- 18 Oct 2024
-
DarkLight
-
PDF
Assign Network & IP (Infoblox) - Transformation
- Updated on 18 Oct 2024
-
DarkLight
-
PDF
Next, we’ll take the sample data from our JSON Form and use it to build a Transformation that will break out the individual variables needed in our workflow.
Transformation Video
Step 1
From Automation Studio, click the + to open the Create window.
Step 2
From the dropdown, select Transformation. Name the Transformation Lab – Assign Network and IP – Infoblox JST – XX and click Create.
Step 3
The canvas loads with a lot of empty space. If you would like to remove extra space, you can do so by hovering your cursor near the top of the canvas and selecting the trash can icon. You can also add space to your canvas by hovering your cursor near the top of the canvas and selecting the plus icon.
Step 4
As you can see, we have Incoming Schemas and Outgoing Schemas. These schemas define how data will look before and after it is manipulated. Let’s start by creating our Incoming Schema. Hover your cursor over the Add+ button under Incoming Schema and select Incoming Schema. The Add Incoming Schema window will open.
Step 5
The Incoming Schema will be created using the sample data from our JSON Form. Paste the copied data into the window on the right. If you do not have your data copied, it can be found on the resource document. Once pasted, click Infer Schema From Example JSON.
Step 6
IAP will digest the sample JSON data, determine the appropriate data types and create a JSON Schema for it, we just need to add an ID. In line 2 in the “$id” field, enter formData between the double quotes and click Save. The first Incoming Schema has been created.
Step 7
We need to create a second Incoming Schema for the jobId of the automation that we will build and run later in the training. Hover your cursor over the Add+ button and select Incoming Schema.
Step 8
In the Add Incoming Schema window, enter jobId for the “$id” value and string for the “type”. Click Save.
Step 9
We are ready to begin building our Outgoing Schema. Select the half circle to the right of the parentNetwork string of the Incoming Schema and drag a line to the Add+ button under Outgoing Schema. Select Outgoing Schema. An appropriate Outgoing Schema will be generated and connected to the Incoming Schema.
Step 10
Repeat this process to create an Outgoing Schema for the hostname variable of the Incoming Schema.
Step 11
We need to create two more Outgoing Schemas that will be used to connect the remaining data after it is manipulated. From the Add+ menu, select Outgoing Schema.
Step 12
In the Add Outgoing Schema window, enter networkDescription for the “$id” value and string for the “type”. Click Save.
Step 13
Repeat this process to add a fourth Outgoing Schema with string as the type and hostDescription as the ID.
Transformation Video - Part 2
Step 14
Before connecting the remaining Incoming Schema to the newly created Outgoing Schema, we need to transform the data using methods. Methods are low-code drag-and-drop representations of JavaScript methods. The first method we will use is the templateLiteral method. Search for the method and then drag and drop the method onto the canvas. For information about a method, click the i icon next to the method name to open the JavaScript documentation. Here, you will find a description of the method, as well as its parameters and example configurations.
Step 15
To add the template parameters to the method, click the edit icon. In the Edit Template Literal window, copy and paste the data and click Update. The methods parameters have been created.
${reservationType} - ${hostname} - ${jobId}
Step 16
From the formData Incoming Schema, connect the reservationType variable to the corresponding parameter of the templateLiteral method.
Step 17
Connect the hostname variable of the Incoming Schema to the corresponding parameter of the templateLiteral method.
Step 18
Connect the jobId Incoming Schema to the jobId parameter of the templateLiteral method.
Step 19
Connect the Return of the templateLiteral method to the networkDescription Outgoing Schema.
Step 20
Add a concat string method to the canvas, which will concatenate the string arguments and return a new string.
Step 21
Connect the reservationType Incoming Schema to the str parameter of the concat method.
Step 22
Enter a dash (-) in the str2 parameter of the concat method.
Step 23
Connect the jobId Incoming Schema to the strN parameter of the concat method.
Step 24
Connect the return of the concat method to the hostDescription Outgoing Schema.
Step 25
The Transformation is complete. Click Save.
Step 26
To preview the format of the outgoing data, click the Run button.
The Run Transformation window is populated with the example formData used to create the Incoming Schema, we just need to add an example jobId.
Step 27
Replace the null value with any example ID and click Run. The output will display at the bottom of the screen. Review the output.