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:
@@ -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
|
||||
17
scripts/10-host_setup_node1.sh
Normal file
17
scripts/10-host_setup_node1.sh
Normal 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
|
||||
17
scripts/10-host_setup_node2.sh
Normal file
17
scripts/10-host_setup_node2.sh
Normal 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
|
||||
@@ -105,20 +105,21 @@ respective IP.
|
||||
|
||||
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
|
||||
> of the hosts commented in and the other sections commented out.
|
||||
> These scripts need to be run on the respective nodes.
|
||||
|
||||
This script executes multiple scripts which setup the hosts.
|
||||
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:
|
||||
This script executes the helper scripts to
|
||||
|
||||
- The interface name which is connected to the switch
|
||||
- MAC address of the interface
|
||||
- Unused IP address
|
||||
- And take a look at the appendix under "Adding new node"
|
||||
- Setup Namespaces
|
||||
- Setup Interfaces
|
||||
- Setup IP Addresses
|
||||
- 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
|
||||
|
||||
@@ -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.
|
||||
|
||||
#### 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
|
||||
#!/bin/bash
|
||||
|
||||
# node3
|
||||
sudo ./30-add_namespaces.sh tb_node3_if0
|
||||
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
|
||||
|
||||
Add the following section for your new interfaces like this:
|
||||
Replace the placeholder mac address with the actual MAC addresses of the interfaces.
|
||||
|
||||
```sh
|
||||
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.4 00:00:00:00:00:04
|
||||
```
|
||||
|
||||
Replace the placeholder mac address with the actual MAC addresses of the interfaces.
|
||||
|
||||
Reference in New Issue
Block a user