From 3bce8ebfdfaf2a4b576012beb3516d1f4030c20c Mon Sep 17 00:00:00 2001 From: Paul Vinciguerra Date: Sat, 24 Nov 2018 21:46:05 -0800 Subject: 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 --- test/vpp_sub_interface.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'test/vpp_sub_interface.py') 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 -- cgit 1.2.3-korg