test framework: vpp_papi_provider.py - further cleanup
[vpp.git] / test / vpp_sub_interface.py
index 3c726b2..a374cba 100644 (file)
@@ -1,12 +1,13 @@
 from scapy.layers.l2 import Dot1Q
-from abc import abstractmethod, ABCMeta
-from vpp_interface import VppInterface
+import abc
+import six
 from vpp_pg_interface import VppPGInterface
 from vpp_papi_provider import L2_VTR_OP
+from vpp_interface import VppInterface
 
 
+@six.add_metaclass(abc.ABCMeta)
 class VppSubInterface(VppPGInterface):
-    __metaclass__ = ABCMeta
 
     @property
     def parent(self):
@@ -42,15 +43,21 @@ class VppSubInterface(VppPGInterface):
         super(VppSubInterface, self).set_sw_if_index(sw_if_index)
         self.set_vtr(L2_VTR_OP.L2_DISABLED)
 
-    @abstractmethod
+    @abc.abstractmethod
     def create_arp_req(self):
         pass
 
-    @abstractmethod
+    @abc.abstractmethod
     def create_ndp_req(self):
         pass
 
-    @abstractmethod
+    def resolve_arp(self):
+        super(VppSubInterface, self).resolve_arp(self.parent)
+
+    def resolve_ndp(self):
+        super(VppSubInterface, self).resolve_ndp(self.parent)
+
+    @abc.abstractmethod
     def add_dot1_layer(self, pkt):
         pass
 
@@ -112,7 +119,7 @@ class VppSubInterface(VppPGInterface):
             self._tag2 = inner
             self._push1q = push1q
 
-        self.test.vapi.sw_interface_set_l2_tag_rewrite(
+        self.test.vapi.l2_interface_vlan_tag_rewrite(
             self.sw_if_index, vtr, push=self._push1q,
             tag1=self._tag1, tag2=self._tag2)
         self._vtr = vtr
@@ -191,8 +198,8 @@ class VppP2PSubint(VppSubInterface):
 
     def __init__(self, test, parent, sub_id, remote_mac):
         super(VppP2PSubint, self).__init__(test, parent, sub_id)
-        r = test.vapi.create_p2pethernet_subif(parent.sw_if_index,
-                                               remote_mac, sub_id)
+        r = test.vapi.p2p_ethernet_add(parent.sw_if_index,
+                                       remote_mac, sub_id)
         self.set_sw_if_index(r.sw_if_index)
         self.parent_sw_if_index = parent.sw_if_index
         self.p2p_remote_mac = remote_mac