|
The most important part of simulation is to set up the simulated environment. You can set up the desired environment by defining the behavior of the TL1 Devices, so that they will behave like a real device. The behavior of devices is done through Jython scripts.
The TL1 Agent Simulator provides a scriptinterface, which defines methods to perform various TL1 operations from a JPython script . For example, you can add or delete Access ID, Response Lines and Message Payload to a specific command code, get current Access ID, Message payload values, set acknowledgment and completion code, etc.
The javadocs for the Script API methods is provided under the <SimulatorHome>/examples/javadocs directory. The name of the Script API file is SNMP_TL1_SimScrIntf.html
Enabling / Disabling TL1 Behavior Service
The Network Simulator provides option to enable/disable the execution of behavior scripts configured for the TL1 agents, at agent runtime. If behavior service is disabled, the agent will not check for script configurations before sending the response. Hence , you can use this option to improve the performance of the TL1 agent, if behavior is not required to be executed.
By default, the service is enabled and the behavior scripts configured (if any), will be executed.
To disable the service ,
Select Run-> Initialize Service in Network Designer.
The Initialize Service dialog is displayed.
Deselect "Enable TL1 Behavior service".
Start the Agent. Now, the behavior scripts configured in the simulator, will not be executed.
|
|
Note: The option Operations -> Initialize Service will be disabled when the TL1 agent is started. |
The TL1 agent simulator, supports to configure request based scripts to simulate real time behavior of agents. Scripts can be configured on a Command Code, Command Code - AccessID or Command Code - AccessId - MessagePayload combination.
The configured scripts will be copied to the configuration directory. It will be executed at run time, when a request is made for the command, before and/or after processing the request.
Follow the steps given below, to configure scripts :
Select Configure -> Behavior Simulation. The Script Table dialog is invoked . This dialog displays the scripts that are already configured.
Click Add, to configure a new script. The Configure Script dialog is invoked. This dialog displays the TCS tree on the left-frame. Expand the TCS tree.
You have the option to configure the script file at the following levels.
To configure script for a command code, select the required command code.
To configure script for a Command code - AccessID combination,
Select the required command code. The Access ID configured for the selected command is displayed on the right-frame.
Select the required Access Id.
To configure script for a Command code - Access ID - Message Pay load combination,
Select the required command code. The Access ID configured for the selected command is displayed on the right-frame.
Select the required Access Id. Selecting the AccessID, will display the Message Payload configured.
Select the required Message Payload.
Specify the condition to execute the script. The following options are available:
Before processing request
After processing request
Before and after processing request
Browse and select the script file to be configured. The example scripts are available under < simulator home >/examples/scripting/tl1 directory. Click Open to configure the script file.
Click OK to add the script configuration in the Script Table .
Click Close to exit the dialog.
The following sample scripts are defined in the <simulator home>/examples/scripting/tl1 directory. A brief overview on each of the script file is provided below. The javadocs for the Script API methods is provided under the <SimulatorHome>/examples/javadocs directory. The name of the Script API file is SNMP_TL1_SimScrIntf.html
1. AddAccessID.py
The script file AddAccessID.py uses the method addAccessID( ) to add a new AID value to the Command Code, at agent run time. This method takes the Command code and AccessId as its parameters .
Format :
|
scriptinterface.addAccessId("ED-FAC","ST1-9-1"); |
When this script is executed, the AID value ST1-9-1 is added for the command code ED-FAC. You can replace the sample command code and AID values with your own configuration.
2. AddLines.py
The script file AddLines.py uses the method addLines( ) to Add Response Lines to the Command Code at agent run time. This method takes the following parameters as input:
commandCode - is the CommandCode present in the agent.
accessId - is the accessId corresponding to the commandCode.
msgPayLoad - is the MessagePayLoad corresponding to the accessId.
isValid - is a boolean representing whether the line is to be added for a valid response/error response.
lineType - represents whether the line is quoted/unquoted.
paramNames - is the list of parameter names available for line to be added.
paramValues - is the list of values for the parameter names.
Format:
|
scriptinterface.addLines ("RTRV-EQPT","ALL", "", boolean.booleanValue(), 1, ParamNames,ParamValues); |
3. AddMsgPayload.py
The script file AddMsgPayload.py uses the method addMsgPayLoad( ) to add a new Message PayLoad for a commandCode, accessId combination. This method will also add the accessId if it is not present. It takes the following parameters as input :
commandCode - is the CommandCode present in the agent.
accessId - is the accessId to be added.
msgPayLoad - is the MessagePayLoad to be added.
Format :
|
scriptinterface.addMsgPayLoad("ED-EQPT" , "ST1-4" , "CSU"); |
4. AddAutoLines.py
This script file uses the method addLines ( ) to add the Autonomous Lines to the corresponding Alarm Description for a Autonomous Code at agent RunTime. It takes the following parameters as input :
AutoCode - The Autonomous Code
AlarmDescription - The Alarm Description for the Auto code.
LineType - 0 : for Quoted, 1 : for Unquoted
String[] Parameter Names - the string array of the Parameter Names present for the Autonomous Code
String[] Parameter Values - the string array of the Parameter Values corresponding to the Parameter Names
Format :
|
scriptinterface.addLines (String AutoCode,String AlarmDescription, int LineType, String[] Parameter Names, String[] Parameter Values); |
4. DeleteAccessID.py
The script file DeleteAccessID.py uses the method deleteAccessID( ) to delete an accessId for a Command Code at agent run time. This method takes the following parameters as input:
commandCode - is the CommandCode present in the agent.
accessId - is the accessId to be deleted.
Format:
|
scriptinterface.deleteAccessId("ED-FAC", "ST1-9-1"); |
When this script is executed, the AID value ST1-9-1 is deleted for the command code ED-FAC. You can replace the sample command code and AID values with your own configuration.
5. DeleteLines.py
The script file DeleteLines.py uses the method delLines( ) to delete an existing Response Line configured for a Command Code, at agent run time. This method takes the following parameters as input:
commandCode - is the CommandCode present in the agent.
accessId - is the accessId corresponding to the commandCode.
msgPayLoad - is the MessagePayLoad corresponding to the accessId.
responseType - is a boolean representing whether the line is to be deleted for a valid response/error response.
lineType - represents whether the line is quoted/unquoted.
paramNames - is the list of parameter names available for the line to be deleted
paramValues - is the list of values for the parameter names.
Format:
|
scriptinterface.delLines ("RTRV-EQPT","ALL", "", boolean.booleanValue(), 1, ParamNames,ParamValues); |
You can replace the sample parameter values in the script file with your own configuration.
6. DeleteLineWithValue.py
This script file DeleteLineWithValue.py uses the method deleteLine( ) to delete the response line for the specified Param Name and Value configured for a command code, at agent runtime.
Format :
|
scriptinterface.deleteLine(String commandCode, String accessID, String msgPayLoad, boolean isValid, int lineType, String uniquePName, String uniquePValue); |
7. DeleteAutoLines.py
This script file DeleteAutoLines.py uses the method delLines( ) to delete the Autonomous Lines of the corresponding alarm description configured for a Autonomous Code, at agent runtime.
Format :
|
scriptinterface.delLines(String AutoCode , String AlarmDescription, int LineType, String[] Parameter Names, String[] Parameter Values); |
8. DeleteAutoLineWithValue.py
This script file DeleteAutoLineWithValue.py uses the method deleteLine( ) to delete the Autonomous Response Line of the corresponding Alarm Description with the specified Param Name and Value, at agaent runtime.
Format :
|
scriptinterface.deleteLine(String autoCode, String alarmDescr, int lineType, String uniquePName, String uniquePValue); |
9. DeleteMsgPayLoad.py
The script file DeleteMsgPayLoad.py uses the method delMsgPayLoad( ) to delete a MessagePayLoad for a command code, accessid combination. This method takes the following parameters:
commandCode - is the CommandCode present in the agent.
accessid - is the accessId corresponding to the MessagePayLoad.
msgPayLoad - is the MessagePayLoad to be deleted.
Format :
|
scriptinterface.delMsgPayLoad("ED-EQPT" , "ST1-4" , "CSU"); |
10. GetCurrentAID.py
The script file GetCurrentAID.py uses the method getCurrentAID( ), to GET the accessId that comes in the request. If the accessId is not given in the request, this method returns an empty string.
Format :
|
AccessID = scriptinterface.getCurrentAID(); |
11. GetCurrentMPB.py
The script file GetCurrentMPB.py uses the method getCurrentMPB( ) to get the msgPayLoad that comes in the request. If the msgPayLoad is not given in the request, this method returns an empty string.
Format:
|
MsgPayload = scriptinterface.getCurrentMPB(); |
12. GetAllAIDs.py
The script file GetAllAIDs.py uses the method getAllAids( ) to Get all the Access Identifier to the Command Code at agent runtime. This method takes the Command code as the input parameter It returns the value as a Vector compound.
Format :
|
scriptinterface.getAllAids("RTRV-EQPT"); |
13. GetAllMPBs.py
The script file GetAllMPBs.py uses the method getAllMpbs( ) to get all the Message Payloads for the specified command code and access identifier at agent runtime. This method takes the following parameters as input. It returns the value as a Vector compound.
commandCode - is the CommandCode present in the agent.
accessId - is the accessId corresponding to the commandCode.
Format :
|
scriptinterface.getAllMpbs("ED-IP", "ETHER"); |
14. GetNumberOfAIDs.py
The script file GetNumberOfAIDspy uses the method getNumberOfAids( ) to get the number of access identifiers to the command code at agent runtime. This method takes the following parameters as input. It returns an integer value as the count of the AIDs.
commandCode - the Command Code for which the number of Access Identifiers should be taken.
Format :
|
scriptinterface.getNumberOfAids("RTRV-EQPT"); |
15. GetNumberOfMPBs.py
The script file GetNumberOfMPBs.py uses the method getNumberOfMpbs( ) to get the number of Message Payloads to the Command Code and the AID at agent runtime. This method takes the following parameters as input. It returns an integer value as the count of the MPBs.
commandCode - the Command Code for which the number of Access Identifiers should be taken.
accessId - the Access Identifier for which the number of Message Payloads should be taken
Format :
|
scriptinterface.getNumberOfMpbs("RTRV-EQPT"); |
16. GetLine.py
This script file uses the method getLine( ) to get the Response Lines to the Command Code at agent runtime.
|
scriptinterface.getLine(String commandCode, String accessID, String msgPayLoad, boolean isValid, String uniquePName, String uniquePValue) |
17. GetAgentPort.py
This script file uses the method getPort( ) to get the port number of the agent from which the agent is started.
Format :
|
scriptinterface.getPort(); |
18. GetIPAddress.py
This script file uses the method getIPAddress() to get the IP Address of the agent. This will be very useful for the Network Simulation of TL1 Devices
Format :
|
scriptinterface.getIPAddress(); |
19. getScriptCondition( )
This script file returns the condition (before/after get) at which the script is executing.
Format :
|
scriptinterface.getScriptCondition(); |
20. IsAIDExists.py
The script file IsAIDExists.py uses the method isAidExists( ) to check whether the given Access Identifier is present in the AID list for the Command Code. This method takes the following parameters as input. It returns a Boolean value as '0' for False and '1' for True.
commandCode - the name of the Command Code
accessId - the value of the Access Identifier to be checked in the specified Command code.
Format :
|
scriptinterface.isAidExists("RTRV-EQPT", "ST1-1"); |
21. IsMPBExists.py
The script file IsMPBExists.py uses the method isMpbExists( ) to check whether the given Message Payload is present in the MPB list for the Command Code and its AID combination. This method takes the following parameters as input. It returns a Boolean value as '0' for False and '1' for True.
commandCode - the name of the Command Code
accessId - the value of the Access Identifier
msgpayload - the Message Payload to be checked for the specified Command code and AID
Format :
|
scriptinterface.isMpbExists("ED-IP", "ETHER", "165.162.1.20,255.255.255.0"); |
22. SetAckCode.py
The script file SetAckCode.py uses the method setAckMessage( ) to SET the acknowledgment Message for a commandCode, accessId, msgPayLoad combination.
Note : The script API method setAckMessage( ) cannot be configured to be executed with the 'Before processing request' condition.
This method takes the following parameters as input :
commandCode - is the CommandCode present in the agent.
accessId - is the accessId corresponding to the commandCode.
msgPayLoad - is the MessagePayLoad corresponding to the accessId.
ackNo - is the acknowledgment message to be set.
Format :
|
scriptinterface.setAckMessage(String commandCode , String accessId , String msgPayLoad , int ackNO); |
24. SetComplCode.py
The script file SetComplCode.py uses the method setComplCode( ) to SET the Completion Code(COMPLD,DENY) for a commandCode, accessId, msgPayLoad combination. This method takes the following parameters:
commandCode - is the CommandCode present in the agent.
accessId - is the accessId corresponding to the commandCode.
msgPayLoad - is the MessagePayLoad corresponding to the accessId.
complCode - is the completion code to be set (COMPLD/DENY).
Format:
|
scriptinterface.setComplCode("ACT-USER" , "ROOT" , "Password" , 1); |
25. SendAutonomousMessage.py
The script file SendAutonomousMessage.py uses the method sendAutonomousMessage( ) to sent the Autonomous Message at agent runtime. This method takes the following parameters as input.
autoCode - the name of the Autonomous Code. The modifiers should be separated by ^
almDescr - the value of the Alarm Description for which the Autonomous Message should be sent.
Format :
|
scriptinterface.sendAutonomousMessage("REPT^ALM^EQPT","TextBlock"); |
26. SendAutonomouswithNumberofTimes.py
The script file SendAutonomouswithNumberofTimes.py uses the method sendAutonomousMessage( ) to send the Autonomous Message with specified number of times, at agent runtime. This method takes the following parameters :
autoCode - the name of the Autonomous Code. The modifiers should be separated by ^
almDescr - the value of the Alarm Description for which the Autonomous Message should be sent
numberOfTimes - the number of times the Autonomous message must be sent
interval - the time interval between the consecutive Autonomous messages .
Format :
|
scriptinterface.sendAutonomousMessage("REPT^ALM^EQPT","TextBlock", 10, 1000); |
27. SendDenyMessage.py
This script file uses the method sendDenyMessage( ) to send the deny message at runtime
Format :
|
scriptinterface.sendDenyMessage(String errorCode, String explanation); |
28. StopTL1Agent.py
This script file uses the method stopAgent( ) to stop the TL1 agent in the network.
Format :
|
scriptinterface.stopAgent(String ipAddress, String snmpPort, String tl1Port); |
29. StartTL1Agent.py
This script file uses the method startAgent( ) to start the TL1 agent in the network.
Format :
|
scriptinterface.startAgent(String ipAddress, String snmpPort, String tl1Port); |
30. UpdateParamValue.py
This script file is to update the parameter value of a Response Line configured for a command code at runtime.
uniquePName & uniquePValue indicates the parameter name and value that will be unique across all the lines in the response.
Format :
|
scriptinterface.updateParamValue(String commandCode, String accessID, String msgPayLoad, boolean isValid, int lineType, String uniquePName, String uniquePValue, String pNameToModify, String modifyValue); |
31. UpdateAutoParamValue.py
This script file is to update the parameter value of a Response Line of the Autonomous code at runtime
Format :
|
scriptinterface.updateParamValue(String autoCode, String alarmDescr, int lineType, String uniquePName, String uniquePValue, String pNameToModify, String modifyValue); |
|