diff options
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 10 |
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) |