mise a jour
This commit is contained in:
parent
36f98e2831
commit
45612c1d88
5 changed files with 136 additions and 93 deletions
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
||||||
|
@ -28,6 +29,7 @@ def retrieve_config():
|
||||||
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
||||||
else:
|
else:
|
||||||
my_json_config = {"verdict":"oops"}
|
my_json_config = {"verdict":"oops"}
|
||||||
|
sleep(3)
|
||||||
|
|
||||||
def config_json_to_string(json_config):
|
def config_json_to_string(json_config):
|
||||||
config = ""
|
config = ""
|
||||||
|
|
|
@ -35,123 +35,158 @@ GATEWAY_F = "--local_ip 127.0.0.1 --local_port 8282 --local_name %s --remote_
|
||||||
DEV = "--local_ip 127.0.0.1 --local_port 9001 --local_name %s --remote_ip %s --remote_port 8282 --remote_name %s --send_period 3000"
|
DEV = "--local_ip 127.0.0.1 --local_port 9001 --local_name %s --remote_ip %s --remote_port 8282 --remote_name %s --send_period 3000"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
SVR_READY = False
|
||||||
|
GWI1_READY = False
|
||||||
|
GWI2_READY = False
|
||||||
|
GWF1_READY = False
|
||||||
|
GWF2_READY = False
|
||||||
|
GWF3_READY = False
|
||||||
|
|
||||||
@app.route("/getmyconfig/<string:my_ip>")
|
@app.route("/getmyconfig/<string:my_ip>")
|
||||||
def configurations_giver(my_ip="127.0.0.1"):
|
def configurations_giver(my_ip="127.0.0.1"):
|
||||||
|
global SVR_READY
|
||||||
|
global GWI1_READY
|
||||||
|
global GWI2_READY
|
||||||
|
global GWF1_READY
|
||||||
|
global GWF2_READY
|
||||||
|
global GWF3_READY
|
||||||
configs = {"local_ip":my_ip, "verdict":"oops"}
|
configs = {"local_ip":my_ip, "verdict":"oops"}
|
||||||
if my_ip==SVR_IP:
|
if my_ip==SVR_IP:
|
||||||
configs["local_port"] = 8080
|
configs["local_port"] = 8080
|
||||||
configs["local_name"] = "srv"
|
configs["local_name"] = "srv"
|
||||||
configs["verdict"] = "yes"
|
configs["verdict"] = "yes"
|
||||||
|
SVR_READY = True
|
||||||
elif my_ip==GWI1_IP:
|
elif my_ip==GWI1_IP:
|
||||||
configs["local_port"] = 8181
|
if SVR_READY:
|
||||||
configs["local_name"] = "gwi1"
|
configs["local_port"] = 8181
|
||||||
configs["remote_ip"] = SVR_IP
|
configs["local_name"] = "gwi1"
|
||||||
configs["remote_port"] = 8080
|
configs["remote_ip"] = SVR_IP
|
||||||
configs["remote_name"] = "srv"
|
configs["remote_port"] = 8080
|
||||||
configs["verdict"] = "yes"
|
configs["remote_name"] = "srv"
|
||||||
|
configs["verdict"] = "yes"
|
||||||
|
GWI1_READY = True
|
||||||
elif my_ip==GWF1_IP:
|
elif my_ip==GWF1_IP:
|
||||||
configs["local_port"] = 8282
|
if GWI1_READY:
|
||||||
configs["local_name"] = "gwf1"
|
configs["local_port"] = 8282
|
||||||
configs["remote_ip"] = GWI1_IP
|
configs["local_name"] = "gwf1"
|
||||||
configs["remote_port"] = 8181
|
configs["remote_ip"] = GWI1_IP
|
||||||
configs["remote_name"] = "gwi1"
|
configs["remote_port"] = 8181
|
||||||
configs["verdict"] = "yes"
|
configs["remote_name"] = "gwi1"
|
||||||
|
configs["verdict"] = "yes"
|
||||||
|
GWF1_READY = True
|
||||||
elif my_ip==GWF2_IP:
|
elif my_ip==GWF2_IP:
|
||||||
configs["local_port"] = 8282
|
if GWI1_READY:
|
||||||
configs["local_name"] = "gwf2"
|
configs["local_port"] = 8282
|
||||||
configs["remote_ip"] = GWI1_IP
|
configs["local_name"] = "gwf2"
|
||||||
configs["remote_port"] = 8181
|
configs["remote_ip"] = GWI1_IP
|
||||||
configs["remote_name"] = "gwi1"
|
configs["remote_port"] = 8181
|
||||||
configs["verdict"] = "yes"
|
configs["remote_name"] = "gwi1"
|
||||||
|
configs["verdict"] = "yes"
|
||||||
|
GWF2_READY = True
|
||||||
elif my_ip==GWF3_IP:
|
elif my_ip==GWF3_IP:
|
||||||
configs["local_port"] = 8282
|
if GWI1_READY:
|
||||||
configs["local_name"] = "gwf3"
|
configs["local_port"] = 8282
|
||||||
configs["remote_ip"] = GWI1_IP
|
configs["local_name"] = "gwf3"
|
||||||
configs["remote_port"] = 8181
|
configs["remote_ip"] = GWI1_IP
|
||||||
configs["remote_name"] = "gwi1"
|
configs["remote_port"] = 8181
|
||||||
configs["verdict"] = "yes"
|
configs["remote_name"] = "gwi1"
|
||||||
|
configs["verdict"] = "yes"
|
||||||
|
GWF3_READY = True
|
||||||
elif my_ip==DEV1_GWF1_IP:
|
elif my_ip==DEV1_GWF1_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF1_READY:
|
||||||
configs["local_name"] = "dev1gwf1"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF1_IP
|
configs["local_name"] = "dev1gwf1"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF1_IP
|
||||||
configs["remote_name"] = "gwf1"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf1"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV2_GWF1_IP:
|
elif my_ip==DEV2_GWF1_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF1_READY:
|
||||||
configs["local_name"] = "dev2gwf1"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF1_IP
|
configs["local_name"] = "dev2gwf1"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF1_IP
|
||||||
configs["remote_name"] = "gwf1"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf1"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV3_GWF1_IP:
|
elif my_ip==DEV3_GWF1_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF1_READY:
|
||||||
configs["local_name"] = "dev3gwf1"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF1_IP
|
configs["local_name"] = "dev3gwf1"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF1_IP
|
||||||
configs["remote_name"] = "gwf1"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf1"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV1_GWF2_IP:
|
elif my_ip==DEV1_GWF2_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF2_READY:
|
||||||
configs["local_name"] = "dev1gwf2"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF2_IP
|
configs["local_name"] = "dev1gwf2"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF2_IP
|
||||||
configs["remote_name"] = "gwf2"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf2"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV2_GWF2_IP:
|
elif my_ip==DEV2_GWF2_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF2_READY:
|
||||||
configs["local_name"] = "dev2gwf2"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF2_IP
|
configs["local_name"] = "dev2gwf2"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF2_IP
|
||||||
configs["remote_name"] = "gwf2"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf2"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV3_GWF2_IP:
|
elif my_ip==DEV3_GWF2_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF2_READY:
|
||||||
configs["local_name"] = "dev3gwf2"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF2_IP
|
configs["local_name"] = "dev3gwf2"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF2_IP
|
||||||
configs["remote_name"] = "gwf2"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf2"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV1_GWF3_IP:
|
elif my_ip==DEV1_GWF3_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF3_READY:
|
||||||
configs["local_name"] = "dev1gwf3"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF3_IP
|
configs["local_name"] = "dev1gwf3"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF3_IP
|
||||||
configs["remote_name"] = "gwf3"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf3"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV2_GWF3_IP:
|
elif my_ip==DEV2_GWF3_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF3_READY:
|
||||||
configs["local_name"] = "dev2gwf3"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF3_IP
|
configs["local_name"] = "dev2gwf3"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF3_IP
|
||||||
configs["remote_name"] = "gwf3"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf3"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
elif my_ip==DEV3_GWF3_IP:
|
elif my_ip==DEV3_GWF3_IP:
|
||||||
configs["local_port"] = 9001
|
if GWF3_READY:
|
||||||
configs["local_name"] = "dev3gwf3"
|
configs["local_port"] = 9001
|
||||||
configs["remote_ip"] = GWF3_IP
|
configs["local_name"] = "dev3gwf3"
|
||||||
configs["remote_port"] = 8282
|
configs["remote_ip"] = GWF3_IP
|
||||||
configs["remote_name"] = "gwf3"
|
configs["remote_port"] = 8282
|
||||||
configs["send_period"] = 3000
|
configs["remote_name"] = "gwf3"
|
||||||
configs["verdict"] = "yes"
|
configs["send_period"] = 3000
|
||||||
|
configs["verdict"] = "yes"
|
||||||
return jsonify(configs)
|
return jsonify(configs)
|
||||||
|
|
||||||
@app.route("/getmyconfig/")
|
@app.route("/getmyconfig/")
|
||||||
def configurations_giver_to_dc():
|
def configurations_giver_to_dc():
|
||||||
configs = {"local_ip":GWI2_IP, "verdict":"yes"}
|
global GWI2_READY
|
||||||
configs["local_port"] = 8181
|
configs = {"local_ip":GWI2_IP, "verdict":"oops"}
|
||||||
configs["local_name"] = "gwi2"
|
if SVR_READY:
|
||||||
configs["remote_ip"] = SVR_IP
|
configs["local_port"] = 8181
|
||||||
configs["remote_port"] = 8080
|
configs["local_name"] = "gwi2"
|
||||||
configs["remote_name"] = "srv"
|
configs["remote_ip"] = SVR_IP
|
||||||
|
configs["remote_port"] = 8080
|
||||||
|
configs["remote_name"] = "srv"
|
||||||
|
configs["verdict"] = "yes"
|
||||||
|
GWI2_READY = True
|
||||||
return jsonify(configs)
|
return jsonify(configs)
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
||||||
|
@ -28,6 +29,7 @@ def retrieve_config():
|
||||||
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
||||||
else:
|
else:
|
||||||
my_json_config = {"verdict":"oops"}
|
my_json_config = {"verdict":"oops"}
|
||||||
|
sleep(3)
|
||||||
|
|
||||||
def config_json_to_string(json_config):
|
def config_json_to_string(json_config):
|
||||||
config = ""
|
config = ""
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
||||||
|
@ -28,6 +29,7 @@ def retrieve_config():
|
||||||
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
||||||
else:
|
else:
|
||||||
my_json_config = {"verdict":"oops"}
|
my_json_config = {"verdict":"oops"}
|
||||||
|
sleep(3)
|
||||||
|
|
||||||
def config_json_to_string(json_config):
|
def config_json_to_string(json_config):
|
||||||
config = ""
|
config = ""
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
|
||||||
|
@ -28,6 +29,7 @@ def retrieve_config():
|
||||||
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
|
||||||
else:
|
else:
|
||||||
my_json_config = {"verdict":"oops"}
|
my_json_config = {"verdict":"oops"}
|
||||||
|
sleep(3)
|
||||||
|
|
||||||
def config_json_to_string(json_config):
|
def config_json_to_string(json_config):
|
||||||
config = ""
|
config = ""
|
||||||
|
|
Loading…
Reference in a new issue