Lines Matching refs:leshan

25 from leshan import Leshan
33 def test_LightweightM2M_1_1_int_102(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
39 leshan.write(endpoint, '1/0/1', lifetime)
41 latest = leshan.get(f'/clients/{endpoint}')
47 def test_LightweightM2M_1_1_int_103(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
49 leshan.execute(endpoint, '1/0/4')
58 def test_LightweightM2M_1_1_int_104(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
62 leshan.execute(endpoint, '1/0/8')
66 def test_LightweightM2M_1_1_int_107(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
68 leshan.write(endpoint, '1/0/1', 120)
75 assert leshan.get(f'/clients/{endpoint}')
77 def test_LightweightM2M_1_1_int_108(leshan, endpoint): argument
79 assert leshan.get(f'/clients/{endpoint}')["queuemode"]
82 def test_LightweightM2M_1_1_int_109(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
90 def test_LightweightM2M_1_1_int_201(shell: Shell, leshan: Leshan, endpoint: str):
92 fmt = leshan.format
93 leshan.format = 'TEXT'
94 assert leshan.read(endpoint, '3/0/0') == 'Zephyr'
95 assert leshan.read(endpoint, '3/0/1') == 'client-1'
96 assert leshan.read(endpoint, '3/0/2') == 'serial-1'
97 leshan.format = fmt
118 def test_LightweightM2M_1_1_int_203(shell: Shell, leshan: Leshan, endpoint: str):
120 fmt = leshan.format
121 leshan.format = 'TLV'
122 resp = leshan.read(endpoint,'3/0')
124 leshan.format = fmt
126 def test_LightweightM2M_1_1_int_204(shell: Shell, leshan: Leshan, endpoint: str):
128 fmt = leshan.format
129 leshan.format = 'JSON'
130 resp = leshan.read(endpoint, '3/0')
132 leshan.format = fmt
134 def test_LightweightM2M_1_1_int_205(shell: Shell, leshan: Leshan, endpoint: str):
136 fmt = leshan.format
137 leshan.format = 'TEXT'
138 leshan.write(endpoint, '1/0/2', 101)
139 leshan.write(endpoint, '1/0/3', 1010)
140 leshan.write(endpoint, '1/0/5', 2000)
141 assert leshan.read(endpoint, '1/0/2') == 101
142 assert leshan.read(endpoint, '1/0/3') == 1010
143 assert leshan.read(endpoint, '1/0/5') == 2000
144 leshan.write(endpoint, '1/0/2', 1)
145 leshan.write(endpoint, '1/0/3', 10)
146 leshan.write(endpoint, '1/0/5', 86400)
147 assert leshan.read(endpoint, '1/0/2') == 1
148 assert leshan.read(endpoint, '1/0/3') == 10
149 assert leshan.read(endpoint, '1/0/5') == 86400
150 leshan.format = fmt
152 def test_LightweightM2M_1_1_int_211(shell: Shell, leshan: Leshan, endpoint: str):
154 fmt = leshan.format
155 leshan.format = 'CBOR'
158 assert leshan.read(endpoint, '1/0/0') == short_id
159 assert leshan.read(endpoint, '1/0/6') is False
160 assert leshan.read(endpoint, '1/0/7') == 'U'
161 leshan.format = fmt
163 def test_LightweightM2M_1_1_int_212(shell: Shell, leshan: Leshan, endpoint: str):
165 fmt = leshan.format
166 leshan.format = 'CBOR'
167 leshan.write(endpoint, '1/0/2', 101)
168 leshan.write(endpoint, '1/0/3', 1010)
169 leshan.write(endpoint, '1/0/6', True)
170 assert leshan.read(endpoint, '1/0/2') == 101
171 assert leshan.read(endpoint, '1/0/3') == 1010
172 assert leshan.read(endpoint, '1/0/6') is True
173 leshan.write(endpoint, '1/0/2', 1)
174 leshan.write(endpoint, '1/0/3', 10)
175 leshan.write(endpoint, '1/0/6', False)
176 leshan.format = fmt
178 def verify_setting_basic_in_format(shell, leshan, endpoint, format): argument
179 fmt = leshan.format
180 leshan.format = format
181 server_obj = leshan.read(endpoint, '1/0')
193 assert leshan.update_obj_instance(endpoint, '1/0', data)['status'] == 'CHANGED(204)'
194 resp = leshan.read(endpoint, '1/0')
200 assert leshan.replace_obj_instance(endpoint, '1/0', server_obj[0])['status'] == 'CHANGED(204)'
201 server_obj = leshan.read(endpoint, '1/0')
203 leshan.format = fmt
205 def test_LightweightM2M_1_1_int_215(shell: Shell, leshan: Leshan, endpoint: str):
207 verify_setting_basic_in_format(shell, leshan, endpoint, 'TLV')
209 def test_LightweightM2M_1_1_int_220(shell: Shell, leshan: Leshan, endpoint: str):
211 verify_setting_basic_in_format(shell, leshan, endpoint, 'JSON')
213 def test_LightweightM2M_1_1_int_221(shell: Shell, leshan: Leshan, endpoint: str):
215 assert leshan.read(endpoint, '0/0')['status'] == 'UNAUTHORIZED(401)'
216 assert leshan.write(endpoint, '0/0/0', 'coap://localhost')['status'] == 'UNAUTHORIZED(401)'
217 assert leshan.write_attributes(endpoint, '0', {'pmin':10})['status'] == 'UNAUTHORIZED(401)'
219 def test_LightweightM2M_1_1_int_222(shell: Shell, leshan: Leshan, endpoint: str):
221 resp = leshan.read(endpoint, '1')
224 resp = leshan.read(endpoint, '3')
230 def test_LightweightM2M_1_1_int_223(shell: Shell, leshan: Leshan, endpoint: str):
232 resp = leshan.read(endpoint, '1/0')
234 resp = leshan.read(endpoint, '3/0')
238 def test_LightweightM2M_1_1_int_224(shell: Shell, leshan: Leshan, endpoint: str):
240 assert leshan.read(endpoint, '1/0/0') == 1
241 assert leshan.read(endpoint, '1/0/1') == 86400
242 assert leshan.read(endpoint, '1/0/6') is False
243 assert leshan.read(endpoint, '1/0/7') == 'U'
245 def test_LightweightM2M_1_1_int_225(shell: Shell, leshan: Leshan, endpoint: str):
247 assert leshan.read(endpoint, '3/0/11/0') == 0
249 def test_LightweightM2M_1_1_int_226(shell: Shell, leshan: Leshan, endpoint: str):
257 assert leshan.update_obj_instance(endpoint, '1/0', resources)['status'] == 'CHANGED(204)'
258 assert leshan.read(endpoint, '1/0/1') == 60
259 assert leshan.read(endpoint, '1/0/6') is True
264 assert leshan.update_obj_instance(endpoint, '1/0', resources)['status'] == 'CHANGED(204)'
266 def test_LightweightM2M_1_1_int_227(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
270 assert leshan.write(endpoint, '1/0/1', int(63))['status'] == 'CHANGED(204)'
272 latest = leshan.get(f'/clients/{endpoint}')
274 assert leshan.read(endpoint, '1/0/1') == 63
275 assert leshan.write(endpoint, '1/0/1', lifetime)['status'] == 'CHANGED(204)'
277 def test_LightweightM2M_1_1_int_228(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
282 assert leshan.create_obj_instance(endpoint, '16/0', resources)['status'] == 'CREATED(201)'
284 assert leshan.write(endpoint, '16/0/0/0', 'test')['status'] == 'CHANGED(204)'
285 assert leshan.read(endpoint, '16/0/0/0') == 'test'
287 def test_LightweightM2M_1_1_int_229(shell: Shell, leshan: Leshan, endpoint: str):
289 old_fmt = leshan.format
291 leshan.format = fmt
292 resp = leshan.composite_read(endpoint, ['/3', '1/0'])
299 resp = leshan.composite_read(endpoint, ['1/0/1', '/3/0/11/0'])
304 leshan.format = old_fmt
306 def test_LightweightM2M_1_1_int_230(shell: Shell, leshan: Leshan, endpoint: str):
318 old_fmt = leshan.format
320 leshan.format = fmt
321 assert leshan.composite_write(endpoint, resources)['status'] == 'CHANGED(204)'
322 resp = leshan.read(endpoint, '1/0')
325 resp = leshan.read(endpoint, '16/0/0')
333 leshan.format = old_fmt
335 def query_basic_in_senml(leshan: Leshan, endpoint: str, fmt: str):
337 old_fmt = leshan.format
338 leshan.format = fmt
339 verify_server_object(leshan.read(endpoint, '1')[1])
340 verify_device_object(leshan.read(endpoint, '3/0'))
341 assert leshan.read(endpoint, '3/0/16') == 'U'
342 assert leshan.read(endpoint, '3/0/11/0') == 0
343 leshan.format = old_fmt
345 def test_LightweightM2M_1_1_int_231(shell: Shell, leshan: Leshan, endpoint: str):
347 query_basic_in_senml(leshan, endpoint, 'SENML_JSON')
349 def test_LightweightM2M_1_1_int_232(shell: Shell, leshan: Leshan, endpoint: str):
351 query_basic_in_senml(leshan, endpoint, 'SENML_CBOR')
353 def setting_basic_senml(shell: Shell, leshan: Leshan, endpoint: str, fmt: str):
355 old_fmt = leshan.format
356 leshan.format = fmt
361 assert leshan.update_obj_instance(endpoint, '1/0', resources)['status'] == 'CHANGED(204)'
362 srv_obj = leshan.read(endpoint, '1/0')
365 assert leshan.write(endpoint, '16/0/0/0', 'test_value')['status'] == 'CHANGED(204)'
366 portfolio = leshan.read(endpoint, '16')
368 assert leshan.write(endpoint, '1/0/1', 63)['status'] == 'CHANGED(204)'
369 assert leshan.read(endpoint, '1/0/1') == 63
372 leshan.format = old_fmt
374 def test_LightweightM2M_1_1_int_233(shell: Shell, leshan: Leshan, endpoint: str):
376 setting_basic_senml(shell, leshan, endpoint, 'SENML_CBOR')
378 def test_LightweightM2M_1_1_int_234(shell: Shell, leshan: Leshan, endpoint: str):
380 setting_basic_senml(shell, leshan, endpoint, 'SENML_JSON')
382 def test_LightweightM2M_1_1_int_235(leshan: Leshan, endpoint: str):
384 resp = leshan.composite_read(endpoint, ['/'])
389 def test_LightweightM2M_1_1_int_236(shell: Shell, leshan: Leshan, endpoint: str):
391 resp = leshan.composite_read(endpoint, ['1/0', '/3/0/11/0', '/3339/0/5522', '/3353/0/6030'])
396 def test_LightweightM2M_1_1_int_237(shell: Shell, leshan: Leshan, endpoint: str):
398 old_fmt = leshan.format
399 leshan.format = None
400 assert leshan.read(endpoint, '1')[1][0][1] is not None
401 assert leshan.read(endpoint, '3')[3][0][0] == 'Zephyr'
402 leshan.format = old_fmt
404 def test_LightweightM2M_1_1_int_241(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
406 leshan.execute(endpoint, '3/0/4')
411 assert leshan.get(f'/clients/{endpoint}')
413 def test_LightweightM2M_1_1_int_256(shell: Shell, leshan: Leshan, endpoint: str):
417 assert leshan.write(endpoint, '1/0/0', 123)['status'] == 'METHOD_NOT_ALLOWED(405)'
418 assert leshan.read(endpoint, '1/0/0') == short_id
420 def test_LightweightM2M_1_1_int_257(shell: Shell, leshan: Leshan, endpoint: str):
427 old_fmt = leshan.format
429 leshan.format = fmt
430 assert leshan.composite_write(endpoint, resources)['status'] == 'CHANGED(204)'
431 assert leshan.read(endpoint, '1/0/2') == 102
432 assert leshan.read(endpoint, '1/0/6') is True
439 leshan.format = old_fmt
441 def test_LightweightM2M_1_1_int_260(shell: Shell, leshan: Leshan, endpoint: str):
443 resp = leshan.discover(endpoint, '3')
447 …assert leshan.write_attributes(endpoint, '3', {'pmin': 10, 'pmax': 200})['status'] == 'CHANGED(204…
448 resp = leshan.discover(endpoint, '3/0')
452 …assert leshan.write_attributes(endpoint, '3/0/7', {'lt': 1, 'gt': 6, 'st': 1})['status'] == 'CHANG…
453 resp = leshan.discover(endpoint, '3/0')
461 resp = leshan.discover(endpoint, '3/0/7')
467 leshan.remove_attributes(endpoint, '3', ['pmin', 'pmax'])
469 def test_LightweightM2M_1_1_int_261(shell: Shell, leshan: Leshan, endpoint: str):
471 resp = leshan.discover(endpoint, '3/0/11')
478 … assert leshan.write_attributes(endpoint, '3', {'pmin':10, 'pmax':200})['status'] == 'CHANGED(204)'
479 assert leshan.write_attributes(endpoint, '3/0', {'pmax':320})['status'] == 'CHANGED(204)'
480 …assert leshan.write_attributes(endpoint, '3/0/11/0', {'pmax':100, 'epmin':1, 'epmax':20})['status'…
481 resp = leshan.discover(endpoint, '3/0/11')
488 leshan.remove_attributes(endpoint, '3', ['pmin', 'pmax'])
489 leshan.remove_attributes(endpoint, '3/0', ['pmax'])
490 leshan.remove_attributes(endpoint, '3/0/11/0', ['pmax'])
493 def test_LightweightM2M_1_1_int_280(shell: Shell, leshan: Leshan, endpoint: str):
495 resp = leshan.composite_read(endpoint, ['/3/0/16', '/3/0/11/0', '/1/0'])
507 def test_LightweightM2M_1_1_int_281(shell: Shell, leshan: Leshan, endpoint: str):
509 resp = leshan.composite_read(endpoint, ['/1/0/1', '/1/0/7', '/1/0/8'])
520 def test_LightweightM2M_1_1_int_301(shell: Shell, leshan: Leshan, endpoint: str):
522 pwr_src = leshan.read(endpoint, '3/0/6')
526 …assert leshan.write_attributes(endpoint, '3/0/7', {'pmin': 5, 'pmax': 10})['status'] == 'CHANGED(2…
527 leshan.observe(endpoint, '3/0/7')
528 with leshan.get_event_stream(endpoint, timeout=30) as events:
544 leshan.cancel_observe(endpoint, '3/0/7')
545 leshan.remove_attributes(endpoint, '3/0/7', ['pmin', 'pmax'])
547 def test_LightweightM2M_1_1_int_302(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
549 leshan.observe(endpoint, '3/0/7')
550 leshan.observe(endpoint, '3/0/8')
551 with leshan.get_event_stream(endpoint) as events:
555 leshan.passive_cancel_observe(endpoint, '3/0/7')
558 with leshan.get_event_stream(endpoint) as events:
562 leshan.passive_cancel_observe(endpoint, '3/0/8')
566 def test_LightweightM2M_1_1_int_303(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
568 leshan.observe(endpoint, '3/0/7')
569 leshan.observe(endpoint, '3/0/8')
570 with leshan.get_event_stream(endpoint) as events:
574 leshan.cancel_observe(endpoint, '3/0/7')
576 with leshan.get_event_stream(endpoint) as events:
580 leshan.cancel_observe(endpoint, '3/0/8')
584 def test_LightweightM2M_1_1_int_304(shell: Shell, leshan: Leshan, endpoint: str):
589 …assert leshan.write_attributes(endpoint, '1/0/1', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(…
590 data = leshan.composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16'])
598 with leshan.get_event_stream(endpoint, timeout=50) as events:
609 leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16'])
613 leshan.remove_attributes(endpoint, '1/0/1', ['pmin', 'pmax'])
615 def test_LightweightM2M_1_1_int_305(dut: DeviceAdapter, leshan: Leshan, endpoint: str):
617 leshan.composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16'])
618 leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0/11/0', '/3/0/16'])
623 def test_LightweightM2M_1_1_int_306(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
625 with leshan.get_event_stream(endpoint) as events:
633 def test_LightweightM2M_1_1_int_307(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
635 leshan.write(endpoint, '1/0/23', True)
638 leshan.write(endpoint, '1/0/23', False)
644 def test_LightweightM2M_1_1_int_308(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
665 assert leshan.create_obj_instance(endpoint, '16/0', resources_a)['status'] == 'CREATED(201)'
667 …assert leshan.write_attributes(endpoint, '16/0', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(2…
668 data = leshan.composite_observe(endpoint, ['/16/0', '/16/1'])
670 with leshan.get_event_stream(endpoint, timeout=50) as events:
674 assert leshan.create_obj_instance(endpoint, '16/1', resources_b)['status'] == 'CREATED(201)'
679 leshan.cancel_composite_observe(endpoint, ['/16/0', '/16/1'])
683 leshan.remove_attributes(endpoint, '16/0', ['pmin','pmax'])
686 def test_LightweightM2M_1_1_int_309(shell: Shell, dut: DeviceAdapter, leshan: Leshan, endpoint: str…
707 assert leshan.create_obj_instance(endpoint, '16/0', resources_a)['status'] == 'CREATED(201)'
708 assert leshan.create_obj_instance(endpoint, '16/1', resources_b)['status'] == 'CREATED(201)'
710 …assert leshan.write_attributes(endpoint, '16/0', {'pmin': 30, 'pmax': 45})['status'] == 'CHANGED(2…
711 data = leshan.composite_observe(endpoint, ['/16/0', '/16/1'])
713 with leshan.get_event_stream(endpoint, timeout=50) as events:
717 assert leshan.delete(endpoint, '16/1')['status'] == 'DELETED(202)'
722 leshan.cancel_composite_observe(endpoint, ['/16/0', '/16/1'])
726 leshan.remove_attributes(endpoint, '16/0', ['pmin', 'pmax'])
729 def test_LightweightM2M_1_1_int_310(shell: Shell, leshan: Leshan, endpoint: str):
734 leshan.composite_observe(endpoint, ['/1/0/1', '/3/0'])
735 with leshan.get_event_stream(endpoint, timeout=50) as events:
736 assert leshan.write_attributes(endpoint, '3', {'pmax': 5})['status'] == 'CHANGED(204)'
745 leshan.cancel_composite_observe(endpoint, ['/1/0/1', '/3/0'])
749 leshan.remove_attributes(endpoint, '3', ['pmax'])
751 def test_LightweightM2M_1_1_int_311(shell: Shell, leshan: Leshan, endpoint: str):
753 with leshan.get_event_stream(endpoint, timeout=50) as events: