osaf/services/saf/amf/amfd/include/ntf.h | 2 +
osaf/services/saf/amf/amfd/include/util.h | 1 +
osaf/services/saf/amf/amfd/ndproc.cc | 13 ++++
osaf/services/saf/amf/amfd/ntf.cc | 84 ++++++++++++++++++++++--------
osaf/services/saf/amf/amfd/util.cc | 13 ++++
5 files changed, 90 insertions(+), 23 deletions(-)
Error report and error clear are miscellaneous types of notifications.
At present Notification Service does not support
saNtfMiscellaneousNotificationAllocate().
So in this enhancement, alarms will be sent and cleared whenever
AMF reports error and clear error on component respectively.
See #106 for sample error report and error clear notification.
diff --git a/osaf/services/saf/amf/amfd/include/ntf.h
b/osaf/services/saf/amf/amfd/include/ntf.h
--- a/osaf/services/saf/amf/amfd/include/ntf.h
+++ b/osaf/services/saf/amf/amfd/include/ntf.h
@@ -93,4 +93,6 @@ uint32_t sendStateChangeNotificationAvd(
/* Clearing of alarms */
void avd_alarm_clear(const SaNameT *name, SaUint16T minorId, uint32_t
probableCause);
+void avd_send_error_report_ntf(const SaNameT *name, AVSV_ERR_RCVR recovery);
+
#endif
diff --git a/osaf/services/saf/amf/amfd/include/util.h
b/osaf/services/saf/amf/amfd/include/util.h
--- a/osaf/services/saf/amf/amfd/include/util.h
+++ b/osaf/services/saf/amf/amfd/include/util.h
@@ -86,6 +86,7 @@ extern const char *avd_readiness_state_n
extern const char *avd_ass_state[];
extern const char *avd_ha_state[];
extern const char *avd_proxy_status_name[];
+extern const char *amf_recovery[];
struct cl_cb_tag;
struct avd_avnd_tag;
diff --git a/osaf/services/saf/amf/amfd/ndproc.cc
b/osaf/services/saf/amf/amfd/ndproc.cc
--- a/osaf/services/saf/amf/amfd/ndproc.cc
+++ b/osaf/services/saf/amf/amfd/ndproc.cc
@@ -707,6 +707,19 @@ void avd_data_update_req_evh(AVD_CL_CB *
value_len);
}
break;
+ case saAmfCompRecoveryOnError_ID:
+ /* This attribute Id is currently used by AMFD
to update AMFND
+ for the modification of
"saAmfCompRecoveryOnError" in any
+ component. There is no update from AMFND to
AMFD for this
+ attribute.
+ So AMFND can currently use this attribute id
for sending
+ error report message to AMFD when error is
reported on a
+ component. This received message is
translated into a
+ alarm notification by AMFD.
+ */
+ l_val =
ntohl(*((uint32_t*)&n2d_msg->msg_info.n2d_data_req.param_info.value[0]));
+
avd_send_error_report_ntf(&comp->comp_info.name,
static_cast<AVSV_ERR_RCVR>(l_val));
+ break;
default:
/* log error that a the object value is invalid
*/
LOG_EM("%s:%u: %u", __FILE__, __LINE__,
n2d_msg->msg_info.n2d_data_req.param_info.attr_id);
diff --git a/osaf/services/saf/amf/amfd/ntf.cc
b/osaf/services/saf/amf/amfd/ntf.cc
--- a/osaf/services/saf/amf/amfd/ntf.cc
+++ b/osaf/services/saf/amf/amfd/ntf.cc
@@ -157,7 +157,7 @@ void avd_send_si_unassigned_alarm(const
}
/*****************************************************************************
- Name : avd_send_comp_proxy_status_unproxied_alarm
+
Description : This function generates a Proxy Status of a Component
Changed to Unproxied alarm.
@@ -504,31 +504,42 @@ SaAisErrorT fill_ntf_header_part_avd(SaN
/* Fill the additional info if present */
if (type != 0) {
- SaStringT dest_ptr;
- SaAisErrorT ret;
- SaNameT *name = (SaNameT*)(add_info);
- if (type == 1) {
- /* node_name */
- notificationHeader->additionalInfo[0].infoId =
SA_AMF_NODE_NAME;
- notificationHeader->additionalInfo[0].infoType =
SA_NTF_VALUE_LDAP_NAME;
+ switch (minorId) {
+ case SA_AMF_NTFID_ERROR_REPORT:
+ SaNtfAdditionalInfoT *info;
+ info = (SaNtfAdditionalInfoT *) add_info;
+ notificationHeader->additionalInfo[0].infoId =
info->infoId;
+ notificationHeader->additionalInfo[0].infoType =
info->infoType;
+ notificationHeader->additionalInfo[0].infoValue =
info->infoValue;
+ break;
+ default:
+ SaStringT dest_ptr;
+ SaAisErrorT ret;
+ SaNameT *name = (SaNameT*)(add_info);
+ if (type == 1) {
+ /* node_name */
+ notificationHeader->additionalInfo[0].infoId =
SA_AMF_NODE_NAME;
+ notificationHeader->additionalInfo[0].infoType
= SA_NTF_VALUE_LDAP_NAME;
- } else if (type == 2) {
- /* si_name */
- notificationHeader->additionalInfo[0].infoId =
SA_AMF_SI_NAME;
- notificationHeader->additionalInfo[0].infoType =
SA_NTF_VALUE_LDAP_NAME;
+ } else if (type == 2) {
+ /* si_name */
+ notificationHeader->additionalInfo[0].infoId =
SA_AMF_SI_NAME;
+ notificationHeader->additionalInfo[0].infoType
= SA_NTF_VALUE_LDAP_NAME;
+ }
+ ret = saNtfPtrValAllocate(notificationHandle,
+ sizeof (SaNameT) + 1,
+ (void**)&dest_ptr,
+
&(notificationHeader->additionalInfo[0].infoValue));
+
+ if (ret != SA_AIS_OK) {
+ LOG_ER("%s: saNtfPtrValAllocate Failed (%u)",
__FUNCTION__, ret);
+ return
static_cast<SaAisErrorT>(NCSCC_RC_FAILURE);
+ }
+
+ memcpy(dest_ptr, name, sizeof(SaNameT));
+ break;
}
- ret = saNtfPtrValAllocate(notificationHandle,
- sizeof (SaNameT) + 1,
- (void**)&dest_ptr,
-
&(notificationHeader->additionalInfo[0].infoValue));
-
- if (ret != SA_AIS_OK) {
- LOG_ER("%s: saNtfPtrValAllocate Failed (%u)",
__FUNCTION__, ret);
- return static_cast<SaAisErrorT>(NCSCC_RC_FAILURE);
- }
-
- memcpy(dest_ptr, name, sizeof(SaNameT));
}
return SA_AIS_OK;
@@ -707,3 +718,30 @@ uint32_t sendStateChangeNotificationAvd(
return status;
}
+
+
+void avd_send_error_report_ntf(const SaNameT *name, AVSV_ERR_RCVR recovery)
+{
+
+ TRACE_ENTER();
+ if ((recovery > static_cast<AVSV_ERR_RCVR> (SA_AMF_NO_RECOMMENDATION))
&& (recovery < AVSV_ERR_RCVR_SU_FAILOVER)) {
+ char add_text[ADDITION_TEXT_LENGTH];
+ SaNtfAdditionalInfoT add_info = {
SA_AMF_AI_RECOMMENDED_RECOVERY, SA_NTF_VALUE_UINT64,recovery};
+ snprintf(add_text, ADDITION_TEXT_LENGTH, "Error reported on %s
with recovery %s", name->value,
+ amf_recovery[recovery]);
+ sendAlarmNotificationAvd(avd_cb,
+ *name,
+ (SaUint8T*)add_text,
+ SA_SVC_AMF,
+ SA_AMF_NTFID_ERROR_REPORT,
+ SA_NTF_SOFTWARE_ERROR,
+ SA_NTF_SEVERITY_MAJOR,
+ (NCSCONTEXT) &add_info,
+ 1 /* No add_info */);
+
+ }
+
+ TRACE_LEAVE();
+}
+
+
diff --git a/osaf/services/saf/amf/amfd/util.cc
b/osaf/services/saf/amf/amfd/util.cc
--- a/osaf/services/saf/amf/amfd/util.cc
+++ b/osaf/services/saf/amf/amfd/util.cc
@@ -107,6 +107,19 @@ const char *avd_ha_state[] = {
"QUIESCING"
};
+const char *amf_recovery[] = {
+ "UNKNOWN_RECOVERY",
+ "NO_RECOMMENDATION" ,
+ "COMPONENT_RESTART",
+ "COMPONENT_FAILOVER",
+ "NODE_SWITCHOVER",
+ "NODE_FAILOVER",
+ "NODE_FAILFAST",
+ "CLUSTER_RESET",
+ "APPLICATION_RESTART",
+ "CONTAINER_RESTART"
+};
+
std::string to_string(const SaNameT &s)
{
return std::string((char*)s.value, s.length);
------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel