utils: remove alarm-type-qualifier from alarm managing functions
We do not use alarm-type-qualifiers in velia's alarms. Every alarm is
invoked with empty string in alarm-type-qualifier so this parameter
is useless for us and only clutters up the functions' interfaces.
Change-Id: I40adadca8afd801bd177c642afe84b8a09d98d15
diff --git a/src/ietf-hardware/sysrepo/Sysrepo.cpp b/src/ietf-hardware/sysrepo/Sysrepo.cpp
index aff779d..1a0fe69 100644
--- a/src/ietf-hardware/sysrepo/Sysrepo.cpp
+++ b/src/ietf-hardware/sysrepo/Sysrepo.cpp
@@ -104,10 +104,10 @@
for (const auto& sensorXPath : activeSensors) {
if (!seenSensors.contains(sensorXPath)) {
auto componentXPath = extractComponentPrefix(sensorXPath);
- alarms::addResourceToInventory(m_session, ALARM_THRESHOLD_CROSSING_LOW, std::nullopt, componentXPath);
- alarms::addResourceToInventory(m_session, ALARM_THRESHOLD_CROSSING_HIGH, std::nullopt, componentXPath);
- alarms::addResourceToInventory(m_session, ALARM_SENSOR_MISSING, std::nullopt, componentXPath);
- alarms::addResourceToInventory(m_session, ALARM_SENSOR_NONOPERATIONAL, std::nullopt, componentXPath);
+ alarms::addResourceToInventory(m_session, ALARM_THRESHOLD_CROSSING_LOW, componentXPath);
+ alarms::addResourceToInventory(m_session, ALARM_THRESHOLD_CROSSING_HIGH, componentXPath);
+ alarms::addResourceToInventory(m_session, ALARM_SENSOR_MISSING, componentXPath);
+ alarms::addResourceToInventory(m_session, ALARM_SENSOR_NONOPERATIONAL, componentXPath);
}
}
seenSensors.merge(activeSensors);
@@ -130,14 +130,14 @@
/* Publish sideloaded alarms */
for (const auto& [alarm, resource, severity, text] : sideLoadedAlarms) {
// Sideloaded alarms are not registered using the code above, let's register those too
- alarms::addResourceToInventory(m_session, ALARM_SENSOR_MISSING, std::nullopt, resource);
+ alarms::addResourceToInventory(m_session, ALARM_SENSOR_MISSING, resource);
bool isActive = activeSideLoadedAlarms.contains({alarm, resource});
if (isActive && severity == "cleared") {
- alarms::push(m_session, alarm, std::nullopt, resource, "cleared", text);
+ alarms::push(m_session, alarm, resource, "cleared", text);
activeSideLoadedAlarms.erase({alarm, resource});
} else if (!isActive && severity != "cleared") {
- alarms::push(m_session, alarm, std::nullopt, resource, severity, text);
+ alarms::push(m_session, alarm, resource, severity, text);
activeSideLoadedAlarms.insert({alarm, resource});
}
}
@@ -152,9 +152,9 @@
}
if (value == "nonoperational" && oldValue != "nonoperational") {
- alarms::push(m_session, ALARM_SENSOR_NONOPERATIONAL, std::nullopt, extractComponentPrefix(leaf), ALARM_SENSOR_NONOPERATIONAL_SEVERITY, ALARM_SENSOR_NONOPERATIONAL_DESCRIPTION);
+ alarms::push(m_session, ALARM_SENSOR_NONOPERATIONAL, extractComponentPrefix(leaf), ALARM_SENSOR_NONOPERATIONAL_SEVERITY, ALARM_SENSOR_NONOPERATIONAL_DESCRIPTION);
} else if (value == "ok" && oldValue && oldValue != "ok" /* don't call clear-alarm if we see this node for the first time, i.e., oldvalue is nullopt */) {
- alarms::push(m_session, ALARM_SENSOR_NONOPERATIONAL, std::nullopt, extractComponentPrefix(leaf), ALARM_CLEARED, ALARM_SENSOR_NONOPERATIONAL_DESCRIPTION);
+ alarms::push(m_session, ALARM_SENSOR_NONOPERATIONAL, extractComponentPrefix(leaf), ALARM_CLEARED, ALARM_SENSOR_NONOPERATIONAL_DESCRIPTION);
}
}
}
@@ -171,14 +171,14 @@
if (state == State::NoValue) {
logAlarm(m_log, componentXPath, ALARM_SENSOR_MISSING, ALARM_MISSING_SEVERITY);
- alarms::push(m_session, ALARM_SENSOR_MISSING, std::nullopt, componentXPath, ALARM_MISSING_SEVERITY, ALARM_MISSING_DESCRIPTION);
+ alarms::push(m_session, ALARM_SENSOR_MISSING, componentXPath, ALARM_MISSING_SEVERITY, ALARM_MISSING_DESCRIPTION);
} else if (prevState == State::NoValue) {
logAlarm(m_log, componentXPath, ALARM_SENSOR_MISSING, ALARM_CLEARED);
/* The alarm message is same for both setting and clearing the alarm. RFC8632 says that it is
* "The string used to inform operators about the alarm. This MUST contain enough information for an operator to be able to understand the problem and how to resolve it.",
* i.e., from my POV it does not make sense to say something like "cleared" when clearing the alarm as this would not be beneficial for the operator to understand what happened.
*/
- alarms::push(m_session, ALARM_SENSOR_MISSING, std::nullopt, componentXPath, ALARM_CLEARED, ALARM_MISSING_DESCRIPTION);
+ alarms::push(m_session, ALARM_SENSOR_MISSING, componentXPath, ALARM_CLEARED, ALARM_MISSING_DESCRIPTION);
}
/*
@@ -192,19 +192,19 @@
*/
if (isThresholdCrossingLow(state)) {
logAlarm(m_log, componentXPath, ALARM_THRESHOLD_CROSSING_LOW, toYangAlarmSeverity(state));
- alarms::push(m_session, ALARM_THRESHOLD_CROSSING_LOW, std::nullopt, componentXPath, toYangAlarmSeverity(state), ALARM_THRESHOLD_CROSSING_LOW_DESCRIPTION);
+ alarms::push(m_session, ALARM_THRESHOLD_CROSSING_LOW, componentXPath, toYangAlarmSeverity(state), ALARM_THRESHOLD_CROSSING_LOW_DESCRIPTION);
} else if (isThresholdCrossingHigh(state)) {
logAlarm(m_log, componentXPath, ALARM_THRESHOLD_CROSSING_HIGH, toYangAlarmSeverity(state));
- alarms::push(m_session, ALARM_THRESHOLD_CROSSING_HIGH, std::nullopt, componentXPath, toYangAlarmSeverity(state), ALARM_THRESHOLD_CROSSING_HIGH_DESCRIPTION);
+ alarms::push(m_session, ALARM_THRESHOLD_CROSSING_HIGH, componentXPath, toYangAlarmSeverity(state), ALARM_THRESHOLD_CROSSING_HIGH_DESCRIPTION);
}
/* Now we can clear the old threshold alarms that are no longer active, i.e., we transition away from the CriticalLow/WarningLow or CriticalHigh/WarningHigh. */
if (!isThresholdCrossingLow(state) && isThresholdCrossingLow(prevState)) {
logAlarm(m_log, componentXPath, ALARM_THRESHOLD_CROSSING_LOW, ALARM_CLEARED);
- alarms::push(m_session, ALARM_THRESHOLD_CROSSING_LOW, std::nullopt, componentXPath, ALARM_CLEARED, ALARM_THRESHOLD_CROSSING_LOW_DESCRIPTION);
+ alarms::push(m_session, ALARM_THRESHOLD_CROSSING_LOW, componentXPath, ALARM_CLEARED, ALARM_THRESHOLD_CROSSING_LOW_DESCRIPTION);
} else if (!isThresholdCrossingHigh(state) && isThresholdCrossingHigh(prevState)) {
logAlarm(m_log, componentXPath, ALARM_THRESHOLD_CROSSING_HIGH, ALARM_CLEARED);
- alarms::push(m_session, ALARM_THRESHOLD_CROSSING_HIGH, std::nullopt, componentXPath, ALARM_CLEARED, ALARM_THRESHOLD_CROSSING_HIGH_DESCRIPTION);
+ alarms::push(m_session, ALARM_THRESHOLD_CROSSING_HIGH, componentXPath, ALARM_CLEARED, ALARM_THRESHOLD_CROSSING_HIGH_DESCRIPTION);
}
thresholdsStates[sensorXPath] = state;