StepSearch
Statement Step in Step Configuration Wizard
The StepSearch statement returns the loop variable value for the last successful loop, i.e. that of the last iteration whose condition evaluated to `true'.
Such a statement could prove useful, for example, when you want to iterate over a discrete set of values like in the case of a
For statement, but wish to interrupt the iteration once a given condition is no longer met, without going through the remaining values.To add a StepSeach statement step:
While in the Script Steps pane, add a step by choosing the Actions > Add step... command. Select a StepSearch step type, click thebutton to validate the selection, and specify the following parameters:
- Run Type: A While step can only be executed sequentially (Sequential).
- 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 a step.
Click Next.
Specify the loop parameters as follows:
- Assign to variable: A variable that iterates over the search interval values.
- Exit value of loop index: The step return value, which can be either of the following:
- Best: The loop variable value that corresponds to the last successful iteration (condition evaluating to true).
- Last: The loop variable value that corresponds to the last executed iteration (condition evaluating to false) before the command completed execution.
- Initial Value: The loop variable initial value.
- Limit Value: The loop variable end value.
- Step Value: The step value, which can be either a positive or a negative value.
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.
In the Expression Builder GUI define the looping condition by double-clicking in turn the desired Tcl commands and operators, and TestComposer variables. For detailed information on using the Expression Builder and creating Tcl expressions refer to Using the Composer Expression Builder.Click Next.
Verify the step summary information and revert to a previous configuration step if needed. Click Finish.The StepSearch and SearchCondition statements are added to the steps list. For compound control statements, such as this, the closing pair EndStepSearch statement is also added.
Example:
StepSeach Best frameRate in (10 100 10)
Assign fR $frameRate
Configure FrameRateSet ports=(1.1.1) streamno="1"
rate="$fR" rateMode=streamRateModePercentRate
Transmit Start ports=(1.1.1)
fL Get Stat ports=(1.1.2) stats=frameLoss
SearchCondition $fL == 0
EndStepSearch
A single StepSearch statement can be run on multiple chassis ports at once, in which case each of the start, end, step parameters needs defined as a numeric list of values, one per port.
The sample command below illustrates the case of a StepSearch statement that is run on 2 ports:
StepSearch Best fR in ({10 110} {100 10} {10 -10})
...
SearchCondition "[expr $fL1 < 20] [expr $fL2 < 10]"
EndStepSearch
When running the StepSearch command on multiple ports, the following behavior applies:
All parameter lists must have the same number of values.
The command returns a list of values which can be assigned to a simple TestComposer variable.
If all search conditions are `true' and none of the current loop variable values is greater (or smaller for a negative loop step) than the corresponding limit value, the search continues. The search stops when all search conditions become `false', or when all limits are reached.
IxLoad TestComposer │ User Guide |