|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.juniper.netconf.NetconfSession
A NetconfSession object is used to call the Netconf driver
methods.
This is derived by creating a Device first,
and calling createNetconfSession().
Typically, one
close() method.
| Constructor Summary | |
protected |
NetconfSession(Session netconfSession,
java.lang.String hello,
javax.xml.parsers.DocumentBuilder builder)
|
| Method Summary | |
void |
close()
Close the Netconf session. |
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/set format. |
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.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 |
getServerCapability()
Get capability of the Netconf server. |
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 corresponding to the Netconf Session. |
java.lang.String |
runCliCommand(java.lang.String command)
Run a cli command. |
java.io.BufferedReader |
runCliCommandRunning(java.lang.String command)
Run a cli command. |
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 |
protected NetconfSession(Session netconfSession,
java.lang.String hello,
javax.xml.parsers.DocumentBuilder builder)
throws NetconfException,
java.io.IOException
| Method Detail |
public java.lang.String getServerCapability()
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 java.io.IOException,
org.xml.sax.SAXException
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>"
java.io.IOException
org.xml.sax.SAXException
public java.io.BufferedReader executeRPCRunning(XML rpc)
throws java.io.IOException,
org.xml.sax.SAXException
rpc - RPC to be sent. Use the XMLBuilder to create RPC as an
XML object.
java.io.IOException
org.xml.sax.SAXException
public java.io.BufferedReader executeRPCRunning(org.w3c.dom.Document rpcDoc)
throws java.io.IOException,
org.xml.sax.SAXException
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 void close()
throws java.io.IOException
java.io.IOException
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 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/set 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.
OR
"set system services ftp"
will load 'ftp' under the 'systems services' hierarchy.loadType - You can choose "merge" or "replace" as the loadType.
NOTE: This parameter's value is redundant in case the file contains
configuration in 'set' format.
LoadException
CommitException
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 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 reboot()
throws org.xml.sax.SAXException,
java.io.IOException
org.xml.sax.SAXException
java.io.IOException
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 | |||||||||