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 TerminationPoint
20 from typing import Any, cast
22 from network_generation.model.python.o_ran_object import (
28 # Define the "IORanObject" interface
29 class IORanTerminationPoint(IORanObject):
34 default_value: IORanTerminationPoint = cast(
35 IORanTerminationPoint,
37 **ORanObject.default(),
39 "supporter": "TerminationPointLayer",
46 # Define an O-RAN Termination Point
47 # (ietf-interface, onf:logical-termination-point) class
48 class ORanTerminationPoint(ORanObject):
50 def default() -> dict[str, Any]:
51 return cast(dict[str, Any], default_value)
54 self, data: dict[str, Any] = default(), **kwargs: dict[str, Any]
56 itp: IORanTerminationPoint = self._to_itp_data(data)
57 super().__init__(cast(dict[str, Any], itp), **kwargs)
58 self._supporter: str = str(itp["supporter"])
59 self._parent: Any = itp["parent"]
61 def _to_itp_data(self, data: dict[str, Any]) -> IORanTerminationPoint:
62 result: IORanTerminationPoint = default_value
63 for key, key_type in IORanTerminationPoint.__annotations__.items():
65 result[key] = data[key] # type: ignore
69 def supporter(self) -> str:
70 return self._supporter
73 def supporter(self, value: str) -> None:
74 self._supporter = value
77 def parent(self) -> Any:
78 return self._utilization
81 def parent(self, value: Any) -> None:
84 def to_topology(self) -> dict[str, Any]:
85 result: dict[str, Any] = {"tp-id": self.name}
88 # network_ref: str = ""
89 # match self.parent.__qualname__:
90 # case ORanSmo.__qualname__:
91 # network_ref = self.parent.parent.id
92 # case "<class 'model.python.o_ran_smo.ORanSmo'>":
93 # network_ref = self.parent.parent.id
94 # case "<class 'model.python.o_ran_near_rt_ric.ORanNearRtRic'>":
95 # network_ref = self.parent.parent.parent.id
96 # case "<class 'model.python.o_ran_cu.ORanCu'>":
97 # network_ref = self.parent.parent.parent.parent.id
98 # case "<class 'model.python.o_ran_du.ORanDu'>":
99 # network_ref = self.parent.parent.parent.parent.parent.id
100 # case "<class 'model.python.o_ran_cloud_du.ORanCloudDu'>":
101 # network_ref = self.parent.parent.parent.parent.parent.id
102 # case "<class 'model.python.o_ran_ru.ORanRu'>":
104 # self.parent.parent.parent.parent.parent.parent.id
107 # print("unknown: implement " + str(type(self.parent)))
108 # network_ref = "unknown: implement " + str(
112 # result["supporting-termination-point"] = [
114 # "network-ref": network_ref,
115 # "node-ref": self.parent.name,
116 # "tp-ref": self.supporter,