Simulation Toolkit's Behavior Simulation feature offers powerful built-in SNMP script APIs and RMI client APIs to automate a complete network environment. For example, you can start and stop individual devices in the network at runtime, schedule network state that change SNMP variables, add/delete rows dynamically, update node values, change interface status, generate SNMP v1,v2c,v3 traps/inform messages, create error conditions and scenarios, make agents stop responding to SNMP requests etc.
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 add SNMP devices to an existing network
The script api method addSnmpAgent() can be used to add SNMP agents to an existing network. The new device is added to the currently selected network using the devices present in the device tree.
To delete SNMP devices from the existing network
This can be achieved by using the deleteSnmpAgent() method with the specified IPAddress and Port. The device will be deleted from the currently selected network .
To configure and send traps in bulk, for thousands of agents
This can be achieved by using the sendTrap() method. This method takes the agent IPv4 or IPv6 Address and port number as parameters. Using this method you can write your script file to send traps for any number of agents.
To send link-up/link-down trap each time there is a get on the ifAdmiStatus 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 start/stop agents
Start/stop any agent in the network by configuring scripts with startAgent() and stopAgent() methods.
To start/stop TFTP Server
Start and stop TFTP server at runtime by configuring with startTFTPServer() and stopTFTPServer() methods.
To upload/download Files using TFTP
Each device in the network supports TFTP client and server. You can upload files from the TFTP client to the server or download files from the TFTP server to the client by using the script methods uploadFile() and downloadFile().
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
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.
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.
To simulate short downed, medium downed and long downed agents
Simulation of Short Downed, Medium Downed and Long Downed agents can be achieved by configuring "Behavior Timer scripts" with the stopAgent() and startAgent() methods. The stopAgent() will self terminate the agent that is running at a specific IPv4 or IPv6 address for a specific period of time and the start Agent() will restart the agents after the specific period of time.