diff options
author | Matus Fabian <matfabia@cisco.com> | 2016-04-28 14:41:32 +0200 |
---|---|---|
committer | Stefan Kobza <skobza@cisco.com> | 2016-05-02 07:44:15 +0000 |
commit | 4152fc66baee098cea4c00e56906c4ecd7578337 (patch) | |
tree | ba96084196aaa63584808308ca30939e225f2983 /resources/libraries | |
parent | 0cc103deccef35abe1b181d262bf44bd2d5e0d35 (diff) |
Add vpp_create_loopback
Change-Id: If934d7ec28f86b070a0cafa0ee56d0bcf4e2ac6d
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index a5f00ad03e..021e8ed74f 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -507,3 +507,19 @@ class InterfaceUtil(object): vat.vat_terminal_exec_cmd('exec show interfaces') return '{}.{}'.format(interface, sub_id), sw_subif_index + + @staticmethod + def vpp_create_loopback(node): + """Create loopback interface on VPP node. + + :param node: Node to create loopback interface on. + :type node: dict + :return: SW interface index. + :rtype: int + """ + out = VatExecutor.cmd_from_template(node, "create_loopback.vat") + if out[0].get('retval') == 0: + return out[0].get('sw_if_index') + else: + raise RuntimeError('Create loopback failed on node "{}"' + .format(node['host'])) |