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 abc import abstractmethod
21 from model.python.o_ran_object import IORanObject, ORanObject
24 # Define the "IORanObject" interface
25 class IORanTerminationPointData(IORanObject):
26 def __init__(self, supporter: str = None, parent=None, **kwargs):
27 super().__init__(**kwargs)
28 self.supporter = supporter
32 # Define an O-RAN Termination Point (ietf-interface, onf:logical-termination-point) class
33 class ORanTerminationPoint(ORanObject, IORanTerminationPointData):
34 def __init__(self, tp: IORanTerminationPointData = None, **kwargs):
35 super().__init__(tp, **kwargs)
36 self.supporter = tp["supporter"] if tp and "supporter" in tp else None
37 self.parent = tp["parent"] if tp and "parent" in tp else None
39 def to_topology(self):
40 result: dict[str, dict] = {"tp-id": self.name}
43 match str(type(self.parent)):
44 case "<class 'model.python.o_ran_smo.ORanSmo'>":
45 network_ref = self.parent.parent.id
46 case "<class 'model.python.o_ran_near_rt_ric.ORanNearRtRic'>":
47 network_ref = self.parent.parent.parent.id
48 case "<class 'model.python.o_ran_cu.ORanCu'>":
49 network_ref = self.parent.parent.parent.parent.id
50 case "<class 'model.python.o_ran_du.ORanDu'>":
51 network_ref = self.parent.parent.parent.parent.parent.id
52 case "<class 'model.python.o_ran_cloud_du.ORanCloudDu'>":
53 network_ref = self.parent.parent.parent.parent.parent.id
54 case "<class 'model.python.o_ran_ru.ORanRu'>":
55 network_ref = self.parent.parent.parent.parent.parent.parent.id
57 print("unknown: implement " + str(type(self.parent)))
58 network_ref = "unknown: implement " + str(type(self.parent))
60 result["supporting-termination-point"] = [
62 "network-ref": network_ref,
63 "node-ref": self.parent.name,
64 "tp-ref": self.supporter,