rsmp 0.19.2 → 0.19.4
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/Gemfile.lock +13 -4
- data/lib/rsmp/alarm_state.rb +51 -40
- data/lib/rsmp/component_base.rb +4 -0
- data/lib/rsmp/message.rb +15 -7
- data/lib/rsmp/node.rb +5 -1
- data/lib/rsmp/rsmp.rb +3 -0
- data/lib/rsmp/site.rb +3 -6
- data/lib/rsmp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f188c0b34f0877ae12b9948d0784b5e1f3f2a44e52e11995ba2adf12e299f4a
|
4
|
+
data.tar.gz: a2b8097b5d73897840d093ce8fbf1690bd7c8bee1e1a2102a605565d12c22ddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '04258e76affbf8e3def87f12edaed2bde5ccf6bf36dfba175c47488082bfaa1e4e8e9c0c8c749295b098e73a39b0ca28bcb0ed4d0e0c90c054486f29a8e0d02d'
|
7
|
+
data.tar.gz: 516d8818dc1737648afdb7cb1496d3c96ea2e9870dc61d185d3bb5a40897ea85ecb930cfece5e5f8dbd1bf8abaf6a62244c5f6188498b082e4c896c02551b190
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rsmp (0.19.
|
4
|
+
rsmp (0.19.4)
|
5
5
|
async (~> 1.30.3)
|
6
6
|
async-io (~> 1.34.3)
|
7
7
|
colorize (~> 0.8.1)
|
@@ -27,7 +27,8 @@ GEM
|
|
27
27
|
builder (3.2.4)
|
28
28
|
childprocess (4.1.0)
|
29
29
|
colorize (0.8.1)
|
30
|
-
console (1.
|
30
|
+
console (1.17.2)
|
31
|
+
fiber-annotation
|
31
32
|
fiber-local
|
32
33
|
contracts (0.17)
|
33
34
|
cucumber (8.0.0)
|
@@ -58,12 +59,14 @@ GEM
|
|
58
59
|
ecma-re-validator (0.4.0)
|
59
60
|
regexp_parser (~> 2.2)
|
60
61
|
ffi (1.15.5)
|
62
|
+
fiber-annotation (0.2.0)
|
61
63
|
fiber-local (1.0.0)
|
62
64
|
hana (1.3.7)
|
63
|
-
json_schemer (0.2.
|
65
|
+
json_schemer (0.2.25)
|
64
66
|
ecma-re-validator (~> 0.3)
|
65
67
|
hana (~> 1.3)
|
66
68
|
regexp_parser (~> 2.0)
|
69
|
+
simpleidn (~> 0.2)
|
67
70
|
uri_template (~> 0.7)
|
68
71
|
mime-types (3.4.1)
|
69
72
|
mime-types-data (~> 3.2015)
|
@@ -71,7 +74,7 @@ GEM
|
|
71
74
|
multi_test (1.1.0)
|
72
75
|
nio4r (2.5.9)
|
73
76
|
rake (13.0.6)
|
74
|
-
regexp_parser (2.8.
|
77
|
+
regexp_parser (2.8.1)
|
75
78
|
rsmp_schema (0.4.0)
|
76
79
|
json_schemer (~> 0.2.21)
|
77
80
|
thor (~> 1.2.1)
|
@@ -88,11 +91,16 @@ GEM
|
|
88
91
|
diff-lcs (>= 1.2.0, < 2.0)
|
89
92
|
rspec-support (~> 3.12.0)
|
90
93
|
rspec-support (3.12.0)
|
94
|
+
simpleidn (0.2.1)
|
95
|
+
unf (~> 0.1.4)
|
91
96
|
sys-uname (1.2.3)
|
92
97
|
ffi (~> 1.1)
|
93
98
|
thor (1.2.2)
|
94
99
|
timecop (0.9.6)
|
95
100
|
timers (4.3.5)
|
101
|
+
unf (0.1.4)
|
102
|
+
unf_ext
|
103
|
+
unf_ext (0.0.8.2)
|
96
104
|
uri_template (0.7.0)
|
97
105
|
|
98
106
|
PLATFORMS
|
@@ -102,6 +110,7 @@ PLATFORMS
|
|
102
110
|
x86_64-darwin-19
|
103
111
|
x86_64-darwin-20
|
104
112
|
x86_64-darwin-21
|
113
|
+
x86_64-darwin-22
|
105
114
|
x86_64-linux
|
106
115
|
|
107
116
|
DEPENDENCIES
|
data/lib/rsmp/alarm_state.rb
CHANGED
@@ -1,33 +1,55 @@
|
|
1
1
|
module RSMP
|
2
|
-
|
2
|
+
|
3
|
+
# The state of an alarm on a component.
|
4
|
+
# The alarm state is for a particular alarm code,
|
5
|
+
# a component typically have an alarm state for each
|
6
|
+
# alarm code that is defined for the component type.
|
7
|
+
|
3
8
|
class AlarmState
|
4
9
|
attr_reader :component_id, :code, :acknowledged, :suspended, :active, :timestamp, :category, :priority, :rvs
|
5
10
|
|
6
|
-
def
|
11
|
+
def self.create_from_message component, message
|
12
|
+
self.new(
|
13
|
+
component: component,
|
14
|
+
code: message.attribute("aCId"),
|
15
|
+
timestamp: RSMP::Clock.parse(message.attribute('aTs')),
|
16
|
+
acknowledged: message.attribute('ack') == 'Acknowledged',
|
17
|
+
suspended: message.attribute('aS') == 'suspended',
|
18
|
+
active: message.attribute('sS') == 'Active',
|
19
|
+
category: message.attribute('cat'),
|
20
|
+
priority: message.attribute('pri').to_i,
|
21
|
+
rvs: message.attribute('rvs')
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize component:, code:,
|
26
|
+
suspended: false, acknowledged: false, active: false, timestamp: nil,
|
27
|
+
category: 'D', priority: 2, rvs: []
|
7
28
|
@component = component
|
8
29
|
@component_id = component.c_id
|
9
30
|
@code = code
|
10
|
-
@suspended =
|
11
|
-
@acknowledged =
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
|
31
|
+
@suspended = !!suspended
|
32
|
+
@acknowledged = !!acknowledged
|
33
|
+
@active = !!active
|
34
|
+
@timestamp = timestamp
|
35
|
+
@category = category || 'D'
|
36
|
+
@priority = priority || 2
|
37
|
+
@rvs = rvs
|
38
|
+
|
39
|
+
update_timestamp unless @timestamp
|
18
40
|
end
|
19
41
|
|
20
42
|
def to_hash
|
21
43
|
{
|
22
|
-
'cId' => component_id,
|
23
|
-
'aCId' => code,
|
24
|
-
'aTs' => Clock.to_s(timestamp),
|
25
|
-
'ack' => (acknowledged ? 'Acknowledged' : 'notAcknowledged'),
|
26
|
-
'sS' => (suspended ? 'suspended' : 'notSuspended'),
|
27
|
-
'aS' => (active ? 'Active' : 'inActive'),
|
28
|
-
'cat' => category,
|
29
|
-
'pri' => priority.to_s,
|
30
|
-
'rvs' => rvs
|
44
|
+
'cId' => @component_id,
|
45
|
+
'aCId' => @code,
|
46
|
+
'aTs' => Clock.to_s(@timestamp),
|
47
|
+
'ack' => (@acknowledged ? 'Acknowledged' : 'notAcknowledged'),
|
48
|
+
'sS' => (@suspended ? 'suspended' : 'notSuspended'),
|
49
|
+
'aS' => (@active ? 'Active' : 'inActive'),
|
50
|
+
'cat' => @category,
|
51
|
+
'pri' => @priority.to_s,
|
52
|
+
'rvs' => @rvs
|
31
53
|
}
|
32
54
|
end
|
33
55
|
|
@@ -65,42 +87,31 @@ module RSMP
|
|
65
87
|
end
|
66
88
|
|
67
89
|
def update_timestamp
|
68
|
-
@timestamp = @component.
|
69
|
-
end
|
70
|
-
|
71
|
-
def to_message specialization:
|
72
|
-
Alarm.new(
|
73
|
-
'cId' => @component_id,
|
74
|
-
'aSp' => specialization,
|
75
|
-
'aCId' => @code,
|
76
|
-
'aTs' => Clock.to_s(@timestamp),
|
77
|
-
'ack' => (@acknowledged ? 'Acknowledged' : 'notAcknowledged'),
|
78
|
-
'sS' => (@suspended ? 'suspended' : 'notSuspended'),
|
79
|
-
'aS' => (@active ? 'Active' : 'inActive'),
|
80
|
-
'cat' => @category,
|
81
|
-
'pri' => @priority.to_s,
|
82
|
-
'rvs' => @rvs
|
83
|
-
)
|
90
|
+
@timestamp = @component.now
|
84
91
|
end
|
85
92
|
|
86
93
|
def differ_from_message? message
|
87
|
-
return true if @timestamp != message.attribute('aTs')
|
88
|
-
return true if message.attribute('ack') && @acknowledged != (message.attribute('ack') == '
|
89
|
-
return true if message.attribute('sS') && @suspended != (message.attribute('sS') == '
|
90
|
-
return true if message.attribute('aS') && @active != (message.attribute('aS') == '
|
94
|
+
return true if RSMP::Clock.to_s(@timestamp) != message.attribute('aTs')
|
95
|
+
return true if message.attribute('ack') && @acknowledged != (message.attribute('ack') == 'Acknowledged')
|
96
|
+
return true if message.attribute('sS') && @suspended != (message.attribute('sS') == 'suspended')
|
97
|
+
return true if message.attribute('aS') && @active != (message.attribute('aS') == 'Active')
|
91
98
|
return true if message.attribute('cat') && @category != message.attribute('cat')
|
92
99
|
return true if message.attribute('pri') && @priority != message.attribute('pri').to_i
|
93
100
|
#return true @rvs = message.attribute('rvs')
|
94
101
|
false
|
95
102
|
end
|
96
103
|
|
104
|
+
def message_is_older? message
|
105
|
+
Time.parse(message.attribute('aTs')) < @timestamp
|
106
|
+
end
|
107
|
+
|
97
108
|
# update from rsmp message
|
98
109
|
# component id, alarm code and specialization are not updated
|
99
110
|
def update_from_message message
|
100
111
|
unless differ_from_message? message
|
101
112
|
raise RepeatedAlarmError.new("no changes from previous alarm #{message.m_id_short}")
|
102
113
|
end
|
103
|
-
if
|
114
|
+
if message_is_older? message
|
104
115
|
raise TimestampError.new("timestamp is earlier than previous alarm #{message.m_id_short}")
|
105
116
|
end
|
106
117
|
ensure
|
data/lib/rsmp/component_base.rb
CHANGED
data/lib/rsmp/message.rb
CHANGED
@@ -233,7 +233,7 @@ module RSMP
|
|
233
233
|
class AlarmIssue < Alarm
|
234
234
|
def initialize attributes = {}
|
235
235
|
super({
|
236
|
-
"aSp" => "Issue"
|
236
|
+
"aSp" => "Issue"
|
237
237
|
}.merge attributes)
|
238
238
|
end
|
239
239
|
end
|
@@ -246,7 +246,7 @@ module RSMP
|
|
246
246
|
end
|
247
247
|
end
|
248
248
|
|
249
|
-
class
|
249
|
+
class AlarmAcknowledge < Alarm
|
250
250
|
def initialize attributes = {}
|
251
251
|
super({
|
252
252
|
"aSp" => "Acknowledge",
|
@@ -254,18 +254,18 @@ module RSMP
|
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
257
|
-
class
|
257
|
+
class AlarmAcknowledged < Alarm
|
258
258
|
def initialize attributes = {}
|
259
259
|
super({
|
260
|
-
"aSp" => "
|
260
|
+
"aSp" => "Acknowledge",
|
261
|
+
"ack" => "acknowledged"
|
261
262
|
}.merge attributes)
|
262
263
|
end
|
263
264
|
end
|
264
|
-
|
265
|
-
class AlarmResume < Alarm
|
265
|
+
class AlarmSuspend < Alarm
|
266
266
|
def initialize attributes = {}
|
267
267
|
super({
|
268
|
-
"aSp" => "
|
268
|
+
"aSp" => "Suspend",
|
269
269
|
}.merge attributes)
|
270
270
|
end
|
271
271
|
end
|
@@ -279,6 +279,14 @@ module RSMP
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
+
class AlarmResume < Alarm
|
283
|
+
def initialize attributes = {}
|
284
|
+
super({
|
285
|
+
"aSp" => "Resume",
|
286
|
+
}.merge attributes)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
282
290
|
class AlarmResumed < Alarm
|
283
291
|
def initialize attributes = {}
|
284
292
|
super({
|
data/lib/rsmp/node.rb
CHANGED
@@ -8,7 +8,7 @@ module RSMP
|
|
8
8
|
|
9
9
|
attr_reader :archive, :logger, :task, :deferred, :error_queue, :clock, :collector
|
10
10
|
|
11
|
-
def initialize options
|
11
|
+
def initialize options={}
|
12
12
|
initialize_logging options
|
13
13
|
initialize_task
|
14
14
|
@deferred = []
|
@@ -18,6 +18,10 @@ module RSMP
|
|
18
18
|
@collect = options[:collect]
|
19
19
|
end
|
20
20
|
|
21
|
+
def now
|
22
|
+
clock.now
|
23
|
+
end
|
24
|
+
|
21
25
|
# stop proxies, then call super
|
22
26
|
def stop_subtasks
|
23
27
|
@proxies.each { |proxy| proxy.stop }
|
data/lib/rsmp/rsmp.rb
CHANGED
data/lib/rsmp/site.rb
CHANGED
@@ -97,18 +97,15 @@ module RSMP
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def alarm_acknowledged alarm_state
|
100
|
-
|
101
|
-
send_alarm alarm
|
100
|
+
send_alarm AlarmAcknowledged.new( alarm_state.to_hash )
|
102
101
|
end
|
103
102
|
|
104
103
|
def alarm_suspended_or_resumed alarm_state
|
105
|
-
|
106
|
-
send_alarm alarm
|
104
|
+
send_alarm AlarmSuspended.new( alarm_state.to_hash )
|
107
105
|
end
|
108
106
|
|
109
107
|
def alarm_activated_or_deactivated alarm_state
|
110
|
-
|
111
|
-
send_alarm alarm
|
108
|
+
send_alarm AlarmIssue.new( alarm_state.to_hash )
|
112
109
|
end
|
113
110
|
|
114
111
|
def send_alarm alarm
|
data/lib/rsmp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.19.
|
4
|
+
version: 0.19.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emil Tin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|