Create Lab 00 authored by Katharina Renk's avatar Katharina Renk
UNDER CONSTRUCTION
# Lab 00
In this lab, we will set up a simple topology with [containerlab](https://containerlab.dev/) and configure two cEOS switches that we manage with the goSDN controller.
The figure below shows what we want to set up using the goSDN-Controller, goSDN-CLI and gnmi:
![lab00-network.drawio](uploads/f77e5dbfea308bbb35a94e82f91c60b7/lab00-network.drawio.png)
## Initial Steps
### Delete old version of GO
```
sudo rm -rf /usr/local/go
```
### Download Go
#### Check for latest system updates using the commands below
```
sudo apt update
sudo apt upgrade
```
#### Download Go using the command wget and link
```
wget https://go.dev/dl/go1.20.1.linux-amd64.tar.gz
```
#### Extract the libraries using the tar command and placing it in the correct location
```
sudo tar -C /usr/local/ -xzf go1.20.1.linux-amd64.tar.gz
cd /usr/local/
```
#### Set path for GO
```
echo $PATH
sudo nano $HOME/.profile
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
source $HOME/.profile
cat $HOME/.profile
```
#### Optional: Set GO path to use with sudo
```
sudo nano /etc/sudoers
```
And add by secure_path at the end:
```
:/usr/local/go/bin
```
#### Check Go version
```
go version
```
If an error occurs it is recommended to log in again, so the .profile can be applied correctly.
### Download docker
#### Uninstall the tech preview or beta version of Docker Desktop for Linux
```
sudo apt remove docker-desktop
```
#### Install Docker
```
sudo apt-get update
```
Download latest DEB package from the [release page](https://docs.docker.com/desktop/linux/install/)
```
sudo apt-get install ./docker-desktop-4.10.1-amd64.deb
systemctl --user start docker-desktop
```
Create docker group (it may be that it already exists)
```
sudo groupadd docker
```
Add user to docker group
```
sudo usermod -aG docker $USER
```
Log in to the docker group
```
newgrp docker
```
#### Launch Docker
```
systemctl --user start docker-desktop
docker compose version
docker –version
docker version
```
### Download Containerlab
Install it via install script:
```
bash -c "$(curl -sL https://get.containerlab.dev)"
```
### Install Make
```
sudo apt install Make
```
### Get the goSDN repository from the Gitlab site
Go into the directory where you want to have this repository.
Get it with SSH:
```
git clone git@code.fbi.h-da.de:danet/gosdn.git
```
Or et it with HTTPS:
```
git clone https://code.fbi.h-da.de/danet/gosdn.git
```
you can find the repository with this link:
```
https://code.fbi.h-da.de/danet/gosdn
```
### Run command for the submodules
```
cd gosdn/
git submodule update --init -–recursive
```
### Run the containerlab
```
make containerlab-start
```
### Download the folder below and place it into the artifacts folder of your gosdn folder
[lab01.zip](uploads/e7bbf3f0575a4e471c8ba8862c0b2dde/lab01.zip)
Or get it with wget:
```
wget https://code.fbi.h-da.de/danet/gosdn/-/wikis/uploads/e7bbf3f0575a4e471c8ba8862c0b2dde/lab01.zip
```
### 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
```
![CLI_image](uploads/155116353627ae3070a53b3fdaeda421/CLI_image.PNG)
### 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)
![login_password](uploads/01ef770d924f8d3f85726bbf124f93fd/login_password.PNG)
### Set up the PND ID
```
pnd use (Choose ID from the displayed menu)
```
![PND_id_display](uploads/2a9f123cc63f6bc1b046beca92c6d0b2/PND_id_display.PNG)
![PND_success](uploads/1f9ec97b38ee90fcdcf0c157972297a1/PND_success.PNG)
### Set-Up the devices/switches
```
mne create --address 172.100.0.11:6030 --name switch1 --username admin --password admin --type plugin
mne create --address 172.100.0.12:6030 --name switch2 --username admin --password admin --type plugin
```
### Check for the devices
```
mne list
```
### Configuration of the switches(the UUID have to be changed according to the output from the devices)
#### Switch 1
```
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 network-instances/network-instance[name=default]/config --file ./lab01/enable-routing.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 interfaces/interface[name=Ethernet1] --file ./lab01/s01-ethernet01.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 interfaces/interface[name=Ethernet2] --file ./lab01/s01-ethernet02.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 network-instances/network-instance[name=default]/protocols --file ./lab01/s01-route.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 network-instances/network-instance[name=default]/tables --file ./lab01/tables.json --force-push
```
#### Switch 2
```
mne set c724b95b-c751-4728-9f19-376e0d570104 network-instances/network-instance[name=default]/config --file ./lab01/enable-routing.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 interfaces/interface[name=Ethernet1] --file ./lab01/s02-ethernet01.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 interfaces/interface[name=Ethernet2] --file ./lab01/s02-ethernet02.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 network-instances/network-instance[name=default]/protocols --file ./lab01/s02-route.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 network-instances/network-instance[name=default]/tables --file ./lab01/tables.json --force-push
```
If you've cloned the goSDN repo from [here](https://code.fbi.h-da.de/danet/gosdn) and have all the requirements, then you can start the containerlab topology (which is defined below) using the command `make containerlab-start` from within the root of the repository
## CLI and the controller
### Setup centos devices
Since we do not have access via gNMI on those devices, we have to perform some steps manually, within the container itself.
First we have to get into the centos device via
`docker exec -it clab-gosdn_csbi_arista_base-centos1 bash`
and run the following commands:
```
[root@centos1 /]# ip address add 10.0.0.100/24 dev eth1
[root@centos1 /]# ip route del default
[root@centos1 /]# ip route add default via 10.0.0.1 dev eth1
[root@centos1 /]# exit
```
`docker exec -it clab-gosdn_csbi_arista_base-centos2 bash`
```
[root@centos2 /]# ip address add 192.168.0.100/24 dev eth1
[root@centos2 /]# ip route del default
[root@centos2 /]# ip route add default via 192.168.0.1 dev eth1
[root@centos2 /]# exit
```
## Testing our setup
### Ping the centos devices with the ip's
```
docker exec -ti clab-gosdn_csbi_arista_base-centos1 ping 192.168.0.1
docker exec -ti clab-gosdn_csbi_arista_base-centos2 ping 10.0.0.1
```