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>
This commit is contained in:
Paul Vinciguerra
2018-11-24 21:46:05 -08:00
committed by Damjan Marion
parent dd3737284d
commit 3bce8ebfdf
7 changed files with 36 additions and 29 deletions
+6 -5
View File
@@ -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