5 print("Update fresh ric configuration in Consul configuration file")
7 p = os.path.abspath('..')
8 consul_config = p + '/consul_cbs' + '/config.json'
11 def write_json(data, filename=consul_config):
12 with open(filename, 'w') as f:
13 json.dump(data, f, indent=4)
16 def bash_command(cmd):
18 sp = subprocess.Popen(['/bin/bash', '-c', cmd], stdout=subprocess.PIPE)
19 for line in sp.stdout.readlines():
20 result.append(line.decode().strip())
24 command = "docker ps | grep simulator | awk '{print $NF}'"
26 ric_list = bash_command(command)
28 with open(consul_config) as json_file:
29 data = json.load(json_file)
33 "baseUrl": "http://" + ric + ":8085/",
34 "managedElementIds": [
43 print("Update Consul config file with fresh ric configuration, done")