aboutsummaryrefslogtreecommitdiffstats
path: root/test/template_bd.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2018-11-24 21:46:05 -0800
committerDamjan Marion <dmarion@me.com>2019-02-26 11:31:42 +0000
commit3bce8ebfdfaf2a4b576012beb3516d1f4030c20c (patch)
treead221819ad353c04e70a021978e50522a4b66998 /test/template_bd.py
parentdd3737284d5021e2e3bd0413b61aab14797e365c (diff)
VPP-1508 Python3 abstract classes
Update the syntax to support abstract classes in python 2 and python 3. Depends on: new style classes -- https://gerrit.fd.io/r/16166 Change-Id: Iad2c1240149f38b3faca1b37ab95d3d210e1daee Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/template_bd.py')
-rw-r--r--test/template_bd.py15
1 files changed, 8 insertions, 7 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