From: demx8as6 Date: Sun, 6 Mar 2022 17:18:13 +0000 (+0100) Subject: Ues json file names as expected by o-ran-sc-topology service X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=87f3a0d5c45f1fb8692e189070d1e1ebea8d6f43;p=oam.git Ues json file names as expected by o-ran-sc-topology service - generate different output for "running" datastore Issue-Id: OAM-258 Change-Id: Iae386d154b859a1b498485e8f63283b87103cb40 Signed-off-by: demx8as6 --- diff --git a/code/network-topology-instance-generator/view/network_viewer.py b/code/network-topology-instance-generator/view/network_viewer.py index f68ee48..957f8ec 100644 --- a/code/network-topology-instance-generator/view/network_viewer.py +++ b/code/network-topology-instance-generator/view/network_viewer.py @@ -53,22 +53,23 @@ class NetworkViewer: """ print(self.__network) - def save(self, filename: str): + def save(self, filename: str, running: bool): """ Method saving the class content to a file in json format. :param filename: A valid path to a file on the system. :type filename: string """ with open(filename, "w", encoding='utf-8') as json_file: - output = self.__network.json() + output = self.__network.json(running) json.dump(output, json_file, ensure_ascii=False, indent=2) - for key in ["Node", "Link"]: - print(key + "s:", len(output - ["tapi-common:context"] - ["tapi-topology:topology-context"] - ["topology"][0][key.lower()]) - ) + if running is False: + for key in ["Node", "Link"]: + print(key + "s:", len(output + ["tapi-common:context"] + ["tapi-topology:topology-context"] + ["topology"][0][key.lower()]) + ) print("File '" + filename + "' saved!") def readStylesFromFile(self) -> str: