CLI Script API methods

 



Overview

 

The CLI script API methods are added to the ScriptInterface to perform operations such as getScriptFile, add parameters, get parameter value, delete parameters, etc. from a JPython script. The SNMP script API methods can also be used within the Jython scripts to implement the IOS commands.

 

The CLI and SNMP script API methods are provided under <simulator home>/examples/javadocs directory. The name of the Script API file is CLI_SimScrIntf.html

 

CLI Script API methods

 

a. getScriptFile method  

 

This method returns the script file for the given command.

 

 

public void getScriptFile(String command, String modeis)  

 

 

where
 

command - IOS command

modeis     - The mode in which the IOS Command is present
 

 

b. updateScripFile method

 

This method updates the script file for a particular command.

 

 

public void updateScriptFile (String command, String scriptfile, String modeis)   

 

 

where ,

 

command  - IOS command
scriptfile    - The new script file to be replaced for the command
modeis      - The mode in which the command is present .

 

c. getCurrentCommand method

 

This method returns the command which is now being executed .

 

public String getCurrentCommand( )

 

 

d. getCurrentLevel method

This method returns the level (Integer values for mode ) at which the command is executed.

 

public int getCurrentLevel( )

 

Note : The modes supported are represented by Integer values. User mode - 5 , Enable mode - 6 , Config mode - 7 , Config interface mode - 9

 

e. getMode method

This method returns the mode in which the command is executed.
 

 

public String getMode ( )

 

 

f. changeMode method

 

This method changes the mode of the client to the specified one  , when the mode is enable and greater.
 

 

public void changeMode(int mode)

 

 

where ,
 

mode  -  Integer value of the mode .

 

g. getCmdWord method

 

This method returns the respective command word for the specified index of the currently executing command.
 

 

public String getCmdWord(int index)

 

 

h. updateHost method

 

This method is used to update the hostname of the client with the given name.
 

 

public void updateHost(String name)

 

 

where

 

name - refers to the new Host name

 

i. getInterfaceStatus method

This method gives what is the interface being configured.
 

 

public String getInterfaceStatus( )

 

 

j. addParameters method

 
This method enables you to add the given paramValue with the ParamKey in the base table.  
 

 

public void addParameters(String paramKey,String paramValue)

 

 
where
 
paramkey     -  The key for the paramvalue .
paramvalue  -  The value to be stored.

 
k. getParamValue method
 
This method enables you to get the paramValue for the given ParamKey.
 

 

public String getParamValue(String paramKey)

 

 
where,
 
paramkey   -  The key for which a value is stored .
 
l. deleteParameters method

This method enables you to delete the row for the given param Key.

 

 

public void deleteParameters(String paramKey);

 

 
where,
paramkey   -  The key for which a value is stored .
 
m. getParamListValues method

This method enables you to get the list of values for the parmakey ( which is just the starting of the actual paramKey.

 

 

public Vector getParamListValues(String paramKey);

 

 
where ,

paramkey   -  The key for which a value is stored . 


n. executeScript method


This method enables you to execute another script from a given script file. 

 

 

public String executeScript(String scriptFile)

 

 
where ,

scriptfile - The script file name along with the path from Simulator home directory

 
o. getParamKeyList method
 
To get a list of  paramKeys.
 

 

public Vector getParamKeyList(String paramKey)

 

 
where ,

paramkey  -  The key in the basedata table . 

 
p. setConnectionTime method

This method is to set the time for the client session to be alive even when it is idle.

 

public void setConnectionTime (int time )

 

 
where ,

time  -  time value in seconds.

 
q. showHistory method

This method is to display the commands executed previously . The number of commands displayed will depend upon the history size. The default history size is ten.

 

public void showHistory()

 

 
 
h. updateIPAddress method
 

 

public void updateIPAddress(String ipAddress)

 

 
This method is used to update the IPAddress of the device for which the request has come.

i. setEnablePassword method

 
This method sets the Enable mode password for the device for which the  request has come
 

 

public void setEnablePassword(String password)

 

 
 
j.  getEnablePassword method
 

 

public String getEnablePassword()

 

 
This method gets the password for the enable mode for which the request has come


k. isInterfaceUp method

 

 

public boolean isInterfaceUp(String ipAddress)

 

 
This method checks whether a particular IPAddress is up or not

l.  getRoundTripTime method

 

 

public int getRoundTripTime()

 

 
This method gives the average time taken by isInterfaceUp method to check whether a particular IPAddress is up or not and hence has to be called after isInterfaceUp method

m. getMaxRoundTripTime method

  

 

public int getMaxRoundTripTime();

 

 
This method gives the maximum time taken by isInterfaceUp method to check whether a particular IPAddress is up or not and hence has to be called after isInterfaceUp method.

n. getMinRoundTripTime method

 

 

public int getMinRoundTripTime();

 

 
This method gives the minimum time taken by isInterfaceUp method to check whether a particular IPAddress is up or not and hence has to be called after isInterfaceUp method.

o. setPassword method

 

 

public void setPassword(String password);

 

 
This method sets the password for the device for which the request has come

p. getPassword method

 

 

public String getPassword();  

 

 
This method gets the password for the device for which the request has come


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