Auto-generated patch by python-black
[integration/test.git] / csit / libraries / SwitchClasses / BaseSwitch.py
index 2cdcb3a5133a4d6c54a3df761c4000a9ae78c890..71619b92654381b3e88cb6c2ea978e95282ae703 100644 (file)
@@ -8,26 +8,26 @@ import xml.etree.ElementTree as ElementTree
 
 
 class BaseSwitch(object):
-    '''
+    """
     Switch Base Class
-    '''
+    """
 
-    make = ''
-    model = ''
+    make = ""
+    model = ""
 
-    mgmt_protocol = ''
-    ssh_key = ''
-    mgmt_ip = ''
-    mgmt_port = ''
-    mgmt_user = ''
-    mgmt_password = ''
-    mgmt_prompt = ''
+    mgmt_protocol = ""
+    ssh_key = ""
+    mgmt_ip = ""
+    mgmt_port = ""
+    mgmt_user = ""
+    mgmt_password = ""
+    mgmt_prompt = ""
 
-    connection_index = ''
+    connection_index = ""
 
-    initialization_type = ''
+    initialization_type = ""
 
-    of_controller_ip = ''
+    of_controller_ip = ""
 
     connection_configs = []
 
@@ -44,16 +44,16 @@ class BaseSwitch(object):
 
     dump_all_flows = []
 
-    src_mac = ''
-    dst_mac = ''
-    ip_src = ''
-    ip_dst = ''
-    table_id = ''
-    action = ''
+    src_mac = ""
+    dst_mac = ""
+    ip_src = ""
+    ip_dst = ""
+    table_id = ""
+    action = ""
 
-    datapath_id_output_string = ''
-    datapath_id_output_command = ''
-    datapath_id = ''
+    datapath_id_output_string = ""
+    datapath_id_output_command = ""
+    datapath_id = ""
 
     def set_connection_index(self, idx):
         self.connection_index = idx
@@ -78,40 +78,46 @@ class BaseSwitch(object):
 
     def create_flow_match_elements(self, flow_xml):
         flow_tree = ElementTree.fromstring(flow_xml)
-        self.table_id = flow_tree.\
-            find('{urn:opendaylight:flow:inventory}table_id').text
-        instructions_element = flow_tree.\
-            find('{urn:opendaylight:flow:inventory}instructions')
-        instruction_element = instructions_element.\
-            find('{urn:opendaylight:flow:inventory}instruction')
-        apply_actions = instruction_element.\
-            find('{urn:opendaylight:flow:inventory}apply-actions')
-        action = apply_actions.\
-            find('{urn:opendaylight:flow:inventory}action')
-        output_action = action.\
-            find('{urn:opendaylight:flow:inventory}output-action')
-        output_node_connector = \
-            output_action.find('{urn:opendaylight:'
-                               'flow:inventory}output-node-connector')
+        self.table_id = flow_tree.find("{urn:opendaylight:flow:inventory}table_id").text
+        instructions_element = flow_tree.find(
+            "{urn:opendaylight:flow:inventory}instructions"
+        )
+        instruction_element = instructions_element.find(
+            "{urn:opendaylight:flow:inventory}instruction"
+        )
+        apply_actions = instruction_element.find(
+            "{urn:opendaylight:flow:inventory}apply-actions"
+        )
+        action = apply_actions.find("{urn:opendaylight:flow:inventory}action")
+        output_action = action.find("{urn:opendaylight:flow:inventory}output-action")
+        output_node_connector = output_action.find(
+            "{urn:opendaylight:" "flow:inventory}output-node-connector"
+        )
         self.action = output_node_connector.text
-        match_element = flow_tree.\
-            find('{urn:opendaylight:flow:inventory}match')
-        ethernet_match_element = match_element.\
-            find('{urn:opendaylight:flow:inventory}ethernet-match')
-        ethernet_source = ethernet_match_element.\
-            find('{urn:opendaylight:flow:inventory}ethernet-source')
-        ethernet_source_address = ethernet_source.\
-            find('{urn:opendaylight:flow:inventory}address')
+        match_element = flow_tree.find("{urn:opendaylight:flow:inventory}match")
+        ethernet_match_element = match_element.find(
+            "{urn:opendaylight:flow:inventory}ethernet-match"
+        )
+        ethernet_source = ethernet_match_element.find(
+            "{urn:opendaylight:flow:inventory}ethernet-source"
+        )
+        ethernet_source_address = ethernet_source.find(
+            "{urn:opendaylight:flow:inventory}address"
+        )
         self.src_mac = ethernet_source_address.text
-        ethernet_destination = ethernet_match_element.\
-            find('{urn:opendaylight:flow:inventory}ethernet-destination')
-        ethernet_destination_address = ethernet_destination.\
-            find('{urn:opendaylight:flow:inventory}address')
+        ethernet_destination = ethernet_match_element.find(
+            "{urn:opendaylight:flow:inventory}ethernet-destination"
+        )
+        ethernet_destination_address = ethernet_destination.find(
+            "{urn:opendaylight:flow:inventory}address"
+        )
         self.dst_mac = ethernet_destination_address.text
-        self.ip_src = match_element.\
-            find('{urn:opendaylight:flow:inventory}ipv4-source').text
-        self.ip_dst = match_element.\
-            find('{urn:opendaylight:flow:inventory}ipv4-destination').text
+        self.ip_src = match_element.find(
+            "{urn:opendaylight:flow:inventory}ipv4-source"
+        ).text
+        self.ip_dst = match_element.find(
+            "{urn:opendaylight:flow:inventory}ipv4-destination"
+        ).text
 
     def convert_hex_to_decimal_as_string(self, hex_string):
         # TODO: need to add error checking in case the hex_string is