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