Home Simulator Home

Simulation Toolkit's Behavior Simulation feature offers powerful built-in SNMP script APIs and RMI client APIs to automate device behavior. For example, you can add/delete rows dynamically, update node values, change interface status, generate SNMP v1,v2c,v3 traps/inform messages, create error conditions and scenarios.

Common test scenarios that can be setup using the SNMP script APIs and RMI client APIs

Some of the common test scenarios that can be setup using the SNMP script API and RMI client APIs are given below. These simulations can be enabled dynamically without disrupting the simulation process.

To have the node values increased at a certain rate

The script api methods getNodeValue() and updateValue() can be used to have the node values increased at a certain rate. This can be achieved by configuring a timer-based script which will be executed with some predefined time interval (for example, every 10 secs). The method getNodeValue() will get the corresponding node's value and the method updateValue() will update a new value to that node.

To send a trap to NMS on the start/stop of the agent

This can be achieved by configuring timer-based scripts to be executed when the agent starts. The sendTrap() method will send the required trap at agent startup. Similarly you can send a trap to the NMS by calling the sendTrap() method before calling the stopAgent() method.

To send link-up/link-down trap each time there is a get on the ifAdminStatus of a particular instance in the IF-MIB table

This can be achieved by configuring a request-based script with the getNodeValue() and sendTrap() method. The getNodeValue() will get the current value of the ifAdminStatus node and send a linkup/linkdown trap based on the value.

To make addition/deletion to SNMP table rows dynamically, based on other node values

This can be achieved by configuring a request/timer script with the getNodeValue(), insertRow() and deleteRow() methods. The insertRow() method is used to add a row to the table and the deleteRow() method is used to remove an entry from the table. The getRowCount() method can be used to get the total number of rows in the SNMP table.

To change interface status and send traps

The upInterface() can be used to make an interface active and downInterface() can be used to down an active interface and sendTrap() to send traps when the status is changed.

To delay SNMP responses

To achieve delay in SNMP responses, you can configure a script with the following content. Here the value of the Thread.sleep() is in milliseconds and should be greater than the time out value.

from java.lang import Thread
Thread.sleep(1000)

To get the IPaddress of a device

The ipaddress of a device can be retrieved at runtime by using the getIpaddress() method.

To modify rows in bulk

The following script api methods can be used to modify rows in bulk for all instances in the SNMP Table by incrementing a column value. The script can be configured to be executed at agent startup.

scriptinterface.getInstances()
scriptinterface.updateValue()

The scriptinterface.getInstances() method can be used to get the instances of a given table. The scriptinterface.updateValue() can be used to update the values in the table based on the instances.

To check the valid range for device values

To check the valid range for device values that is SET, the scriptinterface.getCurrentValue() can be used to get the value that comes with the 'SET' request. This value can be checked for the specified range and if not within the range specified the scriptinterface.terminateOperation() is called to terminate the SET request.

To add rows to tables

The script method scriptinterface.insertRow() can be used to add new row to SNMP tables, at runtime. The rows can be added in bulk by calling the above method inside a loop.

Also Refer: SNMP PDU Customization

Home Simulator Home Simulation of real time device scenarios via RMI Next