aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_sub_interface.py
diff options
context:
space:
mode:
authorKlement Sekera <klement.sekera@gmail.com>2022-04-26 19:02:15 +0200
committerOle Tr�an <otroan@employees.org>2022-05-10 18:52:08 +0000
commitd9b0c6fbf7aa5bd9af84264105b39c82028a4a29 (patch)
tree4f786cfd8ebc2443cb11e11b74c8657204068898 /test/vpp_sub_interface.py
parentf90348bcb4afd0af2611cefc43b17ef3042b511c (diff)
tests: replace pycodestyle with black
Drop pycodestyle for code style checking in favor of black. Black is much faster, stable PEP8 compliant code style checker offering also automatic formatting. It aims to be very stable and produce smallest diffs. It's used by many small and big projects. Running checkstyle with black takes a few seconds with a terse output. Thus, test-checkstyle-diff is no longer necessary. Expand scope of checkstyle to all python files in the repo, replacing test-checkstyle with checkstyle-python. Also, fixstyle-python is now available for automatic style formatting. Note: python virtualenv has been consolidated in test/Makefile, test/requirements*.txt which will eventually be moved to a central location. This is required to simply the automated generation of docker executor images in the CI. Type: improvement Change-Id: I022a326603485f58585e879ac0f697fceefbc9c8 Signed-off-by: Klement Sekera <klement.sekera@gmail.com> Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'test/vpp_sub_interface.py')
-rw-r--r--test/vpp_sub_interface.py53
1 files changed, 30 insertions, 23 deletions
diff --git a/test/vpp_sub_interface.py b/test/vpp_sub_interface.py
index 21560cb99d0..b896a6efbe3 100644
--- a/test/vpp_sub_interface.py
+++ b/test/vpp_sub_interface.py
@@ -18,7 +18,6 @@ class L2_VTR_OP:
class VppSubInterface(VppPGInterface, metaclass=abc.ABCMeta):
-
@property
def parent(self):
"""Parent interface for this sub-interface"""
@@ -117,26 +116,33 @@ class VppSubInterface(VppPGInterface, metaclass=abc.ABCMeta):
self._tag2 = 0
self._push1q = 0
- if (vtr == L2_VTR_OP.L2_PUSH_1 or
- vtr == L2_VTR_OP.L2_TRANSLATE_1_1 or
- vtr == L2_VTR_OP.L2_TRANSLATE_2_1):
+ if (
+ vtr == L2_VTR_OP.L2_PUSH_1
+ or vtr == L2_VTR_OP.L2_TRANSLATE_1_1
+ or vtr == L2_VTR_OP.L2_TRANSLATE_2_1
+ ):
self._tag1 = tag
self._push1q = push1q
- if (vtr == L2_VTR_OP.L2_PUSH_2 or
- vtr == L2_VTR_OP.L2_TRANSLATE_1_2 or
- vtr == L2_VTR_OP.L2_TRANSLATE_2_2):
+ if (
+ vtr == L2_VTR_OP.L2_PUSH_2
+ or vtr == L2_VTR_OP.L2_TRANSLATE_1_2
+ or vtr == L2_VTR_OP.L2_TRANSLATE_2_2
+ ):
self._tag1 = outer
self._tag2 = inner
self._push1q = push1q
self.test.vapi.l2_interface_vlan_tag_rewrite(
- sw_if_index=self.sw_if_index, vtr_op=vtr, push_dot1q=self._push1q,
- tag1=self._tag1, tag2=self._tag2)
+ sw_if_index=self.sw_if_index,
+ vtr_op=vtr,
+ push_dot1q=self._push1q,
+ tag1=self._tag1,
+ tag2=self._tag2,
+ )
self._vtr = vtr
class VppDot1QSubint(VppSubInterface):
-
@property
def vlan(self):
"""VLAN tag"""
@@ -168,7 +174,6 @@ class VppDot1QSubint(VppSubInterface):
class VppDot1ADSubint(VppSubInterface):
-
@property
def outer_vlan(self):
"""Outer VLAN tag"""
@@ -181,13 +186,18 @@ class VppDot1ADSubint(VppSubInterface):
def __init__(self, test, parent, sub_id, outer_vlan, inner_vlan):
super(VppDot1ADSubint, self).__init__(test, parent, sub_id)
- flags = (VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_DOT1AD |
- VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_TWO_TAGS |
- VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_EXACT_MATCH)
- r = test.vapi.create_subif(sw_if_index=parent.sw_if_index,
- sub_id=sub_id, outer_vlan_id=outer_vlan,
- inner_vlan_id=inner_vlan,
- sub_if_flags=flags)
+ flags = (
+ VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_DOT1AD
+ | VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_TWO_TAGS
+ | VppEnum.vl_api_sub_if_flags_t.SUB_IF_API_FLAG_EXACT_MATCH
+ )
+ r = test.vapi.create_subif(
+ sw_if_index=parent.sw_if_index,
+ sub_id=sub_id,
+ outer_vlan_id=outer_vlan,
+ inner_vlan_id=inner_vlan,
+ sub_if_flags=flags,
+ )
self.set_sw_if_index(r.sw_if_index)
self._outer_vlan = outer_vlan
self._inner_vlan = inner_vlan
@@ -204,16 +214,13 @@ class VppDot1ADSubint(VppSubInterface):
return self.add_dot1ad_layer(packet, self.outer_vlan, self.inner_vlan)
def remove_dot1_layer(self, packet):
- return self.remove_dot1ad_layer(packet, self.outer_vlan,
- self.inner_vlan)
+ return self.remove_dot1ad_layer(packet, self.outer_vlan, self.inner_vlan)
class VppP2PSubint(VppSubInterface):
-
def __init__(self, test, parent, sub_id, remote_mac):
super(VppP2PSubint, self).__init__(test, parent, sub_id)
- r = test.vapi.p2p_ethernet_add(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