mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	cv_test_manager: Clean up warnings
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
		@@ -9,13 +9,11 @@ import importlib
 | 
			
		||||
import time
 | 
			
		||||
import json
 | 
			
		||||
from pprint import pprint
 | 
			
		||||
import argparse
 | 
			
		||||
 | 
			
		||||
if sys.version_info[0] != 3:
 | 
			
		||||
    print("This script requires Python 3")
 | 
			
		||||
    exit()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
 | 
			
		||||
 | 
			
		||||
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
 | 
			
		||||
@@ -106,7 +104,7 @@ class cv_test(Realm):
 | 
			
		||||
 | 
			
		||||
        print("adding- " + text + " " + "to test config")
 | 
			
		||||
 | 
			
		||||
        rsp = self.json_post(req_url, data)
 | 
			
		||||
        self.json_post(req_url, data)
 | 
			
		||||
        # time.sleep(1)
 | 
			
		||||
 | 
			
		||||
    # Tell LANforge GUI Chamber View to launch a test
 | 
			
		||||
@@ -142,18 +140,18 @@ class cv_test(Realm):
 | 
			
		||||
    # Send chamber view commands to the LANforge GUI
 | 
			
		||||
    def run_cv_cmd(self, command):
 | 
			
		||||
        response_json = []
 | 
			
		||||
        req_url = "/gui-json/cmd"
 | 
			
		||||
        data = {
 | 
			
		||||
            "cmd": command
 | 
			
		||||
        }
 | 
			
		||||
        debug_par = ""
 | 
			
		||||
        rsp = self.json_post("/gui-json/cmd%s" % debug_par, data, debug_=False, response_json_list_=response_json)
 | 
			
		||||
        self.json_post("/gui-json/cmd%s" % debug_par, data, debug_=False, response_json_list_=response_json)
 | 
			
		||||
        try:
 | 
			
		||||
            if response_json[0]["LAST"]["warnings"].startswith("Unknown"):
 | 
			
		||||
                print("Unknown command?\n")
 | 
			
		||||
                pprint(response_json)
 | 
			
		||||
        except:
 | 
			
		||||
            # Ignore un-handled structs at this point, let calling code deal with it.
 | 
			
		||||
            else:
 | 
			
		||||
                pass
 | 
			
		||||
        finally:
 | 
			
		||||
            pass
 | 
			
		||||
        return response_json
 | 
			
		||||
 | 
			
		||||
@@ -207,7 +205,7 @@ class cv_test(Realm):
 | 
			
		||||
            if self.get_exists(instance):
 | 
			
		||||
                print("Waiting %i/60 for test instance: %s to be deleted." % (tries, instance))
 | 
			
		||||
                tries += 1
 | 
			
		||||
                if (tries > 60):
 | 
			
		||||
                if tries > 60:
 | 
			
		||||
                    break
 | 
			
		||||
                time.sleep(1)
 | 
			
		||||
            else:
 | 
			
		||||
@@ -217,9 +215,9 @@ class cv_test(Realm):
 | 
			
		||||
        tries = 0
 | 
			
		||||
        while True:
 | 
			
		||||
            if not self.get_cv_is_built():
 | 
			
		||||
                print("Waiting %i/60 for Chamber-View to be built."%(tries))
 | 
			
		||||
                print("Waiting %i/60 for Chamber-View to be built." % tries)
 | 
			
		||||
                tries += 1
 | 
			
		||||
                if (tries > 60):
 | 
			
		||||
                if tries > 60:
 | 
			
		||||
                    break
 | 
			
		||||
                time.sleep(1)
 | 
			
		||||
            else:
 | 
			
		||||
@@ -249,17 +247,18 @@ class cv_test(Realm):
 | 
			
		||||
            "type": "Plugin-Settings",
 | 
			
		||||
            "name": str(blob_test_name + config_name),  # config name
 | 
			
		||||
        }
 | 
			
		||||
        rsp = self.json_post(req_url, data)
 | 
			
		||||
        self.json_post(req_url, data)
 | 
			
		||||
 | 
			
		||||
    def rm_cv_text_blob(self, type="Network-Connectivity", name=None):
 | 
			
		||||
    def rm_cv_text_blob(self, cv_type="Network-Connectivity", name=None):
 | 
			
		||||
        req_url = "/cli-json/rm_text_blob"
 | 
			
		||||
        data = {
 | 
			
		||||
            "type": type,
 | 
			
		||||
            "type": cv_type,
 | 
			
		||||
            "name": name,  # config name
 | 
			
		||||
        }
 | 
			
		||||
        rsp = self.json_post(req_url, data)
 | 
			
		||||
        self.json_post(req_url, data)
 | 
			
		||||
 | 
			
		||||
    def apply_cfg_options(self, cfg_options, enables, disables, raw_lines, raw_lines_file):
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def apply_cfg_options(cfg_options, enables, disables, raw_lines, raw_lines_file):
 | 
			
		||||
 | 
			
		||||
        # Read in calibration data and whatever else.
 | 
			
		||||
        if raw_lines_file != "":
 | 
			
		||||
@@ -318,7 +317,7 @@ class cv_test(Realm):
 | 
			
		||||
            if response[0]["LAST"]["response"] == "OK":
 | 
			
		||||
                break
 | 
			
		||||
            else:
 | 
			
		||||
                print("Could not create test, try: %i/60:\n"%(start_try))
 | 
			
		||||
                print("Could not create test, try: %i/60:\n" % start_try)
 | 
			
		||||
                pprint(response)
 | 
			
		||||
                start_try += 1
 | 
			
		||||
                if start_try > 60:
 | 
			
		||||
@@ -381,6 +380,8 @@ class cv_test(Realm):
 | 
			
		||||
                        print("SCP failed, user %s, password %s, dest %s" % (lf_user, lf_password, lf_host))
 | 
			
		||||
                        raise e  # Exception("Could not find Reports")
 | 
			
		||||
                    break
 | 
			
		||||
            else:
 | 
			
		||||
                print('Not reporting to kpi file')
 | 
			
		||||
 | 
			
		||||
            # Of if test stopped for some reason and could not generate report.
 | 
			
		||||
            if not self.get_is_running(instance_name):
 | 
			
		||||
@@ -465,7 +466,7 @@ class cv_test(Realm):
 | 
			
		||||
            "text": text_blob
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        rsp = self.json_post(req_url, data)
 | 
			
		||||
        self.json_post(req_url, data)
 | 
			
		||||
 | 
			
		||||
    def pass_raw_lines_to_cv(self,
 | 
			
		||||
                             scenario_name="Automation",
 | 
			
		||||
@@ -476,7 +477,7 @@ class cv_test(Realm):
 | 
			
		||||
            "name": scenario_name,
 | 
			
		||||
            "text": Rawline
 | 
			
		||||
        }
 | 
			
		||||
        rsp = self.json_post(req_url, data)
 | 
			
		||||
        self.json_post(req_url, data)
 | 
			
		||||
 | 
			
		||||
        # This is for chamber view buttons
 | 
			
		||||
 | 
			
		||||
@@ -502,13 +503,12 @@ class cv_test(Realm):
 | 
			
		||||
    def run_cv_cmd(self, command):  # Send chamber view commands
 | 
			
		||||
        response_json = []
 | 
			
		||||
        req_url = "/gui-json/cmd"
 | 
			
		||||
        data = {
 | 
			
		||||
            "cmd": command
 | 
			
		||||
        }
 | 
			
		||||
        rsp = self.json_post(req_url, data, debug_=False, response_json_list_=response_json)
 | 
			
		||||
        data = {"cmd": command}
 | 
			
		||||
        self.json_post(req_url, data, debug_=False, response_json_list_=response_json)
 | 
			
		||||
        return response_json
 | 
			
		||||
 | 
			
		||||
    def get_response_string(self, response):
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def get_response_string(response):
 | 
			
		||||
        return response[0]["LAST"]["response"]
 | 
			
		||||
 | 
			
		||||
    def get_popup_info_and_close(self):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user