X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-generator%2Fmodel%2Fpython%2Fo_ran_object.py;h=0641afde8c3c8552b9fa9cb639cdde2d15867bd8;hb=refs%2Fchanges%2F55%2F11955%2F1;hp=f9389546489b27c50a91122cb5d8629a6565db78;hpb=9ea4e241e3ec0c9dffd3db7fd7ab5a2cf3d13e7d;p=oam.git diff --git a/code/network-generator/model/python/o_ran_object.py b/code/network-generator/model/python/o_ran_object.py index f938954..0641afd 100644 --- a/code/network-generator/model/python/o_ran_object.py +++ b/code/network-generator/model/python/o_ran_object.py @@ -17,83 +17,29 @@ """ 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 - @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