X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-generator%2Fnetwork_generation%2Fmodel%2Fpython%2Fo_ran_du.py;fp=code%2Fnetwork-generator%2Fnetwork_generation%2Fmodel%2Fpython%2Fo_ran_du.py;h=98e8c1accdf9508373cb90a15f19628c146cff2a;hb=1dcbd86bcea1ebf23ed42f57f936a48d4d445133;hp=0392d2cf002d48f9f3248b8b42e2489ef3bdd897;hpb=28ef5927441476ba78bd04aafec0ccaca7cfc4c5;p=oam.git diff --git a/code/network-generator/network_generation/model/python/o_ran_du.py b/code/network-generator/network_generation/model/python/o_ran_du.py index 0392d2c..98e8c1a 100644 --- a/code/network-generator/network_generation/model/python/o_ran_du.py +++ b/code/network-generator/network_generation/model/python/o_ran_du.py @@ -18,6 +18,7 @@ A Class representing an O-RAN distributed unit (ORanDu) """ import xml.etree.ElementTree as ET +import os from typing import Any, cast from network_generation.model.python.o_ran_node import IORanNode, ORanNode @@ -54,6 +55,7 @@ class ORanDu(ORanNode): if o_ran_du_data and "oRanRuCount" in o_ran_du_data else 1 ) + self.type = "ntsim-ng-o-du" def _to_o_ran_du_data(self, data: dict[str, Any]) -> IORanDu: result: IORanDu = default_value @@ -114,3 +116,11 @@ class ORanDu(ORanNode): def toSvg(self) -> ET.Element: return ET.Element("to-be-implemented") + + def to_directory(self, parent_dir: str) -> None: + parent_path = os.path.join(parent_dir, self.type) + path = os.path.join(parent_path, self.name) + if not os.path.exists(parent_path): + os.makedirs(parent_path, exist_ok=True) + if not os.path.exists(path): + os.mkdir(path)