TFTP protocol support

 



 

Overview

 

AdventNet Simulation Toolkit has implemented the TFTP client and server protocol, an optional facility that enables transfer of files between the TFTP client and the TFTP server. This facility enables the manager to configure an agent by changing the agent configuration files. The agent can use this facility to report any issues to the manager.

 

The file transfer can be done from the Network designer UI or using Jython scripts or through RMI at network startup or during runtime. The mode of transfer may be ascii or binary. The files transferred should have the 'public' access. TFTP uses UDP to transfer packets across the network.

 

Transferring Files From the Network Designer UI

 

The Network designer provides options to configure and start the TFTP server and transfer files between the client and the server.   

 

Configuring TFTP server root directory

 

You can configure root directory for individual devices in the network. By default, a TFTP server will have the root directory below ./networks/<networkname>/tftp/<templatedevicename> for all the devices.

 

To configure root directory for individual devices,

To configure root directory in bulk based on the template devices, use the template device right-click menu option. Refer to Template Devices and Configurations - Telnet Parameters for more information.

 

 

Configuring Scripts to be Executed on File Upload or Download

 

You can configure Jython script files to be executed when a file is uploaded to the server or downloaded from the server. This facility can be used to inform the manager about a file transfer, by way of sending traps etc. You can configure different script files for individual servers or same script file for all the servers.

 

To configure scripts on individual devices,

To configure upload/download scripts in bulk based on the template devices, use the template device right-click menu option. Refer to Template Devices and Configurations - Telnet Parameters for more information.

 

Starting the TFTP server

 

To start the TFTP server in individual devices,

Transferring Files Between the Client and the Server

Stopping the TFTP server

 

To stop the TFTP server in individual devices,

Transferring files from Jython Scripts and RMI

 

Simulation Toolkit has implemented methods in RMI and Jython script interface to start the TFTP server, transfer files between the client and server and stop the TFTP server, at agent runtime.  These methods are defined in the following script APIs and RMI client APIs in <SimulatorHome>/examples/javadocs directory.

Starting the TFTP server

 

This method can be used to start the TFTP server in the Network from any other agent, at runtime.

where,

 

ipAddress - the ip address of the server

port -  the port number where the server is started

rootDir - the root directory of the server.

 

Note : The files can be downloaded from or uploaded to the root directory or within its subdirectories.

 

Transferring Files between the Client and the Server

 

This method can be used to upload the 'source' file to the TFTP server running at the specified ip address and port number, to the 'target' file in ascii or binary mode using the 'tftp/ftp' protocol.

      uploadFile(String ipAddress, int port, # String source, String target,  int mode, String protocol);

where,

 

ipAddress - The ip address at which the TFTP server is running

port - The port in the host at which the TFTP server is running

source -  The source file name with path, to be retrieved from the client.

target - The file name with path,  to upload the data in the server.  

mode - The mode of transfer, 0 for netascii mode and 1 for octets mode

protocol - The protocol used to transfer the files, ftp/tftp

 

This method can be used to download the 'source' file from the TFTP server running at the specified ip address and port number, to the 'target' file in ascii or binary mode using the 'tftp/ftp' protocol.

where,

 

ipAddress - The ip address at which the TFTP server is running

port - The port in the host at which the TFTP server is running

source -  The file name with path, to be retrieved from the server.

target - The file name with path,  to download the data in the client.  

mode - The mode of transfer, 0 for netascii mode and 1 for octets mode

protocol - The protocol used to transfer the files, ftp/tftp

 

Stopping the TFTP server

 

This method can be used to stop the TFTP server from any other agent in the network, at runtime.

      stopTftpServer(String ipAddress, int port);

where,

 

ipAddress - ip address of the tftp server

port - the port number where the server is started

 

Checking if TFTP server is running at the specified port

 

This method can be used at runtime to check if the TFTP server is running at the specified ip address and port number.

Refer to section Managing Agents via RMI, to learn more about managing the agent via RMI.

Refer to section Configuring Network Behavior, to learn more about configuring behavior scripts.

 



Copyright © 1996-2006, AdventNet Inc. All Rights Reserved.