summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/template_bd.py15
-rw-r--r--test/test_lisp.py6
-rw-r--r--test/util.py5
-rw-r--r--test/vpp_interface.py7
-rw-r--r--test/vpp_object.py13
-rw-r--r--test/vpp_sub_interface.py11
-rw-r--r--test/vpp_tunnel_interface.py8
7 files changed, 36 insertions, 29 deletions
diff --git a/test/template_bd.py b/test/template_bd.py
index 291f4684db9..b0d508fee7c 100644
--- a/test/template_bd.py
+++ b/test/template_bd.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
-from abc import abstractmethod, ABCMeta
+import abc
+import six
from scapy.layers.l2 import Ether, Raw
from scapy.layers.inet import IP, UDP
@@ -8,9 +9,9 @@ from scapy.layers.inet import IP, UDP
from util import ip4_range
+@six.add_metaclass(abc.ABCMeta)
class BridgeDomain(object):
""" Bridge domain abstraction """
- __metaclass__ = ABCMeta
@property
def frame_request(self):
@@ -28,27 +29,27 @@ class BridgeDomain(object):
UDP(sport=20000, dport=10000) /
Raw('\xa5' * 100))
- @abstractmethod
+ @abc.abstractmethod
def ip_range(self, start, end):
""" range of remote ip's """
pass
- @abstractmethod
+ @abc.abstractmethod
def encap_mcast(self, pkt, src_ip, src_mac, vni):
""" Encapsulate mcast packet """
pass
- @abstractmethod
+ @abc.abstractmethod
def encapsulate(self, pkt, vni):
""" Encapsulate packet """
pass
- @abstractmethod
+ @abc.abstractmethod
def decapsulate(self, pkt):
""" Decapsulate packet """
pass
- @abstractmethod
+ @abc.abstractmethod
def check_encapsulation(self, pkt, vni, local_only=False):
""" Verify the encapsulation """
pass
diff --git a/test/test_lisp.py b/test/test_lisp.py
index b6272dcb1bd..f66fcf79bc0 100644
--- a/test/test_lisp.py
+++ b/test/test_lisp.py
@@ -1,4 +1,7 @@
#!/usr/bin/env python
+
+import abc
+import six
import unittest
from scapy.fields import BitField, ByteField, FlagsField, IntField
@@ -28,6 +31,7 @@ bind_layers(LISP_GPE_Header, IPv6, next_proto=2)
bind_layers(LISP_GPE_Header, Ether, next_proto=3)
+@six.add_metaclass(abc.ABCMeta)
class Driver(object):
config_order = ['locator-sets',
@@ -61,7 +65,7 @@ class Driver(object):
Raw(payload))
return packet
- @abstractmethod
+ @abc.abstractmethod
def run(self):
""" testing procedure """
pass
diff --git a/test/util.py b/test/util.py
index cf45c85a5f4..5ce84070a87 100644
--- a/test/util.py
+++ b/test/util.py
@@ -1,9 +1,10 @@
""" test framework utilities """
+import abc
import socket
+import six
import sys
import os.path
-from abc import abstractmethod, ABCMeta
from scapy.utils6 import in6_mactoifaceid
from scapy.layers.l2 import Ether
@@ -93,11 +94,9 @@ def check_core_path(logger, core_path):
class NumericConstant(object):
- __metaclass__ = ABCMeta
desc_dict = {}
- @abstractmethod
def __init__(self, value):
self._value = value
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index 58384d2eeb9..2dcf149a593 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -1,16 +1,17 @@
import binascii
import socket
-from abc import abstractmethod, ABCMeta
+import abc
+import six
from six import moves
from util import Host, mk_ll_addr
from vpp_papi import mac_ntop
+@six.add_metaclass(abc.ABCMeta)
class VppInterface(object):
"""Generic VPP interface."""
- __metaclass__ = ABCMeta
@property
def sw_if_index(self):
@@ -181,7 +182,7 @@ class VppInterface(object):
self._hosts_by_ip4[ip4] = host
self._hosts_by_ip6[ip6] = host
- @abstractmethod
+ @abc.abstractmethod
def __init__(self, test):
self._test = test
diff --git a/test/vpp_object.py b/test/vpp_object.py
index 1b0fadae569..a0b9fe3abf2 100644
--- a/test/vpp_object.py
+++ b/test/vpp_object.py
@@ -1,32 +1,33 @@
""" abstract vpp object and object registry """
-from abc import ABCMeta, abstractmethod
+import abc
+import six
from six import moves
+@six.add_metaclass(abc.ABCMeta)
class VppObject(object):
""" Abstract vpp object """
- __metaclass__ = ABCMeta
- @abstractmethod
+ @abc.abstractmethod
def add_vpp_config(self):
""" Add the configuration for this object to vpp. """
pass
- @abstractmethod
+ @abc.abstractmethod
def query_vpp_config(self):
"""Query the vpp configuration.
:return: True if the object is configured"""
pass
- @abstractmethod
+ @abc.abstractmethod
def remove_vpp_config(self):
""" Remove the configuration for this object from vpp. """
pass
- @abstractmethod
+ @abc.abstractmethod
def object_id(self):
""" Return a unique string representing this object. """
pass
diff --git a/test/vpp_sub_interface.py b/test/vpp_sub_interface.py
index 255cfffd827..63a0f543f20 100644
--- a/test/vpp_sub_interface.py
+++ b/test/vpp_sub_interface.py
@@ -1,12 +1,13 @@
from scapy.layers.l2 import Dot1Q
-from abc import abstractmethod, ABCMeta
+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,11 +43,11 @@ 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
@@ -56,7 +57,7 @@ class VppSubInterface(VppPGInterface):
def resolve_ndp(self):
super(VppSubInterface, self).resolve_ndp(self.parent)
- @abstractmethod
+ @abc.abstractmethod
def add_dot1_layer(self, pkt):
pass
diff --git a/test/vpp_tunnel_interface.py b/test/vpp_tunnel_interface.py
index c74f58532f2..e55486e1675 100644
--- a/test/vpp_tunnel_interface.py
+++ b/test/vpp_tunnel_interface.py
@@ -1,13 +1,13 @@
-from abc import abstractmethod, ABCMeta
+import abc
+import six
from vpp_pg_interface import is_ipv6_misc
from vpp_interface import VppInterface
+@six.add_metaclass(abc.ABCMeta)
class VppTunnelInterface(VppInterface):
- """ VPP tunnel interface abstration """
- __metaclass__ = ABCMeta
+ """ VPP tunnel interface abstraction """
- @abstractmethod
def __init__(self, test, parent_if):
super(VppTunnelInterface, self).__init__(test)
self.parent_if = parent_if