[devel] [PATCH 1 of 1] amfd: add support of saAmfSUAssignedSIs [#905]
osaf/services/saf/amf/amfd/imm.cc| 63 osaf/services/saf/amf/amfd/include/imm.h | 7 +++ osaf/services/saf/amf/amfd/su.cc | 31 --- 3 files changed, 95 insertions(+), 6 deletions(-) diff --git a/osaf/services/saf/amf/amfd/imm.cc b/osaf/services/saf/amf/amfd/imm.cc --- a/osaf/services/saf/amf/amfd/imm.cc +++ b/osaf/services/saf/amf/amfd/imm.cc @@ -1635,6 +1635,69 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sy } /** + * IM object update, BLOCKING. It updates multivalue attributes. + * @param dn + * @param attributeName + * @param attrValueType + * @param attrValues + * @param assigned_si + */ +SaAisErrorT avd_saImmOiRtObjectUpdate_multival_sync(const std::string& dn, SaImmAttrNameT attributeName, + SaImmValueTypeT attrValueType, SaImmAttrValueT *attrValues, uint32_t assigned_si, + SaImmAttrModificationTypeT modifyType) +{ + SaAisErrorT rc; + SaImmAttrModificationT_2 attrMod; + const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, nullptr}; + + TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName); + + attrMod.modType = modifyType; + attrMod.modAttr.attrName = attributeName; + attrMod.modAttr.attrValuesNumber = assigned_si; + attrMod.modAttr.attrValueType = attrValueType; + attrMod.modAttr.attrValues = attrValues; + + rc = saImmOiRtObjectUpdate_o3(avd_cb->immOiHandle, dn.c_str(), attrMods); + if (rc != SA_AIS_OK) { + LOG_WA("saImmOiRtObjectUpdate of '%s' %s failed with %u", + dn.c_str(), attributeName, rc); + } + return rc; +} + + +/** + * IM object update, BLOCKING. It replaces the attr values to null. + * @param dn + * @param attributeName + * @param attrValueType + * @param value + */ +SaAisErrorT avd_saImmOiRtObjectUpdate_replace_sync(const std::string& dn, SaImmAttrNameT attributeName, + SaImmValueTypeT attrValueType, void *value, + SaImmAttrModificationTypeT modifyType) +{ + SaAisErrorT rc; + SaImmAttrModificationT_2 attrMod; + const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, nullptr}; + + TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName); + + attrMod.modType = SA_IMM_ATTR_VALUES_REPLACE; + attrMod.modAttr.attrName = attributeName; + attrMod.modAttr.attrValuesNumber = 0; + attrMod.modAttr.attrValueType = attrValueType; + + rc = saImmOiRtObjectUpdate_o3(avd_cb->immOiHandle, dn.c_str(), attrMods); + if (rc != SA_AIS_OK) { + LOG_WA("saImmOiRtObjectUpdate of '%s' %s failed with %u", + dn.c_str(), attributeName, rc); + } + return rc; +} + +/** * @brief As of now standby AMFD will maintain immjobs for object of few classes. * This function checks if immjobs for this object can be maintained at standby. * diff --git a/osaf/services/saf/amf/amfd/include/imm.h b/osaf/services/saf/amf/amfd/include/imm.h --- a/osaf/services/saf/amf/amfd/include/imm.h +++ b/osaf/services/saf/amf/amfd/include/imm.h @@ -153,6 +153,13 @@ extern unsigned int avd_imm_config_get(v extern SaAisErrorT avd_saImmOiRtObjectUpdate_sync(const std::string& dn, SaImmAttrNameT attributeName, SaImmValueTypeT attrValueType, void *value, SaImmAttrModificationTypeT modifyType = SA_IMM_ATTR_VALUES_REPLACE); +extern SaAisErrorT avd_saImmOiRtObjectUpdate_multival_sync(const std::string& dn, + SaImmAttrNameT attributeName, SaImmValueTypeT attrValueType, SaImmAttrValueT *value, + uint32_t assigned_si, + SaImmAttrModificationTypeT modifyType = SA_IMM_ATTR_VALUES_REPLACE); +extern SaAisErrorT avd_saImmOiRtObjectUpdate_replace_sync(const std::string& dn, + SaImmAttrNameT attributeName, SaImmValueTypeT attrValueType, void *value, + SaImmAttrModificationTypeT modifyType = SA_IMM_ATTR_VALUES_REPLACE); extern void avd_saImmOiRtObjectUpdate(const std::string& dn, const std::string& attributeName, SaImmValueTypeT attrValueType, void* value); extern void avd_saImmOiRtObjectCreate(const std::string& lassName, diff --git a/osaf/services/saf/amf/amfd/su.cc b/osaf/services/saf/amf/amfd/su.cc --- a/osaf/services/saf/amf/amfd/su.cc +++ b/osaf/services/saf/amf/amfd/su.cc @@ -1390,12 +1390,31 @@ static SaAisErrorT su_rt_attr_cb(SaImmOi while ((attributeName = attributeNames[i++]) != nullptr) { if (!strcmp("saAmfSUAssignedSIs", attributeName)) { -#if 0 - /* TODO */ - SaUint32T saAmfSUAssignedSIs = su->saAmfSUNumCurrActiveSIs + su->saAmfSUNumCurrStandbySIs; - avd_saImmOiRtObjectUpdate_sync(immOiHandle, objectName, - attributeName, SA_IMM_ATTR_SAUINT32T, &saAmfSUAssignedSIs); -#endif + if (su->list_of_susi != nullptr) { +
Re: [devel] [PATCH 1 of 1] amfd: add support of saAmfSUAssignedSIs [#905]
I am going to push it tomorrow, please review. Thanks -Nagu > -Original Message- > From: Nagendra Kumar > Sent: 03 November 2016 15:07 > To: hans.nordeb...@ericsson.com; Praveen Malviya; > minh.c...@dektech.com.au; gary@dektech.com.au > Cc: opensaf-devel@lists.sourceforge.net > Subject: [devel] [PATCH 1 of 1] amfd: add support of saAmfSUAssignedSIs > [#905] > > osaf/services/saf/amf/amfd/imm.cc| 63 > > osaf/services/saf/amf/amfd/include/imm.h | 7 +++ > osaf/services/saf/amf/amfd/su.cc | 31 --- > 3 files changed, 95 insertions(+), 6 deletions(-) > > > diff --git a/osaf/services/saf/amf/amfd/imm.cc > b/osaf/services/saf/amf/amfd/imm.cc > --- a/osaf/services/saf/amf/amfd/imm.cc > +++ b/osaf/services/saf/amf/amfd/imm.cc > @@ -1635,6 +1635,69 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sy } > > /** > + * IM object update, BLOCKING. It updates multivalue attributes. > + * @param dn > + * @param attributeName > + * @param attrValueType > + * @param attrValues > + * @param assigned_si > + */ > +SaAisErrorT avd_saImmOiRtObjectUpdate_multival_sync(const std::string& > dn, SaImmAttrNameT attributeName, > + SaImmValueTypeT attrValueType, SaImmAttrValueT > *attrValues, uint32_t assigned_si, > + SaImmAttrModificationTypeT modifyType) { > + SaAisErrorT rc; > + SaImmAttrModificationT_2 attrMod; > + const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, nullptr}; > + > + TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName); > + > + attrMod.modType = modifyType; > + attrMod.modAttr.attrName = attributeName; > + attrMod.modAttr.attrValuesNumber = assigned_si; > + attrMod.modAttr.attrValueType = attrValueType; > + attrMod.modAttr.attrValues = attrValues; > + > + rc = saImmOiRtObjectUpdate_o3(avd_cb->immOiHandle, dn.c_str(), > attrMods); > + if (rc != SA_AIS_OK) { > + LOG_WA("saImmOiRtObjectUpdate of '%s' %s failed with > %u", > + dn.c_str(), attributeName, rc); > + } > + return rc; > +} > + > + > +/** > + * IM object update, BLOCKING. It replaces the attr values to null. > + * @param dn > + * @param attributeName > + * @param attrValueType > + * @param value > + */ > +SaAisErrorT avd_saImmOiRtObjectUpdate_replace_sync(const std::string& > dn, SaImmAttrNameT attributeName, > + SaImmValueTypeT attrValueType, void *value, > + SaImmAttrModificationTypeT modifyType) { > + SaAisErrorT rc; > + SaImmAttrModificationT_2 attrMod; > + const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, nullptr}; > + > + TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName); > + > + attrMod.modType = SA_IMM_ATTR_VALUES_REPLACE; > + attrMod.modAttr.attrName = attributeName; > + attrMod.modAttr.attrValuesNumber = 0; > + attrMod.modAttr.attrValueType = attrValueType; > + > + rc = saImmOiRtObjectUpdate_o3(avd_cb->immOiHandle, dn.c_str(), > attrMods); > + if (rc != SA_AIS_OK) { > + LOG_WA("saImmOiRtObjectUpdate of '%s' %s failed with > %u", > + dn.c_str(), attributeName, rc); > + } > + return rc; > +} > + > +/** > * @brief As of now standby AMFD will maintain immjobs for object of few > classes. > * This function checks if immjobs for this object can be > maintained at > standby. > * > diff --git a/osaf/services/saf/amf/amfd/include/imm.h > b/osaf/services/saf/amf/amfd/include/imm.h > --- a/osaf/services/saf/amf/amfd/include/imm.h > +++ b/osaf/services/saf/amf/amfd/include/imm.h > @@ -153,6 +153,13 @@ extern unsigned int avd_imm_config_get(v extern > SaAisErrorT avd_saImmOiRtObjectUpdate_sync(const std::string& dn, > SaImmAttrNameT attributeName, SaImmValueTypeT > attrValueType, void *value, > SaImmAttrModificationTypeT modifyType = > SA_IMM_ATTR_VALUES_REPLACE); > +extern SaAisErrorT avd_saImmOiRtObjectUpdate_multival_sync(const > std::string& dn, > + SaImmAttrNameT attributeName, SaImmValueTypeT > attrValueType, SaImmAttrValueT *value, > + uint32_t assigned_si, > + SaImmAttrModificationTypeT modifyType = > SA_IMM_ATTR_VALUES_REPLACE); > +extern SaAisErrorT avd_saImmOiRtObjectUpdate_replace_sync(const > std::string& dn, > + SaImmAttrNameT attributeName, SaImmValueTypeT > attrValueType, void *value, > + SaImmAttrModificationTypeT modifyType = > SA_IMM_ATTR_VALUES_REPLACE
Re: [devel] [PATCH 1 of 1] amfd: add support of saAmfSUAssignedSIs [#905]
ack, code review only. Minor comments below. The AMF Prog. Ref needs updates too. /Thanks HansN On 11/03/2016 10:37 AM, nagendr...@oracle.com wrote: > osaf/services/saf/amf/amfd/imm.cc| 63 > > osaf/services/saf/amf/amfd/include/imm.h | 7 +++ > osaf/services/saf/amf/amfd/su.cc | 31 --- > 3 files changed, 95 insertions(+), 6 deletions(-) > > > diff --git a/osaf/services/saf/amf/amfd/imm.cc > b/osaf/services/saf/amf/amfd/imm.cc > --- a/osaf/services/saf/amf/amfd/imm.cc > +++ b/osaf/services/saf/amf/amfd/imm.cc > @@ -1635,6 +1635,69 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sy > } > > /** > + * IM object update, BLOCKING. It updates multivalue attributes. > + * @param dn > + * @param attributeName > + * @param attrValueType > + * @param attrValues > + * @param assigned_si > + */ > +SaAisErrorT avd_saImmOiRtObjectUpdate_multival_sync(const std::string& dn, > SaImmAttrNameT attributeName, > + SaImmValueTypeT attrValueType, SaImmAttrValueT *attrValues, > uint32_t assigned_si, > + SaImmAttrModificationTypeT modifyType) > +{ > + SaAisErrorT rc; > + SaImmAttrModificationT_2 attrMod; > + const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, nullptr}; > + > + TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName); > + > + attrMod.modType = modifyType; > + attrMod.modAttr.attrName = attributeName; > + attrMod.modAttr.attrValuesNumber = assigned_si; > + attrMod.modAttr.attrValueType = attrValueType; > + attrMod.modAttr.attrValues = attrValues; > + > + rc = saImmOiRtObjectUpdate_o3(avd_cb->immOiHandle, dn.c_str(), > attrMods); > + if (rc != SA_AIS_OK) { > + LOG_WA("saImmOiRtObjectUpdate of '%s' %s failed with %u", > + dn.c_str(), attributeName, rc); > + } > + return rc; > +} > + > + > +/** > + * IM object update, BLOCKING. It replaces the attr values to null. > + * @param dn > + * @param attributeName > + * @param attrValueType > + * @param value > + */ > +SaAisErrorT avd_saImmOiRtObjectUpdate_replace_sync(const std::string& dn, > SaImmAttrNameT attributeName, > + SaImmValueTypeT attrValueType, void *value, > + SaImmAttrModificationTypeT modifyType) > +{ > + SaAisErrorT rc; > + SaImmAttrModificationT_2 attrMod; > + const SaImmAttrModificationT_2 *attrMods[] = {&attrMod, nullptr}; > + > + TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName); > + > + attrMod.modType = SA_IMM_ATTR_VALUES_REPLACE; > + attrMod.modAttr.attrName = attributeName; > + attrMod.modAttr.attrValuesNumber = 0; > + attrMod.modAttr.attrValueType = attrValueType; > + > + rc = saImmOiRtObjectUpdate_o3(avd_cb->immOiHandle, dn.c_str(), > attrMods); > + if (rc != SA_AIS_OK) { > + LOG_WA("saImmOiRtObjectUpdate of '%s' %s failed with %u", > + dn.c_str(), attributeName, rc); > + } > + return rc; > +} > + > +/** >* @brief As of now standby AMFD will maintain immjobs for object of few > classes. >* This function checks if immjobs for this object can be > maintained at standby. >* > diff --git a/osaf/services/saf/amf/amfd/include/imm.h > b/osaf/services/saf/amf/amfd/include/imm.h > --- a/osaf/services/saf/amf/amfd/include/imm.h > +++ b/osaf/services/saf/amf/amfd/include/imm.h > @@ -153,6 +153,13 @@ extern unsigned int avd_imm_config_get(v > extern SaAisErrorT avd_saImmOiRtObjectUpdate_sync(const std::string& dn, > SaImmAttrNameT attributeName, SaImmValueTypeT attrValueType, > void *value, > SaImmAttrModificationTypeT modifyType = > SA_IMM_ATTR_VALUES_REPLACE); > +extern SaAisErrorT avd_saImmOiRtObjectUpdate_multival_sync(const > std::string& dn, > + SaImmAttrNameT attributeName, SaImmValueTypeT attrValueType, > SaImmAttrValueT *value, > + uint32_t assigned_si, > + SaImmAttrModificationTypeT modifyType = > SA_IMM_ATTR_VALUES_REPLACE); > +extern SaAisErrorT avd_saImmOiRtObjectUpdate_replace_sync(const std::string& > dn, > + SaImmAttrNameT attributeName, SaImmValueTypeT attrValueType, > void *value, > + SaImmAttrModificationTypeT modifyType = > SA_IMM_ATTR_VALUES_REPLACE); > extern void avd_saImmOiRtObjectUpdate(const std::string& dn, const > std::string& attributeName, >SaImmValueTypeT attrValueType, void* value); > extern void avd_saImmOiRtObjectCreate(const std::string& lassName, > diff --git a/osaf/services/saf/amf/amfd/su.cc > b/osaf/services/saf/amf/amfd/su.cc > --- a/osaf/services/saf/amf/amfd/su.cc > +++ b/osaf/services/saf/amf/amfd/su.cc > @@ -1390,12 +1390,31 @@ static SaAisErrorT su_rt_attr_cb(SaImmOi > > while ((attributeName = attributeNames[i++]) != nullptr) { > if (!strcmp("saAmfSUAssignedSIs", attributeName)) { > -#if 0 > - /* TODO */ > - SaUint