aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/InterfaceUtil.py16
-rw-r--r--resources/templates/vat/create_loopback.vat1
2 files changed, 17 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']))
diff --git a/resources/templates/vat/create_loopback.vat b/resources/templates/vat/create_loopback.vat
new file mode 100644
index 0000000000..94cfc0da5f
--- /dev/null
+++ b/resources/templates/vat/create_loopback.vat
@@ -0,0 +1 @@
+create_loopback