Improve the dockerized auto test
The auto test can bring up any number of near rt ric simulators
as requied.
Issue-ID: NONRTRIC-115
Signed-off-by: YongchaoWu <yongchao.wu@est.tech>
Change-Id: I88461b6b5d3fa33a9fccd7cedf15535e06143bb6
diff --git a/near-rt-ric-simulator/simulator-group/ric/cleanConsul.py b/near-rt-ric-simulator/simulator-group/ric/cleanConsul.py
new file mode 100644
index 0000000..1e40416
--- /dev/null
+++ b/near-rt-ric-simulator/simulator-group/ric/cleanConsul.py
@@ -0,0 +1,24 @@
+import json
+import subprocess
+import os
+
+print("Clean old ric configurations in Consul config file")
+
+p = os.path.abspath('..')
+consul_config = p + '/consul_cbs' + '/config.json'
+
+
+def write_json(data, filename=consul_config):
+ with open(filename, 'w') as f:
+ json.dump(data, f, indent=4)
+
+
+with open(consul_config) as json_file:
+ clean = json.load(json_file)
+ clean['ric'] = []
+
+
+write_json(clean)
+print("Clean old ric configurations from Consul config file, done")
+
+