Hi Minh, Some how test cases of new suite 35 fails with SA_AIS_ERR_FAILED_OPERATION. Any prerequisite for executing them?
-Praveen On 08-Aug-14 12:28 PM, Minh Hon Chau wrote: > tests/ntfsv/Makefile.am | 3 +- > tests/ntfsv/test_ntf_imcn.c | 508 ++++++++++++++- > tests/ntfsv/tet_longDnObject_notification.c | 972 > ++++++++++++++++++++++++++++ > tests/unit_test_fw/inc/util.h | 5 +- > tests/unit_test_fw/src/Makefile.am | 1 + > tests/unit_test_fw/src/util.c | 14 +- > 6 files changed, 1483 insertions(+), 20 deletions(-) > > > (1) Add testcase for AdditionInfo with extended name > > (2) Add testcase for create/modify/delete runtime&config object with extended > name attribute > > diff --git a/tests/ntfsv/Makefile.am b/tests/ntfsv/Makefile.am > --- a/tests/ntfsv/Makefile.am > +++ b/tests/ntfsv/Makefile.am > @@ -64,7 +64,8 @@ ntftest_SOURCES = \ > tet_saNtfPtrValAllocate.c \ > tet_saNtfArrayValGet.c \ > tet_saNtfPtrValGet.c \ > - test_ntfFilterVerification.c > + test_ntfFilterVerification.c \ > + tet_longDnObject_notification.c > > ntftest_LDADD = \ > $(top_builddir)/tests/unit_test_fw/src/libutest.la > diff --git a/tests/ntfsv/test_ntf_imcn.c b/tests/ntfsv/test_ntf_imcn.c > --- a/tests/ntfsv/test_ntf_imcn.c > +++ b/tests/ntfsv/test_ntf_imcn.c > @@ -39,6 +39,12 @@ > static SaNtfHandleT ntfHandle; > static NotifData rec_notif_data; > static SaImmOiHandleT immOiHnd = 0; > +#define DEFAULT_EXT_NAME_LENGTH 300 > +static char extended_name_string_01[DEFAULT_EXT_NAME_LENGTH]; > +static char extended_name_string_02[DEFAULT_EXT_NAME_LENGTH]; > + > +extern void saAisNameLend(SaConstStringT value, SaNameT* name); > +extern SaConstStringT saAisNameBorrow(const SaNameT* name); > > /** > * Callback routine, called when subscribed notification arrives. > @@ -976,6 +982,31 @@ static SaAisErrorT set_attr_buf(NotifDat > return error; > } > > +static SaAisErrorT set_attr_extended_name(NotifData* n_exp, SaUint16T idx, > + SaNtfElementIdT attrId, SaNtfValueTypeT valType, void* > attrValue) > +{ > + safassert(valType == SA_NTF_VALUE_LDAP_NAME, true); > + SaAisErrorT error = SA_AIS_OK; > + SaUint16T numAlloc = strlen(saAisNameBorrow((SaNameT*)attrValue)); > + SaUint8T* temp = NULL; > + SaUint8T* srcPtr = (SaUint8T*)saAisNameBorrow((SaNameT*)attrValue); > + > + if (n_exp->c_d_notif_ptr != NULL) { > + error = saNtfPtrValAllocate(n_exp->nHandle, > + numAlloc, > + (void**) &temp, > + > &n_exp->c_d_notif_ptr->objectAttributes[idx].attributeValue); > + if (error == SA_AIS_OK) { > + memcpy(temp, srcPtr, numAlloc); > + n_exp->c_d_notif_ptr->objectAttributes[idx].attributeId > = attrId; > + > n_exp->c_d_notif_ptr->objectAttributes[idx].attributeType = valType; > + } > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + return error; > +} > + > /** > * Set an expected attribute value, type is string. > */ > @@ -1038,6 +1069,34 @@ static SaAisErrorT set_attr_change_buf(N > return error; > } > > +static SaAisErrorT set_attr_change_extended_name(NotifData* n_exp, SaUint16T > idx, > + SaNtfElementIdT attrId, SaNtfValueTypeT valType, const void* > newValue) > +{ > + safassert(valType == SA_NTF_VALUE_LDAP_NAME, true); > + SaAisErrorT error = SA_AIS_OK; > + SaUint16T numAlloc = strlen(saAisNameBorrow((SaNameT*)newValue)); > + SaUint8T* temp = NULL; > + SaUint8T* srcPtr = (SaUint8T*)saAisNameBorrow((SaNameT*)newValue); > + > + if (n_exp->a_c_notif_ptr != NULL) { > + > n_exp->a_c_notif_ptr->changedAttributes[idx].oldAttributePresent = SA_FALSE; > + error = saNtfPtrValAllocate(n_exp->nHandle, > + numAlloc, > + (void**) &temp, > + > &n_exp->a_c_notif_ptr->changedAttributes[idx].newAttributeValue); > + if (error == SA_AIS_OK) { > + memcpy(temp, srcPtr, numAlloc); > + > n_exp->a_c_notif_ptr->changedAttributes[idx].attributeId = attrId; > + > n_exp->a_c_notif_ptr->changedAttributes[idx].attributeType = valType; > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + return error; > +} > + > /** > * Set expected attribute change value, type is > UINT32/INT32/UINT64/INT64/FLOAT/DOUBLE. > */ > @@ -4256,6 +4315,432 @@ void objectDeleteTest_3404(void) > test_validate(error, SA_AIS_OK); > } > > +/** > + * Create a runtime test object with extended name attribute and verify > correctness > + * of generated notification. > + */ > +void objectCreateTest_3501(void) > +{ > + SaAisErrorT error = SA_AIS_OK; > + safassert(init_ntf(), SA_AIS_OK); > + safassert(subscribe_notifications(), SA_AIS_OK); > + rec_notif_data.populated = SA_FALSE; > + > + /* create the runtime object */ > + SaInt32T int32Var = INT32VAR1; > + SaUint32T uint32Var = UINT32VAR1; > + SaInt64T int64Var = INT64VAR1; > + SaUint64T uint64Var = UINT64VAR1; > + SaTimeT timeVar = TIMEVAR1; > + SaNameT nameVar; > + saAisNameLend((SaConstStringT)&extended_name_string_01, &nameVar); > + SaFloatT floatVar = FLOATVAR1; > + SaDoubleT doubleVar = DOUBLEVAR1; > + SaStringT stringVar = STRINGVAR1; > + SaAnyT anyVar = {.bufferSize = sizeof (BUF1), .bufferAddr = (SaUint8T*) > BUF1}; > + > + /* > + * Create the object in IMM. > + */ > + create_rt_test_object("OsafNtfCmTestRT", DNTESTRT, int32Var, uint32Var, > int64Var, uint64Var, > + &timeVar, &nameVar, floatVar, doubleVar, &stringVar, > &anyVar); > + > + /* > + * Wait for notification reception. > + */ > + int dwCnt = 0; > + while (dwCnt++ < POLLWAIT && !rec_notif_data.populated) { > + saNtfDispatch(ntfHandle, SA_DISPATCH_ALL); > + if (!rec_notif_data.populated) usleep(100); > + } > + > + if (rec_notif_data.populated) { > + NotifData n_exp; > + safassert(set_ntf(&n_exp, SA_NTF_OBJECT_CREATION, DNTESTRT, 12, > 12), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 0, 0, > "SaImmAttrImplementerName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 1, 1, "SaImmAttrClassName"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 2, 2, "testUint32"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 3, 3, "testInt32"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 4, 4, "testUint64"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 5, 5, "testInt64"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 6, 6, "testString"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 7, 7, "testFloat"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 8, 8, "testDouble"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 9, 9, "testName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 10, 10, "testTime"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 11, 11, "testAny"), SA_AIS_OK); > + safassert(set_attr_str(&n_exp, 0, 0, IMPLEMENTERNAME_RT), > SA_AIS_OK); > + safassert(set_attr_str(&n_exp, 1, 1, "OsafNtfCmTestRT"), > SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 2, 2, SA_NTF_VALUE_UINT32, > &uint32Var), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 3, 3, SA_NTF_VALUE_INT32, > &int32Var), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 4, 4, SA_NTF_VALUE_UINT64, > &uint64Var), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 5, 5, SA_NTF_VALUE_INT64, > &int64Var), SA_AIS_OK); > + safassert(set_attr_str(&n_exp, 6, 6, stringVar), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 7, 7, SA_NTF_VALUE_FLOAT, > &floatVar), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 8, 8, SA_NTF_VALUE_DOUBLE, > &doubleVar), SA_AIS_OK); > + safassert(set_attr_extended_name(&n_exp, 9, 9, > SA_NTF_VALUE_LDAP_NAME, &nameVar), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 10, 10, SA_NTF_VALUE_INT64, > &timeVar), SA_AIS_OK); > + safassert(set_attr_buf(&n_exp, 11, 11, SA_NTF_VALUE_BINARY, > &anyVar), SA_AIS_OK); > + > + if (!compare_notifs(&n_exp, &rec_notif_data)) { > + print_notif(&n_exp); > + print_notif(&rec_notif_data); > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + > + safassert(saNtfNotificationFree(rec_notif_data.nHandle), > SA_AIS_OK); > + safassert(saNtfNotificationFree(n_exp.nHandle), SA_AIS_OK); > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(unsub_notifications(), SA_AIS_OK); > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + test_validate(error, SA_AIS_OK); > +} > + > +/** > + * Modify a runtime test object with extended name attribute and verify > correctness > + * of generated notification. > + */ > +void objectModifyTest_3502(void) > +{ > + SaAisErrorT error = SA_AIS_OK; > + safassert(init_ntf(), SA_AIS_OK); > + safassert(subscribe_notifications(), SA_AIS_OK); > + rec_notif_data.populated = SA_FALSE; > + > + SaNameT var1; > + saAisNameLend((SaConstStringT)&extended_name_string_02, &var1); > + > + SaAnyT var2 = {.bufferSize = sizeof (BUF2), .bufferAddr = (SaUint8T*) > BUF2}; > + void* v1[] = {&var1}; > + void* v2[] = {&var2}; > + TestAttributeValue att1 = { > + .attrName = "testName", .attrType = SA_IMM_ATTR_SANAMET, > .attrValues = v1 > + }; > + TestAttributeValue att2 = { > + .attrName = "testAny", .attrType = SA_IMM_ATTR_SAANYT, > .attrValues = v2 > + }; > + TestAttributeValue * attrs[] = {&att1, &att2, NULL}; > + > + /* > + * Modify (REPLACE) the object in IMM. > + */ > + modify_rt_test_object(DNTESTRT, SA_IMM_ATTR_VALUES_REPLACE, attrs); > + > + /* > + * Wait for notification reception. > + */ > + int dwCnt = 0; > + while (dwCnt++ < POLLWAIT && !rec_notif_data.populated) { > + saNtfDispatch(ntfHandle, SA_DISPATCH_ALL); > + if (!rec_notif_data.populated) usleep(100); > + } > + > + if (rec_notif_data.populated) { > + NotifData n_exp; > + safassert(set_ntf(&n_exp, SA_NTF_ATTRIBUTE_CHANGED, DNTESTRT, > 4, 4), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 0, 0, > "SaImmAttrImplementerName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 1, 1, "SaImmAttrClassName"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 2, 2, "testName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 3, 3, "testAny"), SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 0, 0, > IMPLEMENTERNAME_RT), SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 1, 1, "OsafNtfCmTestRT"), > SA_AIS_OK); > + safassert(set_attr_change_extended_name(&n_exp, 2, 2, > SA_NTF_VALUE_LDAP_NAME, &var1), SA_AIS_OK); > + safassert(set_attr_change_buf(&n_exp, 3, 3, > SA_NTF_VALUE_BINARY, &var2), SA_AIS_OK); > + > + if (!compare_notifs(&n_exp, &rec_notif_data)) { > + print_notif(&n_exp); > + print_notif(&rec_notif_data); > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(saNtfNotificationFree(rec_notif_data.nHandle), > SA_AIS_OK); > + safassert(saNtfNotificationFree(n_exp.nHandle), SA_AIS_OK); > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(unsub_notifications(), SA_AIS_OK); > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + test_validate(error, SA_AIS_OK); > +} > + > + > +/** > + * Modify a runtime test object with extended name attribute and verify > correctness > + * of generated notification. > + */ > +void objectModifyTest_3503(void) > +{ > + SaAisErrorT error = SA_AIS_OK; > + safassert(init_ntf(), SA_AIS_OK); > + safassert(subscribe_notifications(), SA_AIS_OK); > + rec_notif_data.populated = SA_FALSE; > + > + /* modify the runtime object */ > + > + SaNameT oldvar; > + saAisNameLend((SaConstStringT)&extended_name_string_02, &oldvar); > + SaNameT addvar; > + saAisNameLend((SaConstStringT)&extended_name_string_01, &addvar); > + void* v[] = {&addvar}; > + TestAttributeValue att = { > + .attrName = "testName", .attrType = SA_IMM_ATTR_SANAMET, > .attrValues = v > + }; > + TestAttributeValue * attrs[] = {&att, NULL}; > + > + /* > + * Modify (ADD) the object in IMM. > + */ > + modify_rt_test_object(DNTESTRT, SA_IMM_ATTR_VALUES_ADD, attrs); > + > + /* > + * Wait for notification reception. > + */ > + int dwCnt = 0; > + while (dwCnt++ < POLLWAIT && !rec_notif_data.populated) { > + saNtfDispatch(ntfHandle, SA_DISPATCH_ALL); > + if (!rec_notif_data.populated) usleep(100); > + } > + > + if (rec_notif_data.populated) { > + NotifData n_exp; > + safassert(set_ntf(&n_exp, SA_NTF_ATTRIBUTE_CHANGED, DNTESTRT, > 3, 4), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 0, 0, > "SaImmAttrImplementerName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 1, 1, "SaImmAttrClassName"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 2, 2, "testName"), SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 0, 0, > IMPLEMENTERNAME_RT), SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 1, 1, "OsafNtfCmTestRT"), > SA_AIS_OK); > + safassert(set_attr_change_extended_name(&n_exp, 2, 2, > SA_NTF_VALUE_LDAP_NAME, &oldvar), SA_AIS_OK); > + safassert(set_attr_change_extended_name(&n_exp, 3, 2, > SA_NTF_VALUE_LDAP_NAME, &addvar), SA_AIS_OK); > + > + if (!compare_notifs(&n_exp, &rec_notif_data)) { > + print_notif(&n_exp); > + print_notif(&rec_notif_data); > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(saNtfNotificationFree(rec_notif_data.nHandle), > SA_AIS_OK); > + safassert(saNtfNotificationFree(n_exp.nHandle), SA_AIS_OK); > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(unsub_notifications(), SA_AIS_OK); > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + test_validate(error, SA_AIS_OK); > +} > + > + > +/** > + * Create a config object with extended name attribute and verify > correctness of > + * generated notification. > + */ > +void objectCreateTest_3505(void) > +{ > + char command[1024]; > + SaAisErrorT error = SA_AIS_OK; > + safassert(init_ntf(), SA_AIS_OK); > + safassert(subscribe_notifications(), SA_AIS_OK); > + rec_notif_data.populated = SA_FALSE; > + > + /* create an object */ > + sprintf(command, "immcfg -t 20 -c OsafNtfCmTestCFG %s -a testNameCfg=%s > -a testStringCfg=%s -a testAnyCfg=%s", > + DNTESTCFG, extended_name_string_01, STRINGVAR1, BUF1); > + assert(system(command) != -1); > + > + /* > + * Wait for notification reception. > + */ > + int dwCnt = 0; > + while (dwCnt++ < POLLWAIT && !rec_notif_data.populated) { > + saNtfDispatch(ntfHandle, SA_DISPATCH_ALL); > + if (!rec_notif_data.populated) usleep(100); > + } > + > + if (rec_notif_data.populated) { > + NotifData n_exp; > + SaInt32T int32Var = INT32VAR1; > + SaUint32T uint32Var = UINT32VAR1; > + SaInt64T int64Var = INT64VAR1; > + SaUint64T uint64Var = UINT64VAR1; > + SaTimeT timeVar = TIMEVAR1; > + SaNameT nameVar; > + saAisNameLend((SaConstStringT)&extended_name_string_01, > &nameVar); > + SaFloatT floatVar = FLOATVAR1; > + SaDoubleT doubleVar = DOUBLEVAR1; > + SaStringT stringVar = STRINGVAR1; > + SaAnyT anyVar = {.bufferSize = sizeof (BUF1), .bufferAddr = > (SaUint8T*) BUF1}; > + > + safassert(set_ntf(&n_exp, SA_NTF_OBJECT_CREATION, DNTESTCFG, > 14, 14), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 0, 0, > "SaImmAttrAdminOwnerName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 1, 1, "SaImmAttrClassName"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 2, 2, "SaImmOiCcbIdT"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 3, 3, "ccbLast"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 4, 4, "testUint32Cfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 5, 5, "testInt32Cfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 6, 6, "testUint64Cfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 7, 7, "testInt64Cfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 8, 8, "testStringCfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 9, 9, "testFloatCfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 10, 10, "testDoubleCfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 11, 11, "testNameCfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 12, 12, "testTimeCfg"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 13, 13, "testAnyCfg"), > SA_AIS_OK); > + safassert(set_attr_str(&n_exp, 0, 0, "immcfg_xxx"), SA_AIS_OK); > + safassert(set_attr_str(&n_exp, 1, 1, "OsafNtfCmTestCFG"), > SA_AIS_OK); > + SaUint64T ccidVar = 2; > + safassert(set_attr_scalar(&n_exp, 2, 2, SA_NTF_VALUE_UINT64, > &ccidVar), SA_AIS_OK); > + SaUint32T ccbLast = 1; > + safassert(set_attr_scalar(&n_exp, 3, 3, SA_NTF_VALUE_UINT32, > &ccbLast), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 4, 4, SA_NTF_VALUE_UINT32, > &uint32Var), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 5, 5, SA_NTF_VALUE_INT32, > &int32Var), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 6, 6, SA_NTF_VALUE_UINT64, > &uint64Var), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 7, 7, SA_NTF_VALUE_INT64, > &int64Var), SA_AIS_OK); > + safassert(set_attr_str(&n_exp, 8, 8, stringVar), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 9, 9, SA_NTF_VALUE_FLOAT, > &floatVar), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 10, 10, SA_NTF_VALUE_DOUBLE, > &doubleVar), SA_AIS_OK); > + safassert(set_attr_extended_name(&n_exp, 11, 11, > SA_NTF_VALUE_LDAP_NAME, &nameVar), SA_AIS_OK); > + safassert(set_attr_scalar(&n_exp, 12, 12, SA_NTF_VALUE_INT64, > &timeVar), SA_AIS_OK); > + safassert(set_attr_buf(&n_exp, 13, 13, SA_NTF_VALUE_BINARY, > &anyVar), SA_AIS_OK); > + > + if (!compare_notifs(&n_exp, &rec_notif_data)) { > + print_notif(&n_exp); > + print_notif(&rec_notif_data); > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(saNtfNotificationFree(rec_notif_data.nHandle), > SA_AIS_OK); > + safassert(saNtfNotificationFree(n_exp.nHandle), SA_AIS_OK); > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(unsub_notifications(), SA_AIS_OK); > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + test_validate(error, SA_AIS_OK); > +} > + > + > +/** > + * Modify a config object with extended name and verify correctness > + * of generated notification. > + */ > +void objectModifyTest_3506(void) > +{ > + char command[1024]; > + SaAisErrorT error = SA_AIS_OK; > + safassert(init_ntf(), SA_AIS_OK); > + safassert(subscribe_notifications(), SA_AIS_OK); > + rec_notif_data.populated = SA_FALSE; > + > + SaNameT var1; > + saAisNameLend((SaConstStringT)&extended_name_string_02, &var1); > + > + SaAnyT var2 = {.bufferSize = sizeof (BUF2), .bufferAddr = (SaUint8T*) > BUF2}; > + > + /* modify an object */ > + sprintf(command, "immcfg -t 20 -a testNameCfg=%s -a testAnyCfg=%s %s", > + extended_name_string_02, BUF2, DNTESTCFG); > + assert(system(command) != -1); > + > + /* > + * Wait for notification reception. > + */ > + int dwCnt = 0; > + while (dwCnt++ < POLLWAIT && !rec_notif_data.populated) { > + saNtfDispatch(ntfHandle, SA_DISPATCH_ALL); > + if (!rec_notif_data.populated) usleep(100); > + } > + > + if (rec_notif_data.populated) { > + NotifData n_exp; > + safassert(set_ntf(&n_exp, SA_NTF_ATTRIBUTE_CHANGED, DNTESTCFG, > 6, 6), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 0, 0, > "SaImmAttrAdminOwnerName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 1, 1, "SaImmAttrClassName"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 2, 2, "SaImmOiCcbIdT"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 3, 3, "ccbLast"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 4, 4, "testNameCfg"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 5, 5, "testAnyCfg"), SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 0, 0, "immcfg_xxx"), > SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 1, 1, > "OsafNtfCmTestCFG"), SA_AIS_OK); > + SaUint64T ccidVar = 3; > + safassert(set_attr_change_scalar(&n_exp, 2, 2, > SA_NTF_VALUE_UINT64, &ccidVar), SA_AIS_OK); > + SaUint32T ccbLast = 1; > + safassert(set_attr_change_scalar(&n_exp, 3, 3, > SA_NTF_VALUE_UINT32, &ccbLast), SA_AIS_OK); > + safassert(set_attr_change_extended_name(&n_exp, 4, 4, > SA_NTF_VALUE_LDAP_NAME, &var1), SA_AIS_OK); > + safassert(set_attr_change_buf(&n_exp, 5, 5, > SA_NTF_VALUE_BINARY, &var2), SA_AIS_OK); > + > + if (!compare_notifs(&n_exp, &rec_notif_data)) { > + print_notif(&n_exp); > + print_notif(&rec_notif_data); > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(saNtfNotificationFree(rec_notif_data.nHandle), > SA_AIS_OK); > + safassert(saNtfNotificationFree(n_exp.nHandle), SA_AIS_OK); > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(unsub_notifications(), SA_AIS_OK); > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + test_validate(error, SA_AIS_OK); > +} > + > +/** > + * Modify a config object with extended name attribute and verify correctness > + * of generated notification. > + */ > +void objectModifyTest_3507(void) > +{ > + char command[1024]; > + SaAisErrorT error = SA_AIS_OK; > + safassert(init_ntf(), SA_AIS_OK); > + safassert(subscribe_notifications(), SA_AIS_OK); > + rec_notif_data.populated = SA_FALSE; > + > + /* modify an object */ > + SaNameT oldvar; > + saAisNameLend((SaConstStringT)&extended_name_string_02, &oldvar); > + SaNameT addvar; > + saAisNameLend((SaConstStringT)&extended_name_string_01, &addvar); > + sprintf(command, "immcfg -a testNameCfg+=%s %s", > extended_name_string_01, DNTESTCFG); > + assert(system(command) != -1); > + > + /* > + * Wait for notification reception. > + */ > + int dwCnt = 0; > + while (dwCnt++ < POLLWAIT && !rec_notif_data.populated) { > + saNtfDispatch(ntfHandle, SA_DISPATCH_ALL); > + if (!rec_notif_data.populated) usleep(100); > + } > + > + if (rec_notif_data.populated) { > + NotifData n_exp; > + safassert(set_ntf(&n_exp, SA_NTF_ATTRIBUTE_CHANGED, DNTESTCFG, > 5, 6), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 0, 0, > "SaImmAttrAdminOwnerName"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 1, 1, "SaImmAttrClassName"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 2, 2, "SaImmOiCcbIdT"), > SA_AIS_OK); > + safassert(set_add_info(&n_exp, 3, 3, "ccbLast"), SA_AIS_OK); > + safassert(set_add_info(&n_exp, 4, 4, "testNameCfg"), SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 0, 0, "immcfg_xxx"), > SA_AIS_OK); > + safassert(set_attr_change_str(&n_exp, 1, 1, > "OsafNtfCmTestCFG"), SA_AIS_OK); > + SaUint64T ccidVar = 3; > + safassert(set_attr_change_scalar(&n_exp, 2, 2, > SA_NTF_VALUE_UINT64, &ccidVar), SA_AIS_OK); > + SaUint32T ccbLast = 1; > + safassert(set_attr_change_scalar(&n_exp, 3, 3, > SA_NTF_VALUE_UINT32, &ccbLast), SA_AIS_OK); > + safassert(set_attr_change_extended_name(&n_exp, 4, 4, > SA_NTF_VALUE_LDAP_NAME, &oldvar), SA_AIS_OK); > + safassert(set_attr_change_extended_name(&n_exp, 5, 4, > SA_NTF_VALUE_LDAP_NAME, &addvar), SA_AIS_OK); > + > + if (!compare_notifs(&n_exp, &rec_notif_data)) { > + print_notif(&n_exp); > + print_notif(&rec_notif_data); > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(saNtfNotificationFree(rec_notif_data.nHandle), > SA_AIS_OK); > + safassert(saNtfNotificationFree(n_exp.nHandle), SA_AIS_OK); > + } else { > + error = SA_AIS_ERR_FAILED_OPERATION; > + } > + safassert(unsub_notifications(), SA_AIS_OK); > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + test_validate(error, SA_AIS_OK); > +} > > __attribute__((constructor)) static void ntf_imcn_constructor(void) > { > @@ -4290,9 +4775,15 @@ void objectDeleteTest_3404(void) > rc = system("immcfg -f //tmp//ntfsv_test_classes.xml"); > } > if (rc != 0) { > - printf("ntfsv_test_classes.xml file not installed (see README)"); > - return; > - } > + printf("ntfsv_test_classes.xml file not installed (see > README)"); > + return; > + } > + memset(&extended_name_string_01, 'C', DEFAULT_EXT_NAME_LENGTH - 1); > + extended_name_string_01[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > + memset(&extended_name_string_02, 'D', DEFAULT_EXT_NAME_LENGTH - 1); > + extended_name_string_02[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > test_suite_add(32, "CM notifications test"); > test_case_add(32, objectCreateTest_01, "CREATE, runtime > (OsafNtfCmTestRT) object"); > test_case_add(32, objectModifyTest_02, "runtime, attr ch, REPLACE > (UINT32, FLOAT)"); > @@ -4334,10 +4825,21 @@ void objectDeleteTest_3404(void) > test_case_add(32, objectMultiCcbTest_38, "config, multiple op in ccb, 2 > REPLACE"); > test_case_add(32, objectMultiCcbTest_39, "config, multiple op in ccb, > ADD, REPLACE, DELETE"); > test_case_add(32, objectDeleteTest_40, "DELETE, config > (OsafNtfCmTestCFG) object"); > + > test_suite_add(34, "CM notifications test, persistent runtime"); > test_case_add(34, objectCreateTest_3401, "CREATE, runtime > (OsafNtfCmTestRT1) object"); > test_case_add(34, objectModifyTest_3402, "runtime, attr ch, REPLACE > (UINT32, FLOAT)"); > test_case_add(34, objectModifyTest_3403, "runtime, attr ch, ADD > (INT32)"); > test_case_add(34, objectDeleteTest_3404, "DELETE, runtime > (OsafNtfCmTestRT1) object"); > + > + test_suite_add(35, "CM notification test for extended name attribute"); > + test_case_add(35, objectCreateTest_3501, "CREATE, runtime > (OsafNtfCmTestRT) object, extended name attribute"); > + test_case_add(35, objectModifyTest_3502, "runtime, attr ch, REPLACE > (EXTENDED NAME, ANY)"); > + test_case_add(35, objectModifyTest_3503, "runtime, attr ch, ADD > (EXTENDED NAME)"); > + test_case_add(35, objectDeleteTest_19, "DELETE, runtime > (OsafNtfCmTestRT) object"); > + test_case_add(35, objectCreateTest_3505, "CREATE, config > (OsafNtfCmTestCFG) object, extended name attribute"); > + test_case_add(35, objectModifyTest_3506, "config, attr ch, REPLACE > (EXTENDED NAME, ANY)"); > + test_case_add(35, objectModifyTest_3507, "config, attr ch, ADD > (EXTENDED NAME)"); > + test_case_add(35, objectDeleteTest_40, "DELETE, config > (OsafNtfCmTestCFG) object"); > } > > diff --git a/tests/ntfsv/tet_longDnObject_notification.c > b/tests/ntfsv/tet_longDnObject_notification.c > new file mode 100644 > --- /dev/null > +++ b/tests/ntfsv/tet_longDnObject_notification.c > @@ -0,0 +1,972 @@ > +/* -*- OpenSAF -*- > + * > + * (C) Copyright 2009 The OpenSAF Foundation > + * > + * This program is distributed in the hope that it will be useful, but > + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY > + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed > + * under the GNU Lesser General Public License Version 2.1, February 1999. > + * The complete license can be accessed from the following location: > + * http://opensource.org/licenses/lgpl-license.php > + * See the Copying file included with the OpenSAF distribution for full > + * licensing terms. > + * > + * Author(s): Ericsson AB > + * > + */ > +/** > + > + */ > +#include <utest.h> > +#include <util.h> > +#include "tet_ntf.h" > +#include "tet_ntf_common.h" > +//#include "util.h" > +#define NOTIFYING_OBJECT_TEST "AVND" > +#define NTF_REST_MAX_IDS 30 > + > +#define DEFAULT_EXT_NAME_LENGTH 300 > +#define DEFAULT_UNEXT_NAME_STRING "This is unextended SaNameT string (<256)" > +struct not_idsT { > + int length; > + SaNtfIdentifierT ids[NTF_REST_MAX_IDS]; > +}; > + > +static struct not_idsT received_ids = {0,}; > +static struct not_idsT ok_ids = {0,}; > + > +static char default_ext_notification_object[DEFAULT_EXT_NAME_LENGTH]; > +static char default_ext_notifying_object[DEFAULT_EXT_NAME_LENGTH]; > +static char test_longdn_object_1[DEFAULT_EXT_NAME_LENGTH]; > +static char test_longdn_object_2[DEFAULT_EXT_NAME_LENGTH]; > +static char test_longdn_object_3[DEFAULT_EXT_NAME_LENGTH]; > + > +static SaNtfNotificationTypeFilterHandlesT myNotificationFilterHandles; > + > +/* Used to keep track of which ntf we got */ > +static SaNtfNotificationTypeFilterHandlesT ntfRecieved; > + > +static int errors; > +static SaNtfSubscriptionIdT subscriptionId; > +static SaNtfAlarmNotificationT myAlarmNotification; > +static SaNtfObjectCreateDeleteNotificationT myObjCrDelNotification; > +static SaNtfAttributeChangeNotificationT myAttrChangeNotification; > +static SaNtfStateChangeNotificationT myStateChangeNotification; > +static SaNtfSecurityAlarmNotificationT mySecAlarmNotification; > + > +extern void saAisNameLend(SaConstStringT value, SaNameT* name); > +extern SaConstStringT saAisNameBorrow(const SaNameT* name); > + > +/** > + * Init default long dn objects > + */ > +static void init_ext_object() > +{ > + safassert(setenv("SA_ENABLE_EXTENDED_NAMES", "1", 1), 0); > + > + memset(&default_ext_notification_object, 'A', DEFAULT_EXT_NAME_LENGTH - > 1); > + default_ext_notification_object[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > + memset(&default_ext_notifying_object, 'B', DEFAULT_EXT_NAME_LENGTH - 1); > + default_ext_notifying_object[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > + memset(&test_longdn_object_1, 'C', DEFAULT_EXT_NAME_LENGTH - 1); > + test_longdn_object_1[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > + memset(&test_longdn_object_2, 'D', DEFAULT_EXT_NAME_LENGTH - 1); > + test_longdn_object_2[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > + memset(&test_longdn_object_3, 'E', DEFAULT_EXT_NAME_LENGTH - 1); > + test_longdn_object_3[DEFAULT_EXT_NAME_LENGTH - 1] = '\0'; > + > +} > + > +/** > + * Store all recieved notificationIds > + */ > +static void ntf_id_store(SaNtfIdentifierT n_id) > +{ > + assert(NTF_REST_MAX_IDS > received_ids.length); > + received_ids.ids[received_ids.length++] = n_id; > +} > + > +/** > + * Post process all recived notificationIds towards the ids that > + * are expected to be received. > + */ > +static SaAisErrorT check_errors() > +{ > + int i, j, found; > + SaAisErrorT rc = SA_AIS_OK; > + > + for (i = 0; i< received_ids.length; i++) { > + found=0; > + for (j= 0; j< ok_ids.length; j++) { > + if (received_ids.ids[i] == ok_ids.ids[j]){ > + found = 1; > + break; > + } > + } > + if(!found) > + errors++; > + } > + if(errors) > + { > + rc = SA_AIS_ERR_FAILED_OPERATION; > + printf("num of failed notifications: %d\n", errors); > + } > + return rc; > +} > + > +static void resetCounters() > +{ > + errors = 0; > + received_ids.length = 0; > + ok_ids.length = 0; > + ntfRecieved.alarmFilterHandle = 0; > + ntfRecieved.attributeChangeFilterHandle = 0; > + ntfRecieved.objectCreateDeleteFilterHandle = 0; > + ntfRecieved.securityAlarmFilterHandle = 0; > + ntfRecieved.stateChangeFilterHandle = 0; > +} > + > +/** > + * Creates an ObjectCreateDeleteNotification with default values. > + * > + * @param ntfHandle > + * @param myObjCreDelNotification > + */ > +void extCreateObjectCreateDeleteNotification(SaNtfHandleT ntfHandle, > + SaNtfObjectCreateDeleteNotificationT *myObjCrDelNotification) > +{ > + SaNtfNotificationHeaderT *head; > + > + createObjectCreateDeleteNotification(ntfHandle, myObjCrDelNotification); > + head = &myObjCrDelNotification->notificationHeader; > + /* Overwrite with long dn object */ > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > head->notificationObject); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > head->notifyingObject); > +} > + > +/** > + * Creates an AttributeChangeNotification with default values. > + * > + * @param ntfhandle > + * @param myAttrChangeNotification > + */ > +void extCreateAttributeChangeNotification(SaNtfHandleT ntfHandle, > + SaNtfAttributeChangeNotificationT *myAttrChangeNotification) > +{ > + SaNtfNotificationHeaderT *head; > + > + createAttributeChangeNotification(ntfHandle, myAttrChangeNotification); > + head = &myAttrChangeNotification->notificationHeader; > + /* Overwrite with long dn object */ > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > head->notificationObject); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > head->notifyingObject); > +} > + > +/** > + * Create a StateChangeNotification with default values. > + * > + * @param ntfHandle > + * @param myStateChangeNotification > + */ > +void extCreateStateChangeNotification(SaNtfHandleT ntfHandle, > + SaNtfStateChangeNotificationT *myStateChangeNotification) > +{ > + SaNtfNotificationHeaderT *head; > + > + createStateChangeNotification(ntfHandle, myStateChangeNotification); > + head = &myStateChangeNotification->notificationHeader; > + /* Overwrite with long dn object */ > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > head->notificationObject); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > head->notifyingObject); > +} > + > +/** > + * Create a SecurityAlarmNotification with default values. > + * > + * @param ntfHandle > + * @param mySecAlarmNotification > + */ > +void extCreateSecurityAlarmNotification(SaNtfHandleT ntfHandle, > + SaNtfSecurityAlarmNotificationT *mySecAlarmNotification) > +{ > + SaNtfNotificationHeaderT *head; > + > + createSecurityAlarmNotification(ntfHandle, mySecAlarmNotification); > + head = &mySecAlarmNotification->notificationHeader; > + /* Overwrite with long dn object */ > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > head->notificationObject); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > head->notifyingObject); > +} > + > +/** > + * Verify the contents in the notification. > + * We use the myNotificationFilterHandles to know which notifications to > expect. > + */ > +static void saNtfNotificationCallbackT( > + SaNtfSubscriptionIdT subscriptionId, > + const SaNtfNotificationsT *notification) > +{ > + SaNtfNotificationHandleT notificationHandle = 0; > + switch(notification->notificationType) > + { > + case SA_NTF_TYPE_OBJECT_CREATE_DELETE: > + notificationHandle = > notification->notification.objectCreateDeleteNotification.notificationHandle; > + ntfRecieved.objectCreateDeleteFilterHandle += 1; > + > if(myNotificationFilterHandles.objectCreateDeleteFilterHandle == 0) > + errors +=1; > + else > + > ntf_id_store(*notification->notification.objectCreateDeleteNotification.notificationHeader.notificationId); > + break; > + > + case SA_NTF_TYPE_ATTRIBUTE_CHANGE: > + notificationHandle = > notification->notification.attributeChangeNotification.notificationHandle; > + ntfRecieved.attributeChangeFilterHandle += 1; > + > if(myNotificationFilterHandles.attributeChangeFilterHandle == 0) > + errors += 1; > + else > + > ntf_id_store(*notification->notification.attributeChangeNotification.notificationHeader.notificationId); > + break; > + > + case SA_NTF_TYPE_STATE_CHANGE: > + notificationHandle = > notification->notification.stateChangeNotification.notificationHandle; > + ntfRecieved.stateChangeFilterHandle += 1; > + if(myNotificationFilterHandles.stateChangeFilterHandle > == 0) > + errors += 1; > + else > + > ntf_id_store(*notification->notification.stateChangeNotification.notificationHeader.notificationId); > + break; > + > + case SA_NTF_TYPE_ALARM: > + notificationHandle = > notification->notification.alarmNotification.notificationHandle; > + ntfRecieved.alarmFilterHandle += 1; > + if(myNotificationFilterHandles.alarmFilterHandle == 0) { > + printf("alarmFilterHandle == 0\n"); > > + errors +=1; > + } else > + > ntf_id_store(*notification->notification.alarmNotification.notificationHeader.notificationId); > + break; > + > + case SA_NTF_TYPE_SECURITY_ALARM: > + notificationHandle = > notification->notification.securityAlarmNotification.notificationHandle; > + ntfRecieved.securityAlarmFilterHandle += 1; > + > if(myNotificationFilterHandles.securityAlarmFilterHandle == 0) > + errors += 1; > + else > + > ntf_id_store(*notification->notification.securityAlarmNotification.notificationHeader.notificationId); > + break; > + > + default: > + errors +=1; > + assert(0); > + break; > + } > + last_not_id = get_ntf_id(notification); > + if (notificationHandle != 0) > + safassert(saNtfNotificationFree(notificationHandle), SA_AIS_OK); > +} > + > + > +static SaNtfCallbacksT ntfCbTest = { > + saNtfNotificationCallbackT, > + NULL > +}; > + > +/** > + * Fill the filter header with long dn objects > + */ > +void extFillFilterHeader(SaNtfNotificationFilterHeaderT *head) > +{ > + fillFilterHeader(head); > + /* Overwrite the objects with long dn */ > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > &head->notificationObjects[0]); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > &head->notifyingObjects[0]); > +} > + > +/** > + * Fill the header with long dn objects > + */ > +void extFillHeader(SaNtfNotificationHeaderT *head) > +{ > + fillHeader(head); > + /* Overwrite the objects with long dn */ > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > head->notificationObject); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > head->notifyingObject); > +} > + > + > +/** > + * Fill header with extended SaNameT in additionalInfo > + */ > + void extFillHeaderAddInfo(SaNtfNotificationHeaderT *head, > SaNtfNotificationHandleT notHandle) > + { > + int i; > + SaStringT dest_ptr; > + SaNameT name1, name2, name3, name4, name5; > + *(head->eventType) = SA_NTF_ALARM_COMMUNICATION; > + *(head->eventTime) = SA_TIME_UNKNOWN; > + > + saAisNameLend((SaConstStringT)&default_ext_notification_object, > head->notificationObject); > + saAisNameLend((SaConstStringT)&default_ext_notifying_object, > head->notifyingObject); > + > + head->notificationClassId->vendorId = ERICSSON_VENDOR_ID; > + head->notificationClassId->majorId = 92; > + head->notificationClassId->minorId = 12; > + > + /* set additional text */ > + (void)strncpy(head->additionalText, > + DEFAULT_ADDITIONAL_TEXT, > + (SaUint16T)(strlen(DEFAULT_ADDITIONAL_TEXT) + 1)); > + > + for (i = 0; i < head->numCorrelatedNotifications; i++) > + head->correlatedNotifications[i] = (SaNtfIdentifierT) (i + 400); > + > + // Fill first additionalInfo as extended SaNameT including NULL > character > + head->additionalInfo[0].infoType = SA_NTF_VALUE_LDAP_NAME; > + head->additionalInfo[0].infoId = 1; > + saAisNameLend((SaConstStringT)&test_longdn_object_1, &name1); > + > + safassert(saNtfPtrValAllocate(notHandle, > + strlen(saAisNameBorrow(&name1)) + 3, > + (void**)&dest_ptr, > + &(head->additionalInfo[0].infoValue)), > SA_AIS_OK); > + > + saAisNameLend(saAisNameBorrow(&name1), (SaNameT*) dest_ptr); > + > + // Fill sencond additionalInfo as extended SaNameT excluding NULL > character > + head->additionalInfo[1].infoType = SA_NTF_VALUE_LDAP_NAME; > + head->additionalInfo[1].infoId = 1; > + saAisNameLend((SaConstStringT)&test_longdn_object_2, &name2); > + > + safassert(saNtfPtrValAllocate(notHandle, > + strlen(saAisNameBorrow(&name2)) + 2, > + (void**)&dest_ptr, > + &(head->additionalInfo[1].infoValue)), > SA_AIS_OK); > + > + saAisNameLend(saAisNameBorrow(&name2), (SaNameT*) dest_ptr); > + > + > + //Fill third additionalInfo as extended SaNameT as legacy code -> > object is truncated > + head->additionalInfo[2].infoType = SA_NTF_VALUE_LDAP_NAME; > + head->additionalInfo[2].infoId = 1; > + saAisNameLend((SaConstStringT)&test_longdn_object_3, &name3); > + safassert(saNtfPtrValAllocate(notHandle, > + sizeof(name3) + 1, > + (void**)&dest_ptr, > + &(head->additionalInfo[2].infoValue)), > SA_AIS_OK); > + > + memcpy(dest_ptr, &name3, sizeof(name3)); > + > + // Fill fourth additionalInfo as unextended SaNameT as legacy code > + head->additionalInfo[3].infoType = SA_NTF_VALUE_LDAP_NAME; > + head->additionalInfo[3].infoId = 1; > + saAisNameLend(DEFAULT_UNEXT_NAME_STRING, &name4); > + > + safassert(saNtfPtrValAllocate(notHandle, > + sizeof(name4) + 1, > + (void**)&dest_ptr, > + &(head->additionalInfo[3].infoValue)), > SA_AIS_OK); > + > + memcpy(dest_ptr, &name4, sizeof(name4)); > + > + //Fill the fifth additionalInfo as unextended SaNameT as modern code > + head->additionalInfo[4].infoType = SA_NTF_VALUE_LDAP_NAME; > + head->additionalInfo[4].infoId = 1; > + saAisNameLend(DEFAULT_UNEXT_NAME_STRING, &name5); > + > + safassert(saNtfPtrValAllocate(notHandle, > + strlen(saAisNameBorrow(&name5)) + 3, > + (void**)&dest_ptr, > + &(head->additionalInfo[4].infoValue)), > SA_AIS_OK); > + > + saAisNameLend(saAisNameBorrow(&name5), (SaNameT*) dest_ptr); > + } > + > + /** > + * Test AdditionalInfo with extended SaNameT type > + */ > + void extAdditionalInfoTest(void) > + { > + SaNtfAlarmNotificationFilterT myAlarmFilter; > + subscriptionId = 1; > + SaNtfNotificationHeaderT *head; > + > + rc = SA_AIS_OK; > + > + resetCounters(); > + > + safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , > SA_AIS_OK); > + safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , > SA_AIS_OK); > + > + /* specify complex filter */ > + safassert(saNtfAlarmNotificationFilterAllocate( > + ntfHandle, > + &myAlarmFilter, > + 1, > + 1, > + 1, > + 1, > + 0, > + 0, > + 0), SA_AIS_OK); > + /* set header filter specific fields */ > + extFillFilterHeader(&myAlarmFilter.notificationFilterHeader); > + > + /* 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), > + 5, > + 0, > + 0, > + 0, > + SA_NTF_ALLOC_SYSTEM_LIMIT), SA_AIS_OK); > + > + head = &myAlarmNotification.notificationHeader; > + extFillHeaderAddInfo(head, myAlarmNotification.notificationHandle); > + /* These 3 fields is alarm filter items */ > + *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; > + *(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); > + > + /* only this notification should be caught */ > + ok_ids.ids[ok_ids.length++] = > *myAlarmNotification.notificationHeader.notificationId; > + 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); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > + } > + > +/** > + * Test all filter header fields > + */ > +void extFilterNotificationTest(void) > +{ > + SaNtfAlarmNotificationFilterT myAlarmFilter; > + subscriptionId = 1; > + SaNtfNotificationHeaderT *head; > + > + rc = SA_AIS_OK; > + > + resetCounters(); > + > + safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , > SA_AIS_OK); > + safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , > SA_AIS_OK); > + > + /* specify complex filter */ > + safassert(saNtfAlarmNotificationFilterAllocate( > + ntfHandle, > + &myAlarmFilter, > + 1, > + 1, > + 1, > + 1, > + 0, > + 0, > + 0), SA_AIS_OK); > + /* set header filter specific fields */ > + extFillFilterHeader(&myAlarmFilter.notificationFilterHeader); > + > + /* 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); > + > + head = &myAlarmNotification.notificationHeader; > + extFillHeader(head); > + > + /* These 3 fields is alarm filter items */ > + *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; > + *(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; > + > + *(head->eventType) = SA_NTF_ALARM_EQUIPMENT; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + saAisNameLend((SaConstStringT)&test_longdn_object_1, > head->notificationObject); > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + extFillHeader(head); > + saAisNameLend(NOTIFYING_OBJECT_TEST, head->notifyingObject); > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + extFillHeader(head); > + head->notificationClassId->vendorId = 199; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + extFillHeader(head); > + head->notificationClassId->majorId = 89; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + extFillHeader(head); > + head->notificationClassId->minorId = 24; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + extFillHeader(head); > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + /* only this notification should be caught */ > + ok_ids.ids[ok_ids.length++] = > *myAlarmNotification.notificationHeader.notificationId; > + 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); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > +} > + > +/** > + * Test Alarm notification with long dn objects > + */ > +void extAlarmNotificationTest(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); > + > + safassert(saNtfAlarmNotificationFilterAllocate( > + ntfHandle, > + &myAlarmFilter, > + 0, > + 0, > + 0, > + 0, > + 1, > + 1, > + 1), SA_AIS_OK); > + /* Set perceived severities */ > + myAlarmFilter.perceivedSeverities[0] = SA_NTF_SEVERITY_WARNING; > + myAlarmFilter.probableCauses[0] = SA_NTF_BANDWIDTH_REDUCED; > + myAlarmFilter.trends[0] = SA_NTF_TREND_MORE_SEVERE; > + > + /* 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); > + extFillHeader(&myAlarmNotification.notificationHeader); > + > + *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_CRITICAL; > + *(myAlarmNotification.probableCause) = SA_NTF_CALL_ESTABLISHMENT_ERROR; > + *myAlarmNotification.trend = SA_NTF_TREND_NO_CHANGE; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; > + *(myAlarmNotification.probableCause) = SA_NTF_PRESSURE_UNACCEPTABLE; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; > + *(myAlarmNotification.probableCause) = SA_NTF_BANDWIDTH_REDUCED; > + *myAlarmNotification.trend = SA_NTF_TREND_NO_CHANGE; > + > safassert(saNtfNotificationSend(myAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + extFillHeader(&myAlarmNotification.notificationHeader); > + /* These 3 fields is filter items */ > + *(myAlarmNotification.perceivedSeverity) = SA_NTF_SEVERITY_WARNING; > + *(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); > + /* only this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myAlarmNotification.notificationHeader.notificationId; > + 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); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > +} > + > +/** > + * Test Object Create/Delete notification with long dn objects > + */ > +void extObjectCreateDeleteNotificationTest(void) > +{ > + SaNtfObjectCreateDeleteNotificationFilterT myFilter; > + > + subscriptionId = 2; > + > + resetCounters(); > + > + safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , > SA_AIS_OK); > + safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , > SA_AIS_OK); > + > + safassert(saNtfObjectCreateDeleteNotificationFilterAllocate( > + ntfHandle, > + &myFilter, > + 1, > + 1, > + 1, > + 1, > + 2), SA_AIS_OK); > + myFilter.sourceIndicators[0] = SA_NTF_OBJECT_OPERATION; > + myFilter.sourceIndicators[1] = SA_NTF_MANAGEMENT_OPERATION; > + extFillFilterHeader(&myFilter.notificationFilterHeader); > + myFilter.notificationFilterHeader.eventTypes[0] = > SA_NTF_OBJECT_CREATION; > + /* Initialize filter handles */ > + myNotificationFilterHandles.alarmFilterHandle = 0; > + myNotificationFilterHandles.attributeChangeFilterHandle = 0; > + myNotificationFilterHandles.objectCreateDeleteFilterHandle = > + myFilter.notificationFilterHandle; > + myNotificationFilterHandles.securityAlarmFilterHandle = 0; > + myNotificationFilterHandles.stateChangeFilterHandle = 0; > + safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, > + subscriptionId), SA_AIS_OK); > + extCreateObjectCreateDeleteNotification(ntfHandle, > &myObjCrDelNotification); > + *(myObjCrDelNotification.sourceIndicator) = SA_NTF_OBJECT_OPERATION; > > + > safassert(saNtfNotificationSend(myObjCrDelNotification.notificationHandle), > SA_AIS_OK); > + /* this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myObjCrDelNotification.notificationHeader.notificationId; > + > + *(myObjCrDelNotification.sourceIndicator) = SA_NTF_UNKNOWN_OPERATION; > + > safassert(saNtfNotificationSend(myObjCrDelNotification.notificationHandle), > SA_AIS_OK); > + > + *(myObjCrDelNotification.sourceIndicator) = > SA_NTF_MANAGEMENT_OPERATION; > + > safassert(saNtfNotificationSend(myObjCrDelNotification.notificationHandle), > SA_AIS_OK); > + /* this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myObjCrDelNotification.notificationHeader.notificationId; > + poll_until_received(ntfHandle, > *myObjCrDelNotification.notificationHeader.notificationId); > + if(ntfRecieved.alarmFilterHandle != 0 || > + ntfRecieved.attributeChangeFilterHandle != 0 || > + ntfRecieved.objectCreateDeleteFilterHandle != > ok_ids.length|| > + ntfRecieved.securityAlarmFilterHandle != 0 || > + ntfRecieved.stateChangeFilterHandle != 0) > safassert(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); > + > safassert(saNtfNotificationFree(myObjCrDelNotification.notificationHandle), > SA_AIS_OK); > + > safassert(saNtfNotificationFilterFree(myFilter.notificationFilterHandle), > SA_AIS_OK); > + > + safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); > > + safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > +} > + > +/** > + * Test Attribute Change notification with long dn objects > + */ > +void extAttributeChangeNotificationTest(void) > +{ > + SaNtfAttributeChangeNotificationFilterT myFilter; > + > + subscriptionId = 2; > + > + resetCounters(); > + > + safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , > SA_AIS_OK); > + safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , > SA_AIS_OK); > + > + safassert(saNtfAttributeChangeNotificationFilterAllocate( > + ntfHandle, > + &myFilter, > + 1, > + 1, > + 1, > + 1, > + 2), SA_AIS_OK); > + > + myFilter.sourceIndicators[0] = SA_NTF_OBJECT_OPERATION; > + myFilter.sourceIndicators[1] = SA_NTF_MANAGEMENT_OPERATION; > + extFillFilterHeader(&myFilter.notificationFilterHeader); > + myFilter.notificationFilterHeader.eventTypes[0] = > SA_NTF_ATTRIBUTE_CHANGED; > + /* Initialize filter handles */ > + myNotificationFilterHandles.alarmFilterHandle = 0; > + myNotificationFilterHandles.attributeChangeFilterHandle = > + myFilter.notificationFilterHandle; > + myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; > + myNotificationFilterHandles.securityAlarmFilterHandle = 0; > + myNotificationFilterHandles.stateChangeFilterHandle = 0; > + safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, > + subscriptionId), SA_AIS_OK); > + extCreateAttributeChangeNotification(ntfHandle, > &myAttrChangeNotification); > + *(myAttrChangeNotification.sourceIndicator) = SA_NTF_OBJECT_OPERATION; > > + > safassert(saNtfNotificationSend(myAttrChangeNotification.notificationHandle), > SA_AIS_OK); > + /* this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myAttrChangeNotification.notificationHeader.notificationId; > + > + *(myAttrChangeNotification.sourceIndicator) = SA_NTF_UNKNOWN_OPERATION; > + > safassert(saNtfNotificationSend(myAttrChangeNotification.notificationHandle), > SA_AIS_OK); > + > + *(myAttrChangeNotification.sourceIndicator) = > SA_NTF_MANAGEMENT_OPERATION; > + > safassert(saNtfNotificationSend(myAttrChangeNotification.notificationHandle), > SA_AIS_OK); > + /* this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myAttrChangeNotification.notificationHeader.notificationId; > + poll_until_received(ntfHandle, > *myAttrChangeNotification.notificationHeader.notificationId); > + if(ntfRecieved.alarmFilterHandle != 0 || > + ntfRecieved.attributeChangeFilterHandle != > ok_ids.length || > + ntfRecieved.objectCreateDeleteFilterHandle != 0|| > + ntfRecieved.securityAlarmFilterHandle != 0 || > + ntfRecieved.stateChangeFilterHandle != 0) > safassert(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); > + > safassert(saNtfNotificationFree(myAttrChangeNotification.notificationHandle), > SA_AIS_OK); > + > safassert(saNtfNotificationFilterFree(myFilter.notificationFilterHandle), > SA_AIS_OK); > + > + > + safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); > > + safassert(saNtfFinalize(ntfHandle) , SA_AIS_OK); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > +} > + > +/** > + * Test State Change notification with long dn objects > + */ > +void extStateChangeNotificationTest(void) > +{ > + SaNtfStateChangeNotificationFilterT myFilter; > + > + subscriptionId = 2; > + > + resetCounters(); > + > + safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , > SA_AIS_OK); > + safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , > SA_AIS_OK); > + > + safassert(saNtfStateChangeNotificationFilterAllocate( > + ntfHandle, > + &myFilter, > + 1, > + 1, > + 1, > + 1, > + 2, > + 0), SA_AIS_OK); > + > + myFilter.sourceIndicators[0] = SA_NTF_OBJECT_OPERATION; > + myFilter.sourceIndicators[1] = SA_NTF_MANAGEMENT_OPERATION; > + extFillFilterHeader(&myFilter.notificationFilterHeader); > + myFilter.notificationFilterHeader.eventTypes[0] = > SA_NTF_OBJECT_STATE_CHANGE; > + /* Initialize filter handles */ > + myNotificationFilterHandles.alarmFilterHandle = 0; > + myNotificationFilterHandles.attributeChangeFilterHandle = 0; > + myNotificationFilterHandles.objectCreateDeleteFilterHandle = 0; > + myNotificationFilterHandles.securityAlarmFilterHandle = 0; > + myNotificationFilterHandles.stateChangeFilterHandle = > myFilter.notificationFilterHandle; > + safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, > + subscriptionId), SA_AIS_OK); > + > + extCreateStateChangeNotification(ntfHandle, > &myStateChangeNotification); > + *(myStateChangeNotification.sourceIndicator) = SA_NTF_OBJECT_OPERATION; > > + > safassert(saNtfNotificationSend(myStateChangeNotification.notificationHandle), > SA_AIS_OK); > + /* this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myStateChangeNotification.notificationHeader.notificationId; > + > + *(myStateChangeNotification.sourceIndicator) = SA_NTF_UNKNOWN_OPERATION; > + > safassert(saNtfNotificationSend(myStateChangeNotification.notificationHandle), > SA_AIS_OK); > + > + *(myStateChangeNotification.sourceIndicator) = > SA_NTF_MANAGEMENT_OPERATION; > + > safassert(saNtfNotificationSend(myStateChangeNotification.notificationHandle), > SA_AIS_OK); > + /* this notification should be caught*/ > + ok_ids.ids[ok_ids.length++] = > *myStateChangeNotification.notificationHeader.notificationId; > + poll_until_received(ntfHandle, > *myStateChangeNotification.notificationHeader.notificationId); > + if(ntfRecieved.alarmFilterHandle != 0 || > + ntfRecieved.attributeChangeFilterHandle != 0 || > + ntfRecieved.objectCreateDeleteFilterHandle != 0|| > + ntfRecieved.securityAlarmFilterHandle != 0 || > + ntfRecieved.stateChangeFilterHandle != ok_ids.length) > safassert(SA_AIS_ERR_BAD_FLAGS, SA_AIS_OK); > + > safassert(saNtfNotificationFree(myStateChangeNotification.notificationHandle), > SA_AIS_OK); > + > safassert(saNtfNotificationFilterFree(myFilter.notificationFilterHandle), > SA_AIS_OK); > + > + safassert(saNtfNotificationUnsubscribe(subscriptionId), SA_AIS_OK); > > + safassert(saNtfFinalize(ntfHandle), SA_AIS_OK); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > +} > + > +/** > + * Test Security Alarm notification with long dn objects > + */ > +void extSecurityAlarmNotificationTest(void) > +{ > + SaNtfSecurityAlarmNotificationFilterT myFilter; > + > + subscriptionId = 5; > + > + resetCounters(); > + safassert(saNtfInitialize(&ntfHandle, &ntfCbTest, &ntfVersion) , > SA_AIS_OK); > + safassert(saNtfSelectionObjectGet(ntfHandle, &selectionObject) , > SA_AIS_OK); > + > + safassert(saNtfSecurityAlarmNotificationFilterAllocate( > + ntfHandle, > + &myFilter, > + 0, > + 0, > + 0, > + 0, > + 3, > + 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; > + myFilter.probableCauses[0] = SA_NTF_ADAPTER_ERROR; > + myFilter.probableCauses[1] = SA_NTF_EQUIPMENT_MALFUNCTION; > + myFilter.probableCauses[2] = SA_NTF_VERSION_MISMATCH; > + > + /* subscribe */ > + safassert(saNtfNotificationSubscribe(&myNotificationFilterHandles, > + subscriptionId), SA_AIS_OK); > + extCreateSecurityAlarmNotification(ntfHandle, &mySecAlarmNotification); > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + *mySecAlarmNotification.probableCause = SA_NTF_VERSION_MISMATCH; > > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + ok_ids.ids[ok_ids.length++] = > *mySecAlarmNotification.notificationHeader.notificationId; > + > + *mySecAlarmNotification.probableCause = SA_NTF_RESPONSE_TIME_EXCESSIVE; > > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + *mySecAlarmNotification.probableCause = SA_NTF_NON_REPUDIATION_FAILURE; > > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + > + *mySecAlarmNotification.probableCause = SA_NTF_EQUIPMENT_MALFUNCTION; > > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + ok_ids.ids[ok_ids.length++] = > *mySecAlarmNotification.notificationHeader.notificationId; > + *mySecAlarmNotification.probableCause = > SA_NTF_STORAGE_CAPACITY_PROBLEM; > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + *mySecAlarmNotification.probableCause = SA_NTF_DENIAL_OF_SERVICE; > > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + *mySecAlarmNotification.probableCause = SA_NTF_ADAPTER_ERROR; > + > safassert(saNtfNotificationSend(mySecAlarmNotification.notificationHandle), > SA_AIS_OK); > + ok_ids.ids[ok_ids.length++] = > *mySecAlarmNotification.notificationHeader.notificationId; > + poll_until_received(ntfHandle, > *mySecAlarmNotification.notificationHeader.notificationId); > + if(ntfRecieved.alarmFilterHandle != 0 || > + ntfRecieved.attributeChangeFilterHandle != 0 || > + ntfRecieved.objectCreateDeleteFilterHandle !=0 || > + ntfRecieved.securityAlarmFilterHandle != ok_ids.length > || > + 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); > + rc = check_errors(); > + test_validate(rc, SA_AIS_OK); > +} > + > +__attribute__ ((constructor)) static void > longDnObject_notification_constructor(void) > +{ > + init_ext_object(); > + test_suite_add(36, "Long DNs Test"); > + test_case_add(36, extAdditionalInfoTest > + , "Test additional info with extended > SaNameT type"); > + test_case_add(36, extFilterNotificationTest > + , "Test filter with longDn objects"); > + test_case_add(36, extAlarmNotificationTest > + , "Test Alarm notification with longDn > objects"); > + test_case_add(36, extObjectCreateDeleteNotificationTest > + , "Test Object Create/Delete > notification with longDn objects"); > + test_case_add(36, extAttributeChangeNotificationTest > + , "Test Attribute Change notification > with longDn objects"); > + test_case_add(36, extStateChangeNotificationTest > + , "Test State Change notification with > longDn objects"); > + test_case_add(36, extSecurityAlarmNotificationTest > + , "Test Security Alarm notification > with longDn objects"); > +} > diff --git a/tests/unit_test_fw/inc/util.h b/tests/unit_test_fw/inc/util.h > --- a/tests/unit_test_fw/inc/util.h > +++ b/tests/unit_test_fw/inc/util.h > @@ -19,11 +19,10 @@ > #ifndef util_h > #define util_h > > +#include <saAis.h> > + > extern SaTimeT getSaTimeT(void); > -extern void create_dn(char *rdn, char *parent, SaNameT *dn); > -extern void sa_namet_init(char *value, SaNameT *namet); > extern const char *get_saf_error(SaAisErrorT rc); > - > extern void safassert_impl(const char* file, unsigned int line, SaAisErrorT > actual, SaAisErrorT expected); > > /** > diff --git a/tests/unit_test_fw/src/Makefile.am > b/tests/unit_test_fw/src/Makefile.am > --- a/tests/unit_test_fw/src/Makefile.am > +++ b/tests/unit_test_fw/src/Makefile.am > @@ -22,6 +22,7 @@ noinst_LTLIBRARIES = libutest.la > > libutest_la_CPPFLAGS = \ > $(AM_CPPFLAGS) \ > + -DSA_EXTENDED_NAME_SOURCE \ > -I$(top_srcdir)/tests/unit_test_fw/inc \ > -I$(top_srcdir)/osaf/libs/saf/include > > diff --git a/tests/unit_test_fw/src/util.c b/tests/unit_test_fw/src/util.c > --- a/tests/unit_test_fw/src/util.c > +++ b/tests/unit_test_fw/src/util.c > @@ -21,8 +21,7 @@ > #include <sys/time.h> > #include <unistd.h> > #include <assert.h> > -#include <saAis.h> > - > +#include "util.h" > static const char *saf_error[] = > { > "SA_AIS_NOT_VALID", > @@ -65,17 +64,6 @@ SaTimeT getSaTimeT(void) > (tp.tv_usec * SA_TIME_ONE_MICROSECOND); > } > > -void create_dn(char *rdn, char *parent, SaNameT *dn) > -{ > - dn->length = sprintf((char*)dn->value, "%s,%s", rdn, parent); > - assert(dn->length < SA_MAX_NAME_LENGTH); > -} > - > -void sa_namet_init(char *value, SaNameT *namet) > -{ > - namet->length = sprintf((char*)namet->value, "%s", value); > -} > - > const char *get_saf_error(SaAisErrorT rc) > { > if (rc <= SA_AIS_ERR_UNAVAILABLE) > ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel