|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.juniper.netconf.Device
A Device is used to define a Netconf server.
Typically, one
Device
object.close() method.
| Constructor Summary | |
Device()
Prepares a new Device object, with default client
capabilities and default port 830, which can then be used to perform
netconf operations. |
|
Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile)
Prepares a new Device object, with default client
capabilities and default port 830, which can then be used to perform
netconf operations. |
|
Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile,
java.util.ArrayList capabilities)
Prepares a new Device object, with user-defined client
capabilities and default port 830 which can then be used to perform
netconf operations. |
|
Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile,
int port)
Prepares a new Device object, with default client
capabilities and user-defined port which can then be used to perform
netconf operations. |
|
Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile,
int port,
java.util.ArrayList capabilities)
Prepares a new Device object, with user-defined client
capabilities and user-defined port which can then be used to perform
netconf operations. |
|
| Method Summary | |
void |
close()
Close the connection to the Netconf server. |
void |
closeConfiguration()
This method should be called to close a private session, in case its started. |
void |
commit()
Commit the candidate configuration. |
void |
commitConfirm(long seconds)
Commit the candidate configuration, temporarily. |
void |
commitThisConfiguration(java.lang.String configFile,
java.lang.String loadType)
Loads and commits the candidate configuration, Configuration can be in text/xml format. |
void |
connect()
Connect to the Device, and establish a default NETCONF session. |
NetconfSession |
createNetconfSession()
Create a new Netconf session. |
XML |
executeRPC(org.w3c.dom.Document rpcDoc)
Send an RPC(as Document object) over the Netconf session and get the response as an XML object. |
XML |
executeRPC(java.lang.String rpcContent)
Send an RPC(as String object) over the default Netconf session and get the response as an XML object. |
XML |
executeRPC(XML rpc)
Send an RPC(as XML object) over the Netconf session and get the response as an XML object. |
java.io.BufferedReader |
executeRPCRunning(org.w3c.dom.Document rpcDoc)
Send an RPC(as Document object) over the Netconf session and get the response as a BufferedReader. |
java.io.BufferedReader |
executeRPCRunning(java.lang.String rpcContent)
Send an RPC(as String object) over the default Netconf session and get the response as a BufferedReader. |
java.io.BufferedReader |
executeRPCRunning(XML rpc)
Send an RPC(as XML object) over the Netconf session and get the response as a BufferedReader. |
XML |
getCandidateConfig()
Retrieve the whole candidate configuration. |
XML |
getCandidateConfig(java.lang.String configTree)
Retrieve the candidate configuration, or part of the configuration. |
java.util.ArrayList |
getDefaultClientCapabilities()
Get the client capabilities that are advertised to the Netconf server by default. |
java.lang.String |
gethostName()
Get hostname of the Netconf server. |
java.lang.String |
getLastRPCReply()
Returns the last RPC reply sent by Netconf server. |
XML |
getRunningConfig()
Retrieve the whole running configuration. |
XML |
getRunningConfig(java.lang.String configTree)
Retrieve the running configuration, or part of the configuration. |
java.lang.String |
getSessionId()
Get the session ID of the Netconf session. |
boolean |
hasError()
Check if the last RPC reply returned from Netconf server has any error. |
boolean |
hasWarning()
Check if the last RPC reply returned from Netconf server has any warning. |
boolean |
isOK()
Check if the last RPC reply returned from Netconf server, contains <ok/> tag. |
void |
loadSetConfiguration(java.lang.String configuration)
Loads the candidate configuration, Configuration should be in set format. |
void |
loadSetFile(java.lang.String configFile)
Loads the candidate configuration from file, configuration should be in set format. |
void |
loadTextConfiguration(java.lang.String configuration,
java.lang.String loadType)
Loads the candidate configuration, Configuration should be in text/tree format. |
void |
loadTextFile(java.lang.String configFile,
java.lang.String loadType)
Loads the candidate configuration from file, configuration should be in text/tree format. |
void |
loadXMLConfiguration(java.lang.String configuration,
java.lang.String loadType)
Loads the candidate configuration, Configuration should be in XML format. |
void |
loadXMLFile(java.lang.String configFile,
java.lang.String loadType)
Loads the candidate configuration from file, configuration should be in XML format. |
boolean |
lockConfig()
Locks the candidate configuration. |
void |
openConfiguration(java.lang.String mode)
This method should be called for load operations to happen in 'private' mode. |
java.lang.String |
reboot()
Reboot the device. |
java.lang.String |
runCliCommand(java.lang.String command)
Run a cli command, and get the corresponding output. |
java.io.BufferedReader |
runCliCommandRunning(java.lang.String command)
Run a cli command. |
java.lang.String |
runShellCommand(java.lang.String command)
Execute a command in shell mode. |
java.io.BufferedReader |
runShellCommandRunning(java.lang.String command)
Execute a command in shell mode. |
void |
setCapabilities(java.util.ArrayList capabilities)
Set the client capabilities to be advertised to the Netconf server. |
void |
setHostname(java.lang.String hostName)
Set the hostname of the Netconf server. |
void |
setPassword(java.lang.String password)
Set the password of the Netconf server. |
void |
setPemKeyFile(java.lang.String pemKeyFile)
Set path of the RSA/DSA private key. |
void |
setPort(int port)
Set the port number to establish Netconf session over SSH-2. |
void |
setTimeOut(int timeout)
Set the timeout value for connecting to the Device. |
void |
setUserName(java.lang.String userName)
Set the username of the Netconf server. |
boolean |
unlockConfig()
Unlocks the candidate configuration. |
boolean |
validate()
Validate the candidate configuration. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Device()
throws javax.xml.parsers.ParserConfigurationException
Device object, with default client
capabilities and default port 830, which can then be used to perform
netconf operations.
javax.xml.parsers.ParserConfigurationException
public Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile)
throws NetconfException,
javax.xml.parsers.ParserConfigurationException
Device object, with default client
capabilities and default port 830, which can then be used to perform
netconf operations.
hostName - the hostname of the Netconf server.userName - the login username of the Netconf server.password - the login password of the Netconf server.pemKeyFile - path of the file containing RSA/DSA private key, in PEM
format. For user-password based authentication, let this be
null.
NetconfException
javax.xml.parsers.ParserConfigurationException
public Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile,
int port)
throws NetconfException,
javax.xml.parsers.ParserConfigurationException
Device object, with default client
capabilities and user-defined port which can then be used to perform
netconf operations.
hostName - the hostname of the Netconf server.userName - the login username of the Netconf server.password - the login password of the Netconf server.pemKeyFile - path of the file containing RSA/DSA private key, in PEM
format. For user-password based authentication, let this be
null.port - port number to establish Netconf session over SSH-2.
NetconfException
javax.xml.parsers.ParserConfigurationException
public Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile,
java.util.ArrayList capabilities)
throws NetconfException,
javax.xml.parsers.ParserConfigurationException
Device object, with user-defined client
capabilities and default port 830 which can then be used to perform
netconf operations.
hostName - the hostname of the Netconf server.userName - the login username of the Netconf server.password - the login password of the Netconf server.pemKeyFile - path of the file containing RSA/DSA private key, in PEM
format. For user-password based authentication, let this be
null.capabilities - the client capabilities to be advertised to Netconf server.
NetconfException
javax.xml.parsers.ParserConfigurationException
public Device(java.lang.String hostName,
java.lang.String userName,
java.lang.String password,
java.lang.String pemKeyFile,
int port,
java.util.ArrayList capabilities)
throws NetconfException,
javax.xml.parsers.ParserConfigurationException
Device object, with user-defined client
capabilities and user-defined port which can then be used to perform
netconf operations.
hostName - the hostname of the Netconf server.userName - the login username of the Netconf server.password - the login password of the Netconf server.pemKeyFile - path of the file containing RSA/DSA private key, in PEM
format. For user-password based authentication, let this be
null.port - port number to establish Netconf session over SSH-2.capabilities - the client capabilities to be advertised to Netconf server.
NetconfException
javax.xml.parsers.ParserConfigurationException| Method Detail |
public void connect()
throws NetconfException
NetconfException
public void setTimeOut(int timeout)
throws NetconfException
timeout - timeout in milliseconds.
NetconfException
public void setHostname(java.lang.String hostName)
throws NetconfException
hostName - hostname of the Netconf server, to be set.
NetconfException
public void setUserName(java.lang.String userName)
throws NetconfException
userName - username of the Netconf server, to be set.
NetconfException
public void setPassword(java.lang.String password)
throws NetconfException
password - password of the Netconf server, to be set.
NetconfException
public void setPemKeyFile(java.lang.String pemKeyFile)
throws NetconfException
pemKeyFile - Path of the file containing RSA/DSA private key.
NetconfException
public void setCapabilities(java.util.ArrayList capabilities)
throws NetconfException
capabilities - Client capabilities to be advertised to the Netconf server.
NetconfException
public void setPort(int port)
throws NetconfException
port - Port number.
NetconfExceptionpublic java.lang.String gethostName()
public NetconfSession createNetconfSession()
throws NetconfException
NetconfException
public java.lang.String reboot()
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXException
java.io.IOExceptionpublic void close()
public java.lang.String runShellCommand(java.lang.String command)
throws java.io.IOException
command - The command to be executed in shell mode.
java.io.IOException
public java.io.BufferedReader runShellCommandRunning(java.lang.String command)
throws java.io.IOException
command - The command to be executed in shell mode.
java.io.IOExceptionpublic java.util.ArrayList getDefaultClientCapabilities()
public XML executeRPC(java.lang.String rpcContent)
throws org.xml.sax.SAXException,
java.io.IOException
rpcContent - RPC content to be sent. For example, to send an rpc
<rpc><get-chassis-inventory/></rpc>, the
String to be passed can be
"<get-chassis-inventory/>" OR
"get-chassis-inventory" OR
"<rpc><get-chassis-inventory/></rpc>"
org.xml.sax.SAXException
java.io.IOException
public XML executeRPC(XML rpc)
throws org.xml.sax.SAXException,
java.io.IOException
rpc - RPC to be sent. Use the XMLBuilder to create RPC as an
XML object.
org.xml.sax.SAXException
java.io.IOException
public XML executeRPC(org.w3c.dom.Document rpcDoc)
throws org.xml.sax.SAXException,
java.io.IOException
rpcDoc - RPC content to be sent, as a org.w3c.dom.Document object.
org.xml.sax.SAXException
java.io.IOException
public java.io.BufferedReader executeRPCRunning(java.lang.String rpcContent)
throws org.xml.sax.SAXException,
java.io.IOException
rpcContent - RPC content to be sent. For example, to send an rpc
<rpc><get-chassis-inventory/></rpc>, the
String to be passed can be
"<get-chassis-inventory/>" OR
"get-chassis-inventory" OR
"<rpc><get-chassis-inventory/></rpc>"
org.xml.sax.SAXException
java.io.IOException
public java.io.BufferedReader executeRPCRunning(XML rpc)
throws org.xml.sax.SAXException,
java.io.IOException
rpc - RPC to be sent. Use the XMLBuilder to create RPC as an
XML object.
org.xml.sax.SAXException
java.io.IOException
public java.io.BufferedReader executeRPCRunning(org.w3c.dom.Document rpcDoc)
throws org.xml.sax.SAXException,
java.io.IOException
rpcDoc - RPC content to be sent, as a org.w3c.dom.Document object.
org.xml.sax.SAXException
java.io.IOExceptionpublic java.lang.String getSessionId()
public boolean hasError()
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXException
java.io.IOException
public boolean hasWarning()
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXException
java.io.IOExceptionpublic boolean isOK()
public boolean lockConfig()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public boolean unlockConfig()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public void loadXMLConfiguration(java.lang.String configuration,
java.lang.String loadType)
throws LoadException,
java.io.IOException,
org.xml.sax.SAXException
configuration - Configuration,in XML format, to be loaded. For example,
"<configuration><system><services><ftp/>
<services/></system></configuration/>"
will load 'ftp' under the 'systems services' hierarchy.loadType - You can choose "merge" or "replace" as the loadType.
LoadException
java.io.IOException
org.xml.sax.SAXException
public void loadTextConfiguration(java.lang.String configuration,
java.lang.String loadType)
throws LoadException,
java.io.IOException,
org.xml.sax.SAXException
configuration - Configuration,in text/tree format, to be loaded. For example,
" system {
services {
ftp;
}
}"
will load 'ftp' under the 'systems services' hierarchy.loadType - You can choose "merge" or "replace" as the loadType.
LoadException
java.io.IOException
org.xml.sax.SAXException
public void loadSetConfiguration(java.lang.String configuration)
throws LoadException,
java.io.IOException,
org.xml.sax.SAXException
configuration - Configuration,in set format, to be loaded. For example,
"set system services ftp"
will load 'ftp' under the 'systems services' hierarchy.
To load multiple set statements, separate them by '\n' character.
LoadException
java.io.IOException
org.xml.sax.SAXException
public void loadXMLFile(java.lang.String configFile,
java.lang.String loadType)
throws LoadException,
java.io.IOException,
org.xml.sax.SAXException
configFile - Path name of file containing configuration,in xml format,
to be loaded.loadType - You can choose "merge" or "replace" as the loadType.
LoadException
java.io.IOException
org.xml.sax.SAXException
public void loadTextFile(java.lang.String configFile,
java.lang.String loadType)
throws LoadException,
java.io.IOException,
org.xml.sax.SAXException
configFile - Path name of file containing configuration,in xml format,
to be loaded.loadType - You can choose "merge" or "replace" as the loadType.
LoadException
java.io.IOException
org.xml.sax.SAXException
public void loadSetFile(java.lang.String configFile)
throws java.io.IOException,
LoadException,
org.xml.sax.SAXException
configFile - Path name of file containing configuration,in set format,
to be loaded.
LoadException
java.io.IOException
org.xml.sax.SAXException
public void commit()
throws CommitException,
java.io.IOException,
org.xml.sax.SAXException
CommitException
java.io.IOException
org.xml.sax.SAXException
public void commitConfirm(long seconds)
throws CommitException,
java.io.IOException,
org.xml.sax.SAXException
seconds - Time in seconds, after which the previous active configuration
is reverted back to.
CommitException
java.io.IOException
org.xml.sax.SAXException
public void commitThisConfiguration(java.lang.String configFile,
java.lang.String loadType)
throws LoadException,
CommitException,
java.io.IOException,
org.xml.sax.SAXException
configFile - Path name of file containing configuration,in text/xml format,
to be loaded. For example,
" system {
services {
ftp;
}
}"
will load 'ftp' under the 'systems services' hierarchy.
OR
"<configuration><system><services><ftp/><
services/></system></configuration/>"
will load 'ftp' under the 'systems services' hierarchy.loadType - You can choose "merge" or "replace" as the loadType.
LoadException
CommitException
java.io.IOException
org.xml.sax.SAXException
public XML getCandidateConfig(java.lang.String configTree)
throws org.xml.sax.SAXException,
java.io.IOException
configTree - configuration hierarchy to be retrieved as the argument.
For example, to get the whole configuration, argument should be
<configuration></configuration>
org.xml.sax.SAXException
java.io.IOException
public XML getRunningConfig(java.lang.String configTree)
throws org.xml.sax.SAXException,
java.io.IOException
configTree - configuration hierarchy to be retrieved as the argument.
For example, to get the whole configuration, argument should be
<configuration></configuration>
org.xml.sax.SAXException
java.io.IOException
public XML getCandidateConfig()
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXException
java.io.IOException
public XML getRunningConfig()
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXException
java.io.IOException
public boolean validate()
throws java.io.IOException,
org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public java.lang.String runCliCommand(java.lang.String command)
throws java.io.IOException,
org.xml.sax.SAXException
command - the cli command to be executed.
java.io.IOException
org.xml.sax.SAXException
public java.io.BufferedReader runCliCommandRunning(java.lang.String command)
throws org.xml.sax.SAXException,
java.io.IOException
command - the cli command to be executed.
org.xml.sax.SAXException
java.io.IOException
public void openConfiguration(java.lang.String mode)
throws java.io.IOException
mode - Mode in which to open the configuration.
Permissible mode(s): "private"
java.io.IOException
public void closeConfiguration()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getLastRPCReply()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||