GBP: learn from ARP and L2 packets
[vpp.git] / test / test_map.py
index cd25333..952a737 100644 (file)
@@ -1,12 +1,10 @@
 #!/usr/bin/env python
 
 import unittest
 #!/usr/bin/env python
 
 import unittest
-import socket
 
 from framework import VppTestCase, VppTestRunner
 
 from framework import VppTestCase, VppTestRunner
-from vpp_ip import *
+from vpp_ip import DpoProto
 from vpp_ip_route import VppIpRoute, VppRoutePath
 from vpp_ip_route import VppIpRoute, VppRoutePath
-from ipaddress import IPv6Network, IPv4Network
 from scapy.layers.l2 import Ether, Raw
 from scapy.layers.inet import IP, UDP, ICMP, TCP, fragment
 from scapy.layers.inet6 import IPv6, ICMPv6TimeExceeded
 from scapy.layers.l2 import Ether, Raw
 from scapy.layers.inet import IP, UDP, ICMP, TCP, fragment
 from scapy.layers.inet6 import IPv6, ICMPv6TimeExceeded
@@ -79,10 +77,12 @@ class TestMAP(VppTestCase):
         map_dst = '2001::/64'
         map_src = '3000::1/128'
         client_pfx = '192.168.0.0/16'
         map_dst = '2001::/64'
         map_src = '3000::1/128'
         client_pfx = '192.168.0.0/16'
-        self.vapi.map_add_domain(map_dst, map_src, client_pfx)
+        self.vapi.map_add_domain(map_dst, client_pfx, map_src)
 
         # Enable MAP on interface.
 
         # Enable MAP on interface.
-        self.vapi.map_if_enable_disable(1, self.pg0.sw_if_index, 0)
+        self.vapi.map_if_enable_disable(is_enable=1,
+                                        sw_if_index=self.pg0.sw_if_index,
+                                        is_translation=0)
 
         # Ensure MAP doesn't steal all packets!
         v4 = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
 
         # Ensure MAP doesn't steal all packets!
         v4 = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
@@ -106,7 +106,9 @@ class TestMAP(VppTestCase):
         self.send_and_assert_encapped(v4, "3000::1", "2001::c0a8:0:0")
 
         # Enable MAP on interface.
         self.send_and_assert_encapped(v4, "3000::1", "2001::c0a8:0:0")
 
         # Enable MAP on interface.
-        self.vapi.map_if_enable_disable(1, self.pg1.sw_if_index, 0)
+        self.vapi.map_if_enable_disable(is_enable=1,
+                                        sw_if_index=self.pg1.sw_if_index,
+                                        is_translation=0)
 
         # Ensure MAP doesn't steal all packets
         v6 = (Ether(dst=self.pg1.local_mac, src=self.pg1.remote_mac) /
 
         # Ensure MAP doesn't steal all packets
         v6 = (Ether(dst=self.pg1.local_mac, src=self.pg1.remote_mac) /
@@ -200,12 +202,16 @@ class TestMAP(VppTestCase):
         map_src = '1234:5678:90ab:cdef::/64'
         ip4_pfx = '192.168.0.0/24'
 
         map_src = '1234:5678:90ab:cdef::/64'
         ip4_pfx = '192.168.0.0/24'
 
-        self.vapi.map_add_domain(map_dst, map_src, ip4_pfx,
-                                 16, 6, 4)
+        self.vapi.map_add_domain(map_dst, ip4_pfx, map_src,
+                                 16, 6, 4, mtu=1500)
 
         # Enable MAP-T on interfaces.
 
         # Enable MAP-T on interfaces.
-        self.vapi.map_if_enable_disable(1, self.pg0.sw_if_index, 1)
-        self.vapi.map_if_enable_disable(1, self.pg1.sw_if_index, 1)
+        self.vapi.map_if_enable_disable(is_enable=1,
+                                        sw_if_index=self.pg0.sw_if_index,
+                                        is_translation=1)
+        self.vapi.map_if_enable_disable(is_enable=1,
+                                        sw_if_index=self.pg1.sw_if_index,
+                                        is_translation=1)
 
         # Ensure MAP doesn't steal all packets!
         v4 = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
 
         # Ensure MAP doesn't steal all packets!
         v4 = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /