X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-topology-instance-generator%2Fview%2Fnetwork_viewer.py;h=957f8eca65cf31855c6e4c861ec30263d9ef73a3;hb=9a0d7d6f6b9bb268514d0c0e75c071fd297a425a;hp=f68ee485fcdd95b1a199c873772a77c4170300c0;hpb=16945b9b123d4cb4b0e78b193aa97cae85beec7d;p=oam.git 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: