The SNMP PDU Scrambler is supported in SNMP Agent Simulator and Network Simulator to customize the request/response SNMP PDU by exposing it to the user for customization. For example, a request SNMP PDU can be customized to validate that it contains multiple varbinds before the agent performs SNMP operation in OIDs. The response SNMP PDU can be customized, for example, to send garbled/invalid responses to test the SNMP managers robustness in the event of receiving bad packets. The level of customization varies depending on your requirement.

Common test scenarios that can be setup using the SNMP PDU Scrambler

Some of the common test scenarios that can be setup using the PDU scrambler functionality is given below:

Customize the SNMP PDU to send garbled/error responses

The PDU scrambler enables customizing the request/response PDU to send error responses.The setErrorIndexAndErrorStatus() in the PDU scrambler can be used to customize the SNMP PDU to send error responses.

Validate the request before performing SNMP operations

A request SNMP PDU can be customized, for example, to validate that it contains multiple varbinds before the agent performs SNMP operation in OIDs. The level of customization varies depending on your requirement. The method processRequestPDU( ) in the PDU scrambler is used to customize the request PDU.

It is also possible to simulate that the SNMP response packet is lost in the network, and the simulator does not process the request. If the incoming request PDU is invalid, the updateErrStatAndTerminate() is updated with the proper error status and error index values. In this case, the simulator will resend the incoming PDU as 'responsePDU' without modifying the MIB variables.

Drop PDU based on the incoming request

Updates the response PDU with proper error status and error index values, if invalid and send a error response to the manager.

Achieve global latency

To achieve global delay in response for SNMP requests, the Thread.sleep() method must be called inside the processResponsePDU() of the PDU scrambler. When a query is send from the manager, the response will be delayed with the specified time.

Achieve latency for a specific range of device

To achieve latency for a specific range of devices in the network, the incoming IPv4 or IPv6 Address can be obtained by calling the snmpPdu.getIPAddress() method. If the incoming IP Address is within the specified range, the Thread.sleep() method can be called.