aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2020-03-11 02:56:30 +0100
committerJan Gelety <jgelety@cisco.com>2020-03-16 14:35:21 +0000
commitac683d233f60d0235a6a581bd985cd225568d8e0 (patch)
tree10b24549a006d2535edb0c880320c114d4f7de67 /resources/libraries
parentcecee58d9187f9e444ccc704a1614dcc58f84809 (diff)
CSIT-1597 API cleanup: vxlan
- cover API changes in VPP: https://gerrit.fd.io/r/c/vpp/+/25569 - update vpp stable to version 20.05-rc0~345 - some pylint fixies in Policer.py Change-Id: Iba2c877d0e74526c69826c5ec4afd64ed2055d31 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r--resources/libraries/python/InterfaceUtil.py34
-rw-r--r--resources/libraries/python/Policer.py4
2 files changed, 15 insertions, 23 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index b6647ef32a..144a96cca5 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -20,8 +20,8 @@ from ipaddress import ip_address
from robot.api import logger
from resources.libraries.python.Constants import Constants
-from resources.libraries.python.CpuUtils import CpuUtils
from resources.libraries.python.DUTSetup import DUTSetup
+from resources.libraries.python.IPAddress import IPAddress
from resources.libraries.python.L2Util import L2Util
from resources.libraries.python.PapiExecutor import PapiSocketExecutor
from resources.libraries.python.parsers.JsonParser import JsonParser
@@ -791,16 +791,16 @@ class InterfaceUtil:
:raises RuntimeError: if it is unable to create VxLAN interface on the
node.
"""
- src_address = ip_address(source_ip)
- dst_address = ip_address(destination_ip)
-
cmd = u"vxlan_add_del_tunnel"
args = dict(
- is_add=1,
- is_ipv6=1 if src_address.version == 6 else 0,
+ is_add=True,
instance=Constants.BITWISE_NON_ZERO,
- src_address=src_address.packed,
- dst_address=dst_address.packed,
+ src_address=IPAddress.create_ip_address_object(
+ ip_address(source_ip)
+ ),
+ dst_address=IPAddress.create_ip_address_object(
+ ip_address(destination_ip)
+ ),
mcast_sw_if_index=Constants.BITWISE_NON_ZERO,
encap_vrf_id=0,
decap_next_index=Constants.BITWISE_NON_ZERO,
@@ -838,9 +838,9 @@ class InterfaceUtil:
cmd = u"sw_interface_set_vxlan_bypass"
args = dict(
- is_ipv6=0,
+ is_ipv6=False,
sw_if_index=sw_if_index,
- enable=1
+ enable=True
)
err_msg = f"Failed to set VXLAN bypass on interface " \
f"on host {node[u'host']}"
@@ -870,16 +870,8 @@ class InterfaceUtil:
:returns: Processed vxlan interface dump.
:rtype: dict
"""
- if vxlan_dump[u"is_ipv6"]:
- vxlan_dump[u"src_address"] = \
- ip_address(vxlan_dump[u"src_address"])
- vxlan_dump[u"dst_address"] = \
- ip_address(vxlan_dump[u"dst_address"])
- else:
- vxlan_dump[u"src_address"] = \
- ip_address(vxlan_dump[u"src_address"][0:4])
- vxlan_dump[u"dst_address"] = \
- ip_address(vxlan_dump[u"dst_address"][0:4])
+ vxlan_dump[u"src_address"] = str(vxlan_dump[u"src_address"])
+ vxlan_dump[u"dst_address"] = str(vxlan_dump[u"dst_address"])
return vxlan_dump
if interface is not None:
@@ -1200,7 +1192,7 @@ class InterfaceUtil:
rxq_num=int(num_rx_queues) if num_rx_queues else 0,
rxq_size=rxq_size,
txq_size=txq_size,
- mode=getattr(RdmaMode,f"RDMA_API_MODE_{mode.upper()}").value,
+ mode=getattr(RdmaMode, f"RDMA_API_MODE_{mode.upper()}").value,
)
err_msg = f"Failed to create RDMA interface on host {node[u'host']}"
with PapiSocketExecutor(node) as papi_exec:
diff --git a/resources/libraries/python/Policer.py b/resources/libraries/python/Policer.py
index abf6090cf3..af2321bae9 100644
--- a/resources/libraries/python/Policer.py
+++ b/resources/libraries/python/Policer.py
@@ -165,8 +165,8 @@ class Policer:
).value,
type=getattr(PolicerType, f"TYPE_{policer_type.upper()}").value,
conform_action=conform_action,
- exceed_action = exceed_action,
- violate_action = violate_action,
+ exceed_action=exceed_action,
+ violate_action=violate_action,
color_aware=bool(color_aware == u"'ca'")
)
err_msg = f"Failed to configure policer {policer_name} " \