1. Not sure, why you have moved the logic to su from comp. Since component being added in su makes difference of PI/NPI SU. Ideally the code should have been in su. 2. Removing logic whether su is being deleted, will result in ERROR_NOT_EXIST in rt update of su. Any specific reason for removing it ?
Thanks -Nagu > -----Original Message----- > From: Hans Feldt [mailto:[email protected]] > Sent: 13 May 2014 11:24 > To: Nagendra Kumar; [email protected] > Cc: [email protected] > Subject: [PATCH 3 of 5] amfd: move supreinst logic from comp to su [#713] > > osaf/services/saf/amf/amfd/comp.cc | 65 > +++----------------------------- > osaf/services/saf/amf/amfd/include/su.h | 1 + > osaf/services/saf/amf/amfd/su.cc | 39 ++++++++++++++++++- > 3 files changed, 43 insertions(+), 62 deletions(-) > > > Comp was directly manipulating SU data, this is now moved to SU. > > diff --git a/osaf/services/saf/amf/amfd/comp.cc > b/osaf/services/saf/amf/amfd/comp.cc > --- a/osaf/services/saf/amf/amfd/comp.cc > +++ b/osaf/services/saf/amf/amfd/comp.cc > @@ -246,11 +246,6 @@ static void comp_add_to_model(AVD_COMP * > } > } > > - /* Verify if the SUs preinstan value need to be changed */ > - if (comp_is_preinstantiable(comp) == true) { > - su->saAmfSUPreInstantiable = static_cast<SaBoolT>(true); > - } > - > /* This is a case of adding a component in SU which is instantiated > state. This could be used in upgrade scenarios. When components > are added, it is sent to Amfnd for instantiation and Amfnd > @@ -280,9 +275,6 @@ static void comp_add_to_model(AVD_COMP * > avd_comp_oper_state_set(comp, > SA_AMF_OPERATIONAL_ENABLED); > > /* Set runtime cached attributes. */ > - avd_saImmOiRtObjectUpdate(&su->name, "saAmfSUPreInstantiable", > - SA_IMM_ATTR_SAUINT32T, &su->saAmfSUPreInstantiable); > - > avd_saImmOiRtObjectUpdate(&comp->comp_info.name, > "saAmfCompReadinessState", > SA_IMM_ATTR_SAUINT32T, &comp- > >saAmfCompReadinessState); > > @@ -1500,17 +1492,9 @@ static void comp_ccb_apply_modify_hdlr(s > > static void comp_ccb_apply_delete_hdlr(struct CcbUtilOperationData *opdata) > { > - AVD_COMP *comp = NULL, *i_comp = NULL; > - bool isPre; > - AVD_AVND *su_node_ptr = NULL; > - AVSV_PARAM_INFO param; > - SaBoolT old_val; > - bool su_delete = false; > - struct CcbUtilOperationData *t_opData; > - > TRACE_ENTER(); > > - comp = avd_comp_get(&opdata->objectName); > + AVD_COMP *comp = avd_comp_get(&opdata->objectName); > /* comp should be found in the database even if it was > * due to parent su delete the changes are applied in > * bottom up order so all the component deletes are applied > @@ -1519,58 +1503,21 @@ static void comp_ccb_apply_delete_hdlr(s > **/ > osafassert(comp != NULL); > > - old_val = comp->su->saAmfSUPreInstantiable; > - > - /* Verify if the SUs preinstan value need to be changed */ > - if (comp_is_preinstantiable(comp) == true) { > - isPre = false; > - i_comp = comp->su->list_of_comp; > - while (i_comp) { > - if ((comp_is_preinstantiable(i_comp) == true) && > (i_comp != comp)) { > - isPre = true; > - break; > - } > - i_comp = i_comp->su_comp_next; > - } /* end while */ > - > - if (isPre == true) { > - comp->su->saAmfSUPreInstantiable = > static_cast<SaBoolT>(true); > - } else { > - comp->su->saAmfSUPreInstantiable = > static_cast<SaBoolT>(false); > - } > - } > - > - /* check whether the SU is also undergoing delete operation */ > - t_opData = ccbutil_getCcbOpDataByDN(opdata->ccbId, &comp->su- > >name); > - if (t_opData && t_opData->operationType == CCBUTIL_DELETE) { > - su_delete = true; > - } > - > - /* if SU is not being deleted and the PreInstantiable state has changed > - * then update the IMM with the new value for saAmfSUPreInstantiable > */ > - if (su_delete == false && old_val != comp->su- > >saAmfSUPreInstantiable) { > - avd_saImmOiRtObjectUpdate(&comp->su->name, > "saAmfSUPreInstantiable", > - SA_IMM_ATTR_SAUINT32T, &comp->su- > >saAmfSUPreInstantiable); > - /* If SU becomes NPI then enable saAmfSUFailover flag Sec > 3.11.1.3.2 AMF-B.04.01 spec */ > - if (!comp->su->saAmfSUPreInstantiable) { > - comp->su->set_su_failover(true); > - } > - } > - > - /* send a message to the AVND deleting the > - * component. > - */ > - su_node_ptr = comp->su->get_node_ptr(); > + // send message to ND requesting delete of the component > + AVD_AVND *su_node_ptr = comp->su->get_node_ptr(); > if ((su_node_ptr->node_state == AVD_AVND_STATE_PRESENT) || > (su_node_ptr->node_state == AVD_AVND_STATE_NO_CONFIG) || > (su_node_ptr->node_state == AVD_AVND_STATE_NCS_INIT)) { > + AVSV_PARAM_INFO param; > memset(((uint8_t *)¶m), '\0', > sizeof(AVSV_PARAM_INFO)); > param.act = AVSV_OBJ_OPR_DEL; > param.name = comp->comp_info.name; > param.class_id = AVSV_SA_AMF_COMP; > avd_snd_op_req_msg(avd_cb, su_node_ptr, ¶m); > } > + > avd_comp_delete(comp); > + > TRACE_LEAVE(); > } > > diff --git a/osaf/services/saf/amf/amfd/include/su.h > b/osaf/services/saf/amf/amfd/include/su.h > --- a/osaf/services/saf/amf/amfd/include/su.h > +++ b/osaf/services/saf/amf/amfd/include/su.h > @@ -121,6 +121,7 @@ class AVD_SU { > > private: > void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id); > + void set_saAmfSUPreInstantiable(bool value); > > // disallow copy and assign, TODO(hafe) add common macro for this > AVD_SU(const AVD_SU&); > 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 > @@ -147,9 +147,30 @@ void AVD_SU::remove_comp(AVD_COMP *comp) > } > } > > - if (su_ref->list_of_comp == NULL) { > - /* Revert to def val */ > - su_ref->saAmfSUPreInstantiable = static_cast<SaBoolT>(false); > + bool old_preinst_value = saAmfSUPreInstantiable; > + bool curr_preinst_value = false; > + > + // check if preinst possibly is still true > + if (comp_is_preinstantiable(comp) == true) { > + i_comp = list_of_comp; > + while (i_comp) { > + if (comp_is_preinstantiable(i_comp) == true) { > + curr_preinst_value = true; > + break; > + } > + i_comp = i_comp->su_comp_next; > + } > + } > + > + // if preinst has changed, update IMM and recalculate saAmfSUFailover > + if (curr_preinst_value != old_preinst_value) { > + set_saAmfSUPreInstantiable(curr_preinst_value); > + > + /* If SU becomes NPI then set saAmfSUFailover flag > + * Sec 3.11.1.3.2 AMF-B.04.01 spec */ > + if (saAmfSUPreInstantiable == false) { > + comp->su->set_su_failover(true); > + } > } > } > > @@ -185,6 +206,11 @@ void AVD_SU::add_comp(AVD_COMP *comp) { > prev_comp->su_comp_next = comp; > comp->su_comp_next = i_comp; > } > + > + /* Verify if the SUs preinstan value need to be changed */ > + if (comp_is_preinstantiable(comp) == true) { > + set_saAmfSUPreInstantiable(true); > + } > } > > /** > @@ -1748,3 +1774,10 @@ bool AVD_SU::is_in_service(void) { > (saAmfSUOperState == SA_AMF_OPERATIONAL_ENABLED); > } > } > + > +void AVD_SU::set_saAmfSUPreInstantiable(bool value) { > + saAmfSUPreInstantiable = static_cast<SaBoolT>(value); > + avd_saImmOiRtObjectUpdate(&name, "saAmfSUPreInstantiable", > + SA_IMM_ATTR_SAUINT32T, > &saAmfSUPreInstantiable); > + TRACE("%s saAmfSUPreInstantiable %u", name.value, value); > +} ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
