Reformat files according to template
[oam.git] / code / network-generator / network_generation / model / python / o_ran_cu.py
index 484fc00..d3034b4 100644 (file)
 A Class representing an O-RAN centralized unit (ORanCu)
 and at the same time a location for an O-Cloud resource pool
 """
+import xml.etree.ElementTree as ET
 from typing import overload
+
+import network_generation.model.python.hexagon as Hexagon
 from network_generation.model.python.cube import Cube
 from network_generation.model.python.hexagon import Hex
-import network_generation.model.python.hexagon as Hexagon
 from network_generation.model.python.o_ran_cloud_du import ORanCloudDu
-from network_generation.model.python.tower import Tower
-from network_generation.model.python.o_ran_object import IORanObject
 from network_generation.model.python.o_ran_node import ORanNode
-from network_generation.model.python.o_ran_termination_point import ORanTerminationPoint
-import xml.etree.ElementTree as ET
+from network_generation.model.python.o_ran_object import IORanObject
+from network_generation.model.python.o_ran_termination_point import (
+    ORanTerminationPoint,
+)
+from network_generation.model.python.tower import Tower
 
 
 # Define the "IORanCu" interface
@@ -43,8 +46,12 @@ class ORanCu(ORanNode, IORanCu):
         self._o_ran_cloud_dus: list[ORanCu] = self._calculate_o_ran_dus()
 
     def _calculate_o_ran_dus(self) -> list[ORanCloudDu]:
-        hex_ring_radius: int = self.spiralRadiusProfile.oRanCuSpiralRadiusOfODus
-        hex_list: list[Hex] = self.spiralRadiusProfile.oRanDuSpiral(self.position, hex_ring_radius)
+        hex_ring_radius: int = (
+            self.spiralRadiusProfile.oRanCuSpiralRadiusOfODus
+        )
+        hex_list: list[Hex] = self.spiralRadiusProfile.oRanDuSpiral(
+            self.position, hex_ring_radius
+        )
         result: list[ORanCloudDu] = []
         for index, hex in enumerate(hex_list):
             s: str = "00" + str(index)
@@ -69,7 +76,6 @@ class ORanCu(ORanNode, IORanCu):
             )
         return result
 
-
     @property
     def o_ran_cloud_dus(self) -> list[ORanCloudDu]:
         return self._o_ran_cloud_dus
@@ -88,8 +94,12 @@ class ORanCu(ORanNode, IORanCu):
         phy_tp: str = "-".join([self.name, "phy".upper()])
         result.append({"tp-id": phy_tp, "name": phy_tp})
         for interface in ["e2", "o1"]:
-            id:str = "-".join([self.name, interface.upper()])
-            result.append(ORanTerminationPoint({"id": id, "name":id, "supporter": phy_tp, "parent":self}))
+            id: str = "-".join([self.name, interface.upper()])
+            result.append(
+                ORanTerminationPoint(
+                    {"id": id, "name": id, "supporter": phy_tp, "parent": self}
+                )
+            )
         return result
 
     def to_topology_nodes(self) -> list[dict[str, dict]]:
@@ -97,15 +107,15 @@ class ORanCu(ORanNode, IORanCu):
         # for o_ran_du in self.o_ran_dus: # TODO
         #     result.extend(o_ran_du.to_topology_nodes())
         for o_ran_cloud_du in self.o_ran_cloud_dus:
-            result.extend(o_ran_cloud_du.to_topology_nodes())    
+            result.extend(o_ran_cloud_du.to_topology_nodes())
         return result
 
     def to_topology_links(self) -> list[dict[str, dict]]:
         result: list[dict[str, dict]] = super().to_topology_links()
         # for o_ran_du in self.o_ran_dus:
-            # result.extend(o_ran_du.to_topology_links())
+        # result.extend(o_ran_du.to_topology_links())
         for o_ran_cloud_du in self.o_ran_cloud_dus:
-            result.extend(o_ran_cloud_du.to_topology_links())    
+            result.extend(o_ran_cloud_du.to_topology_links())
         return result
 
     def toKml(self) -> ET.Element:
@@ -118,6 +128,5 @@ class ORanCu(ORanNode, IORanCu):
             o_ran_cu.append(o_ran_cloud_du.toKml())
         return o_ran_cu
 
-
     def toSvg(self) -> None:
         return None