|
AdventNet Simulation Toolkit has implemented the FTP client protocol, an optional facility that enables transfer of files between the FTP client and the FTP 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. FTP uses UDP to transfer packets across the network.
Transferring files from the Network designer UI
To transfer files between the client and the server
Right-click on a device in the network either from the network tree or network area.
Select the option FTP Client. This will display the FTP client dialog. Specify the following details in this dialog:
Server IP : Specify the FTP Server IP address (e.g., 200.201.202.1)
Port: The FTP client talks to the standard FTP port 21 on the FTP server by default. If the server is configured to use a non-standard port, you can specify it in this option.
User Name and Password: Specify the username and password to connect to the FTP server. The default username and password is guest.
Mode: By default, the transfer mode is binary. If you want ascii data to be transferred, then select the mode as ascii.
Command : Select the command as Download file to download a file from the server to the client. Select the command as Upload File to upload a file from the client to the server.
If the command is to download a file from the FTP server, specify the source and target as follows:
Source : Specify the file name to be retrieved from the FTP server with the path.
Target: Specify the file name with path, to save the downloaded data in the client.
If the command is to upload a file to the FTP server, specify the source and target as follows:
Source : Specify the file name with path, to be retrieved from the FTP client.
Target: Specify the file name with path, to upload the data in the server. .
Click Transfer to download or upload the files. The maximum timeout value will be 5000 milliseconds by default and the maximum retries will be 0 by default. Timeout and retries are not configurable. If the file is transferred the message File Transferred will be displayed.
Click Close to exit the dialog.
Transferring files from Jython Scripts and RMI
Simulation Toolkit has implemented methods in RMI and Jython script interface to transfer files between the client and server using FTP, at agent runtime. These methods are defined in the following script APIs and RMI client APIs in <SimulatorHome>/examples/javadocs directory.
SNMPScriptInterface: Defines the methods that can be used to perform operations on a SNMP device, from a Jython script file.
TL1ScriptInterface: Defines the methods that can be used to perform operations on a TL1 device, from a Jython script file.
NetSimSnmpInterface: Defines the methods that can be used to perform operations on a SNMP agent via RMI.
NetSimTL1Interface: Defines the methods that can be used to perform operations on a TL1 agent via RMI.
To transfer files between the client and the server
This method will upload the 'source' file in the client to the FTP server running at the specified ip address and port number, in ascii or binary mode using the 'FTP/ftp' protocol. It returns a boolean whether the file is uploaded or not.
|
uploadFile(String ipAddress, int port, # String source, String target, int mode, String protocol, # String user, String password); |
where,
ipAddress - The host at which the FTP server is running
port - The port in the host at which the FTP server is running
source - The source file to be uploaded
target - The destination file name
mode - The mode of transfer either '0 for ascii' or '1 for binary'
protocol - The protocol to be used for uploading file
user - The user name for the protocol connection
password - The password of the user for the protocol connection
This method can be used to download the 'source' file from the FTP server running at the specified ip address and port number, to the client 'target' file in ascii or binary mode using the 'FTP/ftp' protocol.
|
downloadFile (String ipAddress, int port, # String source, String target, int mode, String protocol), # String user, String password); ; |
where,
ipAddress - The host at which the FTP server is running
port - The port in the host at which the FTP server is running
source - The source file to be downloaded
target - The destination file name
mode - The mode of transfer either '0 for ascii' or '1 for binary'
protocol - The protocol to be used for uploading file
user - The user name for the protocol connection
password - The password of the user for the protocol connection
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.
|