diff options
author | michal.jagiello@t-mobile.pl <michal.jagiello@t-mobile.pl> | 2023-11-02 18:04:59 +0000 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2023-11-02 19:09:26 +0100 |
commit | 10cc190bc21f3f72814ac818b180c2bb06029981 (patch) | |
tree | d0594d1ec1a92cb68d20c0db9af90a0bba5030c5 /src/onapsdk/so | |
parent | 4bdb9d7a9e6b0087332a61125d544a95e695cb8b (diff) |
Sonarqube fixes
Code was linted using sonarqube and fixes was made
Issue-ID: TEST-404
Change-Id: Id5874b8f4f392228743cd12657a8efcb1ded0b5b
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Diffstat (limited to 'src/onapsdk/so')
-rw-r--r-- | src/onapsdk/so/instantiation.py | 20 | ||||
-rw-r--r-- | src/onapsdk/so/so_db_adapter.py | 2 | ||||
-rw-r--r-- | src/onapsdk/so/so_element.py | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/onapsdk/so/instantiation.py b/src/onapsdk/so/instantiation.py index 2ca25c2..084a112 100644 --- a/src/onapsdk/so/instantiation.py +++ b/src/onapsdk/so/instantiation.py @@ -136,8 +136,8 @@ class VnfParameters: """ name: str - vnf_parameters: Iterable["InstantiationParameter"] = None - vfmodule_parameters: Iterable["VfmoduleParameters"] = None + vnf_parameters: Optional[Iterable["InstantiationParameter"]] = None + vfmodule_parameters: Optional[Iterable["VfmoduleParameters"]] = None @dataclass class VfmoduleParameters: @@ -147,7 +147,7 @@ class VfmoduleParameters: """ name: str - vfmodule_parameters: Iterable["InstantiationParameter"] = None + vfmodule_parameters: Optional[Iterable["InstantiationParameter"]] = None @dataclass @@ -194,7 +194,7 @@ class Subnet: # pylint: disable=too-many-instance-attributes name: str start_address: str gateway_address: str - role: str = None + role: Optional[str] = None cidr_mask: str = "24" ip_version: str = "4" dhcp_enabled: bool = False @@ -384,7 +384,7 @@ class VnfInstantiation(NodeTemplateInstantiation): # pylint: disable=too-many-a self.vnf = vnf @classmethod - def create_from_request_response(cls, request_response: dict) -> "VnfInstantiation": + def create_from_request_response(cls, request_response: dict) -> "VnfInstantiation": # NOSONAR """Create VNF instantiation object based on request details. Raises: @@ -399,7 +399,7 @@ class VnfInstantiation(NodeTemplateInstantiation): # pylint: disable=too-many-a """ if request_response.get("request", {}).get("requestScope") == "vnf" and \ request_response.get("request", {}).get("requestType") == "createInstance": - service: SdcService = None + service: Optional[SdcService] = None for related_instance in request_response.get("request", {}).get("requestDetails", {})\ .get("relatedInstanceList", []): if related_instance.get("relatedInstance", {}).get("modelInfo", {})\ @@ -408,7 +408,7 @@ class VnfInstantiation(NodeTemplateInstantiation): # pylint: disable=too-many-a .get("modelInfo", {}).get("modelName")) if not service: raise ResourceNotFound("No related service in Vnf instance details response") - vnf: Vnf = None + vnf: Optional[Vnf] = None for service_vnf in service.vnfs: if service_vnf.name == request_response.get("request", {})\ .get("requestDetails", {}).get("modelInfo", {}).get("modelCustomizationName"): @@ -725,7 +725,7 @@ class PnfInstantiation(NodeTemplateInstantiation): # pylint: disable=too-many-a """ if request_response.get("request", {}).get("requestScope") == "pnf" and \ request_response.get("request", {}).get("requestType") == "createInstance": - service: SdcService = None + service: Optional[SdcService] = None for related_instance in request_response.get("request", {}).get("requestDetails", {})\ .get("relatedInstanceList", []): if related_instance.get("relatedInstance", {}).get("modelInfo", {})\ @@ -734,7 +734,7 @@ class PnfInstantiation(NodeTemplateInstantiation): # pylint: disable=too-many-a .get("modelInfo", {}).get("modelName")) if not service: raise ResourceNotFound("No related service in Pnf instance details response") - pnf: Pnf = None + pnf: Optional[Pnf] = None for service_pnf in service.pnfs: if service_pnf.name == request_response.get("request", {})\ .get("requestDetails", {}).get("modelInfo", {}).get("modelCustomizationName"): @@ -969,7 +969,7 @@ class ServiceInstantiation(Instantiation): # pylint: disable=too-many-ancestors # pylint: disable=too-many-arguments, too-many-locals @classmethod - def instantiate_macro(cls, + def instantiate_macro(cls, # NOSONAR sdc_service: "SdcService", customer: "Customer", owning_entity: OwningEntity, diff --git a/src/onapsdk/so/so_db_adapter.py b/src/onapsdk/so/so_db_adapter.py index 31a93fa..57c5f33 100644 --- a/src/onapsdk/so/so_db_adapter.py +++ b/src/onapsdk/so/so_db_adapter.py @@ -28,7 +28,7 @@ class IdentityService: # pylint: disable=too-many-instance-attributes """Class to store identity service details.""" identity_id: str - url: str = "http://1.2.3.4:5000/v2.0" + url: str = "http://1.2.3.4:5000/v2.0" # NOSONAR mso_id: str = "onapsdk_user" mso_pass: str = "mso_pass_onapsdk" project_domain_name: str = "NULL" diff --git a/src/onapsdk/so/so_element.py b/src/onapsdk/so/so_element.py index 5c00654..e975cd9 100644 --- a/src/onapsdk/so/so_element.py +++ b/src/onapsdk/so/so_element.py @@ -16,7 +16,7 @@ import json from abc import ABC from dataclasses import dataclass from enum import Enum -from typing import Dict +from typing import Dict, Optional from onapsdk.configuration import settings from onapsdk.sdc.service import Service @@ -32,11 +32,11 @@ from onapsdk.utils.gui import GuiItem, GuiList class SoElement(OnapService): """Mother Class of all SO elements.""" - name: str = None + name: Optional[str] = None _server: str = "SO" base_url = settings.SO_URL api_version = settings.SO_API_VERSION - _status: str = None + _status: Optional[str] = None @property def headers(self): @@ -111,7 +111,7 @@ class SoElement(OnapService): f"{cls.api_version}/serviceInstances") @classmethod - def get_guis(cls) -> GuiItem: + def get_guis(cls) -> GuiList: """Retrieve the status of the SO GUIs. Only one GUI is referenced for SO: SO monitor |