1e4041697b2d67d37e44a22cea2a7a5586fe4b6a
[nonrtric.git] / near-rt-ric-simulator / simulator-group / ric / cleanConsul.py
1 import json
2 import subprocess
3 import os
4
5 print("Clean old ric configurations in Consul config file")
6
7 p = os.path.abspath('..')
8 consul_config = p + '/consul_cbs' + '/config.json'
9
10
11 def write_json(data, filename=consul_config):
12     with open(filename, 'w') as f:
13         json.dump(data, f, indent=4)
14
15
16 with open(consul_config) as json_file:
17     clean = json.load(json_file)
18     clean['ric'] = []
19
20
21 write_json(clean)
22 print("Clean old ric configurations from Consul config file, done")
23
24