Ack

Thanks
-Nagu

> -----Original Message-----
> From: Hans Feldt [mailto:osafde...@gmail.com]
> Sent: 30 April 2014 10:31
> To: Nagendra Kumar; Praveen Malviya; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 7 of 7] amfd: add and use SU is_in_service [#713]
> 
>  osaf/services/saf/amf/amfd/include/su.h |   9 +--------
>  osaf/services/saf/amf/amfd/node.cc      |   4 +---
>  osaf/services/saf/amf/amfd/sgproc.cc    |  16 ++++------------
>  osaf/services/saf/amf/amfd/su.cc        |  12 +++++++++++-
>  4 files changed, 17 insertions(+), 24 deletions(-)
> 
> 
> 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
> @@ -116,6 +116,7 @@ class AVD_SU {
>       void set_term_state(bool state);
>       void set_su_switch(SaToggleState state);
>       struct avd_avnd_tag *get_node_ptr(void);
> +     bool is_in_service(void);
> 
>   private:
>       void send_attribute_update(AVSV_AMF_SU_ATTR_ID attrib_id);
> @@ -133,14 +134,6 @@ typedef struct {
> 
>  } AVD_SUTCOMP_TYPE;
> 
> -#define m_AVD_APP_SU_IS_INSVC(i_su,su_node_ptr) \
> -((su_node_ptr->saAmfNodeAdminState == SA_AMF_ADMIN_UNLOCKED) &&
> \
> -(su_node_ptr->saAmfNodeOperState == SA_AMF_OPERATIONAL_ENABLED)
> && \
> -(i_su->sg_of_su->saAmfSGAdminState == SA_AMF_ADMIN_UNLOCKED) &&\
> -(i_su->saAmfSUAdminState == SA_AMF_ADMIN_UNLOCKED) &&\
> -(i_su->saAmfSUOperState == SA_AMF_OPERATIONAL_ENABLED)\
> -)
> -
>  /**
>   * Get SUs from IMM and create internal objects
>   *
> diff --git a/osaf/services/saf/amf/amfd/node.cc
> b/osaf/services/saf/amf/amfd/node.cc
> --- a/osaf/services/saf/amf/amfd/node.cc
> +++ b/osaf/services/saf/amf/amfd/node.cc
> @@ -877,9 +877,7 @@ void avd_node_admin_lock_unlock_shutdown
> 
>               su = node->list_of_su;
>               while (su != NULL) {
> -                     su_node_ptr = su->get_node_ptr();
> -
> -                     if (m_AVD_APP_SU_IS_INSVC(su, su_node_ptr) &&
> +                     if ((su->is_in_service() == true) &&
>                               ((su->saAmfSUPreInstantiable) ?
>                               (su->saAmfSUPresenceState ==
> SA_AMF_PRESENCE_INSTANTIATED):true)) {
>                               /* Pres state check is to prevent assignment to
> SU in case node is instantiating
> diff --git a/osaf/services/saf/amf/amfd/sgproc.cc
> b/osaf/services/saf/amf/amfd/sgproc.cc
> --- a/osaf/services/saf/amf/amfd/sgproc.cc
> +++ b/osaf/services/saf/amf/amfd/sgproc.cc
> @@ -406,7 +406,6 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>       AVD_AVND *node;
>       AVD_SU *su, *i_su;
>       SaAmfReadinessStateT old_state;
> -     AVD_AVND *su_node_ptr = NULL;
>       bool node_reboot_req = true;
> 
>       TRACE_ENTER2("id:%u, node:%x, '%s' state:%u", n2d_msg-
> >msg_info.n2d_opr_state.msg_id,
> @@ -444,8 +443,6 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>               goto done;
>       }
> 
> -     su_node_ptr = su->get_node_ptr();
> -
>       if (n2d_msg->msg_info.n2d_opr_state.rec_rcvr.saf_amf ==
> SA_AMF_NODE_SWITCHOVER) {
>               saflog(LOG_NOTICE, amfSvcUsrName, "Node Switch-Over
> requested by '%s'",
>                          node->name.value);
> @@ -684,7 +681,7 @@ void avd_su_oper_state_evh(AVD_CL_CB *cb
>                               goto done;
>                       }
> 
> -                     if (m_AVD_APP_SU_IS_INSVC(su, su_node_ptr)) {
> +                     if (su->is_in_service() == true) {
>                               su-
> >set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
>                               if ((cb->init_state == AVD_APP_STATE) &&
> (old_state == SA_AMF_READINESS_OUT_OF_SERVICE)) {
>                                       /* An application SU has become in
> service call SG FSM */
> @@ -1269,7 +1266,6 @@ void avd_su_si_assign_evh(AVD_CL_CB *cb,
>  void avd_sg_app_node_su_inst_func(AVD_CL_CB *cb, AVD_AVND *avnd)
>  {
>       AVD_SU *i_su;
> -     AVD_AVND *su_node_ptr = NULL;
> 
>       TRACE_ENTER2("'%s'", avnd->name.value);
> 
> @@ -1299,9 +1295,8 @@ void avd_sg_app_node_su_inst_func(AVD_CL
> 
>                               } else {
>                                       i_su-
> >set_oper_state(SA_AMF_OPERATIONAL_ENABLED);
> -                                     su_node_ptr = i_su->get_node_ptr();
> 
> -                                     if (m_AVD_APP_SU_IS_INSVC(i_su,
> su_node_ptr)) {
> +                                     if (i_su->is_in_service() == true) {
>                                               i_su-
> >set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
>                                       }
>                               }
> @@ -1381,9 +1376,8 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_
>                           (su_node_ptr->saAmfNodeOperState ==
> SA_AMF_OPERATIONAL_ENABLED) &&
>                           (i_su->saAmfSUOperState ==
> SA_AMF_OPERATIONAL_ENABLED) &&
>                               (i_su->term_state == false)) {
> -                             su_node_ptr = i_su->get_node_ptr();
> 
> -                             if (m_AVD_APP_SU_IS_INSVC(i_su,
> su_node_ptr)) {
> +                             if (i_su->is_in_service() == true) {
>                                       i_su-
> >set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
>                                       i_su->sg_of_su->su_insvc(cb, i_su);
> 
> @@ -1454,7 +1448,6 @@ uint32_t avd_sg_app_sg_admin_func(AVD_CL
>  {
>       uint32_t rc = NCSCC_RC_FAILURE;
>       AVD_SU *i_su;
> -     AVD_AVND *i_su_node_ptr = NULL;
> 
>       TRACE_ENTER2("'%s'", sg->name.value);
> 
> @@ -1475,9 +1468,8 @@ uint32_t avd_sg_app_sg_admin_func(AVD_CL
>                * state.
>                */
>               for (i_su = sg->list_of_su; i_su != NULL; i_su = i_su-
> >sg_list_su_next) {
> -                     i_su_node_ptr = i_su->get_node_ptr();
>                       // TODO(nagu) remove saAmfSUPreInstantiable check
> and move into m_AVD_APP_SU_IS_INSVC
> -                     if (m_AVD_APP_SU_IS_INSVC(i_su, i_su_node_ptr)
> &&
> +                     if ((i_su->is_in_service() == true) &&
>                                       ((i_su->saAmfSUPreInstantiable) ?
>                                        (i_su->saAmfSUPresenceState ==
> 
> SA_AMF_PRESENCE_INSTANTIATED):true)) {
> 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
> @@ -936,7 +936,7 @@ static void su_admin_op_cb(SaImmOiHandle
>       switch (op_id) {
>       case SA_AMF_ADMIN_UNLOCK:
>               su->set_admin_state(SA_AMF_ADMIN_UNLOCKED);
> -             if (((m_AVD_APP_SU_IS_INSVC(su, node)) || (su->sg_of_su-
> >sg_ncs_spec == true)) &&
> +             if (((su->is_in_service() == true) || (su->sg_of_su->sg_ncs_spec
> == true)) &&
>                       ((su->saAmfSUPreInstantiable) ?
>                        (su->saAmfSUPresenceState ==
> SA_AMF_PRESENCE_INSTANTIATED):true)) {
>                       /* Pres state check is to prevent assignment to SU in
> case SU is instantiating in
> @@ -1716,3 +1716,13 @@ struct avd_avnd_tag *AVD_SU::get_node_pt
>        else
>                return su_on_node;
>  }
> +
> +bool AVD_SU::is_in_service(void) {
> +     struct avd_avnd_tag *node = get_node_ptr();
> +
> +     return (node->saAmfNodeAdminState ==
> SA_AMF_ADMIN_UNLOCKED) &&
> +                     (node->saAmfNodeOperState ==
> SA_AMF_OPERATIONAL_ENABLED) &&
> +                     (sg_of_su->saAmfSGAdminState ==
> SA_AMF_ADMIN_UNLOCKED) &&
> +                     (saAmfSUAdminState ==
> SA_AMF_ADMIN_UNLOCKED) &&
> +                     (saAmfSUOperState ==
> SA_AMF_OPERATIONAL_ENABLED);
> +}

------------------------------------------------------------------------------
"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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to