/* Test all filter handles set to NULL */ void saNtfNotificationSubscribe_03(void) { SaNtfHandleT ntfHandle; SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles; saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), SA_AIS_OK); /* Initialize filter handles */ myNotificationFilterHandles.alarmFilterHandle = 0; myNotificationFilterHandles.attributeChangeFilterHandle = 0; myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; myNotificationFilterHandles.securityAlarmFilterHandle = 0; myNotificationFilterHandles.stateChangeFilterHandle = 0; rc = saNtfNotificationSubscribe(&myNotificationFilterHandles, 4); safassert(saNtfNotificationUnsubscribe(4), SA_AIS_ERR_NOT_EXIST); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); free(myNotificationParams.additionalText); /* allocated in fillInDefaultValues */ test_validate(rc, SA_AIS_ERR_INVALID_PARAM); }
/** * Test that the return value SA_AIS_ERR_INVALID_PARAM works * * Strategy: */ void saNtfObjectCreateDeleteNotificationAllocate_03(void) { saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), SA_AIS_OK); rc = saNtfObjectCreateDeleteNotificationAllocate( ntfHandle, /* handle to Notification Service instance */ NULL, /* number of correlated notifications */ myNotificationAllocationParams.numCorrelatedNotifications, /* length of additional text */ myNotificationAllocationParams.lengthAdditionalText, /* number of additional info items*/ myNotificationAllocationParams.numAdditionalInfo, /* number of state changes */ myNotificationAllocationParams.numObjectAttributes, /* use default allocation size */ myNotificationAllocationParams.variableDataSize); free(myNotificationParams.additionalText); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); test_validate(rc, SA_AIS_ERR_INVALID_PARAM); }
void saNtfNotificationReadInitialize_04(void) { SaNtfHandleT ntfHandle; SaNtfSearchCriteriaT searchCriteria; SaNtfAlarmNotificationFilterT myAlarmFilter; SaNtfObjectCreateDeleteNotificationFilterT myObjCrDeFilter; SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles; SaNtfReadHandleT readHandle; searchCriteria.searchMode = SA_NTF_SEARCH_AT_OR_AFTER_TIME; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion),SA_AIS_OK); safassert(saNtfAlarmNotificationFilterAllocate( ntfHandle, /* handle to Notification Service instance */ &myAlarmFilter, /* put filter here */ /* number of event types */ myNotificationFilterAllocationParams.numEventTypes, /* number of notification objects */ myNotificationFilterAllocationParams.numNotificationObjects, /* number of notifying objects */ myNotificationFilterAllocationParams.numNotifyingObjects, /* number of notification class ids */ myNotificationFilterAllocationParams.numNotificationClassIds, /* number of probable causes */ myNotificationFilterAllocationParams.numProbableCauses, /* number of perceived severities */ myNotificationFilterAllocationParams.numPerceivedSeverities, /* number of trend indications */ myNotificationFilterAllocationParams.numTrends), SA_AIS_OK); safassert(saNtfObjectCreateDeleteNotificationFilterAllocate( ntfHandle, /* handle to Notification Service instance */ &myObjCrDeFilter, /* put filter here */ /* number of event types */ myNotificationFilterAllocationParams.numEventTypes, /* number of notification objects */ myNotificationFilterAllocationParams.numNotificationObjects, /* number of notifying objects */ myNotificationFilterAllocationParams.numNotifyingObjects, /* number of notification class ids */ myNotificationFilterAllocationParams.numNotificationClassIds, /* number of source indicators */ 0), SA_AIS_OK); myNotificationFilterHandles.alarmFilterHandle = myAlarmFilter.notificationFilterHandle; myNotificationFilterHandles.alarmFilterHandle = myObjCrDeFilter.notificationFilterHandle; rc = saNtfNotificationReadInitialize(searchCriteria, &myNotificationFilterHandles, &readHandle); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); free(myNotificationParams.additionalText); test_validate(rc, SA_AIS_OK); }
void saNtfStateChangeNotificationAllocate_01(void) { SaNtfStateChangeNotificationT myNotification; saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfSendCallbacks, &ntfVersion), SA_AIS_OK); rc = saNtfStateChangeNotificationAllocate( ntfHandle, /* handle to Notification Service instance */ &myNotification, /* number of correlated notifications */ myNotificationAllocationParams.numCorrelatedNotifications, /* length of additional text */ myNotificationAllocationParams.lengthAdditionalText, /* number of additional info items*/ myNotificationAllocationParams.numAdditionalInfo, /* number of state changes */ myNotificationAllocationParams.numAttributes, /* use default allocation size */ myNotificationAllocationParams.variableDataSize); safassert(saNtfNotificationFree(myNotification.notificationHandle) , SA_AIS_OK); safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK); test_validate(rc, SA_AIS_OK); }
/** * Test that return value SA_AIS_ERR_BAD_HANDLE works * * Strategy: Set the handle to zero or invalid number * Create a handle and then destroy it. */ void saNtfObjectCreateDeleteNotificationAllocate_02(void) { int errors = 0; SaNtfObjectCreateDeleteNotificationT myNotification; saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); ntfHandle = 0; rc = saNtfObjectCreateDeleteNotificationAllocate( ntfHandle, /* handle to Notification Service instance */ &myNotification, /* number of correlated notifications */ myNotificationAllocationParams.numCorrelatedNotifications, /* length of additional text */ myNotificationAllocationParams.lengthAdditionalText, /* number of additional info items*/ myNotificationAllocationParams.numAdditionalInfo, /* number of state changes */ myNotificationAllocationParams.numObjectAttributes, /* use default allocation size */ myNotificationAllocationParams.variableDataSize); if(rc != SA_AIS_ERR_BAD_HANDLE) { errors++; } free(myNotificationParams.additionalText); safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); rc = saNtfObjectCreateDeleteNotificationAllocate( ntfHandle, /* handle to Notification Service instance */ &myNotification, /* number of correlated notifications */ myNotificationAllocationParams.numCorrelatedNotifications, /* length of additional text */ myNotificationAllocationParams.lengthAdditionalText, /* number of additional info items*/ myNotificationAllocationParams.numAdditionalInfo, /* number of state changes */ myNotificationAllocationParams.numObjectAttributes, /* use default allocation size */ myNotificationAllocationParams.variableDataSize); if(rc != SA_AIS_ERR_BAD_HANDLE) { errors++; } rc = (errors == 0)? SA_AIS_OK: SA_AIS_ERR_BAD_HANDLE; test_validate(rc, SA_AIS_OK); }
/* Test already existing subscriptionId */ void saNtfNotificationSubscribe_04(void) { SaNtfHandleT ntfHandle; SaNtfAlarmNotificationFilterT myAlarmFilter; SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles; SaNtfSubscriptionIdT subscId = 0; saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), 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, subscId), SA_AIS_OK); rc = saNtfNotificationSubscribe(&myNotificationFilterHandles, subscId); /* No need to saNtfNotificationUnsubscribe since the subscribe failed */ safassert(saNtfNotificationUnsubscribe(subscId), SA_AIS_OK); safassert(saNtfNotificationFilterFree( myNotificationFilterHandles.alarmFilterHandle), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); free(myNotificationParams.additionalText); /* allocated in fillInDefaultValues */ test_validate(rc, SA_AIS_ERR_EXIST); }
/** * 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); }
void saNtfObjectCreateDeleteNotificationAllocate_01(void) { SaNtfObjectCreateDeleteNotificationT myNotification; saNotificationAllocationParamsT myNotificationAllocationParams; saNotificationFilterAllocationParamsT myNotificationFilterAllocationParams; saNotificationParamsT myNotificationParams; fillInDefaultValues(&myNotificationAllocationParams, &myNotificationFilterAllocationParams, &myNotificationParams); safassert(saNtfInitialize(&ntfHandle, &ntfCallbacks, &ntfVersion), SA_AIS_OK); rc = saNtfObjectCreateDeleteNotificationAllocate( ntfHandle, /* handle to Notification Service instance */ &myNotification, /* number of correlated notifications */ myNotificationAllocationParams.numCorrelatedNotifications, /* length of additional text */ myNotificationAllocationParams.lengthAdditionalText, /* number of additional info items*/ myNotificationAllocationParams.numAdditionalInfo, /* number of state changes */ myNotificationAllocationParams.numObjectAttributes, /* use default allocation size */ myNotificationAllocationParams.variableDataSize); /* Event type */ *(myNotification.notificationHeader.eventType) = SA_NTF_OBJECT_CREATION; /* event time to be set automatically to current time by saNtfNotificationSend */ *(myNotification.notificationHeader.eventTime) = myNotificationParams.eventTime; /* Set Notification Object */ myNotification.notificationHeader.notificationObject->length = myNotificationParams.notificationObject.length; (void)memcpy(myNotification.notificationHeader.notificationObject->value, myNotificationParams.notificationObject.value, myNotificationParams.notificationObject.length); /* Set Notifying Object */ myNotification.notificationHeader.notifyingObject->length = myNotificationParams.notifyingObject.length; (void)memcpy(myNotification.notificationHeader.notifyingObject->value, myNotificationParams.notifyingObject.value, myNotificationParams.notifyingObject.length); /* set Notification Class Identifier */ /* vendor id 33333 is not an existing SNMP enterprise number. Just an example */ myNotification.notificationHeader.notificationClassId->vendorId = myNotificationParams.notificationClassId.vendorId; /* sub id of this notification class within "name space" of vendor ID */ myNotification.notificationHeader.notificationClassId->majorId = myNotificationParams.notificationClassId.majorId; myNotification.notificationHeader.notificationClassId->minorId = myNotificationParams.notificationClassId.minorId; /* set additional text and additional info */ (void)strncpy(myNotification.notificationHeader.additionalText, myNotificationParams.additionalText, myNotificationAllocationParams.lengthAdditionalText); /* Set source indicator */ myNotification.sourceIndicator = &myNotificationParams.objectCreateDeleteSourceIndicator; /* Set objectAttibutes */ myNotification.objectAttributes[0].attributeId = myNotificationParams.objectAttributes[0].attributeId; myNotification.objectAttributes[0].attributeType = myNotificationParams.objectAttributes[0].attributeType; myNotification.objectAttributes[0].attributeValue.int32Val = myNotificationParams.objectAttributes[0].attributeValue.int32Val; free(myNotificationParams.additionalText); safassert(saNtfNotificationFree(myNotification.notificationHandle), SA_AIS_OK); safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); 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); }