aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorPatrik Hrnciar <phrnciar@cisco.com>2016-03-08 17:34:18 +0100
committerPatrik Hrnciar <phrnciar@cisco.com>2016-03-14 13:52:46 +0100
commitbe157c8643a2c095d169e3ea78e8db60000189eb (patch)
treed08e935d6f9b65530ccd739061954dbd9c110017 /resources/libraries/python
parent23b681550b878b62ca43ba3554d5d71dd7b4dff2 (diff)
Add vxlan tests using xconnect
Change-Id: I190689d5a624f1c876df90ce29b05a2b0b8a2df4 Signed-off-by: Patrik Hrnciar <phrnciar@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/IPv4Util.py2
-rw-r--r--resources/libraries/python/InterfaceSetup.py2
-rw-r--r--resources/libraries/python/InterfaceUtil.py10
-rw-r--r--resources/libraries/python/L2Util.py21
4 files changed, 22 insertions, 13 deletions
diff --git a/resources/libraries/python/IPv4Util.py b/resources/libraries/python/IPv4Util.py
index 3b500ab1d9..b7035f272c 100644
--- a/resources/libraries/python/IPv4Util.py
+++ b/resources/libraries/python/IPv4Util.py
@@ -36,8 +36,6 @@ class IPv4Util(object):
get_node(node).arp_ping(ip_address, interface)
@staticmethod
- @keyword('Node "${node}" interface "${port}" has IPv4 address "${address}"'
- ' with prefix length "${prefix_length}"')
def set_interface_address(node, interface, address, length):
"""See IPv4Node.set_ip for more information.
diff --git a/resources/libraries/python/InterfaceSetup.py b/resources/libraries/python/InterfaceSetup.py
index f981d2323a..946c8fc8fd 100644
--- a/resources/libraries/python/InterfaceSetup.py
+++ b/resources/libraries/python/InterfaceSetup.py
@@ -151,8 +151,6 @@ class InterfaceSetup(object):
if_v['driver'])
@staticmethod
- @keyword('Create VXLAN interface on "${DUT}" with VNI "${VNI}"'
- ' from "${SRC_IP}" to "${DST_IP}"')
def create_vxlan_interface(node, vni, source_ip, destination_ip):
"""Create VXLAN interface and return index of created interface
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index aeb54be86a..be126503f7 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -30,10 +30,10 @@ class InterfaceUtil(object):
Function can be used for DUTs as well as for TGs.
:param node: node where the interface is
- :param interface: interface name
+ :param interface: interface name or sw_if_index
:param state: one of 'up' or 'down'
:type node: dict
- :type interface: str
+ :type interface: str or int
:type state: str
:return: nothing
"""
@@ -45,7 +45,11 @@ class InterfaceUtil(object):
else:
raise ValueError('Unexpected interface state: {}'.format(state))
- sw_if_index = Topology.get_interface_sw_index(node, interface)
+ if isinstance(interface, basestring):
+ sw_if_index = Topology.get_interface_sw_index(node, interface)
+ else:
+ sw_if_index = interface
+
VatExecutor.cmd_from_template(node, 'set_if_state.vat',
sw_if_index=sw_if_index, state=state)
diff --git a/resources/libraries/python/L2Util.py b/resources/libraries/python/L2Util.py
index c0a764fa2d..4dc230cf16 100644
--- a/resources/libraries/python/L2Util.py
+++ b/resources/libraries/python/L2Util.py
@@ -159,14 +159,23 @@ class L2Util(object):
"""Create bidirectional cross-connect between 2 interfaces on vpp node.
:param node: Node to add bidirectional cross-connect
- :param interface1: first interface
- :param interface2: second interface
+ :param interface1: first interface name or sw_if_index
+ :param interface2: second interface name or sw_if_index
:type node: dict
- :type interface1: str
- :type interface2: str
+ :type interface1: str or int
+ :type interface2: str or int
"""
- sw_iface1 = Topology().get_interface_sw_index(node, interface1)
- sw_iface2 = Topology().get_interface_sw_index(node, interface2)
+
+ if isinstance(interface1, basestring):
+ sw_iface1 = Topology().get_interface_sw_index(node, interface1)
+ else:
+ sw_iface1 = interface1
+
+ if isinstance(interface2, basestring):
+ sw_iface2 = Topology().get_interface_sw_index(node, interface2)
+ else:
+ sw_iface2 = interface2
+
with VatTerminal(node) as vat:
vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat',
interface1=sw_iface1,