@@ -42,18 +42,24 @@ def __init__(self, thread_list: typing.List[threading.Thread], queue: queue.Queu
42
42
parser .add_argument ('command' , help = "Command name" )
43
43
parser .add_argument ('-t' , '--timeout' , help = "The program will return with timeout after specified seconds" , default = '200' )
44
44
parser .add_argument ('-a' , '--address' , help = "Address of the device" )
45
+ parser .add_argument ('-p' , '--port' , help = "Port of the remote device" , default = '5540' )
45
46
parser .add_argument ('-s' , '--setup-payload' , dest = 'setup_payload' ,
46
47
help = "Setup Payload (manual pairing code or QR code content)" )
48
+ parser .add_argument ('-c' , '--setup-pin-code' , dest = 'setup_pin_code' ,
49
+ help = "Setup PIN code which can be used for password-authenticated session establishment (PASE) with the Commissionee" )
47
50
parser .add_argument ('-n' , '--nodeid' , help = "The Node ID issued to the device" , default = '1' )
48
51
parser .add_argument ('-d' , '--discriminator' , help = "Discriminator of the device" , default = '3840' )
49
- parser .add_argument ('-p ' , '--paa-trust-store-path' , dest = 'paa_trust_store_path' ,
52
+ parser .add_argument ('-u ' , '--paa-trust-store-path' , dest = 'paa_trust_store_path' ,
50
53
help = "Path that contains valid and trusted PAA Root Certificates" )
51
54
52
55
args = parser .parse_args (args .split ())
53
56
54
57
self .command_name = args .command
55
58
self .nodeid = args .nodeid
59
+ self .address = args .address
60
+ self .port = args .port
56
61
self .setup_payload = args .setup_payload
62
+ self .setup_pin_code = args .setup_pin_code
57
63
self .discriminator = args .discriminator
58
64
self .timeout = args .timeout
59
65
@@ -67,11 +73,24 @@ def TestCmdOnnetworkLong(self, nodeid, setuppin, discriminator, timeout):
67
73
DumpProgramOutputToQueue (self .thread_list , Fore .GREEN + "JAVA " + Style .RESET_ALL , java_process , self .queue )
68
74
return java_process .wait ()
69
75
76
+ def TestCmdAlreadyDiscovered (self , nodeid , setuppin , address , port , timeout ):
77
+ java_command = self .command + ['pairing' , 'already-discovered' , nodeid , setuppin , address , port , timeout ]
78
+ logging .info (f"Execute: { java_command } " )
79
+ java_process = subprocess .Popen (
80
+ java_command , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
81
+ DumpProgramOutputToQueue (self .thread_list , Fore .GREEN + "JAVA " + Style .RESET_ALL , java_process , self .queue )
82
+ return java_process .wait ()
83
+
70
84
def RunTest (self ):
71
85
if self .command_name == 'onnetwork-long' :
72
- logging .info ("Testing pairing over onnetwork-long" )
73
- code = self .TestCmdOnnetworkLong (self .nodeid , self .setup_payload , self .discriminator , self .timeout )
86
+ logging .info ("Testing pairing onnetwork-long" )
87
+ code = self .TestCmdOnnetworkLong (self .nodeid , self .setup_pin_code , self .discriminator , self .timeout )
88
+ if code != 0 :
89
+ raise Exception (f"Testing pairing onnetwork-long failed with error { code } " )
90
+ elif self .command_name == 'already-discovered' :
91
+ logging .info ("Testing pairing already-discovered" )
92
+ code = self .TestCmdAlreadyDiscovered (self .nodeid , self .setup_pin_code , self .address , self .port , self .timeout )
74
93
if code != 0 :
75
- raise Exception (f"Testing onnetwork-long pairing failed with error { code } " )
94
+ raise Exception (f"Testing pairing already-discovered failed with error { code } " )
76
95
else :
77
96
raise Exception (f"Unsupported command { self .command_name } " )
0 commit comments