Utility Functions¶
duplicate¶
Execute Tester Command ${rt_handle} command=test_control <additional key=value arguments>
- Purpose:
- Scale the configuration with Copies objects. If there is only a single source object, and the source object and destination object are of the same type, the destination object will be copied over by the source object; otherwise, the source objects will be copied under the destination object.
Synopsis:
Note: M indicates the argument is `Mandatory`.
duplicate
src_list= <list of handles> M
repeat_count= <numeric>
dst_list= <list of handles>
Arguments:
src_list
Spirent Extension (for Spirent HLTAPI only). This argument is `Mandatory`.
Specifies the list of source objects to copy from.
repeat_count
`Spirent Extension (for Spirent HLTAPI only).`
Specifies the number to repeat copies to make. The default is 1.
dst_list
`Spirent Extension (for Spirent HLTAPI only).`
Specifies the target object to copy to. If the value is not specified,
the target object will be the parent of the first object in srclist.
Arguments Unsupported by Save as HLTAPI:
All arguments are not supported by Save as HLTAPI
- Return Values:
Depending on the specific language that HLTAPI uses, the function returns a keyed list/dictionary/hash (See Introduction for more information on return value formats) using the following keys (with corresponding data):
status Success (1) or failure (0) of the operation. log An error message (if the operation failed). handles The duplicated objects.
- Description:
The
duplicate
function simulates the configuration operation in Spirent TestCenter GUI like context menu items:Duplicate… Copy/Paste EmulatedDevice… Copy/Paste StreamBlock…When dst_list is not specified, it works as Duplicate… When dst_list is specified with port, it works as Copy/Paste EmulatedDevice… or Copy/Paste StreamBlock…
- Examples:
Sample Input:
::duplicate src_list=$host repeat_count 2
Here is an example of the output for the above sample input function:
{handles {emulateddevice2 emulateddevice3}} {status 1}
End of Procedure Header
fill custom¶
Execute Tester Command ${rt_handle} command=test_control <additional key=value arguments>
- Purpose:
- Scale the configuration with specified copy|increment|decrement|random calculation template on the handles’ specified field values.
Synopsis:
Note: M indicates the argument is `Mandatory`.
fill custom
handles= <list of handles> M
field_type= {ipv4addr|ipv6addr|attached_vtep_addr} M
field_name= <string>
initial= <value> M
type= <increment|copy>
repetition= <integer>
step= <specific value for the field_type>
restriction= <specific value for the field_type>
Arguments:
handles
Spirent Extension (for Spirent HLTAPI only). This argument is `Mandatory`.
Specifies the list of handles to perform the Fill custom operation on their fields.
field_type
Spirent Extension (for Spirent HLTAPI only). This argument is `Mandatory`.
Specifies the type of the field to perform the Fill custom operation
Current possible values are::
name The handle's name
ipv4addr Ipv4 address type
ipv6addr Ipv6 address type
attached_vtep_addr Attached VTEP IP address of VXLAN VM
The default is name.
More type values such as macaddr will be supported in future releases.
field_name
Spirent Extension (for Spirent HLTAPI only).
Specifies the name of the field to perform the Fill custom operation.
field_name value is different for different value of field_type.
For some field_type value, the value of field_name can be skipped
For example::
field_type field_name
name name
(can be skipped, name will be taken by default)
ipv4addr ipv4if.address, ipv4if.gateway
or other Ipv4 address (cannot be skipped)
ipv6addr ipv6if.address or ipv6if.gateway
or other Ipv6 address (cannot be skipped)
attached_vtep_addr attached_vtep_addr (can be skipped)
initial
Spirent Extension (for Spirent HLTAPI only). This argument is `Mandatory`.
Specifies the handle whose field value is used as initial value for fillcustom operation.
type
Spirent Extension (for Spirent HLTAPI only). This argument is `Mandatory`.
Specifies the type of fillcustom operation.
Current possible values are::
copy the field values of handles will be same
as the value of initial handle.
increment the field values of handles will be filled with
incremented calculation value based on the value
of initial handle as initial, and the value of
repetition and -step.
In future release, decrement or random will be supported.
repetition
Spirent Extension (for Spirent HLTAPI only).
Specifies the repetition value between two consecutive field values.
This argument is required when type is increment.
step
Spirent Extension (for Spirent HLTAPI only).
Specifies the value by which the IP address must be stepped.
This argument is required when type is increment.
restriction
Spirent Extension (for Spirent HLTAPI only).
This argument is reserved for future use.
Arguments Unsupported by Save as HLTAPI:
None
- Return Values:
Depending on the specific language that HLTAPI uses, the function returns a keyed list/dictionary/hash (See Introduction for more information on return value formats) using the following keys (with corresponding data):
status Success (1) or failure (0) of the operation. log An error message (if the operation failed).
- Description:
The
fill custom
function enables you to simulate the configuration operations in Spirent TestCenter GUI like context menu items:Copy down… Fill increment… Fill custom…When type is copy, it works as Copy down… When type is increment, -step is x.x.x.1 or others, it works as Fill increment…
- Examples:
Sample Input:
The attached VTEP IP address of VXLAN VM targeted by $devices will be same as that of $host:: ::fill custom handles=$devices field_type attached_vtep_addr -initial $host -type copy The names of devices will be filled with the similar name as $host but in different index like Host 2:: ::fill custom handles=$devices field_type name -initial $host -repetition 1 -step 1 -type increment The ipv4if address or gateway of devices will be filled with the IP address calculated on the IP address of $host:: ::fill custom handles=$devices field_type ipv4addr field_name ipv4if.address -initial $host -repetition 1 -step 0.0.0.1 -type increment ::fill custom handles=$devices field_type ipv4addr field_name ipv4if.gateway -initial $host -repetition 1 -step 0.0.1.0 -type increment
Sample Output:
#On success {status 1} #On failure {status 0} {log {<errorMsg>}}
Note:
To decide the value for field_name, see following example:: fill custom handles=$myhandles field_type ipv4addr field_name ipv4if.address -initial $host -type copy The relationship among the above values of handles, field_name and initial is:: set addr stc::get $host ipv4if.address stc::config (one of $myhandles) ipv4if.address $addr
End of Procedure Header