Specifications:
»
» »
Verify that we can read input status with S0003
-
Given the site is connected
-
When we read input with S0029
-
Then we should receive a valid response
14 15 16 17
# File 'spec/site/tlc/io_spec.rb', line 14 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "input status", { S0003: [:inputstatus] } end
-
Verify that we can read input status with S0003
-
Given the site is connected
-
When we read input with S0029
-
Then we should receive a valid response
14 15 16 17
# File 'spec/site/tlc/io_spec.rb', line 14 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "input status", { S0003: [:inputstatus] } end
-
Verify that we can read forced input status with S0029
-
Given the site is connected
-
When we read input with S0029
-
Then we should receive a valid response
36 37 38 39
# File 'spec/site/tlc/io_spec.rb', line 36 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "forced input status", { S0029: [:status] } end
-
Verify that we can force input with M0019
-
Given the site is connected
-
And the input is forced off
-
When we force the input on
-
Then S0003 should show the input on
49 50 51 52 53 54 55 56 57 58 59
# File 'spec/site/tlc/io_spec.rb', line 49 Validator::Site.connected do |task,supervisor,site| prepare task, site inputs = Validator.get_config('items','inputs') skip("No inputs configured") if inputs.nil? || inputs.empty? inputs.each do |input| force_input input: input, status: 'True', value: 'False' force_input input: input, status: 'True', value: 'True' ensure force_input input: input, status: 'False', validate: false end end
-
Verify that we can activate input with M0006
-
Given the site is connected
-
When we activate input with M0006
-
Then S0003 should show the input is active
-
When we deactivate input with M0006
-
Then S0003 should show the input is inactive
70 71 72 73 74 75 76
# File 'spec/site/tlc/io_spec.rb', line 70 Validator::Site.connected do |task,supervisor,site| prepare task, site inputs = Validator.get_config('items','inputs') skip("No inputs configured") if inputs.nil? || inputs.empty? prepare task, site inputs.each { |input| switch_input input } end
-
Verify that we can acticate/deactivate a series of inputs with M0013
-
Given the site is connected
-
Send control command to set a serie of input
-
Wait for status = true
84 85 86 87 88 89 90
# File 'spec/site/tlc/io_spec.rb', line 84 Validator::Site.connected do |task,supervisor,site| prepare task, site inputs = Validator.get_config('items','inputs') skip("No inputs configured") if inputs.nil? || inputs.empty? status = "1,3,12;5,5,10" set_series_of_inputs status end
-
Verify that input sensitivity can be set with M0021
-
Given the site is connected
-
When we set sensitivity with M0021
-
Then we receive a confirmation
98 99 100 101 102
# File 'spec/site/tlc/io_spec.rb', line 98 Validator::Site.connected do |task,supervisor,site| prepare task, site status = '1-50' set_trigger_level status end
-
» »
Verify that output status can be read with S0004
-
Given the site is connected
-
When we subscribe to S0004
-
We should receive a status updated
-
And the outputstatus attribute should be a digit string
113 114 115 116 117
# File 'spec/site/tlc/io_spec.rb', line 113 Validator::Site.connected do |task,supervisor,site| prepare task, site request_status_and_confirm site, "output status", { S0004: [:outputstatus] } end
-
Verify that output status can be read with S0004
-
Given the site is connected
-
When we subscribe to S0004
-
We should receive a status updated
-
And the outputstatus attribute should be a digit string
113 114 115 116 117
# File 'spec/site/tlc/io_spec.rb', line 113 Validator::Site.connected do |task,supervisor,site| prepare task, site request_status_and_confirm site, "output status", { S0004: [:outputstatus] } end
-
Verify that forced output status can be read with S0030
-
Given the site is connected
-
Request status
-
Expect status response before timeout
138 139 140 141 142
# File 'spec/site/tlc/io_spec.rb', line 138 Validator::Site.connected do |task,supervisor,site| prepare task, site request_status_and_confirm site, "forced output status", { S0030: [:status] } end
-
Verify that output can be forced with M0020
-
Given the site is connected
-
When we force output with M0020
-
Wait for status = true
150 151 152 153 154 155 156 157 158 159 160
# File 'spec/site/tlc/io_spec.rb', line 150 Validator::Site.connected do |task,supervisor,site| prepare task, site outputs = Validator.get_config('items','outputs') skip("No outputs configured") if outputs.nil? || outputs.empty? outputs.each do |output| force_output output: output, status:'True', value:'True' force_output output: output, status:'True', value:'False' ensure force_output output: output, status:'False', validate: false end end
-
»
Validate that a detector logic fault A0302 is raises and cleared.
The test requires that the device is programmed so that the alarm is raise when a specific input is activated, as specified in the test configuration.
-
Given the site is connected
-
When we force the input to True
-
Then an alarm should be raised, with a timestamp close to now
-
When we force the input to False
-
Then the alarm issue should become inactive, with a timestamp close to now
29 30 31 32 33 34 35 36 37 38 39 40 41 42
# File 'spec/site/tlc/alarm_spec.rb', line 29 Validator::Site.connected do |task,supervisor,site| alarm_code_id = 'A0302' prepare task, site def alarm, duration=1.minute alarm_time = Time.parse(alarm.attributes["aTs"]) expect(alarm_time).to be_within(duration).of Time.now.utc end deactivated, component_id = with_alarm_activated(task, site, alarm_code_id) do |alarm,component_id| # raise alarm, by activating input alarm log "Alarm #{alarm_code_id} is now Active on component #{component_id}" end deactivated log "Alarm #{alarm_code_id} is now Inactive on component #{component_id}" end
-
Validate that an alarm can be acknowledged.
The test expects that the TLC is programmed so that an detector logic fault alarm A0302 is raised and can be acknowledged when a specific input is activated. The alarm code and input nr is read from the test configuration.
-
Given the site is connected
-
When we trigger an alarm
-
Then we should receive an unacknowledged alarm issue
-
When we acknowledge the alarm
-
Then we should recieve an acknowledged alarm issue
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
# File 'spec/site/tlc/alarm_spec.rb', line 58 Validator::Site.connected do |task,supervisor,site| prepare task, site alarm_code_id = 'A0302' # what alarm to expect timeout = Validator.get_config('timeouts','alarm') log "Activating alarm #{alarm_code_id}" deactivate, component_id = with_alarm_activated(task, site, alarm_code_id) do |alarm, component_id| # raise alarm, by activating input log "Alarm #{alarm_code_id} is now active on component #{component_id}" # verify timestamp alarm_time = Time.parse(alarm.attributes["aTs"]) expect(alarm_time).to be_within(1.minute).of Time.now.utc # test acknowledge and confirm log "Acknowledge alarm #{alarm_code_id}" collect_task = task.async do RSMP::AlarmCollector.new(site, num: 1, matcher: { 'aCId' => alarm_code_id, 'aSp' => /Acknowledge/i, 'ack' => /Acknowledged/i, 'aS' => /Active/i }, timeout: timeout ).collect! end site. RSMP::AlarmAcknowledge.new( 'cId' => component_id, 'aTs' => site.clock.to_s, 'aCId' => alarm_code_id ) = collect_task.wait expect().to be_an(Array) expect(.first).to be_a(RSMP::Alarm) end end
-
Validate that alarms can be suspended. We’re using A0302 in this test.
-
Given the site is connected
-
And the alarm is resumed
-
When we suspend the alarm
-
Then we should received an alarm suspended messsage
-
When we resume the alarm
-
Then we should receive an alarm resumed message
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
# File 'spec/site/tlc/alarm_spec.rb', line 109 Validator::Site.connected do |task,supervisor,site| alarm_code_id = 'A0302' action = Validator.config.dig('alarms', alarm_code_id) skip "alarm #{alarm_code_id} is not configured" unless action component_id = action['component'] skip "alarm #{alarm_code_id} has no component configured" unless component_id # first resume alarm to make sure something happens when we suspend resume_alarm site, task, cId: component_id, aCId: alarm_code_id, collect: false begin # suspend alarm request, response = suspend_alarm site, task, cId: component_id, aCId: alarm_code_id, collect: true expect(response).to be_a(RSMP::AlarmSuspended) # resume alarm request, response = resume_alarm site, task, cId: component_id, aCId: alarm_code_id, collect: true expect(response).to be_a(RSMP::AlarmResumed) ensure # always end with resuming alarm resume_alarm site, task, cId: component_id, aCId: alarm_code_id, collect: false end end
-
»
Verify status 0096 current date and time
-
Given the site is connected
-
Request status
-
Expect status response before timeout
21 22 23 24 25 26 27 28 29 30 31
# File 'spec/site/tlc/clock_spec.rb', line 21 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "current date and time", { S0096: [ :year, :month, :day, :hour, :minute, :second, ] } end
-
Verify status S0096 clock after changing clock
-
Given the site is connected
-
Send control command to set_clock
-
Request status S0096
-
Compare set_clock and status timestamp
-
Expect the difference to be within max_diff
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
# File 'spec/site/tlc/clock_spec.rb', line 54 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do status_list = { S0096: [ :year, :month, :day, :hour, :minute, :second, ] } result = site.request_status Validator.get_config('main_component'), convert_status_list(status_list), collect!: { timeout: Validator.get_config('timeouts','status_update') } collector = result[:collector] status = status_list.keys.first.to_s received = Time.new( collector.matcher_result( {"sCI" => status, "n" => "year"} )['s'], collector.matcher_result( {"sCI" => status, "n" => "month"} )['s'], collector.matcher_result( {"sCI" => status, "n" => "day"} )['s'], collector.matcher_result( {"sCI" => status, "n" => "hour"} )['s'], collector.matcher_result( {"sCI" => status, "n" => "minute"} )['s'], collector.matcher_result( {"sCI" => status, "n" => "second"} )['s'], 'UTC' ) max_diff = Validator.get_config('timeouts','command_response') + Validator.get_config('timeouts','status_response') diff = received - CLOCK diff = diff.round expect(diff.abs).to be <= max_diff, "Clock reported by S0096 is off by #{diff}s, should be within #{max_diff}s" end end end
-
Verify status response timestamp after changing clock
-
Given the site is connected
-
Send control command to set_clock
-
Request status S0096
-
Compare set_clock and response timestamp
-
Expect the difference to be within max_diff
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
# File 'spec/site/tlc/clock_spec.rb', line 103 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do status_list = { S0096: [ :year, :month, :day, :hour, :minute, :second, ] } result = site.request_status Validator.get_config('main_component'), convert_status_list(status_list), collect!: { timeout: Validator.get_config('timeouts','status_response') } collector = result[:collector] max_diff = Validator.get_config('timeouts','command_response') + Validator.get_config('timeouts','status_response') diff = Time.parse(collector..first.attributes['sTs']) - CLOCK diff = diff.round expect(diff.abs).to be <= max_diff, "Timestamp of S0096 is off by #{diff}s, should be within #{max_diff}s" end end end
-
Verify aggregated status response timestamp after changing clock
-
Given the site is connected
-
Send control command to set clock
-
Wait for status = true
-
Request aggregated status
-
Compare set_clock and response timestamp
-
Expect the difference to be within max_diff
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
# File 'spec/site/tlc/clock_spec.rb', line 142 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do result = site.request_aggregated_status Validator.get_config('main_component'), collect!: { timeout: Validator.get_config('timeouts','status_response') } collector = result[:collector] max_diff = Validator.get_config('timeouts','command_response') + Validator.get_config('timeouts','status_response') diff = Time.parse(collector..first.attributes['aSTS']) - CLOCK diff = diff.round expect(diff.abs).to be <= max_diff, "Timestamp of aggregated status is off by #{diff}s, should be within #{max_diff}s" end end end
-
Verify command response timestamp after changing clock
-
Given the site is connected
-
Send control command to set clock
-
Send command to set functional position
-
Compare set_clock and response timestamp
-
Expect the difference to be within max_diff
168 169 170 171 172 173 174 175 176 177 178 179 180 181
# File 'spec/site/tlc/clock_spec.rb', line 168 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do result = set_functional_position 'NormalControl' collector = result[:collector] max_diff = Validator.get_config('timeouts','command_response') * 2 diff = Time.parse(collector..first.attributes['cTS']) - CLOCK diff = diff.round expect(diff.abs).to be <= max_diff, "Timestamp of command response is off by #{diff}s, should be within #{max_diff}s" end end end
-
Verify command response timestamp after changing clock
-
Given the site is connected
-
Send control command to set clock
-
Send command to set functional position
-
Compare set_clock and response timestamp
-
Expect the difference to be within max_diff
192 193 194 195 196 197 198 199 200 201 202 203 204 205
# File 'spec/site/tlc/clock_spec.rb', line 192 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do result = set_functional_position 'NormalControl' collector = result[:collector] max_diff = Validator.get_config('timeouts','command_response') diff = Time.parse(collector..first.attributes['cTS']) - CLOCK diff = diff.round expect(diff.abs).to be <= max_diff, "Timestamp of command response is off by #{diff}s, should be within #{max_diff}s" end end end
-
Verify timestamp of alarm after changing clock The test requires the device to be programmed so that a A0302 alarm can be raise by activating a specific input, as configuted in the test config.
-
Given the site is connected
-
When we send a command to change the clock
-
And we raise an alarm, by acticate an input
-
Then we should receive an alarm
-
And the alarm timestamp should be close to the time set the clock to
220 221 222 223 224 225 226 227 228 229 230 231 232 233
# File 'spec/site/tlc/clock_spec.rb', line 220 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do # set clock with_alarm_activated(task, site, 'A0302') do |alarm| # raise alarm, by activating input alarm_time = Time.parse( alarm.attributes["aTs"] ) max_diff = Validator.get_config('timeouts','command_response') + Validator.get_config('timeouts','status_response') diff = alarm_time - CLOCK expect(diff.round.abs).to be <= max_diff, "Timestamp of alarm is off by #{diff}s, should be within #{max_diff}s" end end end end
-
Verify timestamp of watchdog after changing clock
-
Given the site is connected
-
Send control command to setset_clock
-
Wait for Watchdog
-
Compare set_clock and alarm response timestamp
-
Expect the difference to be within max_diff
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
# File 'spec/site/tlc/clock_spec.rb', line 244 Validator::Site.connected do |task,supervisor,site| prepare task, site site.with_watchdog_disabled do # avoid time synchronization by disabling watchdogs with_clock_set site, CLOCK do log "Checking watchdog timestamp" collector = RSMP::Collector.new site, task:task, type: "Watchdog", num: 1, timeout: Validator.get_config('timeouts','watchdog') collector.collect! max_diff = Validator.get_config('timeouts','command_response') + Validator.get_config('timeouts','status_response') diff = Time.parse(collector..first.attributes['wTs']) - CLOCK diff = diff.round expect(diff.abs).to be <= max_diff, "Timestamp of watchdog is off by #{diff}s, should be within #{max_diff}s" end end end
-
»
Verify status S0020 control mode
-
Given the site is connected
-
Request status
-
Expect status response before timeout
11 12 13 14
# File 'spec/site/tlc/modes_spec.rb', line 11 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "control mode", { S0020: [:controlmode,:intersection] } end
-
Verify status S0005 traffic controller starting by intersection statusByIntersection requires core >= 3.2, since it uses the array data type.
-
Given the site is connected
-
Request status
-
Expect status response before timeout
23 24 25 26
# File 'spec/site/tlc/modes_spec.rb', line 23 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic controller starting (true/false)", { S0005: [:statusByIntersection] } end
-
Verify status S0005 traffic controller starting by intersection statusByIntersection requires core >= 3.2, since it uses the array data type.
-
Given the site is connected
-
Request status
-
Expect status response before timeout
23 24 25 26
# File 'spec/site/tlc/modes_spec.rb', line 23 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic controller starting (true/false)", { S0005: [:statusByIntersection] } end
-
Verify status S0007 controller switched on, source attribute
-
Given the site is connected
-
Request status
-
Expect status response before timeout
48 49 50 51
# File 'spec/site/tlc/modes_spec.rb', line 48 Validator::Site.connected do |task,supervisor,site| status_list = { S0007: [:status,:intersection,:source] } request_status_and_confirm site, "controller switch on (dark mode=off)", status_list end
-
Verify status S0007 controller switched on, source attribute
-
Given the site is connected
-
Request status
-
Expect status response before timeout
48 49 50 51
# File 'spec/site/tlc/modes_spec.rb', line 48 Validator::Site.connected do |task,supervisor,site| status_list = { S0007: [:status,:intersection,:source] } request_status_and_confirm site, "controller switch on (dark mode=off)", status_list end
-
Verify status S0008 manual control
-
Given the site is connected
-
Request status
-
Expect status response before timeout
72 73 74 75 76 77 78 79
# File 'spec/site/tlc/modes_spec.rb', line 72 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0008: [:status,:intersection,:source] } else status_list = { S0008: [:status,:intersection] } end request_status_and_confirm site, "manual control status", status_list end
-
Verify status S0009 fixed time control
-
Given the site is connected
-
Request status
-
Expect status response before timeout
88 89 90 91 92 93 94 95
# File 'spec/site/tlc/modes_spec.rb', line 88 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0009: [:status,:intersection,:source] } else status_list = { S0009: [:status,:intersection] } end request_status_and_confirm site, "fixed time control status", status_list end
-
Verify command M0007 fixed time control
-
Verify connection
-
Send command to switch to fixed time = true
-
Wait for status = true
-
Send command to switch to fixed time = false
-
Wait for status = false
106 107 108 109 110
# File 'spec/site/tlc/modes_spec.rb', line 106 Validator::Site.connected do |task,supervisor,site| prepare task, site switch_fixed_time 'True' switch_fixed_time 'False' end
-
Verify status S0010 isolated control
-
Given the site is connected
-
Request status
-
Expect status response before timeout
119 120 121 122 123 124 125 126
# File 'spec/site/tlc/modes_spec.rb', line 119 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0010: [:status,:intersection,:source] } else status_list = { S0010: [:status,:intersection] } end request_status_and_confirm site, "isolated control status", status_list end
-
Verify status S0032 coordinated control
-
Given the site is connected
-
Request status
-
Expect status response before timeout
135 136 137 138
# File 'spec/site/tlc/modes_spec.rb', line 135 Validator::Site.connected do |task,supervisor,site| status_list = { S0032: [:status,:intersection,:source] } request_status_and_confirm site, "coordinated control status", status_list end
-
Verify status S0011 yellow flash
-
Given the site is connected
-
Request status
-
Expect status response before timeout
147 148 149 150 151 152 153 154
# File 'spec/site/tlc/modes_spec.rb', line 147 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0011: [:status,:intersection,:source] } else status_list = { S0011: [:status,:intersection] } end request_status_and_confirm site, "yellow flash status", status_list end
-
Verify that we can activate yellow flash
-
Given the site is connected
-
Send the control command to switch to Yellow flash
-
Wait for status Yellow flash
-
Send command to switch to normal control
-
Wait for status “Yellow flash” = false, “Controller starting”= false, “Controller on”= true“
165 166 167 168 169
# File 'spec/site/tlc/modes_spec.rb', line 165 Validator::Site.connected do |task,supervisor,site| prepare task, site switch_yellow_flash switch_normal_control end
-
Verify that we can yellow flash causes all groups to go to state ‘c’
-
Given the site is connected
-
Send the control command to switch to Yellow flash
-
Wait for all groups to go to group ‘c’
-
Send command to switch to normal control
-
Wait for all groups to switch do something else that ‘c’
180 181 182 183 184 185 186 187 188 189
# File 'spec/site/tlc/modes_spec.rb', line 180 Validator::Site.connected do |task,supervisor,site| prepare task, site timeout = Validator.get_config('timeouts','yellow_flash') switch_yellow_flash wait_for_groups 'c', timeout: timeout # c mean s yellow flash switch_normal_control wait_for_groups '[^c]', timeout: timeout # not c, ie. not yellow flash end
-
Verify status S0012 all red
-
Given the site is connected
-
Request status
-
Expect status response before timeout
198 199 200 201 202 203 204 205
# File 'spec/site/tlc/modes_spec.rb', line 198 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0012: [:status,:intersection,:source] } else status_list = { S0012: [:status,:intersection] } end request_status_and_confirm site, "all-red status", status_list end
-
Verify status S0013 police key
-
Given the site is connected
-
Request status
-
Expect status response before timeout
214 215 216 217
# File 'spec/site/tlc/modes_spec.rb', line 214 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "police key", { S0013: [:status] } end
-
Verify that we can activate dark mode
-
Given the site is connected
-
Send the control command to switch todarkmode
-
Wait for status“Controller on” = false
-
Send command to switch to normal control
-
Wait for status “Yellow flash” = false, “Controller starting”= false, “Controller on”= true“
228 229 230 231 232
# File 'spec/site/tlc/modes_spec.rb', line 228 Validator::Site.connected do |task,supervisor,site| prepare task, site switch_dark_mode switch_normal_control end
-
Verify that we can activate yellow flash and after 1 minute goes back to NormalControl
-
Given the site is connected
-
Send the control command to switch to Normal Control, and wait for this
-
Send the control command to switch to Yellow flash
-
Wait for status Yellow flash
-
Wait for automatic revert to Normal Control
243 244 245 246 247 248 249
# File 'spec/site/tlc/modes_spec.rb', line 243 Validator::Site.connected do |task,supervisor,site| prepare task, site switch_normal_control minutes = 1 switch_yellow_flash timeout_minutes: minutes wait_normal_control timeout: minutes*60 + Validator.get_config('timeouts','functional_position') end
-
»
Verify status S0091 operator logged in/out OP-panel
-
Given the site is connected
-
Request status
-
Expect status response before timeout
11 12 13 14 15 16 17 18
# File 'spec/site/tlc/system_spec.rb', line 11 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0091: [:user] } else status_list = { S0091: [:user, :status] } end request_status_and_confirm site, "operator logged in/out OP-panel", status_list end
-
Verify status S0092 operator logged in/out web-interface
-
Given the site is connected
-
Request status
-
Expect status response before timeout
27 28 29 30 31 32 33 34
# File 'spec/site/tlc/system_spec.rb', line 27 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0092: [:user] } else status_list = { S0092: [:user, :status] } end request_status_and_confirm site, "operator logged in/out web-interface", status_list end
-
Verify status S0095 version of traffic controller
-
Given the site is connected
-
Request status
-
Expect status response before timeout
43 44 45 46
# File 'spec/site/tlc/system_spec.rb', line 43 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "version of traffic controller", { S0095: [:status] } end
-
-
Verify connection
-
Send control command to set securitycode_level
-
Wait for status = true
-
Send control command to setsecuritycode_level
-
Wait for status = true
55 56 57 58 59
# File 'spec/site/tlc/system_spec.rb', line 55 Validator::Site.connected do |task,supervisor,site| prepare task, site set_security_code 1 set_security_code 2 end
-
Verify that the site responds with NotAck if we send incorrect security cdoes. RThis hehaviour is defined in SXL >= 1.1. For earlier versions, The behaviour is undefined.
-
Given the site is connected
-
When we send a M0008 command with incorrect security codes
-
Then we should received a NotAck
69 70 71 72
# File 'spec/site/tlc/system_spec.rb', line 69 Validator::Site.connected do |task,supervisor,site| prepare task, site expect { wrong_security_code }.to raise_error(RSMP::MessageRejected) end
-
»
Check that we can subscribe to status messages. The test subscribes to S0001 (signal group status), because it will usually change once per second, but otherwise the choice is arbitrary as we simply want to check that the subscription mechanism works.
-
subscribe
-
check that we receive a status update with a predefined time
-
unsubscribe
15 16 17 18 19 20 21 22 23 24 25 26 27 28
# File 'spec/site/tlc/subscribe_spec.rb', line 15 Validator::Site.connected do |task,supervisor,site| log "Subscribe to status and wait for update" component = Validator.get_config('main_component') status_list = [{'sCI'=>'S0001','n'=>'signalgroupstatus','uRt'=>'1'}] status_list.map! { |item| item.merge!('sOc' => false) } if use_sOc?(site) site.subscribe_to_status component, status_list, collect!: { timeout: Validator.get_config('timeouts','status_update') } ensure unsubscribe_list = status_list.map { |item| item.slice('sCI','n') } site.unsubscribe_to_status component, unsubscribe_list end
-
»
Verify status S0014 current time plan
-
Given the site is connected
-
Request status
-
Expect status response before timeout
11 12 13 14 15 16 17 18
# File 'spec/site/tlc/signal_plans_spec.rb', line 11 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0014: [:status,:source] } else status_list = { S0014: [:status] } end request_status_and_confirm site, "current time plan", status_list end
-
Verify that we change time plan (signal program) We try switching all programs configured
-
Given the site is connected
-
Verify that there is a Validator.get_config(‘validator’) with a time plan
-
Send command to switch time plan
-
Wait for status “Current timeplan” = requested time plan
-
Verify status S0018 number of time plans Deprecated from 1.2, use S0022 instead.
-
Given the site is connected
-
Request status
-
Expect status response before timeout
44 45 46 47
# File 'spec/site/tlc/signal_plans_spec.rb', line 44 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "number of time plans", { S0018: [:number] } end
-
Verify status S0022 list of time plans
-
Given the site is connected
-
Request status
-
Expect status response before timeout
56 57 58 59
# File 'spec/site/tlc/signal_plans_spec.rb', line 56 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "list of time plans", { S0022: [:status] } end
-
Verify status S0026 week time table
-
Given the site is connected
-
Request status
-
Expect status response before timeout
68 69 70 71
# File 'spec/site/tlc/signal_plans_spec.rb', line 68 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "week time table", { S0026: [:status] } end
-
-
Verify connection
-
Send control command to set week_table
-
Wait for status = true
78 79 80 81 82
# File 'spec/site/tlc/signal_plans_spec.rb', line 78 Validator::Site.connected do |task,supervisor,site| status = "0-1,6-2" prepare task, site set_week_table status end
-
Verify status S0027 time tables
-
Given the site is connected
-
Request status
-
Expect status response before timeout
91 92 93 94
# File 'spec/site/tlc/signal_plans_spec.rb', line 91 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "command table", { S0027: [:status] } end
-
-
Verify connection
-
Send control command to set time_table
-
Wait for status = true
101 102 103 104 105
# File 'spec/site/tlc/signal_plans_spec.rb', line 101 Validator::Site.connected do |task,supervisor,site| status = "12-1-12-59,1-0-23-12" prepare task, site set_day_table status end
-
Verify status S0097 version of traffic program
-
Given the site is connected
-
Request status
-
Expect status response before timeout
114 115 116 117
# File 'spec/site/tlc/signal_plans_spec.rb', line 114 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "version of traffic program", { S0097: [:timestamp,:checksum] } end
-
-
Verify connection
-
Send control command to set cycle time
-
Wait for status = true
124 125 126 127 128 129
# File 'spec/site/tlc/signal_plans_spec.rb', line 124 Validator::Site.connected do |task,supervisor,site| status = 5 plan = 0 prepare task, site set_cycle_time status, plan end
-
Verify status S0023 command table
-
Given the site is connected
-
Request status
-
Expect status response before timeout
138 139 140 141
# File 'spec/site/tlc/signal_plans_spec.rb', line 138 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "command table", { S0023: [:status] } end
-
-
Verify connection
-
Send control command to set dynamic_bands
-
Wait for status = true
148 149 150 151 152 153
# File 'spec/site/tlc/signal_plans_spec.rb', line 148 Validator::Site.connected do |task,supervisor,site| plan = "1" status = "1-12" prepare task, site set_dynamic_bands plan, status end
-
-
Given the site is connected
-
Read dynamic band
-
Set dynamic band to 2x previous value
-
Read band to confirm
-
Set dynamic band to previous value
-
Read dynamic band to confirm
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
# File 'spec/site/tlc/signal_plans_spec.rb', line 164 Validator::Site.connected do |task,supervisor,site| prepare task, site plan = 1 band = 3 value = get_dynamic_bands(plan, band) || 0 expect( value ).to be_a(Integer) new_value = value + 1 set_dynamic_bands plan, "#{band}-#{new_value}" expect( get_dynamic_bands(plan, band) ).to eq(new_value) set_dynamic_bands plan, "#{band}-#{value}" expect( get_dynamic_bands(plan, band) ).to eq(value) end
-
Verify command M0023 timeout of dynamic bands
-
Verify connection
-
When we send command to set timeout
-
Then we should get a confirmation
-
When we send command to disable timeout
-
Then we should get a confirmation
190 191 192 193 194 195 196
# File 'spec/site/tlc/signal_plans_spec.rb', line 190 Validator::Site.connected do |task,supervisor,site| prepare task, site status = 10 set_timeout_for_dynamic_bands status status = 0 set_timeout_for_dynamic_bands status end
-
Verify status S0024 offset time
-
Given the site is connected
-
Request status
-
Expect status response before timeout
205 206 207 208
# File 'spec/site/tlc/signal_plans_spec.rb', line 205 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "offset time", { S0024: [:status] } end
-
-
Verify connection
-
Send control command to set dynamic_bands
-
Wait for status = true
215 216 217 218 219 220
# File 'spec/site/tlc/signal_plans_spec.rb', line 215 Validator::Site.connected do |task,supervisor,site| plan = 1 status = 99 prepare task, site set_offset status, plan end
-
Verify status S0028 cycle time
-
Given the site is connected
-
Request status
-
Expect status response before timeout
229 230 231 232
# File 'spec/site/tlc/signal_plans_spec.rb', line 229 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "cycle time", { S0028: [:status] } end
-
-
Verify connection
-
Send control command to set cycle time
-
Wait for status = true
239 240 241 242 243 244
# File 'spec/site/tlc/signal_plans_spec.rb', line 239 Validator::Site.connected do |task,supervisor,site| status = 5 plan = 0 prepare task, site set_cycle_time status, plan end
-
»
Verify status S0201 traffic counting: number of vehicles
-
Given the site is connected
-
Request status
-
Expect status response before timeout
10 11 12 13 14
# File 'spec/site/tlc/traffic_data_spec.rb', line 10 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: number of vehicles", { S0201: [:starttime,:vehicles] }, Validator.get_config('components','detector_logic').keys.first end
-
Verify status S0205 traffic counting: number of vehicles
-
Given the site is connected
-
Request status
-
Expect status response before timeout
23 24 25 26
# File 'spec/site/tlc/traffic_data_spec.rb', line 23 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: number of vehicles", { S0205: [:start,:vehicles] } end
-
Verify status S0202 traffic counting: vehicle speed
-
Given the site is connected
-
Request status
-
Expect status response before timeout
35 36 37 38 39
# File 'spec/site/tlc/traffic_data_spec.rb', line 35 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: vehicle speed", { S0202: [:starttime,:speed] }, Validator.get_config('components','detector_logic').keys.first end
-
Verify status S0206 traffic counting: vehicle speed
-
Given the site is connected
-
Request status
-
Expect status response before timeout
48 49 50 51
# File 'spec/site/tlc/traffic_data_spec.rb', line 48 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: vehicle speed", { S0206: [:start,:speed] } end
-
Verify status S0203 traffic counting: occupancy
-
Given the site is connected
-
Request status
-
Expect status response before timeout
60 61 62 63 64
# File 'spec/site/tlc/traffic_data_spec.rb', line 60 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: occupancy", { S0203: [:starttime,:occupancy] }, Validator.get_config('components','detector_logic').keys.first end
-
Verify status S0207 traffic counting: occupancy
-
Given the site is connected
-
Request status
-
Expect status response before timeout
73 74 75 76
# File 'spec/site/tlc/traffic_data_spec.rb', line 73 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: occupancy", { S0207: [:start,:occupancy] } end
-
Verify status S0204 traffic counting: classification
-
Given the site is connected
-
Request status
-
Expect status response before timeout
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
# File 'spec/site/tlc/traffic_data_spec.rb', line 85 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: classification", { S0204: [ :starttime, :P, :PS, :L, :LS, :B, :SP, :MC, :C, :F ] }, Validator.get_config('components','detector_logic').keys.first end
-
Verify status S0208 traffic counting: classification
-
Given the site is connected
-
Request status
-
Expect status response before timeout
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
# File 'spec/site/tlc/traffic_data_spec.rb', line 109 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "traffic counting: classification", { S0208: [ :start, :P, :PS, :L, :LS, :B, :SP, :MC, :C, :F ] } end
-
»
Validate that a signal group can be ordered to green using the M0010 command.
-
Verify connection
-
Send control command to start signalgrup, set_signal_start= true, include security_code
-
Wait for status = true
11 12 13 14
# File 'spec/site/tlc/signal_groups_spec.rb', line 11 Validator::Site.connected do |task,supervisor,site| prepare task, site set_signal_start end
-
-
Verify connection
-
Send control command to stop signalgrup, set_signal_start= false, include security_code
-
Wait for status = true
21 22 23 24
# File 'spec/site/tlc/signal_groups_spec.rb', line 21 Validator::Site.connected do |task,supervisor,site| prepare task, site set_signal_stop end
-
Verify that signal group status can be read with S0001.
-
Given the site is connected
-
Request status
-
Expect status response before timeout
33 34 35 36
# File 'spec/site/tlc/signal_groups_spec.rb', line 33 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "signal group status", { S0001: [:signalgroupstatus, :cyclecounter, :basecyclecounter, :stage] } end
-
Verify that time-of-green/time-of-red can be read with S0025.
-
Given the site is connected
-
Request status
-
Expect status response before timeout
45 46 47 48 49 50 51 52 53 54 55 56 57
# File 'spec/site/tlc/signal_groups_spec.rb', line 45 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "time-of-green/time-of-red", { S0025: [ :minToGEstimate, :maxToGEstimate, :likelyToGEstimate, :ToGConfidence, :minToREstimate, :maxToREstimate, :likelyToREstimate ] }, Validator.get_config('components','signal_group').keys.first end
-
-
Verify connection
-
Send control command to start or stop a serie of signalgroups
-
Wait for status = true
64 65 66 67
# File 'spec/site/tlc/signal_groups_spec.rb', line 64 Validator::Site.connected do |task,supervisor,site| prepare task, site set_signal_start_or_stop '5,4134,65;5,11' end
-
Verify status S0017 number of signal groups
-
Given the site is connected
-
Request status
-
Expect status response before timeout
76 77 78 79
# File 'spec/site/tlc/signal_groups_spec.rb', line 76 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "number of signal groups", { S0017: [:number] } end
-
Verify that we can activate normal control after yellow flash mode is turned off
-
Given the site is connected and in yellow flash mode
-
When we activate normal control
-
All signal groups should go through e, f and g
88 89 90 91 92 93 94 95
# File 'spec/site/tlc/signal_groups_spec.rb', line 88 Validator::Site.connected do |task,supervisor,site| prepare task, site verify_startup_sequence do switch_yellow_flash set_functional_position 'NormalControl' end set_functional_position 'NormalControl' end
-
»
Verify status S0016 number of detector logics
-
Given the site is connected
-
Request status
-
Expect status response before timeout
11 12 13 14
# File 'spec/site/tlc/detector_logics_spec.rb', line 11 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "number of detector logics", { S0016: [:number] } end
-
Verify status S0002 detector logic status
-
Given the site is connected
-
Request status
-
Expect status response before timeout
23 24 25 26
# File 'spec/site/tlc/detector_logics_spec.rb', line 23 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "detector logic status", { S0002: [:detectorlogicstatus] } end
-
Verify status S0021 manually set detector logic
-
Given the site is connected
-
Request status
-
Expect status response before timeout
35 36 37 38
# File 'spec/site/tlc/detector_logics_spec.rb', line 35 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "detector logic forcing", { S0021: [:detectorlogics] } end
-
-
Verify connection
-
Send control command to switch detector_logic= true
-
Wait for status = true
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
# File 'spec/site/tlc/detector_logics_spec.rb', line 45 Validator::Site.connected do |task,supervisor,site| prepare task, site Validator.get_config('components','detector_logic').keys.each_with_index do |component, indx| force_detector_logic component, mode:'True' wait_for_status(@task, "detector logic #{component} to be True", [{'sCI'=>'S0002','n'=>'detectorlogicstatus','s'=>/^.{#{indx}}1/}] ) force_detector_logic component, mode:'False' wait_for_status(@task, "detector logic #{component} to be False", [{'sCI'=>'S0002','n'=>'detectorlogicstatus','s'=>/^.{#{indx}}0/}] ) end end
-
Verify status S0031 trigger level sensitivity for loop detector
-
Given the site is connected
-
Request status
-
Expect status response before timeout
70 71 72 73
# File 'spec/site/tlc/detector_logics_spec.rb', line 70 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "loop detector sensitivity", { S0031: [:status] } end
-
»
Validate that a signal priority can be requested.
-
Given the site is connected
-
When we send a signal priority request
-
Then we should receive an acknowledgement
13 14 15 16 17 18 19 20 21 22 23 24 25 26
# File 'spec/site/tlc/signal_priority_spec.rb', line 13 Validator::Site.connected do |task,supervisor,site| signal_group = Validator.get_config('components','signal_group').keys.first command_list = build_command_list :M0022, :requestPriority, { requestId: SecureRandom.uuid()[0..3], signalGroupId: signal_group, type: 'new', level: 7, eta: 10, vehicleType: 'car' } prepare task, site send_command_and_confirm @task, command_list, "Request signal priority for signal group #{signal_group}" end
-
Validate that signal priority status can be requested.
-
Given the site is connected
-
When we request signal priority status
-
Then we should receive a status update
35 36 37 38
# File 'spec/site/tlc/signal_priority_spec.rb', line 35 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "signal group status", { S0033: [:status] } end
-
Validate that we can subscribe signal priority status
-
Given the site is connected
-
And we subscribe to signal priority status updates
-
Then we should receive an acknowledgement
-
And we should reive a status updates
48 49 50 51 52 53
# File 'spec/site/tlc/signal_priority_spec.rb', line 48 Validator::Site.connected do |task,supervisor,site| prepare task, site status_list = [{'sCI'=>'S0033','n'=>'status','uRt'=>'0'}] status_list.map! { |item| item.merge!('sOc' => true) } if use_sOc?(site) wait_for_status task, 'signal priority status', status_list end
-
Validate that a signal priority completes when we cancel it.
-
Given the site is connected
-
And we subscribe to signal priority status
-
When we send a signal priority request
-
Then the request state should become ‘received’
-
Then the request state should become ‘activated’
-
When we cancel the request
-
Then the state should become ‘completed’
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
# File 'spec/site/tlc/signal_priority_spec.rb', line 67 Validator::Site.connected do |task,supervisor,site| timeout = Validator.get_config('timeouts','priority_completion') component = Validator.get_config('main_component') signal_group_id = Validator.get_config('components','signal_group').keys.first prio = Validator::StatusHelpers::SignalPriorityRequestHelper.new( site, component: component, signal_group_id: signal_group_id, timeout: timeout, task: task ) prio.run do log "Before: Send unrelated signal priority request." prio. log "Send signal priority request, wait for reception." prio.request log "After: Send unrelated signal priority request." prio. prio.expect :received log "Signal priority request was received, wait for activation." prio.expect :activated log "Signal priority request was activated, now cancel it and wait for completion." prio.cancel prio.expect :completed log "Signal priority request was completed." end end
-
Validate that a signal priority times out if not cancelled.
-
Given the site is connected
-
And we subscribe to signal priority status
-
When we send a signal priority request
-
Then the request state should become ‘received’
-
Then the request state should become ‘activated’
-
When we do not cancel the request
-
Then the state should become ‘stale’
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
# File 'spec/site/tlc/signal_priority_spec.rb', line 114 Validator::Site.connected do |task,supervisor,site| timeout = Validator.get_config('timeouts','priority_completion') component = Validator.get_config('main_component') signal_group_id = Validator.get_config('components','signal_group').keys.first prio = Validator::StatusHelpers::SignalPriorityRequestHelper.new( site, component: component, signal_group_id: signal_group_id, timeout: timeout, task: task ) prio.run do log "Before: Send unrelated signal priority request." prio. log "Send signal priority request, wait for reception." prio.request log "After: Send unrelated signal priority request." prio. prio.expect :received log "Signal priority request was received, wait for activation." prio.expect :activated log "Signal priority request was activated, wait for it to become stale." # don't cancel request, it should then become stale by itself prio.expect :stale log "Signal priority request became stale." end end
-
»
Verify that current emergency route can be read with S0006. Depreciated from 1.2, use S0035 instead.
-
Given the site is connected.
-
When we request S0006.
-
Then we should receive a status response.
12 13 14 15
# File 'spec/site/tlc/emergency_routes_spec.rb', line 12 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "emergency route status", { S0006: [:status,:emergencystage] } end
-
Verify that current emergency routes can be read with S0035. Requires core >= 3.2 since it uses the array data type.
-
Given the site is connected.
-
When we request S0035.
-
Then we should receive a status response.
24 25 26 27
# File 'spec/site/tlc/emergency_routes_spec.rb', line 24 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "emergency route status", { S0035: [:emergencyroutes] } end
-
Verify that emergency routes can be activated with M0005. S0006 should reflect the last route enabled/disabled.
-
Given the site is connected.
-
When we send M0005 to set emergency route.
-
Then we should get a command responds confirming the change.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
# File 'spec/site/tlc/emergency_routes_spec.rb', line 36 emergency_routes = Validator.get_config('items','emergency_routes') skip("No emergency routes configured") if emergency_routes.nil? || emergency_routes.empty? def set_emergency_states task, emergency_routes, state emergency_routes.each do |emergency_route| set_emergency_route emergency_route.to_s, state end wait_for_status(task, "emergency route #{emergency_routes.last} to be enabled", [ {'sCI'=>'S0006','n'=>'status','s'=>(state ? 'True' : 'False')}, {'sCI'=>'S0006','n'=>'emergencystage','s'=>(state ? emergency_routes.last.to_s : '0')} ] ) end Validator::Site.connected do |task,supervisor,site| prepare task, site set_emergency_states task, emergency_routes, false begin set_emergency_states task, emergency_routes, true ensure set_emergency_states task, emergency_routes, false end end
-
- Traffic Light Controller Emergency Route emergency routes can be activated with M0005 and read with S0035
Verify that emergency routes can be activated with M0005. S0035 should show all active routes.
-
Given the site is connected.
-
When we send M0005 to set emergency route.
-
Then we should get a command responds confirming the change.
-
When we request the current emergency routes with S035.
-
Then we should receive the list of active routes.
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
# File 'spec/site/tlc/emergency_routes_spec.rb', line 71 def enable_routes task, emergency_routes emergency_routes.each { |emergency_route| set_emergency_route emergency_route.to_s, true } routes = emergency_routes.map {|i| {'id'=>i.to_s} } wait_for_status(task, "emergency routes #{emergency_routes.to_s} to be enabled", [ {'sCI'=>'S0035','n'=>'emergencyroutes','s'=>routes} ] ) end def disable_routes task, emergency_routes emergency_routes.each { |emergency_route| set_emergency_route emergency_route.to_s, false } routes = [] wait_for_status(task, "all emergency routes to be disabled", [ {'sCI'=>'S0035','n'=>'emergencyroutes','s'=>routes} ] ) end emergency_routes = Validator.get_config('items','emergency_routes') skip("No emergency routes configured") if emergency_routes.nil? || emergency_routes.empty? Validator::Site.connected do |task,supervisor,site| prepare task, site disable_routes task, emergency_routes begin enable_routes task, emergency_routes ensure disable_routes task, emergency_routes end end
-
»
Verify status S0015 current traffic situation
-
Given the site is connected
-
Request status
-
Expect status response before timeout
11 12 13 14 15 16 17 18
# File 'spec/site/tlc/traffic_situations_spec.rb', line 11 Validator::Site.connected do |task,supervisor,site| if RSMP::Proxy.version_meets_requirement?( site.sxl_version, '>=1.1' ) status_list = { S0015: [:status,:source] } else status_list = { S0015: [:status] } end request_status_and_confirm site, "current traffic situation", status_list end
-
Verify that we change traffic situation
-
Given the site is connected
-
Verify that there is a Validator.get_config(‘validator’) with a traffic situation
-
Send the control command to switch traffic situation for each traffic situation
-
Wait for status “Current traffic situation” = requested traffic situation
28 29 30 31 32 33 34 35
# File 'spec/site/tlc/traffic_situations_spec.rb', line 28 situations = Validator.get_config('items','traffic_situations') skip("No traffic situations configured") if situations.nil? || situations.empty? Validator::Site.connected do |task,supervisor,site| prepare task, site situations.each { |traffic_situation| switch_traffic_situation traffic_situation.to_s } ensure unset_traffic_situation end
-
Verify status S0019 number of traffic situations
-
Given the site is connected
-
Request status
-
Expect status response before timeout
44 45 46 47
# File 'spec/site/tlc/traffic_situations_spec.rb', line 44 Validator::Site.connected do |task,supervisor,site| request_status_and_confirm site, "number of traffic situations", { S0019: [:number] } end
-
»
Verify the connection sequence when using rsmp core 3.1.1
-
Given the site is connected and using core 3.1.1
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.1
-
And the connection sequence should be complete
11
# File 'spec/site/core/connect_spec.rb', line 11 check_sequence '3.1.1'
-
Verify the connection sequence when using rsmp core 3.1.2
-
Given the site is connected and using core 3.1.2
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.2
-
And the connection sequence should be complete
21
# File 'spec/site/core/connect_spec.rb', line 21 check_sequence '3.1.2'
-
Verify the connection sequence when using rsmp core 3.1.3
-
Given the site is connected and using core 3.1.3
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.3
-
And the connection sequence should be complete
31
# File 'spec/site/core/connect_spec.rb', line 31 check_sequence '3.1.3'
-
Verify the connection sequence when using rsmp core 3.1.4
-
Given the site is connected and using core 3.1.4
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.4
-
And the connection sequence should be complete
41
# File 'spec/site/core/connect_spec.rb', line 41 check_sequence '3.1.4'
-
Verify the connection sequence when using rsmp core 3.1.5
-
Given the site is connected and using core 3.1.5
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.5
-
And the connection sequence should be complete
51
# File 'spec/site/core/connect_spec.rb', line 51 check_sequence '3.1.5'
-
Verify the connection sequence when using rsmp core 3.2
-
Given the site is connected and using core 3.2
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.5
-
And the connection sequence should be complete
61
# File 'spec/site/core/connect_spec.rb', line 61 check_sequence '3.2'
-
Verify the connection sequence when using rsmp core 3.2.1
-
Given the site is connected and using core 3.2.1
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.5
-
And the connection sequence should be complete
71
# File 'spec/site/core/connect_spec.rb', line 71 check_sequence '3.2.1'
-
Verify the connection sequence when using rsmp core 3.2.2
-
Given the site is connected and using core 3.2.2
-
When handshake messages are sent and received
-
Then the handshake messages should be in the specified sequence corresponding to version 3.1.5
-
And the connection sequence should be complete
81
# File 'spec/site/core/connect_spec.rb', line 81 check_sequence '3.2.2'
-
»
-
Given the site has just connected
-
When our supervisor does not acknowledge watchdogs
-
Then the site should disconnect
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
# File 'spec/site/core/disconnect_spec.rb', line 16 timeout = Validator.get_config('timeouts','disconnect') Validator::Site.isolated do |task,supervisor,site_proxy| supervisor.ignore_errors RSMP::DisconnectError do log "Disabling watchdog acknowledgements, site should disconnect" def site_proxy.acknowledge original if original.is_a? RSMP::Watchdog log "Not acknowledgning watchdog", message: original else super end end site_proxy.wait_for_state :disconnected, timeout: timeout end rescue RSMP::TimeoutError raise "Site did not disconnect within #{timeout}s" end
-
-
Given the site has just connected
-
When our supervisor stops sending watchdogs
-
Then the site should not disconnect
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
# File 'spec/site/core/disconnect_spec.rb', line 38 Validator::Site.isolated do |task,supervisor,site| timeout = Validator.get_config('timeouts','disconnect') wait_task = task.async do site.wait_for_state :disconnected, timeout: timeout raise RSMP::DisconnectError rescue RSMP::TimeoutError # ok, no disconnect happened end log "Stop sending watchdogs, site should not disconnect" site.with_watchdog_disabled do wait_task.wait end end
-
»
Verify that the controller responds to an aggregated status request.
-
Given the site is connected
-
When we request aggregated status
-
Then we should receive an aggregated status
10 11 12 13 14 15 16
# File 'spec/site/core/aggregated_status_spec.rb', line 10 Validator::Site.connected do |task,supervisor,site| prepare task, site log "Request aggregated status" result = site.request_aggregated_status Validator.get_config('main_component'), collect!: { timeout: Validator.get_config('timeouts','status_response') } end
-
Verify that aggregated status uses null for unused attributes, from SXL 1.1 For SXL versions before 1.1 empty strings “” is also allowed.
-
Given the is reconnected
-
When we receive an aggregated status
-
Then fP and fS should be null
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
# File 'spec/site/core/aggregated_status_spec.rb', line 26 Validator::Site.isolated( 'collect' => { filter: RSMP::Filter.new(type:"AggregatedStatus"), timeout: Validator.get_config('timeouts','ready'), num: 1, ingoing: true } ) do |task,supervisor,site_proxy| collector = site_proxy.collector collector.use_task task collector.wait! aggregated_status = site_proxy.collector..first expect(aggregated_status).to be_an(RSMP::AggregatedStatus) expect(aggregated_status.attribute('fP')).to be_nil expect(aggregated_status.attribute('fS')).to be_nil end
-