Commit 4a701ec9 authored by Anastasios Pandis's avatar Anastasios Pandis
Browse files

fix lint issues

parent 0c62b38d
Loading
Loading
Loading
Loading
Loading
+10 −25
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ import requests

from sunrise6g_opensdk import logger
from sunrise6g_opensdk.network.adapters.errors import NetworkPlatformError
from sunrise6g_opensdk.network.core import common, schemas
from sunrise6g_opensdk.network.core import schemas
from sunrise6g_opensdk.network.core.base_network_client import BaseNetworkClient
from sunrise6g_opensdk.network.core.schemas import (
    AsSessionWithQoSSubscription,
@@ -306,9 +306,7 @@ class NetworkManager(BaseNetworkClient):
            )

        # Extract location info (handle both key names)
        location_info = report_data.get("locationInfo") or report_data.get(
            "locationInformation"
        )
        location_info = report_data.get("locationInfo") or report_data.get("locationInformation")
        if not location_info:
            raise NetworkPlatformError(
                "Location information not found in OAI NEF monitoring event report"
@@ -318,9 +316,7 @@ class NetworkManager(BaseNetworkClient):
        event_time_raw = report_data.get("eventTime") or report_data.get("timeStamp")
        if event_time_raw:
            if isinstance(event_time_raw, str):
                event_time = datetime.fromisoformat(
                    event_time_raw.replace("Z", "+00:00")
                )
                event_time = datetime.fromisoformat(event_time_raw.replace("Z", "+00:00"))
            else:
                event_time = event_time_raw
        else:
@@ -345,9 +341,7 @@ class NetworkManager(BaseNetworkClient):
            if isinstance(nr_age, (int, float)):
                age_minutes = int(nr_age)

        last_location_time = self._compute_camara_last_location_time(
            event_time, age_minutes
        )
        last_location_time = self._compute_camara_last_location_time(event_time, age_minutes)
        log.debug(f"OAI Last Location time is {last_location_time}")

        # --- Build CAMARA area from available location data ---
@@ -379,8 +373,7 @@ class NetworkManager(BaseNetworkClient):
            return schemas.Location(area=area, lastLocationTime=last_location_time)

        raise NetworkPlatformError(
            f"No usable location data in OAI NEF response. "
            f"locationInfo: {location_info}"
            f"No usable location data in OAI NEF response. " f"locationInfo: {location_info}"
        )

    @staticmethod
@@ -391,12 +384,8 @@ class NetworkManager(BaseNetworkClient):
        Supports both 3GPP standard keys (lat/lon) and verbose keys
        (latitude/longitude) for forward-compatibility.
        """
        lat = float(
            point_data.get("lat", point_data.get("latitude", 0))
        )
        lon = float(
            point_data.get("lon", point_data.get("longitude", 0))
        )
        lat = float(point_data.get("lat", point_data.get("latitude", 0)))
        lon = float(point_data.get("lon", point_data.get("longitude", 0)))
        return lat, lon

    @staticmethod
@@ -455,9 +444,7 @@ class NetworkManager(BaseNetworkClient):
            elif "uncertaintyEllipse" in geo_area:
                # POINT_UNCERTAINTY_ELLIPSE – use the semi-major axis
                ellipse = geo_area["uncertaintyEllipse"]
                uncertainty = float(
                    ellipse.get("semiMajor", ellipse.get("uncertainty", 0))
                )
                uncertainty = float(ellipse.get("semiMajor", ellipse.get("uncertainty", 0)))
            elif "uncertaintyAltitude" in geo_area:
                # POINT_ALTITUDE_UNCERTAINTY – horizontal uncertainty
                uncertainty = float(geo_area.get("uncertainty", 0))
@@ -488,9 +475,7 @@ class NetworkManager(BaseNetworkClient):
                for c in coords
            ]
            if len(camara_points) < 3:
                raise NetworkPlatformError(
                    "Polygon geographic area requires at least 3 points"
                )
                raise NetworkPlatformError("Polygon geographic area requires at least 3 points")
            return schemas.Polygon(
                areaType=schemas.AreaType.polygon,
                boundary=schemas.PointList(camara_points),
+1 −3
Original line number Diff line number Diff line
@@ -248,9 +248,7 @@ class BaseNetworkClient:
        subscription_3gpp.ipv4Addr = (
            device.ipv4Address.root.publicAddress.root if device.ipv4Address else None
        )
        subscription_3gpp.ipv6Addr = (
            device.ipv6Address.root if device.ipv6Address else None
        )
        subscription_3gpp.ipv6Addr = device.ipv6Address.root if device.ipv6Address else None

        return subscription_3gpp

+5 −4
Original line number Diff line number Diff line
@@ -48,9 +48,7 @@ camara_payload_by_ip = RetrievalLocationRequest(
)

# Identify by phone number (valid E.164 MSISDN format)
camara_payload_by_phone = RetrievalLocationRequest(
    device=Device(phoneNumber="+10010100002")
)
camara_payload_by_phone = RetrievalLocationRequest(device=Device(phoneNumber="+10010100002"))


# ============================================================
@@ -330,7 +328,10 @@ class TestParseLocationResponseRealCoordinates:
                        "cellId": "cell-001",
                        "userLocation": {
                            "nrLocation": {
                                "ncgi": {"nrCellId": "000000001", "plmnId": {"mcc": "001", "mnc": "01"}},
                                "ncgi": {
                                    "nrCellId": "000000001",
                                    "plmnId": {"mcc": "001", "mnc": "01"},
                                },
                                "tai": {"tac": "0001", "plmnId": {"mcc": "001", "mnc": "01"}},
                            }
                        },