X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FL2Util.py;h=c0a764fa2dc537eb426d94ded162b757984fd136;hp=b39515dceeddba03f7c9a2ffc98506698e985730;hb=799c246c1783b534df0ce7731c9078463be33bdd;hpb=1254d80a0b64985de2816eff5ef79e3e22cde972 diff --git a/resources/libraries/python/L2Util.py b/resources/libraries/python/L2Util.py index b39515dcee..c0a764fa2d 100644 --- a/resources/libraries/python/L2Util.py +++ b/resources/libraries/python/L2Util.py @@ -15,7 +15,7 @@ from robot.api.deco import keyword from resources.libraries.python.topology import Topology -from resources.libraries.python.VatExecutor import VatExecutor +from resources.libraries.python.VatExecutor import VatExecutor, VatTerminal class L2Util(object): @@ -153,3 +153,24 @@ class L2Util(object): sw_if_id2=sw_if_index2, bd_id=bd_id, learn=int(learn)) + + @staticmethod + def vpp_setup_bidirectional_cross_connect(node, interface1, interface2): + """Create bidirectional cross-connect between 2 interfaces on vpp node. + + :param node: Node to add bidirectional cross-connect + :param interface1: first interface + :param interface2: second interface + :type node: dict + :type interface1: str + :type interface2: str + """ + sw_iface1 = Topology().get_interface_sw_index(node, interface1) + sw_iface2 = Topology().get_interface_sw_index(node, interface2) + with VatTerminal(node) as vat: + vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', + interface1=sw_iface1, + interface2=sw_iface2) + vat.vat_terminal_exec_cmd_from_template('l2_xconnect.vat', + interface1=sw_iface2, + interface2=sw_iface1)