Skip to content

Commit

Permalink
clean up configs
Browse files Browse the repository at this point in the history
  • Loading branch information
emiltin committed Dec 11, 2024
1 parent 38ed870 commit e076049
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 77 deletions.
3 changes: 1 addition & 2 deletions config/cross_rs4s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# see https://rsmp-nordic.github.io/rsmp_validator/config/
type: tlc
sxl: tlc # Traffic Light Controller. We are testing a site, not a server.
sxl_version: '1.2.1'
port: 12111
ips: all
rsmp_versions: all
Expand Down Expand Up @@ -89,8 +90,6 @@ alarms:
A0302:
activation_input: 1
component: CZ+76000=101DL001
restrict_testing:
sxl_version: 1.2.1
log:
watchdogs: false
acknowledgements: false
5 changes: 2 additions & 3 deletions config/dynniq_ec2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
port: 12111
core_version: '3.1.2'
sxl: tlc
sxl_version: '1.0.7'
intervals:
timer: 1
watchdog: 60
Expand Down Expand Up @@ -37,6 +39,3 @@ secrets:
security_codes:
1: 2503
2: 2503
restrict_testing:
core_version: 3.1.2
sxl_version: 1.0.7
2 changes: 1 addition & 1 deletion config/gem_supervisor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ supervisors:
- ip: 127.0.0.1
port: 14111
sxl: tlc
sxl_version: 1.2.1
sxl_version: '1.2.1'
components:
main:
TC:
Expand Down
32 changes: 8 additions & 24 deletions config/gem_tlc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Config for testing a site running on localhost (e.g. from the rsmp gem)
# The settings are used for starting a local supervisor listening for the site tested
port: 13111
sxl_version: '1.2.1'
intervals:
timer: 0.1
watchdog: 0.1
Expand All @@ -20,33 +21,10 @@ timeouts:
functional_position: 2
priority_completion: 5
yellow_flash: 2
signal_plans:
1:
cycle_time: 6
states:
A1: '111NBB'
A2: '11NBBB'
B1: 'BBB11N'
B2: 'BBB1NB'
dynamic_bands:
1: 0
2: 5
2:
cycle_time: 6
states:
A1: 'NNNNBB'
A2: 'NNNNBN'
B1: 'BBNNNN'
B2: 'BNNNNN'
inputs:
total: 8
programming:
7:
raise_alarm: A0302
component: DL1
components:
main:
TC:
ntsOId: KK+AG9998=001TC000
signal_group:
A1:
A2:
Expand All @@ -55,6 +33,12 @@ components:
detector_logic:
DL1:
DL2:
inputs:
total: 8
programming:
7:
raise_alarm: A0302
component: DL1
items:
plans: [1,2]
traffic_situations: [1,2]
Expand Down
5 changes: 2 additions & 3 deletions config/semaforica_cartesio.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
port: 12111
ips: all
core_version: '3.2.2'
sxl: tlc # Traffic Light Controller. We are testing a site, not a server.
sxl_version: '1.2.1'
intervals:
timer: 1 # main validator timer resolution in seconds
watchdog: 60 # send watchdog every x seconds
Expand Down Expand Up @@ -69,9 +71,6 @@ secrets:
security_codes:
1: 1234
2: 12341234
restrict_testing:
core_version: 3.2.2
sxl_version: 1.2.1
alarms:
A0302:
activation_input: 16 # input 2 activates the control block
Expand Down
11 changes: 7 additions & 4 deletions config/simulator/tlc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sxl_version: '1.2.1'
components:
main:
TC:
cycle_time: 6
ntsOId: KK+AG9998=001TC000
signal_group:
A1:
A2:
Expand All @@ -19,15 +19,17 @@ components:
DL2:
signal_plans:
1:
dynamic_bands:
1: 0
2: 5
cycle_time: 6
states:
A1: '11NBBB'
A2: '1NBBBB'
B1: 'BBB11N'
B2: 'BBB1NB'
dynamic_bands:
1: 0
2: 5
2:
cycle_time: 6
states:
A1: '111NBB'
A2: '11NBBB'
Expand All @@ -39,6 +41,7 @@ inputs:
7:
raise_alarm: A0302
component: DL1
startup_sequence: 'efg'
intervals:
timer: 0.1
watchdog: 0.1
Expand Down
5 changes: 2 additions & 3 deletions config/swarco_itc2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
port: 12111
core_version: '3.1.2'
sxl: tlc
sxl_version: '1.0.7'
ntsOId: KK+AG9998=001TC000
xNId: ''
intervals:
Expand Down Expand Up @@ -39,9 +41,6 @@ secrets:
security_codes:
1: testcode1
2: testcode2
restrict_testing:
core_version: 3.1.2
sxl_version: 1.0.7
alarms:
A0302:
component: KK+AG9998=001DL001
Expand Down
3 changes: 1 addition & 2 deletions config/swarco_itc3.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
port: 12111
core_version: '3.2.0'
sxl: tlc # Traffic Light Controller. We are testing a site, not a server.
sxl_version: '1.0.15'
intervals:
timer: 1 # main validator timer resolution in seconds
watchdog: 20 # send watchdog every x seconds
Expand Down Expand Up @@ -41,8 +42,6 @@ secrets:
security_codes:
1: default
2: default
restrict_testing:
sxl_version: 1.0.15
skip_validation:
- Alarm
alarms:
Expand Down
10 changes: 2 additions & 8 deletions config/tecsen_tmacs_supervisor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ ntsOId: CAR_TC_001
supervisors:
- ip: rsmp.tmacs.it
port: 13111
core_version: '3.2.2'
sxl: tlc
sxl_version: 1.2.1
sxl_version: '1.2.1'
components:
main:
CAR_TC_001:
signal_group:
CAR_SG_001:
cycle_time: 120
plan: '11NBBB'
CAR_SG_002:
cycle_time: 120
plan: '1NBBBB'
CAR_SG_003:
cycle_time: 120
plan: 'BBB11N'
CAR_SG_004:
cycle_time: 120
plan: 'BBB1NB'
detector_logic:
CAR_DL_001:
Expand All @@ -42,6 +39,3 @@ secrets:
security_codes:
1: '1234'
2: '12341234'
restrict_testing:
core_version: 3.2.2
sxl_version: 1.2.1
21 changes: 7 additions & 14 deletions docs/pages/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ All settings except `components` and `items` can be left out, in which case the
```yaml
port: 13111 # port to listen on
ips: all # allowed ip addresses. either 'all' or a list. defaults to 'all' if left out
rsmp_versions: all # allowed core version(s). either 'all' or a list. defaults to 'all' if left out
core_version: 3.2.2 # core version of site, tests not revelant for this version will be skipped
sxl: tlc # sxl of the connecting site, options are 'core' or 'tlc'
sxl_version: 1.2.1 # sxl cersion of the site, tests not relevant for this version will be skipped
intervals:
timer: 1 # main timer interval (resolution), in seconds
watchdog: 1 # how often to send watchdog messages, in seconds
Expand Down Expand Up @@ -89,9 +90,6 @@ items: # other configurations that should be tested
inputs: [1] # list of emergency inputs (I/O)
force_input: 5 # what input to force when testing input forcing
startup_sequence: 'efg' # expected startup sequence
restrict_testing: # restrict what tests are run, default is to run all
core_version: 3.2.2 # skip unless relevant for core 3.2.2
sxl_version: 1.2.1 # skip unless relevant for sxl 1.2.1
secrets: # place secrets or in a separate file, see below
security_codes: # RSMP security codes. there are no defaults for these
1: '1111' # level 1
Expand Down Expand Up @@ -119,8 +117,9 @@ site_id: RN+SI0001 # site id of local site
supervisors: # what supervisor the local site should connect to
- ip: 127.0.0.1 # ip
port: 13111 # port
core_version: 3.2.2 # core version, tests not revelant for this version will be skipped
sxl: tlc # sxl to use, options are 'core' or 'tlc'
sxl_version: 1.1 # sxl version to use
sxl_version: 1.2.1 # sxl version, tests not relevant for this version will be skipped
components: # components of local site, organized by type and name
main: # type
TC: # name
Expand Down Expand Up @@ -158,9 +157,6 @@ timeouts: # timeouts
ready: 1 # max time to complete handshake sequence, in seconds
watchdog: 0.2 # max time between receiving watchdogs, in seconds
acknowledgement: 0.2 # max time unless a message we send is acknowledged, in seconds
restrict_testing: # restrict what tests are run, default is to run all
core_version: 3.2.2 # skip unless relevant for core 3.2.2
sxl_version: 1.2.1 # skip unless relevant for sxl 1.2.1
secrets: # place secrets or in a separate file, see below
security_codes: # RSMP security codes. there are no defaults for these
1: '1111' # level 1
Expand Down Expand Up @@ -255,17 +251,14 @@ end
```


You can limit the tests that will run by adding `restrict_testing` options in the config file for the test:
Only tests relevant to the core and sxl version specified will be run:

```yaml
restrict_testing:
core_version: 3.1.2
sxl_version: 1.0.7
core_version: 3.1.2
sxl_version: 1.0.7
```
In this case, the S0027 test above will not run, because it requires sxl 1.0.13 or higher, but we limited to 1.0.7.
Usually you will want to set `restrict_testing` version to what the site or supervisor is actually using, but it's possible to use other values.

6 changes: 2 additions & 4 deletions spec/site/tlc/alarm_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
RSpec.describe 'Site::Traffic Light Controller' do
include Validator::CommandHelpers
include Validator::StatusHelpers
include Validator::ProgrammingHelpers

# Testing alarms require a reliable way of rainsing them.
#
Expand Down Expand Up @@ -109,10 +110,7 @@ def verify_timestamp alarm, duration=1.minute
it 'A0302 can be suspended and resumed' do
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
input, component_id = find_alarm_programming(alarm_code_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
Expand Down
1 change: 1 addition & 0 deletions spec/site/tlc/clock_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
RSpec.describe 'Site::Traffic Light Controller' do
include Validator::CommandHelpers
include Validator::StatusHelpers
include Validator::ProgrammingHelpers

# Tests related to the clock.
# When you set the clock, the adjusted time should be used
Expand Down
2 changes: 1 addition & 1 deletion spec/site/tlc/io_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# 1. Given the site is connected
# 2. When we read input with S0029
# 3. Then we should receive a valid response
specify 'is read with S0003', sxl: '<1.2' do |example|
specify 'is read with S0003 with extended input status', sxl: '<1.2' do |example|
Validator::Site.connected do |task,supervisor,site|
request_status_and_confirm site, "input status",
{ S0003: [:inputstatus,:extendedinputstatus] }
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
require_relative 'support/signal_priority_request_helper'
require_relative 'support/log_helpers'
require_relative 'support/handshake_helper'
require_relative 'support/programming_helpers'
require_relative 'support/formatters/report_stream.rb'
require_relative 'support/formatters/formatter_base.rb'
require_relative 'support/formatters/brief.rb'
Expand Down
9 changes: 3 additions & 6 deletions spec/support/command_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,15 +339,12 @@ def require_security_codes
end
end

# Run a block with ana alarm acticated, then deactive the alarm
# Run a block with an alarm acticated, then deactive the alarm
# The device must be programmed to activate an alarm when a specific
# input is acticated, and the mapping must be configured in the test config.
def with_alarm_activated task, site, alarm_code_id, initial_deactivation: true
action = Validator.config.dig('alarms', alarm_code_id)
skip "alarm #{alarm_code_id} is not configured" unless action
input_nr = action['activation_input']
skip "alarm #{alarm_code_id} has no activation input configured" unless input_nr
component_id = action['component'] || Validator.get_config('main_component')
input_nr, component_id = find_alarm_programming(alarm_code_id)
component_id ||= Validator.get_config('main_component')
if initial_deactivation
force_input_and_confirm input: input_nr, value: 'False'
end
Expand Down
13 changes: 13 additions & 0 deletions spec/support/programming_helpers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module Validator::ProgrammingHelpers
def find_alarm_programming alarm_code_id
action = Validator.config.dig('inputs','programming').find do |input,options|
options['raise_alarm'] == alarm_code_id
end
skip "Alarm #{alarm_code_id} is not configured" unless action

input = action.first
component_id = action.last['component']

return input, component_id
end
end
4 changes: 2 additions & 2 deletions spec/support/validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def core_filter.inspect
# enable filtering by sxl version tags like '>=1.0.7'
# Gem::Requirement and Gem::Version classed are used to do the version matching,
# but this otherwise has nothing to do with Gems
sxl_version = Validator.config.dig('restrict_testing','sxl_version')
sxl_version = Validator.config.dig('sxl_version')
if sxl_version
sxl_version = Gem::Version.new sxl_version
sxl_filter = -> (v) {
Expand All @@ -316,7 +316,7 @@ def core_filter.inspect
# so we get more useful display of the filter option when we
# run rspec on the command line
def sxl_filter.inspect
"[unless relevant for #{Validator.config.dig('restrict_testing','sxl_version')}]"
"[unless relevant for #{Validator.config.dig('sxl_version')}]"
end
rspec_config.filter_run_excluding sxl: sxl_filter
end
Expand Down

0 comments on commit e076049

Please sign in to comment.