summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2023-10-27 10:32:16 +0000
committersongyanchao <[email protected]>2023-10-27 10:33:10 +0000
commita2cb9faeaf0089f37d91a33af15d4476ee34d034 (patch)
tree87b798c19be509e48da7c2045d98a150c93f2f3a
parentd0cbe729e375dceb7208967458492a9f31fab783 (diff)
🧪 test(DPISDN-24): Add tests for Etherfabric adapter tap modev4.6.58-20231027
Add tests for Etherfabric adapter tap mode
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/etherfabric_test.py108
2 files changed, 105 insertions, 5 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e47c74c..588b41a 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -64,7 +64,7 @@ add_test(
NAME etherfabric_test
COMMAND /usr/local/bin/ptf --test-dir ${CMAKE_SOURCE_DIR}/test
--interface 0@veth0-ptf0
- etherfabric_base_test --test-params "source_dir='${CMAKE_SOURCE_DIR}'"
+ virtual_wire_mode tap_mode --test-params "source_dir='${CMAKE_SOURCE_DIR}'"
)
# Add health_check test
diff --git a/test/etherfabric_test.py b/test/etherfabric_test.py
index 3de47e6..205a9c3 100644
--- a/test/etherfabric_test.py
+++ b/test/etherfabric_test.py
@@ -5,7 +5,7 @@ from scapy.all import *
from mrzcpd import Mrzcpd
from common_pkt import *
-base_conf = """
+conf_for_virtual_wire_mode = """
[device]
device=veth0
sz_tunnel=8192
@@ -79,8 +79,8 @@ listen_device=veth0
"""
-@group("etherfabric_base_test")
-class TestForBase(BaseTest):
+@group("virtual_wire_mode")
+class TestForVirtualWireMode(BaseTest):
def setUp(self):
self.dataplane = ptf.dataplane_instance
@@ -90,7 +90,7 @@ class TestForBase(BaseTest):
def runTest(self):
try:
# Init & Start mrzcpd
- mrzcpd = Mrzcpd(base_conf)
+ mrzcpd = Mrzcpd(conf_for_virtual_wire_mode)
mrzcpd.start()
send_pkt = simple_vxlan_packet(
@@ -103,3 +103,103 @@ class TestForBase(BaseTest):
verify_packets(self, verify_pkt, [0])
finally:
mrzcpd.stop()
+
+conf_for_tap_mode = """
+[device]
+device=veth0
+sz_tunnel=8192
+sz_buffer=0
+
+[device:veth0]
+in_addr=10.254.60.1
+in_mask=255.255.255.0
+gateway=10.10.1.40
+promisc=1
+mtu=1500
+driver=2
+role=3
+
+[service]
+iocore=1
+distmode=2
+hashmode=0
+
+[eal]
+virtaddr=0x600000000000
+loglevel=7
+nohuge=1
+mem=65535
+
+[keepalive]
+check_spinlock=1
+
+[ctrlzone]
+ctrlzone0=tunnat, 64
+ctrlzone1=vsys, 64
+
+[pool]
+create_mode=3
+sz_direct_pktmbuf=4096
+sz_indirect_pktmbuf=4096
+sz_cache=256
+sz_data=3000
+
+[ctrlmsg]
+listen_addr=0.0.0.0
+listen_port=46789
+
+[rpc]
+addr=127.0.0.1
+port=56789
+
+# sid
+[etherfabric_adapters]
+sid_range_start=100
+sid_range_end=200
+max_rules=256
+
+[vwires]
+sid_range_start=300
+sid_range_end=400
+max_rules=256
+
+[service_lb]
+sid_range_start=1000
+sid_range_end=2000
+
+[etherfabric_adapters]
+sid_range_start=100
+sid_range_end=200
+max_rules=256
+
+[etherfabric_adapter:0]
+mode=tap
+listen_device=veth0
+"""
+@group("tap_mode")
+class TestForTapMode(BaseTest):
+ def setUp(self):
+ self.dataplane = ptf.dataplane_instance
+
+ def __init__(self):
+ BaseTest.__init__(self)
+
+ def runTest(self):
+ try:
+ # Init & Start mrzcpd
+ mrzcpd = Mrzcpd(conf_for_tap_mode)
+ mrzcpd.start()
+
+ send_pkt = simple_vxlan_packet(
+ eth_src='0a:0a:0a:0a:01:28', eth_dst='10:70:fd:03:c0:bd',
+ ip_src='10.254.50.1', ip_dst='10.254.60.1', vxlan_vni=32)
+ verify_pkt = simple_vxlan_packet(
+ eth_src='10:70:fd:03:c0:bd', eth_dst='0a:0a:0a:0a:01:28',
+ ip_src='10.254.60.1', ip_dst='10.254.50.1', vxlan_vni=32)
+
+ for i in range(0, 100):
+ send_packet(self, 0, send_pkt)
+ verify_no_packet(self, verify_pkt, 0)
+
+ finally:
+ mrzcpd.stop()