For
Statement Step in Step Configuration Wizard
A For step executes a loop over a counter variable.
To add a For statement step:
While in the Script Steps pane, add a step by choosing the Actions > Add step... command. Select a For step type, click thebutton to validate the selection, and specify the following parameters:
- Run Type: A For step can only be executed sequentially (Sequentially).
- Delay: A delay specifying by how much step start is delayed. A delay value is automatically set when the step is added using the Capture functionality.
- Timeout: A period of time after which the step execution is considered to have timed out.
- Ignore step: When this option is selected, the step is skipped at execution time. Selecting this option is equivalent to right-clicking a step in the Script Steps table and choosing the Exclude command from the context menu that appears.
- Description: An optional step description can be associated with the step.
Click Next.
Define the Conditional Execution settings as explained below.Conditional Execution settings enable you to define the system conditions a script step execution is monitored for. When such a predefined condition occurs a step error or a step timeout an user-defined procedure is executed and an additional action is performed. For example, on encountering a step error, you could enforce the execution of a cleanup procedure and then terminate the script.
To monitor the step for a predefined Timeout or Error condition, select the corresponding condition, then define the associated procedure local or shared (external) by clicking the
control of the Procedure field and selecting a procedure from the the drop-down pane that appears.
For the selected procedure you can view its defined arguments by clicking the
control of the Input Arguments field, which displays a cascading table-format pane containing the argument list. To specify the actual runtime argument(s) enter the desired values in the Current Value field(s).
Configure an additional action by clicking into additional actions column and selecting either of the following options:
- Continue: After performing the specified procedure, the script execution continues.
- Exit Test: After performing the specified procedure, the script execution is terminated.
Click Next.
Whenever the step execution is monitored for predefined events, an
icon is displayed in the step's corresponding Events selected column entry. For information on turning on the displaying of the Events selected column refer to Customizing the Script Steps Table Layout .
Specify the loop parameters defining how the loop is executed:
- Assign to variable: Defines the loop variable.
- Loop type: Defines the loop type as either of the following:
- Counter: When this type is selected, the variable takes an initial value and loops until the incremented variable reaches an end value.
- Set: When this type is selected, the variable cycles through the discrete values of a set.
- Count from, Count to, Step size: These parameters that are valid only for the Counter loop type represent the loop variable start, final, and step value. Parameters can be defined using either numeric values or
TestComposer variables, selected by clicking a parameter'sbutton and choosing an existing variable from the window that appears
If the value of the Count to parameter is lower than that of the Count from parameter, the increment is considered to have a negative value and the loop executes with a decrementing loop variable.
- Values: This parameters that is valid only for the Set loop type represents the set values that the variable takes.
Click Next.
Verify the step summary information and revert to a previous configuration step if needed. Click Finish.The For statement is added to the steps list. For compound control statements, such as this, the closing pair EndFor statement is also added.
Compound statements comprising both a start and an end instruction are shown as displayed in Figure:Compound Statement Step and can be collapsed by clicking the
: control adjacent to the For statement.
Figure:Compound Statement Step
Examples:
For $count in (1,3,1) //counter loop
RunProcedure (P1)
EndFor
StartSession session1 Telnet,10.205.19.237,23
For $interface in {"eth0", "eth1", "eth3"} //set loop
Execute session1 show interface $interface
EndFor
IxLoad TestComposer │ User Guide |