/
test_platform_agent_with_rsn.py
656 lines (501 loc) · 22.8 KB
/
test_platform_agent_with_rsn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
#!/usr/bin/env python
"""
@package ion.agents.platform.test.test_platform_agent_with_rsn
@file ion/agents/platform/test/test_platform_agent_with_rsn.py
@author Carlos Rueda
@brief Test cases for platform agent interacting with RSN
"""
__author__ = 'Carlos Rueda'
__license__ = 'Apache 2.0'
# The following can be prefixed with PLAT_NETWORK=single to exercise the tests
# with a single platform (with no sub-platforms). Otherwise a small network is
# used. See HelperTestMixin.
#
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_capabilities
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_some_state_transitions
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_get_set_resources
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_some_commands
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_resource_monitoring
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_external_event_dispatch
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_connect_disconnect_instrument
# bin/nosetests -sv ion/agents/platform/test/test_platform_agent_with_rsn.py:TestPlatformAgent.test_check_sync
#
from pyon.public import log
from pyon.util.containers import get_ion_ts
from interface.objects import AgentCommand
from interface.objects import CapabilityType
from interface.objects import AgentCapability
from ion.agents.platform.platform_agent import PlatformAgentState
from ion.agents.platform.platform_agent import PlatformAgentEvent
from ion.agents.platform.responses import NormalResponse
from ion.agents.platform.test.base_test_platform_agent_with_rsn import BaseIntTestPlatform
from mock import patch
from pyon.public import CFG
@patch.dict(CFG, {'endpoint': {'receive': {'timeout': 180}}})
class TestPlatformAgent(BaseIntTestPlatform):
def _create_network_and_start_root_platform(self):
"""
Call this at the beginning of each test. We need to make sure that
the patched timeout is in effect for the actions performed here.
@note this used to be done in setUp, but the patch.dict mechanism does
*not* take effect in setUp!
"""
# NOTE The tests expect to use values set up by HelperTestMixin for
# for the following networks (see ion/agents/platform/test/helper.py)
if self.PLATFORM_ID == 'Node1D':
self.p_root = self._create_small_hierarchy()
elif self.PLATFORM_ID == 'LJ01D':
self.p_root = self._create_single_platform()
else:
self.fail("self.PLATFORM_ID expected to be one of: 'Node1D', 'LJ01D'")
self._start_platform(self.p_root.platform_agent_instance_id)
def tearDown(self):
self._stop_platform(self.p_root.platform_agent_instance_id)
super(TestPlatformAgent, self).tearDown()
def _connect_instrument(self):
#
# TODO more realistic settings for the connection
#
port_id = self.PORT_ID
instrument_id = self.INSTRUMENT_ID
instrument_attributes = self.INSTRUMENT_ATTRIBUTES_AND_VALUES
kwargs = dict(
port_id = port_id,
instrument_id = instrument_id,
attributes = instrument_attributes
)
cmd = AgentCommand(command=PlatformAgentEvent.CONNECT_INSTRUMENT, kwargs=kwargs)
retval = self._execute_agent(cmd)
result = retval.result
log.info("CONNECT_INSTRUMENT = %s", result)
self.assertIsInstance(result, dict)
self.assertTrue(port_id in result)
self.assertIsInstance(result[port_id], dict)
returned_attrs = self._verify_valid_instrument_id(instrument_id, result[port_id])
if isinstance(returned_attrs, dict):
for attrName in instrument_attributes:
self.assertTrue(attrName in returned_attrs)
def _get_connected_instruments(self):
port_id = self.PORT_ID
kwargs = dict(
port_id = port_id,
)
cmd = AgentCommand(command=PlatformAgentEvent.GET_CONNECTED_INSTRUMENTS, kwargs=kwargs)
retval = self._execute_agent(cmd)
result = retval.result
log.info("GET_CONNECTED_INSTRUMENTS = %s", result)
self.assertIsInstance(result, dict)
self.assertTrue(port_id in result)
self.assertIsInstance(result[port_id], dict)
instrument_id = self.INSTRUMENT_ID
self.assertTrue(instrument_id in result[port_id])
def _disconnect_instrument(self):
# TODO real settings and corresp verification
port_id = self.PORT_ID
instrument_id = self.INSTRUMENT_ID
kwargs = dict(
port_id = port_id,
instrument_id = instrument_id
)
cmd = AgentCommand(command=PlatformAgentEvent.DISCONNECT_INSTRUMENT, kwargs=kwargs)
retval = self._execute_agent(cmd)
result = retval.result
log.info("DISCONNECT_INSTRUMENT = %s", result)
self.assertIsInstance(result, dict)
self.assertTrue(port_id in result)
self.assertIsInstance(result[port_id], dict)
self.assertTrue(instrument_id in result[port_id])
self._verify_instrument_disconnected(instrument_id, result[port_id][instrument_id])
def _turn_on_port(self):
# TODO real settings and corresp verification
port_id = self.PORT_ID
kwargs = dict(
port_id = port_id
)
cmd = AgentCommand(command=PlatformAgentEvent.TURN_ON_PORT, kwargs=kwargs)
retval = self._execute_agent(cmd)
result = retval.result
log.info("TURN_ON_PORT = %s", result)
self.assertIsInstance(result, dict)
self.assertTrue(port_id in result)
self.assertEquals(result[port_id], NormalResponse.PORT_TURNED_ON)
def _turn_off_port(self):
# TODO real settings and corresp verification
port_id = self.PORT_ID
kwargs = dict(
port_id = port_id
)
cmd = AgentCommand(command=PlatformAgentEvent.TURN_OFF_PORT, kwargs=kwargs)
retval = self._execute_agent(cmd)
result = retval.result
log.info("TURN_OFF_PORT = %s", result)
self.assertIsInstance(result, dict)
self.assertTrue(port_id in result)
self.assertEquals(result[port_id], NormalResponse.PORT_TURNED_OFF)
def _get_resource(self):
attrNames = self.ATTR_NAMES
#
# OOIION-631: use get_ion_ts() as a basis for using system time, which is
# a string.
#
cur_time = get_ion_ts()
from_time = str(int(cur_time) - 50000) # a 50-sec time window
attrs = [(attr_id, from_time) for attr_id in attrNames]
kwargs = dict(attrs=attrs)
cmd = AgentCommand(command=PlatformAgentEvent.GET_RESOURCE, kwargs=kwargs)
retval = self._execute_agent(cmd)
attr_values = retval.result
self.assertIsInstance(attr_values, dict)
for attr_name in attrNames:
self._verify_valid_attribute_id(attr_name, attr_values)
def _set_resource(self):
attrNames = self.ATTR_NAMES
writ_attrNames = self.WRITABLE_ATTR_NAMES
# do valid settings:
# TODO more realistic value depending on attribute's type
attrs = [(attrName, self.VALID_ATTR_VALUE) for attrName in attrNames]
log.info("%r: setting attributes=%s", self.PLATFORM_ID, attrs)
kwargs = dict(attrs=attrs)
cmd = AgentCommand(command=PlatformAgentEvent.SET_RESOURCE, kwargs=kwargs)
retval = self._execute_agent(cmd)
attr_values = retval.result
self.assertIsInstance(attr_values, dict)
for attrName in attrNames:
if attrName in writ_attrNames:
self._verify_valid_attribute_id(attrName, attr_values)
else:
self._verify_not_writable_attribute_id(attrName, attr_values)
# try invalid settings:
# set invalid values to writable attributes:
attrs = [(attrName, self.INVALID_ATTR_VALUE) for attrName in writ_attrNames]
log.info("%r: setting attributes=%s", self.PLATFORM_ID, attrs)
kwargs = dict(attrs=attrs)
cmd = AgentCommand(command=PlatformAgentEvent.SET_RESOURCE, kwargs=kwargs)
retval = self._execute_agent(cmd)
attr_values = retval.result
self.assertIsInstance(attr_values, dict)
for attrName in writ_attrNames:
self._verify_attribute_value_out_of_range(attrName, attr_values)
def _get_subplatform_ids(self):
cmd = AgentCommand(command=PlatformAgentEvent.GET_SUBPLATFORM_IDS)
retval = self._execute_agent(cmd)
self.assertIsInstance(retval.result, list)
self.assertTrue(x in retval.result for x in self.SUBPLATFORM_IDS)
return retval.result
def test_capabilities(self):
self._create_network_and_start_root_platform()
agt_cmds_all = [
PlatformAgentEvent.INITIALIZE,
PlatformAgentEvent.RESET,
PlatformAgentEvent.GO_ACTIVE,
PlatformAgentEvent.GO_INACTIVE,
PlatformAgentEvent.RUN,
PlatformAgentEvent.CLEAR,
PlatformAgentEvent.PAUSE,
PlatformAgentEvent.RESUME,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
PlatformAgentEvent.PING_RESOURCE,
PlatformAgentEvent.GET_RESOURCE,
PlatformAgentEvent.SET_RESOURCE,
PlatformAgentEvent.GET_METADATA,
PlatformAgentEvent.GET_PORTS,
PlatformAgentEvent.CONNECT_INSTRUMENT,
PlatformAgentEvent.DISCONNECT_INSTRUMENT,
PlatformAgentEvent.GET_CONNECTED_INSTRUMENTS,
PlatformAgentEvent.TURN_ON_PORT,
PlatformAgentEvent.TURN_OFF_PORT,
PlatformAgentEvent.GET_SUBPLATFORM_IDS,
PlatformAgentEvent.START_MONITORING,
PlatformAgentEvent.STOP_MONITORING,
PlatformAgentEvent.CHECK_SYNC,
]
def sort_caps(caps):
agt_cmds = []
agt_pars = []
res_cmds = []
res_pars = []
if len(caps)>0 and isinstance(caps[0], AgentCapability):
agt_cmds = [x.name for x in caps if x.cap_type==CapabilityType.AGT_CMD]
agt_pars = [x.name for x in caps if x.cap_type==CapabilityType.AGT_PAR]
res_cmds = [x.name for x in caps if x.cap_type==CapabilityType.RES_CMD]
res_pars = [x.name for x in caps if x.cap_type==CapabilityType.RES_PAR]
elif len(caps)>0 and isinstance(caps[0], dict):
agt_cmds = [x['name'] for x in caps if x['cap_type']==CapabilityType.AGT_CMD]
agt_pars = [x['name'] for x in caps if x['cap_type']==CapabilityType.AGT_PAR]
res_cmds = [x['name'] for x in caps if x['cap_type']==CapabilityType.RES_CMD]
res_pars = [x['name'] for x in caps if x['cap_type']==CapabilityType.RES_PAR]
return agt_cmds, agt_pars, res_cmds, res_pars
agt_pars_all = ['example'] # 'cause ResourceAgent defines aparam_example
res_pars_all = []
res_cmds_all = []
##################################################################
# UNINITIALIZED
##################################################################
self._assert_state(PlatformAgentState.UNINITIALIZED)
# Get exposed capabilities in current state.
retval = self._pa_client.get_capabilities()
# Validate capabilities for state UNINITIALIZED.
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
agt_cmds_uninitialized = [
PlatformAgentEvent.INITIALIZE,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
]
self.assertItemsEqual(agt_cmds, agt_cmds_uninitialized)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, [])
self.assertItemsEqual(res_pars, [])
# Get exposed capabilities in all states.
retval = self._pa_client.get_capabilities(current_state=False)
# Validate all capabilities as read from state UNINITIALIZED.
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
self.assertItemsEqual(agt_cmds, agt_cmds_all)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, [])
self.assertItemsEqual(res_pars, [])
##################################################################
# INACTIVE
##################################################################
self._initialize()
# Get exposed capabilities in current state.
retval = self._pa_client.get_capabilities()
# Validate capabilities for state INACTIVE.
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
agt_cmds_inactive = [
PlatformAgentEvent.RESET,
PlatformAgentEvent.GET_METADATA,
PlatformAgentEvent.GET_PORTS,
PlatformAgentEvent.GET_SUBPLATFORM_IDS,
PlatformAgentEvent.GO_ACTIVE,
PlatformAgentEvent.PING_RESOURCE,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
]
self.assertItemsEqual(agt_cmds, agt_cmds_inactive)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, [])
self.assertItemsEqual(res_pars, [])
# Get exposed capabilities in all states.
retval = self._pa_client.get_capabilities(False)
# Validate all capabilities as read from state INACTIVE.
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
self.assertItemsEqual(agt_cmds, agt_cmds_all)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, [])
self.assertItemsEqual(res_pars, [])
##################################################################
# IDLE
##################################################################
self._go_active()
# Get exposed capabilities in current state.
retval = self._pa_client.get_capabilities()
# Validate capabilities for state IDLE.
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
agt_cmds_idle = [
PlatformAgentEvent.RESET,
PlatformAgentEvent.GO_INACTIVE,
PlatformAgentEvent.RUN,
PlatformAgentEvent.PING_RESOURCE,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
]
self.assertItemsEqual(agt_cmds, agt_cmds_idle)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, [])
self.assertItemsEqual(res_pars, [])
# Get exposed capabilities in all states as read from IDLE.
retval = self._pa_client.get_capabilities(False)
# Validate all capabilities as read from state IDLE.
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
self.assertItemsEqual(agt_cmds, agt_cmds_all)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, [])
self.assertItemsEqual(res_pars, [])
##################################################################
# COMMAND
##################################################################
self._run()
# Get exposed capabilities in current state.
retval = self._pa_client.get_capabilities()
# Validate capabilities of state COMMAND
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
agt_cmds_command = [
PlatformAgentEvent.GO_INACTIVE,
PlatformAgentEvent.RESET,
PlatformAgentEvent.PAUSE,
PlatformAgentEvent.CLEAR,
PlatformAgentEvent.GET_METADATA,
PlatformAgentEvent.GET_PORTS,
PlatformAgentEvent.CONNECT_INSTRUMENT,
PlatformAgentEvent.DISCONNECT_INSTRUMENT,
PlatformAgentEvent.GET_CONNECTED_INSTRUMENTS,
PlatformAgentEvent.TURN_ON_PORT,
PlatformAgentEvent.TURN_OFF_PORT,
PlatformAgentEvent.GET_SUBPLATFORM_IDS,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
PlatformAgentEvent.PING_RESOURCE,
PlatformAgentEvent.GET_RESOURCE,
PlatformAgentEvent.SET_RESOURCE,
PlatformAgentEvent.START_MONITORING,
PlatformAgentEvent.CHECK_SYNC,
]
res_cmds_command = [
]
self.assertItemsEqual(agt_cmds, agt_cmds_command)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, res_cmds_command)
self.assertItemsEqual(res_pars, res_pars_all)
##################################################################
# STOPPED
##################################################################
self._pause()
# Get exposed capabilities in current state.
retval = self._pa_client.get_capabilities()
# Validate capabilities of state STOPPED
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
agt_cmds_stopped = [
PlatformAgentEvent.RESUME,
PlatformAgentEvent.CLEAR,
PlatformAgentEvent.PING_RESOURCE,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
]
res_cmds_command = [
]
self.assertItemsEqual(agt_cmds, agt_cmds_stopped)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, res_cmds_command)
self.assertItemsEqual(res_pars, res_pars_all)
# back to COMMAND:
self._resume()
##################################################################
# MONITORING
##################################################################
self._start_resource_monitoring()
# Get exposed capabilities in current state.
retval = self._pa_client.get_capabilities()
# Validate capabilities of state MONITORING
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
agt_cmds_monitoring = [
PlatformAgentEvent.RESET,
PlatformAgentEvent.GET_METADATA,
PlatformAgentEvent.GET_PORTS,
PlatformAgentEvent.CONNECT_INSTRUMENT,
PlatformAgentEvent.DISCONNECT_INSTRUMENT,
PlatformAgentEvent.GET_CONNECTED_INSTRUMENTS,
PlatformAgentEvent.TURN_ON_PORT,
PlatformAgentEvent.TURN_OFF_PORT,
PlatformAgentEvent.GET_SUBPLATFORM_IDS,
PlatformAgentEvent.GET_RESOURCE_CAPABILITIES,
PlatformAgentEvent.PING_RESOURCE,
PlatformAgentEvent.GET_RESOURCE,
PlatformAgentEvent.SET_RESOURCE,
PlatformAgentEvent.STOP_MONITORING,
PlatformAgentEvent.CHECK_SYNC,
]
res_cmds_command = [
]
self.assertItemsEqual(agt_cmds, agt_cmds_monitoring)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, res_cmds_command)
self.assertItemsEqual(res_pars, res_pars_all)
# return to COMMAND state:
self._stop_resource_monitoring()
###################
# ALL CAPABILITIES
###################
# Get exposed capabilities in all states as read from state COMMAND.
retval = self._pa_client.get_capabilities(False)
# Validate all capabilities as read from state COMMAND
agt_cmds, agt_pars, res_cmds, res_pars = sort_caps(retval)
self.assertItemsEqual(agt_cmds, agt_cmds_all)
self.assertItemsEqual(agt_pars, agt_pars_all)
self.assertItemsEqual(res_cmds, res_cmds_all)
self.assertItemsEqual(res_pars, res_pars_all)
self._go_inactive()
self._reset()
def test_some_state_transitions(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._initialize() # -> INACTIVE
self._reset() # -> UNINITIALIZED
self._initialize() # -> INACTIVE
self._go_active() # -> IDLE
self._reset() # -> UNINITIALIZED
self._initialize() # -> INACTIVE
self._go_active() # -> IDLE
self._run() # -> COMMAND
self._pause() # -> STOPPED
self._resume() # -> COMMAND
self._reset() # -> UNINITIALIZED
def test_get_set_resources(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._ping_agent()
self._initialize()
self._go_active()
self._run()
self._get_resource()
self._set_resource()
self._go_inactive()
self._reset()
def test_some_commands(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._ping_agent()
self._initialize()
self._go_active()
self._run()
self._ping_agent()
self._ping_resource()
self._get_metadata()
self._get_ports()
self._get_subplatform_ids()
self._go_inactive()
self._reset()
def test_resource_monitoring(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._ping_agent()
self._initialize()
self._go_active()
self._run()
self._start_resource_monitoring()
self._wait_for_a_data_sample()
self._stop_resource_monitoring()
self._go_inactive()
self._reset()
def test_external_event_dispatch(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._ping_agent()
self._initialize()
self._go_active()
self._run()
self._wait_for_external_event()
self._go_inactive()
self._reset()
def test_connect_disconnect_instrument(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._ping_agent()
self._initialize()
self._go_active()
self._run()
self._connect_instrument()
self._turn_on_port()
self._get_connected_instruments()
self._turn_off_port()
self._disconnect_instrument()
self._go_inactive()
self._reset()
def test_check_sync(self):
self._create_network_and_start_root_platform()
self._assert_state(PlatformAgentState.UNINITIALIZED)
self._ping_agent()
self._initialize()
self._go_active()
self._run()
self._check_sync()
self._connect_instrument()
self._check_sync()
self._disconnect_instrument()
self._check_sync()
self._go_inactive()
self._reset()