diff --git a/cfm b/cfm deleted file mode 100644 index e69de29..0000000 diff --git a/setup_phyiscal_node.py b/setup_phyiscal_node.py new file mode 100644 index 0000000..cfd443f --- /dev/null +++ b/setup_phyiscal_node.py @@ -0,0 +1,30 @@ +import json +import os +import requests + +def read_json_file(file_path): + try: + with open(file_path, 'r', encoding='utf-8') as file: + data = json.load(file) + + if isinstance(data, list): + cnt = 0 + for index, item in enumerate(data, start=1): + url = "http://127.0.0.1:8443/api/v1/nodes-config" + response = requests.post(url, data=json.dumps(item, ensure_ascii=False, indent=4), verify=False) + print(f"{index} - response: {response.text}") + cnt += 1 + if cnt >= 18: + break + + else: + print("no array") + + except FileNotFoundError: + print(f"no file") + except json.JSONDecodeError: + print("not json") + except Exception as e: + print(f"error: {e}") + +read_json_file('mock_topo_config.json') \ No newline at end of file