test_p2p_autogo.py 890 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/python
  2. #
  3. # P2P autonomous GO test cases
  4. # Copyright (c) 2013, Jouni Malinen <j@w1.fi>
  5. #
  6. # This software may be distributed under the terms of the BSD license.
  7. # See README for more details.
  8. import logging
  9. logger = logging.getLogger(__name__)
  10. import hwsim_utils
  11. def autogo(go, client):
  12. logger.info("Start autonomous GO " + go.ifname)
  13. res = go.p2p_start_go()
  14. logger.debug("res: " + str(res))
  15. logger.info("Try to connect the client to the GO")
  16. pin = client.wps_read_pin()
  17. go.p2p_go_authorize_client(pin)
  18. client.p2p_connect_group(go.p2p_dev_addr(), pin, timeout=60)
  19. logger.info("Group formed")
  20. hwsim_utils.test_connectivity_p2p(go, client)
  21. def test_autogo(dev):
  22. autogo(go=dev[0], client=dev[1])
  23. dev[0].remove_group()
  24. try:
  25. dev[1].remove_group()
  26. except:
  27. pass
  28. def add_tests(tests):
  29. tests.append(test_autogo)