Auto-generated patch by python-black
[integration/test.git] / csit / libraries / SwitchClasses / ProVision.py
index 56d6303ca2bf941c6c1cad3d885217c895fc5917..45055573c0e714b8cc17e326da69caced352bb9b 100644 (file)
@@ -8,98 +8,105 @@ from BaseSwitch import BaseSwitch
 
 
 class ProVision(BaseSwitch):
-    '''
+    """
     ProVision Super Class
-    '''
+    """
 
-    make = 'provision'
-    model = ''
+    make = "provision"
+    model = ""
 
-    mgmt_protocol = 'telnet'
-    mgmt_ip = ''
-    mgmt_port = ''
-    mgmt_prompt = model + '.*#'
+    mgmt_protocol = "telnet"
+    mgmt_ip = ""
+    mgmt_port = ""
+    mgmt_prompt = model + ".*#"
 
-    initialization_type = 'reboot'
+    initialization_type = "reboot"
 
-    of_instance_id = '21'
+    of_instance_id = "21"
 
     @property
     def connection_configs(self):
-        return ['\rend \
+        return [
+            "\rend \
                  \rconfig \
                  \rconsole local-terminal none \
                  \rno page \
-                 \rend\r']
+                 \rend\r"
+        ]
 
     @property
     def initialization_cmds(self):
-        return ['\rend\rboot system flash primary config odl_test_startup_config\r',
-                'y',
-                'n']
+        return [
+            "\rend\rboot system flash primary config odl_test_startup_config\r",
+            "y",
+            "n",
+        ]
 
     @property
     def cleanup_cmds(self):
-        return ['end',
-                'config',
-                'no openflow\r',
-                'y']
+        return ["end", "config", "no openflow\r", "y"]
 
     @property
     def base_openflow_config(self):
-        return 'end', \
-               'config', \
-               'openflow', \
-               'controller-id ' + self.of_instance_id + ' ip ' + self.of_controller_ip + \
-               ' controller-interface oobm', \
-               'instance ' + self.of_instance_id, \
-               'member vlan 10', \
-               'controller-id ' + self.of_instance_id + ' ', \
-               'version 1.3', \
-               'enable', \
-               'openflow enable', \
-               'end'
+        return (
+            "end",
+            "config",
+            "openflow",
+            "controller-id "
+            + self.of_instance_id
+            + " ip "
+            + self.of_controller_ip
+            + " controller-interface oobm",
+            "instance " + self.of_instance_id,
+            "member vlan 10",
+            "controller-id " + self.of_instance_id + " ",
+            "version 1.3",
+            "enable",
+            "openflow enable",
+            "end",
+        )
 
     @property
     def openflow_enable_config(self):
-        return ['end',
-                'config',
-                'openflow enable',
-                'end']
+        return ["end", "config", "openflow enable", "end"]
 
     @property
     def openflow_validation_cmd(self):
-        return \
-            'show openflow'
+        return "show openflow"
 
     @property
     def openflow_enable_validations(self):
-        return ['OpenFlow +: Enabled',
-                self.of_instance_id + ' +Up +2 +1 +1.3']
+        return ["OpenFlow +: Enabled", self.of_instance_id + " +Up +2 +1 +1.3"]
 
     @property
     def openflow_disable_config(self):
-        return ['end',
-                'config',
-                'openflow disable',
-                'end']
+        return ["end", "config", "openflow disable", "end"]
 
     @property
     def openflow_disable_validations(self):
-        return ['OpenFlow +: Disabled', self.of_instance_id + ' +Down +0 +0 +1.3']
+        return ["OpenFlow +: Disabled", self.of_instance_id + " +Down +0 +0 +1.3"]
 
     @property
     def dump_all_flows(self):
-        return 'show openflow instance ' + self.of_instance_id + ' flows'
+        return "show openflow instance " + self.of_instance_id + " flows"
 
     @property
     def flow_validations(self):
-        return ['(?ms)Flow Table ID : 0.*Flow Table ID : 100.*' +
-                'Source Protocol Address : ' + self.ip_src + '.*' +
-                'Target Protocol Address : ' + self.ip_dst + '.*' +
-                'Flow Table ID : ' + self.table_id + '.*' + self.action,
-                'Source MAC    : ' + self.src_mac,
-                'Destination MAC  : ' + self.dst_mac]
+        return [
+            "(?ms)Flow Table ID : 0.*Flow Table ID : 100.*"
+            + "Source Protocol Address : "
+            + self.ip_src
+            + ".*"
+            + "Target Protocol Address : "
+            + self.ip_dst
+            + ".*"
+            + "Flow Table ID : "
+            + self.table_id
+            + ".*"
+            + self.action,
+            "Source MAC    : " + self.src_mac,
+            "Destination MAC  : " + self.dst_mac,
+        ]
 
     def create_flow_match_elements(self, flow_xml):
         super(ProVision, self).create_flow_match_elements(flow_xml)
@@ -108,47 +115,46 @@ class ProVision(BaseSwitch):
         self.action = self.convert_action_to_provision_format(self.action)
 
     def format_mac_with_no_hyphens_and_one_colon(self, mac):
-        mac_no_colons = re.sub(':', '', mac)
-        mac_with_hyphen = mac_no_colons[:6] + '-' + mac_no_colons[6:]
+        mac_no_colons = re.sub(":", "", mac)
+        mac_with_hyphen = mac_no_colons[:6] + "-" + mac_no_colons[6:]
         return mac_with_hyphen
 
     def convert_action_to_provision_format(self, action):
-        if (action == 'INPORT'):
-            return 'Ingress Port'
-        if (action == 'TABLE'):
-            return 'Table'
-        if (action == 'NORMAL'):
-            return 'Normal'
-        if (action == 'FLOOD'):
-            return 'Flood'
-        if (action == 'ALL'):
-            return 'All'
-        if (action == 'CONTROLLER'):
-            return 'Controller Port'
-        if (action == 'LOCAL'):
-            return 'Local'
-        return 'UNKNOWN'
+        if action == "INPORT":
+            return "Ingress Port"
+        if action == "TABLE":
+            return "Table"
+        if action == "NORMAL":
+            return "Normal"
+        if action == "FLOOD":
+            return "Flood"
+        if action == "ALL":
+            return "All"
+        if action == "CONTROLLER":
+            return "Controller Port"
+        if action == "LOCAL":
+            return "Local"
+        return "UNKNOWN"
 
     @property
     def datapath_id_output_command(self):
-        return \
-            'show openflow instance ' + self.of_instance_id + ' | include Datapath'
+        return "show openflow instance " + self.of_instance_id + " | include Datapath"
 
-    connection_index = ''
+    connection_index = ""
 
     def set_connection_index(self, idx):
         self.connection_index = idx
 
-    datapath_id_output_string = ''
-    datapath_id = ''
+    datapath_id_output_string = ""
+    datapath_id = ""
 
     def update_datapath_id(self):
         if not self.datapath_id_output_string:
-            self.datapath_id = 'unknown'
+            self.datapath_id = "unknown"
         else:
             # Datapath ID              : 000af0921c22bac0
             # |-----------------(0)---------------------|
             # |-----------(1)----------| |------(2)-----|
-            matches = re.search('(.*: )(\w+)', self.datapath_id_output_string)
+            matches = re.search("(.*: )(\w+)", self.datapath_id_output_string)
             datapath_id_hex = matches.group(2)
             self.datapath_id = self.convert_hex_to_decimal_as_string(datapath_id_hex)