Appendix B: Response Templates Creation Samples
This appendix provides sample operations sequences for defining both text- and table-format Response Templates (RT).
Creating a Text-Format Response Template
Assuming that we have a procedure configuration step containing the ping command
step yielding the output shown in Figure:Step Command Output, for the purpose of our example we are interested in defining a target that represents the icmp_seq value on the interface.
Figure:Step Command Output
To create the Response Template:
Select the target, comprising the text before the actual byte number ( Figure:RegEx Target Selection) and click the Regex target button.Figure:RegEx Target Selection
A FreeFormat region with a contained Regex target is added.
Choose the C1 = [0-9]* regular expression, choose the icmp_seq value for the C1 constant, and select the Repeating Search option to capture all occurrences.As shown in Figure:Regex Target Settings, the target appears highlighted in red in the command output.
Figure:Regex Target Settings
Choose the Save or Save as command to save the Response Template.Eventually, click the OK button to close the Response Template Editor.
Creating a RepeatingBlock Response Template
Given the hypothetical command output shown in Figure:Step Command Output, for the purpose of our example we are interested in defining a target that retrieves the bytes values from each response line.
Figure:Step Command Output
To create the Response Template:
Select the first command response line and click the Mark Repeating Block button. A RepeatingBlock region delimited by the Reply and \n strings is added (Figure:Repeating Block Region Selection).Figure:Repeating Block Region Selection
Choose the C1 = [0-9]* regular expression and choose the bytes value for the C1 constant. The first occurrence of the target within the RepeatingBlock region is selected (Figure:First Occurrence Selection).Figure:First Occurrence Selection
Select the Repeating Search option to capture all target occurrences within the RepeatingBlock region. As shown in Figure:Regex Target Selection and Highlighting, two targets appear highlighted in red in the command output.Figure:Regex Target Selection and Highlighting
In the Value selected field of the Regions pane, for each RepeatingBlock region an entry is displayed comprising two target values enclosed in { and } characters.
Choose the Save or Save as command to save the Response Template.Eventually, click the OK button to close the Response Template Editor.
Creating a Table Format Response Template
Given the procedure configuration step containing the arp -a command step, which yields the output shown in Figure:Command Output, for the purpose of our example we are interested in defining a target that holds a list of all values from the Internet Address column.
Figure:Command Output
To define the Response Template:
Select the table area and click the Mark table area button.In this case, the table area is only a part of the command output (Figure:Table Area Marking).
Figure:Table Area Marking
Select the entire table header row and click the Mark header button. The marking appears as shown in Figure:Table Header Marking.Figure:Table Header Marking
Mark a column header—the Internet Address column for the purpose of our example—and click the Mark full column header button ( Figure:Table Column Marking).Figure:Table Column Marking
As you can notice, the Column_1 target that was added to the Regions pane holds the values of all IP address from the Internet Address column.
Since the Export results option is selected, the IP addresses list is exposed for processing in subsequent steps of theTestComposer script.
Assuming for example, that we assigned an arp_table return variable to the Execute step that is running the arp -a command, we could subsequently use a steps sequence such as the following to obtain the list length and print out its elements:
In the sample code above, at step 4 the l variable is initialized to the dimension (length) of the arp_table.Column_1 list using the Tcl llength function.
Step 5 then prints out the dimension of the list, while step 6 defines a counter i variable that iterates over all arp_table.Column_1 list elements and prints them out at runtime.
IxLoad TestComposer │ User Guide |