aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/InterfaceUtil.py
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/InterfaceUtil.py
parent23b681550b878b62ca43ba3554d5d71dd7b4dff2 (diff)
Add vxlan tests using xconnect
Change-Id: I190689d5a624f1c876df90ce29b05a2b0b8a2df4 Signed-off-by: Patrik Hrnciar <phrnciar@cisco.com>
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r--resources/libraries/python/InterfaceUtil.py10
1 files changed, 7 insertions, 3 deletions
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)