In this lab, we will set up a simple topology with containerlab. We will create and modify gnmi-target-switch0 (server with a gNMI-target, handled as switch) that we manage with the goSDN controller.
Please note: You need to have the lab-vm or all the software in Prerequisites installed to run this lab.
The figure below shows what we want to set up using the goSDN-Controller, goSDN-CLI and gNMI:
Run the containerlab
Go to the directory of gosdn and use following command:
make containerlab-slim-start
Open a new terminal and start the CLI to talk to the controller (Do not close the previous terminal)
Build command prompt
make build
cd artifacts
./gosdnc prompt
Login into the controller with the credentials
login --controller 172.100.0.5:55055 --u admin --p <password>
To get the (password) go to the previous terminal and use the following commands
docker logs clab-gosdn_csbi_arista_base-gosdn
In the end of the script a 16 character alphanumeric password is generated like this: “Generated admin password: uyslboh15gjp9dne” (not the actual password, just an example)
Set-up the PND ID
pnd use (Choose ID from the displayed menu)
Set-up the switches
Switch 0:
mne create --address 172.100.0.11:7030 --name switch0 --username admin --password admin --tls --plugin-id d1c269a2-6482-4010-b0d8-679dff73153b
Switch 1:
mne create --address 172.100.0.12:7030 --name switch1 --username admin --password admin --tls --plugin-id d1c269a2-6482-4010-b0d8-679dff73153b
Check if the switches were created
mne list
In here, the UUID is also visible which we need for the next step:
Please note that the UUID may vary.
Configuration of the switches
Lab01.zip or get it with wget if you are using Linux:
Download the folder below and place it into the artifacts folder of your gosdn folderwget https://code.fbi.h-da.de/danet/gosdn/-/wikis/uploads/7cd972bedd7c3d29f83707907f8c42ae/Lab01.zip
Afterwards, unzip Lab01.zip: ´´´bash unzip Lab01.zip ´´´
Optional: Use the script in the now unzipped directory Lab01
The directory Lab01 contains different files for the switch interfaces and routing configurations. For each of this, the path to the file has to be modified manually. To simplify the process and avoid typos, the script delivered with Lab01.zip can be used. To set it up, it has to be built:
´´´bash
go build -o buildclicommands main.go
´´´
Then, it can simply be used by setting the UUIDs of the switches as parameters by startup: ´´´bash ./buildclicommands -switch0 "<UUID of Switch0>" -switch1 "<UUID of Switch1>" ´´´ Now, you will find
commands-output.txt' which contains the ready-to-copy-paste commands!
Please note: The path to the files is specified automatically by the location of the directory Lab01. The location of the directory Lab01 can be moved, but the script and configuration files have to stay inside the directory for the script to work!
Next, the scheme tree for the switches need to be loaded, otherwise an error message appears it could not be found. For this, following commands need to be typed: ´´´ mne get path ´´´ ´´´ mne get path ´´´
Switch 0
Modify interfaces eth1 and eth2
mne path set <UUID of Switch0> interfaces/interface[name=eth1] --file <path to Lab01>/s0-eth1.json --force-push
mne path set <UUID of Switch0> interfaces/interface[name=eth2] --file <path to Lab01>/s0-eth2.json --force-push
Insert the routes
mne path set <UUID of Switch0> network-instances/network-instance[name=default]/protocols --file <path to Lab01>/s0-route.json --force-push
Switch 1
Modify interfaces eth1 and eth2
mne path set <UUID of Switch1> interfaces/interface[name=eth1] --file <path to Lab01>/s1-eth1.json --force-push
mne path set <UUID of Switch1> interfaces/interface[name=eth2] --file <path to Lab01>/s1-eth2.json --force-push
Insert the routes
mne path set <UUID of Switch1> network-instances/network-instance[name=default]/protocols --file <path to Lab01>/s1-route.json --force-push
CLI and the controller
Setup centos clients
Since we do not have access via gNMI on those devices, we have to perform some steps manually, within the container itself.
Client Centos0
First we have to get into the first client centos0 via
docker exec -it clab-gosdn_csbi_arista_base-centos0 bash
and run the following commands:
ip link set dev eth1 mtu 1500
ip address add 10.0.0.100/24 dev eth1
ip route del default
ip route add default via 10.0.0.1 dev eth1
ip route add 10.50.0.2/32 via 10.0.0.1 dev eth1
exit
Client Centos1
Now we access the bash of centos1:
docker exec -it clab-gosdn_csbi_arista_base-centos1 bash
And execute following commands:
ip link set dev eth1 mtu 1500
ip address add 192.168.0.100/24 dev eth1
ip route del default
ip route add default via 192.168.0.1 dev eth1
ip route add 10.50.0.1/32 via 192.168.0.1 dev eth1
exit
Testing our setup
Ping the centos devices with their ip's
docker exec -ti clab-gosdn_csbi_arista_base-centos0 ping 192.168.0.100
docker exec -ti clab-gosdn_csbi_arista_base-centos1 ping 10.0.0.100
Shut down the containerlab
Go to the directory of gosdn and use following command:
make containerlab-slim-stop