You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Netconf-cli is a command-line interface tool designed for interacting with network devices
using the NETCONF protocol. To establish a connection to the NETCONF server, the
following command is used:
netconf-cli admin@192.168.0.105
Additional connection options are:
-p (Port, default 830 if unspecified)
-d (Datastore to start on, default operational)
--socket (option to connect via socket)
By successful connection to the NETCONF server, the following message should appear
and, a session should be opened, ready to receive further commands:
Connected via NETCONF [datastore target: operational]
/>
This is the list of command that the session supports:
cancel - Cancel an ongoing RPC/action input.
cd - Enter a different node.
commit - Commit current changes.
copy - Copy configuration.
create - Create a node.
delete - Delete a node.
describe - Print information about YANG tree path.
discard - Discard current changes.
dump - Print out datastore content as JSON or XML.
exec - Execute RPC/action.
get - Retrieve configuration from the server.
help - Print help for commands.
ls - List available nodes.
move - Move (leaf)list instances.
prepare - Initiate RPC/action.
quit - Quit the console.
set - Set value of a leaf.
switch - Switch datastore target.
Examples:
1. Get operational data on some node, via NETCONF:
When the session is connected, type the ls command and it will print a list of modules that you can choose of. Lets say we pick ietf-system:system.
Then we can change the directory of the node by typing cd ietf-system:system.
Once we are navigated inside ietf-system:system we can also use ls to see the directories in that node and navigate further.
We can use the get command in order to get a leaf value, or a whole tree value. By executing get hostname,
this is the output:
/ietf-system:system/hostname = test_hostname
we can also do a whole tree get by executing get command on a node that is not a leaf.
For example executing get ntp will return this result:
2. Setting up and / or change some value via netconf-cli:
The first thing we should do is change the datastore from operational to running by
executing switch running command
Lets say we want to add new server node in the list. First we have to add values to all the leaf nodes
in the tree and then commit the changes.
This is the order of commands:
/ietf-system:system/ntp> set server[name='Server 4']/association-type pool
/ietf-system:system/ntp> set server[name='Server 4']/iburst true
/ietf-system:system/ntp> set server[name='Server 4']/prefer true
/ietf-system:system/ntp> set server[name='Server 4']/udp/address example.ntp.com
/ietf-system:system/ntp> commit
If there is no error showing, then changes should be commited to the running datastore, and we can
confirm that with: /ietf-system:system/ntp> get server[name='Server 4']
result:
If the user wants to discard some changes that are not yet commited, one can just use the discard
command and it will discard the changes that are set / created, but not yet commited.
In the same way as we used set, we can use delete command.
NOTE: netconf-cli has an auto-complete feature built in, and if you press on the tab key, it will list
the user a list of possible commands / values that can be used in the current situation .
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Netconf-cli is a command-line interface tool designed for interacting with network devices
using the NETCONF protocol. To establish a connection to the NETCONF server, the
following command is used:
netconf-cli admin@192.168.0.105
Additional connection options are:
By successful connection to the NETCONF server, the following message should appear
and, a session should be opened, ready to receive further commands:
This is the list of command that the session supports:
Examples:
1. Get operational data on some node, via NETCONF:
When the session is connected, type the ls command and it will print a list of modules that you can choose of. Lets say we pick ietf-system:system.
Then we can change the directory of the node by typing cd ietf-system:system.
Once we are navigated inside ietf-system:system we can also use ls to see the directories in that node and navigate further.
We can use the get command in order to get a leaf value, or a whole tree value. By executing
get hostname
,this is the output:
/ietf-system:system/hostname = test_hostname
we can also do a whole tree get by executing get command on a node that is not a leaf.
For example executing get ntp will return this result:
2. Setting up and / or change some value via netconf-cli:
The first thing we should do is change the datastore from operational to running by
executing switch running command
Lets say we want to add new server node in the list. First we have to add values to all the leaf nodes
in the tree and then commit the changes.
This is the order of commands:
If there is no error showing, then changes should be commited to the running datastore, and we can
confirm that with:
/ietf-system:system/ntp> get server[name='Server 4']
result:
If the user wants to discard some changes that are not yet commited, one can just use the discard
command and it will discard the changes that are set / created, but not yet commited.
In the same way as we used set, we can use delete command.
NOTE: netconf-cli has an auto-complete feature built in, and if you press on the tab key, it will list
the user a list of possible commands / values that can be used in the current situation .
Beta Was this translation helpful? Give feedback.
All reactions