mise a jour

This commit is contained in:
Abdel-Kader Chabi-Sika-Boni 2021-01-01 16:30:31 +01:00
parent 47e1c04cd8
commit d95742b4c7

View file

@ -36,40 +36,119 @@ DEV = "--local_ip 127.0.0.1 --local_port 9001 --local_name
@app.route("/getmyconfig/<string:my_ip>") @app.route("/getmyconfig/<string:my_ip>")
def configurations_giver(my_ip): def configurations_giver(my_ip):
configs = {"verdict":"oops"} configs = {"local_ip":"127.0.0.1", "verdict":"oops"}
if my_ip==SVR_IP: if my_ip==SVR_IP:
configs["local_ip"] = "127.0.0.1" configs["local_port"] = 8080
configs["local_name"] = "srv"
configs["verdict"] = "yes"
elif my_ip==GWI1_IP: elif my_ip==GWI1_IP:
configs = GATEWAY_I%('gwi1',SVR_IP,'srv') configs["local_port"] = 8181
configs["local_name"] = "gwi1"
configs["remote_ip"] = SVR_IP
configs["remote_port"] = 8080
configs["remote_name"] = "srv"
configs["verdict"] = "yes"
elif my_ip==GWI2_IP: elif my_ip==GWI2_IP:
configs = GATEWAY_I%('gwi2',SVR_IP,'srv') configs["local_port"] = 8181
configs["local_name"] = "gwi2"
configs["remote_ip"] = SVR_IP
configs["remote_port"] = 8080
configs["remote_name"] = "srv"
configs["verdict"] = "yes"
elif my_ip==GWF1_IP: elif my_ip==GWF1_IP:
configs = GATEWAY_F%('gwf1',GWI1_IP,'gwi1') configs["local_port"] = 8282
configs["local_name"] = "gwf1"
configs["remote_ip"] = GWI1_IP
configs["remote_port"] = 8181
configs["remote_name"] = "gwi1"
configs["verdict"] = "yes"
elif my_ip==GWF2_IP: elif my_ip==GWF2_IP:
configs = GATEWAY_F%('gwf2',GWI1_IP,'gwi1') configs["local_port"] = 8282
configs["local_name"] = "gwf2"
configs["remote_ip"] = GWI1_IP
configs["remote_port"] = 8181
configs["remote_name"] = "gwi1"
configs["verdict"] = "yes"
elif my_ip==GWF3_IP: elif my_ip==GWF3_IP:
configs = GATEWAY_F%('gwf3',GWI1_IP,'gwi1') configs["local_port"] = 8282
configs["local_name"] = "gwf3"
configs["remote_ip"] = GWI1_IP
configs["remote_port"] = 8181
configs["remote_name"] = "gwi1"
configs["verdict"] = "yes"
elif my_ip==DEV1_GWF1_IP: elif my_ip==DEV1_GWF1_IP:
configs = DEV%('dev1gwf1',GWF1_IP,'gwf1') configs["local_port"] = 9001
configs["local_name"] = "dev1gwf1"
configs["remote_ip"] = GWF1_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf1"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV2_GWF1_IP: elif my_ip==DEV2_GWF1_IP:
configs = DEV%('dev2gwf1',GWF1_IP,'gwf1') configs["local_port"] = 9001
configs["local_name"] = "dev2gwf1"
configs["remote_ip"] = GWF1_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf1"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV3_GWF1_IP: elif my_ip==DEV3_GWF1_IP:
configs = DEV%('dev3gwf1',GWF1_IP,'gwf1') configs["local_port"] = 9001
configs["local_name"] = "dev3gwf1"
configs["remote_ip"] = GWF1_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf1"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV1_GWF2_IP: elif my_ip==DEV1_GWF2_IP:
configs = DEV%('dev1gwf2',GWF2_IP,'gwf2') configs["local_port"] = 9001
configs["local_name"] = "dev1gwf2"
configs["remote_ip"] = GWF2_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf2"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV2_GWF2_IP: elif my_ip==DEV2_GWF2_IP:
configs = DEV%('dev2gwf2',GWF2_IP,'gwf2') configs["local_port"] = 9001
configs["local_name"] = "dev2gwf2"
configs["remote_ip"] = GWF2_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf2"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV3_GWF2_IP: elif my_ip==DEV3_GWF2_IP:
configs = DEV%('dev3gwf2',GWF2_IP,'gwf2') configs["local_port"] = 9001
configs["local_name"] = "dev3gwf2"
configs["remote_ip"] = GWF2_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf2"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV1_GWF3_IP: elif my_ip==DEV1_GWF3_IP:
configs = DEV%('dev1gwf3',GWF3_IP,'gwf3') configs["local_port"] = 9001
configs["local_name"] = "dev1gwf3"
configs["remote_ip"] = GWF3_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf3"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV2_GWF3_IP: elif my_ip==DEV2_GWF3_IP:
configs = DEV%('dev2gwf3',GWF3_IP,'gwf3') configs["local_port"] = 9001
configs["local_name"] = "dev2gwf3"
configs["remote_ip"] = GWF3_IP
configs["remote_port"] = 8282
configs["remote_name"] = "gwf3"
configs["send_period"] = 3000
configs["verdict"] = "yes"
elif my_ip==DEV3_GWF3_IP: elif my_ip==DEV3_GWF3_IP:
configs = DEV%('dev3gwf3',GWF3_IP,'gwf3') configs["local_port"] = 9001
else: configs["local_name"] = "dev3gwf3"
configs = "oops" configs["remote_ip"] = GWF3_IP
return configs configs["remote_port"] = 8282
configs["remote_name"] = "gwf3"
configs["send_period"] = 3000
configs["verdict"] = "yes"
return jsonify(configs)
if __name__=='__main__': if __name__=='__main__':
app.run(debug=False, host='0.0.0.0', port=5555) app.run(debug=False, host='0.0.0.0', port=5555)