HC Tests: disable failing ACL ODL tests (HC2VPP-337)
[csit.git] / resources / libraries / python / InterfaceUtil.py
index c0a8957..6c3aa46 100644 (file)
@@ -316,7 +316,6 @@ class InterfaceUtil(object):
         :type node: dict
         :type pci_addr: str
         :type driver: str
-        :returns: None.
         :raises RuntimeError: If unbinding from the current driver fails.
         :raises RuntimeError: If binding to the new driver fails.
         """
@@ -397,9 +396,8 @@ class InterfaceUtil(object):
                         return None
                 if name == 'Driver:':
                     return value if value else None
-        else:
-            raise RuntimeError('Get interface driver for: {0}'
-                               .format(pci_addr))
+        raise RuntimeError('Get interface driver for: {0}'
+                           .format(pci_addr))
 
     @staticmethod
     def tg_set_interfaces_udev_rules(node):
@@ -910,6 +908,29 @@ class InterfaceUtil(object):
             raise RuntimeError('Create loopback failed on node "{}"'
                                .format(node['host']))
 
+    @staticmethod
+    def add_bond_eth_interface(node, ifc_name):
+        """Add BondEthernet interface to current topology.
+
+        :param node: Node to add BondEthernet interface for.
+        :param ifc_name: Name of the BondEthernet interface.
+        :type node: dict
+        :type ifc_name: str
+        """
+        if_key = Topology.add_new_port(node, 'eth_bond')
+        Topology.update_interface_name(node, if_key, ifc_name)
+
+        vat_executor = VatExecutor()
+        vat_executor.execute_script_json_out("dump_interfaces.vat", node)
+        interface_dump_json = vat_executor.get_script_stdout()
+
+        sw_if_idx = VatJsonUtil.get_interface_sw_index_from_json(
+            interface_dump_json, ifc_name)
+        Topology.update_interface_sw_if_index(node, if_key, sw_if_idx)
+        ifc_mac = VatJsonUtil.get_interface_mac_from_json(
+            interface_dump_json, sw_if_idx)
+        Topology.update_interface_mac_address(node, if_key, ifc_mac)
+
     @staticmethod
     def vpp_enable_input_acl_interface(node, interface, ip_version,
                                        table_index):