From: garciadeblas Date: Thu, 19 Sep 2024 11:28:23 +0000 (+0200) Subject: Fix E0401 and E1111 pylint errors in osm_ngsa X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F14630%2F1;p=osm%2FNG-SA.git Fix E0401 and E1111 pylint errors in osm_ngsa Change-Id: Idca830c61f9cad1666f158845701512522dc65db Signed-off-by: garciadeblas --- diff --git a/src/osm_ngsa/dags/multisdnc_sdnc_status.py b/src/osm_ngsa/dags/multisdnc_sdnc_status.py index a9b7c13..3412a12 100644 --- a/src/osm_ngsa/dags/multisdnc_sdnc_status.py +++ b/src/osm_ngsa/dags/multisdnc_sdnc_status.py @@ -19,9 +19,9 @@ import logging from airflow import DAG from airflow.decorators import task -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.sdnc_connectors.onos import OnosInfraCollector +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.sdnc_connectors.onos import OnosInfraCollector from prometheus_client import CollectorRegistry, Gauge, push_to_gateway diff --git a/src/osm_ngsa/dags/multivim_vim_status.py b/src/osm_ngsa/dags/multivim_vim_status.py index 2f71bc9..996ca77 100644 --- a/src/osm_ngsa/dags/multivim_vim_status.py +++ b/src/osm_ngsa/dags/multivim_vim_status.py @@ -19,11 +19,11 @@ import logging from airflow import DAG from airflow.decorators import task -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.vim_connectors.azure import AzureCollector -from osm_mon.vim_connectors.gcp import GcpCollector -from osm_mon.vim_connectors.openstack import OpenStackCollector +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.vim_connectors.azure import AzureCollector +from osm_ngsa.osm_mon.vim_connectors.gcp import GcpCollector +from osm_ngsa.osm_mon.vim_connectors.openstack import OpenStackCollector from prometheus_client import CollectorRegistry, Gauge, push_to_gateway diff --git a/src/osm_ngsa/dags/multivim_vm_metrics.py b/src/osm_ngsa/dags/multivim_vm_metrics.py index acec04d..6292e57 100644 --- a/src/osm_ngsa/dags/multivim_vm_metrics.py +++ b/src/osm_ngsa/dags/multivim_vm_metrics.py @@ -21,11 +21,11 @@ from typing import Dict, List from airflow import DAG from airflow.decorators import task -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.vim_connectors.azure import AzureCollector -from osm_mon.vim_connectors.gcp import GcpCollector -from osm_mon.vim_connectors.openstack import OpenStackCollector +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.vim_connectors.azure import AzureCollector +from osm_ngsa.osm_mon.vim_connectors.gcp import GcpCollector +from osm_ngsa.osm_mon.vim_connectors.openstack import OpenStackCollector from prometheus_client import CollectorRegistry, Gauge, push_to_gateway diff --git a/src/osm_ngsa/dags/multivim_vm_status.py b/src/osm_ngsa/dags/multivim_vm_status.py index 80a38eb..2e0640d 100644 --- a/src/osm_ngsa/dags/multivim_vm_status.py +++ b/src/osm_ngsa/dags/multivim_vm_status.py @@ -19,11 +19,11 @@ import logging from airflow import DAG from airflow.decorators import task -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.vim_connectors.azure import AzureCollector -from osm_mon.vim_connectors.gcp import GcpCollector -from osm_mon.vim_connectors.openstack import OpenStackCollector +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.vim_connectors.azure import AzureCollector +from osm_ngsa.osm_mon.vim_connectors.gcp import GcpCollector +from osm_ngsa.osm_mon.vim_connectors.openstack import OpenStackCollector from prometheus_client import CollectorRegistry, Gauge, push_to_gateway diff --git a/src/osm_ngsa/dags/ns_topology.py b/src/osm_ngsa/dags/ns_topology.py index a3983c4..611ba0a 100644 --- a/src/osm_ngsa/dags/ns_topology.py +++ b/src/osm_ngsa/dags/ns_topology.py @@ -18,8 +18,8 @@ from datetime import datetime, timedelta import logging from airflow.decorators import dag, task -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config from prometheus_client import CollectorRegistry, Gauge, push_to_gateway diff --git a/src/osm_ngsa/dags/scalein_vdu.py b/src/osm_ngsa/dags/scalein_vdu.py index c5daefd..e1c590f 100644 --- a/src/osm_ngsa/dags/scalein_vdu.py +++ b/src/osm_ngsa/dags/scalein_vdu.py @@ -22,9 +22,9 @@ import uuid from airflow.decorators import dag, task from airflow.operators.python import get_current_context -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.core.message_bus_client import MessageBusClient +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.message_bus_client import MessageBusClient # Logging logger = logging.getLogger("airflow.task") diff --git a/src/osm_ngsa/dags/scaleout_vdu.py b/src/osm_ngsa/dags/scaleout_vdu.py index 978ab3f..56a9d36 100644 --- a/src/osm_ngsa/dags/scaleout_vdu.py +++ b/src/osm_ngsa/dags/scaleout_vdu.py @@ -22,9 +22,9 @@ import uuid from airflow.decorators import dag, task from airflow.operators.python import get_current_context -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.core.message_bus_client import MessageBusClient +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.message_bus_client import MessageBusClient # Logging logger = logging.getLogger("airflow.task") diff --git a/src/osm_ngsa/dags/vdu_alarm.py b/src/osm_ngsa/dags/vdu_alarm.py index 9acabf1..cd724fb 100644 --- a/src/osm_ngsa/dags/vdu_alarm.py +++ b/src/osm_ngsa/dags/vdu_alarm.py @@ -20,8 +20,8 @@ import logging from airflow.decorators import dag, task from airflow.operators.python import get_current_context -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config import requests from requests.exceptions import ConnectionError, RequestException diff --git a/src/osm_ngsa/dags/vdu_down.py b/src/osm_ngsa/dags/vdu_down.py index 13bc207..0c2637d 100644 --- a/src/osm_ngsa/dags/vdu_down.py +++ b/src/osm_ngsa/dags/vdu_down.py @@ -22,9 +22,9 @@ import uuid from airflow.decorators import dag, task from airflow.operators.python import get_current_context -from osm_mon.core.common_db import CommonDbClient -from osm_mon.core.config import Config -from osm_mon.core.message_bus_client import MessageBusClient +from osm_ngsa.osm_mon.core.common_db import CommonDbClient +from osm_ngsa.osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.message_bus_client import MessageBusClient # Logging logger = logging.getLogger("airflow.task") diff --git a/src/osm_ngsa/osm_mon/core/common_db.py b/src/osm_ngsa/osm_mon/core/common_db.py index 933a0ea..ee6194c 100644 --- a/src/osm_ngsa/osm_mon/core/common_db.py +++ b/src/osm_ngsa/osm_mon/core/common_db.py @@ -15,7 +15,7 @@ # limitations under the License. ####################################################################################### from osm_common import dbmemory, dbmongo -from osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.config import Config class CommonDbClient: diff --git a/src/osm_ngsa/osm_mon/core/message_bus_client.py b/src/osm_ngsa/osm_mon/core/message_bus_client.py index 3f81214..df3aa32 100644 --- a/src/osm_ngsa/osm_mon/core/message_bus_client.py +++ b/src/osm_ngsa/osm_mon/core/message_bus_client.py @@ -17,7 +17,7 @@ from typing import Callable, List from osm_common import msgkafka, msglocal -from osm_mon.core.config import Config +from osm_ngsa.osm_mon.core.config import Config class MessageBusClient: diff --git a/src/osm_ngsa/osm_mon/sdnc_connectors/onos.py b/src/osm_ngsa/osm_mon/sdnc_connectors/onos.py index f9463f1..2cce99a 100644 --- a/src/osm_ngsa/osm_mon/sdnc_connectors/onos.py +++ b/src/osm_ngsa/osm_mon/sdnc_connectors/onos.py @@ -22,7 +22,7 @@ import logging from typing import Dict -from osm_mon.sdnc_connectors.base_sdnc import SDNCConnector +from osm_ngsa.osm_mon.sdnc_connectors.base_sdnc import SDNCConnector import requests from requests.auth import HTTPBasicAuth diff --git a/src/osm_ngsa/osm_mon/vim_connectors/azure.py b/src/osm_ngsa/osm_mon/vim_connectors/azure.py index 4cf20b7..90c8cf1 100644 --- a/src/osm_ngsa/osm_mon/vim_connectors/azure.py +++ b/src/osm_ngsa/osm_mon/vim_connectors/azure.py @@ -22,7 +22,7 @@ from azure.identity import ClientSecretCredential from azure.mgmt.compute import ComputeManagementClient from azure.mgmt.monitor import MonitorManagementClient from azure.profiles import ProfileDefinition -from osm_mon.vim_connectors.base_vim import VIMConnector +from osm_ngsa.osm_mon.vim_connectors.base_vim import VIMConnector log = logging.getLogger(__name__) diff --git a/src/osm_ngsa/osm_mon/vim_connectors/gcp.py b/src/osm_ngsa/osm_mon/vim_connectors/gcp.py index bfb3e10..87b4f56 100644 --- a/src/osm_ngsa/osm_mon/vim_connectors/gcp.py +++ b/src/osm_ngsa/osm_mon/vim_connectors/gcp.py @@ -23,7 +23,7 @@ from typing import Dict, List from google.cloud import monitoring_v3 from google.oauth2 import service_account import googleapiclient.discovery -from osm_mon.vim_connectors.base_vim import VIMConnector +from osm_ngsa.osm_mon.vim_connectors.base_vim import VIMConnector log = logging.getLogger(__name__) diff --git a/src/osm_ngsa/osm_mon/vim_connectors/openstack.py b/src/osm_ngsa/osm_mon/vim_connectors/openstack.py index 16ea543..61f3c49 100644 --- a/src/osm_ngsa/osm_mon/vim_connectors/openstack.py +++ b/src/osm_ngsa/osm_mon/vim_connectors/openstack.py @@ -28,8 +28,8 @@ from keystoneauth1.exceptions.catalog import EndpointNotFound from keystoneauth1.identity import v3 from keystoneclient.v3 import client as keystone_client from novaclient import client as nova_client -from osm_mon.vim_connectors.base_vim import VIMConnector -from osm_mon.vim_connectors.vrops_helper import vROPS_Helper +from osm_ngsa.osm_mon.vim_connectors.base_vim import VIMConnector +from osm_ngsa.osm_mon.vim_connectors.vrops_helper import vROPS_Helper from prometheus_api_client import PrometheusConnect as prometheus_client log = logging.getLogger(__name__) @@ -134,10 +134,10 @@ class OpenStackCollector(VIMConnector): keystone = keystone_client.Client(session=self.vim_session) # Obtain the service catalog from OpenStack service_catalog = keystone.services.list() - log.debug(f"Openstack service catalog: {service_catalog}") + log.info(f"Openstack service catalog: {service_catalog}") # Convert into a dictionary services = {service.name: service.type for service in service_catalog} - log.debug(f"Openstack services: {services}") + log.info(f"Openstack services: {services}") if "prometheus" in services: log.debug("Using Prometheus backend") return "prometheus" @@ -153,14 +153,14 @@ class OpenStackCollector(VIMConnector): def _get_backend(self, vim_account: dict, vim_session: object): openstack_metrics_backend = self._determine_backend() - log.debug(f"openstack_metrics_backend: {openstack_metrics_backend}") + log.info(f"openstack_metrics_backend: {openstack_metrics_backend}") # Priority 1. If prometheus-config, use Prometheus backend log.debug(f"vim_account: {vim_account}") if vim_account.get("prometheus-config"): try: tsbd = PrometheusTSBDBackend(vim_account) - log.debug("Using prometheustsbd backend to collect metric") + log.info("Using prometheustsbd backend to collect metric") return tsbd except Exception as e: log.error(f"Can't create prometheus client, {e}") @@ -174,7 +174,7 @@ class OpenStackCollector(VIMConnector): log.debug(f"vim_type: {vim_type}") if vim_type == "vio" and "vrops_site" in vim_config: try: - log.debug("Using vROPS backend to collect metric") + log.info("Using vROPS backend to collect metric") vrops = VropsBackend(vim_account) return vrops except Exception as e: @@ -185,7 +185,7 @@ class OpenStackCollector(VIMConnector): try: gnocchi = GnocchiBackend(vim_account, vim_session) gnocchi.client.metric.list(limit=1) - log.debug("Using gnocchi backend to collect metric") + log.info("Using gnocchi backend to collect metric") return gnocchi except (gnocchiclient.exceptions.ClientException, EndpointNotFound) as e: log.warning(f"Gnocchi not available: {e}") @@ -194,7 +194,7 @@ class OpenStackCollector(VIMConnector): try: ceilometer = CeilometerBackend(vim_account, vim_session) ceilometer.client.capabilities.get() - log.debug("Using ceilometer backend to collect metric") + log.info("Using ceilometer backend to collect metric") return ceilometer except (HTTPException, EndpointNotFound) as e: log.warning(f"Ceilometer not available: {e}") diff --git a/tox.ini b/tox.ini index 3428170..e3d7037 100644 --- a/tox.ini +++ b/tox.ini @@ -75,7 +75,7 @@ deps = {[testenv]deps} pylint skip_install = true commands = - pylint -E src setup.py --disable=E0401 --disable=E1111 + pylint -E src setup.py [testenv:pylint-webhook]