diff options
author | Matej Klotton <mklotton@cisco.com> | 2016-03-11 13:56:39 +0100 |
---|---|---|
committer | Stefan Kobza <skobza@cisco.com> | 2016-04-13 16:09:31 +0000 |
commit | 6d9fe9bb4bd353b1d4fec3b2569bcd743f87fc4a (patch) | |
tree | 7a21e9072114ba6670fab95421ded8796335c1c4 /resources/libraries/python/InterfaceUtil.py | |
parent | 5a2fd159dce96a70f2e5157314391aceb6d80197 (diff) |
VXLAN test with dot1q tagging.
Change-Id: I3dbd12983736e338d757c580570d91680aedd83f
Signed-off-by: Matej Klotton <mklotton@cisco.com>
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 4631ccce7a..6526fe83ca 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -400,6 +400,38 @@ class InterfaceUtil(object): InterfaceUtil.update_tg_interface_data_on_node(node_data) @staticmethod + def create_vlan_subinterface(node, interface, vlan): + """Create VLAN subinterface on node. + + :param node: Node to add VLAN subinterface on. + :param interface: Interface name on which create VLAN subinterface. + :param vlan: VLAN ID of the subinterface to be created. + :type node: dict + :type interface: str + :type vlan: int + :return: Name and index of created subinterface. + :rtype: tuple + """ + sw_if_index = Topology.get_interface_sw_index(node, interface) + + output = VatExecutor.cmd_from_template(node, "create_vlan_subif.vat", + sw_if_index=sw_if_index, + vlan=vlan) + if output[0]["retval"] == 0: + sw_subif_index = output[0]["sw_if_index"] + logger.trace('VLAN subinterface with sw_if_index {} and VLAN ID {} ' + 'created on node {}'.format(sw_subif_index, + vlan, node['host'])) + else: + raise RuntimeError('Unable to create VLAN subinterface on node {}' + .format(node['host'])) + + with VatTerminal(node, False) as vat: + vat.vat_terminal_exec_cmd('exec show interfaces') + + return '{}.{}'.format(interface, vlan), sw_subif_index + + @staticmethod def create_vxlan_interface(node, vni, source_ip, destination_ip): """Create VXLAN interface and return sw if index of created interface. |