def test_grpform2_c(dev): """P2P group formation using PIN and authorized connection (resp -> GO) (group iface)""" dev[0].request("SET p2p_no_group_iface 0") dev[1].request("SET p2p_no_group_iface 0") [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=0, r_dev=dev[1], r_intent=15) remove_group(dev[0], dev[1]) if i_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed") if r_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_grpform3_c(dev): """P2P group formation using PIN and re-init GO Negotiation (group iface)""" dev[0].request("SET p2p_no_group_iface 0") dev[1].request("SET p2p_no_group_iface 0") [i_res, r_res] = go_neg_pin(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0) remove_group(dev[0], dev[1]) if i_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed") if r_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_autogo2(dev): """P2P autonomous GO with a separate group interface and client joining group""" dev[0].global_request("SET p2p_no_group_iface 0") res = autogo(dev[0], freq=2437) if "p2p-wlan" not in res['ifname']: raise Exception("Unexpected group interface name on GO") if res['ifname'] not in utils.get_ifnames(): raise Exception("Could not find group interface netdev") connect_cli(dev[0], dev[1], social=True, freq=2437) dev[0].remove_group() dev[1].wait_go_ending_session() if res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_autogo2(dev): """P2P autonomous GO with a separate group interface and client joining group""" dev[0].request("SET p2p_no_group_iface 0") res = autogo(dev[0]) if "p2p-wlan" not in res['ifname']: raise Exception("Unexpected group interface name on GO") if res['ifname'] not in utils.get_ifnames(): raise Exception("Could not find group interface netdev") connect_cli(dev[0], dev[1]) dev[0].remove_group() dev[1].wait_go_ending_session() if res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_autogo3(dev): """P2P autonomous GO and client with a separate group interface joining group""" dev[1].global_request("SET p2p_no_group_iface 0") autogo(dev[0], freq=2462) res = connect_cli(dev[0], dev[1], social=True, freq=2462) if "p2p-wlan" not in res['ifname']: raise Exception("Unexpected group interface name on client") if res['ifname'] not in utils.get_ifnames(): raise Exception("Could not find group interface netdev") dev[0].remove_group() dev[1].wait_go_ending_session() dev[1].ping() if res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_autogo3(dev): """P2P autonomous GO and client with a separate group interface joining group""" dev[1].request("SET p2p_no_group_iface 0") autogo(dev[0]) res = connect_cli(dev[0], dev[1]) if "p2p-wlan" not in res['ifname']: raise Exception("Unexpected group interface name on client") if res['ifname'] not in utils.get_ifnames(): raise Exception("Could not find group interface netdev") dev[0].remove_group() dev[1].wait_go_ending_session() dev[1].ping() if res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_grpform_c(dev): """P2P group formation using PIN and authorized connection (init -> GO) (group iface)""" dev[0].request("SET p2p_no_group_iface 0") dev[1].request("SET p2p_no_group_iface 0") [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0) if "p2p-wlan" not in i_res['ifname']: raise Exception("Unexpected group interface name") if "p2p-wlan" not in r_res['ifname']: raise Exception("Unexpected group interface name") check_grpform_results(i_res, r_res) remove_group(dev[0], dev[1]) if i_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed") if r_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_autogo4(dev): """P2P autonomous GO and client joining group (both with a separate group interface)""" dev[0].request("SET p2p_no_group_iface 0") dev[1].request("SET p2p_no_group_iface 0") res1 = autogo(dev[0]) res2 = connect_cli(dev[0], dev[1]) if "p2p-wlan" not in res1['ifname']: raise Exception("Unexpected group interface name on GO") if "p2p-wlan" not in res2['ifname']: raise Exception("Unexpected group interface name on client") ifnames = utils.get_ifnames() if res1['ifname'] not in ifnames: raise Exception("Could not find GO group interface netdev") if res2['ifname'] not in ifnames: raise Exception("Could not find client group interface netdev") dev[0].remove_group() dev[1].wait_go_ending_session() dev[1].ping() ifnames = utils.get_ifnames() if res1['ifname'] in ifnames: raise Exception("GO group interface netdev was not removed") if res2['ifname'] in ifnames: raise Exception("Client group interface netdev was not removed")
def test_autogo4(dev): """P2P autonomous GO and client joining group (both with a separate group interface)""" dev[0].global_request("SET p2p_no_group_iface 0") dev[1].global_request("SET p2p_no_group_iface 0") res1 = autogo(dev[0], freq=2412) res2 = connect_cli(dev[0], dev[1], social=True, freq=2412) if "p2p-wlan" not in res1['ifname']: raise Exception("Unexpected group interface name on GO") if "p2p-wlan" not in res2['ifname']: raise Exception("Unexpected group interface name on client") ifnames = utils.get_ifnames() if res1['ifname'] not in ifnames: raise Exception("Could not find GO group interface netdev") if res2['ifname'] not in ifnames: raise Exception("Could not find client group interface netdev") dev[0].remove_group() dev[1].wait_go_ending_session() dev[1].ping() ifnames = utils.get_ifnames() if res1['ifname'] in ifnames: raise Exception("GO group interface netdev was not removed") if res2['ifname'] in ifnames: raise Exception("Client group interface netdev was not removed")
def test_grpform_b(dev): """P2P group formation using PIN and authorized connection (init -> GO) (resp: group iface)""" dev[1].global_request("SET p2p_no_group_iface 0") [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0) if "p2p-wlan" not in r_res['ifname']: raise Exception("Unexpected group interface name") check_grpform_results(i_res, r_res) addr = dev[0].group_request("P2P_GROUP_MEMBER " + dev[1].p2p_dev_addr()) if "FAIL" in addr: raise Exception("P2P_GROUP_MEMBER failed") if addr != dev[1].p2p_interface_addr(): raise Exception("Unexpected P2P_GROUP_MEMBER result: " + addr) if "FAIL" not in dev[0].group_request("P2P_GROUP_MEMBER a"): raise Exception("Invalid P2P_GROUP_MEMBER command accepted") if "FAIL" not in dev[0].group_request("P2P_GROUP_MEMBER 00:11:22:33:44:55"): raise Exception("P2P_GROUP_MEMBER for non-member accepted") remove_group(dev[0], dev[1]) if r_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed")
def test_grpform_random_addr(dev): """P2P group formation with random interface addresses""" dev[0].global_request("SET p2p_no_group_iface 0") dev[1].global_request("SET p2p_no_group_iface 0") try: if "OK" not in dev[0].global_request("SET p2p_interface_random_mac_addr 1"): raise Exception("Failed to set p2p_interface_random_mac_addr") if "OK" not in dev[1].global_request("SET p2p_interface_random_mac_addr 1"): raise Exception("Failed to set p2p_interface_random_mac_addr") [i_res, r_res] = go_neg_pin_authorized(i_dev=dev[0], i_intent=15, r_dev=dev[1], r_intent=0) if "p2p-wlan" not in i_res['ifname']: raise Exception("Unexpected group interface name") check_grpform_results(i_res, r_res) hwsim_utils.test_connectivity_p2p(dev[0], dev[1]) remove_group(dev[0], dev[1]) if i_res['ifname'] in utils.get_ifnames(): raise Exception("Group interface netdev was not removed") finally: dev[0].global_request("SET p2p_interface_random_mac_addr 0") dev[1].global_request("SET p2p_interface_random_mac_addr 0")