-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtest_SM_at_remote.py
More file actions
92 lines (77 loc) · 3.32 KB
/
test_SM_at_remote.py
File metadata and controls
92 lines (77 loc) · 3.32 KB
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
__author__ = 'Grzegorz Latuszek, Marcin Usielski'
__copyright__ = 'Copyright (C) 2020-2026, Nokia'
__email__ = 'grzegorz.latuszek@nokia.com, marcin.usielski@nokia.com'
import pytest
from moler.util.devices_SM import get_memory_device_connection, iterate_over_device_states, moler_check_sm_identity, DeviceCM
at_remotes = ["AT_REMOTE", "AT_REMOTE3"]
at_remotes_proxy_pc = ["AT_REMOTE_PROXY_PC", "AT_REMOTE_PROXY_PC3"]
@pytest.mark.parametrize("device_name", at_remotes)
def test_at_remote_device(device_name, device_connection, at_remote_output):
with DeviceCM(name=device_name, connection=device_connection, device_output=at_remote_output,
test_file_path=__file__) as at_remote:
iterate_over_device_states(device=at_remote)
@pytest.mark.parametrize("device_name", at_remotes_proxy_pc)
def test_at_remote_device_proxy_pc(device_name, device_connection, at_remote_output_proxy_pc):
with DeviceCM(name=device_name, connection=device_connection, device_output=at_remote_output_proxy_pc,
test_file_path=__file__) as at_remote:
iterate_over_device_states(device=at_remote)
@pytest.mark.parametrize("devices", [at_remotes_proxy_pc, at_remotes])
def test_unix_sm_identity(devices, device_connection, at_remote_output):
assert len(devices) == 2
with DeviceCM(name=devices[0], connection=device_connection, device_output=at_remote_output,
test_file_path=__file__) as dev0:
with DeviceCM(name=devices[1], connection=get_memory_device_connection(), device_output=at_remote_output,
test_file_path=__file__) as dev1:
moler_check_sm_identity([dev0, dev1])
@pytest.fixture
def at_remote_output():
plink_cmd_string = 'plink -serial COM5 |& awk \'BEGIN {print "COM5> port READY"} {print} END {print "^C"}\''
output = {
"UNIX_LOCAL": {
'TERM=xterm-mono ssh -l remote_login -o ServerAliveInterval=7 -o ServerAliveCountMax=2 remote_host': 'remote#',
'su': 'local_root_prompt'
},
"UNIX_LOCAL_ROOT": {
'exit': 'moler_bash#'
},
"UNIX_REMOTE": {
'exit': 'moler_bash#',
'su': 'remote_root_prompt',
plink_cmd_string: 'COM5>'
},
"AT_REMOTE": {
'\x03': '^C\nremote#',
},
"UNIX_REMOTE_ROOT": {
'exit': 'remote#',
},
}
return output
@pytest.fixture
def at_remote_output_proxy_pc():
plink_cmd_string = 'plink -serial COM5 |& awk \'BEGIN {print "COM5> port READY"} {print} END {print "^C"}\''
output = {
"UNIX_LOCAL": {
'TERM=xterm-mono ssh -l proxy_pc_login -o ServerAliveInterval=7 -o ServerAliveCountMax=2 proxy_pc_host': 'proxy_pc#',
'su': 'local_root_prompt'
},
"PROXY_PC": {
'TERM=xterm-mono ssh -l remote_login -o ServerAliveInterval=7 -o ServerAliveCountMax=2 remote_host': 'remote#',
'exit': 'moler_bash#',
},
"UNIX_LOCAL_ROOT": {
'exit': 'moler_bash#'
},
"UNIX_REMOTE": {
'exit': 'proxy_pc#',
'su': 'remote_root_prompt',
plink_cmd_string: 'COM5>'
},
"AT_REMOTE": {
'\x03': '^C\nremote#',
},
"UNIX_REMOTE_ROOT": {
'exit': 'remote#',
},
}
return output