Edition mode¶
Enter into a context¶
The configuration is organized hierarchically. All configuration is
available under the config
node.
config/
├── system
│ ├── auth
│ ├── fast-path
│ └── ...
└── vrf
├── dns
├── interface
└── ...
To enter into a context, type its name, followed by the key in case of a list.
vrouter running config#
vrouter running config# vrf main
vrouter running vrf main# interface
vrouter running interface# physical eth0
vrouter running physical eth0#
This can also be done in one command:
vrouter running config# vrf main interface physical eth0
vrouter running physical eth0#
Note
The CLI commands are generated from YANG files, which also specifies the NETCONF API of the device. A CLI context corresponds to a container or a list statement in the YANG file.
Set configuration values¶
To set the value of a leaf, type its name and its value:
vrouter running physical eth0# port pci-b0s4
vrouter running physical eth0# mtu 1500
vrouter running physical eth0# show config
physical eth0
(...)
port pci-b0s4
mtu 1500
(...)
Several leaves can be set in one command, achieving the same result:
vrouter running physical eth0# port pci-b0s4 mtu 1500
vrouter running physical eth0#
Finally, it is possible to set the value of leaves that are in a different path. In that case, specify the path, followed by the leaves and their values. Note that the current directory remains unchanged.
vrouter running config# vrf main interface physical eth0 mtu 1500 port pci-b0s4
vrouter running config#
Note
The CLI commands are generated from YANG files, which also specifies the NETCONF API of the device. A CLI configuration leaf corresponds to a leaf or a leaflist statement in the YANG file.
Delete a configuration node¶
A configuration node (either a leaf or a context) can be deleted with
the command del
, followed by the path of the node:
vrouter running physical eth0# mtu 1500
vrouter running physical eth0# show config
physical eth0
(...)
mtu 1500
(...)
vrouter running physical eth0# del mtu
vrouter running physical eth0# show config
[... no mtu ...]
Complex configuration commands¶
Some commands need to have a more complex syntax, because a couple
name
/value
is not sufficient. In this case, the CLI behavior is
customized with extensions in the YANG files.
Particularly, a YANG container or list can be used to define oneliner commands. For example, the interface IP neighbor context uses an extension to have a specific syntax:
neighbor <ip> link-layer-address <mac>
The following example shows that it does not follow the same syntax than the simple case described above. Each neighbor is identified by its key, and the argument attached to the neighbor is mandatory. To delete a neighbor, only the key is needed.
vrouter running ipv4# neighbor 10.100.0.0 link-layer-address 11:11:11:11:11:11
vrouter running ipv4# neighbor 10.200.0.0 link-layer-address 22:22:22:22:22:22
vrouter running ipv4# show config
ipv4
neighbor 10.100.0.0 link-layer-address 11:11:11:11:11:11
neighbor 10.200.0.0 link-layer-address 22:22:22:22:22:22
enabled true
..
vrouter running ipv4# del neighbor 10.100.0.0
vrouter running ipv4# show config
ipv4
neighbor 10.200.0.0 link-layer-address 22:22:22:22:22:22
enabled true
..
Show the configuration¶
The show config
command is used to display the configuration. In edition
mode, it shows the staging configuration by default, relative to the
current path.
The syntax of the command is: show config [staging|running|startup|<file>]
[text|xml|json] [all|nodefault] [<path...>]
Note
show config
(show the configuration) should not be confused with
show state
(get the operational state).
vrouter running config# vrf main ssh-server
vrouter running ssh-server# show config
ssh-server
enabled true
port 22
..
It is possible to show the running or the startup configuration:
vrouter running config# vrf main ssh-server
vrouter running ssh-server# show config running
ssh-server
enabled true
port 22
..
The configuration can be displayed in different format (text, xml or json):
vrouter running config# vrf main ssh-server
vrouter running ssh-server# show config json
{
"vrouter-ssh-server:ssh-server": {
"enabled": true,
"port": 22
}
}
The configuration nodes set to the default value can be stripped from
the configuration with nodefault
(in this example port
set to 22
and enabled
set to true
are not displayed):
vrouter running config# vrf main ssh-server
vrouter running ssh-server# show config xml nodefault
<ssh-server xmlns="urn:6wind:vrouter/ssh-server">
</ssh-server>
A path can be specified, which can be absolute, or relative to the current path:
vrouter running config# vrf main ssh-server
vrouter running ssh-server# show config
ssh-server
enabled true
port 22
..
vrouter running ssh-server#
vrouter running ssh-server# show config .. ..
config
vrf main
ssh-server
enabled true
port 22
..
..
..
vrouter running ssh-server# show config /
config
vrf main
ssh-server
enabled true
port 22
..
..
..
vrouter running ssh-server# show config / vrf main ssh-server
ssh-server
enabled true
port 22
..
The show config
command is also available from the operational mode. In this
case, the running configuration is displayed by default as there is no
staging configuration.
vrouter> show config /
config
vrf main
ssh-server
enabled true
port 22
..
..
..
Commit configuration changes¶
Once you are satisfied with your changes in the staging configuration, you can apply the changes by committing the configuration. This operation copies the content of the staging configuration into the running configuration.
vrouter> edit running
vrouter running config# vrf main
vrouter running vrf main# ssh-server
vrouter running ssh-server# show config
ssh-server
enabled true
port 22
..
vrouter running ssh-server# show config running
vrouter running ssh-server# commit
Configuration committed.
vrouter running ssh-server# show config running
ssh-server
enabled true
port 22
..
Note
After a call to commit
, the running configuration is updated
immediately. In contrast, the state of the system can take some
time to change, depending on the configuration.
Clear configuration changes¶
Exiting the edition mode cancels the changes done in the staging configuration.
vrouter running config# exit
Exit: not saved/applied, are you sure? [y/N] y