Package: netconf-console2
A console application for interacting with NETCONF servers built on top
ofncclient.Note:this is a continuation (or a rename) of the projectnetconf-console; the old name was clashing with another product.  Usenetconf-console2instead ofnetconf-console.Requirements and installationThis application runs both in Python 2 and Python 3 environments. The
only package required for running this application isncclient; if
this is installed, all other necessary packages are installed as
dependencies. This means that if you can (successfully) run something
likepip install ncclienton the target platform, all requirements
should be met.If you cannot, there still is a chance you can run it if the target platform
supports at least packagessixandlxml, which are commonly present;
and if it containsparamikoor at leastcryptography, you will be able
to use SSH (without them you can only use plain and nonstandard TCP
transport). The missing piece,ncclient, can beclonedand compiled to a “Python Wheel” -
you can do this on any computer and copy the resulting.whlfile to the
target platform, it should work there. Pretty much the same holds forparamiko. You may also want to create a wheel for the application itself by
runningpython setup.py bdist_wheel.Installing and running the applicationIf you can and want to install the application and all necessary
libraries, just runpython setup.py install. Otherwise prepare all
necessary .whl files and the scriptnetconf-console2to the target
platform. If they are in the same directory, nothing else is needed,
otherwise you may need to add the wheel files toPYTHONPATHbefore
running the script.Once installed or copied, you can just run the script with appropriate
options - see below.Command-line modeThe application can be run in two different modes: command-line mode and
interactive (console) mode. The command-line mode allows you to request
several RPC operations in one shell command. The command line would
contain the operation command options (--get,--lock, etc.) in
the desired order, all common options (such as--host,--portetc.) as well as command options (--db,--style); the command
options are all used for the commands that accept them, so for example
no two commands can address different datastores.An example of such command line:# netconf-console2 --host=example.com --db candidate --lock --edit-config=fragment1.xml \
--rpc=commit-confirmed.xml --unlock --sleep 5 --rpc=confirm.xmlInteractive modeThe interactive mode is started by--interactive(or-i). During
an interactive session the user issues commands, one per line, with
required arguments or options. The options are isolated now, so it is
possible to have two commands in one session accessing different
datastores. The interactive console provides limited support for
tab-completion of commands, options, and their arguments.The previous example can look like this:# netconf-console2 --host=example.com -i
netconf> lock
netconf> edit-config fragment1.xml --db candidate
netconf> rpc commit-confirmed.xml
netconf> unlock
netconf> get-config
netconf> rpc confirm.xml
netconf>Note: some commands (rpc,edit-configand others) may accept
data from standard input in the command-line mode; this does not work in
the interactive mode.Some capabilities of the interactive mode can be used in command-line
mode too using--exprpseudo-command: the argument is a command
(including options) as if it was added in the interactive mode, such as# netconf-console2 --expr 'get-config --db candidate' 'get-config'CommandsA command may accept an argument and a number of options. In
command-line mode, all option values are shared (see above); conversely,
in interactive mode the option needs to be provided for every command
where its desired value differs from the default. If a command does not
accept given option, it is a syntax error to provide it in interactive
mode (in command-line mode such situations are ignored).helloSend just the initialhellomessage and display the reply. Does
not accept any arguments or options.getSendgetRPC. Accepts optionsoutputStyle,with-defaults,xpath. As an alternative toxpath,getaccepts path as an
argument.get-configSendget-configRPC. Accepts the same set of options asgetplusdb.setSendedit-configwith single leaf assignment.  Requires the assignment
in the form<path>=<value>as an argument, acceptsdb,test,
andoperation.  The path may contain (or actually needs to contain, in
case it descends into a list instance) simple predicates in the formnode[key1=value1][key2=value2]....deleteSendsedit-configwith a single node to be deleted.  The node is
determined by the path provided as an argument, seesetfor the path
format.  Acceptsdb,test, anddel-operationoptions.createSendsedit-configwith a single node to be created.  The node is
determined by the path provided as an argument, seesetfor the path
format.kill-sessionSendkill-sessionRPC. Requires session identifier as an
argument, accepts no options.discard-changesSenddiscard-changesRPC. Accepts no arguments or options.lockSendlockRPC towards the datastore indicated bydboption.unlockSendunlockRPC, counterpart oflock.commitSendcommitrequest. Accepts optionalconfirmedas an
argument and optiontimeout.validateSendvalidateRPC. Accepts one argument, which can be either the
literalcandidate(to validate the contents of the candidate
datastore) or a filename pointing to a file with full configuration
to be validated; defaults to-, standard input.copy-running-to-startupSendcopy-configRPC withrunningdatastore as the source
andstartupdatastore as target. Accepts no arguments or
options.copy-configSendcopy-configRPC. Accepts a filename for the source
configuration as a argument (defaults to-), and thedboption for the target datastore.edit-configSendedit-configRPC. Accepts the same set of arguments and
options ascopy-config.get-schemaSendget-schemaRPC. Requires schema identifier as an argument.create-subscriptionSendcreate-subscriptionRPC. Requires notification stream
identifier as an argument. The notifications received from the
server are displayed on standard output while the session is active
- i.e. makes sense either in an interactive mode or in command-line
mode with the commandsleep.rpcIf none of the commands above is sufficient, a custom RPC can be
send using this command. Accepts a filename (or-as default) as
an argument; the file contents is sent to the server enveloped in
therpcelement.sleepDo nothing, just sleep for given number of seconds provided as an
argument.As a backward-compatibility option, it is possible to provide a filename (or-for standard input) containing all messages that are supposed to be sent
to the server, separated by the NETCONF transport v1.0 message separator.  This
option cannot be used with any other command.  Note that RPC message-id is not
preserved.OptionsThere are two sets of options: global options and command options.
Global options affect overall behavior of the tool and can be provided
in the shell command line (i.e. not to individual commands in the
interactive mode). Command options affect individual commands and in
interactive mode they need to be provided per command.Global optionshelpDisplay a usage message and exit.hostHostname or IP address of the NETCONF server.portPort number of the NETCONF server.userUsername for the authentication on the server (defaults toadmin).passwordPassword for the authentication on the server (defaults toadmin). If the option is provided without a value, the password
is read from the terminal.privKeyFileFile containing the user’s private key.rawPrint all received replies in the original form. The option accepts
one argument, name of file where the text should be stored; defaults
to standard output.tcpUse plain TCP for the communication with the server (without this
option SSH is used).dryDo not actually send any RPCs, just display them to standard output.Local optionsAs written above, local (or command) options are meaningful only for
certain command.outputStyleAffects the format of the displayed RPC reply. By default, the reply
is pretty-printed, but otherwise kept as is. The option acceptsplain(do no pretty-printing) andnoaaa(remove theaaasubtree from the reply fromgetorget-configrequests).dbTarget datastore for some of the RPC operations. Defaults torunning.timeoutTimeout in seconds for confirmed commit.with-defaultsSet default values handling. Accepted values areexplicit,trim,report-all,report-all-tagged.xpathSet the XPath filter for get or subscribe requests.nsSet a namespace prefix list; useful in casexpathoption uses
namespace prefixes.testTest-option value. Accepted values aretest-only,test-then-setandset.operationValue of the attributenc:operation.  Useful with thesetoperation, can bemerge(the default),replace,create.del-operationValue of the attributenc:operationwhen used with thedeleteoperation, can beremove(the default) ordelete.