Пример #1
0
    def test_ap_config_renew(self):
        # Regression test: MAC address should be case insensitive
        mac_repeater1_upper = env.agents[0].mac.upper()
        # Configure the controller and send renew
        env.controller.cmd_reply("DEV_RESET_DEFAULT")
        env.controller.cmd_reply(
            "DEV_SET_CONFIG,"
            "bss_info1,{} 8x Multi-AP-24G-1 0x0020 0x0008 maprocks1 0 1,"
            "bss_info2,{} 8x Multi-AP-24G-2 0x0020 0x0008 maprocks2 1 0".
            format(mac_repeater1_upper, env.agents[0].mac))
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x000A,
            tlv(0x01, 0x0006, "{" + env.controller.mac + "}"),
            tlv(0x0F, 0x0001, "{0x00}"), tlv(0x10, 0x0001, "{0x00}"))

        # 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-1 .* bss_type: 2")
        self.check_log(
            env.agents[0].radios[0],
            r"Received credentials for ssid: Multi-AP-24G-2 .* bss_type: 1")
        self.check_log(env.agents[0].radios[1], r".* tear down radio")

        bssid1 = env.agents[0].dev_get_parameter(
            'macaddr',
            ruid='0x' + env.agents[0].radios[0].mac.replace(':', ''),
            ssid='Multi-AP-24G-1')
        if not bssid1:
            self.fail("repeater1 didn't configure Multi-AP-24G-1")
Пример #2
0
    def test_client_association_link_metrics(self):
        ''' This test verifies that a MAUT with an associated STA responds to
        an Associated STA Link Metrics Query message with an Associated STA Link Metrics
        Response message containing an Associated STA Link Metrics TLV for the associated STA.'''

        sta_mac = "11:11:33:44:55:66"
        debug("Send link metrics query for unconnected STA")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x800D,
            tlv(0x95, 0x0006, '{sta_mac}'.format(sta_mac=sta_mac)))
        self.check_log(
            env.agents[0],
            "client with mac address {sta_mac} not found".format(
                sta_mac=sta_mac))
        time.sleep(1)

        sta = env.Station.create()
        debug('sta: {}'.format(sta.mac))

        env.agents[0].radios[0].vaps[0].associate(sta)

        time.sleep(1)

        mid = env.controller.dev_send_1905(
            env.agents[0].mac, 0x800D,
            tlv(0x95, 0x0006, '{sta_mac}'.format(sta_mac=sta.mac)))
        time.sleep(1)
        self.check_log(
            env.agents[0],
            "Send AssociatedStaLinkMetrics to controller, mid = {}".format(
                mid))
    def runTest(self):
        # Locate test participants
        agent = self.dev.DUT.agent_entity
        controller = self.dev.lan.controller_entity
        sta = self.dev.wifi

        # Regression check
        # Don't connect nonexistent Station
        self.dev.DUT.wired_sniffer.start(self.__class__.__name__ + "-" + self.dev.DUT.name)
        sta_mac = "11:11:33:44:55:66"
        debug("Send link metrics query for unconnected STA")
        controller.ucc_socket.dev_send_1905(agent.mac, 0x800D,
                                            tlv(0x95, 0x0006, '{sta_mac}'.format(sta_mac=sta_mac)))
        self.check_log(agent,
                       "client with mac address {sta_mac} not found".format(sta_mac=sta_mac))
        time.sleep(1)

        debug('sta: {}'.format(sta.mac))
        sta.wifi_connect_check(agent.radios[0].vaps[0])

        time.sleep(1)

        mid = controller.ucc_socket.dev_send_1905(agent.mac, 0x800D,
                                                  tlv(0x95, 0x0006,
                                                      '{sta_mac}'.format(sta_mac=sta.mac)))
        time.sleep(1)
        self.check_log(agent,
                       "Send AssociatedStaLinkMetrics to controller, mid = {}".format(mid),
                       timeout=20)
Пример #4
0
    def test_ap_config_renew(self):
        # Regression test: MAC address should be case insensitive
        mac_repeater1_upper = self.mac_repeater1.upper()
        # Configure the controller and send renew
        self.gateway_ucc.cmd_reply("DEV_RESET_DEFAULT")
        self.gateway_ucc.cmd_reply(
            "DEV_SET_CONFIG,"
                "bss_info1,{mac_repeater1_upper} 8x Multi-AP-24G-1 0x0020 0x0008 maprocks1 0 1,"
                "bss_info2,{self.mac_repeater1} 8x Multi-AP-24G-2 0x0020 0x0008 maprocks2 1 0".format(**locals()))
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x000A,
            tlv(0x01, 0x0006, "{" + self.mac_gateway + "}"),
            tlv(0x0F, 0x0001, "{0x00}"),
            tlv(0x10, 0x0001, "{0x00}"))

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

        self.check_log(self.repeater1, "agent_wlan0", r"Received credentials for ssid: Multi-AP-24G-1 .* bss_type: 2")
        self.check_log(self.repeater1, "agent_wlan0", r"Received credentials for ssid: Multi-AP-24G-2 .* bss_type: 1")
        self.check_log(self.repeater1, "agent_wlan2", r".* tear down radio")

        bssid1 = self.repeater1_ucc.dev_get_parameter('macaddr',
                                                      ruid = '0x' + self.mac_repeater1_wlan0.replace(':', ''),
                                                      ssid = 'Multi-AP-24G-1')
        if not bssid1:
            self.fail("repeater1 didn't configure Multi-AP-24G-1")
Пример #5
0
    def test_client_capability_query(self):
        sta1 = env.Station.create()
        sta2 = env.Station.create()

        association_frame = """00 0e 4d 75 6c 74 69 2d 41 50 2d 32 34 47 2d 31
01 08 02 04 0b 0c 12 16 18 24 21 02 00 14 30 14
01 00 00 0f ac 04 01 00 00 0f ac 04 01 00 00 0f
ac 02 00 00 32 04 30 48 60 6c 3b 10 51 51 53 54
73 74 75 76 77 78 7c 7d 7e 7f 80 82 3b 16 0c 01
02 03 04 05 0c 16 17 18 19 1a 1b 1c 1d 1e 1f 20
21 80 81 82 46 05 70 00 00 00 00 46 05 71 50 50
00 04 7f 0a 04 00 0a 82 21 40 00 40 80 00 dd 07
00 50 f2 02 00 01 00 2d 1a 2d 11 03 ff ff 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 e6
e1 09 00 bf 0c b0 79 d1 33 fa ff 0c 03 fa ff 0c
03 c7 01 10 """

        debug("Send client capability query for unconnected STA")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8009,
            tlv(0x90, 0x000C, '{} {}'.format(env.agents[0].radios[0].mac,
                                             sta1.mac)))
        time.sleep(1)
        debug("Confirming client capability query has been received on agent")
        # check that both radio agents received it, in the future we'll add a check to verify which
        # radio the query was intended for.
        self.check_log(env.agents[0], r"CLIENT_CAPABILITY_QUERY_MESSAGE")

        debug(
            "Confirming client capability report message has been received on controller"
        )
        self.check_log(env.controller,
                       r"Received CLIENT_CAPABILITY_REPORT_MESSAGE")
        self.check_log(
            env.controller,
            r"Result Code= FAILURE, client MAC= {}, BSSID= {}".format(
                sta1.mac, env.agents[0].radios[0].mac))

        debug("Connect dummy STA to wlan0")
        env.agents[0].radios[0].vaps[0].associate(sta2)

        debug("Send client capability query for connected STA")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8009,
            tlv(0x90, 0x000C, '{} {}'.format(env.agents[0].radios[0].mac,
                                             sta2.mac)))
        time.sleep(1)

        debug(
            "Confirming client capability report message has been received on controller"
        )
        self.check_log(env.controller,
                       r"Received CLIENT_CAPABILITY_REPORT_MESSAGE")
        self.check_log(
            env.controller,
            r"Result Code= SUCCESS, client MAC= {}, BSSID= {}".format(
                sta2.mac, env.agents[0].radios[0].mac))

        for line in association_frame.splitlines():
            self.check_log(env.controller, r"{}".format(line))
Пример #6
0
    def test_combined_infra_metrics(self):
        debug("Send AP Metrics query message to agent 1")
        vap1 = env.agents[0].radios[0].vaps[0]
        vap2 = env.agents[1].radios[1].vaps[0]
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x800B,
            tlv(0x93, 0x0007, "0x01 {%s}" % (vap1.bssid)))
        self.check_log(env.controller, "Received AP_METRICS_RESPONSE_MESSAGE")

        debug("Send AP Metrics query message to agent 2")
        env.controller.dev_send_1905(
            env.agents[1].mac, 0x800B,
            tlv(0x93, 0x0007, "0x01 {%s}" % vap2.bssid))
        self.check_log(env.controller, "Received AP_METRICS_RESPONSE_MESSAGE")

        debug("Send 1905 Link metric query to agent 1 (neighbor gateway)")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x0005,
            tlv(0x08, 0x0008, "0x01 {%s} 0x02" % env.controller.mac))
        self.check_log(env.agents[0], "Received LINK_METRIC_QUERY_MESSAGE")
        self.check_log(env.controller, "Received LINK_METRIC_RESPONSE_MESSAGE")
        self.check_log(env.controller, "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(env.controller, "Received TLV_RECEIVER_LINK_METRIC")

        # Trigger combined infra metrics
        debug("Send Combined infrastructure metrics message to agent 1")
        env.controller.dev_send_1905(env.agents[0].mac, 0x8013)
        self.check_log(env.agents[0],
                       "Received COMBINED_INFRASTRUCTURE_METRICS")
        self.check_log(env.agents[0], "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(env.agents[0], "Received TLV_RECEIVER_LINK_METRIC")
Пример #7
0
    def test_client_steering_mandate(self):
        debug("Send topology request to agent 1")
        env.controller.dev_send_1905(env.agents[0].mac, 0x0002)
        time.sleep(1)
        debug("Confirming topology query was received")
        self.check_log(env.agents[0], "TOPOLOGY_QUERY_MESSAGE")

        debug("Send topology request to agent 2")
        env.controller.dev_send_1905(env.agents[1].mac, 0x0002)
        time.sleep(1)
        debug("Confirming topology query was received")
        self.check_log(env.agents[1], "TOPOLOGY_QUERY_MESSAGE")

        debug(
            "Send Client Steering Request message for Steering Mandate to CTT Agent1"
        )
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8014,
            tlv(
                0x9B, 0x001b,
                "{%s 0xe0 0x0000 0x1388 0x01 {0x000000110022} 0x01 {%s 0x73 0x24}}"
                % (env.agents[0].radios[0].mac,
                   env.agents[1].radios[0].mac)))  # noqa E501
        time.sleep(1)
        debug(
            "Confirming Client Steering Request message was received - mandate"
        )
        self.check_log(env.agents[0].radios[0], "Got steer request")

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

        debug("Checking BTM Report source bssid")
        self.check_log(
            env.controller,
            "BTM_REPORT from source bssid %s" % env.agents[0].radios[0].mac)

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

        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8014,
            tlv(0x9B, 0x000C, "{%s 0x00 0x000A 0x0000 0x00}" %
                env.agents[0].radios[0].mac))  # noqa E501
        time.sleep(1)
        debug(
            "Confirming Client Steering Request message was received - Opportunity"
        )
        self.check_log(env.agents[0].radios[0],
                       "CLIENT_STEERING_REQUEST_MESSAGE")

        debug("Confirming ACK message was received")
        self.check_log(env.controller, "ACK_MESSAGE")

        debug("Confirming steering completed message was received")
        self.check_log(env.controller, "STEERING_COMPLETED_MESSAGE")

        debug("Confirming ACK message was received")
        self.check_log(env.agents[0].radios[0], "ACK_MESSAGE")
Пример #8
0
    def test_client_association(self):
        debug("Send topology request to agent 1")
        env.controller.dev_send_1905(env.agents[0].mac, 0x0002)
        debug("Confirming topology query was received")
        self.check_log(env.agents[0], r"TOPOLOGY_QUERY_MESSAGE")

        debug("Send client association control message")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8016,
            tlv(
                0x9D, 0x000F, "{%s 0x00 0x1E 0x01 {0x000000110022}}" %
                env.agents[0].radios[0].mac))  # noqa E501

        debug(
            "Confirming client association control message has been received on agent"
        )
        # check that both radio agents received it,in the future we'll add a check to verify which
        # radio the query was intended for.
        self.check_log(env.agents[0].radios[0],
                       r"CLIENT_ASSOCIATION_CONTROL_REQUEST_MESSAGE")
        self.check_log(env.agents[0].radios[1],
                       r"CLIENT_ASSOCIATION_CONTROL_REQUEST_MESSAGE")

        debug("Confirming ACK message was received on controller")
        self.check_log(env.controller, r"ACK_MESSAGE")
Пример #9
0
    def test_higher_layer_data_payload_trigger(self):
        mac_gateway_hex = '0x' + env.controller.mac.replace(':', '')
        debug("mac_gateway_hex = " + mac_gateway_hex)
        payload = 199 * (mac_gateway_hex + " ") + mac_gateway_hex

        debug("Send Higher Layer Data message")
        # MCUT sends Higher Layer Data message to CTT Agent1 by providing:
        # Higher layer protocol = "0x00"
        # Higher layer payload = 200 concatenated copies of the ALID of the MCUT (1200 octets)
        mid = env.controller.dev_send_1905(
            env.agents[0].mac, 0x8018, tlv(0xA0, 0x04b1,
                                           "{0x00 %s}" % payload))

        debug("Confirming higher layer data message was received in the agent")

        self.check_log(env.agents[0], r"HIGHER_LAYER_DATA_MESSAGE")

        debug("Confirming matching protocol and payload length")

        self.check_log(env.agents[0], r"protocol: 0")
        self.check_log(env.agents[0], r"payload_length: 0x4b0")

        debug("Confirming ACK message was received in the controller")
        self.check_log(env.controller,
                       r"ACK_MESSAGE, mid=0x{:04x}".format(mid))
Пример #10
0
    def test_combined_infra_metrics(self):
        self.debug("Send AP Metrics query message to agent 1")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x800B,
                                       tlv(0x93,0x0007,"0x01 {%s}" % (self.mac_repeater1_wlan0)))
        self.check_log(self.repeater1, "agent_wlan0", "Received AP_METRICS_QUERY_MESSAGE")
        # TODO agent should send response autonomously, with same MID.
        # tlv1 == AP metrics TLV
        # tlv2 == STA metrics TLV with no metrics
        # tlv3 == STA metrics TLV for STA connected to this BSS
        # tlv4 == STA traffic stats TLV for same STA
        self.repeater1_ucc.dev_send_1905(self.mac_gateway, 0x800C,
            tlv(0x94,0x000d,"{%s} 0x01 0x0002 0x01 0x1f2f3f" % (self.mac_repeater1_wlan0)),
            tlv(0x96,0x0007,"{55:44:33:22:11:00} 0x00"),
            tlv(0x96,0x001a,"{66:44:33:22:11:00} 0x01 {%s} 0x11223344 0x1a2a3a4a 0x1b2b3b4b 0x55" %
                self.mac_repeater1_wlan0),
            tlv(0xa2,0x0022,"{55:44:33:22:11:00} 0x10203040 0x11213141 0x12223242 0x13233343 "
                "0x14243444 0x15253545 0x16263646"))
        self.check_log(self.gateway, "controller", "Received AP_METRICS_RESPONSE_MESSAGE")

        self.debug("Send AP Metrics query message to agent 2")
        self.gateway_ucc.dev_send_1905(self.mac_repeater2, 0x800B,
                                       tlv(0x93,0x0007,"0x01 {%s}" % self.mac_repeater2_wlan2))
        self.check_log(self.repeater2, "agent_wlan2", "Received AP_METRICS_QUERY_MESSAGE")
        # TODO agent should send response autonomously
        # Same as above but with different STA MAC addresses, different values and skipping the empty one
        self.repeater2_ucc.dev_send_1905(self.mac_gateway, 0x800C,
            tlv(0x94,0x0010,"{%s} 0x11 0x1002 0x90 0x1c2c3c 0x1d2d3d" % self.mac_repeater2_wlan2),
            tlv(0x96,0x001a,"{77:44:33:22:11:00} 0x01 {%s} 0x19293949 0x10203040 0x11213141 0x99" % self.mac_repeater2_wlan2),
            tlv(0xa2,0x0022,"{77:44:33:22:11:00} 0xa0203040 0xa1213141 0xa2223242 0xa3233343 "
                         "0xa4243444 0xa5253545 0xa6263646"))
        self.check_log(self.gateway, "controller", "Received AP_METRICS_RESPONSE_MESSAGE")

        self.debug("Send 1905 Link metric query to agent 1 (neighbor gateway)")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x0005,
                                       tlv(0x08,0x0008,"0x01 {%s} 0x02" % self.mac_gateway))
        self.check_log(self.repeater1, "agent", "Received LINK_METRIC_QUERY_MESSAGE")
        self.check_log(self.gateway, "controller", "Received LINK_METRIC_RESPONSE_MESSAGE")
        self.check_log(self.gateway, "controller", "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(self.gateway, "controller", "Received TLV_RECEIVER_LINK_METRIC")

        # Trigger combined infra metrics
        self.debug("Send Combined infrastructure metrics message to agent 1")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8013)
        self.check_log(self.repeater1, "agent", "Received COMBINED_INFRASTRUCTURE_METRICS")
        self.check_log(self.repeater1, "agent", "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(self.repeater1, "agent", "Received TLV_RECEIVER_LINK_METRIC")
Пример #11
0
    def test_client_capability_query(self):
        sta1 = env.Station.create()
        sta2 = env.Station.create()

        debug("Send client capability query for unconnected STA")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8009,
            tlv(0x90, 0x000C, '{} {}'.format(env.agents[0].radios[0].mac,
                                             sta1.mac)))
        time.sleep(1)
        debug("Confirming client capability query has been received on agent")
        # check that both radio agents received it, in the future we'll add a check to verify which
        # radio the query was intended for.
        self.check_log(env.agents[0], r"CLIENT_CAPABILITY_QUERY_MESSAGE")

        debug(
            "Confirming client capability report message has been received on controller"
        )
        self.check_log(env.controller,
                       r"Received CLIENT_CAPABILITY_REPORT_MESSAGE")
        self.check_log(
            env.controller,
            r"Result Code= FAILURE, client MAC= {}, BSSID= {}".format(
                sta1.mac, env.agents[0].radios[0].mac))

        debug("Connect dummy STA to wlan0")
        env.agents[0].radios[0].vaps[0].associate(sta2)

        debug("Send client capability query for connected STA")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x8009,
            tlv(0x90, 0x000C, '{} {}'.format(env.agents[0].radios[0].mac,
                                             sta2.mac)))
        time.sleep(1)

        debug(
            "Confirming client capability report message has been received on controller"
        )
        self.check_log(env.controller,
                       r"Received CLIENT_CAPABILITY_REPORT_MESSAGE")
        self.check_log(
            env.controller,
            r"Result Code= SUCCESS, client MAC= {}, BSSID= {}".format(
                sta2.mac, env.agents[0].radios[0].mac))
Пример #12
0
    def test_client_steering_mandate(self):
        self.debug("Send topology request to agent 1")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x0002)
        time.sleep(1)
        self.debug("Confirming topology query was received")
        self.check_log(self.repeater1, "agent", "TOPOLOGY_QUERY_MESSAGE")

        self.debug("Send topology request to agent 2")
        self.gateway_ucc.dev_send_1905(self.mac_repeater2, 0x0002)
        time.sleep(1)
        self.debug("Confirming topology query was received")
        self.check_log(self.repeater2, "agent", "TOPOLOGY_QUERY_MESSAGE")

        self.debug("Send Client Steering Request message for Steering Mandate to CTT Agent1")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8014,
            tlv(0x9B, 0x001b, "{%s 0xe0 0x0000 0x1388 0x01 {0x000000110022} 0x01 {%s 0x73 0x24}}" %
                (self.mac_repeater1_wlan0, self.mac_repeater2_wlan0)))
        time.sleep(1)
        self.debug("Confirming Client Steering Request message was received - mandate")
        self.check_log(self.repeater1, "agent_wlan0", "Got steer request")

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

        self.debug("Checking BTM Report source bssid")
        self.check_log(self.gateway, "controller", "BTM_REPORT from source bssid %s" % self.mac_repeater1_wlan0)

        self.debug("Confirming ACK message was received")
        self.check_log(self.repeater1, "agent_wlan0", "ACK_MESSAGE")

        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8014,
            tlv(0x9B, 0x000C, "{%s 0x00 0x000A 0x0000 0x00}" % self.mac_repeater1_wlan0))
        time.sleep(1)
        self.debug("Confirming Client Steering Request message was received - Opportunity")
        self.check_log(self.repeater1, "agent_wlan0", "CLIENT_STEERING_REQUEST_MESSAGE")

        self.debug("Confirming ACK message was received")
        self.check_log(self.gateway, "controller", "ACK_MESSAGE")

        self.debug("Confirming steering completed message was received")
        self.check_log(self.gateway, "controller", "STEERING_COMPLETED_MESSAGE")

        self.debug("Confirming ACK message was received")
        self.check_log(self.repeater1, "agent_wlan0", "ACK_MESSAGE")
Пример #13
0
    def test_client_steering_policy(self):
        self.debug("Send client steering policy to agent 1")
        mid = self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8003,
            tlv(0x89, 0x000C, "{0x00 0x00 0x01 {0x112233445566 0x01 0xFF 0x14}}"))
        time.sleep(1)
        self.debug("Confirming client steering policy has been received on agent")

        self.check_log(self.repeater1, "agent_wlan0", r"MULTI_AP_POLICY_CONFIG_REQUEST_MESSAGE")
        time.sleep(1)
        self.debug("Confirming client steering policy ack message has been received on the controller")
        self.check_log(self.gateway, "controller", r"ACK_MESSAGE, mid=0x{:04x}".format(mid))
Пример #14
0
    def test_client_capability_query(self):
        sta_mac1 = '00:00:00:11:00:22'
        sta_mac2 = '00:00:00:11:00:33'

        self.debug("Send client capability query for unconnected STA")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8009,
                                       tlv(0x90,0x000C,
                                           '{mac_repeater1_wlan0} {sta_mac1}'
                                            .format(sta_mac1 = sta_mac1,
                                                    mac_repeater1_wlan0 = self.mac_repeater1_wlan0)))
        time.sleep(1)
        self.debug("Confirming client capability query has been received on agent")
        # check that both radio agents received it, in the future we'll add a check to verify which
        # radio the query was intended for.
        self.check_log(self.repeater1, "agent", r"CLIENT_CAPABILITY_QUERY_MESSAGE")

        self.debug("Confirming client capability report message has been received on controller")
        self.check_log(self.gateway, "controller", r"Received CLIENT_CAPABILITY_REPORT_MESSAGE")
        self.check_log(self.gateway, "controller",
                       r"Result Code= FAILURE, client MAC= {sta_mac1}, BSSID= {mac_repeater1_wlan0}"
                        .format(sta_mac1 = sta_mac1,
                                mac_repeater1_wlan0 = self.mac_repeater1_wlan0))

        self.debug("Connect dummy STA to wlan0")
        self.send_bwl_event(self.repeater1, "wlan0",
                            "EVENT AP-STA-CONNECTED {sta_mac2}".format(sta_mac2 = sta_mac2))

        self.debug("Send client capability query for connected STA")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8009,
                                       tlv(0x90,0x000C,
                                           '{mac_repeater1_wlan0} {sta_mac2}'
                                            .format(sta_mac2 = sta_mac2,
                                                    mac_repeater1_wlan0 = self.mac_repeater1_wlan0)))
        time.sleep(1)

        self.debug("Confirming client capability report message has been received on controller")
        self.check_log(self.gateway, "controller", r"Received CLIENT_CAPABILITY_REPORT_MESSAGE")
        self.check_log(self.gateway, "controller",
                       r"Result Code= SUCCESS, client MAC= {sta_mac2}, BSSID= {mac_repeater1_wlan0}"
                        .format(sta_mac2 = sta_mac2,
                                mac_repeater1_wlan0 = self.mac_repeater1_wlan0))
Пример #15
0
    def test_link_metric_query(self):
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x0005,
                                       tlv(0x08,0x0002,"0x00 0x02"))
        time.sleep(1)

        self.debug("Confirming link metric query has been received on agent")
        self.check_log(self.repeater1, "agent", "Received LINK_METRIC_QUERY_MESSAGE")

        self.debug("Confirming link metric response has been received on controller")
        self.check_log(self.gateway, "controller", "Received LINK_METRIC_RESPONSE_MESSAGE")
        self.check_log(self.gateway, "controller", "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(self.gateway, "controller", "Received TLV_RECEIVER_LINK_METRIC")
Пример #16
0
    def test_link_metric_query(self):
        env.controller.dev_send_1905(env.agents[0].mac, 0x0005,
                                     tlv(0x08, 0x0002, "0x00 0x02"))
        time.sleep(1)

        debug("Confirming link metric query has been received on agent")
        self.check_log(env.agents[0], "Received LINK_METRIC_QUERY_MESSAGE")

        debug(
            "Confirming link metric response has been received on controller")
        self.check_log(env.controller, "Received LINK_METRIC_RESPONSE_MESSAGE")
        self.check_log(env.controller, "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(env.controller, "Received TLV_RECEIVER_LINK_METRIC")
Пример #17
0
    def test_ap_config_bss_tear_down(self):
        # Configure the controller and send renew
        env.controller.cmd_reply("DEV_RESET_DEFAULT")
        env.controller.cmd_reply(
            "DEV_SET_CONFIG,bss_info1,"
            "{} 8x Multi-AP-24G-3 0x0020 0x0008 maprocks1 0 1".format(
                env.agents[0].mac))
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x000A,
            tlv(0x01, 0x0006, "{" + env.controller.mac + "}"),
            tlv(0x0F, 0x0001, "{0x00}"), tlv(0x10, 0x0001, "{0x00}"))

        # 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 .*"
            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', b'N/A'):
                self.fail(
                    'Wrong SSID: {vap.ssid} instead of Multi-AP-24G-3'.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))

        # SSIDs have been removed for the CTT Agent1's front radio
        env.controller.cmd_reply("DEV_SET_CONFIG,bss_info1,{} 8x".format(
            env.agents[0].mac))
        # Send renew message
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x000A,
            tlv(0x01, 0x0006, "{" + env.controller.mac + "}"),
            tlv(0x0F, 0x0001, "{0x00}"), tlv(0x10, 0x0001, "{0x00}"))

        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))
Пример #18
0
    def runTest(self):
        # Locate test participants
        agent = self.dev.DUT.agent_entity
        controller = self.dev.lan.controller_entity

        self.dev.DUT.wired_sniffer.start(self.__class__.__name__ + "-" +
                                         self.dev.DUT.name)
        # Regression test: MAC address should be case insensitive
        mac_repeater1_upper = agent.mac.upper()
        controller.ucc_socket.cmd_reply("DEV_RESET_DEFAULT")
        controller.ucc_socket.cmd_reply(
            "DEV_SET_CONFIG,"
            "bss_info1,{} 8x Multi-AP-24G-1 0x0020 0x0008 maprocks1 0 1,"
            "bss_info2,{} 8x Multi-AP-24G-2 0x0020 0x0008 maprocks2 1 0".
            format(mac_repeater1_upper, agent.mac))
        controller.ucc_socket.dev_send_1905(
            agent.mac, 0x000A, tlv(0x01, 0x0006, "{" + controller.mac + "}"),
            tlv(0x0F, 0x0001, "{0x00}"), tlv(0x10, 0x0001, "{0x00}"))

        time.sleep(5)
        self.check_log(agent.radios[0], r"ssid: Multi-AP-24G-1 .*"
                       r"fronthaul: true backhaul: false",
                       timeout=60)
        self.check_log(agent.radios[0], r"ssid: Multi-AP-24G-2 .*"
                       r"fronthaul: false backhaul: true",
                       timeout=60)
        self.check_log(agent.radios[1], r"tear down radio", timeout=60)
        bssid1 = agent.ucc_socket.dev_get_parameter(
            'macaddr',
            ruid='0x' + agent.radios[0].mac.replace(':', ''),
            ssid='Multi-AP-24G-1')
        if not bssid1:
            self.fail("repeater1 didn't configure Multi-AP-24G-1")
        # simulate wps onboarding to the backhaul vap
        agent.ucc_socket.start_wps_registration("24G")
        self.check_log(agent.radios[0], r"Start WPS PBC", timeout=60)
Пример #19
0
    def test_client_steering_policy(self):
        debug("Send client steering policy to agent 1")
        mid = env.controller.dev_send_1905(
            env.agents[0].mac, 0x8003,
            tlv(0x89, 0x000C,
                "{0x00 0x00 0x01 {0x112233445566 0x01 0xFF 0x14}}")
        )  # noqa E501
        time.sleep(1)
        debug("Confirming client steering policy has been received on agent")

        self.check_log(env.agents[0].radios[0],
                       r"MULTI_AP_POLICY_CONFIG_REQUEST_MESSAGE")
        time.sleep(1)
        debug(
            "Confirming client steering policy ack message has been received on the controller"
        )
        self.check_log(env.controller,
                       r"ACK_MESSAGE, mid=0x{:04x}".format(mid))
Пример #20
0
    def test_client_association(self):
        self.debug("Send topology request to agent 1")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x0002)
        self.debug("Confirming topology query was received")
        self.check_log(self.repeater1, "agent", r"TOPOLOGY_QUERY_MESSAGE")

        self.debug("Send client association control message")
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x8016,
            tlv(0x9D, 0x000F, "{%s 0x00 0x1E 0x01 {0x000000110022}}" % self.mac_repeater1_wlan0))

        self.debug("Confirming client association control message has been received on agent")
        # check that both radio agents received it,in the future we'll add a check to verify which
        # radio the query was intended for.
        self.check_log(self.repeater1, "agent_wlan0", r"CLIENT_ASSOCIATION_CONTROL_REQUEST_MESSAGE")
        self.check_log(self.repeater1, "agent_wlan2", r"CLIENT_ASSOCIATION_CONTROL_REQUEST_MESSAGE")

        self.debug("Confirming ACK message was received on controller")
        self.check_log(self.gateway, "controller", r"ACK_MESSAGE")
Пример #21
0
    def test_ap_config_bss_tear_down(self):
        # Configure the controller and send renew
        self.gateway_ucc.cmd_reply("DEV_RESET_DEFAULT")
        self.gateway_ucc.cmd_reply(
            "DEV_SET_CONFIG,bss_info1,"
                "{self.mac_repeater1} 8x Multi-AP-24G-3 0x0020 0x0008 maprocks1 0 1".format(self = self))
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x000A,
            tlv(0x01, 0x0006, "{" + self.mac_gateway + "}"),
            tlv(0x0F, 0x0001, "{0x00}"),
            tlv(0x10, 0x0001, "{0x00}"))

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

        self.check_log(self.repeater1, "agent_wlan0", r"Received credentials for ssid: Multi-AP-24G-3 .* bss_type: 2")
        self.check_log(self.repeater1, "agent_wlan2", r".* tear down radio")
        conn_map = self.get_conn_map()
        repeater1 = conn_map[self.mac_repeater1]
        repeater1_wlan0 = repeater1.radios[self.mac_repeater1_wlan0]
        for vap in repeater1_wlan0.vaps.values():
            if vap.ssid not in (b'Multi-AP-24G-3', b'N/A'):
                self.fail('Wrong SSID: {vap.ssid} instead of Multi-AP-24G-3'.format(vap = vap))
        repeater1_wlan2 = repeater1.radios[self.mac_repeater1_wlan2]
        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))

        # SSIDs have been removed for the CTT Agent1's front radio
        self.gateway_ucc.cmd_reply(
            "DEV_SET_CONFIG,bss_info1,{self.mac_repeater1} 8x".format(self = self))
        # Send renew message
        self.gateway_ucc.dev_send_1905(self.mac_repeater1, 0x000A,
            tlv(0x01, 0x0006, "{" + self.mac_gateway + "}"),
            tlv(0x0F, 0x0001, "{0x00}"),
            tlv(0x10, 0x0001, "{0x00}"))

        time.sleep(3)
        self.check_log(self.repeater1, "agent_wlan0", r".* tear down radio")
        conn_map = self.get_conn_map()
        repeater1 = conn_map[self.mac_repeater1]
        repeater1_wlan0 = repeater1.radios[self.mac_repeater1_wlan0]
        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[self.mac_repeater1_wlan2]
        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))
Пример #22
0
    def test_multi_ap_policy_config_w_steering_policy(self):
        debug(
            "Send multi-ap policy config request with steering policy to agent 1"
        )
        mid = env.controller.dev_send_1905(
            env.agents[0].mac, 0x8003,
            tlv(
                0x89, 0x000C, "{0x00 0x00 0x01 {%s 0x01 0xFF 0x14}}" %
                env.agents[0].radios[0].mac))  # noqa E501
        time.sleep(1)
        debug(
            "Confirming multi-ap policy config request has been received on agent"
        )

        self.check_log(env.agents[0],
                       r"MULTI_AP_POLICY_CONFIG_REQUEST_MESSAGE")
        time.sleep(1)
        debug(
            "Confirming multi-ap policy config ack message has been received on the controller"
        )
        self.check_log(env.controller,
                       r"ACK_MESSAGE, mid=0x{:04x}".format(mid))
Пример #23
0
    def test_channel_selection(self):
        debug("Send channel preference query")
        ch_pref_query_mid = env.controller.dev_send_1905(
            env.agents[0].mac, 0x8004)
        time.sleep(1)
        debug("Confirming channel preference query has been received on agent")
        self.check_log(env.agents[0].radios[0],
                       "CHANNEL_PREFERENCE_QUERY_MESSAGE")
        self.check_log(env.agents[0].radios[1],
                       "CHANNEL_PREFERENCE_QUERY_MESSAGE")

        self.check_cmdu_type("channel preferency response", 0x8005,
                             env.agents[0].mac, env.controller.mac,
                             ch_pref_query_mid)

        debug("Send empty channel selection request")
        cs_req_mid = env.controller.dev_send_1905(env.agents[0].mac, 0x8006,
                                                  tlv(0x00, 0x0000, "{}"))
        time.sleep(1)

        debug(
            "Confirming empty channel selection request has been received on agent"
        )
        self.check_log(env.agents[0].radios[0],
                       "CHANNEL_SELECTION_REQUEST_MESSAGE")
        self.check_log(env.agents[0].radios[1],
                       "CHANNEL_SELECTION_REQUEST_MESSAGE")

        self.check_cmdu_type("channel selection response", 0x8007,
                             env.agents[0].mac, env.controller.mac, cs_req_mid)
        oper_channel_reports = self.check_cmdu_type("operating channel report",
                                                    0x8008, env.agents[0].mac,
                                                    env.controller.mac)
        for report in oper_channel_reports:
            self.check_cmdu_type("ACK", 0x8000, env.controller.mac,
                                 env.agents[0].mac, report.ieee1905_mid)

        env.checkpoint()

        tp20dBm = 0x14
        tp21dBm = 0x15

        for payload_transmit_power in (tp20dBm, tp21dBm):
            debug(
                "Send empty channel selection request with changing tx_power_limit"
            )
            cs_req_mid = env.controller.dev_send_1905(
                env.agents[0].mac, 0x8006,
                tlv(
                    0x8D, 0x0007,
                    '{} 0x{:02x}'.format(env.agents[0].radios[0].mac,
                                         payload_transmit_power)),
                tlv(
                    0x8D, 0x0007,
                    '{} 0x{:02x}'.format(env.agents[0].radios[1].mac,
                                         payload_transmit_power)))
            time.sleep(1)

            self.check_log(env.agents[0].radios[0],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")
            self.check_log(env.agents[0].radios[1],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")

            self.check_log(
                env.agents[0].radios[0],
                "tlvTransmitPowerLimit {}".format(payload_transmit_power))
            self.check_log(
                env.agents[0].radios[1],
                "tlvTransmitPowerLimit {}".format(payload_transmit_power))

            self.check_cmdu_type("channel selection response", 0x8007,
                                 env.agents[0].mac, env.controller.mac,
                                 cs_req_mid)

            oper_channel_reports = self.check_cmdu_type(
                "operating channel report", 0x8008, env.agents[0].mac,
                env.controller.mac)
            for report in oper_channel_reports:
                for ocr in report.ieee1905_tlvs:
                    if ocr.tlv_type != 0x8F:
                        self.fail(
                            "Unexpected TLV in operating channel report: {}".
                            format(ocr))
                        continue
                    if int(ocr.operating_channel_eirp
                           ) != payload_transmit_power:
                        self.fail(
                            "Unexpected transmit power {} instead of {} for {}"
                            .format(ocr.operating_channel_eirp,
                                    payload_transmit_power,
                                    ocr.operating_channel_radio_id))
                self.check_cmdu_type("ACK", 0x8000, env.controller.mac,
                                     env.agents[0].mac, report.ieee1905_mid)

            env.checkpoint()

        # payload_wlan0 - request for change channel on 6
        payload_wlan0 = (
            "0x14 "
            "{0x51 {0x0C {0x01 0x02 0x03 0x04 0x05 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D} 0x00}} "
            "{0x52 {0x00 0x00}} "
            "{0x53 {0x08 {0x01 0x02 0x03 0x04 0x05 0x07 0x08 0x09} 0x00}} "
            "{0x54 {0x08 {0x05 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D} 0x00}} "
            "{0x73 {0x00 0x00}} "
            "{0x74 {0x00 0x00}} "
            "{0x75 {0x00 0x00}} "
            "{0x76 {0x00 0x00}} "
            "{0x77 {0x00 0x00}} "
            "{0x78 {0x00 0x00}} "
            "{0x79 {0x00 0x00}} "
            "{0x7A {0x00 0x00}} "
            "{0x7B {0x00 0x00}} "
            "{0x7C {0x00 0x00}} "
            "{0x7D {0x00 0x00}} "
            "{0x7E {0x00 0x00}} "
            "{0x7F {0x00 0x00}} "
            "{0x80 {0x00 0x00}} "
            "{0x81 {0x00 0x00}} "
            "{0x82 {0x00 0x00}} ")

        # payload_wlan2  - request for change channel on 36
        payload_wlan2 = ("0x14 "
                         "{0x51 {0x00 0x00}} "
                         "{0x52 {0x00 0x00}} "
                         "{0x53 {0x00 0x00}} "
                         "{0x54 {0x00 0x00}} "
                         "{0x73 0x03 {0x28 0x2C 0x30} 0x00} "
                         "{0x74 0x01 {0x2C} 0x00} "
                         "{0x75 {0x00 0x00}} "
                         "{0x76 {0x00 0x00}} "
                         "{0x77 {0x00 0x00}} "
                         "{0x78 {0x00 0x00}} "
                         "{0x79 {0x00 0x00}} "
                         "{0x7A {0x00 0x00}} "
                         "{0x7B {0x00 0x00}} "
                         "{0x7C {0x00 0x00}} "
                         "{0x7D {0x00 0x00}} "
                         "{0x7E {0x00 0x00}} "
                         "{0x7F {0x00 0x00}} "
                         "{0x80 0x05 {0x3A 0x6A 0x7A 0x8A 0x9B} 0x00} "
                         "{0x81 {0x00 0x00}} "
                         "{0x82 {0x00 0x00}}")
        """
        Step 1: Trigger channel selection to channel 6 and 36. Check that
                operating channel report was sent.

        Step 2: Trigger channel selection to channel 6 and 36 again - check that
                operating channel report is sent again. This is to catch bugs
                when we don't send channel report when there is no need to
                switch channel
        """
        for i in range(1, 3):
            debug("Send channel selection request, step {}".format(i))
            cs_req_mid = env.controller.dev_send_1905(
                env.agents[0].mac, 0x8006,
                tlv(0x8B, 0x005F, '{} {}'.format(env.agents[0].radios[0].mac,
                                                 payload_wlan0)),
                tlv(0x8D, 0x0007,
                    '{} 0x{:2x}'.format(env.agents[0].radios[0].mac, tp20dBm)),
                tlv(0x8B, 0x004C, '{} {}'.format(env.agents[0].radios[1].mac,
                                                 payload_wlan2)),
                tlv(0x8D, 0x0007,
                    '{} 0x{:2x}'.format(env.agents[0].radios[1].mac, tp20dBm)))
            time.sleep(1)

            debug(
                "Confirming channel selection request has been received on agent,step {}"
                .format(i))

            self.check_log(env.agents[0].radios[0],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")
            self.check_log(env.agents[0].radios[1],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")

            debug(
                "Confirming tlvTransmitPowerLimit has been received with correct value on \
                    agent, step {}".format(i))

            self.check_log(env.agents[0].radios[0],
                           "tlvTransmitPowerLimit {}".format(tp20dBm))

            self.check_log(env.agents[0].radios[0],
                           "ACTION_APMANAGER_HOSTAP_CHANNEL_SWITCH_ACS_START")

            self.check_log(env.agents[0].radios[1],
                           "tlvTransmitPowerLimit {}".format(tp20dBm))

            self.check_log(env.agents[0].radios[0],
                           "ACTION_APMANAGER_HOSTAP_CHANNEL_SWITCH_ACS_START")

            self.check_cmdu_type("channel selection response", 0x8007,
                                 env.agents[0].mac, env.controller.mac,
                                 cs_req_mid)

            oper_channel_reports = self.check_cmdu_type(
                "operating channel report", 0x8008, env.agents[0].mac,
                env.controller.mac)
            for report in oper_channel_reports:
                for ocr in report.ieee1905_tlvs:
                    if ocr.tlv_type != 0x8F:
                        self.fail(
                            "Unexpected TLV in operating channel report: {}".
                            format(ocr))
                        continue
                    if int(ocr.operating_channel_eirp) != tp20dBm:
                        self.fail(
                            "Unexpected transmit power {} instead of {} for {}"
                            .format(ocr.operating_channel_eirp,
                                    payload_transmit_power,
                                    ocr.operating_channel_radio_id))
                self.check_cmdu_type("ACK", 0x8000, env.controller.mac,
                                     env.agents[0].mac, report.ieee1905_mid)

            env.checkpoint()
Пример #24
0
    def test_combined_infra_metrics(self):
        debug("Send AP Metrics query message to agent 1")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x800B,
            tlv(0x93, 0x0007, "0x01 {%s}" % (env.agents[0].radios[0].mac)))
        self.check_log(env.agents[0].radios[0],
                       "Received AP_METRICS_QUERY_MESSAGE")
        # TODO agent should send response autonomously, with same MID.
        # AP metrics TLV
        tlv1 = tlv(
            0x94, 0x000d,
            "{%s} 0x01 0x0002 0x01 0x1f2f3f" % (env.agents[0].radios[0].mac))
        # STA metrics TLV with no metrics
        tlv2 = tlv(0x96, 0x0007, "{55:44:33:22:11:00} 0x00")
        # STA metrics TLV for STA connected to this BSS
        tlv3 = tlv(
            0x96, 0x001a,
            "{66:44:33:22:11:00} 0x01 {%s} 0x11223344 0x1a2a3a4a 0x1b2b3b4b 0x55"
            % env.agents[0].radios[0].mac)  # noqa E501
        # STA traffic stats TLV for same STA
        tlv4 = tlv(
            0xa2, 0x0022,
            "{55:44:33:22:11:00} 0x10203040 0x11213141 0x12223242 0x13233343 0x14243444 0x15253545 0x16263646"
        )  # noqa E501
        env.agents[0].dev_send_1905(env.controller.mac, 0x800C, tlv1, tlv2,
                                    tlv3, tlv4)
        self.check_log(env.controller, "Received AP_METRICS_RESPONSE_MESSAGE")

        debug("Send AP Metrics query message to agent 2")
        env.controller.dev_send_1905(
            env.agents[1].mac, 0x800B,
            tlv(0x93, 0x0007, "0x01 {%s}" % env.agents[1].radios[1].mac))
        self.check_log(env.agents[1].radios[1],
                       "Received AP_METRICS_QUERY_MESSAGE")
        # TODO agent should send response autonomously
        # Same as above but with different STA MAC addresses, different values and
        # skipping the empty one
        tlv1 = tlv(
            0x94, 0x000d,
            "{%s} 0x01 0x0002 0x01 0x1f2f3f" % (env.agents[1].radios[1].mac))
        tlv3 = tlv(
            0x96, 0x001a,
            "{77:44:33:22:11:00} 0x01 {%s} 0x19293949 0x10203040 0x11213141 0x99"
            % env.agents[1].radios[1].mac)  # noqa E501
        tlv4 = tlv(
            0xa2, 0x0022,
            "{77:44:33:22:11:00} 0xa0203040 0xa1213141 0xa2223242 0xa3233343 0xa4243444 0xa5253545 0xa6263646"
        )  # noqa E501
        env.agents[1].dev_send_1905(env.controller.mac, 0x800C, tlv1, tlv3,
                                    tlv4)
        self.check_log(env.controller, "Received AP_METRICS_RESPONSE_MESSAGE")

        debug("Send 1905 Link metric query to agent 1 (neighbor gateway)")
        env.controller.dev_send_1905(
            env.agents[0].mac, 0x0005,
            tlv(0x08, 0x0008, "0x01 {%s} 0x02" % env.controller.mac))
        self.check_log(env.agents[0], "Received LINK_METRIC_QUERY_MESSAGE")
        self.check_log(env.controller, "Received LINK_METRIC_RESPONSE_MESSAGE")
        self.check_log(env.controller, "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(env.controller, "Received TLV_RECEIVER_LINK_METRIC")

        # Trigger combined infra metrics
        debug("Send Combined infrastructure metrics message to agent 1")
        env.controller.dev_send_1905(env.agents[0].mac, 0x8013)
        self.check_log(env.agents[0],
                       "Received COMBINED_INFRASTRUCTURE_METRICS")
        self.check_log(env.agents[0], "Received TLV_TRANSMITTER_LINK_METRIC")
        self.check_log(env.agents[0], "Received TLV_RECEIVER_LINK_METRIC")
Пример #25
0
    def test_channel_selection(self):
        debug("Send channel preference query")
        env.controller.dev_send_1905(env.agents[0].mac, 0x8004)
        time.sleep(1)
        debug("Confirming channel preference query has been received on agent")
        self.check_log(env.agents[0].radios[0],
                       "CHANNEL_PREFERENCE_QUERY_MESSAGE")
        self.check_log(env.agents[0].radios[1],
                       "CHANNEL_PREFERENCE_QUERY_MESSAGE")

        debug("Send empty channel selection request")
        cs_req_mid = env.controller.dev_send_1905(env.agents[0].mac, 0x8006,
                                                  tlv(0x00, 0x0000, "{}"))
        time.sleep(1)

        debug(
            "Confirming channel selection request has been received on controller"
        )
        self.check_log(
            env.controller,
            r"CHANNEL_SELECTION_RESPONSE_MESSAGE, mid={}".format(cs_req_mid))

        debug(
            "Confirming empty channel selection request has been received on agent"
        )
        self.check_log(env.agents[0].radios[0],
                       "CHANNEL_SELECTION_REQUEST_MESSAGE")
        self.check_log(env.agents[0].radios[1],
                       "CHANNEL_SELECTION_REQUEST_MESSAGE")

        debug(
            "Confirming OPERATING_CHANNEL_REPORT_MESSAGE message has been received on \
            controller with mid")

        result, ocrm_line, mid_match = self.check_log(
            env.controller, r'.+OPERATING_CHANNEL_REPORT_MESSAGE,\smid=(\d+)')
        if (mid_match):
            debug("Confirming ACK_MESSAGE from the controller \
                with same mid as OPERATING_CHANNEL_REPORT_MESSAGE")
            self.check_log(env.agents[0].radios[0],
                           "ACK_MESSAGE, mid={}".format(mid_match[0]))
            self.check_log(env.agents[0].radios[1],
                           "ACK_MESSAGE, mid={}".format(mid_match[0]))

        tp20dBm = 0x14
        tp21dBm = 0x15

        for payload_transmit_power in (tp20dBm, tp21dBm):
            debug(
                "Send empty channel selection request with changing tx_power_limit"
            )
            cs_req_mid = env.controller.dev_send_1905(
                env.agents[0].mac, 0x8006,
                tlv(
                    0x8D, 0x0007,
                    '{} 0x{:02x}'.format(env.agents[0].radios[0].mac,
                                         payload_transmit_power)),
                tlv(
                    0x8D, 0x0007,
                    '{} 0x{:02x}'.format(env.agents[0].radios[1].mac,
                                         payload_transmit_power)))
            time.sleep(1)

            self.check_log(
                env.controller,
                r"CHANNEL_SELECTION_RESPONSE_MESSAGE, mid={}".format(
                    cs_req_mid))

            self.check_log(env.agents[0].radios[0],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")
            self.check_log(env.agents[0].radios[1],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")

            self.check_log(
                env.agents[0].radios[0],
                "tlvTransmitPowerLimit {}".format(payload_transmit_power))
            self.check_log(
                env.agents[0].radios[1],
                "tlvTransmitPowerLimit {}".format(payload_transmit_power))

            self.check_log(env.controller,
                           "tx_power={}".format(payload_transmit_power))

            result, ocrm_line, mid_match = self.check_log(
                env.controller,
                r'.+OPERATING_CHANNEL_REPORT_MESSAGE,\smid=(\d+)', ocrm_line)
            if (result):
                self.check_log(env.agents[0].radios[0],
                               "ACK_MESSAGE, mid={}".format(mid_match[0]))

                self.check_log(env.agents[0].radios[1],
                               "ACK_MESSAGE, mid={}".format(mid_match[0]))

        # payload_wlan0 - request for change channel on 6
        payload_wlan0 = (
            "0x14 "
            "{0x51 {0x0C {0x01 0x02 0x03 0x04 0x05 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D} 0x00}} "
            "{0x52 {0x00 0x00}} "
            "{0x53 {0x08 {0x01 0x02 0x03 0x04 0x05 0x07 0x08 0x09} 0x00}} "
            "{0x54 {0x08 {0x05 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D} 0x00}} "
            "{0x73 {0x00 0x00}} "
            "{0x74 {0x00 0x00}} "
            "{0x75 {0x00 0x00}} "
            "{0x76 {0x00 0x00}} "
            "{0x77 {0x00 0x00}} "
            "{0x78 {0x00 0x00}} "
            "{0x79 {0x00 0x00}} "
            "{0x7A {0x00 0x00}} "
            "{0x7B {0x00 0x00}} "
            "{0x7C {0x00 0x00}} "
            "{0x7D {0x00 0x00}} "
            "{0x7E {0x00 0x00}} "
            "{0x7F {0x00 0x00}} "
            "{0x80 {0x00 0x00}} "
            "{0x81 {0x00 0x00}} "
            "{0x82 {0x00 0x00}} ")

        # payload_wlan2  - request for change channel on 36
        payload_wlan2 = ("0x14 "
                         "{0x51 {0x00 0x00}} "
                         "{0x52 {0x00 0x00}} "
                         "{0x53 {0x00 0x00}} "
                         "{0x54 {0x00 0x00}} "
                         "{0x73 0x03 {0x28 0x2C 0x30} 0x00} "
                         "{0x74 0x01 {0x2C} 0x00} "
                         "{0x75 {0x00 0x00}} "
                         "{0x76 {0x00 0x00}} "
                         "{0x77 {0x00 0x00}} "
                         "{0x78 {0x00 0x00}} "
                         "{0x79 {0x00 0x00}} "
                         "{0x7A {0x00 0x00}} "
                         "{0x7B {0x00 0x00}} "
                         "{0x7C {0x00 0x00}} "
                         "{0x7D {0x00 0x00}} "
                         "{0x7E {0x00 0x00}} "
                         "{0x7F {0x00 0x00}} "
                         "{0x80 0x05 {0x3A 0x6A 0x7A 0x8A 0x9B} 0x00} "
                         "{0x81 {0x00 0x00}} "
                         "{0x82 {0x00 0x00}}")
        """
        Step 1: Trigger channel selection to channel 6 and 36. Check that
                operating channel report was sent.

        Step 2: Trigger channel selection to channel 6 and 36 again - check that
                operating channel report is sent again. This is to catch bugs
                when we don't send channel report when there is no need to
                switch channel
        """
        for i in range(1, 3):
            debug("Send channel selection request, step {}".format(i))
            mid = env.controller.dev_send_1905(
                env.agents[0].mac, 0x8006,
                tlv(0x8B, 0x005F, '{} {}'.format(env.agents[0].radios[0].mac,
                                                 payload_wlan0)),
                tlv(0x8D, 0x0007,
                    '{} 0x{:2x}'.format(env.agents[0].radios[0].mac, tp20dBm)),
                tlv(0x8B, 0x004C, '{} {}'.format(env.agents[0].radios[1].mac,
                                                 payload_wlan2)),
                tlv(0x8D, 0x0007,
                    '{} 0x{:2x}'.format(env.agents[0].radios[1].mac, tp20dBm)))
            time.sleep(1)

            debug(
                "Confirming channel selection request has been received on controller,\
                    step {}".format(i))
            self.check_log(
                env.controller,
                r"CHANNEL_SELECTION_RESPONSE_MESSAGE, mid={}".format(mid))

            debug(
                "Confirming channel selection request has been received on agent,step {}"
                .format(i))

            self.check_log(env.agents[0].radios[0],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")
            self.check_log(env.agents[0].radios[1],
                           "CHANNEL_SELECTION_REQUEST_MESSAGE")

            debug(
                "Confirming tlvTransmitPowerLimit has been received with correct value on \
                    agent, step {}".format(i))

            self.check_log(env.agents[0].radios[0],
                           "tlvTransmitPowerLimit {}".format(tp20dBm))

            self.check_log(env.agents[0].radios[0],
                           "ACTION_APMANAGER_HOSTAP_CHANNEL_SWITCH_ACS_START")

            self.check_log(env.agents[0].radios[1],
                           "tlvTransmitPowerLimit {}".format(tp20dBm))

            self.check_log(env.agents[0].radios[0],
                           "ACTION_APMANAGER_HOSTAP_CHANNEL_SWITCH_ACS_START")

            debug(
                "Confirming CHANNEL_SELECTION_RESPONSE_MESSAGE has been received, \
                step {}".format(i))

            self.check_log(env.controller,
                           "CHANNEL_SELECTION_RESPONSE_MESSAGE")

            debug(
                "Confirming OPERATING_CHANNEL_REPORT_MESSAGE has been received on \
                controller step {}".format(i))

            result, ocrm_line, mid_match = self.check_log(
                env.controller,
                r'.+OPERATING_CHANNEL_REPORT_MESSAGE,\smid=(\d+)', ocrm_line)

            if (mid_match):
                self.check_log(env.agents[0].radios[0],
                               "ACK_MESSAGE, mid={}".format(mid_match[0]))

                self.check_log(env.agents[0].radios[1],
                               "ACK_MESSAGE, mid={}".format(mid_match[0]))

            debug(
                "Confirming tx_power has been received with correct value on controller, \
                step {}".format(i))
            self.check_log(env.controller, "tx_power={}".format(tp20dBm))