static uint32_t sendStateChangeNotificationClms(CLMS_CB * clms_cb, SaNameT node_name, SaUint8T *add_text, SaUint16T majorId, SaUint16T minorId, uint32_t sourceIndicator, SaUint32T stateId, SaUint32T newState) { uint32_t status = NCSCC_RC_FAILURE; SaNtfStateChangeNotificationT myStateNotification; status = saNtfStateChangeNotificationAllocate(clms_cb->ntf_hdl, /* handle to Notification Service instance */ &myStateNotification, /* number of correlated notifications */ 0, /* length of additional text */ ADDITION_TEXT_LENGTH, /* number of additional info items */ 0, /* number of state changes */ 1, /* use default allocation size */ 0); if (status != SA_AIS_OK) { /* log the error code here */ return NCSCC_RC_FAILURE; } fill_ntf_header_part_clms(&myStateNotification.notificationHeader, SA_NTF_OBJECT_STATE_CHANGE, node_name, add_text, majorId, minorId, CLMS_NTF_SENDER); *(myStateNotification.sourceIndicator) = sourceIndicator; myStateNotification.changedStates->stateId = stateId; myStateNotification.changedStates->oldStatePresent = SA_FALSE; myStateNotification.changedStates->newState = newState; status = saNtfNotificationSend(myStateNotification.notificationHandle); if (status != SA_AIS_OK) { saNtfNotificationFree(myStateNotification.notificationHandle); /* log the error code here */ return NCSCC_RC_FAILURE; } status = saNtfNotificationFree(myStateNotification.notificationHandle); if (status != SA_AIS_OK) { /* log the error code here */ return NCSCC_RC_FAILURE; } return status; }
/** * Test the content of an SecurityAlarmNotification * Strategy: Set up a subscription and send a notification. * Check it. */ void securityAlarmNotificationTest(void) { SaNtfSecurityAlarmNotificationFilterT myFilter; subscriptionId = 5; resetCounters(); safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , SA_AIS_OK); safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , SA_AIS_OK); if(!safassertNice((rc = saNtfSecurityAlarmNotificationFilterAllocate( ntfHandle, &myFilter, 0, 0, 0, 0, 0,0,0,0,0)), SA_AIS_OK)) { /* Initialize filter handles */ myNotificationFilterHandles.alarmFilterHandle = 0; myNotificationFilterHandles.attributeChangeFilterHandle = 0; myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; myNotificationFilterHandles.securityAlarmFilterHandle = myFilter.notificationFilterHandle; myNotificationFilterHandles.stateChangeFilterHandle = 0; /* subscribe */ safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, subscriptionId), SA_AIS_OK); createSecurityAlarmNotification(ntfHandle, &mySecAlarmNotification); safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), SA_AIS_OK); /* Delay to let the notification slip through */ poll_until_received(ntfHandle, *mySecAlarmNotification.notificationHeader.notificationId); if(ntfRecieved.alarmFilterHandle != 0 || ntfRecieved.attributeChangeFilterHandle != 0 || ntfRecieved.objectCreateDeleteFilterHandle !=0 || ntfRecieved.securityAlarmFilterHandle != 1 || ntfRecieved.stateChangeFilterHandle != 0) safassert(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); safassert(saNtfNotificationFree(mySecAlarmNotification.notificationHandle), SA_AIS_OK); safassert(saNtfNotificationFilterFree(myFilter.notificationFilterHandle), SA_AIS_OK); } safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK); if(errors && rc == SA_AIS_OK) rc = SA_AIS_ERR_FAILED_OPERATION; test_validate(rc, SA_AIS_OK); }
/** * Test the content of several notifications at once * Strategy: Set up a subscription and send a notification. * Check it. */ void allNotificationTest(void) { rc = SA_AIS_OK; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; SaNtfAlarmNotificationFilterT myAlarmFilter; SaNtfObjectCreateDeleteNotificationFilterT myObjCrDeFilter; SaNtfAttributeChangeNotificationFilterT myAttrChangeFilter; SaNtfStateChangeNotificationFilterT myStateChangeFilter; SaNtfSecurityAlarmNotificationFilterT mySecAlarmFilter; subscriptionId = 7; resetCounters(); fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , SA_AIS_OK); if(!safassertNice(saNtfAlarmNotificationFilterAllocate( ntfHandle, &myAlarmFilter, myNotificationFilterAllocationParams.numEventTypes, myNotificationFilterAllocationParams.numNotificationObjects, myNotificationFilterAllocationParams.numNotifyingObjects, myNotificationFilterAllocationParams.numNotificationClassIds, myNotificationFilterAllocationParams.numProbableCauses, myNotificationFilterAllocationParams.numPerceivedSeverities, myNotificationFilterAllocationParams.numTrends), SA_AIS_OK)) { /* Set perceived severities */ myAlarmFilter.perceivedSeverities[0] = SA_NTF_SEVERITY_WARNING; myAlarmFilter.perceivedSeverities[1] = SA_NTF_SEVERITY_CLEARED; if(!safassertNice((rc = saNtfObjectCreateDeleteNotificationFilterAllocate( ntfHandle, &myObjCrDeFilter, myNotificationFilterAllocationParams.numEventTypes, myNotificationFilterAllocationParams.numNotificationObjects, myNotificationFilterAllocationParams.numNotifyingObjects, myNotificationFilterAllocationParams.numNotificationClassIds, myNotificationFilterAllocationParams.numSourceIndicators)), SA_AIS_OK)) { if(!safassertNice((rc = saNtfAttributeChangeNotificationFilterAllocate( ntfHandle, &myAttrChangeFilter, myNotificationFilterAllocationParams.numEventTypes, myNotificationFilterAllocationParams.numNotificationObjects, myNotificationFilterAllocationParams.numNotifyingObjects, myNotificationFilterAllocationParams.numNotificationClassIds, myNotificationFilterAllocationParams.numSourceIndicators)), SA_AIS_OK)) { if(!safassertNice((rc = saNtfSecurityAlarmNotificationFilterAllocate( ntfHandle, &mySecAlarmFilter, myNotificationFilterAllocationParams.numEventTypes, myNotificationFilterAllocationParams.numNotificationObjects, myNotificationFilterAllocationParams.numNotifyingObjects, myNotificationFilterAllocationParams.numNotificationClassIds, myNotificationFilterAllocationParams.numProbableCauses, myNotificationFilterAllocationParams.numSeverities, myNotificationFilterAllocationParams.numSecurityAlarmDetectos, myNotificationFilterAllocationParams.numServiceUsers, myNotificationFilterAllocationParams.numServiceProviders)), SA_AIS_OK)) { if(!safassertNice((rc = saNtfStateChangeNotificationFilterAllocate( ntfHandle, &myStateChangeFilter, myNotificationFilterAllocationParams.numEventTypes, myNotificationFilterAllocationParams.numNotificationObjects, myNotificationFilterAllocationParams.numNotifyingObjects, myNotificationFilterAllocationParams.numNotificationClassIds, myNotificationFilterAllocationParams.numSourceIndicators, myNotificationFilterAllocationParams.numChangedStates)), SA_AIS_OK)) { /* Initialize filter handles */ myNotificationFilterHandles.alarmFilterHandle = myAlarmFilter.notificationFilterHandle; myNotificationFilterHandles.attributeChangeFilterHandle = myAttrChangeFilter.notificationFilterHandle; myNotificationFilterHandles.objectCreateDeleteFilterHandle = myObjCrDeFilter.notificationFilterHandle; myNotificationFilterHandles.securityAlarmFilterHandle = mySecAlarmFilter.notificationFilterHandle; myNotificationFilterHandles.stateChangeFilterHandle = myStateChangeFilter.notificationFilterHandle; /* subscribe */ safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, subscriptionId), SA_AIS_OK); /* Create a couple of notifications and send them */ createAlarmNotification(ntfHandle, &myAlarmNotification); safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), SA_AIS_OK); createObjectCreateDeleteNotification(ntfHandle, &myObjCrDelNotfification); safassert(saNtfNotificationSend(myObjCrDelNotfification.notificationHandle), SA_AIS_OK); createAttributeChangeNotification(ntfHandle, &myAttrChangeNotification); safassert(saNtfNotificationSend(myAttrChangeNotification.notificationHandle), SA_AIS_OK); createStateChangeNotification(ntfHandle, &myStateChangeNotification); safassert(saNtfNotificationSend(myStateChangeNotification.notificationHandle), SA_AIS_OK); createSecurityAlarmNotification(ntfHandle, &mySecAlarmNotification); safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), SA_AIS_OK); /* TODO: add MiscellaneousNotification */ poll_until_received(ntfHandle, *mySecAlarmNotification.notificationHeader.notificationId); if(ntfRecieved.alarmFilterHandle != 1 || ntfRecieved.attributeChangeFilterHandle != 1 || ntfRecieved.objectCreateDeleteFilterHandle !=1 || ntfRecieved.securityAlarmFilterHandle != 1 || ntfRecieved.stateChangeFilterHandle != 1){ fprintf(stderr, "ntfreceived fh: a: %llu, att: %llu, o: %llu, se: %llu, st: %llu \n", ntfRecieved.alarmFilterHandle, ntfRecieved.attributeChangeFilterHandle, ntfRecieved.objectCreateDeleteFilterHandle, ntfRecieved.securityAlarmFilterHandle, ntfRecieved.stateChangeFilterHandle); safassertNice(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); } safassert(saNtfNotificationFree(myAlarmNotification.notificationHandle) , SA_AIS_OK); safassert(saNtfNotificationFree(myObjCrDelNotfification.notificationHandle), SA_AIS_OK); safassert(saNtfNotificationFree(myAttrChangeNotification.notificationHandle), SA_AIS_OK); safassert(saNtfNotificationFree(myStateChangeNotification.notificationHandle), SA_AIS_OK); safassert(saNtfNotificationFree(mySecAlarmNotification.notificationHandle), SA_AIS_OK); /* TODO: add MiscellaneousNotification free */ safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); safassert(saNtfNotificationFilterFree(myStateChangeFilter.notificationFilterHandle), SA_AIS_OK); } safassert(saNtfNotificationFilterFree(mySecAlarmFilter.notificationFilterHandle), SA_AIS_OK); } safassert(saNtfNotificationFilterFree(myAttrChangeFilter.notificationFilterHandle), SA_AIS_OK); } safassert(saNtfNotificationFilterFree(myObjCrDeFilter.notificationFilterHandle), SA_AIS_OK); } safassert(saNtfNotificationFilterFree(myAlarmFilter.notificationFilterHandle), SA_AIS_OK); } safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK); /* Allocated in fillInDefaultValues() */ free(myNotificationParams.additionalText); if(errors && rc == SA_AIS_OK) rc = SA_AIS_ERR_FAILED_OPERATION; test_validate(rc, SA_AIS_OK); }
/** * Test the content of an alarm notification * Strategy: Set up a subscription and send a notification. * Check it. */ void alarmNotificationTest2(void) { SaNtfAlarmNotificationFilterT myAlarmFilter; subscriptionId = 1; int i; rc = SA_AIS_OK; resetCounters(); safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , SA_AIS_OK); safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , SA_AIS_OK); /* Set up the filters and subscription */ safassert(saNtfAlarmNotificationFilterAllocate( ntfHandle, &myAlarmFilter, 0, 0, 0, 0, 0, 2, 0), SA_AIS_OK); /* Set perceived severities */ myAlarmFilter.perceivedSeverities[0] = SA_NTF_SEVERITY_WARNING; myAlarmFilter.perceivedSeverities[1] = SA_NTF_SEVERITY_CLEARED; /* Initialize filter handles */ myNotificationFilterHandles.alarmFilterHandle = myAlarmFilter.notificationFilterHandle; myNotificationFilterHandles.attributeChangeFilterHandle = 0; myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; myNotificationFilterHandles.securityAlarmFilterHandle = 0; myNotificationFilterHandles.stateChangeFilterHandle = 0; safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, subscriptionId), SA_AIS_OK); /* Create a notification and send it */ myAlarmNotification.notificationHeader.numCorrelatedNotifications = 2; myAlarmNotification.notificationHeader.numAdditionalInfo = 5; safassert(saNtfAlarmNotificationAllocate( ntfHandle, &myAlarmNotification, myAlarmNotification.notificationHeader.numCorrelatedNotifications, (SaUint16T)(strlen(DEFAULT_ADDITIONAL_TEXT) + 1), myAlarmNotification.notificationHeader.numAdditionalInfo, 3, /* SaUint16T numSpecificProblems, */ 2, /* SaUint16T numMonitoredAttributes, */ 2, /* SaUint16T numProposedRepairActions, */ SA_NTF_ALLOC_SYSTEM_LIMIT), /* SaInt16T variableDataSize */ SA_AIS_OK); fillHeader(&myAlarmNotification.notificationHeader); /* determine perceived severity */ *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; /* set probable cause*/ *(myAlarmNotification.probableCause) = SA_NTF_BANDWIDTH_REDUCED; myAlarmNotification.specificProblems[0].problemClassId.vendorId = 23; myAlarmNotification.specificProblems[0].problemClassId.majorId = 22; myAlarmNotification.specificProblems[0].problemClassId.minorId = 21; myAlarmNotification.specificProblems[1].problemClassId.vendorId = 5; myAlarmNotification.specificProblems[1].problemClassId.majorId = 4; myAlarmNotification.specificProblems[1].problemClassId.minorId = 2; myAlarmNotification.specificProblems[2].problemClassId.vendorId = 2; myAlarmNotification.specificProblems[2].problemClassId.majorId = 3; myAlarmNotification.specificProblems[2].problemClassId.minorId = 4; myAlarmNotification.monitoredAttributes[0].attributeId = 1; myAlarmNotification.monitoredAttributes[0].attributeType = SA_NTF_VALUE_INT64; myAlarmNotification.monitoredAttributes[0].attributeValue.int64Val = 987654321; myAlarmNotification.monitoredAttributes[1].attributeId = 2; myAlarmNotification.monitoredAttributes[1].attributeType = SA_NTF_VALUE_INT8; myAlarmNotification.monitoredAttributes[1].attributeValue.int8Val = 88; myAlarmNotification.proposedRepairActions[0].actionId = 3; myAlarmNotification.proposedRepairActions[0].actionValueType = SA_NTF_VALUE_INT16; myAlarmNotification.proposedRepairActions[0].actionValue.int16Val = 456; myAlarmNotification.proposedRepairActions[1].actionId = 4; myAlarmNotification.proposedRepairActions[1].actionValueType = SA_NTF_VALUE_INT32; myAlarmNotification.proposedRepairActions[1].actionValue.int32Val = 456; for (i = 0; i < myAlarmNotification.numSpecificProblems; i++) { myAlarmNotification.specificProblems[i].problemId = i; myAlarmNotification.specificProblems[i].problemClassId.majorId = 1; myAlarmNotification.specificProblems[i].problemClassId.minorId = 2; myAlarmNotification.specificProblems[i].problemClassId.vendorId = 33; myAlarmNotification.specificProblems[i].problemType = SA_NTF_VALUE_UINT32; myAlarmNotification.specificProblems[i].problemValue.uint32Val = (SaUint32T)(600+i); } for (i = 0; i < myAlarmNotification.numProposedRepairActions; i++) { myAlarmNotification.proposedRepairActions[i].actionId = i; myAlarmNotification.proposedRepairActions[i].actionValueType = SA_NTF_VALUE_UINT32; myAlarmNotification.proposedRepairActions[i].actionValue.uint32Val = (SaUint32T)(700+i); } *myAlarmNotification.trend = SA_NTF_TREND_MORE_SEVERE; myAlarmNotification.thresholdInformation->thresholdValueType = SA_NTF_VALUE_UINT32; myAlarmNotification.thresholdInformation->thresholdValue.uint32Val = 600; myAlarmNotification.thresholdInformation->thresholdHysteresis.uint32Val = 100; myAlarmNotification.thresholdInformation->observedValue.uint32Val = 567; myAlarmNotification.thresholdInformation->armTime = SA_TIME_UNKNOWN; myAlarmNotification.notificationHeader.correlatedNotifications[0] = 1999; myAlarmNotification.notificationHeader.correlatedNotifications[1] = 1984; safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), SA_AIS_OK); poll_until_received(ntfHandle, *myAlarmNotification.notificationHeader.notificationId); if(ntfRecieved.alarmFilterHandle != 1 || ntfRecieved.attributeChangeFilterHandle != 0 || ntfRecieved.objectCreateDeleteFilterHandle !=0 || ntfRecieved.securityAlarmFilterHandle != 0 || ntfRecieved.stateChangeFilterHandle != 0) safassert(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); safassert(saNtfNotificationFree(myAlarmNotification.notificationHandle) , SA_AIS_OK); safassert(saNtfNotificationFilterFree(myAlarmFilter.notificationFilterHandle), SA_AIS_OK); safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); /* Allocated in fillInDefaultValues() */ free(myNotificationParams.additionalText); if(errors) rc = SA_AIS_ERR_FAILED_OPERATION; test_validate(rc, SA_AIS_OK); }
/** * Test the content of an alarm notification * Strategy: Set up a subscription and send a notification. * Check it. */ void alarmNotificationTest(void) { SaNtfAlarmNotificationFilterT myAlarmFilter; subscriptionId = 1; rc = SA_AIS_OK; resetCounters(); safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , SA_AIS_OK); safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , SA_AIS_OK); /* Set up the filters and subscription */ safassert(saNtfAlarmNotificationFilterAllocate( ntfHandle, &myAlarmFilter, 0, 0, 0, 0, 0, 2, 0), SA_AIS_OK); /* Set perceived severities */ myAlarmFilter.perceivedSeverities[0] = SA_NTF_SEVERITY_WARNING; myAlarmFilter.perceivedSeverities[1] = SA_NTF_SEVERITY_CLEARED; /* Initialize filter handles */ myNotificationFilterHandles.alarmFilterHandle = myAlarmFilter.notificationFilterHandle; myNotificationFilterHandles.attributeChangeFilterHandle = 0; myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; myNotificationFilterHandles.securityAlarmFilterHandle = 0; myNotificationFilterHandles.stateChangeFilterHandle = 0; safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, subscriptionId), SA_AIS_OK); /* Create a notification and send it */ safassert(saNtfAlarmNotificationAllocate( ntfHandle, &myAlarmNotification, 0, (SaUint16T)(strlen(DEFAULT_ADDITIONAL_TEXT) + 1), 0, 0, 0, 0, SA_NTF_ALLOC_SYSTEM_LIMIT), SA_AIS_OK); fillHeader(&myAlarmNotification.notificationHeader); /* determine perceived severity */ *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; /* set probable cause*/ *(myAlarmNotification.probableCause) = SA_NTF_BANDWIDTH_REDUCED; *myAlarmNotification.trend = SA_NTF_TREND_MORE_SEVERE; myAlarmNotification.thresholdInformation->thresholdValueType = SA_NTF_VALUE_UINT32; myAlarmNotification.thresholdInformation->thresholdValue.uint32Val = 600; myAlarmNotification.thresholdInformation->thresholdHysteresis.uint32Val = 100; myAlarmNotification.thresholdInformation->observedValue.uint32Val = 567; myAlarmNotification.thresholdInformation->armTime = SA_TIME_UNKNOWN; safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), SA_AIS_OK); poll_until_received(ntfHandle, *myAlarmNotification.notificationHeader.notificationId); if(ntfRecieved.alarmFilterHandle != 1 || ntfRecieved.attributeChangeFilterHandle != 0 || ntfRecieved.objectCreateDeleteFilterHandle !=0 || ntfRecieved.securityAlarmFilterHandle != 0 || ntfRecieved.stateChangeFilterHandle != 0) safassert(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); safassert(saNtfNotificationFree(myAlarmNotification.notificationHandle) , SA_AIS_OK); safassert(saNtfNotificationFilterFree(myAlarmFilter.notificationFilterHandle), SA_AIS_OK); safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); /* Allocated in fillInDefaultValues() */ free(myNotificationParams.additionalText); if(errors) rc = SA_AIS_ERR_FAILED_OPERATION; test_validate(rc, SA_AIS_OK); }
/* incomming notifications in the MDS thread discarding makes no sense */ void saNtfNotificationDiscardedCallbackT_01(void) { struct pollfd fds[1]; int ret,i; saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; AlarmNotificationParams myAlarmParams; SaNtfAlarmNotificationFilterT myAlarmFilter; SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles; SaNtfIdentifierT myNotId[NUM_NOTIF]; resetCounters(); fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); if(verbose) { printf("num not to send: %d\n", NUM_NOTIF); } rc=SA_AIS_ERR_NOT_SUPPORTED; /* Not fully implemented */ test_validate(rc, SA_AIS_OK); /* See above */ return; /* */ safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , SA_AIS_OK); safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , SA_AIS_OK); safassert(saNtfAlarmNotificationFilterAllocate( ntfHandle, &myAlarmFilter, myNotificationFilterAllocationParams.numEventTypes, myNotificationFilterAllocationParams.numNotificationObjects, myNotificationFilterAllocationParams.numNotifyingObjects, myNotificationFilterAllocationParams.numNotificationClassIds, myNotificationFilterAllocationParams.numProbableCauses, myNotificationFilterAllocationParams.numPerceivedSeverities, myNotificationFilterAllocationParams.numTrends), SA_AIS_OK); /* Set perceived severities */ myAlarmFilter.perceivedSeverities[0] = SA_NTF_SEVERITY_WARNING; myAlarmFilter.perceivedSeverities[1] = SA_NTF_SEVERITY_CLEARED; /* Initialize filter handles */ myNotificationFilterHandles.alarmFilterHandle = myAlarmFilter.notificationFilterHandle; myNotificationFilterHandles.attributeChangeFilterHandle = 0; myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; myNotificationFilterHandles.securityAlarmFilterHandle = 0; myNotificationFilterHandles.stateChangeFilterHandle = 0; safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, my_subid), SA_AIS_OK); myAlarmParams.numCorrelatedNotifications = myNotificationAllocationParams.numCorrelatedNotifications; myAlarmParams.lengthAdditionalText = myNotificationAllocationParams.lengthAdditionalText; myAlarmParams.numAdditionalInfo = myNotificationAllocationParams.numAdditionalInfo; myAlarmParams.numSpecificProblems = myNotificationAllocationParams.numSpecificProblems; myAlarmParams.numMonitoredAttributes = myNotificationAllocationParams.numMonitoredAttributes; myAlarmParams.numProposedRepairActions = myNotificationAllocationParams.numProposedRepairActions; myAlarmParams.variableDataSize = myNotificationAllocationParams.variableDataSize; safassert(saNtfAlarmNotificationAllocate( ntfHandle, &myAlarmNotification, myAlarmParams.numCorrelatedNotifications, myAlarmParams.lengthAdditionalText, myAlarmParams.numAdditionalInfo, myAlarmParams.numSpecificProblems, myAlarmParams.numMonitoredAttributes, myAlarmParams.numProposedRepairActions, myAlarmParams.variableDataSize), SA_AIS_OK); myNotificationParams.eventType = myNotificationParams.alarmEventType; fill_header_part( &myAlarmNotification.notificationHeader, (saNotificationParamsT *)&myNotificationParams, myAlarmParams.lengthAdditionalText); /* determine perceived severity */ *(myAlarmNotification.perceivedSeverity) = myNotificationParams.perceivedSeverity; /* set probable cause*/ *(myAlarmNotification.probableCause) = myNotificationParams.probableCause; for(i=0; i<NUM_NOTIF;i++) { if((rc =saNtfNotificationSend(myAlarmNotification.notificationHandle)) != SA_AIS_OK) { if(verbose) { printf("send failed rc: %d\n", rc); } break; } myNotId[i] = *myAlarmNotification.notificationHeader.notificationId; } sleep(10); fds[0].fd = (int) selectionObject; fds[0].events = POLLIN; ret = poll(fds, 1, 10000); assert(ret > 0); safassert(saNtfDispatch(ntfHandle, SA_DISPATCH_ALL) , SA_AIS_OK); rc =SA_AIS_ERR_FAILED_OPERATION; for(i = 0; i < NUM_NOTIF; i++) { if(cb_notId[i] != myNotId[i]) { break; } } if(numDiscarded == 0) { rc =SA_AIS_ERR_FAILED_OPERATION; } else if(numDiscarded != (NUM_NOTIF - i)) { if(verbose) { printf("failed num of discarded: %d\n", numDiscarded); } rc =SA_AIS_ERR_FAILED_OPERATION; } if(verbose) { printf("Number of discarded: %d\n", numDiscarded); printf("Number of received not: %d\n", cb_index); } safassert(saNtfNotificationFree(myAlarmNotification.notificationHandle) , SA_AIS_OK); safassert(saNtfNotificationUnsubscribe(my_subid), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK); test_validate(rc, SA_AIS_OK); }