"""
An abstract Class for O-RAN Objects
"""
-from abc import ABC, abstractmethod
-from typing import Dict
-
+from abc import abstractmethod
+from typing import Any
from model.python.top import ITop, Top
-from model.python.type_definitions import (
- AddressType,
-)
-from model.python.geo_location import GeoLocation
# Define the "IORanObject" interface
class IORanObject(ITop):
- def __init__(
- self,
- address: AddressType = None,
- geoLocation: GeoLocation = None,
- url: str = None,
- **kwargs
- ):
+ def __init__(self, **kwargs):
super().__init__(**kwargs)
- self.address = address
- self.geoLocation = geoLocation
- self.url = url
# Define an abstract O-RAN Object class
class ORanObject(Top, IORanObject):
def __init__(self, of: IORanObject = None, **kwargs):
- super().__init__(**kwargs)
- self.address = of["address"] if of and "address" in of else None
- self.geoLocation = (
- of["geoLocation"] if of and "geoLocation" in of else GeoLocation()
- )
- self.url = of["url"] if of and "url" in of else self.id
-
- @property
- def address(self):
- return self._address
-
- @address.setter
- def address(self, value):
- self._address = value
-
- @property
- def geoLocation(self):
- return self._geographicalLocation
-
- @geoLocation.setter
- def geoLocation(self, value):
- self._geographicalLocation = value
-
- @property
- def url(self):
- return self._url
+ super().__init__(of, **kwargs)
- @url.setter
- def url(self, value):
- self._url = value
-
- def json(self):
- result :Dict = super().json()
- result['address'] = self.address
- result['geoLocation'] = self.geoLocation.json()
- result['url'] = self.url
+ def json(self) -> dict[str, Any]:
+ result: dict[str, Any] = super().json()
return result
- def __str__(self):
+ def __str__(self) -> str:
return str(self.json())
-
- @abstractmethod
- def toTopology(self):
- pass
-
- @abstractmethod
- def toKml(self):
- pass
@abstractmethod
- def toSvg(self):
+ def toTopology(self) -> dict[str, Any]:
pass