1 # Copyright 2023 highstreet technologies GmbH
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 An abstract Class for O-RAN Objects
20 from abc import ABC, abstractmethod
21 from typing import Dict
23 from model.python.top import ITop, Top
24 from model.python.type_definitions import (
27 from model.python.geo_location import GeoLocation
30 # Define the "IORanObject" interface
31 class IORanObject(ITop):
34 address: AddressType = None,
35 geoLocation: GeoLocation = None,
39 super().__init__(**kwargs)
40 self.address = address
41 self.geoLocation = geoLocation
45 # Define an abstract O-RAN Object class
46 class ORanObject(Top, IORanObject):
47 def __init__(self, of: IORanObject = None, **kwargs):
48 super().__init__(**kwargs)
49 self.address = of["address"] if of and "address" in of else None
51 of["geoLocation"] if of and "geoLocation" in of else GeoLocation()
53 self.url = of["url"] if of and "url" in of else self.id
60 def address(self, value):
64 def geoLocation(self):
65 return self._geographicalLocation
68 def geoLocation(self, value):
69 self._geographicalLocation = value
80 result :Dict = super().json()
81 result['address'] = self.address
82 result['geoLocation'] = self.geoLocation.json()
83 result['url'] = self.url
87 return str(self.json())