rsmp-validator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/config/cross_rs4s.yaml +55 -0
- data/config/gem_supervisor.yaml +56 -0
- data/config/gem_tlc.yaml +56 -0
- data/config/gem_tlc_secrets.yaml +3 -0
- data/config/kapsch_etx.yaml +54 -0
- data/config/lightmotion_satellite.yaml +56 -0
- data/config/secrets.yaml +3 -0
- data/config/secrets_example.yaml +6 -0
- data/config/semaforica_cartesio.yaml +56 -0
- data/config/simulator/node_log.yaml +17 -0
- data/config/simulator/supervisor.yaml +11 -0
- data/config/simulator/tlc.yaml +56 -0
- data/config/sus.rb +13 -0
- data/config/swarco_itc3.yaml +55 -0
- data/config/tecsen_tmacs_supervisor.yaml +57 -0
- data/config/validator.rb +37 -0
- data/config/validator.yaml +5 -0
- data/config/validator_example.yaml +23 -0
- data/config/validator_log.yaml +19 -0
- data/exe/rsmp-validator +121 -0
- data/lib/doc_gen/parser.rb +276 -0
- data/lib/doc_gen/renderer.rb +153 -0
- data/lib/rsmp/validator/async_context.rb +15 -0
- data/lib/rsmp/validator/auto_node.rb +82 -0
- data/lib/rsmp/validator/auto_site.rb +30 -0
- data/lib/rsmp/validator/auto_supervisor.rb +23 -0
- data/lib/rsmp/validator/config_normalizer.rb +103 -0
- data/lib/rsmp/validator/configuration/loader.rb +79 -0
- data/lib/rsmp/validator/configuration/secrets.rb +54 -0
- data/lib/rsmp/validator/configuration/validation.rb +115 -0
- data/lib/rsmp/validator/configuration.rb +129 -0
- data/lib/rsmp/validator/helpers/alarms.rb +66 -0
- data/lib/rsmp/validator/helpers/clock.rb +16 -0
- data/lib/rsmp/validator/helpers/connection.rb +73 -0
- data/lib/rsmp/validator/helpers/handshake.rb +110 -0
- data/lib/rsmp/validator/helpers/input.rb +42 -0
- data/lib/rsmp/validator/helpers/security.rb +26 -0
- data/lib/rsmp/validator/helpers/signal_plans.rb +37 -0
- data/lib/rsmp/validator/helpers/signal_priority.rb +130 -0
- data/lib/rsmp/validator/helpers/startup.rb +157 -0
- data/lib/rsmp/validator/helpers/status.rb +22 -0
- data/lib/rsmp/validator/lifecycle.rb +99 -0
- data/lib/rsmp/validator/log.rb +11 -0
- data/lib/rsmp/validator/mode_detection.rb +84 -0
- data/lib/rsmp/validator/options/site_test_options.rb +58 -0
- data/lib/rsmp/validator/options/supervisor_test_options.rb +51 -0
- data/lib/rsmp/validator/site_tester.rb +113 -0
- data/lib/rsmp/validator/supervisor_tester.rb +76 -0
- data/lib/rsmp/validator/tester.rb +101 -0
- data/lib/rsmp/validator/version.rb +5 -0
- data/lib/rsmp/validator/version_filter.rb +44 -0
- data/lib/rsmp/validator.rb +50 -0
- data/schemas/site_test.json +36 -0
- data/schemas/supervisor_test.json +28 -0
- data/test/site/core/aggregated_status_spec.rb +43 -0
- data/test/site/core/connect_spec.rb +104 -0
- data/test/site/core/core_spec.rb +9 -0
- data/test/site/core/disconnect_spec.rb +54 -0
- data/test/site/site_spec.rb +5 -0
- data/test/site/tlc/alarm_spec.rb +134 -0
- data/test/site/tlc/clock_spec.rb +252 -0
- data/test/site/tlc/detector_logics_spec.rb +76 -0
- data/test/site/tlc/emergency_routes_spec.rb +106 -0
- data/test/site/tlc/input_spec.rb +102 -0
- data/test/site/tlc/invalid_command_spec.rb +103 -0
- data/test/site/tlc/invalid_status_spec.rb +70 -0
- data/test/site/tlc/modes_spec.rb +260 -0
- data/test/site/tlc/output_spec.rb +58 -0
- data/test/site/tlc/signal_groups_spec.rb +96 -0
- data/test/site/tlc/signal_plans_spec.rb +287 -0
- data/test/site/tlc/signal_priority_spec.rb +144 -0
- data/test/site/tlc/subscribe_spec.rb +71 -0
- data/test/site/tlc/system_spec.rb +76 -0
- data/test/site/tlc/tlc_spec.rb +7 -0
- data/test/site/tlc/traffic_data_spec.rb +151 -0
- data/test/site/tlc/traffic_situations_spec.rb +50 -0
- data/test/supervisor/aggregated_status_spec.rb +18 -0
- data/test/supervisor/connect_spec.rb +219 -0
- data/test/supervisor/supervisor_spec.rb +11 -0
- metadata +190 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
describe 'Site::Tlc::System' do
|
|
2
|
+
include RSMP::Validator::Helpers::Security
|
|
3
|
+
|
|
4
|
+
# Verify status S0091 operator logged in/out OP-panel
|
|
5
|
+
#
|
|
6
|
+
# 1. Given the site_proxy is connected
|
|
7
|
+
# 2. Request status
|
|
8
|
+
# 3. Expect status response before timeout
|
|
9
|
+
it 'operator logged in/out of OP-panel is read with S0091' do
|
|
10
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
11
|
+
status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
|
|
12
|
+
{ S0091: [:user] }
|
|
13
|
+
else
|
|
14
|
+
{ S0091: %i[user status] }
|
|
15
|
+
end
|
|
16
|
+
site_proxy.request_status_and_collect(status_list,
|
|
17
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Verify status S0092 operator logged in/out web-interface
|
|
22
|
+
#
|
|
23
|
+
# 1. Given the site_proxy is connected
|
|
24
|
+
# 2. Request status
|
|
25
|
+
# 3. Expect status response before timeout
|
|
26
|
+
it 'operator logged in/out of web-interface is read with S0092' do
|
|
27
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
28
|
+
status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
|
|
29
|
+
{ S0092: [:user] }
|
|
30
|
+
else
|
|
31
|
+
{ S0092: %i[user status] }
|
|
32
|
+
end
|
|
33
|
+
site_proxy.request_status_and_collect(status_list,
|
|
34
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Verify status S0095 version of traffic controller
|
|
39
|
+
#
|
|
40
|
+
# 1. Given the site_proxy is connected
|
|
41
|
+
# 2. Request status
|
|
42
|
+
# 3. Expect status response before timeout
|
|
43
|
+
it 'version is read with S0095' do
|
|
44
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
45
|
+
site_proxy.request_status_and_collect({ S0095: [:status] },
|
|
46
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# 1. Verify connection
|
|
51
|
+
# 2. Send control command to set securitycode_level
|
|
52
|
+
# 3. Wait for status = true
|
|
53
|
+
# 4. Send control command to setsecuritycode_level
|
|
54
|
+
# 5. Wait for status = true
|
|
55
|
+
it 'security code is set with M0103' do
|
|
56
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
57
|
+
code1 = RSMP::Validator.get_config('secrets', 'security_codes', 1)
|
|
58
|
+
code2 = RSMP::Validator.get_config('secrets', 'security_codes', 2)
|
|
59
|
+
timeout = RSMP::Validator.get_config('timeouts', 'command_response')
|
|
60
|
+
site_proxy.tlc.set_security_code(level: 'Level1', old_code: code1, new_code: code1, within: timeout)
|
|
61
|
+
site_proxy.tlc.set_security_code(level: 'Level2', old_code: code2, new_code: code2, within: timeout)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Verify that the site_proxy responds with NotAck if we send incorrect security cdoes.
|
|
66
|
+
# RThis hehaviour is defined in SXL >= 1.1. For earlier versions,
|
|
67
|
+
# The behaviour is undefined.
|
|
68
|
+
# 1. Given the site_proxy is connected
|
|
69
|
+
# 2. When we send a M0008 command with incorrect security codes
|
|
70
|
+
# 3. Then we should received a NotAck
|
|
71
|
+
it 'security code is rejected when incorrect' do
|
|
72
|
+
with_site(:connected, sxl: '>=1.1') do |site_proxy|
|
|
73
|
+
expect { wrong_security_code(site_proxy) }.to raise_exception(RSMP::MessageRejected)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
describe 'Site::Tlc::TrafficData' do
|
|
2
|
+
include RSMP::Validator::Helpers::Status
|
|
3
|
+
|
|
4
|
+
# Verify status S0201 traffic counting: number of vehicles
|
|
5
|
+
#
|
|
6
|
+
# 1. Given the site_proxy is connected
|
|
7
|
+
# 2. Request status
|
|
8
|
+
# 3. Expect status response before timeout
|
|
9
|
+
it 'number of vehicles for a single detector is read with S0201' do
|
|
10
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
11
|
+
component = RSMP::Validator.get_config('components', 'detector_logic').keys.first
|
|
12
|
+
site_proxy.request_status_and_collect(
|
|
13
|
+
{ S0201: %i[starttime vehicles] },
|
|
14
|
+
component: component,
|
|
15
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')
|
|
16
|
+
).ok!
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Verify status S0205 traffic counting: number of vehicles
|
|
21
|
+
#
|
|
22
|
+
# 1. Given the site_proxy is connected
|
|
23
|
+
# 2. Request status
|
|
24
|
+
# 3. Expect status response before timeout
|
|
25
|
+
it 'number of vehicles for all detectors is read with S0205' do
|
|
26
|
+
with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
|
|
27
|
+
site_proxy.request_status_and_collect({ S0205: %i[start vehicles] },
|
|
28
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Verify status S0202 traffic counting: vehicle speed
|
|
33
|
+
#
|
|
34
|
+
# 1. Given the site_proxy is connected
|
|
35
|
+
# 2. Request status
|
|
36
|
+
# 3. Expect status response before timeout
|
|
37
|
+
it 'vehicle speed for a single detector is read with S0202' do
|
|
38
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
39
|
+
component = RSMP::Validator.get_config('components', 'detector_logic').keys.first
|
|
40
|
+
site_proxy.request_status_and_collect(
|
|
41
|
+
{ S0202: %i[starttime speed] },
|
|
42
|
+
component: component,
|
|
43
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')
|
|
44
|
+
).ok!
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Verify status S0206 traffic counting: vehicle speed
|
|
49
|
+
#
|
|
50
|
+
# 1. Given the site_proxy is connected
|
|
51
|
+
# 2. Request status
|
|
52
|
+
# 3. Expect status response before timeout
|
|
53
|
+
it 'vehicle speed for all detectors is read with S0206' do
|
|
54
|
+
with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
|
|
55
|
+
site_proxy.request_status_and_collect({ S0206: %i[start speed] },
|
|
56
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Verify status S0203 traffic counting: occupancy
|
|
61
|
+
#
|
|
62
|
+
# 1. Given the site_proxy is connected
|
|
63
|
+
# 2. Request status
|
|
64
|
+
# 3. Expect status response before timeout
|
|
65
|
+
it 'occupancy for a single detector is read with S0203' do
|
|
66
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
67
|
+
component = RSMP::Validator.get_config('components', 'detector_logic').keys.first
|
|
68
|
+
site_proxy.request_status_and_collect(
|
|
69
|
+
{ S0203: %i[starttime occupancy] },
|
|
70
|
+
component: component,
|
|
71
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')
|
|
72
|
+
).ok!
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Verify status S0207 traffic counting: occupancy
|
|
77
|
+
#
|
|
78
|
+
# 1. Given the site_proxy is connected
|
|
79
|
+
# 2. Request status
|
|
80
|
+
# 3. Expect status response before timeout
|
|
81
|
+
it 'occupancy for all detectors is read with S0207' do
|
|
82
|
+
with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
|
|
83
|
+
result = wait_for_status(site_proxy, 'traffic counting: occupancy',
|
|
84
|
+
{ S0207: %i[start occupancy] },
|
|
85
|
+
update_rate: 60)
|
|
86
|
+
|
|
87
|
+
occupancies = result.matcher_got_hash.dig('S0207', 'occupancy')
|
|
88
|
+
start = result.matcher_got_hash.dig('S0207', 'start')
|
|
89
|
+
|
|
90
|
+
expect(occupancies).to be_a(String)
|
|
91
|
+
expect(start).to be_a(String)
|
|
92
|
+
|
|
93
|
+
occupancies.split(',').each do |occupancy|
|
|
94
|
+
num = occupancy.to_i
|
|
95
|
+
assert((-1..100).cover?(num), "Occupancy must be in the range -1..100, got #{num}")
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Verify status S0204 traffic counting: classification
|
|
101
|
+
#
|
|
102
|
+
# 1. Given the site_proxy is connected
|
|
103
|
+
# 2. Request status
|
|
104
|
+
# 3. Expect status response before timeout
|
|
105
|
+
it 'classification for a single detector is read with S0204' do
|
|
106
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
107
|
+
component = RSMP::Validator.get_config('components', 'detector_logic').keys.first
|
|
108
|
+
site_proxy.request_status_and_collect(
|
|
109
|
+
{ S0204: %i[
|
|
110
|
+
starttime
|
|
111
|
+
P
|
|
112
|
+
PS
|
|
113
|
+
L
|
|
114
|
+
LS
|
|
115
|
+
B
|
|
116
|
+
SP
|
|
117
|
+
MC
|
|
118
|
+
C
|
|
119
|
+
F
|
|
120
|
+
] },
|
|
121
|
+
component: component,
|
|
122
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')
|
|
123
|
+
).ok!
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Verify status S0208 traffic counting: classification
|
|
128
|
+
#
|
|
129
|
+
# 1. Given the site_proxy is connected
|
|
130
|
+
# 2. Request status
|
|
131
|
+
# 3. Expect status response before timeout
|
|
132
|
+
it 'classification for all detectors is read with S0208' do
|
|
133
|
+
with_site(:connected, sxl: '>=1.0.14') do |site_proxy|
|
|
134
|
+
site_proxy.request_status_and_collect(
|
|
135
|
+
{ S0208: %i[
|
|
136
|
+
start
|
|
137
|
+
P
|
|
138
|
+
PS
|
|
139
|
+
L
|
|
140
|
+
LS
|
|
141
|
+
B
|
|
142
|
+
SP
|
|
143
|
+
MC
|
|
144
|
+
C
|
|
145
|
+
F
|
|
146
|
+
] },
|
|
147
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')
|
|
148
|
+
).ok!
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
describe 'Site::Tlc::TrafficSituations' do
|
|
2
|
+
# Verify status S0015 current traffic situation
|
|
3
|
+
#
|
|
4
|
+
# 1. Given the site_proxy is connected
|
|
5
|
+
# 2. Request status
|
|
6
|
+
# 3. Expect status response before timeout
|
|
7
|
+
it 'is read with S0015' do
|
|
8
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
9
|
+
status_list = if RSMP::Proxy.version_meets_requirement?(site_proxy.sxl_version, '>=1.1')
|
|
10
|
+
{ S0015: %i[status source] }
|
|
11
|
+
else
|
|
12
|
+
{ S0015: [:status] }
|
|
13
|
+
end
|
|
14
|
+
site_proxy.request_status_and_collect(status_list,
|
|
15
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Verify that we change traffic situation
|
|
20
|
+
#
|
|
21
|
+
# 1. Given the site_proxy is connected
|
|
22
|
+
# 2. Verify that there is a RSMP::Validator.get_config('validator') with a traffic situation
|
|
23
|
+
# 3. Send the control command to switch traffic situation for each traffic situation
|
|
24
|
+
# 4. Wait for status "Current traffic situation" = requested traffic situation
|
|
25
|
+
it 'is set with M0003' do
|
|
26
|
+
skip 'requires sxl >= 1.0.7' unless RSMP::Validator.sxl_matches?('>=1.0.7')
|
|
27
|
+
situations = RSMP::Validator.get_config('items', 'traffic_situations')
|
|
28
|
+
skip('No traffic situations configured') if situations.nil? || situations.empty?
|
|
29
|
+
timeout = RSMP::Validator.get_config('timeouts', 'command')
|
|
30
|
+
with_site(:connected) do |site_proxy|
|
|
31
|
+
situations.each do |traffic_situation|
|
|
32
|
+
assert site_proxy.tlc.set_traffic_situation(traffic_situation.to_s, within: timeout)
|
|
33
|
+
end
|
|
34
|
+
ensure
|
|
35
|
+
site_proxy.tlc.unset_traffic_situation(within: timeout)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Verify status S0019 number of traffic situations
|
|
40
|
+
#
|
|
41
|
+
# 1. Given the site_proxy is connected
|
|
42
|
+
# 2. Request status
|
|
43
|
+
# 3. Expect status response before timeout
|
|
44
|
+
it 'list size is read with S0019' do
|
|
45
|
+
with_site(:connected, sxl: '>=1.0.7') do |site_proxy|
|
|
46
|
+
site_proxy.request_status_and_collect({ S0019: [:number] },
|
|
47
|
+
within: RSMP::Validator.get_config('timeouts', 'status_response')).ok!
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
describe 'Supervisor' do
|
|
2
|
+
# Validate behaviour related to aggregated status messages
|
|
3
|
+
describe 'Aggregated Status' do
|
|
4
|
+
# Validate that the supervisor responds correctly when we send an aggregated status message
|
|
5
|
+
it 'receives aggregated status' do
|
|
6
|
+
with_supervisor(:connected) do |supervisor_proxy|
|
|
7
|
+
component = supervisor_proxy.node.find_component RSMP::Validator.get_config('main_component')
|
|
8
|
+
|
|
9
|
+
# setting ':collect' will cause set_aggregated_status() to wait for the
|
|
10
|
+
# outgoing aggregated status is acknowledged
|
|
11
|
+
component.set_aggregated_status :high_priority_alarm, collect!: {
|
|
12
|
+
timeout: RSMP::Validator.get_config('timeouts', 'acknowledgement'),
|
|
13
|
+
num: 1
|
|
14
|
+
}
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
describe 'Supervisor' do
|
|
2
|
+
describe 'Connection Sequence' do
|
|
3
|
+
def connection_collect_options(timeout, length)
|
|
4
|
+
{
|
|
5
|
+
timeout: timeout,
|
|
6
|
+
num: length,
|
|
7
|
+
ingoing: true,
|
|
8
|
+
outgoing: true
|
|
9
|
+
}
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def prepare_and_wait_for_collector(supervisor_proxy)
|
|
13
|
+
collector = supervisor_proxy.collector
|
|
14
|
+
collector.use_task Async::Task.current
|
|
15
|
+
collector.wait!
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def direction_and_type_pairs(messages)
|
|
19
|
+
messages.map { |message| [message.direction.to_s, message.type] }
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def get_connection_message(core_version, length)
|
|
23
|
+
timeout = RSMP::Validator.get_config('timeouts', 'ready')
|
|
24
|
+
got_messages = nil
|
|
25
|
+
with_supervisor(:isolated,
|
|
26
|
+
'rsmp_versions' => [core_version],
|
|
27
|
+
'collect' => {
|
|
28
|
+
**connection_collect_options(timeout, length)
|
|
29
|
+
}) do |supervisor_proxy|
|
|
30
|
+
prepare_and_wait_for_collector(supervisor_proxy)
|
|
31
|
+
assert(supervisor_proxy.ready?, 'expected site proxy to be ready')
|
|
32
|
+
got_messages = supervisor_proxy.collector.messages
|
|
33
|
+
end
|
|
34
|
+
direction_and_type_pairs(got_messages)
|
|
35
|
+
rescue Async::TimeoutError
|
|
36
|
+
raise "Did not collect #{length} messages within #{timeout}s"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def check_sequence_v311(core_version)
|
|
40
|
+
# in earlier core version, both sides sends a Version
|
|
41
|
+
# message simulatenously. we therefore cannot expect
|
|
42
|
+
# a specific sequence
|
|
43
|
+
# but we can expect a set of messages
|
|
44
|
+
|
|
45
|
+
expected_version_messages = [
|
|
46
|
+
%w[out Version],
|
|
47
|
+
%w[in MessageAck],
|
|
48
|
+
%w[in Version],
|
|
49
|
+
%w[out MessageAck]
|
|
50
|
+
]
|
|
51
|
+
expected_watchdog_messages = [
|
|
52
|
+
%w[out Watchdog],
|
|
53
|
+
%w[in MessageAck],
|
|
54
|
+
%w[in Watchdog],
|
|
55
|
+
%w[out MessageAck]
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
length = expected_version_messages.length +
|
|
59
|
+
expected_watchdog_messages.length
|
|
60
|
+
|
|
61
|
+
got = get_connection_message core_version, length
|
|
62
|
+
got_version_messages = got[0..3]
|
|
63
|
+
got_watchdog_messages = got[4..7]
|
|
64
|
+
|
|
65
|
+
assert(expected_version_messages.all? { |e| got_version_messages.include?(e) },
|
|
66
|
+
'expected version messages not found in connection sequence')
|
|
67
|
+
assert(got_watchdog_messages.all? { |e| expected_watchdog_messages.include?(e) },
|
|
68
|
+
'unexpected watchdog messages in connection sequence')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def check_sequence_v314(version)
|
|
72
|
+
expected = [
|
|
73
|
+
%w[out Version],
|
|
74
|
+
%w[in MessageAck],
|
|
75
|
+
%w[in Version],
|
|
76
|
+
%w[out MessageAck],
|
|
77
|
+
%w[out Watchdog],
|
|
78
|
+
%w[in MessageAck],
|
|
79
|
+
%w[in Watchdog],
|
|
80
|
+
%w[out MessageAck],
|
|
81
|
+
%w[out AggregatedStatus],
|
|
82
|
+
%w[in MessageAck]
|
|
83
|
+
]
|
|
84
|
+
got = get_connection_message version, expected.length
|
|
85
|
+
expect(got).to eq(expected)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def check_sequence_v330(version)
|
|
89
|
+
expected = [
|
|
90
|
+
%w[out Version],
|
|
91
|
+
%w[in MessageAck],
|
|
92
|
+
%w[in Version],
|
|
93
|
+
%w[out MessageAck],
|
|
94
|
+
%w[out Watchdog],
|
|
95
|
+
%w[in MessageAck],
|
|
96
|
+
%w[in Watchdog],
|
|
97
|
+
%w[out MessageAck],
|
|
98
|
+
%w[out ComponentList],
|
|
99
|
+
%w[in MessageAck],
|
|
100
|
+
%w[out AggregatedStatus],
|
|
101
|
+
%w[in MessageAck]
|
|
102
|
+
]
|
|
103
|
+
got = get_connection_message version, expected.length
|
|
104
|
+
expect(got).to eq(expected)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def check_sequence(version)
|
|
108
|
+
case version
|
|
109
|
+
when '3.1.1', '3.1.2', '3.1.3'
|
|
110
|
+
check_sequence_v311 version
|
|
111
|
+
when '3.1.4', '3.1.5', '3.2', '3.2.1', '3.2.2'
|
|
112
|
+
check_sequence_v314 version
|
|
113
|
+
when '3.3.0'
|
|
114
|
+
check_sequence_v330 version
|
|
115
|
+
else
|
|
116
|
+
raise "Unkown rsmp version #{version}"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Verify the connection sequence when using rsmp core 3.1.1
|
|
121
|
+
#
|
|
122
|
+
# 1. Given the site is connected and using core 3.1.1
|
|
123
|
+
# 2. Send and receive handshake messages
|
|
124
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.1
|
|
125
|
+
# 4. Expect the connection sequence to be complete
|
|
126
|
+
it 'exchanges correct connection sequence of rsmp version 3.1.1' do
|
|
127
|
+
skip 'requires core == 3.1.1' unless RSMP::Validator.core_matches?('3.1.1')
|
|
128
|
+
check_sequence '3.1.1'
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Verify the connection sequence when using rsmp core 3.1.2
|
|
132
|
+
#
|
|
133
|
+
# 1. Given the site is connected and using core 3.1.2
|
|
134
|
+
# 2. Send and receive handshake messages
|
|
135
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.2
|
|
136
|
+
# 4. Expect the connection sequence to be complete
|
|
137
|
+
it 'exchanges correct connection sequence of rsmp version 3.1.2' do
|
|
138
|
+
skip 'requires core == 3.1.2' unless RSMP::Validator.core_matches?('3.1.2')
|
|
139
|
+
check_sequence '3.1.2'
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# Verify the connection sequence when using rsmp core 3.1.3
|
|
143
|
+
#
|
|
144
|
+
# 1. Given the site is connected and using core 3.1.3
|
|
145
|
+
# 2. Send and receive handshake messages
|
|
146
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.3
|
|
147
|
+
# 4. Expect the connection sequence to be complete
|
|
148
|
+
it 'exchanges correct connection sequence of rsmp version 3.1.3' do
|
|
149
|
+
skip 'requires core == 3.1.3' unless RSMP::Validator.core_matches?('3.1.3')
|
|
150
|
+
check_sequence '3.1.3'
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
# Verify the connection sequence when using rsmp core 3.1.4
|
|
154
|
+
#
|
|
155
|
+
# 1. Given the site is connected and using core 3.1.4
|
|
156
|
+
# 2. Send and receive handshake messages
|
|
157
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.4
|
|
158
|
+
# 4. Expect the connection sequence to be complete
|
|
159
|
+
it 'exchanges correct connection sequence of rsmp version 3.1.4' do
|
|
160
|
+
skip 'requires core == 3.1.4' unless RSMP::Validator.core_matches?('3.1.4')
|
|
161
|
+
check_sequence '3.1.4'
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Verify the connection sequence when using rsmp core 3.1.5
|
|
165
|
+
#
|
|
166
|
+
# 1. Given the site is connected and using core 3.1.5
|
|
167
|
+
# 2. Send and receive handshake messages
|
|
168
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.5
|
|
169
|
+
# 4. Expect the connection sequence to be complete
|
|
170
|
+
it 'exchanges correct connection sequence of rsmp version 3.1.5' do
|
|
171
|
+
skip 'requires core == 3.1.5' unless RSMP::Validator.core_matches?('3.1.5')
|
|
172
|
+
check_sequence '3.1.5'
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Verify the connection sequence when using rsmp core 3.2
|
|
176
|
+
#
|
|
177
|
+
# 1. Given the site is connected and using core 3.2
|
|
178
|
+
# 2. Send and receive handshake messages
|
|
179
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.5
|
|
180
|
+
# 4. Expect the connection sequence to be complete
|
|
181
|
+
it 'exchanges correct connection sequence of rsmp version 3.2' do
|
|
182
|
+
skip 'requires core == 3.2' unless RSMP::Validator.core_matches?('3.2')
|
|
183
|
+
check_sequence '3.2'
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Verify the connection sequence when using rsmp core 3.2.1
|
|
187
|
+
#
|
|
188
|
+
# 1. Given the site is connected and using core 3.2.1
|
|
189
|
+
# 2. Send and receive handshake messages
|
|
190
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.5
|
|
191
|
+
# 4. Expect the connection sequence to be complete
|
|
192
|
+
it 'exchanges correct connection sequence of rsmp version 3.2.1' do
|
|
193
|
+
skip 'requires core == 3.2.1' unless RSMP::Validator.core_matches?('3.2.1')
|
|
194
|
+
check_sequence '3.2.1'
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# Verify the connection sequence when using rsmp core 3.2.2
|
|
198
|
+
#
|
|
199
|
+
# 1. Given the site is connected and using core 3.2.2
|
|
200
|
+
# 2. Send and receive handshake messages
|
|
201
|
+
# 3. Expect the handshake messages to be in the specified sequence corresponding to version 3.1.5
|
|
202
|
+
# 4. Expect the connection sequence to be complete
|
|
203
|
+
it 'exchanges correct connection sequence of rsmp version 3.2.2' do
|
|
204
|
+
skip 'requires core == 3.2.2' unless RSMP::Validator.core_matches?('3.2.2')
|
|
205
|
+
check_sequence '3.2.2'
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Verify the connection sequence when using rsmp core 3.3.0
|
|
209
|
+
#
|
|
210
|
+
# 1. Given the site is connected and using core 3.3.0
|
|
211
|
+
# 2. Send and receive handshake messages
|
|
212
|
+
# 3. Expect the ComponentList before application traffic
|
|
213
|
+
# 4. Expect the connection sequence to be complete
|
|
214
|
+
it 'exchanges correct connection sequence of rsmp version 3.3.0' do
|
|
215
|
+
skip 'requires core == 3.3.0' unless RSMP::Validator.core_matches?('3.3.0')
|
|
216
|
+
check_sequence '3.3.0'
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Tests for RSMP supervisors.
|
|
2
|
+
# Supervisor testing is still preliminary, and only a small set of tests are available,
|
|
3
|
+
# covering just the core specification. No tests are available for specific equipment types, e.g.
|
|
4
|
+
# Traffic Light Controllers.
|
|
5
|
+
#
|
|
6
|
+
# When testing a supervisor the validator will run a local RSMP site. Because commands and status requests
|
|
7
|
+
# are initiated by the supervisor, only a limited set of tests can be automated by the validator.
|
|
8
|
+
|
|
9
|
+
describe 'Supervisor' do
|
|
10
|
+
# This group is intentionally empty, but exist so for documentation generation purposes.
|
|
11
|
+
end
|