Clean-up existing docker-compose solutions
[oam.git] / solution / network / config.py
similarity index 83%
rename from solution/integration/network/config.py
rename to solution/network/config.py
index 30c4a39..57aab93 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 ################################################################################
-# Copyright 2021 highstreet technologies GmbH
+# Copyright 2023 highstreet technologies GmbH
 #
 # Licensed under the Apache License, Version 2.0 (the 'License');
 # you may not use this file except in compliance with the License.
@@ -21,13 +21,23 @@ import sys
 import json
 import requests
 import subprocess
+import pathlib
+from jproperties import Properties
+
+def get_environment_variable(name):
+    configs = Properties()
+    path = pathlib.Path( os.path.dirname(os.path.abspath(__file__)) )
+    env_file = str(path.absolute()) + '/.env'
+    with open(env_file, "rb") as read_prop:
+        configs.load(read_prop)
+    return configs.get(name).data
 
 dockerFilter = subprocess.check_output("docker ps --format '{{.Names}}'", shell=True)
 containers = dockerFilter.splitlines()
 
 mapping = dict({"ntsim-ng-o-ru": "O-RU", "ntsim-ng-o-du": "O-DU"})
 # base = 'https://sdnc-web:8453'
-base = 'https://localhost:8453'
+base = get_environment_variable('SDN_CONTROLLER_PROTOCOL') + '://' + get_environment_variable('SDNC_OAM_HOST')
 username = 'admin'
 password = 'Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U'