nat: use correct data types for memory sizes
[vpp.git] / test / test_p2p_ethernet.py
index 5200e48..7cc6cdc 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 import random
 import unittest
 import datetime
@@ -32,6 +32,10 @@ class P2PEthernetAPI(VppTestCase):
         for i in cls.pg_interfaces:
             i.admin_up()
 
+    @classmethod
+    def tearDownClass(cls):
+        super(P2PEthernetAPI, cls).tearDownClass()
+
     def create_p2p_ethernet(self, parent_if, sub_id, remote_mac):
         p2p = VppP2PSubint(self, parent_if, sub_id, mac_pton(remote_mac))
         self.p2p_sub_ifs.append(p2p)
@@ -125,6 +129,10 @@ class P2PEthernetIPV6(VppTestCase):
         cls.pg1.configure_ipv6_neighbors()
         cls.pg1.disable_ipv6_ra()
 
+    @classmethod
+    def tearDownClass(cls):
+        super(P2PEthernetIPV6, cls).tearDownClass()
+
     def setUp(self):
         super(P2PEthernetIPV6, self).setUp()
         for p in self.packets:
@@ -164,7 +172,7 @@ class P2PEthernetIPV6(VppTestCase):
             pkt_size = random.choice(self.pg_if_packet_sizes)
         p = Ether(src=src_mac, dst=dst_mac)
         p /= IPv6(src=src_ip, dst=dst_ip)
-        p /= (UDP(sport=1234, dport=4321) / Raw('\xa5' * 20))
+        p /= (UDP(sport=1234, dport=4321) / Raw(b'\xa5' * 20))
         self.extend_packet(p, pkt_size)
         return p
 
@@ -184,16 +192,14 @@ class P2PEthernetIPV6(VppTestCase):
 
         route_8000 = VppIpRoute(self, "8000::", 64,
                                 [VppRoutePath(self.pg0.remote_ip6,
-                                              self.pg0.sw_if_index,
-                                              proto=DpoProto.DPO_PROTO_IP6)],
-                                is_ip6=1)
+                                              self.pg0.sw_if_index)])
         route_8000.add_vpp_config()
 
         self.packets = [(Ether(dst=self.pg1.local_mac,
                                src=self.pg1.remote_mac) /
                          IPv6(src="3001::1", dst="8000::100") /
                          UDP(sport=1234, dport=1234) /
-                         Raw('\xa5' * 100))]
+                         Raw(b'\xa5' * 100))]
         self.send_packets(self.pg1, self.pg0)
 
         self.logger.info("FFP_TEST_FINISH_0001")
@@ -204,9 +210,7 @@ class P2PEthernetIPV6(VppTestCase):
 
         route_9001 = VppIpRoute(self, "9001::", 64,
                                 [VppRoutePath(self.pg1.remote_ip6,
-                                              self.pg1.sw_if_index,
-                                              proto=DpoProto.DPO_PROTO_IP6)],
-                                is_ip6=1)
+                                              self.pg1.sw_if_index)])
         route_9001.add_vpp_config()
 
         self.packets.append(
@@ -229,9 +233,7 @@ class P2PEthernetIPV6(VppTestCase):
 
         route_3 = VppIpRoute(self, "9000::", 64,
                              [VppRoutePath(self.pg1._remote_hosts[0].ip6,
-                                           self.pg1.sw_if_index,
-                                           proto=DpoProto.DPO_PROTO_IP6)],
-                             is_ip6=1)
+                                           self.pg1.sw_if_index)])
         route_3.add_vpp_config()
 
         self.packets.append(
@@ -254,9 +256,7 @@ class P2PEthernetIPV6(VppTestCase):
 
         route_9001 = VppIpRoute(self, "9000::", 64,
                                 [VppRoutePath(self.pg1._remote_hosts[0].ip6,
-                                              self.pg1.sw_if_index,
-                                              proto=DpoProto.DPO_PROTO_IP6)],
-                                is_ip6=1)
+                                              self.pg1.sw_if_index)])
         route_9001.add_vpp_config()
 
         self.packets.append(
@@ -275,21 +275,17 @@ class P2PEthernetIPV6(VppTestCase):
 
         route_8000 = VppIpRoute(self, "8000::", 64,
                                 [VppRoutePath(self.pg0.remote_ip6,
-                                              self.pg0.sw_if_index,
-                                              proto=DpoProto.DPO_PROTO_IP6)],
-                                is_ip6=1)
+                                              self.pg0.sw_if_index)])
         route_8000.add_vpp_config()
         route_8001 = VppIpRoute(self, "8001::", 64,
-                                [VppRoutePath(self.p2p_sub_ifs[0].remote_ip6,
-                                              self.p2p_sub_ifs[0].sw_if_index,
-                                              proto=DpoProto.DPO_PROTO_IP6)],
-                                is_ip6=1)
+                                [VppRoutePath(
+                                    self.p2p_sub_ifs[0].remote_ip6,
+                                    self.p2p_sub_ifs[0].sw_if_index)])
         route_8001.add_vpp_config()
         route_8002 = VppIpRoute(self, "8002::", 64,
-                                [VppRoutePath(self.p2p_sub_ifs[1].remote_ip6,
-                                              self.p2p_sub_ifs[1].sw_if_index,
-                                              proto=DpoProto.DPO_PROTO_IP6)],
-                                is_ip6=1)
+                                [VppRoutePath(
+                                    self.p2p_sub_ifs[1].remote_ip6,
+                                    self.p2p_sub_ifs[1].sw_if_index)])
         route_8002.add_vpp_config()
 
         for i in range(0, 3):
@@ -350,6 +346,10 @@ class P2PEthernetIPV4(VppTestCase):
         cls.pg1.generate_remote_hosts(5)
         cls.pg1.configure_ipv4_neighbors()
 
+    @classmethod
+    def tearDownClass(cls):
+        super(P2PEthernetIPV4, cls).tearDownClass()
+
     def setUp(self):
         super(P2PEthernetIPV4, self).setUp()
         for p in self.packets:
@@ -375,7 +375,7 @@ class P2PEthernetIPV4(VppTestCase):
             pkt_size = random.choice(self.pg_if_packet_sizes)
         p = Ether(src=src_mac, dst=dst_mac)
         p /= IP(src=src_ip, dst=dst_ip)
-        p /= (UDP(sport=1234, dport=4321) / Raw('\xa5' * 20))
+        p /= (UDP(sport=1234, dport=4321) / Raw(b'\xa5' * 20))
         self.extend_packet(p, pkt_size)
         return p