mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	Resolved merge conflicts
Signed-off-by: jitendracandela <jitendra.kushavah@candelatech.com>
This commit is contained in:
		@@ -154,6 +154,7 @@ class lf_libs:
 | 
			
		||||
        logging.basicConfig(format='%(asctime)s - %(message)s', level=log_level)
 | 
			
		||||
        lf_data = dict(lf_data)
 | 
			
		||||
        self.dut_data = dut_data
 | 
			
		||||
        self.dut_data = dut_data
 | 
			
		||||
        self.run_lf = run_lf
 | 
			
		||||
        self.dut_idx_mapping = {}
 | 
			
		||||
        # try:
 | 
			
		||||
@@ -162,7 +163,6 @@ class lf_libs:
 | 
			
		||||
        self.scenario = lf_data.get("scenario")
 | 
			
		||||
        self.setup_lf_data()
 | 
			
		||||
        self.setup_relevent_profiles()
 | 
			
		||||
        # self.load_scenario()
 | 
			
		||||
        self.setup_metadata()
 | 
			
		||||
        if self.scenario == "dhcp-bridge":
 | 
			
		||||
            logging.info("Scenario name: " + str(self.scenario))
 | 
			
		||||
@@ -174,9 +174,8 @@ class lf_libs:
 | 
			
		||||
        self.chamber_view(raw_lines="default")
 | 
			
		||||
        self.temp_raw_lines = self.default_scenario_raw_lines.copy()
 | 
			
		||||
        self.setup_dut()
 | 
			
		||||
 | 
			
		||||
        # except Exception as e:
 | 
			
		||||
        logging.error("lf_data has bad values: " + str(lf_data))
 | 
			
		||||
        # logging.error("lf_data has bad values: " + str(lf_data))
 | 
			
		||||
        # logging.error(e)
 | 
			
		||||
 | 
			
		||||
    """
 | 
			
		||||
@@ -1241,6 +1240,43 @@ class lf_libs:
 | 
			
		||||
            allure.attach.file(source=path,
 | 
			
		||||
                               name=file_name, attachment_type="CSV")
 | 
			
		||||
        return os.path.exists(path)
 | 
			
		||||
    def get_supplicant_logs(self, radio="1.1.wiphy0", attach_allure=True):
 | 
			
		||||
        try:
 | 
			
		||||
            resource = radio.split(".")[1]
 | 
			
		||||
            radio = radio.split(".")[2]
 | 
			
		||||
            ip = self.get_manager_from_resource(resource=int(resource))
 | 
			
		||||
            if ip is not None:
 | 
			
		||||
                supplicant = "/home/lanforge/wifi/wpa_supplicant_log_" + radio + ".txt"
 | 
			
		||||
                obj = SCP_File(ip=ip, port=22, username="root", password="lanforge",
 | 
			
		||||
                               remote_path=supplicant,
 | 
			
		||||
                               local_path=".")
 | 
			
		||||
                obj.pull_file()
 | 
			
		||||
                if attach_allure:
 | 
			
		||||
                    allure.attach.file(source="wpa_supplicant_log_" + radio + ".txt",
 | 
			
		||||
                                       name="wpa_supplicant_log - " + str(radio))
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            logging.error("get_supplicant_logs() - Error in getting supplicant Logs: " + str(e))
 | 
			
		||||
 | 
			
		||||
    def get_resources(self):
 | 
			
		||||
        try:
 | 
			
		||||
            d = self.json_get("/port/?fields=alias,ip")
 | 
			
		||||
            resource_data = dict()
 | 
			
		||||
            for i in d["interfaces"]:
 | 
			
		||||
                if str(list(dict(i).keys())[0]).__contains__("eth0"):
 | 
			
		||||
                    resource_data[str(list(dict(i).keys())[0]).split(".")[1]] = i[str(list(dict(i).keys())[0])]["ip"]
 | 
			
		||||
            logging.info("Resource ID and Management port Mapping: " + str(resource_data))
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            logging.error(str(e))
 | 
			
		||||
        return resource_data
 | 
			
		||||
 | 
			
		||||
    def get_manager_from_resource(self, resource=1):
 | 
			
		||||
        resource_data = self.get_resources()
 | 
			
		||||
        try:
 | 
			
		||||
            ip = resource_data[str(resource)]
 | 
			
		||||
        except Exception as e:
 | 
			
		||||
            logging.error("Resource is Unavailable when reading manager: " + str(e))
 | 
			
		||||
            ip = None
 | 
			
		||||
        return ip
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Report:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user