![]() ![]() ![]() |
Remote Method Invocation (RMI) enables the programmer to create distributed applications, in which the methods of remote Java objects can be invoked from other Java virtual machines, possibly on different hosts. It allows communication between programs written in Java.
An RMI client is a program that invokes one or more methods on a remote object in another virtual machine. For an RMI client to contact a remote RMI server, the client must first hold a reference to the server. The reference is obtained, either by looking up the remote object in the bootstrap naming service provided by RMI or by receiving the reference as an argument or a return value.
Every remote reference contains a server hostname and port number that allow clients to locate the VM that is serving a particular remote object. Once an RMI client has a remote reference, the client will use the hostname and port provided in the reference to open a socket connection to the remote server.
To summarize, RMI provides the mechanism by which the server and the client communicate and pass information back and forth.
RMI implementation in Simulation Toolkit
Simulation Toolkit has implemented RMI to control the simulated SNMP / TL1 agents and agents in the network via RMI. The RMI client API present under <SimulatorHome>/examples/javadocs directory, defines the methods in the simulator, which can be accessed via RMI.
To access the agent/network via RMI, you have to write the RMI Client program, invoking the methods provided in the RMI client APIs. The methods in RMI Client API can be invoked by setting the AdventNetSimulatorClient.jar present under the <Simulator_Home>/tutorials/rmi directory.
Some of the functionalities that can be achieved by using the methods in RMI Client API is given below :
Ability to programmatically update values for a specific SNMP/TL1 device within the simulated network
Ability to programmatically add/delete an SNMP agent in the existing network, get the number of SNMP agents running in the network and their device names.
Ability to programmatically start/stop individual SNMP/TL1 devices in the network.
Ability to programmatically send SNMP v1/v2/v3 traps and TL1 autonomous messages, on the fly.
Refer to the javadocs for more information.
Advantages of using RMI in simulation
1. RMI's unique capabilities to load and execute user-defined tasks at runtime helps in test case automation of manager applications. For example, the automated test environment can change the value of a given OID on a given SNMP agent to simulate different responses that is required for the test cases, trigger traps at any time, etc.
2. Results in enhanced performance as number of scripts need not be configured in the agent to simulate agent behavior. RMI provides means for controlling the simulated agent and network behavior.
![]() ![]() ![]() |