Pin black, flake and pylint versions in tox.ini 75/14175/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 21 Dec 2023 15:28:15 +0000 (16:28 +0100)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Mon, 29 Jan 2024 17:00:05 +0000 (18:00 +0100)
Change-Id: I373f6188cbf04dfe6f3c8f8e9ef4f823cf6c3dcf
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
14 files changed:
NG-RO/osm_ng_ro/monitor.py
NG-RO/osm_ng_ro/ns.py
NG-RO/osm_ng_ro/ns_thread.py
NG-RO/osm_ng_ro/ro_main.py
NG-RO/osm_ng_ro/tests/test_ns.py
RO-SDN-floodlight_openflow/osm_rosdn_floodlightof/floodlight_of.py
RO-SDN-ietfl2vpn/osm_rosdn_ietfl2vpn/wimconn_ietfl2vpn.py
RO-SDN-onos_openflow/osm_rosdn_onosof/onos_of.py
RO-VIM-aws/osm_rovim_aws/vimconn_aws.py
RO-VIM-gcp/osm_rovim_gcp/vimconn_gcp.py
RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py
RO-VIM-vmware/osm_rovim_vmware/vimconn_vmware.py
releasenotes/notes/pin_flake_black_pylint-8a793d9acdb772b6.yaml [new file with mode: 0644]
tox.ini

index 529ce0e..ebb2779 100644 (file)
@@ -526,21 +526,21 @@ class MonitorVms:
             vdur_path               (str):          Path of VDUR in DB
         """
         if server.status in openStackvmStatusOk:
-            vdur_vim_info_update["vim_status"] = vdur_update[
-                vdur_path + ".status"
-            ] = server.status
+            vdur_vim_info_update["vim_status"] = vdur_update[vdur_path + ".status"] = (
+                server.status
+            )
 
         else:
-            vdur_vim_info_update["vim_status"] = vdur_update[
-                vdur_path + ".status"
-            ] = server.status
+            vdur_vim_info_update["vim_status"] = vdur_update[vdur_path + ".status"] = (
+                server.status
+            )
             vdur_vim_info_update["vim_message"] = "VIM status reported " + server.status
 
         vdur_vim_info_update["vim_details"] = self._get_server_info(server)
         vdur_vim_info_update["vim_id"] = server.id
-        vdur_vim_info_update["vim_name"] = vdur_update[
-            vdur_path + ".name"
-        ] = server.name
+        vdur_vim_info_update["vim_name"] = vdur_update[vdur_path + ".name"] = (
+            server.name
+        )
 
     @staticmethod
     def get_interface_info(
@@ -610,9 +610,9 @@ class MonitorVms:
         """
         current_ip_address = MonitorVms._get_current_ip_address(interface_info)
         if current_ip_address:
-            vdur_update[
-                vdur_path + ".interfaces." + str(index) + ".ip-address"
-            ] = current_ip_address
+            vdur_update[vdur_path + ".interfaces." + str(index) + ".ip-address"] = (
+                current_ip_address
+            )
 
             if old_interface.get("mgmt_vdu_interface"):
                 vdur_update[vdur_path + ".ip-address"] = current_ip_address
@@ -620,9 +620,9 @@ class MonitorVms:
             if old_interface.get("mgmt_vnf_interface"):
                 vnfr_update[vnfr_id + ".ip-address"] = current_ip_address
 
-        vdur_update[
-            vdur_path + ".interfaces." + str(index) + ".mac-address"
-        ] = interface_info.get("mac_address")
+        vdur_update[vdur_path + ".interfaces." + str(index) + ".mac-address"] = (
+            interface_info.get("mac_address")
+        )
 
     @staticmethod
     def _get_current_ip_address(interface_info: dict) -> Optional[str]:
@@ -667,14 +667,18 @@ class MonitorVms:
         vdur_vim_info_update["interfaces"][index].update(
             {
                 "mac_address": interface_info["mac_address"],
-                "ip_address": interface_info["fixed_ips"][0].get("ip_address")
-                if interface_info.get("fixed_ips")
-                else None,
+                "ip_address": (
+                    interface_info["fixed_ips"][0].get("ip_address")
+                    if interface_info.get("fixed_ips")
+                    else None
+                ),
                 "vim_net_id": interface_info["network_id"],
                 "vim_info": self.serialize(interface_info),
-                "compute_node": server.to_dict()["OS-EXT-SRV-ATTR:host"]
-                if server.to_dict().get("OS-EXT-SRV-ATTR:host")
-                else None,
+                "compute_node": (
+                    server.to_dict()["OS-EXT-SRV-ATTR:host"]
+                    if server.to_dict().get("OS-EXT-SRV-ATTR:host")
+                    else None
+                ),
             }
         )
 
@@ -744,9 +748,9 @@ class MonitorVms:
         for index, old_interface in enumerate(existing_vim_info["interfaces"]):
             interface_info = self.get_interface_info(ports, old_interface, server)
             if not interface_info:
-                vdur_vim_info_update[
-                    "vim_message"
-                ] = f"Interface {old_interface['vim_interface_id']} deleted externally."
+                vdur_vim_info_update["vim_message"] = (
+                    f"Interface {old_interface['vim_interface_id']} deleted externally."
+                )
 
             else:
                 if interface_info.get("status") in openStacknetStatusOk:
index 6cab53a..fc2b9a7 100644 (file)
@@ -737,9 +737,11 @@ class Ns(object):
             # Pinning policy "ISOLATE" uses cores as host should not support SMT architecture
             # Pinning policy "PREFER" uses threads in case host supports SMT architecture
             numa[
-                "cores"
-                if guest_epa_quota.get("cpu-thread-pinning-policy") == "ISOLATE"
-                else "threads"
+                (
+                    "cores"
+                    if guest_epa_quota.get("cpu-thread-pinning-policy") == "ISOLATE"
+                    else "threads"
+                )
             ] = max(vcpu_count, 1)
             local_epa_vcpu_set = True
 
@@ -3393,9 +3395,9 @@ class Ns(object):
 
         return_data = {
             "status": global_status,
-            "details": ". ".join(details)
-            if details
-            else "progress {}/{}".format(done, total),
+            "details": (
+                ". ".join(details) if details else "progress {}/{}".format(done, total)
+            ),
             "nsr_id": nsr_id,
             "action_id": action_id,
             "tasks": task_list,
index bca21e0..2b9d8cf 100644 (file)
@@ -285,9 +285,11 @@ class VimInteractionNet(VimInteractionBase):
                     ro_task["target_id"],
                     vim_id,
                     ro_vim_item_update.get("vim_status"),
-                    ro_vim_item_update.get("vim_message")
-                    if ro_vim_item_update.get("vim_status") != "ACTIVE"
-                    else "",
+                    (
+                        ro_vim_item_update.get("vim_message")
+                        if ro_vim_item_update.get("vim_status") != "ACTIVE"
+                        else ""
+                    ),
                 )
             )
 
@@ -969,9 +971,11 @@ class VimInteractionVdu(VimInteractionBase):
                     ro_task["target_id"],
                     vim_id,
                     ro_vim_item_update.get("vim_status"),
-                    ro_vim_item_update.get("vim_message")
-                    if ro_vim_item_update.get("vim_status") != "ACTIVE"
-                    else "",
+                    (
+                        ro_vim_item_update.get("vim_message")
+                        if ro_vim_item_update.get("vim_status") != "ACTIVE"
+                        else ""
+                    ),
                 )
             )
 
@@ -1635,9 +1639,9 @@ class VimInteractionSdnNet(VimInteractionBase):
                 new_port = {
                     "service_endpoint_id": pmap.get("service_endpoint_id")
                     or service_endpoint_id,
-                    "service_endpoint_encapsulation_type": "dot1q"
-                    if port["type"] == "SR-IOV"
-                    else None,
+                    "service_endpoint_encapsulation_type": (
+                        "dot1q" if port["type"] == "SR-IOV" else None
+                    ),
                     "service_endpoint_encapsulation_info": {
                         "vlan": port.get("vlan"),
                         "mac": port.get("mac-address"),
@@ -2183,9 +2187,7 @@ class NsWorker(threading.Thread):
         target_database = (
             "vim_accounts"
             if target == "vim"
-            else "wim_accounts"
-            if target == "wim"
-            else "sdns"
+            else "wim_accounts" if target == "wim" else "sdns"
         )
         error_text = ""
 
@@ -2291,9 +2293,7 @@ class NsWorker(threading.Thread):
         target_database = (
             "vim_accounts"
             if target == "vim"
-            else "wim_accounts"
-            if target == "wim"
-            else "sdns"
+            else "wim_accounts" if target == "wim" else "sdns"
         )
         plugin_name = ""
         vim = None
@@ -2474,9 +2474,9 @@ class NsWorker(threading.Thread):
                     and task["action"] == "CREATE"
                 ):
                     # set to finished
-                    db_update["tasks.{}.status".format(index)] = task[
-                        "status"
-                    ] = "FINISHED"
+                    db_update["tasks.{}.status".format(index)] = task["status"] = (
+                        "FINISHED"
+                    )
                 elif task["action"] == "CREATE" and task["status"] not in (
                     "FINISHED",
                     "SUPERSEDED",
@@ -2789,9 +2789,9 @@ class NsWorker(threading.Thread):
                                 task_depends[dependency_task_id] = dependency_ro_task[
                                     "vim_info"
                                 ]["vim_id"]
-                                task_depends[
-                                    "TASK-{}".format(dependency_task_id)
-                                ] = dependency_ro_task["vim_info"]["vim_id"]
+                                task_depends["TASK-{}".format(dependency_task_id)] = (
+                                    dependency_ro_task["vim_info"]["vim_id"]
+                                )
 
                             if dependency_not_completed:
                                 self.logger.warning(
index c0e47ae..51c22bf 100644 (file)
@@ -254,9 +254,9 @@ class Server(object):
                             indata = filecontent.file  # .read()
 
                             if filecontent.content_type.value:
-                                cherrypy.request.headers[
-                                    "Content-Type"
-                                ] = filecontent.content_type.value
+                                cherrypy.request.headers["Content-Type"] = (
+                                    filecontent.content_type.value
+                                )
                     else:
                         # raise cherrypy.HTTPError(HTTPStatus.Not_Acceptable,
                         #                          "Only 'Content-Type' of type 'application/json' or
@@ -356,9 +356,9 @@ class Server(object):
 
         if accept:
             if "application/json" in accept:
-                cherrypy.response.headers[
-                    "Content-Type"
-                ] = "application/json; charset=utf-8"
+                cherrypy.response.headers["Content-Type"] = (
+                    "application/json; charset=utf-8"
+                )
                 a = json.dumps(data, indent=4) + "\n"
 
                 return a.encode("utf8")
@@ -539,15 +539,15 @@ class Server(object):
             return ",".join(folders) + " folders deleted\n"
         elif args and args[0] == "login":
             if not cherrypy.request.headers.get("Authorization"):
-                cherrypy.response.headers[
-                    "WWW-Authenticate"
-                ] = 'Basic realm="Access to OSM site", charset="UTF-8"'
+                cherrypy.response.headers["WWW-Authenticate"] = (
+                    'Basic realm="Access to OSM site", charset="UTF-8"'
+                )
                 cherrypy.response.status = HTTPStatus.UNAUTHORIZED.value
         elif args and args[0] == "login2":
             if not cherrypy.request.headers.get("Authorization"):
-                cherrypy.response.headers[
-                    "WWW-Authenticate"
-                ] = 'Bearer realm="Access to OSM site"'
+                cherrypy.response.headers["WWW-Authenticate"] = (
+                    'Bearer realm="Access to OSM site"'
+                )
                 cherrypy.response.status = HTTPStatus.UNAUTHORIZED.value
         elif args and args[0] == "sleep":
             sleep_time = 5
@@ -743,9 +743,11 @@ class Server(object):
             cherrypy.response.status = (
                 HTTPStatus.ACCEPTED.value
                 if not done
-                else HTTPStatus.OK.value
-                if outdata is not None
-                else HTTPStatus.NO_CONTENT.value
+                else (
+                    HTTPStatus.OK.value
+                    if outdata is not None
+                    else HTTPStatus.NO_CONTENT.value
+                )
             )
 
             return self._format_out(outdata, token_info, _format)
@@ -766,9 +768,9 @@ class Server(object):
                 http_code_name = e.http_code.name
                 cherrypy.log("Exception {}".format(e))
             else:
-                http_code_value = (
-                    cherrypy.response.status
-                ) = HTTPStatus.BAD_REQUEST.value  # INTERNAL_SERVER_ERROR
+                http_code_value = cherrypy.response.status = (
+                    HTTPStatus.BAD_REQUEST.value
+                )  # INTERNAL_SERVER_ERROR
                 cherrypy.log("CRITICAL: Exception {}".format(e), traceback=True)
                 http_code_name = HTTPStatus.BAD_REQUEST.name
 
index a7f4409..0da5290 100644 (file)
@@ -3037,9 +3037,9 @@ class TestNs(unittest.TestCase):
             }
             extra_dict["params"] = params
             expected_result = deepcopy(expected_result_rebuild_start_stop)
-            expected_result[
-                "target_record"
-            ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+            expected_result["target_record"] = (
+                "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+            )
             expected_result["params"] = params
             task = self.ns.rebuild_start_stop_task(
                 vdu_id,
@@ -3063,9 +3063,9 @@ class TestNs(unittest.TestCase):
         vdu_index = "0"
         task_index = 0
         expected_result = deepcopy(expected_result_rebuild_start_stop)
-        expected_result[
-            "target_record"
-        ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+        expected_result["target_record"] = (
+            "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+        )
         for _ in actions:
             task = self.ns.rebuild_start_stop_task(
                 vdu_id,
@@ -3095,9 +3095,9 @@ class TestNs(unittest.TestCase):
             }
             extra_dict["params"] = params
             expected_result = deepcopy(expected_result_rebuild_start_stop)
-            expected_result[
-                "target_record"
-            ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.4.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+            expected_result["target_record"] = (
+                "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.4.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+            )
             expected_result["params"] = params
             task = self.ns.rebuild_start_stop_task(
                 vdu_id,
@@ -3127,9 +3127,9 @@ class TestNs(unittest.TestCase):
             }
             extra_dict["params"] = params
             expected_result = deepcopy(expected_result_rebuild_start_stop)
-            expected_result[
-                "target_record"
-            ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+            expected_result["target_record"] = (
+                "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.0.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+            )
             expected_result["params"] = params
             expected_result["task_id"] = "bb937f49-3870-4169-b758-9732e1ff40f3:3"
             task = self.ns.rebuild_start_stop_task(
@@ -3289,9 +3289,9 @@ class TestNs(unittest.TestCase):
         vdu_index = "4"
         task_index = 1
         expected_result = deepcopy(expected_result_migrate)
-        expected_result[
-            "target_record"
-        ] = "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.4.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+        expected_result["target_record"] = (
+            "vnfrs:665b4165-ce24-4320-bf19-b9a45bade49f:vdur.4.vim_info.vim:f9f370ac-0d44-41a7-9000-457f2332bc35"
+        )
         task = self.ns.migrate_task(
             vdu, vnf, vdu_index, action_id, nsr_id_2, task_index, extra_dict_migrate
         )
index c5fec1a..43b3a30 100644 (file)
@@ -241,7 +241,7 @@ class OfConnFloodLight(OpenflowConn):
             self.logger.debug("get_of_rules " + error_text)
             info = of_response.json()
 
-            if type(info) != dict:
+            if not info.isinstance(dict):
                 self.logger.error(
                     "get_of_rules. Unexpected response not a dict %s", str(type(info))
                 )
@@ -445,7 +445,7 @@ class OfConnFloodLight(OpenflowConn):
                     self.logger.debug("obtain_port_correspondence " + error_text)
                     info = of_response.json()
 
-                    if type(info) != dict:
+                    if not info.isinstance(dict):
                         raise OpenflowConnUnexpectedResponse(
                             "unexpected openflow port-desc response, "
                             "not a dict. Wrong version?"
@@ -457,10 +457,9 @@ class OfConnFloodLight(OpenflowConn):
                             "'portDesc' not found. Wrong version?"
                         )
 
-                    if (
-                        type(info["portDesc"]) != list
-                        and type(info["portDesc"]) != tuple
-                    ):
+                    if not info["portDesc"].isinstance(list) and not info[
+                        "portDesc"
+                    ].isinstance(tuple):
                         raise OpenflowConnUnexpectedResponse(
                             "unexpected openflow port-desc response at "
                             "'portDesc', not a list. Wrong version?"
index 4cfeb12..2052bf1 100644 (file)
@@ -263,9 +263,9 @@ class WimconnectorIETFL2VPN(SdnConnectorBase):
                 site_network_accesses = {}
                 site_network_access_list = []
                 site_network_access_list.append(site_network_access)
-                site_network_accesses[
-                    "ietf-l2vpn-svc:site-network-access"
-                ] = site_network_access_list
+                site_network_accesses["ietf-l2vpn-svc:site-network-access"] = (
+                    site_network_access_list
+                )
                 conn_info_d = {}
                 conn_info_d["site"] = connection_point_wan_info["service_mapping_info"][
                     "site-id"
@@ -419,9 +419,9 @@ class WimconnectorIETFL2VPN(SdnConnectorBase):
             site_network_accesses = {}
             site_network_access_list = []
             site_network_access_list.append(site_network_access)
-            site_network_accesses[
-                "ietf-l2vpn-svc:site-network-access"
-            ] = site_network_access_list
+            site_network_accesses["ietf-l2vpn-svc:site-network-access"] = (
+                site_network_access_list
+            )
 
             try:
                 endpoint_site_network_access_edit = (
index 34359ae..be8fa7d 100644 (file)
@@ -128,7 +128,7 @@ class OfConnOnos(OpenflowConn):
             self.logger.debug("get_of_switches " + error_text)
             info = of_response.json()
 
-            if type(info) != dict:
+            if not info.isinstance(dict):
                 self.logger.error(
                     "get_of_switches. Unexpected response, not a dict: %s", str(info)
                 )
@@ -312,7 +312,7 @@ class OfConnOnos(OpenflowConn):
 
             info = of_response.json()
 
-            if type(info) != dict:
+            if not info.isinstance(dict):
                 self.logger.error(
                     "get_of_rules. Unexpected response, not a dict: %s",
                     str(info),
index 393acba..db7e63e 100644 (file)
@@ -1034,9 +1034,9 @@ class vimconnector(vimconn.VimConnector):
                                     + interface.private_ip_address
                                 )
                             else:
-                                interface_dict[
-                                    "ip_address"
-                                ] = interface.private_ip_address
+                                interface_dict["ip_address"] = (
+                                    interface.private_ip_address
+                                )
 
                             instance_dict["interfaces"].append(interface_dict)
                     except Exception as e:
index 5b58c1a..0109bf1 100644 (file)
@@ -904,9 +904,9 @@ class vimconnector(vimconn.VimConnector):
                     if not net.get("name"):
                         continue
                     else:
-                        net_iface[
-                            "subnetwork"
-                        ] = "regions/%s/subnetworks/" % self.region + net.get("name")
+                        net_iface["subnetwork"] = (
+                            "regions/%s/subnetworks/" % self.region + net.get("name")
+                        )
                 else:
                     net_iface["subnetwork"] = net.get("net_id")
                 if net.get("ip_address"):
index d97771c..54d0e88 100644 (file)
@@ -863,17 +863,17 @@ class vimconnector(vimconn.VimConnector):
                     )
 
                 if not self.config.get("multisegment_support"):
-                    network_dict[
-                        "provider:physical_network"
-                    ] = provider_physical_network
+                    network_dict["provider:physical_network"] = (
+                        provider_physical_network
+                    )
 
                     if (
                         provider_network_profile
                         and "network-type" in provider_network_profile
                     ):
-                        network_dict[
-                            "provider:network_type"
-                        ] = provider_network_profile["network-type"]
+                        network_dict["provider:network_type"] = (
+                            provider_network_profile["network-type"]
+                        )
                     else:
                         network_dict["provider:network_type"] = self.config.get(
                             "dataplane_network_type", "vlan"
index 456db81..907e20f 100644 (file)
@@ -1253,9 +1253,9 @@ class vimconnector(vimconn.VimConnector):
                             "x-vcloud-authorization"
                         ],
                     }
-                    headers[
-                        "Content-Type"
-                    ] = "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml"
+                    headers["Content-Type"] = (
+                        "application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml"
+                    )
 
                 response = self.perform_request(
                     req_type="POST", url=catalog_href, headers=headers, data=data
@@ -1990,9 +1990,9 @@ class vimconnector(vimconn.VimConnector):
                 ).group(1)
                 # cores = re.search('<vmw:CoresPerSocket ovf:required.*?>(\d+)</vmw:CoresPerSocket>', result).group(1)
 
-                headers[
-                    "Content-Type"
-                ] = "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml"
+                headers["Content-Type"] = (
+                    "application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml"
+                )
                 vdc_id = vdc.get("id").split(":")[-1]
                 instantiate_vapp_href = (
                     "{}/api/vdc/{}/action/instantiateVAppTemplate".format(
@@ -4220,15 +4220,15 @@ class vimconnector(vimconn.VimConnector):
                     child.attrib["type"]
                     == "application/vnd.vmware.vcloud.orgNetwork+xml"
                 ):
-                    network_list[
-                        child.attrib["href"].split("/")[-1:][0]
-                    ] = child.attrib["name"]
+                    network_list[child.attrib["href"].split("/")[-1:][0]] = (
+                        child.attrib["name"]
+                    )
                     org_dict["networks"] = network_list
 
                 if child.attrib["type"] == "application/vnd.vmware.vcloud.catalog+xml":
-                    catalog_list[
-                        child.attrib["href"].split("/")[-1:][0]
-                    ] = child.attrib["name"]
+                    catalog_list[child.attrib["href"].split("/")[-1:][0]] = (
+                        child.attrib["name"]
+                    )
                     org_dict["catalogs"] = catalog_list
         except Exception:
             pass
@@ -4440,9 +4440,9 @@ class vimconnector(vimconn.VimConnector):
                         for configuration in child.iter():
                             tagKey = configuration.tag.split("}")[1].strip()
                             if tagKey != "":
-                                network_configuration[
-                                    tagKey
-                                ] = configuration.text.strip()
+                                network_configuration[tagKey] = (
+                                    configuration.text.strip()
+                                )
         except Exception as exp:
             self.logger.debug("get_vcd_network: Failed with Exception {}".format(exp))
 
@@ -4988,9 +4988,9 @@ class vimconnector(vimconn.VimConnector):
                                         </InstantiateVdcTemplateParams>""".format(
                 vdc_name, vdc_template_ref
             )
-            headers[
-                "Content-Type"
-            ] = "application/vnd.vmware.vcloud.instantiateVdcTemplateParams+xml"
+            headers["Content-Type"] = (
+                "application/vnd.vmware.vcloud.instantiateVdcTemplateParams+xml"
+            )
             response = self.perform_request(
                 req_type="POST", url=vm_list_rest_call, headers=headers, data=data
             )
@@ -5102,9 +5102,9 @@ class vimconnector(vimconn.VimConnector):
                                 ip_ranges = scope.getchildren()
                                 for ipblock in ip_ranges:
                                     for block in ipblock:
-                                        parsed_respond[
-                                            block.tag.split("}")[1]
-                                        ] = block.text
+                                        parsed_respond[block.tag.split("}")[1]] = (
+                                            block.text
+                                        )
                             else:
                                 parsed_respond[tag_key] = scope.text
 
@@ -5192,9 +5192,9 @@ class vimconnector(vimconn.VimConnector):
                                 if link.attrib["rel"] == "edit" and link.attrib[
                                     "href"
                                 ].endswith("/disks"):
-                                    vm_virtual_hardware_info[
-                                        "disk_edit_href"
-                                    ] = link.attrib["href"]
+                                    vm_virtual_hardware_info["disk_edit_href"] = (
+                                        link.attrib["href"]
+                                    )
                                     break
 
                     parsed_respond["vm_virtual_hardware"] = vm_virtual_hardware_info
@@ -5306,9 +5306,9 @@ class vimconnector(vimconn.VimConnector):
             )
 
             # Send PUT request to modify disk size
-            headers[
-                "Content-Type"
-            ] = "application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1"
+            headers["Content-Type"] = (
+                "application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1"
+            )
 
             response = self.perform_request(
                 req_type="PUT", url=disk_href, headers=headers, data=data
@@ -5834,14 +5834,14 @@ class vimconnector(vimconn.VimConnector):
                         ].spec.ip.ipAddress
 
                         for device in vm_obj.config.hardware.device:
-                            if type(device) == vim.vm.device.VirtualPCIPassthrough:
+                            if device.isinstance(vim.vm.device.VirtualPCIPassthrough):
                                 device_details = {
                                     "devide_id": device.backing.id,
                                     "pciSlotNumber": device.slotInfo.pciSlotNumber,
                                 }
-                                vm_pci_devices_info[
-                                    device.deviceInfo.label
-                                ] = device_details
+                                vm_pci_devices_info[device.deviceInfo.label] = (
+                                    device_details
+                                )
                 else:
                     self.logger.error(
                         "Can not connect to vCenter while getting "
@@ -5986,9 +5986,9 @@ class vimconnector(vimconn.VimConnector):
             )
 
         data = response.text
-        headers[
-            "Content-Type"
-        ] = "application/vnd.vmware.vcloud.networkConfigSection+xml"
+        headers["Content-Type"] = (
+            "application/vnd.vmware.vcloud.networkConfigSection+xml"
+        )
         net_id = self.get_network_id_by_name(net_name)
         if not net_id:
             raise vimconn.VimConnException(
@@ -6103,9 +6103,9 @@ class vimconnector(vimconn.VimConnector):
             data = response.text
             data = data.split('<Link rel="edit"')[0]
 
-            headers[
-                "Content-Type"
-            ] = "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+            headers["Content-Type"] = (
+                "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+            )
 
             newdata = """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                       <NetworkConnectionSection xmlns="http://www.vmware.com/vcloud/v1.5"
@@ -6293,9 +6293,9 @@ class vimconnector(vimconn.VimConnector):
 
                         data = data + new_item + "</NetworkConnectionSection>"
 
-                    headers[
-                        "Content-Type"
-                    ] = "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+                    headers["Content-Type"] = (
+                        "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+                    )
 
                     response = self.perform_request(
                         req_type="PUT", url=url_rest_call, headers=headers, data=data
@@ -6446,9 +6446,9 @@ class vimconnector(vimconn.VimConnector):
 
                         data = data + new_item + "</NetworkConnectionSection>"
 
-                    headers[
-                        "Content-Type"
-                    ] = "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+                    headers["Content-Type"] = (
+                        "application/vnd.vmware.vcloud.networkConnectionSection+xml"
+                    )
 
                     response = self.perform_request(
                         req_type="PUT", url=url_rest_call, headers=headers, data=data
@@ -6671,9 +6671,9 @@ class vimconnector(vimconn.VimConnector):
             )
 
             # Send PUT request to modify virtual hardware section with new disk
-            headers[
-                "Content-Type"
-            ] = "application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1"
+            headers["Content-Type"] = (
+                "application/vnd.vmware.vcloud.rasdItemsList+xml; charset=ISO-8859-1"
+            )
 
             response = self.perform_request(
                 req_type="PUT", url=disk_href, data=new_data, headers=headers
@@ -7258,9 +7258,9 @@ class vimconnector(vimconn.VimConnector):
                 for vms in vapp.get_all_vms():
                     vm_id = vms.get("id").split(":")[-1]
 
-                    headers[
-                        "Content-Type"
-                    ] = "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+                    headers["Content-Type"] = (
+                        "application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml"
+                    )
                     rest_url = "{}/api/vApp/vm-{}/media/action/insertMedia".format(
                         self.url, vm_id
                     )
diff --git a/releasenotes/notes/pin_flake_black_pylint-8a793d9acdb772b6.yaml b/releasenotes/notes/pin_flake_black_pylint-8a793d9acdb772b6.yaml
new file mode 100644 (file)
index 0000000..538ee14
--- /dev/null
@@ -0,0 +1,23 @@
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# 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.
+#######################################################################################
+---
+other:
+  - |
+    This change pins flake8 version in tox.ini to 7.0.0, black version to 24.1.1 and
+    pylint verion to 3.0.3. In addition, all the flake8 and black issues have been
+    properly fixed.
+
diff --git a/tox.ini b/tox.ini
index 967513a..a3af3d5 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -43,7 +43,7 @@ commands =
 
 #######################################################################################
 [testenv:black]
-deps = black
+deps = black==24.1.1
 skip_install = true
 commands =
         black --check --diff NG-RO
@@ -142,7 +142,7 @@ commands =
 #######################################################################################
 [testenv:flake8]
 deps =
-        flake8==5.0.4
+        flake8==7.0.0
         flake8-import-order
 skip_install = true
 commands =
@@ -172,12 +172,12 @@ commands =
 deps =  {[testenv]deps}
         -r{toxinidir}/requirements-dev.txt
         -r{toxinidir}/requirements-test.txt
-        pylint==2.17.7
+        pylint==3.0.3
 skip_install = true
 commands =
         pylint -E NG-RO/osm_ng_ro --disable=E1101
         pylint -E RO-plugin/osm_ro_plugin --disable=E1101
-        pylint -E RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision --disable=all
+        pylint -E RO-SDN-arista_cloudvision/osm_rosdn_arista_cloudvision --disable=all
         pylint -E RO-SDN-dpb/osm_rosdn_dpb
         pylint -E RO-SDN-dynpac/osm_rosdn_dynpac --disable=E1101
         pylint -E RO-SDN-floodlight_openflow/osm_rosdn_floodlightof
@@ -188,10 +188,10 @@ commands =
         pylint -E RO-SDN-onos_vpls/osm_rosdn_onos_vpls --disable=E1101
         pylint -E RO-SDN-tapi/osm_rosdn_tapi
         pylint -E RO-VIM-aws/osm_rovim_aws
-        pylint -E RO-VIM-azure/osm_rovim_azure --disable=all
+        pylint -E RO-VIM-azure/osm_rovim_azure --disable=all
         pylint -E RO-VIM-openstack/osm_rovim_openstack --disable=E1101
-        pylint -E RO-VIM-openvim/osm_rovim_openvim --disable=all
-        pylint -E RO-VIM-vmware/osm_rovim_vmware --disable=all
+        pylint -E RO-VIM-openvim/osm_rovim_openvim --disable=all
+        pylint -E RO-VIM-vmware/osm_rovim_vmware --disable=all
         pylint -E RO-VIM-gcp/osm_rovim_gcp --disable=E1101