예제 #1
0
 def Single_Client_Connectivity(self,
                                upstream_port="eth1",
                                radio="wiphy0",
                                ssid="TestAP",
                                passkey="ssid_psk",
                                security="open",
                                station_name="sta0000",
                                test_case=None,
                                rid=None,
                                client=None,
                                logger=None):
     '''SINGLE CLIENT CONNECTIVITY using test_connect2.py'''
     self.staConnect = StaConnect2(self.lanforge_ip,
                                   self.lanforge_port,
                                   debug_=False)
     self.staConnect.sta_mode = 0
     self.staConnect.upstream_resource = 1
     self.staConnect.upstream_port = upstream_port
     self.staConnect.radio = radio
     self.staConnect.resource = 1
     self.staConnect.dut_ssid = ssid
     self.staConnect.dut_passwd = passkey
     self.staConnect.dut_security = security
     self.staConnect.station_names = station_name
     self.staConnect.sta_prefix = self.lanforge_prefix
     self.staConnect.runtime_secs = 10
     self.staConnect.bringup_time_sec = 60
     self.staConnect.cleanup_on_exit = True
     # staConnect.cleanup()
     self.staConnect.setup()
     self.staConnect.start()
     print("napping %f sec" % self.staConnect.runtime_secs)
     time.sleep(self.staConnect.runtime_secs)
     self.staConnect.stop()
     self.staConnect.cleanup()
     run_results = self.staConnect.get_result_list()
     for result in run_results:
         print("test result: " + result)
     # result = 'pass'
     print("Single Client Connectivity :", self.staConnect.passes)
     if self.staConnect.passes() == True:
         print("Single client connection to", self.staConnect.dut_ssid,
               "successful. Test Passed")
         client.update_testrail(case_id=test_case,
                                run_id=rid,
                                status_id=1,
                                msg='Client connectivity passed')
         logger.info("Client connectivity to " + self.staConnect.dut_ssid +
                     " Passed")
         return ("passed")
     else:
         client.update_testrail(case_id=test_case,
                                run_id=rid,
                                status_id=5,
                                msg='Client connectivity failed')
         print("Single client connection to", self.staConnect.dut_ssid,
               "unsuccessful. Test Failed")
         logger.warning("Client connectivity to " +
                        self.staConnect.dut_ssid + " FAILED")
         return ("failed")
예제 #2
0
    def test_single_client_wpa2(self, setup_testrails, setup_cloudsdk,
                                update_firmware, instantiate_testrail):
        lf_config = setup_cloudsdk["LANforge"]
        radio_config = setup_cloudsdk["24ghz"]

        staConnect = StaConnect2(lf_config["host"],
                                 lf_config["port"],
                                 debug_=False)
        staConnect.sta_mode = 0
        staConnect.upstream_resource = 1
        staConnect.upstream_port = lf_config["eth_port"]
        staConnect.radio = lf_config["radio"]
        staConnect.runtime_secs = lf_config["runtime_duration"]
        staConnect.resource = 1
        staConnect.dut_ssid = radio_config["ssid"]
        staConnect.dut_passwd = radio_config["password"]
        staConnect.dut_security = "wpa2"
        staConnect.station_names = radio_config["station_names"]
        staConnect.bringup_time_sec = 60
        staConnect.cleanup_on_exit = True
        staConnect.setup()
        staConnect.start()
        sleep(staConnect.runtime_secs)
        staConnect.stop()
        staConnect.cleanup()

        assert staConnect.passes()
        if setup_testrails > 0:
            instantiate_testrail.update_testrail(case_id=2835,
                                                 run_id=setup_testrails,
                                                 status_id=1,
                                                 msg="testing")
예제 #3
0
    def test_single_client_wpa2(self, setup_testrails, setup_cloudsdk,
                                update_firmware, instantiate_testrail):
        lf_config = setup_cloudsdk["lanforge"]
        # ap_profile = setup_cloudsdk["ap_object"]
        staConnect = StaConnect2(lf_config["ip"],
                                 lf_config["port"],
                                 debug_=False)
        staConnect.sta_mode = 0
        staConnect.upstream_resource = 1
        staConnect.upstream_port = lf_config["eth_port"]
        staConnect.radio = lf_config["2g_radio"]
        # staConnect.runtime_secs = lf_config["runtime_duration"]
        staConnect.resource = 1
        staConnect.dut_ssid = "NOLA-01g-ecw5410-2G_WPA2"
        staConnect.dut_passwd = "ecw5410-2G_WPA2"
        staConnect.dut_security = "wpa2"
        staConnect.station_names = ['sta0000']
        staConnect.bringup_time_sec = 60
        staConnect.cleanup_on_exit = True
        staConnect.setup()
        staConnect.start()
        sleep(staConnect.runtime_secs)
        staConnect.stop()
        staConnect.cleanup()

        assert staConnect.passes()
        if setup_testrails > 0:
            instantiate_testrail.update_testrail(case_id=2835,
                                                 run_id=setup_testrails,
                                                 status_id=1,
                                                 msg="testing")
예제 #4
0
 def test_modify_ssid(self, request, update_ssid, get_lanforge_data,
                      setup_profile_data, instantiate_testrail,
                      instantiate_project):
     profile_data = setup_profile_data["BRIDGE"]["WPA"]["5G"]
     station_names = []
     for i in range(0, int(request.config.getini("num_stations"))):
         station_names.append(get_lanforge_data["lanforge_5g_prefix"] +
                              "0" + str(i))
     staConnect = StaConnect2(
         get_lanforge_data["lanforge_ip"],
         int(get_lanforge_data["lanforge-port-number"]),
         debug_=False)
     staConnect.sta_mode = 0
     staConnect.upstream_resource = 1
     staConnect.upstream_port = get_lanforge_data["lanforge_bridge_port"]
     staConnect.radio = get_lanforge_data["lanforge_5g"]
     staConnect.resource = 1
     staConnect.dut_ssid = profile_data["ssid_name"]
     staConnect.dut_passwd = profile_data["security_key"]
     staConnect.dut_security = "wpa"
     staConnect.station_names = station_names
     staConnect.sta_prefix = get_lanforge_data["lanforge_5g_prefix"]
     staConnect.runtime_secs = 10
     staConnect.bringup_time_sec = 60
     staConnect.cleanup_on_exit = True
     # staConnect.cleanup()
     staConnect.setup()
     staConnect.start()
     print("napping %f sec" % staConnect.runtime_secs)
     time.sleep(staConnect.runtime_secs)
     staConnect.stop()
     staConnect.cleanup()
     run_results = staConnect.get_result_list()
     for result in run_results:
         print("test result: " + result)
     # result = 'pass'
     print("Single Client Connectivity :", staConnect.passes)
     if staConnect.passes():
         instantiate_testrail.update_testrail(
             case_id=TEST_CASES["bridge_ssid_update"],
             run_id=instantiate_project,
             status_id=1,
             msg=
             '5G WPA Client Connectivity Passed successfully - bridge mode '
             'updated ssid')
     else:
         instantiate_testrail.update_testrail(
             case_id=TEST_CASES["bridge_ssid_update"],
             run_id=instantiate_project,
             status_id=5,
             msg=
             '5G WPA Client Connectivity Failed - bridge mode updated ssid')
     assert staConnect.passes()
예제 #5
0
            results = TESTRAIL[(sdk.ap_firmware(TEST_DATA["customer_id"], TEST_DATA["ap_models"][model]["id"]) == latest_image)]
            testrail.update_testrail(case_id="2831", run_id=runId, status_id=results["statusCode"], msg=f"Upgrade {results['message']}")
            logging.info(f"Upgrade {results['statusCode']}")
            if results["message"] == "failure": # might want to fail all the other tests in testrails
                continue

        # Set Proper AP Profile
        test_profile_id = TEST_DATA["ap_models"][model]["info"]["profile_id"]
        sdk.set_ap_profile(TEST_DATA["ap_models"][model]["id"], test_profile_id)
        logging.info(f"Test profile id: {test_profile_id}")

        # Run Client Single Connectivity Test Cases
        for testcase in test_cases_data.keys():
            if test_cases_data[testcase]["ssid_name"] != "skip": # to be refactored with pytest, good enough for now
                logging.info(f"Test parameters are:\n  radio = {test_cases_data[testcase]['radio']}\n  ssid_name = {test_cases_data[testcase]['ssid_name']}\n  ssid_psk = {test_cases_data[testcase]['ssid_psk']}\n  security = {test_cases_data[testcase]['security']}\n  station = {test_cases_data[testcase]['station']}\n  testcase = {testcase}")
                staConnect = StaConnect2(command_line_args.lanforge_ip_address, command_line_args.lanforge_port_number, debug_ = False)
                staConnect.sta_mode = 0
                staConnect.upstream_resource = 1
                staConnect.upstream_port = "eth2"
                staConnect.radio = test_cases_data[testcase]["radio"]
                staConnect.resource = 1
                staConnect.dut_ssid = test_cases_data[testcase]["ssid_name"]
                staConnect.dut_passwd = test_cases_data[testcase]["ssid_psk"]
                staConnect.dut_security = test_cases_data[testcase]["security"]
                staConnect.station_names = test_cases_data[testcase]["station"]
                staConnect.runtime_secs = 30
                staConnect.clean_all_sta = True
                staConnect.cleanup_on_exit = True
                staConnect.setup()
                staConnect.start()
                logging.info(f"sleeping {staConnect.runtime_secs} seconds")
예제 #6
0
    def __init__(self,
                 lanforge_data=None,
                 access_point_data=None,
                 run_lf=False,
                 debug=True,
                 testbed=None,
                 cc_1=False,
                 ap_version=None):
        print("lanforge data", lanforge_data)
        print("access point data", access_point_data)
        self.access_point_data = access_point_data
        self.access_point_data = access_point_data
        self.run_lf = run_lf
        self.cc_1 = cc_1
        print("testbed", testbed)
        if "type" in lanforge_data.keys():
            if lanforge_data["type"] == "Non-mesh":
                self.lanforge_ip = lanforge_data["ip"]
                self.lanforge_port = lanforge_data["port"]
                self.ssh_port = lanforge_data["ssh_port"]
                self.twog_radios = lanforge_data["2.4G-Radio"]
                self.fiveg_radios = lanforge_data["5G-Radio"]
                self.ax_radios = lanforge_data["AX-Radio"]
                self.upstream_port = lanforge_data["upstream"]
                self.uplink_port = lanforge_data["uplink"]
                self.upstream_subnet = lanforge_data["upstream_subnet"]
                self.upstream_resources = self.upstream_port.split(
                    ".")[0] + "." + self.upstream_port.split(".")[1]
                self.uplink_resources = self.uplink_port.split(
                    ".")[0] + "." + self.uplink_port.split(".")[1]
                self.scenario_name = testbed
                self.debug = debug
                self.exit_on_error = False
                self.dut_idx_mapping = {}
                self.ssid_list = []
                self.staConnect = StaConnect2(self.lanforge_ip,
                                              self.lanforge_port,
                                              debug_=self.debug)
                self.local_realm = realm.Realm(
                    lfclient_host=self.lanforge_ip,
                    lfclient_port=self.lanforge_port)
                self.raw_line = [
                    [
                        "profile_link " + self.upstream_resources +
                        " upstream-dhcp 1 NA NA " +
                        self.upstream_port.split(".")[2] + ",AUTO -1 NA"
                    ],
                    [
                        "profile_link " + self.uplink_resources +
                        " uplink-nat 1 'DUT: upstream LAN " +
                        self.upstream_subnet + "' NA " +
                        self.uplink_port.split(".")[2] + "," +
                        self.upstream_port.split(".")[2] + " -1 NA"
                    ]
                ]
                self.CreateChamberview = CreateChamberview(
                    self.lanforge_ip, self.lanforge_port)

                self.delete_old_scenario = True
                if access_point_data:
                    print(len(access_point_data))

                    for ap in range(len(access_point_data)):
                        print(access_point_data[ap])
                        self.dut_name = access_point_data[ap]["model"]
                        print(self.dut_name)
                        self.ap_model = access_point_data[ap]["model"]
                        self.version = access_point_data[ap]["version"].split(
                            "/")[-1]
                        self.serial = access_point_data[ap]["serial"]
                        self.ssid_data = None
                        if self.run_lf:
                            self.ssid_data = access_point_data[ap]['ssid']
                            print(self.ssid_data)

                        self.CreateDut = DUT(lfmgr=self.lanforge_ip,
                                             port=self.lanforge_port,
                                             dut_name=self.dut_name,
                                             sw_version=self.version,
                                             hw_version=self.ap_model,
                                             model_num=self.ap_model,
                                             serial_num=self.serial)
                        self.CreateDut.ssid = []
                        if self.ssid_data is not None:
                            self.twog_ssid = [
                                "ssid_idx=0"
                                " ssid=" + self.ssid_data["2g-ssid"] +
                                " security=" +
                                self.ssid_data["2g-encryption"].upper() +
                                " password="******"2g-password"] +
                                " bssid=" +
                                self.ssid_data["2g-bssid"].lower().replace(
                                    " ", "")
                            ]

                            self.fiveg_ssid = [
                                "ssid_idx=1 ssid=" +
                                self.ssid_data["5g-ssid"] + " security=" +
                                self.ssid_data["5g-encryption"].upper() +
                                " password="******"5g-password"] +
                                " bssid=" +
                                self.ssid_data["5g-bssid"].lower().replace(
                                    " ", "")
                            ]
                            if "6g-ssid" in self.ssid_data.keys():
                                print("yes")
                                self.sixg_ssid = [
                                    "ssid_idx=2 ssid=" +
                                    self.ssid_data["6g-ssid"] + " security=" +
                                    self.ssid_data["6g-encryption"].upper() +
                                    " password="******"6g-password"] + " bssid=" +
                                    self.ssid_data["6g-bssid"].lower().replace(
                                        " ", "")
                                ]
                                ssid_var = [
                                    self.twog_ssid, self.fiveg_ssid,
                                    self.sixg_ssid
                                ]
                            else:
                                ssid_var = [self.twog_ssid, self.fiveg_ssid]
                            self.CreateDut.ssid = ssid_var
                            # print(self.CreateDut.ssid)
                            self.Create_Dut()

            if lanforge_data["type"] == "mesh":
                self.lanforge_ip = lanforge_data["ip"]
                self.lanforge_port = lanforge_data["port"]
                self.ssh_port = lanforge_data["ssh_port"]
                self.upstream_port_1 = lanforge_data["upstream-mobile-sta"]
                self.upstream_port_2 = lanforge_data["upstream-root"]
                self.upstream_port_3 = lanforge_data["upstream-node-1"]
                self.upstream_port_4 = lanforge_data["upstream-node-2"]
                self.uplink_port_1 = lanforge_data["uplink-mobile-sta"]
                self.uplink_port_2 = lanforge_data["uplink-root"]
                self.uplink_port_3 = lanforge_data["uplink--node-1"]
                self.uplink_port_4 = lanforge_data["uplink--node-2"]
                self.upstream_resource_1 = self.upstream_port_1.split(
                    ".")[0] + "." + self.upstream_port_1.split(".")[1]
                self.upstream_resource_2 = self.upstream_port_2.split(
                    ".")[0] + "." + self.upstream_port_2.split(".")[1]
                self.upstream_resource_3 = self.upstream_port_3.split(
                    ".")[0] + "." + self.upstream_port_3.split(".")[1]
                self.upstream_resource_4 = self.upstream_port_4.split(
                    ".")[0] + "." + self.upstream_port_4.split(".")[1]
                self.uplink_resource_1 = self.uplink_port_1.split(
                    ".")[0] + "." + self.uplink_port_1.split(".")[1]
                self.uplink_resource_2 = self.uplink_port_2.split(
                    ".")[0] + "." + self.uplink_port_2.split(".")[1]
                self.uplink_resource_3 = self.uplink_port_3.split(
                    ".")[0] + "." + self.uplink_port_3.split(".")[1]
                self.uplink_resource_4 = self.uplink_port_4.split(
                    ".")[0] + "." + self.uplink_port_4.split(".")[1]
                self.upstream_subnet = lanforge_data[
                    "upstream_subnet-mobile-sta"]
                self.delete_old_scenario = True
                self.debug = debug
                self.testbed = "mesh"
                self.scenario_name = "TIP-" + self.testbed
                self.raw_line = [
                    [
                        "profile_link " + self.upstream_resource_1 +
                        " upstream-dhcp 1 NA NA " +
                        self.upstream_port_1.split(".")[2] + ",AUTO -1 NA"
                    ],
                    [
                        "profile_link " + self.uplink_resource_1 +
                        " uplink-nat 1 'DUT: upstream LAN " +
                        self.upstream_subnet + "' NA " +
                        self.uplink_port_1.split(".")[2] + "," +
                        self.upstream_port_1.split(".")[2] + " -1 NA"
                    ]
                ]
                self.CreateChamberview = CreateChamberview(
                    self.lanforge_ip, self.lanforge_port)
        else:
            self.lanforge_ip = lanforge_data["ip"]
            self.lanforge_port = lanforge_data["port"]
            self.twog_radios = lanforge_data["2.4G-Radio"]
            self.fiveg_radios = lanforge_data["5G-Radio"]
            self.ax_radios = lanforge_data["AX-Radio"]
            self.upstream_port = lanforge_data["upstream"]
            self.twog_prefix = lanforge_data["2.4G-Station-Name"]
            self.fiveg_prefix = lanforge_data["5G-Station-Name"]
            self.ax_prefix = lanforge_data["AX-Station-Name"]
            self.uplink_port = lanforge_data["uplink"]  # eth2
            self.upstream_subnet = lanforge_data["upstream_subnet"]
            self.testbed = testbed
            self.upstream_resources = self.upstream_port.split(
                ".")[0] + "." + self.upstream_port.split(".")[1]
            self.uplink_resources = self.uplink_port.split(
                ".")[0] + "." + self.uplink_port.split(".")[1]
            self.delete_old_scenario = True
            # For chamber view
            self.scenario_name = "TIP-" + self.testbed
            self.debug = debug
            self.exit_on_error = False
            self.dut_idx_mapping = {}
            self.ssid_list = []
            self.ap_version = ap_version
            self.staConnect = StaConnect2(self.lanforge_ip,
                                          self.lanforge_port,
                                          debug_=self.debug)
            self.raw_line = [[
                "profile_link " + self.upstream_resources +
                " upstream-dhcp 1 NA NA " + self.upstream_port.split(".")[2] +
                ",AUTO -1 NA"
            ],
                             [
                                 "profile_link " + self.uplink_resources +
                                 " uplink-nat 1 'DUT: upstream LAN " +
                                 self.upstream_subnet + "' NA " +
                                 self.uplink_port.split(".")[2] + "," +
                                 self.upstream_port.split(".")[2] + " -1 NA"
                             ]]

            # This is for rawline input | see create_chamberview_dut.py for more details

            self.CreateChamberview = CreateChamberview(self.lanforge_ip,
                                                       self.lanforge_port)

            if access_point_data:
                # for DUT
                self.dut_name = testbed
                self.ap_model = access_point_data[0]["model"]
                self.ap_hw_info = access_point_data[0]["mode"]
                try:
                    self.version = self.ap_version[0].split(" / ")[1].split(
                        "\r\n\n")[0]
                    print("AP version", self.version)
                except Exception as e:
                    print(e)
                self.serial = access_point_data[0]["serial"]
                self.ssid_data = None
                if self.run_lf:
                    self.ssid_data = access_point_data[0]['ssid']
                self.CreateDut = DUT(lfmgr=self.lanforge_ip,
                                     port=self.lanforge_port,
                                     dut_name=self.testbed,
                                     sw_version=self.version,
                                     hw_version=self.ap_hw_info,
                                     model_num=self.ap_model,
                                     serial_num=self.serial)
                self.CreateDut.ssid = []
                if self.ssid_data is not None:
                    # ssid = ['ssid_idx=0 ssid=Default-SSID-2g security=WPA|WEP| password=12345678 bssid=90:3c:b3:94:48:58']
                    # ssid = ["ssid_idx=" + str(interface) +
                    #         " ssid=" + ssid_info_sdk[interface][0] +
                    #         " security=" + ssid_info_sdk[interface][1].upper() +
                    #         " password="******" bssid=" + ssid_info_sdk[interface][4].lower()
                    #         ]
                    self.twog_ssid = [
                        "ssid_idx=0"
                        " ssid=" + self.ssid_data["2g-ssid"] + " security=" +
                        self.ssid_data["2g-encryption"].upper() +
                        " password="******"2g-password"] +
                        " bssid=" +
                        self.ssid_data["2g-bssid"].lower().replace(" ", "")
                    ]

                    self.fiveg_ssid = [
                        "ssid_idx=1 ssid=" + self.ssid_data["5g-ssid"] +
                        " security=" +
                        self.ssid_data["5g-encryption"].upper() +
                        " password="******"5g-password"] +
                        " bssid=" +
                        self.ssid_data["5g-bssid"].lower().replace(" ", "")
                    ]
                    self.CreateDut.ssid = [self.twog_ssid, self.fiveg_ssid]
                    # print(self.CreateDut.ssid)
                    self.Create_Dut()