Class: RSMP::Component
Overview
Constant Summary
RSMP::ComponentBase::AGGREGATED_STATUS_KEYS
Instance Attribute Summary
#aggregated_status, #aggregated_status_bools, #alarms, #c_id, #component_type, #grouped, #name, #node, #ntsoid, #statuses, #xnid
Instance Method Summary
collapse
#aggregated_status_changed, #clear_aggregated_status, #clear_alarm_timestamps, #get_alarm_state, #initialize, #inspect, #log, #now, #set_aggregated_status, #update_metadata
Instance Method Details
#acknowledge_alarm(alarm_code) ⇒ Object
12
13
14
15
16
17
18
19
20
|
# File 'lib/rsmp/component/component.rb', line 12
def acknowledge_alarm(alarm_code)
alarm = get_alarm_state alarm_code
if alarm.acknowledge
log "Acknowledging alarm #{alarm_code}", level: :info
@node.alarm_acknowledged alarm
else
log "Alarm #{alarm_code} already acknowledged", level: :info
end
end
|
#activate_alarm(alarm_code) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/rsmp/component/component.rb', line 42
def activate_alarm(alarm_code)
alarm = get_alarm_state alarm_code
return unless alarm.activate
log "Activating alarm #{alarm_code}", level: :info
@node.alarm_activated_or_deactivated alarm
end
|
#deactivate_alarm(alarm_code) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/rsmp/component/component.rb', line 50
def deactivate_alarm(alarm_code)
alarm = get_alarm_state alarm_code
return unless alarm.deactivate
log "Deactivating alarm #{alarm_code}", level: :info
@node.alarm_activated_or_deactivated alarm
end
|
#get_status(status_code, status_name = nil, _options = {}) ⇒ Object
8
9
10
|
# File 'lib/rsmp/component/component.rb', line 8
def get_status(status_code, status_name = nil, _options = {})
raise UnknownStatus, "Status #{status_code}/#{status_name} not implemented by #{self.class}"
end
|
#handle_command(command_code, _arg) ⇒ Object
4
5
6
|
# File 'lib/rsmp/component/component.rb', line 4
def handle_command(command_code, _arg)
raise UnknownCommand, "Command #{command_code} not implemented by #{self.class}"
end
|
#resume_alarm(alarm_code) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/rsmp/component/component.rb', line 32
def resume_alarm(alarm_code)
alarm = get_alarm_state alarm_code
if alarm.resume
log "Resuming alarm #{alarm_code}", level: :info
@node.alarm_suspended_or_resumed alarm
else
log "Alarm #{alarm_code} already resumed", level: :info
end
end
|
#status_updates_sent ⇒ Object
58
|
# File 'lib/rsmp/component/component.rb', line 58
def status_updates_sent; end
|
#suspend_alarm(alarm_code) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/rsmp/component/component.rb', line 22
def suspend_alarm(alarm_code)
alarm = get_alarm_state alarm_code
if alarm.suspend
log "Suspending alarm #{alarm_code}", level: :info
@node.alarm_suspended_or_resumed alarm
else
log "Alarm #{alarm_code} already suspended", level: :info
end
end
|