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
In this step, the network interfaces and routing configuration for each switch will be set up. With the goSDN CLI, the configuration can also be changed by specifying the path to a .json file which contains the new values.
Download Lab01.zip
To execute this commands, you can either exit the goSDN CLI with exit
or open a new terminal or SSH connection (depends if you are using the lab locally or in a VM).
Now, download Lab01.zip or get it with wget if you are using Linux:
wget https://code.fbi.h-da.de/danet/gosdn/-/wikis/uploads/14a354b543ecdc0658313bf19084b967/Lab01.zip
Afterwards, unzip Lab01.zip:
unzip Lab01.zip
Best practice: Place it afterwards into the artifacts folder of your gosdn directory.
Optional: Use the script in Lab01 to copy-paste configuration commands
The directory Lab01 contains different files for the switch interfaces and routing configurations. For each of this, a command on the SDN controller CLI has to be set up that specifies the path to the file and the path on the switch that has to be modified. 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:
go build -o buildclicommands main.go
Then, it can simply be used by setting the UUID`s of the switches as parameters by startup:
./buildclicommands -switch0 "<UUID of Switch0>" -switch1 "<UUID of Switch1>"
Now, you will find `commands-output.txt' which contains the ready-to-copy-paste commands!
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 path get <UUID of Switch0>
mne path get <UUID of Switch1>
Please note: The script specifies the path to the .json files 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!
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
Now, we configured both switches and we can exit the goSDN CLI:
exit
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
If both pings work, congrats! You set up Lab01 successfully!
Shut down the containerlab
Go to the directory of gosdn and use following command:
make containerlab-slim-stop