From 9f343bb58a5339cd9992bfb7dd2695cc8ee2b4a9 Mon Sep 17 00:00:00 2001
From: "Georgios P. Katsikas" <gkatsikas@ubitech.eu>
Date: Mon, 4 Nov 2024 15:35:14 +0000
Subject: [PATCH] fix: hardcoded paths in p4 L1 fwd test

---
 src/tests/p4-fwd-l1/mininet/2switch1path.py       | 4 ++--
 src/tests/p4-fwd-l1/mininet/4switch2path.py       | 8 ++++----
 src/tests/p4-fwd-l1/mininet/6switch2path.py       | 8 ++++----
 src/tests/p4-fwd-l1/mininet/8switch3path.py       | 8 ++++----
 src/tests/p4-fwd-l1/run_test_01_bootstrap.sh      | 3 +--
 src/tests/p4-fwd-l1/run_test_02_create_service.sh | 2 +-
 src/tests/p4-fwd-l1/run_test_03_delete_service.sh | 2 +-
 src/tests/p4-fwd-l1/run_test_04_cleanup.sh        | 2 +-
 src/tests/p4-fwd-l1/setup.sh                      | 4 ++--
 src/tests/p4-fwd-l1/tests/Objects.py              | 2 +-
 10 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/src/tests/p4-fwd-l1/mininet/2switch1path.py b/src/tests/p4-fwd-l1/mininet/2switch1path.py
index 91db70052..d782d1085 100644
--- a/src/tests/p4-fwd-l1/mininet/2switch1path.py
+++ b/src/tests/p4-fwd-l1/mininet/2switch1path.py
@@ -73,12 +73,12 @@ class TutorialTopo(Topo):
 def main():
     net = Mininet(topo=TutorialTopo(), controller=None)
     net.start()
-    
+
     client = net.hosts[0]
     client.setARP('10.0.0.2', 'aa:bb:cc:dd:ee:22')
     server = net.hosts[1]
     server.setARP('10.0.0.1', 'aa:bb:cc:dd:ee:11')
-    
+
     CLI(net)
     net.stop()
     print '#' * 80
diff --git a/src/tests/p4-fwd-l1/mininet/4switch2path.py b/src/tests/p4-fwd-l1/mininet/4switch2path.py
index d8ad04b01..0c0fa578b 100644
--- a/src/tests/p4-fwd-l1/mininet/4switch2path.py
+++ b/src/tests/p4-fwd-l1/mininet/4switch2path.py
@@ -70,13 +70,13 @@ class TutorialTopo(Topo):
                            ip='10.0.0.1/24', gw='10.0.0.100')
         server = self.addHost('server', cls=IPv4Host, mac="aa:bb:cc:dd:ee:22",
                            ip='10.0.0.2/24', gw='10.0.0.100')
-        
+
         # Switch links
         self.addLink(switch1, switch2)  # Switch1:port 1, Switch2:port 1
         self.addLink(switch1, switch3)  # Switch1:port 2, Switch3:port 1
         self.addLink(switch2, switch4)  # Switch2:port 2, Switch4:port 1
         self.addLink(switch3, switch4)  # Switch3:port 2, Switch4:port 2
-        
+
         # Host links
         self.addLink(client, switch1)  # Switch 1: port 3
         self.addLink(server, switch4)  # Switch 4: port 3
@@ -84,12 +84,12 @@ class TutorialTopo(Topo):
 def main():
     net = Mininet(topo=TutorialTopo(), controller=None)
     net.start()
-    
+
     client = net.hosts[0]
     client.setARP('10.0.0.2', 'aa:bb:cc:dd:ee:22')
     server = net.hosts[1]
     server.setARP('10.0.0.1', 'aa:bb:cc:dd:ee:11')
-    
+
     CLI(net)
     net.stop()
     print '#' * 80
diff --git a/src/tests/p4-fwd-l1/mininet/6switch2path.py b/src/tests/p4-fwd-l1/mininet/6switch2path.py
index 8efb4b017..b98c0e960 100644
--- a/src/tests/p4-fwd-l1/mininet/6switch2path.py
+++ b/src/tests/p4-fwd-l1/mininet/6switch2path.py
@@ -74,7 +74,7 @@ class TutorialTopo(Topo):
                            ip='10.0.0.1/24', gw='10.0.0.100')
         server = self.addHost('server', cls=IPv4Host, mac="aa:bb:cc:dd:ee:22",
                            ip='10.0.0.2/24', gw='10.0.0.100')
-        
+
         # Switch links
         self.addLink(switch1, switch2)  # Switch1:port 1, Switch2:port 1
         self.addLink(switch1, switch3)  # Switch1:port 2, Switch3:port 1
@@ -84,7 +84,7 @@ class TutorialTopo(Topo):
 
         self.addLink(switch4, switch6)  # Switch4:port 2, Switch6:port 1
         self.addLink(switch5, switch6)  # Switch5:port 2, Switch6:port 2
-        
+
         # Host links
         self.addLink(client, switch1)  # Switch1: port 3
         self.addLink(server, switch6)  # Switch6: port 3
@@ -92,12 +92,12 @@ class TutorialTopo(Topo):
 def main():
     net = Mininet(topo=TutorialTopo(), controller=None)
     net.start()
-    
+
     client = net.hosts[0]
     client.setARP('10.0.0.2', 'aa:bb:cc:dd:ee:22')
     server = net.hosts[1]
     server.setARP('10.0.0.1', 'aa:bb:cc:dd:ee:11')
-    
+
     CLI(net)
     net.stop()
     print '#' * 80
diff --git a/src/tests/p4-fwd-l1/mininet/8switch3path.py b/src/tests/p4-fwd-l1/mininet/8switch3path.py
index 20322fac9..3dea60789 100755
--- a/src/tests/p4-fwd-l1/mininet/8switch3path.py
+++ b/src/tests/p4-fwd-l1/mininet/8switch3path.py
@@ -79,7 +79,7 @@ class TutorialTopo(Topo):
                             ip='10.0.0.1/24', gw='10.0.0.100')
         server = self.addHost('server', cls=IPv4Host, mac="aa:bb:cc:dd:ee:22",
                             ip='10.0.0.2/24', gw='10.0.0.100')
-        
+
         # Switch links
         self.addLink(switch1, switch2)  # Switch1:port 1, Switch2:port 1
         self.addLink(switch1, switch4)  # Switch1:port 2, Switch4:port 1
@@ -92,7 +92,7 @@ class TutorialTopo(Topo):
         self.addLink(switch3, switch8)  # Switch3:port 2, Switch8:port 1
         self.addLink(switch5, switch8)  # Switch5:port 2, Switch8:port 2
         self.addLink(switch7, switch8)  # Switch7:port 2, Switch8:port 3
-        
+
         # Host links
         self.addLink(client, switch1)   # Switch1: port 4
         self.addLink(server, switch8)   # Switch8: port 4
@@ -100,13 +100,13 @@ class TutorialTopo(Topo):
 def main():
     net = Mininet(topo=TutorialTopo(), controller=None)
     net.start()
-    
+
     #get hosts
     client = net.hosts[0]
     client.setARP('10.0.0.2', 'aa:bb:cc:dd:ee:22')
     server = net.hosts[1]
     server.setARP('10.0.0.1', 'aa:bb:cc:dd:ee:11')
-    
+
     CLI(net)
     net.stop()
     print '#' * 80
diff --git a/src/tests/p4-fwd-l1/run_test_01_bootstrap.sh b/src/tests/p4-fwd-l1/run_test_01_bootstrap.sh
index 60bb20d0d..bbe76d67e 100755
--- a/src/tests/p4-fwd-l1/run_test_01_bootstrap.sh
+++ b/src/tests/p4-fwd-l1/run_test_01_bootstrap.sh
@@ -18,5 +18,4 @@
 # - tfs_runtime_env_vars.sh
 
 source tfs_runtime_env_vars.sh
-python -m pytest --verbose src/tests/p4/tests/test_functional_bootstrap.py
-
+python -m pytest --verbose src/tests/p4-fwd-l1/tests/test_functional_bootstrap.py
diff --git a/src/tests/p4-fwd-l1/run_test_02_create_service.sh b/src/tests/p4-fwd-l1/run_test_02_create_service.sh
index 824626234..07c165ce7 100755
--- a/src/tests/p4-fwd-l1/run_test_02_create_service.sh
+++ b/src/tests/p4-fwd-l1/run_test_02_create_service.sh
@@ -14,4 +14,4 @@
 # limitations under the License.
 
 source tfs_runtime_env_vars.sh
-python -m pytest --verbose src/tests/p4/tests/test_functional_create_service.py
+python -m pytest --verbose src/tests/p4-fwd-l1/tests/test_functional_create_service.py
diff --git a/src/tests/p4-fwd-l1/run_test_03_delete_service.sh b/src/tests/p4-fwd-l1/run_test_03_delete_service.sh
index c4337daea..46c22f1f4 100755
--- a/src/tests/p4-fwd-l1/run_test_03_delete_service.sh
+++ b/src/tests/p4-fwd-l1/run_test_03_delete_service.sh
@@ -14,4 +14,4 @@
 # limitations under the License.
 
 source tfs_runtime_env_vars.sh
-python -m pytest --verbose src/tests/p4/tests/test_functional_delete_service.py
+python -m pytest --verbose src/tests/p4-fwd-l1/tests/test_functional_delete_service.py
diff --git a/src/tests/p4-fwd-l1/run_test_04_cleanup.sh b/src/tests/p4-fwd-l1/run_test_04_cleanup.sh
index f2ebec08b..8ad9e259d 100755
--- a/src/tests/p4-fwd-l1/run_test_04_cleanup.sh
+++ b/src/tests/p4-fwd-l1/run_test_04_cleanup.sh
@@ -14,4 +14,4 @@
 # limitations under the License.
 
 source tfs_runtime_env_vars.sh
-python -m pytest --verbose src/tests/p4/tests/test_functional_cleanup.py
+python -m pytest --verbose src/tests/p4-fwd-l1/tests/test_functional_cleanup.py
diff --git a/src/tests/p4-fwd-l1/setup.sh b/src/tests/p4-fwd-l1/setup.sh
index 1e6b63c54..e1c943831 100755
--- a/src/tests/p4-fwd-l1/setup.sh
+++ b/src/tests/p4-fwd-l1/setup.sh
@@ -18,5 +18,5 @@ export POD_NAME=$(kubectl get pods -n=tfs | grep device | awk '{print $1}')
 
 kubectl exec ${POD_NAME} -n=tfs -c=server -- mkdir /root/p4
 
-kubectl cp src/tests/p4/p4/p4info.txt tfs/${POD_NAME}:/root/p4 -c=server
-kubectl cp src/tests/p4/p4/bmv2.json tfs/${POD_NAME}:/root/p4 -c=server
+kubectl cp src/tests/p4-fwd-l1/p4/p4info.txt tfs/${POD_NAME}:/root/p4 -c=server
+kubectl cp src/tests/p4-fwd-l1/p4/bmv2.json tfs/${POD_NAME}:/root/p4 -c=server
diff --git a/src/tests/p4-fwd-l1/tests/Objects.py b/src/tests/p4-fwd-l1/tests/Objects.py
index d8f08c271..32bda1684 100644
--- a/src/tests/p4-fwd-l1/tests/Objects.py
+++ b/src/tests/p4-fwd-l1/tests/Objects.py
@@ -506,7 +506,7 @@ LINKS = [
     LINK_SW8_SW3,
     LINK_SW8_SW5,
     LINK_SW8_SW7,
-] 
+]
 
 SERVICES = [
     (SERVICE_SW1_SW8, SERVICE_SW1_SW8_ENDPOINT_IDS),
-- 
GitLab