X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-generator%2Fmodel%2Fpython%2FTop.py;fp=code%2Fnetwork-generator%2Fmodel%2Fpython%2FTop.py;h=0000000000000000000000000000000000000000;hb=9ea4e241e3ec0c9dffd3db7fd7ab5a2cf3d13e7d;hp=b076a62a302de912049f46ef32b27225d0757c76;hpb=efc32e4b1b65c69fce9600e08f95e17e4d4032ef;p=oam.git diff --git a/code/network-generator/model/python/Top.py b/code/network-generator/model/python/Top.py deleted file mode 100644 index b076a62..0000000 --- a/code/network-generator/model/python/Top.py +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright 2023 highstreet technologies GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#!/usr/bin/python - -""" -An abstract Class for all classes -""" -import uuid -from abc import ABC, abstractmethod -from typing import Optional, Dict, Union -from model.python.TypeDefinitions import ( - AddressType, - AdministrativeState, - OperationalState, - UsageState, - Utilization, - LifeCycleState, - AlarmState, -) -from model.python.GeoLocation import GeoLocation - - -# Define the ITop interface -class ITop: - def __init__( - self, - id: str = None, - name: str = None, - administrativeState: AdministrativeState = None, - operationalState: OperationalState = None, - lifeCycleState: LifeCycleState = None, - alarmState: AlarmState = None, - usageState: UsageState = None, - utilization: Utilization = None, - ): - self.id = id - self.name = name - self.administrativeState = administrativeState - self.operationalState = operationalState - self.lifeCycleState = lifeCycleState - self.alarmState = alarmState - self.usageState = usageState - self.utilization = utilization - - -# Define the Top class -class Top(ABC, ITop): - def __init__(self, data=None): - self._id = data.id if data and data.id else str(uuid.uuid4()) - self._name = ( - data.name if data and data.name else " ".join(["Name", "of", self._id]) - ) - self._administrativeState = ( - data.administrativeState - if data and data.administrativeState - else AdministrativeState.LOCKED - ) - self._operationalState = ( - data.operationalState - if data and data.operationalState - else OperationalState.DISABLED - ) - self._lifeCycleState = ( - data.lifeCycleState - if data and data.lifeCycleState - else LifeCycleState.PLANNED - ) - self._alarmState = ( - data.alarmState if data and data.alarmState else 0 - ) - self._usageState = ( - data.usageState if data and data.usageState else UsageState.UNUSED - ) - self._utilization = ( - data.utilization if data and data.utilization else 0 - ) - - @property - def id(self): - return self._id - - @id.setter - def id(self, value): - self._id = value - - @property - def name(self): - return self._name - - @name.setter - def name(self, value): - self._name = value - - @property - def administrativeState(self): - return self._administrativeState - - @administrativeState.setter - def administrativeState(self, value): - self._administrativeState = value - - @property - def operationalState(self): - return self._operationalState - - @operationalState.setter - def operationalState(self, value): - self._operationalState = value - - @property - def lifeCycleState(self): - return self._lifeCycleState - - @lifeCycleState.setter - def lifeCycleState(self, value): - self._lifeCycleState = value - - @property - def alarmState(self): - return self._alarmState - - @alarmState.setter - def alarmState(self, value): - self._alarmState = value - - @property - def usageState(self): - return self._usageState - - @usageState.setter - def usageState(self, value): - self._usageState = value - - @property - def utilization(self): - return self._utilization - - @utilization.setter - def utilization(self, value): - self._utilization = value - - def json(self): - return { - "id": self.id, - "name": self.name, - "administrativeState": self.administrativeState.value, - "operationalState": self.operationalState.value, - "lifeCycleState": self.lifeCycleState.value, - "alarmState": self.alarmState, - "usageState": self.usageState.value, - "utilization": self.utilization, - } - - def __str__(self): - return str(self.json())