18.0 Transport Provider Interface

 


18.1 Overview of Transport Provider Interface

18.2 The Transport Provider Interface Advantage

18.3 Steps Involved in Plugging in Your Own Protocol

18.4 Running the Example


 

18.1 Overview of Transport Provider Interface

 

TL1 Agent of the WebNMS Agent Toolkit Java Edition provides TCP/IP as a default protocol implementation for communication between manager and an agent. Sometimes, situations may arise when developers may want to implement other protocols of communication such as IPX, HTTP, UDP, Serial port etc between the TL1 Manager and the TL1 device. The Transport Provider Interface which addresses the above problem.

 

The Transport Provider Interface allows the user to plug-in their own transport protocol, thereby allowing developers to implement any protocol of their choice for TL1 communication.

 

18.2 The Transport Provider Interface Advantage

 

The TL1 Transport Provider is responsible for all communication between the TL1 Manager and Agent and uses the configured protocol to do so. So, it essentially acts as a bridge between the TL1 Agent and the underlying transport protocol used.

 

The advantage of using this approach is that the TL1 Agent need not be aware of the underlying protocol used and the user can virtually run TL1 over anything. For using a particular transport protocol, the user has to implement that protocol and plug-in (or register) with the TL1 Transport Provider.

 

18.3 Steps Involved in Plugging in your own Protocol

 

The following are steps involved in plugging-in your own Transport Protocol using the Transport Provider Framework.

  1. Implementing TL1ServerTransportProvider Interface for server side implementation.

    This interface has the following methods:
    i. open()

    Initializes the Transport session over which the data is sent/received.

    ii. start()

    This interface method should be used for creating instances of client session (TL1Session) with their corresponding TL1TransportProvider framework and it should be updated in TL1ServerSession's addTL1Session(..) method.

    iii. close()

    Closes the transport interface after communication is over.

    Please refer Java Docs for TL1ServerTransportProvider interface details.

  2. Implementing TL1TransportProvider interface for providing a transport connection between the TL1 Manager and TL1 Agent.

    This interface has the following methods :

    i. open() - Opens the session over which the data is sent/received
    ii. read() - Receive data from the peer over the transport interface.
    iii. write() - Send data to the server over the TCP server socket interface.
    iv. close() - Closes the transport interface after communication is over.

    Please refer Java Docs for TL1TransportProvider interface details.

Instantiating and starting the TL1 API Thread

 

We have to instantiate and start the TL1API thread that monitors all the TL1 sessions registered to it. To communicate with TL1 entities, we need to instantiate the TL1ServerSession class. The TL1ServerSession class is used to instantiate TL1Session for communicating with other TL1 Manager. The following is a sample code snippet for plugging-in TCP transport provider.

 

TL1API api = new TL1API();

TL1ServerSession server = null;

server = new TL1ServerSession(api);

/* Setting transport provider name */

server.setSessionClassifier("TCP");

/**

*TL1Client interface needs to be implemented to receive and process the TL1Message from the TL1Agent.This is mainly used in asynchronous mode of message transfer. The TL1Session invokes the callback(...) method upon succesfully receiving the TL1Message from the TL1Agent. So instance of TL1Agent is registered with TL1Sesion for callback.

*/

server.addTL1Client(tl1Agent);

TcpServerTransportImpl serverTransportImpl = new TcpServerTransportImpl();

server.setTL1ServerTransportProvider(serverTransportImpl);

/* Creating paramter hashtable, this hashtable will be used in opening server session */

Hashtable parameters = new Hashtable();

parameters.put("PORT","9999");

/* Opens server session using the parameters */

server.open(parameters);

/* Starts server session, this will create TL1Session once accepts client's connection request. */

server.start();

 

A sample plugging example for plugging in TCP protocol is available in the <Agent Toolkit Home>/examples/tl1/transport directory. Also the Craft Interface support in the TL1 Agent is made possible through the Transport Provider framework.

 

18.4 Running the Example

 

An example is available in the <Agent Toolkit Home>/examples/tl1/transport directory, which explains how you can plug-in your own transport protocol. The following Readme.html file explains the steps involved in using TCP as the transport communication

 

Readme.html

 

The implementations involved in plugging-in TCP as Transport Protocol, by using Transport Provider Framework, have already been done and the implemented files are available in the <Agent Toolkit Home>/examples/tl1/transport/src directory. Details about running the example are available in the Readme.html file mentioned above.

 



Copyright © 2009, ZOHO Corp. All Rights Reserved.