Update Lab01 authored by Katharina Renk's avatar Katharina Renk
**UNDER CONSTRUCTION!**
In this lab, we will set up a simple topology with [containerlab](https://containerlab.dev/). 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](Labs/Prerequisites) installed to run this lab.**
The figure below shows what we want to set up using the goSDN-Controller, goSDN-CLI and gNMI:
![lab01-network](uploads/ee4893bcc17020b444ba0b11012ea3f5/lab01-network.png)
## Run command to build the docker image for the gNMI target
First, go to your local gnmi-target repository:
```bash
cd gnmi-target
```
Next, build the image:
```bash
git checkout develop
make container
```
## Run the containerlab
Go to the directory of gosdn and use following command:
```bash
make containerlab-slim-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 if you are using Linux:
```bash
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
```bash
make build
cd artifacts
./gosdnc prompt
```
![CLI_image](uploads/155116353627ae3070a53b3fdaeda421/CLI_image.PNG)
## Login into the controller with the credentials
```bash
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
```bash
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
```bash
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 switches
Switch0:
```bash
mne create --address 172.100.0.11:7030 --name switch0 --username admin --password admin --tls --plugin-id d1c269a2-6482-4010-b0d8-679dff73153b
```
Switch1:
```bash
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
```bash
mne list
```
In here, the UUID is also visible which we need for the next step:![Lab00_mne_list](uploads/23ec897ac1b9a307e733786529cf875f/Lab00_mne_list.png)
**Please note that the UUID may vary.**
## Configuration of the switches(the UUID have to be changed according to the output from the devices)
### Switch 1
```bash
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 network-instances/network-instance[name=default]/config --file ./lab00/enable-routing.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 interfaces/interface[name=Ethernet1] --file ./lab00/s01-ethernet01.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 interfaces/interface[name=Ethernet2] --file ./lab00/s01-ethernet02.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 network-instances/network-instance[name=default]/protocols --file ./lab00/s01-route.json --force-push
mne set 401982c5-fb98-4402-b98f-1b6d30915fc4 network-instances/network-instance[name=default]/tables --file ./lab00/tables.json --force-push
```
### Switch 2
```bash
mne set c724b95b-c751-4728-9f19-376e0d570104 network-instances/network-instance[name=default]/config --file ./lab00/enable-routing.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 interfaces/interface[name=Ethernet1] --file ./lab00/s02-ethernet01.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 interfaces/interface[name=Ethernet2] --file ./lab00/s02-ethernet02.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 network-instances/network-instance[name=default]/protocols --file ./lab00/s02-route.json --force-push
mne set c724b95b-c751-4728-9f19-376e0d570104 network-instances/network-instance[name=default]/tables --file ./lab00/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:
```text
[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`
```text
[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 their ip's
```bash
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
```