tests: Add CPT parameter to p2ps_advertise()
authorMax Stepanov <Max.Stepanov@intel.com>
Thu, 2 Jul 2015 13:21:25 +0000 (16:21 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 26 Jul 2015 21:47:20 +0000 (00:47 +0300)
Add an optional parameter to p2ps_advertise() function allowing to
specify CPT priority values.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
tests/hwsim/test_p2ps.py

index d789ea1..4e77ca3 100644 (file)
@@ -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()