rsmp-validator 0.3.3 → 0.4.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 +4 -4
- data/config/secrets_example.yaml +2 -2
- data/config/simulator/supervisor.yaml +1 -1
- data/config/simulator/tlc.yaml +2 -1
- data/config/{cross_rs4s.yaml → sites/cross_rs4s.yaml} +5 -5
- data/config/sites/cross_rs5.yaml +62 -0
- data/config/{lightmotion_satellite.yaml → sites/lightmotion_satellite.yaml} +1 -1
- data/config/{swarco_itc3.yaml → sites/swarco_itc3.yaml} +3 -4
- data/config/validator.rb +1 -0
- data/config/validator_example.yaml +2 -2
- data/lib/rsmp/validator/buffer_replay_queue.rb +37 -0
- data/lib/rsmp/validator/cli/config_cli.rb +34 -9
- data/lib/rsmp/validator/config_check.rb +21 -2
- data/lib/rsmp/validator/config_normalizer.rb +3 -2
- data/lib/rsmp/validator/configuration/loader.rb +7 -13
- data/lib/rsmp/validator/configuration/secrets.rb +7 -3
- data/lib/rsmp/validator/configuration/sxls_override.rb +19 -4
- data/lib/rsmp/validator/configuration/test_requirements.rb +63 -0
- data/lib/rsmp/validator/configuration/version_normalization.rb +10 -5
- data/lib/rsmp/validator/configuration.rb +2 -9
- data/lib/rsmp/validator/helpers/alarms.rb +3 -3
- data/lib/rsmp/validator/helpers/connection.rb +14 -14
- data/lib/rsmp/validator/helpers/expectations.rb +35 -0
- data/lib/rsmp/validator/helpers/input.rb +3 -3
- data/lib/rsmp/validator/helpers/signal_plans.rb +11 -16
- data/lib/rsmp/validator/helpers/signal_priority.rb +23 -22
- data/lib/rsmp/validator/lifecycle.rb +2 -0
- data/lib/rsmp/validator/missing_configuration.rb +10 -0
- data/lib/rsmp/validator/options/site_test_options.rb +1 -1
- data/lib/rsmp/validator/options/supervisor_test_options.rb +1 -1
- data/lib/rsmp/validator/site_tester.rb +4 -19
- data/lib/rsmp/validator/version.rb +1 -1
- data/lib/rsmp/validator.rb +1 -0
- data/schemas/site_test.json +0 -4
- data/schemas/supervisor_test.json +0 -2
- data/schemas/test_config/common.json +21 -0
- data/schemas/test_config/core/3.1.4.json +14 -0
- data/schemas/test_config/core/3.1.5.json +14 -0
- data/schemas/test_config/core.json +33 -0
- data/schemas/test_config/tlc/1.0.15.json +13 -0
- data/schemas/test_config/tlc/1.0.7.json +67 -0
- data/schemas/test_config/tlc/1.0.8.json +13 -0
- data/schemas/test_config/tlc/1.1.0.json +13 -0
- data/schemas/test_config/versions.json +28 -0
- data/test/site/core/aggregated_status_spec.rb +28 -6
- data/test/site/core/message_buffer_spec.rb +90 -75
- data/test/site/tlc/alarm_spec.rb +9 -5
- data/test/site/tlc/clock_spec.rb +9 -9
- data/test/site/tlc/detector_logics_spec.rb +11 -9
- data/test/site/tlc/emergency_routes_spec.rb +4 -4
- data/test/site/tlc/invalid_command_spec.rb +9 -8
- data/test/site/tlc/invalid_status_spec.rb +8 -7
- data/test/site/tlc/modes_spec.rb +21 -21
- data/test/site/tlc/signal_groups_spec.rb +10 -10
- data/test/site/tlc/signal_plans_spec.rb +21 -21
- data/test/site/tlc/signal_priority_spec.rb +5 -5
- data/test/site/tlc/subscribe_spec.rb +5 -3
- data/test/site/tlc/system_spec.rb +11 -11
- data/test/site/tlc/traffic_data_spec.rb +12 -10
- data/test/site/tlc/traffic_situations_spec.rb +3 -3
- data/test/supervisor/aggregated_status_spec.rb +4 -0
- metadata +25 -11
- /data/config/{gem_tlc.yaml → sites/gem_tlc.yaml} +0 -0
- /data/config/{gem_tlc_secrets.yaml → sites/gem_tlc_secrets.yaml} +0 -0
- /data/config/{kapsch_etx.yaml → sites/kapsch_etx.yaml} +0 -0
- /data/config/{semaforica_cartesio.yaml → sites/semaforica_cartesio.yaml} +0 -0
- /data/config/{gem_supervisor.yaml → supervisors/gem_supervisor.yaml} +0 -0
- /data/config/{tecsen_tmacs_supervisor.yaml → supervisors/tecsen_tmacs_supervisor.yaml} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require_relative '../missing_configuration'
|
|
2
|
+
|
|
1
3
|
module RSMP
|
|
2
4
|
module Validator
|
|
3
5
|
module Helpers
|
|
@@ -27,14 +29,10 @@ module RSMP
|
|
|
27
29
|
validate_state!(state)
|
|
28
30
|
check_version_requirements(sxl, core)
|
|
29
31
|
if state == :disconnected
|
|
30
|
-
RSMP::Validator::SiteTester.disconnected { block
|
|
32
|
+
RSMP::Validator::SiteTester.disconnected { run_test(&block) }
|
|
31
33
|
else
|
|
32
34
|
RSMP::Validator::SiteTester.public_send(state, **opts) do |_task, _node, proxy|
|
|
33
|
-
block.call(proxy)
|
|
34
|
-
rescue RSMP::OperationError => e
|
|
35
|
-
fail_test e.failure.message
|
|
36
|
-
rescue StandardError => e
|
|
37
|
-
error_test UncaughtException.new(e)
|
|
35
|
+
run_test { block.call(proxy) }
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
end
|
|
@@ -43,23 +41,25 @@ module RSMP
|
|
|
43
41
|
validate_state!(state)
|
|
44
42
|
check_version_requirements(sxl, core)
|
|
45
43
|
if state == :disconnected
|
|
46
|
-
RSMP::Validator::SupervisorTester.disconnected { block
|
|
44
|
+
RSMP::Validator::SupervisorTester.disconnected { run_test(&block) }
|
|
47
45
|
else
|
|
48
46
|
RSMP::Validator::SupervisorTester.public_send(state, **opts) do |_task, _node, proxy|
|
|
49
|
-
block.call(proxy)
|
|
50
|
-
rescue RSMP::OperationError => e
|
|
51
|
-
fail_test e.failure.message
|
|
52
|
-
rescue StandardError => e
|
|
53
|
-
error_test UncaughtException.new(e)
|
|
47
|
+
run_test { block.call(proxy) }
|
|
54
48
|
end
|
|
55
49
|
end
|
|
56
50
|
end
|
|
57
51
|
|
|
58
52
|
private
|
|
59
53
|
|
|
60
|
-
def
|
|
61
|
-
|
|
54
|
+
def run_test
|
|
55
|
+
yield
|
|
56
|
+
rescue MissingConfiguration => e
|
|
57
|
+
error_test e
|
|
58
|
+
rescue RSMP::OperationError => e
|
|
59
|
+
@__assertions__.assert false, e.failure.message
|
|
62
60
|
throw :rsmp_validator_test_failure
|
|
61
|
+
rescue StandardError => e
|
|
62
|
+
error_test UncaughtException.new(e)
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def error_test(error)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'sus'
|
|
2
|
+
|
|
3
|
+
module RSMP
|
|
4
|
+
module Validator
|
|
5
|
+
module Helpers
|
|
6
|
+
# Expectations for prerequisites that must pass before a test can continue.
|
|
7
|
+
module Expectations
|
|
8
|
+
# Keep Sus's reporting and chaining, then stop after recording a failure.
|
|
9
|
+
class StoppingExpectation < Sus::Expect
|
|
10
|
+
def to(predicate)
|
|
11
|
+
result = nil
|
|
12
|
+
super(lambda do |assertions, subject|
|
|
13
|
+
result = assertions
|
|
14
|
+
predicate.call(assertions, subject)
|
|
15
|
+
if assertions.deferred?
|
|
16
|
+
raise ArgumentError, 'expect_or_stop needs an immediate expectation; use expect for deferred assertions'
|
|
17
|
+
end
|
|
18
|
+
end)
|
|
19
|
+
|
|
20
|
+
throw :rsmp_validator_test_failure unless result.passed?
|
|
21
|
+
|
|
22
|
+
self
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Stop the current conformance test on failure, unwinding ensure blocks.
|
|
27
|
+
# Supports the same subjects, blocks, negation and chaining as expect,
|
|
28
|
+
# but requires a predicate whose result is available immediately.
|
|
29
|
+
def expect_or_stop(subject = nil, &block)
|
|
30
|
+
StoppingExpectation.new(@__assertions__, block || subject, distinct: true)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -13,7 +13,7 @@ module RSMP
|
|
|
13
13
|
site_proxy,
|
|
14
14
|
"input #{input} to be #{value}",
|
|
15
15
|
[
|
|
16
|
-
{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' =>
|
|
16
|
+
{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' => /\A.{#{input - 1}}#{digit}/ }
|
|
17
17
|
]
|
|
18
18
|
)
|
|
19
19
|
end
|
|
@@ -25,7 +25,7 @@ module RSMP
|
|
|
25
25
|
site_proxy,
|
|
26
26
|
"input #{indx} to be True",
|
|
27
27
|
[
|
|
28
|
-
{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' =>
|
|
28
|
+
{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' => /\A.{#{indx - 1}}1/ }
|
|
29
29
|
]
|
|
30
30
|
)
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ module RSMP
|
|
|
33
33
|
wait_for_status(
|
|
34
34
|
site_proxy,
|
|
35
35
|
"input #{indx} to be False",
|
|
36
|
-
[{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' =>
|
|
36
|
+
[{ 'sCI' => 'S0003', 'n' => 'inputstatus', 's' => /\A.{#{indx - 1}}0/ }]
|
|
37
37
|
)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -3,14 +3,22 @@ module RSMP
|
|
|
3
3
|
module Helpers
|
|
4
4
|
# Helper methods for testing RSMP signal plan functionality.
|
|
5
5
|
module SignalPlans
|
|
6
|
+
# Keep assertions and their return guards together in the setup flow.
|
|
7
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
6
8
|
def with_cycle_time_extended(site_proxy, extension = 5, &block)
|
|
7
9
|
timeout = RSMP::Validator.get_config('timeouts', 'command_response')
|
|
8
10
|
plan = site_proxy.tlc.read_current_plan!
|
|
9
|
-
time =
|
|
10
|
-
|
|
11
|
+
time = site_proxy.tlc.read_cycle_times![plan]
|
|
12
|
+
expect(time).not.to be_nil
|
|
13
|
+
return if time.nil?
|
|
14
|
+
|
|
11
15
|
time_extended = time + extension
|
|
16
|
+
need_to_reset = true
|
|
12
17
|
site_proxy.tlc.set_cycle_time!(plan: plan, cycle_time: time_extended, within: timeout)
|
|
13
|
-
|
|
18
|
+
actual = site_proxy.tlc.read_cycle_times![plan]
|
|
19
|
+
expect(actual).to be == time_extended
|
|
20
|
+
return unless actual == time_extended
|
|
21
|
+
|
|
14
22
|
block.yield
|
|
15
23
|
ensure
|
|
16
24
|
if need_to_reset
|
|
@@ -18,19 +26,6 @@ module RSMP
|
|
|
18
26
|
site_proxy.tlc.set_cycle_time!(plan: plan, cycle_time: time, within: timeout)
|
|
19
27
|
end
|
|
20
28
|
end
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
def read_plan_cycle_time(site_proxy, plan)
|
|
25
|
-
time = site_proxy.tlc.read_cycle_times![plan]
|
|
26
|
-
assert(!time.nil?, 'Site returned empty cycle times list')
|
|
27
|
-
time
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def verify_cycle_time(site_proxy, plan, expected)
|
|
31
|
-
actual = site_proxy.tlc.read_cycle_times![plan]
|
|
32
|
-
assert(actual == expected, "Expected cycle time #{expected}, got #{actual}")
|
|
33
|
-
end
|
|
34
29
|
end
|
|
35
30
|
end
|
|
36
31
|
end
|
|
@@ -6,28 +6,17 @@ module RSMP
|
|
|
6
6
|
module SignalPriority
|
|
7
7
|
# Match a specific status response or update
|
|
8
8
|
class S0033Matcher < RSMP::StatusMatcher
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def initialize(want, request_id:, state: nil)
|
|
9
|
+
def initialize(want, request_id:)
|
|
12
10
|
super(want)
|
|
13
11
|
@request_id = request_id
|
|
14
|
-
@state = state
|
|
15
|
-
@latest_state = nil
|
|
16
12
|
end
|
|
17
13
|
|
|
18
|
-
def match(item)
|
|
19
|
-
super_matched = super
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
true
|
|
25
|
-
else
|
|
26
|
-
false
|
|
27
|
-
end
|
|
28
|
-
else
|
|
29
|
-
super_matched
|
|
30
|
-
end
|
|
14
|
+
def match(item, state: nil)
|
|
15
|
+
super_matched = super(item)
|
|
16
|
+
return super_matched unless super_matched == true
|
|
17
|
+
|
|
18
|
+
got = find_request_state item['s']
|
|
19
|
+
!got.nil? && (state.nil? || got == state.to_s)
|
|
31
20
|
end
|
|
32
21
|
|
|
33
22
|
def find_request_state(list)
|
|
@@ -52,11 +41,10 @@ module RSMP
|
|
|
52
41
|
@component = component
|
|
53
42
|
@signal_group_id = signal_group_id
|
|
54
43
|
@request_id = SecureRandom.uuid[0..3]
|
|
55
|
-
@matcher = S0033Matcher.new({ '
|
|
44
|
+
@matcher = S0033Matcher.new({ 'sCI' => 'S0033', 'n' => 'status', 'q' => 'recent' }, request_id: @request_id)
|
|
56
45
|
@subscribe_list = [{ 'sCI' => 'S0033', 'n' => 'status', 'uRt' => '0' }]
|
|
57
46
|
@subscribe_list.map! { |item| item.merge!('sOc' => true) } if @site_proxy.tlc.use_soc?
|
|
58
47
|
@unsubscribe_list = [{ 'sCI' => 'S0033', 'n' => 'status' }]
|
|
59
|
-
@got = []
|
|
60
48
|
@timeout = timeout
|
|
61
49
|
end
|
|
62
50
|
|
|
@@ -97,8 +85,21 @@ module RSMP
|
|
|
97
85
|
end
|
|
98
86
|
|
|
99
87
|
def expect(state)
|
|
100
|
-
|
|
101
|
-
|
|
88
|
+
# Consume in arrival order, retaining later updates for the next expectation.
|
|
89
|
+
# One timeout covers the whole search, including non-matching updates.
|
|
90
|
+
Async::Task.current.with_timeout(@timeout) do
|
|
91
|
+
loop do
|
|
92
|
+
message = wait_for_message!
|
|
93
|
+
return message if get_items(message).any? { |item| @matcher.match(item, state: state) }
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
rescue Async::TimeoutError => e
|
|
97
|
+
RSMP::Result.failure(
|
|
98
|
+
:timeout,
|
|
99
|
+
message: "Signal priority request #{@request_id} did not become #{state} within #{@timeout}s",
|
|
100
|
+
source: :timeout,
|
|
101
|
+
cause: e
|
|
102
|
+
).value!
|
|
102
103
|
end
|
|
103
104
|
|
|
104
105
|
private
|
|
@@ -30,7 +30,6 @@ module RSMP
|
|
|
30
30
|
|
|
31
31
|
def parse_config
|
|
32
32
|
setup_supervisor_config
|
|
33
|
-
validate_timeouts
|
|
34
33
|
end
|
|
35
34
|
|
|
36
35
|
def setup_supervisor_config
|
|
@@ -44,28 +43,14 @@ module RSMP
|
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
def apply_security_codes
|
|
46
|
+
return unless config['secrets'].is_a?(Hash)
|
|
47
|
+
|
|
47
48
|
security_codes = config.dig('secrets', 'security_codes')
|
|
48
|
-
return unless security_codes && !@supervisor_config['sites']['default']['security_codes']
|
|
49
|
+
return unless security_codes.is_a?(Hash) && !@supervisor_config['sites']['default']['security_codes']
|
|
49
50
|
|
|
50
51
|
@supervisor_config['sites']['default']['security_codes'] = security_codes
|
|
51
52
|
end
|
|
52
53
|
|
|
53
|
-
def validate_timeouts
|
|
54
|
-
%w[
|
|
55
|
-
connect
|
|
56
|
-
ready
|
|
57
|
-
status_response
|
|
58
|
-
status_update
|
|
59
|
-
subscribe
|
|
60
|
-
command
|
|
61
|
-
command_response
|
|
62
|
-
alarm
|
|
63
|
-
disconnect
|
|
64
|
-
].each do |key|
|
|
65
|
-
raise "config 'timeouts/#{key}' is missing" unless config['timeouts'][key]
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
54
|
def build_node(options)
|
|
70
55
|
logger = create_supervisor_logger(@supervisor_config)
|
|
71
56
|
supervisor_settings = ConfigNormalizer.normalize_supervisor_settings(
|
|
@@ -93,7 +78,7 @@ module RSMP
|
|
|
93
78
|
def wait_for_handshake
|
|
94
79
|
return if @proxy.ready?
|
|
95
80
|
|
|
96
|
-
log 'Waiting for
|
|
81
|
+
log 'Waiting for site to become ready'
|
|
97
82
|
result = @proxy.wait_for_state :ready, timeout: config['timeouts']['ready']
|
|
98
83
|
raise RSMP::ConnectionError, result.failure.message if result.failure?
|
|
99
84
|
|
data/lib/rsmp/validator.rb
CHANGED
|
@@ -18,6 +18,7 @@ require_relative 'validator/auto_site'
|
|
|
18
18
|
require_relative 'validator/auto_supervisor'
|
|
19
19
|
require_relative 'validator/async_context'
|
|
20
20
|
require_relative 'validator/helpers/connection'
|
|
21
|
+
require_relative 'validator/helpers/expectations'
|
|
21
22
|
require_relative 'validator/helpers/status'
|
|
22
23
|
require_relative 'validator/helpers/input'
|
|
23
24
|
require_relative 'validator/helpers/clock'
|
data/schemas/site_test.json
CHANGED
|
@@ -18,11 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"timeouts": { "type": "object" },
|
|
20
20
|
"components": { "type": "object" },
|
|
21
|
-
"items": { "type": "object" },
|
|
22
|
-
"startup_sequence": { "type": ["string", "null"] },
|
|
23
21
|
"skip_validation": { "type": "array", "items": { "type": "string" } },
|
|
24
|
-
"secrets": { "type": "object" },
|
|
25
|
-
"alarm_triggers": { "type": "object" },
|
|
26
22
|
"log": { "type": "object" }
|
|
27
23
|
},
|
|
28
24
|
"required": ["local_supervisor"],
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"timeouts": { "type": "object" },
|
|
20
20
|
"components": { "type": "object" },
|
|
21
|
-
"items": { "type": "object" },
|
|
22
21
|
"skip_validation": { "type": "array", "items": { "type": "string" } },
|
|
23
|
-
"secrets": { "type": "object" },
|
|
24
22
|
"log": { "type": "object" }
|
|
25
23
|
},
|
|
26
24
|
"required": ["local_site"],
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$defs": {
|
|
4
|
+
"timeout": { "type": "number", "exclusiveMinimum": 0 },
|
|
5
|
+
"components": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"minProperties": 1,
|
|
8
|
+
"propertyNames": { "minLength": 1 },
|
|
9
|
+
"additionalProperties": { "type": ["object", "null"] }
|
|
10
|
+
},
|
|
11
|
+
"items": {
|
|
12
|
+
"type": "array",
|
|
13
|
+
"items": { "type": "integer", "minimum": 1 },
|
|
14
|
+
"uniqueItems": true
|
|
15
|
+
},
|
|
16
|
+
"nonemptyItems": {
|
|
17
|
+
"allOf": [{ "$ref": "#/$defs/items" }],
|
|
18
|
+
"minItems": 1
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$comment": "The message-buffer tests use status_update from Core 3.1.4.",
|
|
4
|
+
"allOf": [{ "$ref": "../core.json" }],
|
|
5
|
+
"if": { "required": ["local_supervisor"] },
|
|
6
|
+
"then": {
|
|
7
|
+
"properties": {
|
|
8
|
+
"timeouts": {
|
|
9
|
+
"required": ["status_update"],
|
|
10
|
+
"properties": { "status_update": { "$ref": "../common.json#/$defs/timeout" } }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$comment": "AggregatedStatus requests use status_response from Core 3.1.5.",
|
|
4
|
+
"allOf": [{ "$ref": "3.1.4.json" }],
|
|
5
|
+
"if": { "required": ["local_supervisor"] },
|
|
6
|
+
"then": {
|
|
7
|
+
"properties": {
|
|
8
|
+
"timeouts": {
|
|
9
|
+
"required": ["status_response"],
|
|
10
|
+
"properties": { "status_response": { "$ref": "../common.json#/$defs/timeout" } }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"required": ["timeouts", "components"],
|
|
5
|
+
"properties": {
|
|
6
|
+
"timeouts": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": ["connect", "ready", "watchdog", "acknowledgement"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"connect": { "$ref": "common.json#/$defs/timeout" },
|
|
11
|
+
"ready": { "$ref": "common.json#/$defs/timeout" },
|
|
12
|
+
"watchdog": { "$ref": "common.json#/$defs/timeout" },
|
|
13
|
+
"acknowledgement": { "$ref": "common.json#/$defs/timeout" }
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"components": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"required": ["main"],
|
|
19
|
+
"properties": { "main": { "$ref": "common.json#/$defs/components" } }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"if": { "required": ["local_supervisor"] },
|
|
23
|
+
"then": {
|
|
24
|
+
"properties": {
|
|
25
|
+
"timeouts": {
|
|
26
|
+
"required": ["disconnect"],
|
|
27
|
+
"properties": {
|
|
28
|
+
"disconnect": { "$ref": "common.json#/$defs/timeout" }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"allOf": [{ "$ref": "1.0.8.json" }],
|
|
4
|
+
"if": { "required": ["local_supervisor"] },
|
|
5
|
+
"then": {
|
|
6
|
+
"properties": {
|
|
7
|
+
"items": {
|
|
8
|
+
"required": ["outputs"],
|
|
9
|
+
"properties": { "outputs": { "$ref": "../common.json#/$defs/nonemptyItems" } }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$comment": "TLC site-test settings. Supervisor tests currently need only the Core settings.",
|
|
4
|
+
"if": { "required": ["local_supervisor"] },
|
|
5
|
+
"then": {
|
|
6
|
+
"required": ["timeouts", "components", "items", "startup_sequence", "secrets"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"timeouts": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"required": ["status_response", "status_update", "command", "command_response", "alarm", "startup_sequence", "functional_position", "yellow_flash"],
|
|
11
|
+
"properties": {
|
|
12
|
+
"status_response": { "$ref": "../common.json#/$defs/timeout" },
|
|
13
|
+
"status_update": { "$ref": "../common.json#/$defs/timeout" },
|
|
14
|
+
"command": { "$ref": "../common.json#/$defs/timeout" },
|
|
15
|
+
"command_response": { "$ref": "../common.json#/$defs/timeout" },
|
|
16
|
+
"alarm": { "$ref": "../common.json#/$defs/timeout" },
|
|
17
|
+
"startup_sequence": { "$ref": "../common.json#/$defs/timeout" },
|
|
18
|
+
"functional_position": { "$ref": "../common.json#/$defs/timeout" },
|
|
19
|
+
"yellow_flash": { "$ref": "../common.json#/$defs/timeout" }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"components": {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"required": ["detector_logic"],
|
|
25
|
+
"properties": { "detector_logic": { "$ref": "../common.json#/$defs/components" } }
|
|
26
|
+
},
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"required": ["plans", "traffic_situations", "emergency_routes", "inputs"],
|
|
30
|
+
"properties": {
|
|
31
|
+
"plans": { "$ref": "../common.json#/$defs/nonemptyItems" },
|
|
32
|
+
"traffic_situations": { "$ref": "../common.json#/$defs/nonemptyItems" },
|
|
33
|
+
"emergency_routes": { "$ref": "../common.json#/$defs/items" },
|
|
34
|
+
"inputs": { "$ref": "../common.json#/$defs/nonemptyItems" }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"startup_sequence": { "type": "string", "minLength": 1 },
|
|
38
|
+
"secrets": {
|
|
39
|
+
"type": "object",
|
|
40
|
+
"required": ["security_codes"],
|
|
41
|
+
"properties": {
|
|
42
|
+
"security_codes": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"required": ["1", "2"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"1": { "type": "string", "minLength": 1 },
|
|
47
|
+
"2": { "type": "string", "minLength": 1 }
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"alarm_triggers": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"properties": {
|
|
55
|
+
"A0302": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": ["input"],
|
|
58
|
+
"properties": {
|
|
59
|
+
"input": { "type": "integer", "minimum": 1 },
|
|
60
|
+
"component": { "type": "string", "minLength": 1 }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"allOf": [{ "$ref": "1.0.7.json" }],
|
|
4
|
+
"if": { "required": ["local_supervisor"] },
|
|
5
|
+
"then": {
|
|
6
|
+
"properties": {
|
|
7
|
+
"components": {
|
|
8
|
+
"required": ["signal_group"],
|
|
9
|
+
"properties": { "signal_group": { "$ref": "../common.json#/$defs/components" } }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"allOf": [{ "$ref": "1.0.15.json" }],
|
|
4
|
+
"if": { "required": ["local_supervisor"] },
|
|
5
|
+
"then": {
|
|
6
|
+
"properties": {
|
|
7
|
+
"timeouts": {
|
|
8
|
+
"required": ["priority_completion"],
|
|
9
|
+
"properties": { "priority_completion": { "$ref": "../common.json#/$defs/timeout" } }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"core": {
|
|
3
|
+
"3.1.1": "core.json",
|
|
4
|
+
"3.1.2": "core.json",
|
|
5
|
+
"3.1.3": "core.json",
|
|
6
|
+
"3.1.4": "core/3.1.4.json",
|
|
7
|
+
"3.1.5": "core/3.1.5.json",
|
|
8
|
+
"3.2.0": "core/3.1.5.json",
|
|
9
|
+
"3.2.1": "core/3.1.5.json",
|
|
10
|
+
"3.2.2": "core/3.1.5.json",
|
|
11
|
+
"3.3.0": "core/3.1.5.json"
|
|
12
|
+
},
|
|
13
|
+
"tlc": {
|
|
14
|
+
"1.0.7": "tlc/1.0.7.json",
|
|
15
|
+
"1.0.8": "tlc/1.0.8.json",
|
|
16
|
+
"1.0.9": "tlc/1.0.8.json",
|
|
17
|
+
"1.0.10": "tlc/1.0.8.json",
|
|
18
|
+
"1.0.11": "tlc/1.0.8.json",
|
|
19
|
+
"1.0.12": "tlc/1.0.8.json",
|
|
20
|
+
"1.0.13": "tlc/1.0.8.json",
|
|
21
|
+
"1.0.14": "tlc/1.0.8.json",
|
|
22
|
+
"1.0.15": "tlc/1.0.15.json",
|
|
23
|
+
"1.1.0": "tlc/1.1.0.json",
|
|
24
|
+
"1.2.0": "tlc/1.1.0.json",
|
|
25
|
+
"1.2.1": "tlc/1.1.0.json",
|
|
26
|
+
"1.3.0": "tlc/1.1.0.json"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -15,27 +15,49 @@ describe 'Site::Core' do
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
# Verify that aggregated status uses null for unused attributes, from SXL 1.1.0
|
|
18
|
+
# Verify that aggregated status uses null for unused attributes, from SXL 1.1.0 and core before 3.3.0.
|
|
19
19
|
# For SXL versions before 1.1.0 empty strings "" is also allowed.
|
|
20
20
|
#
|
|
21
21
|
# 1. Given the is reconnected
|
|
22
22
|
# 2. When we receive an aggregated status
|
|
23
23
|
# 3. Then fP and fS should be null
|
|
24
24
|
it 'uses null for functional position/state' do
|
|
25
|
-
with_site(:isolated, sxl: '>=1.1.0',
|
|
25
|
+
with_site(:isolated, sxl: '>=1.1.0', core: '<3.3.0',
|
|
26
26
|
'collect' => {
|
|
27
|
-
filter: RSMP::Filter.new(type: 'AggregatedStatus'),
|
|
27
|
+
filter: RSMP::Filter.new(type: 'AggregatedStatus', ingoing: true, outgoing: false),
|
|
28
28
|
timeout: RSMP::Validator.get_config('timeouts', 'ready'),
|
|
29
|
-
num: 1
|
|
30
|
-
ingoing: true
|
|
29
|
+
num: 1
|
|
31
30
|
}) do |site_proxy|
|
|
32
31
|
collector = site_proxy.collector
|
|
33
32
|
aggregated_status = collector.wait!.first
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
expect_or_stop(aggregated_status).to be_a(RSMP::AggregatedStatus)
|
|
35
|
+
|
|
36
36
|
expect(aggregated_status.attribute('fP')).to be_nil
|
|
37
37
|
expect(aggregated_status.attribute('fS')).to be_nil
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
+
|
|
41
|
+
# Verify that aggregated status omits unused attributes from core 3.3.0.
|
|
42
|
+
#
|
|
43
|
+
# 1. Given the is reconnected
|
|
44
|
+
# 2. When we receive an aggregated status
|
|
45
|
+
# 3. Then fP and fS should be omitted
|
|
46
|
+
it 'omits functional position/state' do
|
|
47
|
+
with_site(:isolated, core: '>=3.3.0',
|
|
48
|
+
'collect' => {
|
|
49
|
+
filter: RSMP::Filter.new(type: 'AggregatedStatus', ingoing: true, outgoing: false),
|
|
50
|
+
timeout: RSMP::Validator.get_config('timeouts', 'ready'),
|
|
51
|
+
num: 1
|
|
52
|
+
}) do |site_proxy|
|
|
53
|
+
collector = site_proxy.collector
|
|
54
|
+
aggregated_status = collector.wait!.first
|
|
55
|
+
|
|
56
|
+
expect_or_stop(aggregated_status).to be_a(RSMP::AggregatedStatus)
|
|
57
|
+
|
|
58
|
+
expect(aggregated_status.attributes.key?('fP')).to be == false
|
|
59
|
+
expect(aggregated_status.attributes.key?('fS')).to be == false
|
|
60
|
+
end
|
|
61
|
+
end
|
|
40
62
|
end
|
|
41
63
|
end
|