gctrl update

This commit is contained in:
Abdel Kader Chabi Sika Boni 2021-01-20 01:08:07 +01:00
parent ee89012a93
commit fd3fe273f4

View file

@ -3,7 +3,10 @@
'''In our topology, we assume the container running this script has ip address 10.10.10.10 '''In our topology, we assume the container running this script has ip address 10.10.10.10
(useful information according to our topology: useless otherwise) (useful information according to our topology: useless otherwise)
''' '''
from time import sleep
from flask import Flask, jsonify from flask import Flask, jsonify
import requests
from threading import Thread
app = Flask(__name__) app = Flask(__name__)
@ -189,6 +192,15 @@ def configurations_giver_to_dc():
GWI2_READY = True GWI2_READY = True
return jsonify(configs) return jsonify(configs)
def registergwfs():
while not GWI2_READY:
sleep(3)
#sleep(5)
requests.post('http://172.17.0.17:8181/gateways/register', json={"Name": "gwf2", "PoC":"http://10.0.2.100"})
requests.post('http://172.17.0.17:8181/gateways/register', json={"Name": "gwf3", "PoC":"http://10.0.3.100"})
if __name__=='__main__': if __name__=='__main__':
registrar = Thread(target=registergwfs)
registrar.start()
app.run(debug=False, host='0.0.0.0', port=5555) app.run(debug=False, host='0.0.0.0', port=5555)