Transfer l2_xconnect setup to L2Util 42/442/6
authorPatrik Hrnciar <phrnciar@cisco.com>
Mon, 29 Feb 2016 13:28:41 +0000 (14:28 +0100)
committerPatrik Hrnciar <phrnciar@cisco.com>
Wed, 2 Mar 2016 12:03:10 +0000 (13:03 +0100)
Change-Id: I7a661c9ce8b5f9ca8fbd36858f7a9cd6f1da8ffd
Signed-off-by: Patrik Hrnciar <phrnciar@cisco.com>
resources/libraries/python/CrossConnectSetup.py [deleted file]
resources/libraries/python/L2Util.py
resources/libraries/robot/l2_xconnect.robot

diff --git a/resources/libraries/python/CrossConnectSetup.py b/resources/libraries/python/CrossConnectSetup.py
deleted file mode 100644 (file)
index 3f1f7d4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (c) 2016 Cisco and/or its affiliates.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Library to set up cross-connect in topology."""
-
-from resources.libraries.python.VatExecutor import VatExecutor
-from resources.libraries.python.topology import Topology
-
-__all__ = ['CrossConnectSetup']
-
-class CrossConnectSetup(object):
-    """Crossconnect setup in topology."""
-
-    def __init__(self):
-        pass
-
-    @staticmethod
-    def vpp_setup_bidirectional_cross_connect(node, interface1, interface2):
-        """Create crossconnect between 2 interfaces on vpp node.
-
-        :param node: Node to add bidirectional crossconnect
-        :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)
-        VatExecutor.cmd_from_template(node, "l2_xconnect.vat",
-                                      interface1=sw_iface1,
-                                      interface2=sw_iface2)
-        VatExecutor.cmd_from_template(node, "l2_xconnect.vat",
-                                      interface1=sw_iface2,
-                                      interface2=sw_iface1)
index b39515d..a891308 100644 (file)
@@ -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,25 @@ 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)
+        vat = VatTerminal(node)
+        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)
+        vat.vat_terminal_close()
index e4dcddd..12601e3 100644 (file)
@@ -14,7 +14,7 @@
 *** Settings ***
 
 | Library | resources.libraries.python.VatExecutor
-| Library | resources.libraries.python.CrossConnectSetup
+| Library | resources.libraries.python.L2Util
 | Library | resources.libraries.python.topology.Topology
 | Library | resources.libraries.python.TrafficScriptExecutor
 | Variables | resources/libraries/python/constants.py