Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-16 Thread praveen malviya
Please find comments inline with [Praveen]

Thanks,
Praveen
On 16-Jun-14 10:37 AM, Hans Feldt wrote:
>   osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
>   osaf/services/saf/amf/amfd/include/sg.h  |  48 
> +--
>   osaf/services/saf/amf/amfd/sg.cc |  36 +++-
>   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
>   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
>   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
>   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
>   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
>   8 files changed, 85 insertions(+), 23 deletions(-)
>
>
> A first step in converting the C based SG FSM files into C++. The idea with 
> that
> is to simplify the FSM code.
>
> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
>   \**/
>   static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
>   {
> - AVD_SG sg;
> + SG_2N sg;
>   
[Praveen] AMF will decode SGs of other red models also, then why on 2N?
>   TRACE_ENTER2("i_action '%u'", dec->i_action);
>   
> @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_
>   {
>   uint32_t status = NCSCC_RC_SUCCESS;
>   uint32_t count;
> - AVD_SG dec_sg;
> + SG_2N dec_sg;
>   
[Praveen] same as above.
>   TRACE_ENTER();
>   
> diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> b/osaf/services/saf/amf/amfd/include/sg.h
> --- a/osaf/services/saf/amf/amfd/include/sg.h
> +++ b/osaf/services/saf/amf/amfd/include/sg.h
> @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
>   struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
>   } AVD_SG_OPER;
>   
> -/* Availability directors Service Group structure(AVD_SG):
> - * This data structure lives in the AvD and reflects data points
> - * associated with the Service group (SG).
> +/**
> + * Service group abstract base class
>*/
>   class AVD_SG {
>   public:
>   AVD_SG();
> + virtual ~AVD_SG() {};
>   
>   SaNameT name;   /* the service group DN used as the index.
>* Checkpointing - Sent as a one time update.
> @@ -251,6 +251,47 @@ private:
>   
>   extern AmfDb *sg_db;
>   
> +/**
> + * 2N redundancy model SG specialization
> + */
> +class SG_2N : public AVD_SG {
> +public:
> + ~SG_2N();
> +};
> +
> +/**
> + * No redundancy specialization
> + */
> +class SG_NORED : public AVD_SG {
> +public:
> + ~SG_NORED();
> +};
> +
> +/**
> + * N+M redundancy specialization
> + */
> +class SG_NPM : public AVD_SG {
> +public:
> + ~SG_NPM();
> +};
> +
> +/**
> + * N-Way active specialization
> + */
> +class SG_NACV : public AVD_SG {
> +public:
> + ~SG_NACV();
> +};
> +
> +/**
> + * N-Way specialization
> + */
> +class SG_NWAY : public AVD_SG {
> +public:
> + ~SG_NWAY();
> +};
> +
> +
>   #define m_AVD_SET_SG_ADJUST(cb,sg,state) {\
>   TRACE("adjust_state %u => %u", sg->adjust_state, state); \
>   sg->adjust_state = state;\
> @@ -321,7 +362,6 @@ extern AmfDb *sg_db
>  }\
>   }
>   
> -extern AVD_SG *avd_sg_new(const SaNameT *dn);
>   extern void avd_sg_delete(AVD_SG *sg);
>   extern void avd_sg_db_add(AVD_SG *sg);
>   extern void avd_sg_db_remove(AVD_SG *sg);
> diff --git a/osaf/services/saf/amf/amfd/sg.cc 
> b/osaf/services/saf/amf/amfd/sg.cc
> --- a/osaf/services/saf/amf/amfd/sg.cc
> +++ b/osaf/services/saf/amf/amfd/sg.cc
> @@ -134,11 +134,23 @@ AVD_SG::AVD_SG():
>   su_oper_list.next = NULL;
>   }
>   
> -AVD_SG *avd_sg_new(const SaNameT *dn)
> +static AVD_SG *sg_new(const SaNameT *dn, SaAmfRedundancyModelT 
> redundancy_model)
>   {
>   AVD_SG *sg;
>   
> - sg = new AVD_SG();
> + if (redundancy_model == SA_AMF_2N_REDUNDANCY_MODEL)
> + sg = new SG_2N();
> + else if (redundancy_model == SA_AMF_NPM_REDUNDANCY_MODEL)
> + sg = new SG_NPM();
> + else if (redundancy_model == SA_AMF_N_WAY_REDUNDANCY_MODEL)
> + sg = new SG_NWAY();
> + else if (redundancy_model == SA_AMF_N_WAY_ACTIVE_REDUNDANCY_MODEL)
> + sg = new SG_NACV();
> + else if (redundancy_model == SA_AMF_NO_REDUNDANCY_MODEL)
> + sg = new SG_NORED();
> + else
> + assert(0);
> +
>   memcpy(sg->name.value, dn->value, dn->length);
>   sg->name.length = dn->length;
>   
> @@ -282,22 +294,13 @@ static AVD_SG *sg_create(const SaNameT *
>   
>   TRACE_ENTER2("'%s'", sg_name->value);
>   
> - /*
> - ** If called at new active at failover, the object is found in the DB
> - ** but needs to get configuration attributes initialized.
> - */
> - if (NULL == (sg = sg_db->find(Amf::to_string(sg_name {
> - if ((s

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-16 Thread Hans Feldt
Inline
Thanks,
Hans

> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: den 16 juni 2014 11:49
> To: Hans Feldt
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific 
> SG classes [#713]
> 
> Please find comments inline with [Praveen]
> 
> Thanks,
> Praveen
> On 16-Jun-14 10:37 AM, Hans Feldt wrote:
> >   osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
> >   osaf/services/saf/amf/amfd/include/sg.h  |  48 
> > +--
> >   osaf/services/saf/amf/amfd/sg.cc |  36 +++-
> >   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
> >   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
> >   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
> >   8 files changed, 85 insertions(+), 23 deletions(-)
> >
> >
> > A first step in converting the C based SG FSM files into C++. The idea with 
> > that
> > is to simplify the FSM code.
> >
> > diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> > b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
> >   
> > \**/
> >   static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
> >   {
> > -   AVD_SG sg;
> > +   SG_2N sg;
> >
> [Praveen] AMF will decode SGs of other red models also, then why on 2N?
[Hans] this is just to get an instance to store attributes in. AVD_SG is 
abstract and can't be used. It does not matter if it is SG_2N or SG_NORED here.

> > TRACE_ENTER2("i_action '%u'", dec->i_action);
> >
> > @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_
> >   {
> > uint32_t status = NCSCC_RC_SUCCESS;
> > uint32_t count;
> > -   AVD_SG dec_sg;
> > +   SG_2N dec_sg;
> >
> [Praveen] same as above.
> > TRACE_ENTER();
> >
> > diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> > b/osaf/services/saf/amf/amfd/include/sg.h
> > --- a/osaf/services/saf/amf/amfd/include/sg.h
> > +++ b/osaf/services/saf/amf/amfd/include/sg.h
> > @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
> > struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
> >   } AVD_SG_OPER;
> >
> > -/* Availability directors Service Group structure(AVD_SG):
> > - * This data structure lives in the AvD and reflects data points
> > - * associated with the Service group (SG).
> > +/**
> > + * Service group abstract base class
> >*/
> >   class AVD_SG {
> >   public:
> > AVD_SG();
> > +   virtual ~AVD_SG() {};
> >
> > SaNameT name;   /* the service group DN used as the index.
> >  * Checkpointing - Sent as a one time update.
> > @@ -251,6 +251,47 @@ private:
> >
> >   extern AmfDb *sg_db;
> >
> > +/**
> > + * 2N redundancy model SG specialization
> > + */
> > +class SG_2N : public AVD_SG {
> > +public:
> > +   ~SG_2N();
> > +};
> > +
> > +/**
> > + * No redundancy specialization
> > + */
> > +class SG_NORED : public AVD_SG {
> > +public:
> > +   ~SG_NORED();
> > +};
> > +
> > +/**
> > + * N+M redundancy specialization
> > + */
> > +class SG_NPM : public AVD_SG {
> > +public:
> > +   ~SG_NPM();
> > +};
> > +
> > +/**
> > + * N-Way active specialization
> > + */
> > +class SG_NACV : public AVD_SG {
> > +public:
> > +   ~SG_NACV();
> > +};
> > +
> > +/**
> > + * N-Way specialization
> > + */
> > +class SG_NWAY : public AVD_SG {
> > +public:
> > +   ~SG_NWAY();
> > +};
> > +
> > +
> >   #define m_AVD_SET_SG_ADJUST(cb,sg,state) {\
> > TRACE("adjust_state %u => %u", sg->adjust_state, state); \
> > sg->adjust_state = state;\
> > @@ -321,7 +362,6 @@ extern AmfDb *sg_db
> >  }\
> >   }
> >
> > -extern AVD_SG *avd_sg_new(const SaNameT *dn);
> >   extern void avd_sg_delete(AVD_SG *sg);
> >   extern void avd_sg_db_add(AVD_SG *sg);
> >   extern void avd_sg_db_remove(AVD_SG *sg);
>

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-16 Thread Hans Nordebäck
some comments inline./Regards HansN

-Original Message-
From: Hans Feldt [mailto:hans.fe...@ericsson.com] 
Sent: den 16 juni 2014 12:17
To: praveen malviya; Hans Feldt
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG 
classes [#713]

Inline
Thanks,
Hans

> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: den 16 juni 2014 11:49
> To: Hans Feldt
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model 
> specific SG classes [#713]
> 
> Please find comments inline with [Praveen]
> 
> Thanks,
> Praveen
> On 16-Jun-14 10:37 AM, Hans Feldt wrote:
> >   osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
> >   osaf/services/saf/amf/amfd/include/sg.h  |  48 
> > +--
> >   osaf/services/saf/amf/amfd/sg.cc |  36 +++-
> >   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
> >   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
> >   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
> >   8 files changed, 85 insertions(+), 23 deletions(-)
> >
> >
> > A first step in converting the C based SG FSM files into C++. The 
> > idea with that is to simplify the FSM code.
> >
> > diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> > b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
> >   
> > \**/
> >   static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
> >   {
> > -   AVD_SG sg;
> > +   SG_2N sg;
> >
> [Praveen] AMF will decode SGs of other red models also, then why on 2N?
[Hans] this is just to get an instance to store attributes in. AVD_SG is 
abstract and can't be used. It does not matter if it is SG_2N or SG_NORED here.
[HansN] AVD_SG is not abstract, i.e there are no pure virtual functions. Anyhow 
the SG_2N sg could be changed to AVD_SG *sg and method decode_sg do create the 
concrete type.

> > TRACE_ENTER2("i_action '%u'", dec->i_action);
> >
> > @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_
> >   {
> > uint32_t status = NCSCC_RC_SUCCESS;
> > uint32_t count;
> > -   AVD_SG dec_sg;
> > +   SG_2N dec_sg;
> >
> [Praveen] same as above.
> > TRACE_ENTER();
> >
> > diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> > b/osaf/services/saf/amf/amfd/include/sg.h
> > --- a/osaf/services/saf/amf/amfd/include/sg.h
> > +++ b/osaf/services/saf/amf/amfd/include/sg.h
> > @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
> > struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
> >   } AVD_SG_OPER;
> >
> > -/* Availability directors Service Group structure(AVD_SG):
> > - * This data structure lives in the AvD and reflects data points
> > - * associated with the Service group (SG).
> > +/**
> > + * Service group abstract base class
> >*/
> >   class AVD_SG {
> >   public:
> > AVD_SG();
> > +   virtual ~AVD_SG() {};
> >
> > SaNameT name;   /* the service group DN used as the index.
> >  * Checkpointing - Sent as a one time update.
> > @@ -251,6 +251,47 @@ private:
> >
> >   extern AmfDb *sg_db;
> >
> > +/**
> > + * 2N redundancy model SG specialization  */ class SG_2N : public 
> > +AVD_SG {
> > +public:
> > +   ~SG_2N();
> > +};
> > +
> > +/**
> > + * No redundancy specialization
> > + */
> > +class SG_NORED : public AVD_SG {
> > +public:
> > +   ~SG_NORED();
> > +};
> > +
> > +/**
> > + * N+M redundancy specialization
> > + */
> > +class SG_NPM : public AVD_SG {
> > +public:
> > +   ~SG_NPM();
> > +};
> > +
> > +/**
> > + * N-Way active specialization
> > + */
> > +class SG_NACV : public AVD_SG {
> > +public:
> > +   ~SG_NACV();
> > +};
> > +
> > +/**
> > + * N-Way specialization
> > + */
> > +class SG_NWAY : public AVD_SG {
> > +public:
> > +   ~SG_NWAY();
> > +};
> > +
> > +
> >   #define m_AVD_SET_SG_ADJUST(cb,sg,state) {\
>

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-16 Thread praveen malviya

On 16-Jun-14 5:09 PM, Hans Nordebäck wrote:
> some comments inline./Regards HansN
>
> -Original Message-
> From: Hans Feldt [mailto:hans.fe...@ericsson.com]
> Sent: den 16 juni 2014 12:17
> To: praveen malviya; Hans Feldt
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific 
> SG classes [#713]
>
> Inline
> Thanks,
> Hans
>
>> -Original Message-
>> From: praveen malviya [mailto:praveen.malv...@oracle.com]
>> Sent: den 16 juni 2014 11:49
>> To: Hans Feldt
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model
>> specific SG classes [#713]
>>
>> Please find comments inline with [Praveen]
>>
>> Thanks,
>> Praveen
>> On 16-Jun-14 10:37 AM, Hans Feldt wrote:
>>>osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
>>>osaf/services/saf/amf/amfd/include/sg.h  |  48 
>>> +--
>>>osaf/services/saf/amf/amfd/sg.cc |  36 +++-
>>>osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
>>>osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
>>>osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
>>>osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
>>>osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
>>>8 files changed, 85 insertions(+), 23 deletions(-)
>>>
>>>
>>> A first step in converting the C based SG FSM files into C++. The
>>> idea with that is to simplify the FSM code.
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
>>>
>>> \**/
>>>static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)
>>>{
>>> -   AVD_SG sg;
>>> +   SG_2N sg;
>>>
>> [Praveen] AMF will decode SGs of other red models also, then why on 2N?
> [Hans] this is just to get an instance to store attributes in. AVD_SG is 
> abstract and can't be used. It does not matter if it is SG_2N or SG_NORED 
> here.
> [HansN] AVD_SG is not abstract, i.e there are no pure virtual functions. 
> Anyhow the SG_2N sg could be changed to AVD_SG *sg and method decode_sg do 
> create the concrete type.
[Praveen] PATCH 3 of 4 makes it abstract.
>>> TRACE_ENTER2("i_action '%u'", dec->i_action);
>>>
>>> @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_
>>>{
>>> uint32_t status = NCSCC_RC_SUCCESS;
>>> uint32_t count;
>>> -   AVD_SG dec_sg;
>>> +   SG_2N dec_sg;
>>>
>> [Praveen] same as above.
>>> TRACE_ENTER();
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/include/sg.h
>>> b/osaf/services/saf/amf/amfd/include/sg.h
>>> --- a/osaf/services/saf/amf/amfd/include/sg.h
>>> +++ b/osaf/services/saf/amf/amfd/include/sg.h
>>> @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
>>> struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
>>>} AVD_SG_OPER;
>>>
>>> -/* Availability directors Service Group structure(AVD_SG):
>>> - * This data structure lives in the AvD and reflects data points
>>> - * associated with the Service group (SG).
>>> +/**
>>> + * Service group abstract base class
>>> */
>>>class AVD_SG {
>>>public:
>>> AVD_SG();
>>> +   virtual ~AVD_SG() {};
>>>
>>> SaNameT name;   /* the service group DN used as the index.
>>>  * Checkpointing - Sent as a one time update.
>>> @@ -251,6 +251,47 @@ private:
>>>
>>>extern AmfDb *sg_db;
>>>
>>> +/**
>>> + * 2N redundancy model SG specialization  */ class SG_2N : public
>>> +AVD_SG {
>>> +public:
>>> +   ~SG_2N();
>>> +};
>>> +
>>> +/**
>>> + * No redundancy specialization
>>> + */
>>> +class SG_NORED : public AVD_SG {
>>> +public:
>>> +   ~SG_NORED();
>>> +};
>>> +
>>> +/**
>>> + * N+M redundancy specialization
>>> + */
>>> +class SG_NPM : public AVD_SG {
>>&

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-16 Thread Hans Nordebäck
Hi, a few comments, looking at the amf spec. isn't it more natural to:

class SaAmfSGType 

class SG_2N : public SaAmfSGType 
class SG_NORED : public SaAmfSGType
etc?

What about a factory class, e.g.  SaAmfSGTypeFactory that creates concrete 
SaAmfSGTypes types?
/Regards HansN


-Original Message-
From: Hans Feldt [mailto:osafde...@gmail.com] 
Sent: den 16 juni 2014 07:08
To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 2 of 4] amfd: add specialized red model specific SG classes 
[#713]

 osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
 osaf/services/saf/amf/amfd/include/sg.h  |  48 +--
 osaf/services/saf/amf/amfd/sg.cc |  36 +++-
 osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
 osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
 osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
 osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
 osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
 8 files changed, 85 insertions(+), 23 deletions(-)


A first step in converting the C based SG FSM files into C++. The idea with 
that is to simplify the FSM code.

diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
b/osaf/services/saf/amf/amfd/ckpt_dec.cc
--- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
+++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
@@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD  
\**/
 static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)  {
-   AVD_SG sg;
+   SG_2N sg;
 
TRACE_ENTER2("i_action '%u'", dec->i_action);
 
@@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_  {
uint32_t status = NCSCC_RC_SUCCESS;
uint32_t count;
-   AVD_SG dec_sg;
+   SG_2N dec_sg;
 
TRACE_ENTER();
 
diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
b/osaf/services/saf/amf/amfd/include/sg.h
--- a/osaf/services/saf/amf/amfd/include/sg.h
+++ b/osaf/services/saf/amf/amfd/include/sg.h
@@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
 } AVD_SG_OPER;
 
-/* Availability directors Service Group structure(AVD_SG):
- * This data structure lives in the AvD and reflects data points
- * associated with the Service group (SG).
+/**
+ * Service group abstract base class
  */
 class AVD_SG {
 public:
AVD_SG();
+   virtual ~AVD_SG() {};
 
SaNameT name;   /* the service group DN used as the index.
 * Checkpointing - Sent as a one time update.
@@ -251,6 +251,47 @@ private:
 
 extern AmfDb *sg_db;
 
+/**
+ * 2N redundancy model SG specialization  */ class SG_2N : public 
+AVD_SG {
+public:
+   ~SG_2N();
+};
+
+/**
+ * No redundancy specialization
+ */
+class SG_NORED : public AVD_SG {
+public:
+   ~SG_NORED();
+};
+
+/**
+ * N+M redundancy specialization
+ */
+class SG_NPM : public AVD_SG {
+public:
+   ~SG_NPM();
+};
+
+/**
+ * N-Way active specialization
+ */
+class SG_NACV : public AVD_SG {
+public:
+   ~SG_NACV();
+};
+
+/**
+ * N-Way specialization
+ */
+class SG_NWAY : public AVD_SG {
+public:
+   ~SG_NWAY();
+};
+
+
 #define m_AVD_SET_SG_ADJUST(cb,sg,state) {\
TRACE("adjust_state %u => %u", sg->adjust_state, state); \
sg->adjust_state = state;\
@@ -321,7 +362,6 @@ extern AmfDb *sg_db
}\
 }
 
-extern AVD_SG *avd_sg_new(const SaNameT *dn);  extern void 
avd_sg_delete(AVD_SG *sg);  extern void avd_sg_db_add(AVD_SG *sg);  extern void 
avd_sg_db_remove(AVD_SG *sg); diff --git a/osaf/services/saf/amf/amfd/sg.cc 
b/osaf/services/saf/amf/amfd/sg.cc
--- a/osaf/services/saf/amf/amfd/sg.cc
+++ b/osaf/services/saf/amf/amfd/sg.cc
@@ -134,11 +134,23 @@ AVD_SG::AVD_SG():
su_oper_list.next = NULL;
 }
 
-AVD_SG *avd_sg_new(const SaNameT *dn)
+static AVD_SG *sg_new(const SaNameT *dn, SaAmfRedundancyModelT 
+redundancy_model)
 {
AVD_SG *sg;
 
-   sg = new AVD_SG();
+   if (redundancy_model == SA_AMF_2N_REDUNDANCY_MODEL)
+   sg = new SG_2N();
+   else if (redundancy_model == SA_AMF_NPM_REDUNDANCY_MODEL)
+   sg = new SG_NPM();
+   else if (redundancy_model == SA_AMF_N_WAY_REDUNDANCY_MODEL)
+   sg = new SG_NWAY();
+   else if (redundancy_model == SA_AMF_N_WAY_ACTIVE_REDUNDANCY_MODEL)
+   sg = new SG_NACV();
+   else if (redundancy_model == SA_AMF_NO_REDUNDANCY_MODEL)
+   sg = new SG_NORED();
+   else
+   assert(0);
+
memcpy(sg->name.value, dn->value, dn->length);
sg->name.length = dn->length;
 
@@ -282,22 +294,13 @@ static AVD_SG *sg_create(const SaNameT *
 
TRACE_ENTER2("'%s'", sg_name->value);
 
-   /*
-   ** If called at new active at failover, the object is found in the DB
-   ** but needs to get configuration a

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-16 Thread praveen malviya

On 16-Jun-14 6:58 PM, Hans Nordebäck wrote:
> Hi, a few comments, looking at the amf spec. isn't it more natural to:
>
> class SaAmfSGType
>
> class SG_2N : public SaAmfSGType
> class SG_NORED : public SaAmfSGType
> etc?
>
> What about a factory class, e.g.  SaAmfSGTypeFactory that creates concrete 
> SaAmfSGTypes types?
All  *Types of entities exists from SMF upgrade perspective. So we have 
some parallelism like Apptype supports certain SGTypes, SGTypes supports
certain SUTypes and so on. At the same time we have Application which 
can contains several SGs and an SG can contains several SUs and so on.
In this way factory class can also be an application class (though it is 
not fully implemented) and inheritance will start from it.
So, is it possible to make two factory classes for each *Type and AMF 
entities?

Thanks,
Praveen

> /Regards HansN
>
>
> -Original Message-
> From: Hans Feldt [mailto:osafde...@gmail.com]
> Sent: den 16 juni 2014 07:08
> To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 2 of 4] amfd: add specialized red model specific SG classes 
> [#713]
>
>   osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
>   osaf/services/saf/amf/amfd/include/sg.h  |  48 
> +--
>   osaf/services/saf/amf/amfd/sg.cc |  36 +++-
>   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
>   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
>   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
>   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
>   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
>   8 files changed, 85 insertions(+), 23 deletions(-)
>
>
> A first step in converting the C based SG FSM files into C++. The idea with 
> that is to simplify the FSM code.
>
> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD  
> \**/
>   static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)  {
> - AVD_SG sg;
> + SG_2N sg;
>   
>   TRACE_ENTER2("i_action '%u'", dec->i_action);
>   
> @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_  {
>   uint32_t status = NCSCC_RC_SUCCESS;
>   uint32_t count;
> - AVD_SG dec_sg;
> + SG_2N dec_sg;
>   
>   TRACE_ENTER();
>   
> diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> b/osaf/services/saf/amf/amfd/include/sg.h
> --- a/osaf/services/saf/amf/amfd/include/sg.h
> +++ b/osaf/services/saf/amf/amfd/include/sg.h
> @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
>   struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
>   } AVD_SG_OPER;
>   
> -/* Availability directors Service Group structure(AVD_SG):
> - * This data structure lives in the AvD and reflects data points
> - * associated with the Service group (SG).
> +/**
> + * Service group abstract base class
>*/
>   class AVD_SG {
>   public:
>   AVD_SG();
> + virtual ~AVD_SG() {};
>   
>   SaNameT name;   /* the service group DN used as the index.
>* Checkpointing - Sent as a one time update.
> @@ -251,6 +251,47 @@ private:
>   
>   extern AmfDb *sg_db;
>   
> +/**
> + * 2N redundancy model SG specialization  */ class SG_2N : public
> +AVD_SG {
> +public:
> + ~SG_2N();
> +};
> +
> +/**
> + * No redundancy specialization
> + */
> +class SG_NORED : public AVD_SG {
> +public:
> + ~SG_NORED();
> +};
> +
> +/**
> + * N+M redundancy specialization
> + */
> +class SG_NPM : public AVD_SG {
> +public:
> + ~SG_NPM();
> +};
> +
> +/**
> + * N-Way active specialization
> + */
> +class SG_NACV : public AVD_SG {
> +public:
> + ~SG_NACV();
> +};
> +
> +/**
> + * N-Way specialization
> + */
> +class SG_NWAY : public AVD_SG {
> +public:
> + ~SG_NWAY();
> +};
> +
> +
>   #define m_AVD_SET_SG_ADJUST(cb,sg,state) {\
>   TRACE("adjust_state %u => %u", sg->adjust_state, state); \
>   sg->adjust_state = state;\
> @@ -321,7 +362,6 @@ extern AmfDb *sg_db
>  }\
>   }
>   
> -extern AVD_SG *avd_sg_new(const SaNameT *dn);  extern void 
> avd_sg_delete(AVD_SG *sg);  extern void avd_sg_db_add(AVD_SG *sg);  extern 
> void avd_sg_db_remove(AVD_SG *sg); diff --git 
> a/osaf/services/saf/amf/amfd/sg.cc b/osaf/services/saf/amf/amfd/sg.cc
> --- a/osaf/services/saf/amf/amfd/sg.cc
> +++ b/osaf/services/saf/amf/amfd/sg.cc
> @@ -134,11 +134,23 @@ AVD_SG::AVD_SG():
>   su_oper_list.next = NULL;
>   }
>   
> -AVD_SG *avd_sg_new(const SaNameT *dn)
> +static AVD_SG *sg_new(const SaNameT *dn, SaAmfRedundancyModelT
> +redundancy_model)
>   {
>   AVD_SG *sg;
>   
> - sg = new AVD_SG();
> + if (redundancy_model == SA_AMF_2N_REDUNDANCY_MODEL)
> +

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-17 Thread Hans Feldt
Honestly I don't understand what you are talking about.
"Factory class"; there is already a factory function called avd_sg_new() isn't 
that enough for now?

My main purpose with this patch series is to convert the fsm functions into 
methods so it can be simplified.

In dec_sg_config the reason I use SG_2N is because 1) AVD_SG is abstract 2) 
need an instance to temporarily store decoded attributes.
Could have used any of the derived classes since they have the same data. I 
don't see the issue/problem. Please explain it to me.

Thanks,
Hans


> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: den 17 juni 2014 06:28
> To: Hans Nordebäck
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific 
> SG classes [#713]
> 
> 
> On 16-Jun-14 6:58 PM, Hans Nordebäck wrote:
> > Hi, a few comments, looking at the amf spec. isn't it more natural to:
> >
> > class SaAmfSGType
> >
> > class SG_2N : public SaAmfSGType
> > class SG_NORED : public SaAmfSGType
> > etc?
> >
> > What about a factory class, e.g.  SaAmfSGTypeFactory that creates concrete 
> > SaAmfSGTypes types?
> All  *Types of entities exists from SMF upgrade perspective. So we have
> some parallelism like Apptype supports certain SGTypes, SGTypes supports
> certain SUTypes and so on. At the same time we have Application which
> can contains several SGs and an SG can contains several SUs and so on.
> In this way factory class can also be an application class (though it is
> not fully implemented) and inheritance will start from it.
> So, is it possible to make two factory classes for each *Type and AMF
> entities?
> 
> Thanks,
> Praveen
> 
> > /Regards HansN
> >
> >
> > -Original Message-
> > From: Hans Feldt [mailto:osafde...@gmail.com]
> > Sent: den 16 juni 2014 07:08
> > To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: [PATCH 2 of 4] amfd: add specialized red model specific SG classes 
> > [#713]
> >
> >   osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
> >   osaf/services/saf/amf/amfd/include/sg.h  |  48 
> > +--
> >   osaf/services/saf/amf/amfd/sg.cc |  36 +++-
> >   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
> >   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
> >   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
> >   8 files changed, 85 insertions(+), 23 deletions(-)
> >
> >
> > A first step in converting the C based SG FSM files into C++. The idea with 
> > that is to simplify the FSM code.
> >
> > diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> > b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
> \**/
> >   static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)  {
> > -   AVD_SG sg;
> > +   SG_2N sg;
> >
> > TRACE_ENTER2("i_action '%u'", dec->i_action);
> >
> > @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_  {
> > uint32_t status = NCSCC_RC_SUCCESS;
> > uint32_t count;
> > -   AVD_SG dec_sg;
> > +   SG_2N dec_sg;
> >
> > TRACE_ENTER();
> >
> > diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> > b/osaf/services/saf/amf/amfd/include/sg.h
> > --- a/osaf/services/saf/amf/amfd/include/sg.h
> > +++ b/osaf/services/saf/amf/amfd/include/sg.h
> > @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
> > struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
> >   } AVD_SG_OPER;
> >
> > -/* Availability directors Service Group structure(AVD_SG):
> > - * This data structure lives in the AvD and reflects data points
> > - * associated with the Service group (SG).
> > +/**
> > + * Service group abstract base class
> >*/
> >   class AVD_SG {
> >   public:
> > AVD_SG();
> > +   virtual ~AVD_SG() {};
> >
> > SaNameT name;   /* the service group DN used as the index.
> >  * Checkpointing - Sent as a one time update.
> > @@ -251,6 +251,47 @

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-17 Thread Hans Nordebäck
ack for the patch series, see minor comments below./Regards HansN

-Original Message-
From: Hans Feldt 
Sent: den 17 juni 2014 16:39
To: praveen malviya; Hans Nordebäck
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG 
classes [#713]

Honestly I don't understand what you are talking about.
"Factory class"; there is already a factory function called avd_sg_new() isn't 
that enough for now?
[HansN] ok, but  we should use known patterns where possible/needed (e.g. GOF).

My main purpose with this patch series is to convert the fsm functions into 
methods so it can be simplified.

In dec_sg_config the reason I use SG_2N is because 1) AVD_SG is abstract 2) 
need an instance to temporarily store decoded attributes.
Could have used any of the derived classes since they have the same data. I 
don't see the issue/problem. Please explain it to me.
[HansN] haven't looked at this in detail, but a more general solution is 
declare a pointer to the abstract base class and  let the decode function 
create the concrete type, 
if it can deduce the correct type from the decode data.

Thanks,
Hans


> -Original Message-
> From: praveen malviya [mailto:praveen.malv...@oracle.com]
> Sent: den 17 juni 2014 06:28
> To: Hans Nordebäck
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model 
> specific SG classes [#713]
> 
> 
> On 16-Jun-14 6:58 PM, Hans Nordebäck wrote:
> > Hi, a few comments, looking at the amf spec. isn't it more natural to:
> >
> > class SaAmfSGType
> >
> > class SG_2N : public SaAmfSGType
> > class SG_NORED : public SaAmfSGType
> > etc?
> >
> > What about a factory class, e.g.  SaAmfSGTypeFactory that creates concrete 
> > SaAmfSGTypes types?
> All  *Types of entities exists from SMF upgrade perspective. So we 
> have some parallelism like Apptype supports certain SGTypes, SGTypes 
> supports certain SUTypes and so on. At the same time we have 
> Application which can contains several SGs and an SG can contains several SUs 
> and so on.
> In this way factory class can also be an application class (though it 
> is not fully implemented) and inheritance will start from it.
> So, is it possible to make two factory classes for each *Type and AMF 
> entities?
> 
> Thanks,
> Praveen
> 
> > /Regards HansN
> >
> >
> > -Original Message-
> > From: Hans Feldt [mailto:osafde...@gmail.com]
> > Sent: den 16 juni 2014 07:08
> > To: Hans Nordebäck; praveen.malv...@oracle.com; 
> > nagendr...@oracle.com
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: [PATCH 2 of 4] amfd: add specialized red model specific SG 
> > classes [#713]
> >
> >   osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
> >   osaf/services/saf/amf/amfd/include/sg.h  |  48 
> > +--
> >   osaf/services/saf/amf/amfd/sg.cc |  36 +++-
> >   osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
> >   osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
> >   osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
> >   osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
> >   8 files changed, 85 insertions(+), 23 deletions(-)
> >
> >
> > A first step in converting the C based SG FSM files into C++. The idea with 
> > that is to simplify the FSM code.
> >
> > diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
> > b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
> > @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
> \*
> */
> >   static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)  {
> > -   AVD_SG sg;
> > +   SG_2N sg;
> >
> > TRACE_ENTER2("i_action '%u'", dec->i_action);
> >
> > @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_  {
> > uint32_t status = NCSCC_RC_SUCCESS;
> > uint32_t count;
> > -   AVD_SG dec_sg;
> > +   SG_2N dec_sg;
> >
> > TRACE_ENTER();
> >
> > diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
> > b/osaf/services/saf/amf/amfd/include/sg.h
> > --- a/osaf/services/saf/amf/amfd/include/sg.h
> > +++ b/osaf/services/saf/amf/amfd/include/sg.h
> > @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
> > struct avd_sg_oper_tag *next;   /* The next SU under

Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific SG classes [#713]

2014-06-17 Thread praveen malviya
Ack for the patch series.

Thanks,
Praveen
On 17-Jun-14 8:08 PM, Hans Feldt wrote:
> Honestly I don't understand what you are talking about.
> "Factory class"; there is already a factory function called avd_sg_new() 
> isn't that enough for now?
>
> My main purpose with this patch series is to convert the fsm functions into 
> methods so it can be simplified.
>
> In dec_sg_config the reason I use SG_2N is because 1) AVD_SG is abstract 2) 
> need an instance to temporarily store decoded attributes.
> Could have used any of the derived classes since they have the same data. I 
> don't see the issue/problem. Please explain it to me.
>
> Thanks,
> Hans
>
>
>> -Original Message-
>> From: praveen malviya [mailto:praveen.malv...@oracle.com]
>> Sent: den 17 juni 2014 06:28
>> To: Hans Nordebäck
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [devel] [PATCH 2 of 4] amfd: add specialized red model specific 
>> SG classes [#713]
>>
>>
>> On 16-Jun-14 6:58 PM, Hans Nordebäck wrote:
>>> Hi, a few comments, looking at the amf spec. isn't it more natural to:
>>>
>>> class SaAmfSGType
>>>
>>> class SG_2N : public SaAmfSGType
>>> class SG_NORED : public SaAmfSGType
>>> etc?
>>>
>>> What about a factory class, e.g.  SaAmfSGTypeFactory that creates concrete 
>>> SaAmfSGTypes types?
>> All  *Types of entities exists from SMF upgrade perspective. So we have
>> some parallelism like Apptype supports certain SGTypes, SGTypes supports
>> certain SUTypes and so on. At the same time we have Application which
>> can contains several SGs and an SG can contains several SUs and so on.
>> In this way factory class can also be an application class (though it is
>> not fully implemented) and inheritance will start from it.
>> So, is it possible to make two factory classes for each *Type and AMF
>> entities?
>>
>> Thanks,
>> Praveen
>>
>>> /Regards HansN
>>>
>>>
>>> -Original Message-
>>> From: Hans Feldt [mailto:osafde...@gmail.com]
>>> Sent: den 16 juni 2014 07:08
>>> To: Hans Nordebäck; praveen.malv...@oracle.com; nagendr...@oracle.com
>>> Cc: opensaf-devel@lists.sourceforge.net
>>> Subject: [PATCH 2 of 4] amfd: add specialized red model specific SG classes 
>>> [#713]
>>>
>>>osaf/services/saf/amf/amfd/ckpt_dec.cc   |   4 +-
>>>osaf/services/saf/amf/amfd/include/sg.h  |  48 
>>> +--
>>>osaf/services/saf/amf/amfd/sg.cc |  36 +++-
>>>osaf/services/saf/amf/amfd/sg_2n_fsm.cc  |   4 ++
>>>osaf/services/saf/amf/amfd/sg_nored_fsm.cc   |   4 ++
>>>osaf/services/saf/amf/amfd/sg_npm_fsm.cc |   4 ++
>>>osaf/services/saf/amf/amfd/sg_nway_fsm.cc|   4 ++
>>>osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |   4 ++
>>>8 files changed, 85 insertions(+), 23 deletions(-)
>>>
>>>
>>> A first step in converting the C based SG FSM files into C++. The idea with 
>>> that is to simplify the FSM code.
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc 
>>> b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc
>>> @@ -403,7 +403,7 @@ static void decode_sg(NCS_UBAID *ub, AVD
>> \**/
>>>static uint32_t dec_sg_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec)  {
>>> -   AVD_SG sg;
>>> +   SG_2N sg;
>>>
>>> TRACE_ENTER2("i_action '%u'", dec->i_action);
>>>
>>> @@ -2479,7 +2479,7 @@ static uint32_t dec_cs_sg_config(AVD_CL_  {
>>> uint32_t status = NCSCC_RC_SUCCESS;
>>> uint32_t count;
>>> -   AVD_SG dec_sg;
>>> +   SG_2N dec_sg;
>>>
>>> TRACE_ENTER();
>>>
>>> diff --git a/osaf/services/saf/amf/amfd/include/sg.h 
>>> b/osaf/services/saf/amf/amfd/include/sg.h
>>> --- a/osaf/services/saf/amf/amfd/include/sg.h
>>> +++ b/osaf/services/saf/amf/amfd/include/sg.h
>>> @@ -62,13 +62,13 @@ typedef struct avd_sg_oper_tag {
>>> struct avd_sg_oper_tag *next;   /* The next SU undergoing operation. */
>>>} AVD_SG_OPER;
>>>
>>> -/* Availability directors Service Group structure(AVD_SG):
>>> - * This data structure lives in the AvD and reflects data point