mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 19:58:03 +00:00
- added check response
- added check for build - removed prints Signed-off-by: SushantBawiskar <sushant.bawiskar@candelatech.com>
This commit is contained in:
@@ -36,7 +36,6 @@ class chamberview(LFCliBase):
|
|||||||
text_blob = "profile_link" + " " + Resources + " " + Profile + " " + Amount + " " + "\'DUT:" + " " + DUT\
|
text_blob = "profile_link" + " " + Resources + " " + Profile + " " + Amount + " " + "\'DUT:" + " " + DUT\
|
||||||
+ " " + Dut_Radio + "\' " + Traffic + " " + Uses1 + ","+Uses2 + " " + Freq + " " + VLAN
|
+ " " + Dut_Radio + "\' " + Traffic + " " + Uses1 + ","+Uses2 + " " + Freq + " " + VLAN
|
||||||
|
|
||||||
print(text_blob)
|
|
||||||
data = {
|
data = {
|
||||||
"type": "Network-Connectivity",
|
"type": "Network-Connectivity",
|
||||||
"name": scenario_name,
|
"name": scenario_name,
|
||||||
@@ -56,7 +55,6 @@ class chamberview(LFCliBase):
|
|||||||
"name": scenario_name,
|
"name": scenario_name,
|
||||||
"text": Rawline
|
"text": Rawline
|
||||||
}
|
}
|
||||||
print("data: ",data)
|
|
||||||
rsp = self.json_post(req_url, data)
|
rsp = self.json_post(req_url, data)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
@@ -75,27 +73,32 @@ class chamberview(LFCliBase):
|
|||||||
def apply_cv_scenario(self, cv_scenario):
|
def apply_cv_scenario(self, cv_scenario):
|
||||||
cmd = "cv apply '%s'" % cv_scenario #To apply scenario
|
cmd = "cv apply '%s'" % cv_scenario #To apply scenario
|
||||||
self.run_cv_cmd(cmd)
|
self.run_cv_cmd(cmd)
|
||||||
print("Apply scenario")
|
print("Applying %s scenario" % cv_scenario)
|
||||||
|
|
||||||
def build_cv_scenario(self):#build chamber view scenario
|
def build_cv_scenario(self):#build chamber view scenario
|
||||||
cmd = "cv build"
|
cmd = "cv build"
|
||||||
self.run_cv_cmd(cmd)
|
self.run_cv_cmd(cmd)
|
||||||
print("Build scenario")
|
print("Building scenario")
|
||||||
|
|
||||||
def is_cv_build(self):#check if scenario is build
|
def is_cv_build(self):#check if scenario is build
|
||||||
cmd = "cv is_build"
|
cmd = "cv is_built"
|
||||||
self.run_cv_cmd(cmd)
|
response = self.run_cv_cmd(cmd)
|
||||||
|
return self.check_reponse(response)
|
||||||
|
|
||||||
def sync_cv(self):#sync
|
def sync_cv(self):#sync
|
||||||
cmd = "cv sync"
|
cmd = "cv sync"
|
||||||
self.run_cv_cmd(cmd)
|
self.run_cv_cmd(cmd)
|
||||||
|
|
||||||
def run_cv_cmd(self, command):#Send chamber view commands
|
def run_cv_cmd(self, command):#Send chamber view commands
|
||||||
|
response_json = []
|
||||||
req_url = "/gui-json/cmd"
|
req_url = "/gui-json/cmd"
|
||||||
data = {
|
data = {
|
||||||
"cmd": command
|
"cmd": command
|
||||||
}
|
}
|
||||||
rsp = self.json_post(req_url, data)
|
rsp = self.json_post(req_url, data, debug_=False, response_json_list_=response_json)
|
||||||
print(rsp)
|
return response_json
|
||||||
|
|
||||||
|
def check_reponse(self, response):
|
||||||
|
d1 = {k: v for e in response for (k, v) in e.items()}
|
||||||
|
return d1["LAST"]["response"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user