mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-01 11:18:03 +00:00
create_wanlink.py: remove stopping wanlink
This commit is contained in:
@@ -197,36 +197,36 @@ def main(args={}):
|
||||
|
||||
print("Wanlink is running")
|
||||
|
||||
# stop wanlink
|
||||
lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_cx_state")
|
||||
lf_r.addPostData({
|
||||
'test_mgr': 'all',
|
||||
'cx_name': args['name'],
|
||||
'cx_state': 'STOPPED'
|
||||
})
|
||||
lf_r.jsonPost()
|
||||
running = 1
|
||||
while (running > 0):
|
||||
sleep(1)
|
||||
lf_r = LFRequest.LFRequest(base_url+"/wl/"+args['name']+"?fields=name,eid,state,_links")
|
||||
LFUtils.debug_printer.pprint(json_response)
|
||||
try:
|
||||
json_response = lf_r.getAsJson()
|
||||
if (json_response is None):
|
||||
continue
|
||||
for key, value in json_response.items():
|
||||
if (isinstance(value, dict)):
|
||||
if ("_links" in value):
|
||||
if (value["name"] == args['name']):
|
||||
if (value["state"].startswith("Stop")):
|
||||
LFUtils.debug_printer.pprint(json_response)
|
||||
running = 0
|
||||
# # stop wanlink
|
||||
# lf_r = LFRequest.LFRequest(base_url+"/cli-json/set_cx_state")
|
||||
# lf_r.addPostData({
|
||||
# 'test_mgr': 'all',
|
||||
# 'cx_name': args['name'],
|
||||
# 'cx_state': 'STOPPED'
|
||||
# })
|
||||
# lf_r.jsonPost()
|
||||
# running = 1
|
||||
# while (running > 0):
|
||||
# sleep(1)
|
||||
# lf_r = LFRequest.LFRequest(base_url+"/wl/"+args['name']+"?fields=name,eid,state,_links")
|
||||
# LFUtils.debug_printer.pprint(json_response)
|
||||
# try:
|
||||
# json_response = lf_r.getAsJson()
|
||||
# if (json_response is None):
|
||||
# continue
|
||||
# for key, value in json_response.items():
|
||||
# if (isinstance(value, dict)):
|
||||
# if ("_links" in value):
|
||||
# if (value["name"] == args['name']):
|
||||
# if (value["state"].startswith("Stop")):
|
||||
# LFUtils.debug_printer.pprint(json_response)
|
||||
# running = 0
|
||||
|
||||
except urllib.error.HTTPError as error:
|
||||
print("Error code "+error.code)
|
||||
continue
|
||||
# except urllib.error.HTTPError as error:
|
||||
# print("Error code "+error.code)
|
||||
# continue
|
||||
|
||||
print("Wanlink is stopped.")
|
||||
# print("Wanlink is stopped.")
|
||||
|
||||
# print("Wanlink info:")
|
||||
# lf_r = LFRequest.LFRequest(base_url+"/wl/wl_eg1")
|
||||
|
||||
Reference in New Issue
Block a user