VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc...

29
© 2020 Spirent Communications 1 VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents Overview ................................................................................................................................................................................. 3 General Information ................................................................................................................................................................ 3 Procedure Arguments (Positional versus Named) ............................................................................................................. 3 Management Interface ........................................................................................................................................................ 4 Device Status and Port Status/Info ................................................................................................................................ 4 Device Properties ........................................................................................................................................................... 7 Layer 1 Switch Interface ................................................................................................................................................... 11 Connect Ports ............................................................................................................................................................... 11 Disconnect Ports .......................................................................................................................................................... 11 Get Connections ........................................................................................................................................................... 12 Layer 2 Switch Interface ................................................................................................................................................... 13 Create VLAN ................................................................................................................................................................ 13 Add Port to VLAN ......................................................................................................................................................... 13 Remove Port from VLAN .............................................................................................................................................. 14 Destroy VLAN ............................................................................................................................................................... 14 Configurable Interface ...................................................................................................................................................... 15 Set Configuration .......................................................................................................................................................... 15 Set Image ..................................................................................................................................................................... 15 Get Configuration ......................................................................................................................................................... 16 Get Image ..................................................................................................................................................................... 16 Set Account Password ................................................................................................................................................. 17 Configurable Layer 1 Switch Interface .............................................................................................................................. 17 Configurable Layer 2 Switch Interface .............................................................................................................................. 17 Package Structure ................................................................................................................................................................. 18 manifest.xml ...................................................................................................................................................................... 18 Usage of the "Optional” attribute of a property ................................................................................................................. 20 Creating a driver for your device ........................................................................................................................................... 21 The testcase ................................................................................................................................................................. 21 The manifest file ........................................................................................................................................................... 22 Manifest requirements ...................................................................................................................................................... 23 Resource properties.......................................................................................................................................................... 23

Transcript of VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc...

Page 1: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 1

VELOCITY Resource Driver Reference DOC10679 (KB Doc ID)

Contents Overview ................................................................................................................................................................................. 3 General Information ................................................................................................................................................................ 3

Procedure Arguments (Positional versus Named) ............................................................................................................. 3 Management Interface ........................................................................................................................................................ 4

Device Status and Port Status/Info ................................................................................................................................ 4 Device Properties ........................................................................................................................................................... 7

Layer 1 Switch Interface ................................................................................................................................................... 11 Connect Ports ............................................................................................................................................................... 11 Disconnect Ports .......................................................................................................................................................... 11 Get Connections ........................................................................................................................................................... 12

Layer 2 Switch Interface ................................................................................................................................................... 13 Create VLAN ................................................................................................................................................................ 13 Add Port to VLAN ......................................................................................................................................................... 13 Remove Port from VLAN .............................................................................................................................................. 14 Destroy VLAN ............................................................................................................................................................... 14

Configurable Interface ...................................................................................................................................................... 15 Set Configuration .......................................................................................................................................................... 15 Set Image ..................................................................................................................................................................... 15 Get Configuration ......................................................................................................................................................... 16 Get Image ..................................................................................................................................................................... 16 Set Account Password ................................................................................................................................................. 17

Configurable Layer 1 Switch Interface .............................................................................................................................. 17 Configurable Layer 2 Switch Interface .............................................................................................................................. 17

Package Structure ................................................................................................................................................................. 18 manifest.xml ...................................................................................................................................................................... 18 Usage of the "Optional” attribute of a property ................................................................................................................. 20

Creating a driver for your device ........................................................................................................................................... 21 The testcase ................................................................................................................................................................. 21 The manifest file ........................................................................................................................................................... 22

Manifest requirements ...................................................................................................................................................... 23 Resource properties.......................................................................................................................................................... 23

Page 2: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 2

Port properties .................................................................................................................................................................. 23 iTest drivers .................................................................................................................................................................. 23 Script drivers ................................................................................................................................................................. 24 Special character substitution ...................................................................................................................................... 24

Procedures and arguments .............................................................................................................................................. 25 iTest drivers .................................................................................................................................................................. 25 Script drivers ................................................................................................................................................................. 25

Drivers delivered within Velocity GA releases .................................................................................................................. 26 MRV driver .................................................................................................................................................................... 26 Calient driver ................................................................................................................................................................ 26 NetScout driver ............................................................................................................................................................. 27 Cisco driver ................................................................................................................................................................... 28 Polatis driver ................................................................................................................................................................. 28 Lepton Systems ColdFusion driver .............................................................................................................................. 28 SNMP driver ................................................................................................................................................................. 29 Ping6 Drivers ................................................................................................................................................................ 29 Ping Drivers .................................................................................................................................................................. 29

Page 3: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 3

Overview The resource driver for a device enables Velocity to communicate with a device when gathering information about the device or while configuring the device for a reservation. A driver is defined by the files that make up its driver package (described below). This document describes drivers, driver packaging, and how to implement drivers using iTest.

General Information A resource driver is a library that provides procedures that the Velocity server can call to perform certain operations with resources. The driver library of procedures is not a Java API library; however it supports Python library. The driver runs on an agent.

A resource driver is usually an iTest test case or a Python script with procedures that conform to the interfaces that are defined in the sections below. It is easy to add procedures to an iTest test case. iTest procedures support input arguments as well as return values. The Velocity server supplies the argument values and uses the return value from the procedure call.

A procedure can be called with zero or more positional or named arguments. A procedure should always return a value (the value may be an empty string). A procedure can also interrupt abnormally (with exception), in which case driver should provide an appropriate error message. A driver always implements some interface, that is, it provides a pre-defined set of procedures. For Velocity to know what to do with the driver, interfaces are necessary.

Procedure Arguments (Positional versus Named) Velocity can pass either positional (ordered) or named arguments to the agent upon driver execution. When the 'supportCustomArguments' tag:

<supportCustomArguments>true</supportCustomArguments>

is present in the driver package's manifest.xml file with value true, Velocity will pass named arguments to the agent upon driver execution. For example:

addToVlan -vlanId 200 -portNumber port4 -tagging untagged

When the 'supportCustomArguments' tag is not present (or defined with value false ) in the driver package's manifest.xml file, Velocity will pass positional arguments to the agent upon driver execution. For example:

addToVlan 200 port4 untagged

For Velocity to pass custom arguments/values for user defined connections in a topology, the 'supportCustomArguments' tag must be present within the driver package's manifest.xml file. In this case, all arguments passed to the agent will be in the form of named arguments. For example, if a topology that uses a user defined L2 connection including a custom argument called reserved_bandwidth may call the agent with the following procedural syntax:

addToVlan -vlanId 200 -portNumber port4 -tagging untagged -reserved_bandwidth 1000

Page 4: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 4

Each custom argument/value defined in a user defined connection is appended to the procedure call. From the example above, if the user defined L2 connection included two custom arguments, one for reserved bandwidth and the other for port channel, the following procedure syntax may be called:

addToVlan -vlanId 200 -portNumber port4 -tagging untagged -reserved_bandwidth 1000 -port_channel 10

Management Interface Velocity defines a management interface. The interface provides general information about devices. The interface is used, for example, when gathering online/offline information about a device or port for the Daily Inventory Status report. Management interface procedures with their arguments and return values are listed below.

Device Status and Port Status/Info

Name getPorts

Description

Returns information about device ports and their properties.

This method is also used to determine whether the device is online. If this call ends up with an error, the device is considered offline. Otherwise, the device is considered online.

Arguments none

Page 5: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 5

Returns

JSON string of the format shown here. name and status fields for each port are required.

The optional container field tells Velocity which slot (or other kind of group) the port belongs to. Slash ('/') character represents port group hierarchy.

The optional properties field contains available properties of the port. Each property has name and value.

If driver does support port retrieval, it will simply check the device status and return an empty list here.

{

"ports": [

{ "name": "1.1.1",

"status": "online",

"container": "Chassis 1/Blade 1"

"properties": {

"ipAddress": "10.0.1.2",

"macAddress": "AA:BB:CC:DD:EE:01",

... // other properties

}

},

{ "name": "1.2.2",

"status": "offline",

"container": "Blade 2",

"properties": {

"ipAddress": "10.0.1.3",

"macAddress": "AA:BB:CC:DD:EE:02",

... // other properties

}

},

... // other ports

] }

Note:

Example of GUI effects on status from getPorts:

{"name": "Fa1/0/23","status": "offline"},

{"name": "Fa1/0/24","status": "online"},

{"name": "Gi1/0/1" ,"status": "offline"},

{"name": "Gi1/0/2" ,"status": "offline"}

Page 6: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 6

The port Fa1/0/24 will be marked as online and the ports with status offline will be displayed as no link.

Page 7: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 7

Device Properties

getProperties

Name getProperties

Description Returns available properties of the device. Each property has name and value.

Arguments

• includePorts - If true, getPorts output will also be included into returned JSON

Positional / named argument examples:

getProperties true

getProperties -includePorts true

Returns

JSON string of the following format: object with properties, which are device properties. Example:

{

"properties": {

"physicalClass": "chassis",

"manufacturerName": "Cisco",

"modelName": "CISCO1841",

"productFamily": "chassis",

"prouctId": ".1.3.6.1.4.1.9.12.3.1.3.450",

"versionHardware": "V05 ",

"numberSlots": "4",

"numberPorts": "7",

... // other properties

},

// the following section presents, only if the includePorts argument is true

"ports": [

... // same format as in getPorts method

]

}

Page 8: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 8

getPropertiesInBulk

Name getPropertiesInBulk

Description When a driver manifest file includes the node isBulkSupported with a value set to "true", Velocity presents a boolean flag on that driver's page to enable/disable "Real-time Mode".

• When enabled, Velocity will utilize the getPropertiesInBulk procedure in that driver for bulk polling, detecting the online/offline status of an entire group of resources at once.

• When disabled, Velocity will utilize getPorts in that driver for polling on each individual resource associated with that driver.

In addition, when enabled, Velocity uses this procedure to refresh resource and port status of a group of resources at the interval set in the Velocity VM configuration.

Arguments The procedure will receive two input arguments: includePorts (boolean) and resourceArray (json array). The contents of the resourceArray will include all the properties specified in the driver's manifest file. In the example below, the driver's manifest file called for ipAddress, Hostname, SSH_Username, and SSH_Password as needed "resourceProperties", so the resourceArray input argument may appear as follows. {

"uuid": "b42a7f86-b33d-43b5-bb64-65c0811afea2",

"ipAddress": "10.1.1.1",

"Hostname" : "r1.spirenteng.com",

"SSH_Username" : "guest",

"SSH_Password" : "GXnxR9L9p7E="

},

{

"uuid": "b42a7f86-b33d-43b5-bb64-65c0811afea2",

"ipAddress": "10.1.1.2",

"Hostname" : "r2.spirenteng.com",

"SSH_Username" : "admin",

"SSH_Password" : "voDd0TwFXNY="

}

]

Below is an example of named arguments:

getPropertiesInBulk -includePorts true -resourceArray "[ { "uuid": "b42a7f86-b33d-43b5-bb64-65c0811afea2", "ipAddress": "10.1.1.1", "Hostname" : "r1.spirenteng.com", "SSH_Username" : "guest", "SSH_Password" : "GXnxR9L9p7E=" }, { "uuid": "b42a7f86-b33d-43b5-bb64- 65c0811afea2", "ipAddress": "10.1.1.2", "Hostname" : "r2.spirenteng.com", "SSH_Username" : "admin", "SSH_Password" : "voDd0TwFXNY=" } ]"

Page 9: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 9

Returns The getPropertiesInBulk procedure will return a json array of objects containing data for each resource.

• uuid - resource ID • status - resource status (online/offline) • properties - object with resource property • ports - array with ports (when the procedure was called with includePorts=true)

Format of port array is the same as in getPorts procedure.

For example, the driver may return:

[

{

"uuid": "b42a7f86-b33d-43b5-bb64-65c0811afea2",

"status": "online",

"properties": {

"Hostname": "r1.spirenteng.com",

"Kernel_Release": "4.15.0-46-generic"

},

"ports": [

{

"container": "ports",

"name": "eth0",

"status": "online"

}

]

},

{

"uuid": "40a5b5b3-7718-4ab2-8a3a-2c003840512c",

"status": "online",

"properties": {

"Hostname": "r2.spirenteng.com",

"Kernel_Release": "4.16.0-46-generic"

},

"ports": [

{

"container": "ports",

"name": "eth0",

"status": "offline"

}

]

}

]

Page 10: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 10

portTemplate

Name portTemplate

Description Velocity supports configuration of portTemplate property in the driver manifest file, which allows you to specify a custom port template name to be used as templates for ports of resources during discovery. These rules apply for using the value defined in portTemplate property to be used as the template for port during discovery: • portTemplate property value contains the custom template name defined in the Driver

Manifest file. • portTemplate is not case-sensitive, for example, if the template name network port is

defined in the manifest file then Network Port template will be used as the template for ports discovered.

• Only one portTemplate value is defined in the manifest file.

Example portTemplate definition in the Driver Manifest to specify a custom port template name: <resourceDriver>

<manifestVersion>1.4</manifestVersion>

<version>2.0.0</version>

<vendor>Spirent</vendor>

<language>itest</language>

<interface>Management</interface>

<entryPoint>ping-2.1.0.fftc</entryPoint>

<isBulkSupported>true</isBulkSupported>

<portTemplate>My Custom Network Port</portTemplate>

...

Note: The default port template name will be used if the portTemplate property is not defined in the Driver Manifest file.

Page 11: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 11

Layer 1 Switch Interface Drivers that implement this interface must implement the Management interface as well. The Layer 1 Switch Interface allows Velocity to manage connections between ports -- necessary for topology activation. We use the term "connection" to indicate that network packets can go from one port to another. In MRV terminology, a connection is a mapping. A connection may be unidirectional or bidirectional.

Connect Ports

Name connect

Arguments

• firstPort - the portNumber property of the first port to connect • secondPort - the portNumber property of the second port to connect • direction: to, bidir - based on the connection direction defined in the topology

Positional / named argument examples:

connect port3 port2 bidir

connect -firstPort port3 -secondPort port2 -direction bidir

Description Creates a connection between the specified ports: "first port, second port, to/bidir".

Does nothing if the connection already exists.

Returns nothing

Disconnect Ports

Name disconnect

Arguments

• firstPort - the portNumber property of the first port to disconnect • secondPort - the portNumber property of the second port to disconnect • direction: to, bidir - based on the connection direction defined in the topology

Positional / named argument examples:

disconnect port3 port2 bidir

disconnect -firstPort port3 -secondPort port2 -direction bidir

Description Destroys connection between the specified ports. Does nothing if the connection does not exist.

Returns nothing

Page 12: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 12

Get Connections

Name getConnections

Arguments none

Description Returns a list of all currently connected ports

Returns

JSON string of the following format.

{

"connections": [

{ "port1": "1.1.1",

"port2": "1.1.2",

"type": "to"

},

{ "port1": "1.1.5",

"port2": "1.1.6",

"type": "to"

},

{ "port1": "1.1.11",

"port2": "1.1.12",

"type": "bidir"

},

... // other connections

]

}

Page 13: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 13

Layer 2 Switch Interface Like L1 drivers, L2 drivers implement the Management interface as well. The L2 Interface allows Velocity to manage VLANs -- necessary for reserving topologies with Layer 2 links.

Create VLAN

Name createVlan

Arguments

• vlanId (integer value) - the VLAN instance to create on the L2 switch

Positional / named argument examples:

createVlan 200

createVlan -vlanId 200

Description Creates an empty VLAN with the specified ID

Returns nothing

Add Port to VLAN

Name addToVlan

Arguments

• vlanId (integer value) - the VLAN instance to modify on the L2 switch • portNumber - the portNumber property of the L2 switch port • tagging: tagged, untagged - based on the VLAN connection setting in the topology or implicitly

set for L2 switch inter-connects

Positional / named argument examples:

addToVlan 200 port4 untagged

addToVlan -vlanId 200 -portNumber port4 -tagging untagged

Description

Adds the specified port to the specified VLAN. The tagging argument indicates desired traffic tagging status, i. e. should the traffic going from the port be tagged or untagged. See IEEE 802.1q standard for more information.

Velocity always calls createVlan before adding ports to the VLAN.

Returns nothing

Page 14: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 14

Remove Port from VLAN

Name removeFromVlan

Arguments

• vlanId (integer value) - the VLAN instance to modify on the L2 switch • portNumber - the portNumber property of the L2 switch port • tagging: tagged, untagged - based on the VLAN connection setting in the topology or implicitly

set for L2 switch inter-connects

Positional / named argument examples:

removeFromVlan 200 port4 untagged

removeFromVlan -vlanId 200 -portNumber port4 -tagging untagged

Description

Removes the specified port from the specified VLAN. The tagging argument should have the same value it has when the specified port was added by addToVlan command.

In case there are no ports reserved with the specified VLAN, after removing the last port Velocity calls destroyVlan.

Returns nothing

Destroy VLAN

Name destroyVlan

Arguments

• vlanId (integer value) - the VLAN instance to modify on the L2 switch

Positional / named argument examples:

destroyVlan 200

destroyVlan -vlanId 200

Description

Removes the VLAN with the specified ID. After destruction, the VLAN's ID is considered unused and may be used for future reservations.

Important:

All the ports must be removed from the specified VLAN before calling this method – it is not sufficient to call the "no vlan <ID>" CLI command on a Cisco Catalyst switch, because the command merely disables a VLAN. After the VLAN is enabled again, all of its ports will still exist.

Returns nothing

Page 15: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 15

Configurable Interface This interface provides procedures to upload necessary configuration and/or a binary image. Drivers that implement the interface must implement the Management interface as well.

Set Configuration

Name setConfig

Description Sets the resource's configuration using a specified configuration file

Arguments

• fileSize - length of file in bytes • url - configuration file URL

Positional / named argument examples:

setConfig 0 tftp://10.1.1.1/config.txt

setConfig -fileSize 0 -url tftp://10.1.1.1/config.txt

Returns nothing

Set Image

Name setImage

Description Sets the resource's software image using a specified image file

Arguments

• fileSize - length of file in bytes • url - image file URL

Positional / named argument examples:

setImage 0 tftp://10.1.1.1/image.bin

setImage -fileSize 0 -url tftp://10.1.1.1/image.bin

Returns nothing

Page 16: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 16

Get Configuration

Name getConfig

Description Uploads the resource's configuration file to a URL provided

Arguments

• url - target URL for the configuration file

Positional / named argument examples:

getConfig tftp://10.1.1.1/config.txt

getConfig -url tftp://10.1.1.1/config.txt

Returns file size in bytes

Get Image

Name getImage

Description Uploads the resource's image file to a URL provided

Arguments

• url - target URL for the image file

Positional / named argument examples:

getImage tftp://10.1.1.1/image.bin

getImage -url tftp://10.1.1.1/image.bin

Returns file size in bytes

Page 17: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 17

Set Account Password

Name setAccountPassword

Description Sets account's password on a resource

Arguments

• user • password

Positional / named argument examples:

setAccountPassword foo bar

setAccountPassword -user foo -password bar

Returns nothing

Configurable Layer 1 Switch Interface Combination of Layer 1 Switch and Configurable interfaces. It has procedures from both interfaces.

Configurable Layer 2 Switch Interface Combination of Layer 2 Switch and Configurable interfaces. It has procedures from both interfaces.

Page 18: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 18

Package Structure A resource driver package is an iTar archive. A file named manifest.xml must be located at the archive root. Everything else is optional and/or depends on a particular language, agent, and so on. (. zip files are supported but deprecated)

manifest.xml manifest.xml

<resourceDriver>

<!-- Manifest's version, must be 1.4 -->

<manifestVersion>1.4</manifestVersion>

<!-- Driver's version -->

<version>1.1.0</version>

<!-- Driver's vendor -->

<vendor>Spirent</vendor>

<!-- The driver's language. This value will be used to find appropriate agent to execute the driver's procedures -->

<language>itest</language>

<!-- When the tag below is present, Velocity will pass named arguments for driver calls instead of positional. This tag is required to support custom arguments for user defined connection types -->

<supportCustomArguments></supportCustomArguments>

<!-- Interface this driver implements. Options, which are supported currently: "Management", "Layer 1 Switch", "Layer 2 Switch", "Configurable", "Configurable Layer 1 Switch", "Configurable Layer 2 Switch" -->

<interface>Layer 1 Switch</interface>

<!-- Network port template that will be used as base template for discovered ports.

Optional, when not specified the Network Port template will be used. The template name is case-insensitive. -->

<portTemplate>My Custom Network Port</portTemplate>

<!-- Entry point for this driver.

It is a file inside of the driver's package, which will be executed by an agent.

Other files from the package will be loaded as assets. -->

<entryPoint>mrv.fftc</entryPoint>

Page 19: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 19

<!-- Resource properties, which are required by this driver.

When the driver is attached to a template or a resource, Velocity makes sure, that these properties are present.

-->

<resourceProperties>

<property>

<!-- Property name.

Template or resource, to which this driver is attached, must have a property with the same name.

-->

<name>ipAddress</name>

<!-- Human-readable property description.

This is necessary to be able to provide a way to resolve properties manually, when a driver is attached to template/resource

(we could need it, since a template may have properties with same names as driver require, but different meanings).

-->

<description>IP address of the remote device</description>

</property>

<!-- You can use "optional" attribute for property to specify that property is not required. -->

<property optional="true">

<name>Hostname</name>

<description>Hostname of the remote device</description>

</property>

<!-- Other properties -->

</resourceProperties>

<!--

Port properties (optional manifest section).

Specifies a set of port properties which will be passed to the driver invocation as parameters

for each port which appears in connect/disconnect/addToVlan/removeFromVlan commands.

-->

<portProperties>

<property>

<name>Port Type</name>

Page 20: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 20

<description>Example: Ethernet, Fast Ethernet, etc.</description>

</property>

<!-- You can use "optional" attribute for property to specify that property is not required. -->

<property optional="true">

<name>Port Speed</name>

<description>Unit of Measure: Mbps</description>

</property>

<!-- Other properties -->

</portProperties>

</resourceDriver>

Usage of the "Optional” attribute of a property How does Velocity use this attribute?

• When "optional" attribute is true: Indicates that the property is not mandatory for driver function. The resource may not have the property defined or its value can be empty. The property value is passed to the driver only when the value is not empty.

• When "optional" attribute is not present or false: Indicates that the property is mandatory for driver function. The resource must have the property defined and its value cannot be empty. The property value is passed to the driver at execution.

Note: The mandatory resource property must be defined in the resource’s template and the resource’s property value cannot be empty. Unless the property exists and is not empty, the driver execution does not start and an error is displayed.

The following examples lists when the property is mandatory:

• The property does not have the optional attribute (indicates a mandatory property). • The optional attribute is marked false (indicates a mandatory property). • In either case above, Velocity does not attempt driver execution. The property is required and because of

that, the driver execution will not start.

Page 21: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 21

Creating a driver for your device A driver package for Velocity is an iTar archive with a root that contains one simple XML manifest file (required) and one iTest test case (optional, but nearly always included) and sometimes additional support files. (.zip files are supported but deprecated)

The testcase

You build the test case by using iTest to capture your interaction with the device and then converting the captured items into a test case. To simplify the process of developing the test case, we recommend that you use one of the test cases that is included in the one of the drivers that ships with Velocity as a stub for your work. Depending on whether positional or named arguments are used, the call step should separate the procedure name and its arguments (in the case of positional arguments) or call the entire procedure with arguments as a single string (in the case of named arguments):

Positional Arguments Driver Example Named Arguments Driver Example

In order to force field substitution for a call step (as in the named arguments example), the FFTC file needs to be edited manually, enabling field substitution for the the call step.

Page 22: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 22

For example:

<item guid="9b8620ae-ae52-4ab2-8390-9b3d533a4f1e" action="call">

<command>

<body>[param call_$i]</body>

</command>

<applicationProperties type="com.fnfr.svt.documents.EmptyPropertyGroup"/>

<useFieldsInCommand>true</useFieldsInCommand>

</item>

The manifest file

Use a built-in manifest file (mrv-1.3.0 in our example) as a stub. Replace the values of <interface>, <entryPoint> and other elements as needed. Here is the full text of manifest.xml (comments removed). Properties are provided as test case parameters with prefix "property_". In our example, the ipAddress property appears as the property_ipAddress parameter in the test case.

<?xml version="1.0" encoding="UTF-8"?> <resourceDriver> <manifestVersion>1.4</manifestVersion> <version>1.3.0</version> <vendor>Spirent</vendor> <language>itest</language> <interface>Layer 1 Switch</interface> <entryPoint>mrv-1.3.0.fftc</entryPoint> <resourceProperties> <property> <name>ipAddress</name> <description>IP address of the remote device</description> </property> <property> <name>username</name> <description>username to login via SSH</description> </property> <property> <name>password</name> <description>password to login via SSH</description> </property> </resourceProperties> </resourceDriver>

Page 23: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 23

Manifest requirements • language must be itest • entryPoint must be an iTest test case (a .fftc file). The test case must have a main procedure.

Resource properties All of the resource properties are described in the driver's manifest. Properties are provided as test case parameters with the prefix "property_".

In our example, the ipAddress property in the mrv-1.3.0 manifest is the property_ipAddress parameter in the test case.

Port properties Specifies a set of port properties which will be passed to the driver invocation as parameters for each port which appears in connect / disconnect / addToVlan / removeFromVlan commands.

Example:

Driver has 2 commands: connect 1.1.1 1.1.2 and connect 1.1.3 1.1.4

Declared port properties for 1.1.1, 1.1.2, 1.1.3, 1.1.4 will be passed to the driver.

iTest drivers

For iTest drivers port properties are passed as nested parameters. The parent parameter will represent the port ID (e.g. the name of this parameter is "port_<portNumber>"), and its children will be port properties (e.g. "property_<propertyName>").

Example:

• port_<portNumber1> o property_<propertyName1> = (some value) o ... o property_<propertyNameM> = (some value)

• ... • port_<portNumberN>

o property_<propertyName1> = (some value) o ... o property_<propertyNameM> = (some value)

Page 24: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 24

Script drivers

For script drivers port properties are passed as JSON string, where key is property name and value is corresponding property value.

Example:

• port_<portNumber1> = {"property_<propertyName1>": "(some value)", ..., "property_<propertyNameM>": "(some value)"}

• ... • port_<portNumber2> = {"property_<propertyName1>": "(some value)", ...,

"property_<propertyNameM>": "(some value)"}

Special character substitution

There is a limitation for naming of iTest/script driver parameters. All special characters, for example: [^A-Za-z0-9_] (not alphabet, or not a digit, or not an underscore) should be replaced by an underscore symbol (that is, escape the special chars by underscore symbol).

Examples:

1. If the portNumber is Fa1/1, after escaping it will be Fa1_1

2. if the property name is Port Type, after escaping it will be Port_Type

iTest code snippet (tcl): procedure parameter_escape

eval regsub -all {[^A-Za-z0-9_]} ${arg[1]} "_" ret

return $ret

Python code snippet: import re

def parameter_escape(s):

return re.sub('[^A-Za-z0-9_]', '_', s)

Page 25: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 25

Procedures and arguments Velocity uses test case parameters to provide information about calls it wants to make (procedures and their parameters).

• call_count parameter holds the total number of calls • call_N parameters, where N is an integer, so that 0 <= N < call_count, hold call strings. A call string start

with procedure name and followed by its arguments, separated by spaces.

For example, the following parameters mean that Velocity wants to make three port connections (1.1.1 <-> 1.1.2, 1.1.4 <-> 1.1.7, and 1.1.11 -> 1.1.20) on resource 127.0.0.1

iTest drivers

property_ipAddress = 127.0.0.1

property_username = admin

property_password = admin

call_count = 3

call_0 = connect 1.1.1 1.1.2 bidir

call_1 = connect 1.1.4 1.1.7 bidir

call_2 = connect 1.1.11 1.1.20 to

Script drivers

Agent creates an environment variable for each parameter in the form of VELOCITY_PARAM_name_of_parameter=value. It is the script's responsibility to read the environment variables.

VELOCITY_PARAM_property_ipAddress = 127.0.0.1

VELOCITY_PARAM_property_username = admin

VELOCITY_PARAM_property_password = admin

VELOCITY_PARAM_call_count = 3

VELOCITY_PARAM_call_0 = connect 1.1.1 1.1.2 bidir

VELOCITY_PARAM_call_1 = connect 1.1.4 1.1.7 bidir

VELOCITY_PARAM_call_2 = connect 1.1.11 1.1.20 to

Page 26: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 26

Drivers delivered within Velocity GA releases Administrators can view and edit resource drivers on the Inventory > Drivers page. Descriptions of built-in drivers follow:

MRV driver

This is the default driver for MRV switches. The driver package contains the manifest file and a single test case. We encourage you to use the test case's structure (main procedures and functional procedures) as a stub for implementing drivers for other devices.

The driver implements the Layer 1 Switch interface and requires the following resource properties:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified) • username • password

Calient driver

This is the default driver for Calient switches. The driver package contains the manifest file and a single test case.

The driver implements the Layer 1 Switch interface and requires the following resource properties:

• ipAddress (optional, but if omitted, Hostname must be specified) • Hostname (optional, but if omitted, ipAddress must be specified) • username - SSH username • password - SSH password • calientUsername - TL1 session username • calientPassword – TL1 session password

Note: The Calient driver connects to the switch via an SSH connection using the “username” and “password” credentials. Once the SSH connection is established, the TL1 agent> prompt will appear, and the driver issues the ACT-USER TL1 command to activate the “calientUsername” using its “CalientPassword” password string.

This driver requires the following to be configured on the Calient switch:

• An SSH user account on the Calient switch (the “username” property) o By default, an ssh user named “tl1user” exists on the Calient switch as a factory default, and this ssh user

can be used for the driver’s “username” property. This account requires no password by default, so the “password” property can remain blank.

• A TL1 user account with provisioning access (the “calientUsername” property) o In order to create and remove cross connects, a TL1 account with provisioning access must have been

provisioned on the Calient switch. By default, a TL1 user named “admin” exists on the Calient switch as a factory default and can be used as the “calientUsername”. The default password for admin is “pxc***” and can be used as the “calientPassword” value.

Page 27: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 27

Readiness check

Below is a procedure to ensure that the Calient is ready to be managed by the Velocity driver.

• SSH to the Calient using syntax like: ssh [email protected] o Where tl1user is the ssh username to be used as the “username” property o Where the IP address is the Calient’s IP address or hostname o If necessary, type a password for ssh access (the “password” property) o If this step is successful, the agent> prompt should appear in the terminal

• Activate the user in TL1 with syntax, e.g.,: act-user::admin:::pxc*** o Where admin is the TL1 username (the “calientUsername” property”) o Where pxc*** is the TL1 password (the “calientPassword” value)

If this step is successful, the following response should appear in the terminal:

TL1AGENT 16-12-03 13:45:16

M 0 COMPLD

"admin:admin,2"

/* NOTICE This is a private computer system.

Unauthorized access or use may lead to prosecution. */

Note: If the SSH connection and activate user operations are successful, the Calient driver configured with the appropriate credentials should now auto-discover the Calient ports and allow users to create and delete cross-connects.

NetScout driver

This is the default driver for NetScout (OnPath) switches. The driver package contains the manifest file and a single test case.

The driver implements the Layer 1 Switch interface and requires the following resource properties:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified) • username - console username • password - console password • Protocol (optional, supported values are "SSH" and "Telnet", "SSH" is the default)

Page 28: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 28

Cisco driver

This default Cisco driver works for Cisco Catalyst 3550. Its structure is very similar to MRV, except for L2- and config-specific items. You can use this driver as a stub for implementing other L2 drivers.

The driver implements the Configurable Layer 2 Switch interface and requires the following resource properties:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified) • username • password

The Cisco driver has been tested for models 3750 and 2960.

Polatis driver

This default Polatis driver works for Polatis optical switches using their TL1 command set. Its structure is very similar to Calient.

The driver implements the configurable Layer 1 interface and supports the following properties.

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified) • polatisUsername username for logging onto Polatis TL1 session. • polatisPassword password for logging onto Polatis TL1 session. • TL1 Port port through which TL1 sessions are connected. Default 3082. • Port Group Size size of port groups. Default is 8. Polatis has no natural port grouping (like blade or chassis). This

number allows the driver to group the ports. If this number does not evenly divide the total number of ports the last port groups contains remaining ports and is less than this size.

The Polatis driver was developed against an emulator supplied by Polatis.

Lepton Systems ColdFusion driver

This is the default driver for ColdFusion switches. The driver package contains the manifest file and a single test case.

The driver implements the Layer 1 Switch interface and requires the following resource properties:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified) • username - console username (required) • password - console password (required) • Protocol (required, supported values are "HTTP" and "HTTPS") • Port Modeling (required, "Lanes 1-4: Performance Mode" is the default)

Supported values: + Lanes 1-4: Performance Mode + Lane 1: Density Mode + Lane 2: Density Mode

Page 29: VELOCITY Resource Driver Reference (Latest) · VELOCITY Resource Driver Reference DOC10679 (KB Doc ID) Contents . ... It is easy to add procedures to an iTest test case. iTest procedures

© 2020 Spirent Communications 29

+ Lane 3: Density Mode + Lane 4: Density Mode

Port modeling influences the way the ColdFusion switch is discovered and managed.

• Lanes 1-4: Performance Mode o All ports in the switch will be discovered and modeled in card.port notation (i.e. 1.01, 1.02 ... 8.31, 8.32)

• Lane 1: Density Mode o All ports in the switch will be discovered and modeled in card.port:lane notation for lane number 1 (i.e.

1.01:1, 1.02:1 ... 8.31:1, 8.32:1) • Lane 2: Density Mode

o All ports in the switch will be discovered and modeled in card.port:lane notation for lane number 2 (i.e. 1.01:2, 1.02:2 ... 8.31:2, 8.32:2)

• Lane 3: Density Mode o All ports in the switch will be discovered and modeled in card.port:lane notation for lane number 3 (i.e.

1.01:3, 1.02:3 ... 8.31:3, 8.32:3) • Lane 4: Density Mode

o All ports in the switch will be discovered and modeled in card.port:lane notation for lane number 4 (i.e. 1.01:4, 1.02:4 ... 8.31:4, 8.32:4)

SNMP driver

A generic SNMP driver that implements the Management interface and requires the following resource properties:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified) • community

Ping6 Drivers

A generic ICMP driver that implements the Management interface. Can be used only for determine online status of device, port and properties lists always returned empty. The following resource properties requires:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified)

Ping Drivers

A generic ICMP driver that implements the Management interface. Can be used only to determine the online status of device, port and properties lists always returned empty. The following resource properties requires:

• ipAddress (optional, but either ipAddress or Hostname must be specified) • Hostname (optional, but either ipAddress or Hostname must be specified)

It has a node called isBulkSupported in its manifest with a value set to "true" and the getPropertiesInBulk procedure for supporting bulk polling.