예제 #1
0
    def test_client_association_dummy(self):
        sta = env.Station.create()

        debug("Connect dummy STA to wlan0")
        env.agents[0].radios[0].vaps[0].associate(sta)
        debug(
            "Send client association control request to the chosen BSSID (UNBLOCK)"
        )
        env.beerocks_cli_command('client_allow {} {}'.format(
            sta.mac, env.agents[0].radios[1].mac))
        time.sleep(1)

        debug(
            "Confirming Client Association Control Request message was received (UNBLOCK)"
        )
        self.check_log(env.agents[0].radios[1],
                       r"Got client allow request for {}".format(sta.mac))

        debug("Send client association control request to all other (BLOCK) ")
        env.beerocks_cli_command('client_disallow {} {}'.format(
            sta.mac, env.agents[0].radios[0].mac))
        time.sleep(1)

        debug(
            "Confirming Client Association Control Request message was received (BLOCK)"
        )
        self.check_log(env.agents[0].radios[0],
                       r"Got client disallow request for {}".format(sta.mac))
예제 #2
0
    def test_ap_config_bss_tear_down_cli(self):
        # Same test as the previous one but using CLI instead of dev_send_1905

        env.beerocks_cli_command('bml_clear_wifi_credentials {}'.format(
            env.agents[0].mac))
        env.beerocks_cli_command(
            'bml_set_wifi_credentials {} {} {} {} {}'.format(
                env.agents[0].mac, "Multi-AP-24G-3-cli", "maprocks1", "24g",
                "fronthaul"))
        env.beerocks_cli_command('bml_update_wifi_credentials {}'.format(
            env.agents[0].mac))

        # Wait a bit for the renew to complete
        time.sleep(3)

        self.check_log(
            env.agents[0].radios[0],
            r"Received credentials for ssid: Multi-AP-24G-3-cli .*"
            r"fronthaul: true backhaul: false")
        self.check_log(env.agents[0].radios[1], r".* tear down radio")
        conn_map = connmap.get_conn_map()
        repeater1 = conn_map[env.agents[0].mac]
        repeater1_wlan0 = repeater1.radios[env.agents[0].radios[0].mac]
        for vap in repeater1_wlan0.vaps.values():
            if vap.ssid not in (b'Multi-AP-24G-3-cli', b'N/A'):
                self.fail(
                    'Wrong SSID: {vap.ssid} instead of Multi-AP-24G-3-cli'.
                    format(vap=vap))
        repeater1_wlan2 = repeater1.radios[env.agents[0].radios[1].mac]
        for vap in repeater1_wlan2.vaps.values():
            if vap.ssid != b'N/A':
                self.fail(
                    'Wrong SSID: {vap.ssid} instead torn down'.format(vap=vap))

        env.beerocks_cli_command('bml_clear_wifi_credentials {}'.format(
            env.agents[0].mac))
        env.beerocks_cli_command('bml_update_wifi_credentials {}'.format(
            env.agents[0].mac))

        time.sleep(3)
        self.check_log(env.agents[0].radios[0], r".* tear down radio")
        conn_map = connmap.get_conn_map()
        repeater1 = conn_map[env.agents[0].mac]
        repeater1_wlan0 = repeater1.radios[env.agents[0].radios[0].mac]
        for vap in repeater1_wlan0.vaps.values():
            if vap.ssid != b'N/A':
                self.fail(
                    'Wrong SSID: {vap.ssid} instead torn down'.format(vap=vap))
        repeater1_wlan2 = repeater1.radios[env.agents[0].radios[1].mac]
        for vap in repeater1_wlan2.vaps.values():
            if vap.ssid != b'N/A':
                self.fail(
                    'Wrong SSID: {vap.ssid} instead torn down'.format(vap=vap))
예제 #3
0
def get_conn_map() -> Dict[str, MapDevice]:
    '''Get the connection map from the controller.'''
    conn_map = {}
    for line in env.beerocks_cli_command("bml_conn_map").split(b'\n'):
        # TODO we need to parse indentation to get the exact topology.
        # For the time being, just parse the repeaters.
        bridge = re.search(rb' {8}IRE_BRIDGE: .* mac: ' + RE_MAC, line)
        radio = re.match(rb' {16}RADIO: .* mac: ' + RE_MAC, line)
        vap = re.match(
            rb' {20}fVAP.* bssid: ' + RE_MAC + rb', ssid: (?P<ssid>.*)$', line)
        if bridge:
            cur_agent = MapDevice(bridge.group('mac').decode('utf-8'))
            conn_map[cur_agent.mac] = cur_agent
        elif radio:
            cur_radio = cur_agent.add_radio(radio.group('mac').decode('utf-8'))
        elif vap:
            cur_radio.add_vap(
                vap.group('mac').decode('utf-8'), vap.group('ssid'))
    return conn_map
예제 #4
0
    def test_client_steering_dummy(self):
        sta = env.Station.create()

        debug("Connect dummy STA to wlan0")
        env.agents[0].radios[0].vaps[0].associate(sta)
        debug("Send steer request ")
        env.beerocks_cli_command("steer_client {} {}".format(
            sta.mac, env.agents[0].radios[1].mac))
        time.sleep(1)

        debug(
            "Confirming Client Association Control Request message was received (UNBLOCK)"
        )
        self.check_log(env.agents[0].radios[1], r"Got client allow request")

        debug(
            "Confirming Client Association Control Request message was received (BLOCK)"
        )
        self.check_log(env.agents[0].radios[0], r"Got client disallow request")

        debug(
            "Confirming Client Association Control Request message was received (BLOCK)"
        )
        self.check_log(env.agents[1].radios[0], r"Got client disallow request")

        debug(
            "Confirming Client Association Control Request message was received (BLOCK)"
        )
        self.check_log(env.agents[1].radios[1], r"Got client disallow request")

        debug(
            "Confirming Client Steering Request message was received - mandate"
        )
        self.check_log(env.agents[0].radios[0], r"Got steer request")

        debug("Confirming BTM Report message was received")
        self.check_log(env.controller, r"CLIENT_STEERING_BTM_REPORT_MESSAGE")

        debug("Confirming ACK message was received")
        self.check_log(env.agents[0].radios[0], r"ACK_MESSAGE")

        debug("Disconnect dummy STA from wlan0")
        env.agents[0].radios[0].vaps[0].disassociate(sta)
        # Make sure that controller sees disconnect before connect by waiting a little
        time.sleep(1)

        debug("Connect dummy STA to wlan2")
        env.agents[0].radios[1].vaps[0].associate(sta)
        debug("Confirm steering success by client connected")
        self.check_log(env.controller,
                       r"steering successful for sta {}".format(sta.mac))
        self.check_log(
            env.controller,
            r"sta {} disconnected due to steering request".format(sta.mac))

        # Make sure that all blocked agents send UNBLOCK messages at the end of
        # disallow period (default 25 sec)
        time.sleep(25)

        debug(
            "Confirming Client Association Control Request message was received (UNBLOCK)"
        )
        self.check_log(env.agents[0].radios[0], r"Got client allow request")

        debug(
            "Confirming Client Association Control Request message was received (UNBLOCK)"
        )
        self.check_log(env.agents[1].radios[0], r"Got client allow request")

        debug(
            "Confirming Client Association Control Request message was received (UNBLOCK)"
        )
        self.check_log(env.agents[1].radios[1], r"Got client allow request")
예제 #5
0
    def test_client_association_dummy(self):
        sta = env.Station.create()

        debug("Connect dummy STA to wlan0")
        env.agents[0].radios[0].vaps[0].associate(sta)
        debug(
            "Send client association control request to the chosen BSSID (UNBLOCK)"
        )
        env.beerocks_cli_command('client_allow {} {}'.format(
            sta.mac, env.agents[0].radios[1].mac))
        time.sleep(1)

        debug(
            "Confirming Client Association Control Request message was received (UNBLOCK)"
        )
        self.check_log(env.agents[0].radios[1],
                       r"Got client allow request for {}".format(sta.mac))

        debug("Send client association control request to all other (BLOCK) ")
        env.beerocks_cli_command('client_disallow {} {}'.format(
            sta.mac, env.agents[0].radios[0].mac))
        time.sleep(1)

        debug(
            "Confirming Client Association Control Request message was received (BLOCK)"
        )
        self.check_log(env.agents[0].radios[0],
                       r"Got client disallow request for {}".format(sta.mac))

        # TODO client blocking not implemented in dummy bwl

        # Check in connection map
        conn_map = connmap.get_conn_map()
        map_radio = conn_map[env.agents[0].mac].radios[
            env.agents[0].radios[0].mac]
        map_vap = map_radio.vaps[env.agents[0].radios[0].vaps[0].bssid]
        if sta.mac not in map_vap.clients:
            self.fail("client {} not in conn_map, clients: {}".format(
                sta.mac, map_vap.clients))

        # Associate with other radio, check that conn_map is updated
        env.agents[0].radios[0].vaps[0].disassociate(sta)
        env.agents[0].radios[1].vaps[0].associate(sta)
        time.sleep(1)  # Wait for conn_map to be updated
        conn_map = connmap.get_conn_map()
        map_agent = conn_map[env.agents[0].mac]
        map_radio1 = map_agent.radios[env.agents[0].radios[1].mac]
        map_vap1 = map_radio1.vaps[env.agents[0].radios[1].vaps[0].bssid]
        if sta.mac not in map_vap1.clients:
            self.fail("client {} not in conn_map, clients: {}".format(
                sta.mac, map_vap1.clients))
        map_radio0 = map_agent.radios[env.agents[0].radios[0].mac]
        map_vap0 = map_radio0.vaps[env.agents[0].radios[0].vaps[0].bssid]
        if sta.mac in map_vap0.clients:
            self.fail("client {} still in conn_map, clients: {}".format(
                sta.mac, map_vap0.clients))

        # Associate with other radio implies disassociate from first
        env.agents[0].radios[0].vaps[0].associate(sta)
        time.sleep(1)  # Wait for conn_map to be updated
        conn_map = connmap.get_conn_map()
        map_agent = conn_map[env.agents[0].mac]
        map_radio1 = map_agent.radios[env.agents[0].radios[1].mac]
        map_vap1 = map_radio1.vaps[env.agents[0].radios[1].vaps[0].bssid]
        if sta.mac in map_vap1.clients:
            self.fail("client {} still in conn_map, clients: {}".format(
                sta.mac, map_vap1.clients))
        map_radio0 = map_agent.radios[env.agents[0].radios[0].mac]
        map_vap0 = map_radio0.vaps[env.agents[0].radios[0].vaps[0].bssid]
        if sta.mac not in map_vap0.clients:
            self.fail("client {} not in conn_map, clients: {}".format(
                sta.mac, map_vap0.clients))