Re: [devel] [PATCH 1 of 1] lgs: Add new multivalue attributes to configuration handler [#2258]
Hi Lanert ACK , ( code review only ) will be tested along with Vu Part of #2258 -AVM On 2/23/2017 3:41 PM, A V Mahesh wrote: > Hi Lanert > > This means , user can configure multiple DESTINATION_CONFIGURATION > concurrently ? > > > + switch (attrMod->modType) { > +case SA_IMM_ATTR_VALUES_ADD: > + lgs_cfgupd_multival_add(LOG_RECORD_DESTINATION_CONFIGURATION, > + values_vector, > + _data); > + break; > +case SA_IMM_ATTR_VALUES_DELETE: > + lgs_cfgupd_multival_delete(LOG_RECORD_DESTINATION_CONFIGURATION, > + values_vector, > + _data); > + break; > +case SA_IMM_ATTR_VALUES_REPLACE: > + lgs_cfgupd_mutival_replace(LOG_RECORD_DESTINATION_CONFIGURATION, > + values_vector, > + _data); > + break; > +default: > + // Shall never happen > + LOG_ER("%s: Unknown modType %d", __FUNCTION__, attrMod->modType); > + osafassert(0); > + }; > > -AVM > > > On 2/20/2017 8:48 PM, Lennart Lund wrote: >>src/log/Makefile.am |5 +- >>src/log/apitest/imm_tstutil.c| 126 +++ >>src/log/apitest/imm_tstutil.h| 61 +++ >>src/log/apitest/logtest.h|2 +- >>src/log/apitest/saflogtest.c | 29 - >>src/log/apitest/tet_LogOiOps.c | 408 >>src/log/apitest/tet_Log_recov.c |7 +- >>src/log/apitest/tet_log_runtime_cfgobj.c |9 +- >>src/log/config/logsv_classes.xml | 27 + >>src/log/logd/lgs.h |2 +- >>src/log/logd/lgs_config.cc | 507 >> -- >>src/log/logd/lgs_config.h| 252 ++- >>src/log/logd/lgs_evt.cc |2 +- >>src/log/logd/lgs_file.cc |2 +- >>src/log/logd/lgs_imm.cc | 69 +++- >>src/log/logd/lgs_mbcsv.cc|2 +- >>src/log/logd/lgs_mbcsv_v5.cc |2 + >>17 files changed, 1344 insertions(+), 168 deletions(-) >> >> >> Add new attributes to the configuration object and configuration info object >> The new attributes are multi value so multi value support is also added >> >> NOTE: UML test fixed and new test cases added >> >> diff --git a/src/log/Makefile.am b/src/log/Makefile.am >> --- a/src/log/Makefile.am >> +++ b/src/log/Makefile.am >> @@ -1,6 +1,7 @@ >># -*- OpenSAF -*- >># >># (C) Copyright 2016 The OpenSAF Foundation >> +# Copyright Ericsson AB [2016, 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 >> @@ -147,7 +148,8 @@ bin_PROGRAMS += bin/logtest bin/saflogte >> >>noinst_HEADERS += \ >> src/log/apitest/logtest.h \ >> -src/log/apitest/logutil.h >> +src/log/apitest/logutil.h \ >> +src/log/apitest/imm_tstutil.h >> >>bin_logtest_CFLAGS = $(AM_CFLAGS) -Wformat=1 >> >> @@ -158,6 +160,7 @@ bin_logtest_CPPFLAGS = \ >>bin_logtest_SOURCES = \ >> src/log/apitest/logtest.c \ >> src/log/apitest/logutil.c \ >> +src/log/apitest/imm_tstutil.c \ >> src/log/apitest/tet_saLogInitialize.c \ >> src/log/apitest/tet_saLogSelectionObjectGet.c \ >> src/log/apitest/tet_saLogDispatch.c \ >> diff --git a/src/log/apitest/imm_tstutil.c b/src/log/apitest/imm_tstutil.c >> new file mode 100644 >> --- /dev/null >> +++ b/src/log/apitest/imm_tstutil.c >> @@ -0,0 +1,126 @@ >> +/* -*- 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. >> + * >> + */ >> +#include >> +#include >> +#include >> +#include >> +#include "imm/saf/saImm.h" >> +#include "imm/saf/saImmOm.h" >> +#include "osaf/immutil/immutil.h" >> +#include "base/saf_error.h" >> +#include "base/osaf_extended_name.h" >> + >> +static SaVersionT immVersion = {'A', 2, 11}; >> + >> +bool get_multivalue_type_string_from_imm(SaImmHandleT *omHandle, >> +SaConstStringT objectName, >> +char *attribute_name, >> +
Re: [devel] [PATCH 1 of 1] lgs: Add new multivalue attributes to configuration handler [#2258]
Hi Lennart, Ack with few comments. [Vu] Regards, Vu > -Original Message- > From: Lennart Lund [mailto:lennart.l...@ericsson.com] > Sent: Monday, February 20, 2017 10:18 PM > To: mahesh.va...@oracle.com; vu.m.ngu...@dektech.com.au > Cc: opensaf-devel@lists.sourceforge.net > Subject: [PATCH 1 of 1] lgs: Add new multivalue attributes to configuration > handler [#2258] > > src/log/Makefile.am |5 +- > src/log/apitest/imm_tstutil.c| 126 +++ > src/log/apitest/imm_tstutil.h| 61 +++ > src/log/apitest/logtest.h|2 +- > src/log/apitest/saflogtest.c | 29 - > src/log/apitest/tet_LogOiOps.c | 408 > src/log/apitest/tet_Log_recov.c |7 +- > src/log/apitest/tet_log_runtime_cfgobj.c |9 +- > src/log/config/logsv_classes.xml | 27 + > src/log/logd/lgs.h |2 +- > src/log/logd/lgs_config.cc | 507 -- > src/log/logd/lgs_config.h| 252 ++- > src/log/logd/lgs_evt.cc |2 +- > src/log/logd/lgs_file.cc |2 +- > src/log/logd/lgs_imm.cc | 69 +++- > src/log/logd/lgs_mbcsv.cc|2 +- > src/log/logd/lgs_mbcsv_v5.cc |2 + > 17 files changed, 1344 insertions(+), 168 deletions(-) > > > Add new attributes to the configuration object and configuration info object > The new attributes are multi value so multi value support is also added > > NOTE: UML test fixed and new test cases added > > diff --git a/src/log/Makefile.am b/src/log/Makefile.am > --- a/src/log/Makefile.am > +++ b/src/log/Makefile.am > @@ -1,6 +1,7 @@ > # -*- OpenSAF -*- > # > # (C) Copyright 2016 The OpenSAF Foundation > +# Copyright Ericsson AB [2016, 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 > @@ -147,7 +148,8 @@ bin_PROGRAMS += bin/logtest bin/saflogte > > noinst_HEADERS += \ > src/log/apitest/logtest.h \ > - src/log/apitest/logutil.h > + src/log/apitest/logutil.h \ > + src/log/apitest/imm_tstutil.h > > bin_logtest_CFLAGS = $(AM_CFLAGS) -Wformat=1 > > @@ -158,6 +160,7 @@ bin_logtest_CPPFLAGS = \ > bin_logtest_SOURCES = \ > src/log/apitest/logtest.c \ > src/log/apitest/logutil.c \ > + src/log/apitest/imm_tstutil.c \ > src/log/apitest/tet_saLogInitialize.c \ > src/log/apitest/tet_saLogSelectionObjectGet.c \ > src/log/apitest/tet_saLogDispatch.c \ > diff --git a/src/log/apitest/imm_tstutil.c b/src/log/apitest/imm_tstutil.c > new file mode 100644 > --- /dev/null > +++ b/src/log/apitest/imm_tstutil.c > @@ -0,0 +1,126 @@ > +/* -*- 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. > + * > + */ > +#include > +#include > +#include > +#include > +#include "imm/saf/saImm.h" > +#include "imm/saf/saImmOm.h" > +#include "osaf/immutil/immutil.h" > +#include "base/saf_error.h" > +#include "base/osaf_extended_name.h" > + > +static SaVersionT immVersion = {'A', 2, 11}; > + > +bool get_multivalue_type_string_from_imm(SaImmHandleT *omHandle, > + SaConstStringT objectName, > + char *attribute_name, > + char ***multivalue_array) { > + SaAisErrorT om_rc = SA_AIS_OK; > + SaImmAccessorHandleT accessorHandle; > + SaImmAttrValuesT_2 *attribute; > + SaImmAttrValuesT_2 **attributes; > + bool func_rc = true; > + > + //printf(">> get_multivalue_string_type_from_imm()\n"); > + > + do { > + /* Make sure this is a NULL pointer if no values are found */ > + *multivalue_array = NULL; > + > + om_rc = immutil_saImmOmInitialize(omHandle, NULL, > ); > + if (om_rc != SA_AIS_OK) { > + printf("immutil_saImmOmInitialize Fail '%s'\n", > + saf_error(om_rc)); > + func_rc = false; > + break; > + } > + > + //printf("\timmutil_saImmOmInitialize() Done\n"); > + > + om_rc = immutil_saImmOmAccessorInitialize(*omHandle, > + ); > + if (om_rc != SA_AIS_OK)
[devel] [PATCH 1 of 1] lgs: Add new multivalue attributes to configuration handler [#2258]
src/log/Makefile.am |5 +- src/log/apitest/imm_tstutil.c| 126 +++ src/log/apitest/imm_tstutil.h| 61 +++ src/log/apitest/logtest.h|2 +- src/log/apitest/saflogtest.c | 29 - src/log/apitest/tet_LogOiOps.c | 408 src/log/apitest/tet_Log_recov.c |7 +- src/log/apitest/tet_log_runtime_cfgobj.c |9 +- src/log/config/logsv_classes.xml | 27 + src/log/logd/lgs.h |2 +- src/log/logd/lgs_config.cc | 507 -- src/log/logd/lgs_config.h| 252 ++- src/log/logd/lgs_evt.cc |2 +- src/log/logd/lgs_file.cc |2 +- src/log/logd/lgs_imm.cc | 69 +++- src/log/logd/lgs_mbcsv.cc|2 +- src/log/logd/lgs_mbcsv_v5.cc |2 + 17 files changed, 1344 insertions(+), 168 deletions(-) Add new attributes to the configuration object and configuration info object The new attributes are multi value so multi value support is also added NOTE: UML test fixed and new test cases added diff --git a/src/log/Makefile.am b/src/log/Makefile.am --- a/src/log/Makefile.am +++ b/src/log/Makefile.am @@ -1,6 +1,7 @@ # -*- OpenSAF -*- # # (C) Copyright 2016 The OpenSAF Foundation +# Copyright Ericsson AB [2016, 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 @@ -147,7 +148,8 @@ bin_PROGRAMS += bin/logtest bin/saflogte noinst_HEADERS += \ src/log/apitest/logtest.h \ - src/log/apitest/logutil.h + src/log/apitest/logutil.h \ + src/log/apitest/imm_tstutil.h bin_logtest_CFLAGS = $(AM_CFLAGS) -Wformat=1 @@ -158,6 +160,7 @@ bin_logtest_CPPFLAGS = \ bin_logtest_SOURCES = \ src/log/apitest/logtest.c \ src/log/apitest/logutil.c \ + src/log/apitest/imm_tstutil.c \ src/log/apitest/tet_saLogInitialize.c \ src/log/apitest/tet_saLogSelectionObjectGet.c \ src/log/apitest/tet_saLogDispatch.c \ diff --git a/src/log/apitest/imm_tstutil.c b/src/log/apitest/imm_tstutil.c new file mode 100644 --- /dev/null +++ b/src/log/apitest/imm_tstutil.c @@ -0,0 +1,126 @@ +/* -*- 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. + * + */ +#include +#include +#include +#include +#include "imm/saf/saImm.h" +#include "imm/saf/saImmOm.h" +#include "osaf/immutil/immutil.h" +#include "base/saf_error.h" +#include "base/osaf_extended_name.h" + +static SaVersionT immVersion = {'A', 2, 11}; + +bool get_multivalue_type_string_from_imm(SaImmHandleT *omHandle, + SaConstStringT objectName, + char *attribute_name, + char ***multivalue_array) { + SaAisErrorT om_rc = SA_AIS_OK; + SaImmAccessorHandleT accessorHandle; + SaImmAttrValuesT_2 *attribute; + SaImmAttrValuesT_2 **attributes; + bool func_rc = true; + + //printf(">> get_multivalue_string_type_from_imm()\n"); + + do { + /* Make sure this is a NULL pointer if no values are found */ + *multivalue_array = NULL; + + om_rc = immutil_saImmOmInitialize(omHandle, NULL, ); + if (om_rc != SA_AIS_OK) { + printf("immutil_saImmOmInitialize Fail '%s'\n", + saf_error(om_rc)); + func_rc = false; + break; + } + + //printf("\timmutil_saImmOmInitialize() Done\n"); + + om_rc = immutil_saImmOmAccessorInitialize(*omHandle, + ); + if (om_rc != SA_AIS_OK) { + printf("immutil_saImmOmAccessorInitialize failed: %s\n", + saf_error(om_rc)); + func_rc = false; + break; + } + + //printf("\timmutil_saImmOmAccessorInitialize() Done\n"); + + //SaConstStringT objectName = "logConfig=1,safApp=safLogService"; + SaNameT tmpObjName; + osaf_extended_name_lend(objectName, ); + + /* Get the attribute */ + SaImmAttrNameT
[devel] [PATCH 1 of 1] lgs: Add new multivalue attributes to configuration handler [#2258]
src/log/Makefile.am |4 +- src/log/apitest/imm_tstutil.c| 126 src/log/apitest/imm_tstutil.h| 61 +++ src/log/apitest/logtest.h|2 +- src/log/apitest/saflogtest.c | 29 - src/log/apitest/tet_LogOiOps.c | 320 src/log/apitest/tet_Log_recov.c |6 +- src/log/apitest/tet_log_runtime_cfgobj.c |8 +- src/log/config/logsv_classes.xml | 27 + src/log/logd/lgs.h |2 +- src/log/logd/lgs_config.cc | 486 -- src/log/logd/lgs_config.h| 250 ++- src/log/logd/lgs_evt.cc |2 +- src/log/logd/lgs_file.cc |2 +- src/log/logd/lgs_imm.cc | 63 +++- src/log/logd/lgs_mbcsv.cc|2 +- 16 files changed, 1227 insertions(+), 163 deletions(-) Add new attributes to the configuration object and configuration info object The new attributes are multi value so multi value support is also added NOTE: UML test fixed and new test cases added diff --git a/src/log/Makefile.am b/src/log/Makefile.am --- a/src/log/Makefile.am +++ b/src/log/Makefile.am @@ -147,7 +147,8 @@ bin_PROGRAMS += bin/logtest bin/saflogte noinst_HEADERS += \ src/log/apitest/logtest.h \ - src/log/apitest/logutil.h + src/log/apitest/logutil.h \ + src/log/apitest/imm_tstutil.h bin_logtest_CFLAGS = $(AM_CFLAGS) -Wformat=1 @@ -158,6 +159,7 @@ bin_logtest_CPPFLAGS = \ bin_logtest_SOURCES = \ src/log/apitest/logtest.c \ src/log/apitest/logutil.c \ + src/log/apitest/imm_tstutil.c \ src/log/apitest/tet_saLogInitialize.c \ src/log/apitest/tet_saLogSelectionObjectGet.c \ src/log/apitest/tet_saLogDispatch.c \ diff --git a/src/log/apitest/imm_tstutil.c b/src/log/apitest/imm_tstutil.c new file mode 100644 --- /dev/null +++ b/src/log/apitest/imm_tstutil.c @@ -0,0 +1,126 @@ +/* -*- 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. + * + */ +#include +#include +#include +#include +#include "imm/saf/saImm.h" +#include "imm/saf/saImmOm.h" +#include "osaf/immutil/immutil.h" +#include "base/saf_error.h" +#include "base/osaf_extended_name.h" + +static SaVersionT immVersion = {'A', 2, 11}; + +bool get_multivalue_type_string_from_imm(SaImmHandleT *omHandle, + SaConstStringT objectName, + char *attribute_name, + char ***multivalue_array) { + SaAisErrorT om_rc = SA_AIS_OK; + SaImmAccessorHandleT accessorHandle; + SaImmAttrValuesT_2 *attribute; + SaImmAttrValuesT_2 **attributes; + bool func_rc = true; + + //printf(">> get_multivalue_string_type_from_imm()\n"); + + do { + /* Make sure this is a NULL pointer if no values are found */ + *multivalue_array = NULL; + + om_rc = immutil_saImmOmInitialize(omHandle, NULL, ); + if (om_rc != SA_AIS_OK) { + printf("immutil_saImmOmInitialize Fail '%s'\n", + saf_error(om_rc)); + func_rc = false; + break; + } + + //printf("\timmutil_saImmOmInitialize() Done\n"); + + om_rc = immutil_saImmOmAccessorInitialize(*omHandle, + ); + if (om_rc != SA_AIS_OK) { + printf("immutil_saImmOmAccessorInitialize failed: %s\n", + saf_error(om_rc)); + func_rc = false; + break; + } + + //printf("\timmutil_saImmOmAccessorInitialize() Done\n"); + + //SaConstStringT objectName = "logConfig=1,safApp=safLogService"; + SaNameT tmpObjName; + osaf_extended_name_lend(objectName, ); + + /* Get the attribute */ + SaImmAttrNameT attributeNames[2]; + attributeNames[0] = attribute_name; + attributeNames[1] = NULL; + om_rc = immutil_saImmOmAccessorGet_2( + accessorHandle, + , + attributeNames, + ); + if (om_rc != SA_AIS_OK) { +