refactor(testbed): Split node scripts from ./10-host_setup.sh

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2024-12-30 17:25:17 +01:00
parent 66d1e9eb58
commit f3e97a4619
4 changed files with 52 additions and 49 deletions

View File

@@ -1,35 +0,0 @@
#!/bin/bash
# node1
sudo ./30-add_namespaces.sh tb_node1_if0
sudo ./30-add_namespaces.sh tb_node1_if1
sudo ./30-add_namespaces.sh tb_node1_if2
sudo ./30-add_namespaces.sh tb_node1_if3
sudo ./31-configure_interfaces.sh tb_node1_if0 enp6s0f0np0 10.0.1.1/16
sudo ./31-configure_interfaces.sh tb_node1_if1 enp6s0f1np1 10.0.1.2/16
sudo ./31-configure_interfaces.sh tb_node1_if2 enp6s0f2np2 10.0.1.3/16
sudo ./31-configure_interfaces.sh tb_node1_if3 enp6s0f3np3 10.0.1.4/16
sudo ./32-setup_arp.sh tb_node1_if0 enp6s0f0np0
sudo ./32-setup_arp.sh tb_node1_if1 enp6s0f1np1
sudo ./32-setup_arp.sh tb_node1_if2 enp6s0f2np2
sudo ./32-setup_arp.sh tb_node1_if3 enp6s0f3np3
# node2
# Create Namespace: Testbed on Node1 for Interface n
sudo ./30-add_namespaces.sh tb_node2_if0
sudo ./30-add_namespaces.sh tb_node2_if1
sudo ./30-add_namespaces.sh tb_node2_if2
sudo ./30-add_namespaces.sh tb_node2_if3
sudo ./31-configure_interfaces.sh tb_node2_if0 enp6s0f0np0 10.0.2.1/16
sudo ./31-configure_interfaces.sh tb_node2_if1 enp6s0f1np1 10.0.2.2/16
sudo ./31-configure_interfaces.sh tb_node2_if2 enp6s0f2np2 10.0.2.3/16
sudo ./31-configure_interfaces.sh tb_node2_if3 enp6s0f3np3 10.0.2.4/16
# execute arp
sudo ./32-setup_arp.sh tb_node2_if0 enp6s0f0np0
sudo ./32-setup_arp.sh tb_node2_if1 enp6s0f1np1
sudo ./32-setup_arp.sh tb_node2_if2 enp6s0f2np2
sudo ./32-setup_arp.sh tb_node2_if3 enp6s0f3np3

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# node1
sudo ./30-add_namespaces.sh tb_node1_if0
sudo ./30-add_namespaces.sh tb_node1_if1
sudo ./30-add_namespaces.sh tb_node1_if2
sudo ./30-add_namespaces.sh tb_node1_if3
sudo ./31-configure_interfaces.sh tb_node1_if0 enp6s0f0np0 10.0.1.1/16
sudo ./31-configure_interfaces.sh tb_node1_if1 enp6s0f1np1 10.0.1.2/16
sudo ./31-configure_interfaces.sh tb_node1_if2 enp6s0f2np2 10.0.1.3/16
sudo ./31-configure_interfaces.sh tb_node1_if3 enp6s0f3np3 10.0.1.4/16
sudo ./32-setup_arp.sh tb_node1_if0 enp6s0f0np0
sudo ./32-setup_arp.sh tb_node1_if1 enp6s0f1np1
sudo ./32-setup_arp.sh tb_node1_if2 enp6s0f2np2
sudo ./32-setup_arp.sh tb_node1_if3 enp6s0f3np3

View File

@@ -0,0 +1,17 @@
#!/bin/bash
# node2
sudo ./30-add_namespaces.sh tb_node2_if0
sudo ./30-add_namespaces.sh tb_node2_if1
sudo ./30-add_namespaces.sh tb_node2_if2
sudo ./30-add_namespaces.sh tb_node2_if3
sudo ./31-configure_interfaces.sh tb_node2_if0 enp6s0f0np0 10.0.2.1/16
sudo ./31-configure_interfaces.sh tb_node2_if1 enp6s0f1np1 10.0.2.2/16
sudo ./31-configure_interfaces.sh tb_node2_if2 enp6s0f2np2 10.0.2.3/16
sudo ./31-configure_interfaces.sh tb_node2_if3 enp6s0f3np3 10.0.2.4/16
sudo ./32-setup_arp.sh tb_node2_if0 enp6s0f0np0
sudo ./32-setup_arp.sh tb_node2_if1 enp6s0f1np1
sudo ./32-setup_arp.sh tb_node2_if2 enp6s0f2np2
sudo ./32-setup_arp.sh tb_node2_if3 enp6s0f3np3

View File

@@ -105,20 +105,21 @@ respective IP.
This script is run with `bfshell -b $(pwd)/04-wedge_route_configure.py` This script is run with `bfshell -b $(pwd)/04-wedge_route_configure.py`
### 10-host_setup.sh ### 10-host*setup*\*.sh
> This script needs to be run on the respective nodes with the section > These scripts need to be run on the respective nodes.
> of the hosts commented in and the other sections commented out.
This script executes multiple scripts which setup the hosts. This script executes the helper scripts to
In our setup we'll only have two hosts, but this can be extended to other
hosts as well.
Information needed to do so is:
- The interface name which is connected to the switch - Setup Namespaces
- MAC address of the interface - Setup Interfaces
- Unused IP address - Setup IP Addresses
- And take a look at the appendix under "Adding new node" - Setup ARP Table Entries
on the respective node.
./10-host_setup_node1.sh needs to be executed on node1.
./10-host_setup_node2.sh needs to be executed on node2.
### 19-cleanup.sh ### 19-cleanup.sh
@@ -263,11 +264,13 @@ bfrt.l1switch.pipe.SwitchIngress.t_l1_forwarding.add_with_send(
- egress_port: Value at the `D_P` column at the output of the last script. - egress_port: Value at the `D_P` column at the output of the last script.
#### Adjust ./10-host_setup.sh #### Add ./10-host_setup_node3.sh
Add a section for you new node like this: Create a new script
```sh ```sh
#!/bin/bash
# node3 # node3
sudo ./30-add_namespaces.sh tb_node3_if0 sudo ./30-add_namespaces.sh tb_node3_if0
sudo ./30-add_namespaces.sh tb_node3_if1 sudo ./30-add_namespaces.sh tb_node3_if1
@@ -290,7 +293,6 @@ Adjust [./32-setup_arp.sh](./32-setup_arp.sh) before running this script.
#### Adjust ./32-setup_arp.sh #### Adjust ./32-setup_arp.sh
Add the following section for your new interfaces like this: Add the following section for your new interfaces like this:
Replace the placeholder mac address with the actual MAC addresses of the interfaces.
```sh ```sh
ip netns exec "$NS" arp -i "$IF" -s 10.0.3.1 00:00:00:00:00:01 ip netns exec "$NS" arp -i "$IF" -s 10.0.3.1 00:00:00:00:00:01
@@ -298,3 +300,5 @@ ip netns exec "$NS" arp -i "$IF" -s 10.0.3.2 00:00:00:00:00:02
ip netns exec "$NS" arp -i "$IF" -s 10.0.3.3 00:00:00:00:00:03 ip netns exec "$NS" arp -i "$IF" -s 10.0.3.3 00:00:00:00:00:03
ip netns exec "$NS" arp -i "$IF" -s 10.0.3.4 00:00:00:00:00:04 ip netns exec "$NS" arp -i "$IF" -s 10.0.3.4 00:00:00:00:00:04
``` ```
Replace the placeholder mac address with the actual MAC addresses of the interfaces.