[PATCH 7/9] tests: Add CPT parameter to p2ps_advertise()

Ilan Peer ilan.peer
Thu Jul 2 06:21:25 PDT 2015


From: Max Stepanov <Max.Stepanov at intel.com>

Add an optional parameter to p2ps_advertise() function allowing to
specify CPT priority values.

Signed-off-by: Max Stepanov <Max.Stepanov at intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
Reviewed-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/test_p2ps.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/hwsim/test_p2ps.py b/tests/hwsim/test_p2ps.py
index 8b38ed2..1f8d390 100644
--- a/tests/hwsim/test_p2ps.py
+++ b/tests/hwsim/test_p2ps.py
@@ -22,25 +22,27 @@ from utils import HwsimSkip
 # ev0 -> Event generated at advertiser side
 # ev1 -> Event generated at Seeker side
 
-def p2ps_advertise(r_dev, r_role, svc_name, srv_info, rsp_info=None):
+def p2ps_advertise(r_dev, r_role, svc_name, srv_info, rsp_info=None, cpt=None):
     """P2PS Advertise function"""
     adv_id = random.randrange(1, 0xFFFFFFFF)
     advid = hex(adv_id)[2:]
 
+    cpt_param = (" cpt=" + cpt) if cpt is not None else ""
+
     if rsp_info is not None and srv_info is not None:
-        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + " svc_info='" + srv_info + "'" + " rsp_info=" + rsp_info + "'"):
+        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + cpt_param + " svc_info='" + srv_info + "'" + " rsp_info=" + rsp_info + "'"):
             raise Exception("P2P_SERVICE_ADD with response info and service info failed")
 
     if rsp_info is None and srv_info is not None:
-        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + " svc_info='" + srv_info + "'"):
+        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + cpt_param + " svc_info='" + srv_info + "'"):
             raise Exception("P2P_SERVICE_ADD with service info failed")
 
     if rsp_info is None and srv_info is None:
-        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + " "):
+        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(advid) + " 1 1108 " + svc_name + cpt_param):
             raise Exception("P2P_SERVICE_ADD without service info and without response info failed")
 
     if rsp_info is not None and srv_info is None:
-        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(adv_id) + " 1 1108 " + svc_name + " svc_info='" + " rsp_info=" + rsp_info + "'"):
+        if "OK" not in r_dev.global_request("P2P_SERVICE_ADD asp " + str(r_role) + " " + str(adv_id) + " 1 1108 " + svc_name + cpt_param + " svc_info='" + " rsp_info=" + rsp_info + "'"):
             raise Exception("P2P_SERVICE_ADD with response info failed")
 
     r_dev.p2p_listen()
-- 
1.9.1




More information about the Hostap mailing list