JSON: wip: run cv scenario

This commit is contained in:
Jed Reynolds
2020-06-29 23:18:50 -07:00
parent b851933f98
commit fa391f601d

View File

@@ -82,7 +82,7 @@ class RunCvScenario(LFCliBase):
self._pass("Loaded scenario %s" % self.lanforge_db, True) self._pass("Loaded scenario %s" % self.lanforge_db, True)
return True return True
def start(self): def start(self, debug_=False):
# /gui_cli takes commands keyed on 'cmd', so we create an array of commands # /gui_cli takes commands keyed on 'cmd', so we create an array of commands
commands = [ commands = [
"cv apply '%s'" % self.cv_scenario, "cv apply '%s'" % self.cv_scenario,
@@ -94,24 +94,25 @@ class RunCvScenario(LFCliBase):
# "cv click test_ref Start" # "cv click test_ref Start"
# "cv get rvr_instance 'Report Location:'" # "cv get rvr_instance 'Report Location:'"
] ]
self.use_preexec = False response_json = []
response_json = ["nothing"]
for command in commands: for command in commands:
data = { data = {
"cmd": command "cmd": command
} }
try: try:
debug_par = ""
if debug_:
debug_par="?_debug=1"
print("List: ", type(response_json)) print("List: ", type(response_json))
response = self.json_post("/gui-json/cmd?__debug=1", data, debug_=True, response_json_list_=response_json) if command.endswith("is_built"):
if command == "cv is_built": print("xxxxxxxxxx command %s xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" % command)
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") self.localrealm.wait_while_building(debug_=debug_)
LFUtils.debug_printer.pprint(response_json) print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
last_response = response_json["LAST"]["response"];
if (last_response != "OK"):
print("keep waiting")
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
exit(1) exit(1)
else:
print("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy")
response = self.json_post("/gui-json/cmd%s" % debug_par, data, debug_=True, response_json_list_=response_json)
print("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy")
sleep(1) sleep(1)
except Exception as x: except Exception as x: