Re: [devel] [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

2018-01-08 Thread Hans Nordebäck

Hi Hieu,

it sounds good. The question about backwards compatible was to highlight 
possible application problems, it should not


be too hard to avoid this non backward compatibility, either as you 
suggest, changing version, or perhaps, with some overhead,


do the init if needed in each function, (similar to the singleton pattern).

/Regards HansN



On 01/09/2018 04:28 AM, Hieu Nguyen wrote:

Thanks Hans,

New exception is just an improvement to make exception type and message 
clearer. It informs ERR_INIT to user so that user knows that OI needs to be 
initialized before any function is used. Something like that:


from pyosaf.utils import immoi
immoi.get_available_classes_in_imm()

Traceback (most recent call last):
   File "", line 1, in 
   File "/usr/local/lib/python2.7/dist-packages/pyosaf/utils/__init__.py", line 
243, in inner
 return func(*args, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/pyosaf/utils/immoi/__init__.py", line 
312, in get_available_classes_in_imm
 raise SafException(eSaAisErrorT.SA_AIS_ERR_INIT)
pyosaf.utils.SafException: SA_AIS_ERR_INIT


If not use new exception (current version in develop branch), it is raising 
AttributeError exception for the case above.


from pyosaf.utils import immoi
immoi.get_available_classes_in_imm()

Traceback (most recent call last):
   File "", line 1, in 
   File "/usr/local/lib/python2.7/dist-packages/pyosaf/utils/__init__.py", line 
243, in inner
 return func(*args, **kwargs)
   File 
"/usr/local/lib/python2.7/dist-packages/pyosaf/utils/immoi/__init__.py", line 
314, in get_available_classes_in_imm
 return _oi_agent.get_available_classes_in_imm()
AttributeError: 'NoneType' object has no attribute 
'get_available_classes_in_imm'

To avoid this minor non-backwards compatible issue, I will increase the version of pyosaf 
utils (pyosaf/utils/__init__.py) to "1.0.1", how do you think?

Regards,
Hieu

-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
Sent: Monday, January 8, 2018 7:23 PM
To: Hieu Thanh Nguyen ; Anders Widell 
; srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hieu,

Yes, I noticed that e.g. initialize is needed, but also other changes e.g. new 
exceptions are thrown.
These changes implies that applications may have to be updated and thus the 
changes are not backwards compatible.

/Regards HansN

-Original Message-
From: Hieu Nguyen [mailto:hieu.t.ngu...@dektech.com.au]
Sent: den 8 januari 2018 13:06
To: Hans Nordebäck ; Anders Widell 
; srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hans,

I answered your questions below:
Q: " These changes are not backwards compatible ?"
A: These change still support pyosaf utils old version. Your sample missing 
immoi.initialize() before, correctly:
python

from pyosaf.utils import immoi
immoi.initialize()
immoi.get_available_classes_in_imm()

I keep all old interfaces of imm utils with @deprecate functions in __init__.py 
file.

Q: " Why is some behavior changed in e.g. functions marked as deprecated?"
A: We changed some imm utils behavior because that is requested by ticket #2602.
https://sourceforge.net/p/opensaf/tickets/2602/

Same as title of ticket #2602 " improvement of high level python interfaces ". 
We want users should be change from functions to OOP.

Regards,
Hieu
-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com]
Sent: Monday, January 8, 2018 5:56 PM
To: Hieu Nguyen ; anders.wid...@ericsson.com; 
srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hieu,

I have some initial questions regarding this patch:

These changes are not backwards compatible, e.g.:

  python

  >>> from pyosaf.utils import immoi

  >>> immoi.get_available_classes_in_imm()

do not work after this patch.

Why is some behavior changed in e.g. functions marked as deprecated? E.g
adding exceptions.

/Regards HansN


On 12/20/2017 09:25 AM, Hieu Nguyen wrote:

+ improve OI utils use a separate instance OM agent
+ refactor OM utils with Ccb inheritace OmAgent, rename some classes...
---
   python/Makefile.am   |   1 +
   python/pyosaf/utils/immoi/__init__.py| 531 
+++
   python/pyosaf/utils/immoi/agent.py   | 473 +++
   python/pyosaf/utils/immoi/implementer.py | 145 +
   python/pyosaf/utils/immom/__init__.py|   7 +-
   python/pyosaf/utils/immom/accessor.py|  31 +-
   python/pyosaf/utils/immom/agent.py   |  31 +-
   python/pyosaf/utils/immom/ccb.py |  71 +
   python/pyosaf/utils/immom/iterator.py|   4 +-
   python/pyosaf/utils/immom/object.py  |   4 +-
   10 files changed, 739 insertions(+), 559 deletions(-)
   create mode 100644 p

Re: [devel] [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

2018-01-08 Thread Hieu Nguyen
Thanks Hans,

New exception is just an improvement to make exception type and message 
clearer. It informs ERR_INIT to user so that user knows that OI needs to be 
initialized before any function is used. Something like that: 

>>> from pyosaf.utils import immoi
>>> immoi.get_available_classes_in_imm()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/pyosaf/utils/__init__.py", line 
243, in inner
return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pyosaf/utils/immoi/__init__.py", 
line 312, in get_available_classes_in_imm
raise SafException(eSaAisErrorT.SA_AIS_ERR_INIT)
pyosaf.utils.SafException: SA_AIS_ERR_INIT


If not use new exception (current version in develop branch), it is raising 
AttributeError exception for the case above.

>>> from pyosaf.utils import immoi
>>> immoi.get_available_classes_in_imm()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/pyosaf/utils/__init__.py", line 
243, in inner
return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pyosaf/utils/immoi/__init__.py", 
line 314, in get_available_classes_in_imm
return _oi_agent.get_available_classes_in_imm()
AttributeError: 'NoneType' object has no attribute 
'get_available_classes_in_imm'

To avoid this minor non-backwards compatible issue, I will increase the version 
of pyosaf utils (pyosaf/utils/__init__.py) to "1.0.1", how do you think?

Regards,
Hieu

-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: Monday, January 8, 2018 7:23 PM
To: Hieu Thanh Nguyen ; Anders Widell 
; srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hieu,

Yes, I noticed that e.g. initialize is needed, but also other changes e.g. new 
exceptions are thrown. 
These changes implies that applications may have to be updated and thus the 
changes are not backwards compatible.

/Regards HansN

-Original Message-
From: Hieu Nguyen [mailto:hieu.t.ngu...@dektech.com.au] 
Sent: den 8 januari 2018 13:06
To: Hans Nordebäck ; Anders Widell 
; srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hans,

I answered your questions below:
Q: " These changes are not backwards compatible ?"
A: These change still support pyosaf utils old version. Your sample missing 
immoi.initialize() before, correctly:
python
>>> from pyosaf.utils import immoi
>>> immoi.initialize()
>>> immoi.get_available_classes_in_imm()

I keep all old interfaces of imm utils with @deprecate functions in __init__.py 
file.

Q: " Why is some behavior changed in e.g. functions marked as deprecated?"
A: We changed some imm utils behavior because that is requested by ticket #2602.
https://sourceforge.net/p/opensaf/tickets/2602/

Same as title of ticket #2602 " improvement of high level python interfaces ". 
We want users should be change from functions to OOP.

Regards,
Hieu
-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: Monday, January 8, 2018 5:56 PM
To: Hieu Nguyen ; anders.wid...@ericsson.com; 
srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hieu,

I have some initial questions regarding this patch:

These changes are not backwards compatible, e.g.:

 python

 >>> from pyosaf.utils import immoi

 >>> immoi.get_available_classes_in_imm()

do not work after this patch.

Why is some behavior changed in e.g. functions marked as deprecated? E.g 
adding exceptions.

/Regards HansN


On 12/20/2017 09:25 AM, Hieu Nguyen wrote:
> + improve OI utils use a separate instance OM agent
> + refactor OM utils with Ccb inheritace OmAgent, rename some classes...
> ---
>   python/Makefile.am   |   1 +
>   python/pyosaf/utils/immoi/__init__.py| 531 
> +++
>   python/pyosaf/utils/immoi/agent.py   | 473 +++
>   python/pyosaf/utils/immoi/implementer.py | 145 +
>   python/pyosaf/utils/immom/__init__.py|   7 +-
>   python/pyosaf/utils/immom/accessor.py|  31 +-
>   python/pyosaf/utils/immom/agent.py   |  31 +-
>   python/pyosaf/utils/immom/ccb.py |  71 +
>   python/pyosaf/utils/immom/iterator.py|   4 +-
>   python/pyosaf/utils/immom/object.py  |   4 +-
>   10 files changed, 739 insertions(+), 559 deletions(-)
>   create mode 100644 python/pyosaf/utils/immoi/agent.py
>
> diff --git a/python/Makefile.am b/python/Makefile.am
> index 08338bb..1952d5e 100644
> --- a/python/Makefile.am
> +++ b/python/Makefile.am
> @@ -61,6 +61,7 @@ pkgpyosafutilslog_PYTHON = \
>   
>   pkgpyosafutilsimmoi_PYTHON = \
>   python/pyosaf/utils/immoi/__init__.py \
> + python/pyosaf/utils/immoi/agent.py \
>   p

[devel] [PATCH 3/3] smf: Add capability to redo CCBs that fail [#1398]

2018-01-08 Thread Lennart Lund
All types can be used to set attributes at create time
(SaAnyT and SaNameT added)
Help functions for converting SaAnyT and SaNameT to string is added
See SaAnytToString() and SaNametToString() in immccb.h
---
 src/smf/smfd/imm_modify_config/attribute.cc | 107 +++--
 src/smf/smfd/imm_modify_config/attribute.h  |  72 +++--
 src/smf/smfd/imm_modify_config/creator.cc   |   2 +-
 src/smf/smfd/imm_modify_config/immccb.cc|  24 +--
 src/smf/smfd/imm_modify_config/immccb.h |  59 ++-
 src/smf/smfd/imm_modify_demo/ccbdemo1.cc| 195 ++--
 src/smf/smfd/imm_modify_demo/democlass.xml  |  16 ++
 src/smf/smfd/imm_om_api/common/imm_attribute.cc |   9 +-
 8 files changed, 427 insertions(+), 57 deletions(-)

diff --git a/src/smf/smfd/imm_modify_config/attribute.cc 
b/src/smf/smfd/imm_modify_config/attribute.cc
index 93bd6f520..28dc6b76f 100644
--- a/src/smf/smfd/imm_modify_config/attribute.cc
+++ b/src/smf/smfd/imm_modify_config/attribute.cc
@@ -17,11 +17,6 @@
  */
 #include "attribute.h"
 
-#if 1 // TODO(Lennart) Remove
-#include 
-#include 
-#endif
-
 #include 
 
 #include 
@@ -104,7 +99,8 @@ static bool StringToNumericValue(const std::string& 
str_value,
   return rc;
 }
 
-bool AttributeHandler::AddAttributes(const CreateDescriptor& 
create_descriptor) {
+bool AttributeHandler::AddAttributes(const CreateDescriptor&
+ create_descriptor) {
   bool rc = true;
   for (auto& attribute_descriptor : create_descriptor.attributes) {
 rc = AddAttribute(attribute_descriptor);
@@ -134,7 +130,7 @@ bool AttributeHandler::AddAttribute(const 
AttributeDescriptor& attribute) {
 case SA_IMM_ATTR_SAUINT64T:
   rc = StoreNumericAttribute(attribute);
   break;
-  
+
 case SA_IMM_ATTR_SATIMET:
   rc = StoreNumericAttribute(attribute);
   // rc = StoreTimeTAttribute(attribute);
@@ -157,6 +153,15 @@ bool AttributeHandler::AddAttribute(const 
AttributeDescriptor& attribute) {
   set_attributesp_.push_back(std::move(CreatorAttribute));
   break;
 }
+
+case SA_IMM_ATTR_SANAMET:
+  StoreSaNametAttribute(attribute);
+  break;
+
+case SA_IMM_ATTR_SAANYT:
+  StoreSaAnytAttribute(attribute);
+  break;
+
 default:
   break;
   }
@@ -171,6 +176,13 @@ bool AttributeHandler::AddAttribute(const 
AttributeDescriptor& attribute) {
 // Save the SetAttribute object in a vector so that the object will be in scope
 // until "this" object goes out of scope which shall happen when the creator
 // has given the create operation to IMM
+
+// All Store methods:
+// For an attribute;
+//  - Convert all Values As a String to its real type and save
+//those values in a temporary vector.
+//  - Create a new SetAttribute object and give it the converted values
+//  - Store the SetAttribute object
 template
 bool AttributeHandler::
 StoreNumericAttribute(const AttributeDescriptor& attribute) {
@@ -179,6 +191,7 @@ StoreNumericAttribute(const AttributeDescriptor& attribute) 
{
   T numeric_value{0};
   std::vector num_values;
   for (auto& value_str : attribute.values_as_strings) {
+// Create a vector containing all values for this attribute
 if (StringToNumericValue
 (value_str, numeric_value, value_type) == false) {
   LOG_NO("LLDTEST %s: StringToNumericValue() Fail", __FUNCTION__);
@@ -188,15 +201,88 @@ StoreNumericAttribute(const AttributeDescriptor& 
attribute) {
 num_values.push_back(numeric_value);
   }
   if (rc == true) {
+// Store the attribute for the creator and give it to the creator
 std::unique_ptr CreatorAttribute =
 std::unique_ptr(new SetAttribute(creator_));
-  CreatorAttribute->SetAttributeValues(attribute.attribute_name,
-   num_values);
+CreatorAttribute->SetAttributeValues(attribute.attribute_name, num_values);
 set_attributesp_.push_back(std::move(CreatorAttribute));
   }
   return rc;
 }
 
+void AttributeHandler::
+StoreSaNametAttribute(const AttributeDescriptor& attribute) {
+  SaNameT name_value;
+  std::vector name_values;
+  for (auto& value_str : attribute.values_as_strings) {
+StringToSaNameT(value_str, &name_value);
+name_values.push_back(name_value);
+  }
+
+  std::unique_ptr CreatorAttribute =
+  std::unique_ptr(new SetAttribute(creator_));
+  CreatorAttribute->SetAttributeValues(attribute.attribute_name, name_values);
+  set_attributesp_.push_back(std::move(CreatorAttribute));
+}
+
+void AttributeHandler::
+StoreSaAnytAttribute(const AttributeDescriptor& attribute) {
+  // Note: For this type it is also needed to store the buffer pointed to
+  //   from the SaAnyT structure
+  SaAnyT any_value;
+  std::vector any_values;
+  //static inline void StringToSaAnyT(std::string str_anyt, SaAnyT* anyt_value)
+  for (auto& value_str : attribute.values_as_strings) {
+StringToSaAnyT(value_str, &any_value);
+any_values.push_back(any_value);
+  }
+
+  st

[devel] [PATCH 0/3] Review Request for smf: Add capability to redo CCBs that fail [#1398]

2018-01-08 Thread Lennart Lund
Summary: smf: Add capability to redo CCBs that fail [#1398]
Review request for Ticket(s): 1398
Peer Reviewer(s): Vijay Roy 
Pull request to: 
Affected branch(es): develop
Development branch: ticket-1398
Base revision: aed53269f76dfdc98add52515f3af1b9ab2eb71f
Personal repository: git://git.code.sf.net/u/elunlen/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision fdf2a273858350ee01ae03992271b9fb6acbfa23
Author: Lennart Lund 
Date:   Mon, 8 Jan 2018 15:37:08 +0100

smf: Add capability to redo CCBs that fail [#1398]

All types can be used to set attributes at create time
(SaAnyT and SaNameT added)
Help functions for converting SaAnyT and SaNameT to string is added
See SaAnytToString() and SaNametToString() in immccb.h



revision 9d62b0ee295e09661f86174ab5f3d317110b686a
Author: Lennart Lund 
Date:   Mon, 8 Jan 2018 15:37:08 +0100

smf: Add capability to redo CCBs that fail [#1398]

Added all numeric types including SaTimeT
Still not implemented are SaNameT and SaAnyT



revision 9ac4ed24d265db876c41baf29b0a3c37eb6bf1c9
Author: Lennart Lund 
Date:   Mon, 8 Jan 2018 15:37:08 +0100

smf: Add capability to redo CCBs that fail [#1398]

Create a module for handling IMM CCB that implements all steps involved and
all rules regaring possible recovery and failing
Replace current CCB handling in SMF with useage of this module

NOTE: This is an early version that is not well tested and everything is not
  yet implemented. Also some refactoring can be done (redundency). In some
  places LLDTEST tagged traces, logs and printouts exists that will be 
removed
  or modified in a final version
- Only SaUint32T, SaInt32T and SaStringT is implemented.
  Means that IMM type SA_IMM_ATTR_SAUINT32T, SA_IMM_ATTR_SAINT32T and
  SA_IMM_ATTR_SASTRINGT can be set as value type
- A program called ccbdemo1 is included that can be used as an example and
  for some testing. This program is built and will be installed in an OpenSAF
  uml cluster if --enable-tests is set in configure
- An IMM class definition, democlass.xml, for ccbdemo1 is provided. This class
  must be installed before ccbdemo1 can be executed
  Example: # immcfg -f /hostfs/democlass.xml



Added Files:

 src/smf/config/democlass.xml
 src/smf/smfd/imm_modify_config/attribute.cc
 src/smf/smfd/imm_modify_config/attribute.h
 src/smf/smfd/imm_modify_config/creator.cc
 src/smf/smfd/imm_modify_config/creator.h
 src/smf/smfd/imm_modify_config/immccb.cc
 src/smf/smfd/imm_modify_config/immccb.h
 src/smf/smfd/imm_modify_config/README
 src/smf/smfd/imm_modify_demo/ccbdemo1.cc
 src/smf/smfd/imm_modify_demo/democlass.xml
 src/smf/smfd/imm_modify_demo/Makefile
 src/smf/smfd/imm_om_api/common/common.cc
 src/smf/smfd/imm_om_api/common/common.h
 src/smf/smfd/imm_om_api/common/imm_attribute.cc
 src/smf/smfd/imm_om_api/common/imm_attribute.h
 src/smf/smfd/imm_om_api/om_admin_owner_clear.cc
 src/smf/smfd/imm_om_api/om_admin_owner_clear.h
 src/smf/smfd/imm_om_api/om_admin_owner_handle.cc
 src/smf/smfd/imm_om_api/om_admin_owner_handle.h
 src/smf/smfd/imm_om_api/om_admin_owner_set.cc
 src/smf/smfd/imm_om_api/om_admin_owner_set.h
 src/smf/smfd/imm_om_api/om_ccb_handle.cc
 src/smf/smfd/imm_om_api/om_ccb_handle.h
 src/smf/smfd/imm_om_api/om_ccb_object_create.cc
 src/smf/smfd/imm_om_api/om_ccb_object_create.h
 src/smf/smfd/imm_om_api/om_ccb_object_delete.cc
 src/smf/smfd/imm_om_api/om_ccb_object_delete.h
 src/smf/smfd/imm_om_api/om_ccb_object_modify.cc
 src/smf/smfd/imm_om_api/om_ccb_object_modify.h
 src/smf/smfd/imm_om_api/om_handle.cc
 src/smf/smfd/imm_om_api/om_handle.h


Complete diffstat:
--
 src/smf/Makefile.am  |  85 +++-
 src/smf/config/democlass.xml |  76 +++
 src/smf/smfd/SmfImmOperation.cc  |   2 +-
 src/smf/smfd/imm_modify_config/README| 126 +
 src/smf/smfd/imm_modify_config/attribute.cc  | 405 
 src/smf/smfd/imm_modify_config/attribute.h   | 236 ++
 src/smf/smfd/imm_modify_config/creator.cc| 109 +
 src/smf/smfd/imm_modify_config/creator.h |  44 ++
 src/smf/smfd/imm_modify_config/immccb.cc | 566 +++
 src/smf/smfd/imm_modify_config/immccb.h  | 430 +
 src/smf/smfd/imm_modify_demo/Makefile|  19 +
 src/smf/smfd/imm_modify_demo/ccbdemo1.cc | 433 +
 src/smf/smfd/imm_modify_demo/democlass.xml  

[devel] [PATCH 2/3] smf: Add capability to redo CCBs that fail [#1398]

2018-01-08 Thread Lennart Lund
Added all numeric types including SaTimeT
Still not implemented are SaNameT and SaAnyT
---
 src/smf/smfd/imm_modify_config/attribute.cc| 183 +++--
 src/smf/smfd/imm_modify_config/attribute.h | 118 +++-
 src/smf/smfd/imm_modify_demo/ccbdemo1.cc   |  71 --
 src/smf/smfd/imm_modify_demo/democlass.xml |   8 ++
 src/smf/smfd/imm_om_api/common/common.h|  41 ++
 src/smf/smfd/imm_om_api/common/imm_attribute.h |  29 
 6 files changed, 361 insertions(+), 89 deletions(-)

diff --git a/src/smf/smfd/imm_modify_config/attribute.cc 
b/src/smf/smfd/imm_modify_config/attribute.cc
index 8485cf2dc..93bd6f520 100644
--- a/src/smf/smfd/imm_modify_config/attribute.cc
+++ b/src/smf/smfd/imm_modify_config/attribute.cc
@@ -112,50 +112,43 @@ bool AttributeHandler::AddAttributes(const 
CreateDescriptor& create_descriptor)
   return rc;
 }
 
+// Add one attribute to a creator. Store the attribute and
+// its values until this object goes out of scope
+// Return false if fail
 bool AttributeHandler::AddAttribute(const AttributeDescriptor& attribute) {
   bool rc = true;
   SaImmValueTypeT value_type = attribute.value_type;
   switch (value_type) {
-case SA_IMM_ATTR_SAINT32T: {
-  SaInt32T numeric_value = 0;
-  std::vector num_values;
-  for (auto& value_str : attribute.values_as_strings) {
-if (StringToNumericValue
-(value_str, numeric_value, value_type) == false) {
-  LOG_NO("LLDTEST %s: '%s' could not be converted to a SaInt32T",
- __FUNCTION__, value_str.c_str());
-  rc = false;
-  break;
-}
-num_values.push_back(numeric_value);
-  }
-  std::unique_ptr CreatorAttribute =
-  std::unique_ptr(new SetAttribute(creator_));
-  CreatorAttribute->SetAttributeValues(attribute.attribute_name,
-  num_values);
-  set_attributesp_.push_back(std::move(CreatorAttribute));
+case SA_IMM_ATTR_SAINT32T:
+  rc = StoreNumericAttribute(attribute);
   break;
-}
-case SA_IMM_ATTR_SAUINT32T: {
-  SaUint32T num_value = 0;
-  std::vector numeric_values;
-  for (auto& value_str : attribute.values_as_strings) {
-if (StringToNumericValue
-(value_str, num_value, value_type) == false) {
-  LOG_NO("LLDTEST %s: '%s' could not be converted to a SaInt32T",
- __FUNCTION__, value_str.c_str());
-  rc = false;
-  break;
-}
-numeric_values.push_back(num_value);
-  }
-  std::unique_ptr CreatorAttribute =
-  std::unique_ptr(new SetAttribute(creator_));
-  CreatorAttribute->SetAttributeValues(attribute.attribute_name,
-  numeric_values);
-  set_attributesp_.push_back(std::move(CreatorAttribute));
+
+case SA_IMM_ATTR_SAUINT32T:
+  rc = StoreNumericAttribute(attribute);
   break;
-}
+
+case SA_IMM_ATTR_SAINT64T:
+  rc = StoreNumericAttribute(attribute);
+  break;
+
+case SA_IMM_ATTR_SAUINT64T:
+  rc = StoreNumericAttribute(attribute);
+  break;
+  
+case SA_IMM_ATTR_SATIMET:
+  rc = StoreNumericAttribute(attribute);
+  // rc = StoreTimeTAttribute(attribute);
+  break;
+
+case SA_IMM_ATTR_SAFLOATT:
+  rc = StoreNumericAttribute(attribute);
+  break;
+
+case SA_IMM_ATTR_SADOUBLET:
+  rc = StoreNumericAttribute(attribute);
+  break;
+
+
 case SA_IMM_ATTR_SASTRINGT: {
   std::unique_ptr CreatorAttribute =
   std::unique_ptr(new SetAttribute(creator_));
@@ -171,8 +164,40 @@ bool AttributeHandler::AddAttribute(const 
AttributeDescriptor& attribute) {
   return rc;
 }
 
+// Convert all values as a string for an attribute to numeric values.
+// Create a SetAttribute object and give that object the attribute name and its
+// numeric values. The SetAttribute object will store the attribute and give
+// the attribute name and values to the creator
+// Save the SetAttribute object in a vector so that the object will be in scope
+// until "this" object goes out of scope which shall happen when the creator
+// has given the create operation to IMM
+template
+bool AttributeHandler::
+StoreNumericAttribute(const AttributeDescriptor& attribute) {
+  bool rc = true;
+  SaImmValueTypeT value_type = attribute.value_type;
+  T numeric_value{0};
+  std::vector num_values;
+  for (auto& value_str : attribute.values_as_strings) {
+if (StringToNumericValue
+(value_str, numeric_value, value_type) == false) {
+  LOG_NO("LLDTEST %s: StringToNumericValue() Fail", __FUNCTION__);
+  rc = false;
+  break;
+}
+num_values.push_back(numeric_value);
+  }
+  if (rc == true) {
+std::unique_ptr CreatorAttribute =
+std::unique_ptr(new SetAttribute(creator_));
+  CreatorAttribute->SetAttributeValues(attribute.attribute_name,
+   num_values)

[devel] [PATCH 0/1] Review Request for amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]

2018-01-08 Thread Hans Nordeback
Summary: amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]
Review request for Ticket(s): 2755
Peer Reviewer(s): AMF maintainers
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2755
Base revision: 467a899fad561b498a11b4fca4ede5d136eb15b3
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision e0a73d77beea5dcf9a558074cfc03d1ea3d4dbd7
Author: Hans Nordeback 
Date:   Mon, 8 Jan 2018 14:37:18 +0100

amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]



Complete diffstat:
--
 src/amf/amfnd/compdb.cc | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]

2018-01-08 Thread Hans Nordeback
---
 src/amf/amfnd/compdb.cc | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/amf/amfnd/compdb.cc b/src/amf/amfnd/compdb.cc
index 1ecd1a1c9..962bbec7d 100644
--- a/src/amf/amfnd/compdb.cc
+++ b/src/amf/amfnd/compdb.cc
@@ -842,15 +842,16 @@ static amf_comp_type_t *avnd_comptype_create(SaImmHandleT 
immOmHandle,
   const char *str;
   const SaImmAttrValuesT_2 **attributes;
   SaNameT saAmfCtSwBundle;
+  SaAisErrorT rc {SA_AIS_OK};
 
   TRACE_ENTER2("'%s'", dn.c_str());
 
   (void)amf_saImmOmAccessorInitialize(immOmHandle, accessorHandle);
 
-  if (amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, dn, nullptr,
-(SaImmAttrValuesT_2 ***)&attributes) !=
+  if ((rc = amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, dn, nullptr,
+(SaImmAttrValuesT_2 ***)&attributes)) !=
   SA_AIS_OK) {
-LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s'", dn.c_str());
+LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s', rc: %u", dn.c_str(), 
rc);
 goto done;
   }
 
@@ -1716,10 +1717,10 @@ int avnd_comp_config_reinit(AVND_COMP *comp) {
 LOG_CR("amf_saImmOmAccessorInitialize FAILED for '%s'", 
comp->name.c_str());
 goto done2;
   }
-  if (amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, comp->name,
-nullptr, (SaImmAttrValuesT_2 ***)&attributes) 
!=
+  if ((error = amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, 
comp->name,
+nullptr, (SaImmAttrValuesT_2 ***)&attributes)) 
!=
   SA_AIS_OK) {
-LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s'", comp->name.c_str());
+LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s' rc: %u", 
comp->name.c_str(), error);
 goto done3;
   }
 
-- 
2.15.1


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

2018-01-08 Thread Hans Nordebäck
Hi Hieu,

Yes, I noticed that e.g. initialize is needed, but also other changes e.g. new 
exceptions are thrown. 
These changes implies that applications may have to be updated and thus the 
changes are not backwards compatible.

/Regards HansN

-Original Message-
From: Hieu Nguyen [mailto:hieu.t.ngu...@dektech.com.au] 
Sent: den 8 januari 2018 13:06
To: Hans Nordebäck ; Anders Widell 
; srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hans,

I answered your questions below:
Q: " These changes are not backwards compatible ?"
A: These change still support pyosaf utils old version. Your sample missing 
immoi.initialize() before, correctly:
python
>>> from pyosaf.utils import immoi
>>> immoi.initialize()
>>> immoi.get_available_classes_in_imm()

I keep all old interfaces of imm utils with @deprecate functions in __init__.py 
file.

Q: " Why is some behavior changed in e.g. functions marked as deprecated?"
A: We changed some imm utils behavior because that is requested by ticket #2602.
https://sourceforge.net/p/opensaf/tickets/2602/

Same as title of ticket #2602 " improvement of high level python interfaces ". 
We want users should be change from functions to OOP.

Regards,
Hieu
-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: Monday, January 8, 2018 5:56 PM
To: Hieu Nguyen ; anders.wid...@ericsson.com; 
srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hieu,

I have some initial questions regarding this patch:

These changes are not backwards compatible, e.g.:

 python

 >>> from pyosaf.utils import immoi

 >>> immoi.get_available_classes_in_imm()

do not work after this patch.

Why is some behavior changed in e.g. functions marked as deprecated? E.g 
adding exceptions.

/Regards HansN


On 12/20/2017 09:25 AM, Hieu Nguyen wrote:
> + improve OI utils use a separate instance OM agent
> + refactor OM utils with Ccb inheritace OmAgent, rename some classes...
> ---
>   python/Makefile.am   |   1 +
>   python/pyosaf/utils/immoi/__init__.py| 531 
> +++
>   python/pyosaf/utils/immoi/agent.py   | 473 +++
>   python/pyosaf/utils/immoi/implementer.py | 145 +
>   python/pyosaf/utils/immom/__init__.py|   7 +-
>   python/pyosaf/utils/immom/accessor.py|  31 +-
>   python/pyosaf/utils/immom/agent.py   |  31 +-
>   python/pyosaf/utils/immom/ccb.py |  71 +
>   python/pyosaf/utils/immom/iterator.py|   4 +-
>   python/pyosaf/utils/immom/object.py  |   4 +-
>   10 files changed, 739 insertions(+), 559 deletions(-)
>   create mode 100644 python/pyosaf/utils/immoi/agent.py
>
> diff --git a/python/Makefile.am b/python/Makefile.am
> index 08338bb..1952d5e 100644
> --- a/python/Makefile.am
> +++ b/python/Makefile.am
> @@ -61,6 +61,7 @@ pkgpyosafutilslog_PYTHON = \
>   
>   pkgpyosafutilsimmoi_PYTHON = \
>   python/pyosaf/utils/immoi/__init__.py \
> + python/pyosaf/utils/immoi/agent.py \
>   python/pyosaf/utils/immoi/implementer.py
>   
>   pkgpyosafutilsntf_PYTHON = \
> diff --git a/python/pyosaf/utils/immoi/__init__.py 
> b/python/pyosaf/utils/immoi/__init__.py
> index 1b4dece..7247b0e 100644
> --- a/python/pyosaf/utils/immoi/__init__.py
> +++ b/python/pyosaf/utils/immoi/__init__.py
> @@ -22,298 +22,23 @@ Supported functions:
>   - Set/clear/release implementer for class/object
>   - Create/delete/update runtime object
>   - Get class/object attributes
> -- Get IMM error strings
> +- Get/set IMM error strings
> +- Get parent for dn
> +- Get class for dn
> +- Get objects for class
> +- Get available classes of IMM
>   """
>   from __future__ import print_function
> -from copy import deepcopy
> -from ctypes import c_char_p, c_void_p, cast, pointer
> -
> -from pyosaf.saAis import SaStringT, SaVersionT, SaNameT, SaSelectionObjectT, 
> \
> -unmarshalSaStringTArray, eSaDispatchFlagsT, eSaAisErrorT
> -from pyosaf import saImm, saImmOi
> -from pyosaf.saImm import unmarshalSaImmValue, SaImmAttrNameT,  \
> -SaImmAttrValuesT_2, SaImmClassNameT, SaImmSearchParametersT_2, \
> -eSaImmValueTypeT, SaImmAttrDefinitionT_2, SaImmClassCategoryT, \
> -SaImmAttrModificationT_2, eSaImmAttrModificationTypeT
> -from pyosaf.saImmOi import SaImmOiHandleT, SaImmOiImplementerNameT
> -from pyosaf.utils import immom, log_err, bad_handle_retry, decorate, \
> -deprecate, initialize_decorate, SafException
> +
> +from pyosaf.saAis import SaSelectionObjectT, eSaAisErrorT
> +from pyosaf.utils import deprecate, SafException
>   from pyosaf.utils.immom.object import ImmObject
> -from pyosaf.utils.immom.ccb import marshal_c_array
> -from pyosaf.utils.immom.iterator import SearchIterator
> +from pyosaf.utils.immoi.agent import OiAgent
>   
>   
> -OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,

Re: [devel] [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

2018-01-08 Thread Hieu Nguyen
Hi Hans,

I answered your questions below:
Q: " These changes are not backwards compatible ?"
A: These change still support pyosaf utils old version. Your sample missing 
immoi.initialize() before, correctly:
python
>>> from pyosaf.utils import immoi
>>> immoi.initialize()
>>> immoi.get_available_classes_in_imm()

I keep all old interfaces of imm utils with @deprecate functions in __init__.py 
file.

Q: " Why is some behavior changed in e.g. functions marked as deprecated?"
A: We changed some imm utils behavior because that is requested by ticket #2602.
https://sourceforge.net/p/opensaf/tickets/2602/

Same as title of ticket #2602 " improvement of high level python interfaces ". 
We want users should be change from functions to OOP.

Regards,
Hieu
-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: Monday, January 8, 2018 5:56 PM
To: Hieu Nguyen ; anders.wid...@ericsson.com; 
srinivas.mangip...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

Hi Hieu,

I have some initial questions regarding this patch:

These changes are not backwards compatible, e.g.:

 python

 >>> from pyosaf.utils import immoi

 >>> immoi.get_available_classes_in_imm()

do not work after this patch.

Why is some behavior changed in e.g. functions marked as deprecated? E.g 
adding exceptions.

/Regards HansN


On 12/20/2017 09:25 AM, Hieu Nguyen wrote:
> + improve OI utils use a separate instance OM agent
> + refactor OM utils with Ccb inheritace OmAgent, rename some classes...
> ---
>   python/Makefile.am   |   1 +
>   python/pyosaf/utils/immoi/__init__.py| 531 
> +++
>   python/pyosaf/utils/immoi/agent.py   | 473 +++
>   python/pyosaf/utils/immoi/implementer.py | 145 +
>   python/pyosaf/utils/immom/__init__.py|   7 +-
>   python/pyosaf/utils/immom/accessor.py|  31 +-
>   python/pyosaf/utils/immom/agent.py   |  31 +-
>   python/pyosaf/utils/immom/ccb.py |  71 +
>   python/pyosaf/utils/immom/iterator.py|   4 +-
>   python/pyosaf/utils/immom/object.py  |   4 +-
>   10 files changed, 739 insertions(+), 559 deletions(-)
>   create mode 100644 python/pyosaf/utils/immoi/agent.py
>
> diff --git a/python/Makefile.am b/python/Makefile.am
> index 08338bb..1952d5e 100644
> --- a/python/Makefile.am
> +++ b/python/Makefile.am
> @@ -61,6 +61,7 @@ pkgpyosafutilslog_PYTHON = \
>   
>   pkgpyosafutilsimmoi_PYTHON = \
>   python/pyosaf/utils/immoi/__init__.py \
> + python/pyosaf/utils/immoi/agent.py \
>   python/pyosaf/utils/immoi/implementer.py
>   
>   pkgpyosafutilsntf_PYTHON = \
> diff --git a/python/pyosaf/utils/immoi/__init__.py 
> b/python/pyosaf/utils/immoi/__init__.py
> index 1b4dece..7247b0e 100644
> --- a/python/pyosaf/utils/immoi/__init__.py
> +++ b/python/pyosaf/utils/immoi/__init__.py
> @@ -22,298 +22,23 @@ Supported functions:
>   - Set/clear/release implementer for class/object
>   - Create/delete/update runtime object
>   - Get class/object attributes
> -- Get IMM error strings
> +- Get/set IMM error strings
> +- Get parent for dn
> +- Get class for dn
> +- Get objects for class
> +- Get available classes of IMM
>   """
>   from __future__ import print_function
> -from copy import deepcopy
> -from ctypes import c_char_p, c_void_p, cast, pointer
> -
> -from pyosaf.saAis import SaStringT, SaVersionT, SaNameT, SaSelectionObjectT, 
> \
> -unmarshalSaStringTArray, eSaDispatchFlagsT, eSaAisErrorT
> -from pyosaf import saImm, saImmOi
> -from pyosaf.saImm import unmarshalSaImmValue, SaImmAttrNameT,  \
> -SaImmAttrValuesT_2, SaImmClassNameT, SaImmSearchParametersT_2, \
> -eSaImmValueTypeT, SaImmAttrDefinitionT_2, SaImmClassCategoryT, \
> -SaImmAttrModificationT_2, eSaImmAttrModificationTypeT
> -from pyosaf.saImmOi import SaImmOiHandleT, SaImmOiImplementerNameT
> -from pyosaf.utils import immom, log_err, bad_handle_retry, decorate, \
> -deprecate, initialize_decorate, SafException
> +
> +from pyosaf.saAis import SaSelectionObjectT, eSaAisErrorT
> +from pyosaf.utils import deprecate, SafException
>   from pyosaf.utils.immom.object import ImmObject
> -from pyosaf.utils.immom.ccb import marshal_c_array
> -from pyosaf.utils.immom.iterator import SearchIterator
> +from pyosaf.utils.immoi.agent import OiAgent
>   
>   
> -OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,safApp=safImmService"
>   _oi_agent = None
>   
>   
> -# Decorate pure saImmOi* API's with error-handling retry and exception 
> raising
> -saImmOiInitialize_2 = initialize_decorate(saImmOi.saImmOiInitialize_2)
> -saImmOiSelectionObjectGet = decorate(saImmOi.saImmOiSelectionObjectGet)
> -saImmOiDispatch = decorate(saImmOi.saImmOiDispatch)
> -saImmOiFinalize = decorate(saImmOi.saImmOiFinalize)
> -saImmOiImplementerSet = decorate(saImmOi.saImmOiImplementerSet)
> -saImmOiImplementerClear = decorate(saImmOi.saImmOiImplementerCl

Re: [devel] [PATCH 2/2] clm: add tryagain handle to clmtest [#2634]

2018-01-08 Thread Hans Nordebäck

ack, code review only. Some comments inlined below.

/Regards HansN


On 12/21/2017 01:18 PM, Vu Minh Nguyen wrote:

Add tryagain to CLM APIs using C++ decorator.
---
  src/clm/Makefile.am|  29 +-
  src/clm/apitest/clm_api_with_try_again.h   | 145 ++
  src/clm/apitest/clmtest.cc |   2 +-
  src/clm/apitest/clmtest.h  |   9 +-
  src/clm/apitest/tet_ClmLongRdn.cc  |  74 ++---
  src/clm/apitest/tet_saClmClusterNodeGet.cc | 120 
  src/clm/apitest/tet_saClmClusterNodeGetAsync.cc| 108 +++
  .../apitest/tet_saClmClusterNotificationFree.cc|  20 +-
  src/clm/apitest/tet_saClmClusterTrack.cc   | 318 ++---
  src/clm/apitest/tet_saClmClusterTrackStop.cc   |  36 ++-
  src/clm/apitest/tet_saClmDispatch.cc   |  32 +--
  src/clm/apitest/tet_saClmFinalize.cc   |  16 +-
  src/clm/apitest/tet_saClmInitialize.cc |  68 ++---
  src/clm/apitest/tet_saClmResponse.cc   |  60 ++--
  src/clm/apitest/tet_saClmSelectionObjectGet.cc |  25 +-
  src/osaf/apitest/util.h|   8 +
  16 files changed, 613 insertions(+), 457 deletions(-)
  create mode 100644 src/clm/apitest/clm_api_with_try_again.h

diff --git a/src/clm/Makefile.am b/src/clm/Makefile.am
index 7be57bb..b603bbd 100644
--- a/src/clm/Makefile.am
+++ b/src/clm/Makefile.am
@@ -186,26 +186,27 @@ if ENABLE_TESTS
  bin_PROGRAMS += bin/clmtest
  
  noinst_HEADERS += \

-   src/clm/apitest/clmtest.h
+   src/clm/apitest/clmtest.h \
+   src/clm/apitest/clm_api_with_try_again.h
  
  bin_clmtest_CPPFLAGS = \

-DSA_CLM_B01=1 \
$(AM_CPPFLAGS)
  
  bin_clmtest_SOURCES = \

-   src/clm/apitest/clmtest.c \
-   src/clm/apitest/tet_saClmInitialize.c \
-   src/clm/apitest/tet_saClmClusterNodeGetAsync.c \
-   src/clm/apitest/tet_saClmClusterTrack.c \
-   src/clm/apitest/tet_saClmClusterTrackStop.c \
-   src/clm/apitest/tet_saClmClusterNotificationFree.c \
-   src/clm/apitest/tet_saClmClusterNodeGet.c \
-   src/clm/apitest/tet_saClmResponse.c \
-   src/clm/apitest/tet_ClmOiOps.c \
-   src/clm/apitest/tet_saClmDispatch.c \
-   src/clm/apitest/tet_saClmSelectionObjectGet.c \
-   src/clm/apitest/tet_saClmFinalize.c \
-   src/clm/apitest/tet_ClmLongRdn.c
+   src/clm/apitest/clmtest.cc \
+   src/clm/apitest/tet_saClmInitialize.cc \
+   src/clm/apitest/tet_saClmClusterNodeGetAsync.cc \
+   src/clm/apitest/tet_saClmClusterTrack.cc \
+   src/clm/apitest/tet_saClmClusterTrackStop.cc \
+   src/clm/apitest/tet_saClmClusterNotificationFree.cc \
+   src/clm/apitest/tet_saClmClusterNodeGet.cc \
+   src/clm/apitest/tet_saClmResponse.cc \
+   src/clm/apitest/tet_ClmOiOps.cc \
+   src/clm/apitest/tet_saClmDispatch.cc \
+   src/clm/apitest/tet_saClmSelectionObjectGet.cc \
+   src/clm/apitest/tet_saClmFinalize.cc \
+   src/clm/apitest/tet_ClmLongRdn.cc
  
  bin_clmtest_LDADD = \

lib/libSaClm.la \
diff --git a/src/clm/apitest/clm_api_with_try_again.h 
b/src/clm/apitest/clm_api_with_try_again.h
new file mode 100644
index 000..450487f
--- /dev/null
+++ b/src/clm/apitest/clm_api_with_try_again.h
@@ -0,0 +1,145 @@
+/*  -*- OpenSAF  -*-
+ *
+ * Copyright Ericsson AB 2017 - All Rights Reserved.
+ *
+ * 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.
+ *
+ */
+
+#ifndef CLM_APITEST_CLM_API_WITH_TRY_AGAIN_H_
+#define CLM_APITEST_CLM_API_WITH_TRY_AGAIN_H_
+
+#include 
+#include "ais/try_again_decorator.h"
+
+class ClmTest {
+ public:

[HansN] do not use the SA_CLM macros, they are only needed in saClm.h.

+#if defined(SA_CLM_B01) || defined(SA_CLM_B02)
+  static SaAisErrorT saClmInitialize(
+  SaClmHandleT* handle,
+  const SaClmCallbacksT* cbs,
+  SaVersionT* version) {
+return ais::make_decorator(::saClmInitialize)(handle, cbs, version);
+  }
+#endif // SA_CLM_B01 || SA_CLM_B02
+
+#ifdef SA_CLM_B03
+  static SaAisErrorT saClmInitialize_3(
+  SaClmHandleT* handle,
+  const SaClmCallbacksT_3* cbs,
+  SaVersionT* version) {
+return ais::make_decorator(::saClmInitialize_3)(handle, cbs, version);
+  }
+#endif // SA_CLM_B03
+
+  static SaAisErrorT saClmInitialize_4(
+  SaClmHandleT* handle,
+  const SaClmCallbacksT_4* cbs,
+  SaVersionT* version) {
+return ais::make_decorator(::saClmInitialize_4)(handle, cbs, version);
+  }
+
+
+  static Sa

Re: [devel] [PATCH 6/8] plm: Use Node ID instead of slot and subslot to identify a node [#2742]

2018-01-08 Thread Anders Widell

Ok, I will remove them before pushing!

Does anyone have more comments? I will push this on Wednesday if no more 
comments are posted.


regards,

Anders Widell


On 01/02/2018 04:10 PM, Alex Jones wrote:


As far as I can see, plms_self_id and plms_remote_id aren't used at all.

Let's just get rid of them.

Alex


On 12/21/2017 05:25 AM, Anders Widell wrote:


NOTICE: This email was received from an EXTERNAL sender


---
src/plm/common/plms.h | 4 ++--
src/plm/plmd/plms_mds.c | 15 +--
2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/src/plm/common/plms.h b/src/plm/common/plms.h
index d550ea06d..6523a92d6 100644
--- a/src/plm/common/plms.h
+++ b/src/plm/common/plms.h
@@ -257,8 +257,8 @@ typedef struct plms_cb {
MDS_DEST mdest_id;
MDS_DEST hrb_dest;
V_DEST_RL mds_role;
- SaUint32T plms_self_id;
- SaUint32T plms_remote_id;
+ NCS_NODE_ID plms_self_id;
+ NCS_NODE_ID plms_remote_id;
NCS_NODE_ID node_id;

SaAmfHandleT amf_hdl; /*AMF handle, obtained thru AMF init */
diff --git a/src/plm/plmd/plms_mds.c b/src/plm/plmd/plms_mds.c
index 59536ab2b..1415fefe1 100644
--- a/src/plm/plmd/plms_mds.c
+++ b/src/plm/plmd/plms_mds.c
@@ -30,18 +30,6 @@ static SaUint32T 
plms_mds_rcv(MDS_CALLBACK_RECEIVE_INFO *rcv_info);

static SaUint32T plms_mds_svc_evt(MDS_CALLBACK_SVC_EVENT_INFO *svc_evt);
void plms_mds_unregister();

-/*
- Name : plms_get_slot_and_subslot_id_from_node_id
-
- Description : To get the physical slot & sbuslot unique id from the 
node id

-
- Arguments :
-*/
-SaUint32T plms_get_slot_and_subslot_id_from_node_id(NCS_NODE_ID node_id)
-{
- return GetSlotSubslotIdFromNodeId(node_id);
-}
-
/\
PROCEDURE NAME : plms_mds_vdest_create

@@ -217,8 +205,7 @@ SaUint32T plms_mds_register()
/* Get the node id of local PLMS */
cb->node_id = m_NCS_GET_NODE_ID;

- cb->plms_self_id =
- plms_get_slot_and_subslot_id_from_node_id(cb->node_id);
+ cb->plms_self_id = cb->node_id;
TRACE_5("NodeId:%x SelfId:%x", cb->node_id, cb->plms_self_id);
TRACE_LEAVE();
return NCSCC_RC_SUCCESS;
--
2.13.3




--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] pyosaf: refactor IMM utils [#2683]

2018-01-08 Thread Hans Nordebäck

Hi Hieu,

I have some initial questions regarding this patch:

These changes are not backwards compatible, e.g.:

    python

    >>> from pyosaf.utils import immoi

    >>> immoi.get_available_classes_in_imm()

do not work after this patch.

Why is some behavior changed in e.g. functions marked as deprecated? E.g 
adding exceptions.


/Regards HansN


On 12/20/2017 09:25 AM, Hieu Nguyen wrote:

+ improve OI utils use a separate instance OM agent
+ refactor OM utils with Ccb inheritace OmAgent, rename some classes...
---
  python/Makefile.am   |   1 +
  python/pyosaf/utils/immoi/__init__.py| 531 +++
  python/pyosaf/utils/immoi/agent.py   | 473 +++
  python/pyosaf/utils/immoi/implementer.py | 145 +
  python/pyosaf/utils/immom/__init__.py|   7 +-
  python/pyosaf/utils/immom/accessor.py|  31 +-
  python/pyosaf/utils/immom/agent.py   |  31 +-
  python/pyosaf/utils/immom/ccb.py |  71 +
  python/pyosaf/utils/immom/iterator.py|   4 +-
  python/pyosaf/utils/immom/object.py  |   4 +-
  10 files changed, 739 insertions(+), 559 deletions(-)
  create mode 100644 python/pyosaf/utils/immoi/agent.py

diff --git a/python/Makefile.am b/python/Makefile.am
index 08338bb..1952d5e 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -61,6 +61,7 @@ pkgpyosafutilslog_PYTHON = \
  
  pkgpyosafutilsimmoi_PYTHON = \

python/pyosaf/utils/immoi/__init__.py \
+   python/pyosaf/utils/immoi/agent.py \
python/pyosaf/utils/immoi/implementer.py
  
  pkgpyosafutilsntf_PYTHON = \

diff --git a/python/pyosaf/utils/immoi/__init__.py 
b/python/pyosaf/utils/immoi/__init__.py
index 1b4dece..7247b0e 100644
--- a/python/pyosaf/utils/immoi/__init__.py
+++ b/python/pyosaf/utils/immoi/__init__.py
@@ -22,298 +22,23 @@ Supported functions:
  - Set/clear/release implementer for class/object
  - Create/delete/update runtime object
  - Get class/object attributes
-- Get IMM error strings
+- Get/set IMM error strings
+- Get parent for dn
+- Get class for dn
+- Get objects for class
+- Get available classes of IMM
  """
  from __future__ import print_function
-from copy import deepcopy
-from ctypes import c_char_p, c_void_p, cast, pointer
-
-from pyosaf.saAis import SaStringT, SaVersionT, SaNameT, SaSelectionObjectT, \
-unmarshalSaStringTArray, eSaDispatchFlagsT, eSaAisErrorT
-from pyosaf import saImm, saImmOi
-from pyosaf.saImm import unmarshalSaImmValue, SaImmAttrNameT,  \
-SaImmAttrValuesT_2, SaImmClassNameT, SaImmSearchParametersT_2, \
-eSaImmValueTypeT, SaImmAttrDefinitionT_2, SaImmClassCategoryT, \
-SaImmAttrModificationT_2, eSaImmAttrModificationTypeT
-from pyosaf.saImmOi import SaImmOiHandleT, SaImmOiImplementerNameT
-from pyosaf.utils import immom, log_err, bad_handle_retry, decorate, \
-deprecate, initialize_decorate, SafException
+
+from pyosaf.saAis import SaSelectionObjectT, eSaAisErrorT
+from pyosaf.utils import deprecate, SafException
  from pyosaf.utils.immom.object import ImmObject
-from pyosaf.utils.immom.ccb import marshal_c_array
-from pyosaf.utils.immom.iterator import SearchIterator
+from pyosaf.utils.immoi.agent import OiAgent
  
  
-OPENSAF_IMM_OBJECT = "opensafImm=opensafImm,safApp=safImmService"

  _oi_agent = None
  
  
-# Decorate pure saImmOi* API's with error-handling retry and exception raising

-saImmOiInitialize_2 = initialize_decorate(saImmOi.saImmOiInitialize_2)
-saImmOiSelectionObjectGet = decorate(saImmOi.saImmOiSelectionObjectGet)
-saImmOiDispatch = decorate(saImmOi.saImmOiDispatch)
-saImmOiFinalize = decorate(saImmOi.saImmOiFinalize)
-saImmOiImplementerSet = decorate(saImmOi.saImmOiImplementerSet)
-saImmOiImplementerClear = decorate(saImmOi.saImmOiImplementerClear)
-saImmOiClassImplementerSet = decorate(saImmOi.saImmOiClassImplementerSet)
-saImmOiClassImplementerRelease = \
-decorate(saImmOi.saImmOiClassImplementerRelease)
-saImmOiObjectImplementerSet = decorate(saImmOi.saImmOiObjectImplementerSet)
-saImmOiObjectImplementerRelease = \
-decorate(saImmOi.saImmOiObjectImplementerRelease)
-saImmOiRtObjectCreate_2 = decorate(saImmOi.saImmOiRtObjectCreate_2)
-saImmOiRtObjectDelete = decorate(saImmOi.saImmOiRtObjectDelete)
-saImmOiRtObjectUpdate_2 = decorate(saImmOi.saImmOiRtObjectUpdate_2)
-saImmOiAdminOperationResult = decorate(saImmOi.saImmOiAdminOperationResult)
-saImmOiAdminOperationResult_o2 = \
-decorate(saImmOi.saImmOiAdminOperationResult_o2)
-saImmOiAugmentCcbInitialize = decorate(saImmOi.saImmOiAugmentCcbInitialize)
-saImmOiCcbSetErrorString = decorate(saImmOi.saImmOiCcbSetErrorString)
-
-
-class OiAgent(object):
-""" This class acts as a high-level OI agent, providing OI functions to
-the users as a higher level, and relieving the users of the need to manage
-the life cycle of the OI agent and providing general interface for
-Implementer or Applier used
-"""
-def __init__(self, version=None):
-""" Constr