Пример #1
0
 def postcleanup(self):
     self.station_profile.cleanup()
     LFUtils.wait_until_ports_disappear(
         base_url=self.lfclient_url,
         port_list=self.station_profile.station_names,
         debug=self.debug)
     print("Test Completed")
Пример #2
0
 def pre_cleanup(self):
     self.cx_profile.cleanup_prefix()
     for sta in self.sta_list:
         self.local_realm.rm_port(sta, check_exists=True, debug_=self.debug)
     LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url,
                                        port_list=self.sta_list,
                                        debug=self.debug)
 def cleanup(self):
     self.cx_profile.cleanup()
     self.station_profile.cleanup()
     LFUtils.wait_until_ports_disappear(
         base_url=self.lfclient_url,
         port_list=self.station_profile.station_names,
         debug=self.debug)
    def setup(self):
        self.clear_test_results()
        self.check_connect()
        upstream_json = self.json_get("%s?fields=alias,phantom,down,port,ip" %
                                      self.get_upstream_url(),
                                      debug_=False)

        if upstream_json is None:
            self._fail(message="Unable to query %s, bye" % self.upstream_port,
                       print_=True)
            return False

        if upstream_json['interface']['ip'] == "0.0.0.0":
            if self.debug:
                pprint.pprint(upstream_json)
            self._fail("Warning: %s lacks ip address" %
                       self.get_upstream_url(),
                       print_=True)
            return False

        # remove old stations
        print("Removing old stations")
        for sta_name in self.station_names:
            sta_url = self.get_station_url(sta_name)
            response = self.json_get(sta_url)
            if (response is not None) and (response["interface"] is not None):
                for sta_name in self.station_names:
                    LFUtils.removePort(self.resource, sta_name,
                                       self.lfclient_url)
        LFUtils.wait_until_ports_disappear(self.lfclient_url,
                                           self.station_names)

        # Create stations and turn dhcp on
        self.station_profile = self.localrealm.new_station_profile()

        # Build stations
        self.station_profile.use_security(self.security,
                                          self.ssid,
                                          passwd="[BLANK]")
        self.station_profile.set_number_template(self.number_template)
        print("Creating stations")
        self.station_profile.set_command_flag("add_sta", "create_admin_down",
                                              1)
        self.station_profile.set_command_param("set_port", "report_timer",
                                               1500)
        self.station_profile.set_command_flag("set_port", "rpt_timer", 1)
        self.station_profile.set_wifi_extra(key_mgmt=self.key_mgmt,
                                            eap=self.eap,
                                            identity=self.identity,
                                            passwd=self.ttls_passwd,
                                            realm=self.ttls_realm,
                                            domain=self.domain,
                                            hessid=self.hessid)
        self.station_profile.create(radio=self.radio,
                                    sta_names_=self.sta_list,
                                    debug=self.debug,
                                    use_radius=True,
                                    hs20_enable=False)
        self._pass("PASS: Station build finished")
Пример #5
0
 def cleanup(self, sta_list):
     self.endp_profile.cleanup()
     self.ro_profile.cleanup()
     self.station_profile.cleanup(sta_list)
     LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url,
                                        port_list=sta_list,
                                        debug=self.debug)
     self.mvlan_profile.cleanup()
Пример #6
0
    def precleanup(self):
        print("precleanup started")
        sta_list = []
        for i in self.local_realm.station_list():
            if list(i.keys())[0] == '1.1.wlan0':
                pass
            elif list(i.keys())[0] == '1.1.wlan1':
                pass
            else:
                sta_list.append(list(i.keys())[0])
        print(sta_list)
        for sta in sta_list:
            self.local_realm.rm_port(sta, check_exists=True)
            time.sleep(1)

        LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url,
                                           port_list=sta_list,
                                           debug=self.debug)
        print("precleanup done")
    def setup(self):
        self.clear_test_results()
        self.check_connect()
        upstream_json = self.json_get("%s?fields=alias,phantom,down,port,ip" %
                                      self.get_upstream_url(),
                                      debug_=False)

        if upstream_json is None:
            self._fail(message="Unable to query %s, bye" % self.upstream_port,
                       print_=True)
            return False

        if upstream_json['interface']['ip'] == "0.0.0.0":
            if self.debug:
                pprint.pprint(upstream_json)
            self._fail("Warning: %s lacks ip address" %
                       self.get_upstream_url(),
                       print_=True)
            return False

        # remove old stations
        print("Removing old stations")
        for sta_name in self.station_names:
            sta_url = self.get_station_url(sta_name)
            response = self.json_get(sta_url)
            if (response is not None) and (response["interface"] is not None):
                for sta_name in self.station_names:
                    LFUtils.removePort(self.resource, sta_name,
                                       self.lfclient_url)
        LFUtils.wait_until_ports_disappear(self.lfclient_url,
                                           self.station_names)

        # Create stations and turn dhcp on
        self.station_profile = self.localrealm.new_station_profile()

        if self.dut_security == WPA2:
            self.station_profile.use_security(security_type="wpa2",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        elif self.dut_security == WPA:
            self.station_profile.use_security(security_type="wpa",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        elif self.dut_security == OPEN:
            self.station_profile.use_security(security_type="open",
                                              ssid=self.dut_ssid,
                                              passwd="[BLANK]")
        elif self.dut_security == WPA:
            self.station_profile.use_security(security_type="wpa",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        elif self.dut_security == WEP:
            self.station_profile.use_security(security_type="wep",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        self.station_profile.set_command_flag("add_sta", "create_admin_down",
                                              1)

        print("Adding new stations ", end="")
        self.station_profile.create(radio=self.radio,
                                    sta_names_=self.station_names,
                                    up_=False,
                                    debug=self.debug,
                                    suppress_related_commands_=True)
        LFUtils.wait_until_ports_appear(self.lfclient_url,
                                        self.station_names,
                                        debug=self.debug)
Пример #8
0
    def setup(self):
        self.clear_test_results()
        self.check_connect()
        upstream_json = self.json_get("%s?fields=alias,phantom,down,port,ip" %
                                      self.get_upstream_url(),
                                      debug_=False)

        if upstream_json is None:
            self._fail(message="Unable to query %s, bye" % self.upstream_port,
                       print_=True)
            return False

        if upstream_json['interface']['ip'] == "0.0.0.0":
            if self.debug:
                pprint.pprint(upstream_json)
            self._fail("Warning: %s lacks ip address" %
                       self.get_upstream_url(),
                       print_=True)
            return False

        # remove old stations
        if self.clean_all_sta:
            print("Removing all stations on resource.")
            self.localrealm.remove_all_stations(self.resource)
        else:
            print("Removing old stations to be created by this test.")
            for sta_name in self.station_names:
                sta_url = self.get_station_url(sta_name)
                response = self.json_get(sta_url)
                if (response is not None) and (response["interface"]
                                               is not None):
                    for sta_name in self.station_names:
                        LFUtils.removePort(self.resource, sta_name,
                                           self.lfclient_url)
            LFUtils.wait_until_ports_disappear(self.lfclient_url,
                                               self.station_names)

        # Create stations and turn dhcp on
        self.station_profile = self.localrealm.new_station_profile()

        if self.dut_security == WPA2:
            self.station_profile.use_security(security_type="wpa2",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        elif self.dut_security == OPEN:
            self.station_profile.use_security(security_type="open",
                                              ssid=self.dut_ssid,
                                              passwd="[BLANK]")
        elif self.dut_security == WPA:
            self.station_profile.use_security(security_type="wpa",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        elif self.dut_security == WEP:
            self.station_profile.use_security(security_type="wep",
                                              ssid=self.dut_ssid,
                                              passwd=self.dut_passwd)
        self.station_profile.set_command_flag("add_sta", "create_admin_down",
                                              1)

        print("Adding new stations ", end="")
        self.station_profile.create(radio=self.radio,
                                    sta_names_=self.station_names,
                                    up_=False,
                                    debug=self.debug,
                                    suppress_related_commands_=True)
        LFUtils.wait_until_ports_appear(self.lfclient_url,
                                        self.station_names,
                                        debug=self.debug)

        # Create UDP endpoints
        self.l3_udp_profile = self.localrealm.new_l3_cx_profile()
        self.l3_udp_profile.side_a_min_bps = 128000
        self.l3_udp_profile.side_b_min_bps = 128000
        self.l3_udp_profile.side_a_min_pdu = 1200
        self.l3_udp_profile.side_b_min_pdu = 1500
        self.l3_udp_profile.report_timer = 1000
        self.l3_udp_profile.name_prefix = "udp"
        port_list = list(
            self.localrealm.find_ports_like("%s+" % self.sta_prefix))
        if (port_list is None) or (len(port_list) < 1):
            raise ValueError("Unable to find ports named '%s'+" %
                             self.sta_prefix)
        self.l3_udp_profile.create(endp_type="lf_udp",
                                   side_a=port_list,
                                   side_b="%d.%s" %
                                   (self.resource, self.upstream_port),
                                   suppress_related_commands=True)

        # Create TCP endpoints
        self.l3_tcp_profile = self.localrealm.new_l3_cx_profile()
        self.l3_tcp_profile.side_a_min_bps = 128000
        self.l3_tcp_profile.side_b_min_bps = 56000
        self.l3_tcp_profile.name_prefix = "tcp"
        self.l3_tcp_profile.report_timer = 1000
        self.l3_tcp_profile.create(
            endp_type="lf_tcp",
            side_a=list(
                self.localrealm.find_ports_like("%s+" % self.sta_prefix)),
            side_b="%d.%s" % (self.resource, self.upstream_port),
            suppress_related_commands=True)
 def cleanup(self, sta_list):
     self.station_profile.cleanup(sta_list, debug_=self.debug)
     LFUtils.wait_until_ports_disappear(base_url=self.lfclient_url,
                                        port_list=sta_list,
                                        debug=self.debug)
     time.sleep(1)