Command Line Interface
Module Introduction
Before you start the hands-on part of this module, you should load the appropriate configuration and verify that the testbed is up and running by executing the corresponding robot file:
student@tour:~/trainings_resources/robot$ robot basics/basics_setup.robot
Logging into the System
The standard way to access a RBFS is by means of secure shell. By default, the username is supervisor
and the corresponding password is also supervisor
.
student@tour:~/tour$ ssh supervisor@R1
ED25519 key fingerprint is SHA256:iL9VBMq65NzU53XvRqxkbNbkra+yhW8wUjE2kTZ61RQ.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
supervisor@l1's password:
Last login: Tue Feb 21 08:38:09 2023
+--------------------------------------------------------------------+
| |
RBFS container R1 running on tour:
Date: Tue Mar 7 11:14:17 UTC 2023
Uptime: up 23 hours, 49 minutes
Image metadata:
UUID: 7615b2f8-5e9a-48c5-84d1-8955d8556f90
Version: 23.2.1
Role: consolidated-bng
Platform: virtual
Format: lxd
Build date: 2023-02-23 15:47:33 UTC
Based on: Ubuntu 18.04.6 LTS
| |
+--------------------------------------------------------------------+
supervisor@R1>tour:~ $
After successfully logging into the system, you will first see some practical information. In this lab we use a virtual system as you can see in the corresponding platform parameter.
Which version and which role does your system have?
Click to reveal the answer
op> show version
UUID : 8363f4a2-6d65-4336-a2dc-0243ed5b9bc0
Version : 23.6.1
Role : consolidated-bng
Platform : virtual
Format : lxd
Build date : 2023-06-21 06:06:57 UTC
<output omitted>
The version in this example is 23.6.1 and the platform is virtual.
The information Based on tells you, that the RBFS is running on top of an Ubuntu Linux Container which you can also see from the command prompt ($). |
We will now start the RBFS command line interface (CLI) that enables you to interact with RBFS for monitoring, configuring, debugging, and maintaining the system.
supervisor@R1>tour:~ $ cli
op>
Once you have started the CLI, the command prompt will change to >
. The CLI provides some features that help you working with the CLI, e.g., automatic command completion using the TAB key or list of available options using the kbd:? key.
What happens if you type the ? key? Which command allows you to set the mode for CLI operation?
Click to reveal the answer
op>
<...>
show Show a particular state of the system
switch-mode Set a mode for CLI operation
switch-over Initiate redundancy switch-over
<...>
The correct command is switch-mode
which allows you to set the mode to operation
(default), config
and debug
.
Exploring the System
For monitoring the system and troubleshooting the various show commands are very useful. If you enter show
followed by the ? key again, you get a list of options for this new command hierarchy.
What is the output of the command show interface summary
? How many interfaces does your switch have?
Click to reveal the answer
op> show interface summary
Interface Admin Link Oper IPv4 Address IPv6 Address
hostif-0/0/0 Up Up Up
hostif-0/0/1 Up Up Up
hostif-0/0/2 Up Up Up
hostif-0/0/4 Up Up Up
hostif-0/0/11 Up Up Up
There are five interfaces available on the switch.
By default, RBFS is running Link Layer Discovery Protocol (LLDP) on all active interfaces. LLDP is a media-independent link layer protocol used by network devices for advertising their identity, capabilities to neighbors on a LAN segment. LLDP runs over the data-link layer only, allowing two systems running different network layer protocols to learn about each other.
What is the output of the command show lldp neighbor
? How many neighbors do you have?
Click to reveal the answer
op> show lldp neighbor
Neighbor name Status Remote port ID Local port ID Neighbor MAC address Last received Last sent
R2 Up hostif-0/0/1 hostif-0/0/1 7a:fc:da:00:00:00 0:00:20 ago 0:00:11 ago
R2 Up hostif-0/0/11 hostif-0/0/11 7a:fc:da:00:00:00 0:00:30 ago 0:00:11 ago
R3 Up hostif-0/0/2 hostif-0/0/2 7a:00:3f:01:00:00 0:00:20 ago 0:00:11 ago
Like any other computer, the switch consists of a CPU, RAM, and disks which are needed to run the control and management plane. Similar to a standard Linux system, you can monitor the utilization of these resources using the show process | memory | disk usage
command.
op> show process usage summary
Name PID VIRT Resident Memory Sharable Memory CPU Percentage Memory Percentage CPU Affinity
bfdd 92 373.99 MiB 110.04 MiB 26.44 MiB 1.7 0.34 0-15
bgp.appd.1 85 390.27 MiB 105.44 MiB 28.43 MiB 1.7 0.33 0-15
bgp.iod.1 160 558.8 MiB 121.38 MiB 28.43 MiB 2.12 0.38 0-15
confd 194 779.34 MiB 207.34 MiB 35.89 MiB 1.28 0.65 0-15
<output omitted>
op> show memory usage
Name Total Used Free Shared Buffers Cached
RAM 31.39 GiB 2.48 GiB 27.94 GiB 100.74 MiB 0 bytes 980.73 MiB
SWAP 0 bytes 0 bytes 0 bytes n/a n/a n/a
op> show disk usage
Filesystem Type Size Used Available Mountpoint Usage %
none tmpfs 492 KiB 4 KiB 488 KiB /dev 0.81
tmpfs tmpfs 15.69 GiB 16.25 MiB 15.68 GiB /run 0.1
/dev/sda4 ext4 40.06 GiB 24.22 GiB 13.77 GiB /shm 63.75
tmpfs tmpfs 15.69 GiB 19.49 MiB 15.67 GiB /dev/shm 0.12
tmpfs tmpfs 5 MiB 0 bytes 5 MiB /run/lock 0.0
udev devtmpfs 15.64 GiB 0 bytes 15.64 GiB /dev/net/tun 0.0
tmpfs tmpfs 3.14 GiB 0 bytes 3.14 GiB /run/user/1000 0.0
/var/cache/rtbrick/imag overlay 40.06 GiB 24.22 GiB 13.77 GiB / 63.75
If you suspect any environmental issues, the system allows you to display information about some of the hardware components including power supplies, fans, and temperature using the show sensor power-supply | fan | temperature
command. It is also possible to view information about interface plugins using the show optics inventory
command.
The lab setup is based on virtual RBFS nodes, which do not provide any hardware related information, i.e., executing commands like show sensor power-supply detail or show optics inventory will result in a blank answer. |
Basic Configuration
In order to modify the configuration of the system, we need to enter the configuration mode. After starting the CLI, the operational mode is used by default. The mode is also part of the command prompt, so when switching from one mode to another you can see how the prompt changes:
op> switch-mode config
Activating syntax mode : cfg [config]
cfg>
INFO: In addition to operational and config mode, RBFS also has a debug mode, which allows you to execute troubleshooting or debugging operations.
The configuration is processed in JSON format which relies on a YANG-based data model. Configuration changes can be applied manually using the CLI or via the RESTCONF interface. The system maintains two configuration databases:
-
Running configuration which is currently used by the system
-
Candidate configuration which contains changes that are not yet activated
Running Configuration
The running configuration can be displayed using the show config
command.
cfg> show config
{
"ietf-restconf:data": {
"rtbrick-config:system": {
"load-last-config": "true"
},
"rtbrick-config:interface": [
{
"name": "hostif-0/0/0",
"host-if": "R1-SN-0"
},
{
"name": "hostif-0/0/1",
"host-if": "R1-R2-0"
},
{
"name": "hostif-0/0/11",
"host-if": "R1-R2-1"
},
{
"name": "hostif-0/0/2",
"host-if": "R1-R3-0"
},
{
"name": "hostif-0/0/4",
"host-if": "R1-SN-1"
}
]
}
}
The RBFS system is able to convert and output the configuration in other formats, for example in NETCONF format or set format. The set
syntax is also used to modify the configuration. The show config
command provides the possibility to restrict the configuration output to a certain area, e.g., if you are only interested in a specific interface configuration you can use
cfg> show config interface hostif-0/0/2
{
"rtbrick-config:interface": [
{
"name": "hostif-0/0/2",
"host-if": "R1-R3-0"
}
]
}
or in set format
cfg> show config set interface hostif-0/0/2
set interface hostif-0/0/2
set interface hostif-0/0/2 host-if R1-R3-0
Candidate Configuration
Adding and removing configuration statements is done by the set
and delete
commands.
We have already seen that a RBFS system automatically establishes LLDP neighborship by default. Additional LLDP parameters can be configured using the set lldp
command hierarchy. Configure an LLDP system-description as well as port-description for each interface.
Also set the element-name to R1 using the set system host
command syntax.
How does the configuration changes?
Click to reveal the answer
cfg> set system host element-name R1
cfg> set lldp system-description "Virtual Switch R1"
cfg> set lldp interface hostif-0/0/1 port-description "Interface to R2"
cfg> set lldp interface hostif-0/0/2 port-description "Interface to R3"
cfg> set lldp interface hostif-0/0/11 port-description "Interface to R2"
cfg> show config lldp
cfg>
The configuration has not changed at all, because the configuration changes are made to the candidate configuration, while the show config command displays the running configuration.
|
We have already mentioned that configuration changes are not automatically activated. They are stored in the candidate configuration. Before we activate the configuration changes, let’s have a look at the changes first:
cfg> show diff
+system {
+ host {
+ element-name R1;
+ }
+}
+lldp {
+ interface {
+ interface-name hostif-0/0/1;
+ port-description Interface to R2;
+ }
+ interface {
+ interface-name hostif-0/0/11;
+ port-description Interface to R2;
+ }
+ interface {
+ interface-name hostif-0/0/2;
+ port-description Interface to R3;
+ }
+}
The show diff [set]
command provides a summary of all the changes that have not been activated yet. The plus-sign indicates the configuration lines that have been added, while the minus-sign indicates the lines which have been removed. The command commit
activates the configuration and updates the running configuration:
cfg> commit
cfg> show diff
As you can see from the output, after committing the configuration there is no difference between running and candidate configuration anymore. The RBFS system stores the previous configurations making it easier to return to a previous configuration in case the current configuration is faulty. You can view a commit history with the command:
cfg> show commit log
Rollback ID User Name Timestamp
0 supervisor 2023-07-01T08:54:09.337248+0000
1 supervisor 2023-07-01T08:50:59.361173+0000
2 supervisor 2023-07-01T08:34:15.621009+0000
3 supervisor 2023-07-01T08:27:03.983770+0000
<...>
The rollback ID 0 refers to currently running configuration. If you want to revert to an older version, you can use the rollback <id>
command, e.g.,
cfg> rollback 4
If you have made some configuration changes, but decide that you do not want to commit them, then you can reset the candidate configuration to the running configuration with the discard
command.
By default, the system configuration is not preserved on reboot. In order to use the last committed configuration after a reboot, the option set system load-last-config true ineeds to be configured.
|
Write and Read Configuration To/From Files
Sometimes it is useful to store the configuration in a file. In RBFS, the save command
command performs this task:
cfg> save config myconfig.json
The configuration is always stored in json format. In addition, only the running configuration is stored, not the candidate configuration. |
If you want to use a previously stored configuration, you can load it into the system with the load config
command:
cfg> load config myconfig.json replace
The configuration is loaded into the candidate configuration, i.e., it must be explicitly committed. There are two options how to load a configuration: replace (override the existing running configuration with this one) and merge (add the configuration from the file to the existing configuration).
|
License Management
A RBFS license allows you to access the full functionality of your system. Rtbrick provides a 28-day evaluation license on request. However, It is not allowed to be used evaluation licenses in production. Without any license installed on your system, you can evaluate RBFS for 7 days.
cfg> show system license
No license found
In order to install a permanent or subscription license, the set system license
command is used.
Configure the license that was provided to you by RtBrick on your node.
Click to reveal the answer
cfg> set system license <...>
cfg> show system license
License Validity:
License index 1:
Start date : Tue Feb 28 09:44:27 GMT +0000 2023
End date : Mon Mar 04 09:44:27 GMT +0000 2024