summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2024-01-12 08:02:17 +0000
committersongyanchao <[email protected]>2024-01-12 08:02:17 +0000
commitd61f6b7b9c1fd4955074c9a49ecb07a5adb6803f (patch)
tree82f2c1008a67d13aa0b0444effea30e79f996074 /test
parent5843c1833801d118b334382956ac393045fe7064 (diff)
✨ feat(DPISDN-33): Support non-contiguous configuration for Vwire ID.
Support non-contiguous configuration for Vwire ID.
Diffstat (limited to 'test')
-rw-r--r--test/vwire_test.py235
1 files changed, 235 insertions, 0 deletions
diff --git a/test/vwire_test.py b/test/vwire_test.py
index 8a377e3..fa9141d 100644
--- a/test/vwire_test.py
+++ b/test/vwire_test.py
@@ -205,50 +205,62 @@ sid_end=2000
# vwire
[vwire:0]
+vwire_id = 0
interface_int = veth0
interface_ext = veth1
[vwire:1]
+vwire_id = 1
interface_int = veth2
interface_ext = veth3
[vwire:2]
+vwire_id = 2
interface_int = veth4
interface_ext = veth5
[vwire:3]
+vwire_id = 3
interface_int = veth6
interface_ext = veth7
[vwire:4]
+vwire_id = 4
interface_int = veth8
interface_ext = veth9
[vwire:5]
+vwire_id = 5
interface_int = veth10
interface_ext = veth11
[vwire:6]
+vwire_id = 6
interface_int = veth12
interface_ext = veth13
[vwire:7]
+vwire_id = 7
interface_int = veth14
interface_ext = veth15
[vwire:8]
+vwire_id = 8
interface_int = veth16
interface_ext = veth17
[vwire:9]
+vwire_id = 9
interface_int = veth18
interface_ext = veth19
[vwire:10]
+vwire_id = 10
interface_int = veth20
interface_ext = veth21
[vwire:11]
+vwire_id = 11
interface_int = veth22
interface_ext = veth23
"""
@@ -307,3 +319,226 @@ class TestSendAndReceive(BaseTest):
finally:
mrzcpd.stop()
+
+
+start_conf_with_non_contiguous_test = """
+[device]
+device = veth0,veth1,veth2,veth3,veth4,veth5,veth6,veth7,veth8
+sz_tunnel = 8192
+sz_buffer = 0
+
+[device:veth0]
+promisc = 1
+mtu = 1500
+driver = 2
+role = 1
+
+[device:veth1]
+promisc = 1
+mtu = 1500
+driver = 2
+role = 1
+
+[device:veth2]
+promisc = 1
+mtu = 1500
+driver=2
+role=4
+
+[device:veth3]
+promisc = 1
+mtu = 1500
+driver = 2
+role = 1
+
+[device:veth4]
+promisc = 1
+mtu = 1500
+driver = 2
+role = 1
+
+[device:veth5]
+promisc = 1
+mtu = 1500
+driver=2
+role=4
+
+[device:veth6]
+promisc = 1
+mtu = 1500
+driver = 2
+role = 1
+
+[device:veth7]
+promisc = 1
+mtu = 1500
+driver = 2
+role = 1
+
+[device:veth8]
+promisc = 1
+mtu = 1500
+driver=2
+role=4
+
+[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
+[ef_adapters]
+sid_start=100
+sid_end=200
+max_rules=256
+
+[vwires]
+sid_start=300
+sid_end=400
+max_rules=256
+
+[service_lb]
+sid_start=1000
+sid_end=2000
+
+# vwire
+[vwire:0]
+vwire_id = 0
+interface_int = veth0
+interface_ext = veth1
+
+[vwire:1]
+vwire_id = 2
+interface_int = veth3
+interface_ext = veth4
+
+[vwire:2]
+vwire_id = 4
+interface_int = veth6
+interface_ext = veth7
+
+# load balance
+[load_balance:0]
+mode=balance
+devices=veth2,normal
+
+[load_balance:1]
+mode=balance
+devices=veth5,normal
+
+[load_balance:2]
+mode=balance
+devices=veth8,normal
+
+"""
+
+dynamic_conf_with_non_contiguous_test = """
+[classifier_rule:0]
+rule_id=1
+ruleset_type=classifier
+action=nf_steering
+priority=1
+category=0
+sid=1000
+vwire_id=0
+
+[classifier_rule:1]
+rule_id=2
+ruleset_type=classifier
+action=nf_steering
+priority=1
+category=0
+sid=1001
+vwire_id=2
+
+[classifier_rule:2]
+rule_id=2
+ruleset_type=classifier
+action=nf_steering
+priority=1
+category=0
+sid=1002
+vwire_id=4
+"""
+
+"""
+ +--------------+ +----------++-----------+----------+
+ | PTF | | Mrzcpd |
+ +--------------+ +----------++-----------+----------+
+ | veth0-ptf0 | ---> | veth0 | | | +------------+
+ +--------------+ +----------+ | veth2 | ---> | veth2-ptf2 |
+ | veth1-ptf1 | <-\- | veth1 | | | +------------+
+ +--------------+ +----------+ +----------+
+ | veth3-ptf3 | ---> | veth3 | | | +------------+
+ +--------------+ +----------+ | veth5 | ---> | veth5-ptf5 |
+ | veth4-ptf4 | <-\- | veth4 | | | +------------+
+ +--------------+ +----------+ +----------+
+ | veth6-ptf6 | ---> | veth6 | | | +------------+
+ +--------------+ +----------+ | veth8 | ---> | veth8-ptf8 |
+ | veth7-ptf7 | <-\- | veth7 | | | +------------+
+ +--------------+ +----------++----------++----------+
+"""
+@group("id_non_contiguous_test")
+class IdNonContiguousTest(BaseTest):
+ # Base test init
+ def __init__(self):
+ BaseTest.__init__(self)
+
+ # Dataplane set up
+ def setUp(self):
+ self.dataplane = ptf.dataplane_instance
+
+ # Run test
+ def runTest(self):
+ try:
+ # Init & Start mrzcpd
+ mrzcpd = Mrzcpd(start_conf_with_non_contiguous_test,dynamic_conf_with_non_contiguous_test)
+ mrzcpd.start()
+
+ packets=[]
+
+ # Create packets
+ for i in range(0,3):
+ packets.append(simple_tcp_packet(eth_dst='00:11:11:11:11:11',
+ eth_src='00:22:22:22:22:22',
+ ip_dst='10.0.0.' + str(i),
+ ip_id=101,
+ ip_ttl=64))
+
+ # Traverse all ports
+ for i in range(0, 3):
+ # Send pkt for the port
+ send_packet(self, i * 3 , packets[i])
+ # Verify pkt for specified port
+ verify_packets(self, packets[i], [2 + i*3])
+
+ finally:
+ mrzcpd.stop()