Also fix the CLM API tests so that they longer assume that there is a node with
node ID 0x2010f in the cluster.
---
 src/clm/apitest/clmtest.cc                      |  6 ++++++
 src/clm/apitest/tet_saClmClusterNodeGet.cc      | 23 ++++++++++++-----------
 src/clm/apitest/tet_saClmClusterNodeGetAsync.cc | 15 ++++++++-------
 src/clm/apitest/tet_saClmClusterTrack.cc        |  2 +-
 src/clm/apitest/tet_saClmClusterTrackStop.cc    |  4 +++-
 src/clm/apitest/tet_saClmDispatch.cc            |  6 ++++--
 src/clm/apitest/tet_saClmResponse.cc            |  2 +-
 7 files changed, 35 insertions(+), 23 deletions(-)

diff --git a/src/clm/apitest/clmtest.cc b/src/clm/apitest/clmtest.cc
index 2bfa54ef7..77886e658 100644
--- a/src/clm/apitest/clmtest.cc
+++ b/src/clm/apitest/clmtest.cc
@@ -20,6 +20,8 @@
 #include <unistd.h>
 
 #include "clmtest.h"
+#include "base/ncs_main_papi.h"
+
 /* Highest supported version*/
 #define CLM_HIGHEST_SUPPORTED_VERSION  {'B', 0x04, 0x01}
 #define CLM_LOWEST_SUPPORTED_VERSION   {'B', 0x01, 0x01}
@@ -72,6 +74,10 @@ int main(int argc, char **argv) {
   int suite = ALL_SUITES, tcase = ALL_TESTS;
 
   srandom(getpid());
+  if (ncs_leap_startup() != NCSCC_RC_SUCCESS) {
+    printf("LEAP startup failed\n");
+    return 1;
+  }
   clm_init();
 
   if (argc > 1) {
diff --git a/src/clm/apitest/tet_saClmClusterNodeGet.cc 
b/src/clm/apitest/tet_saClmClusterNodeGet.cc
index c69335204..9a9d948bc 100644
--- a/src/clm/apitest/tet_saClmClusterNodeGet.cc
+++ b/src/clm/apitest/tet_saClmClusterNodeGet.cc
@@ -1,6 +1,6 @@
 /*      -*- OpenSAF  -*-
  *
- * (C) Copyright 13134308 The OpenSAF Foundation
+ * (C) Copyright 2008 The OpenSAF Foundation
  * Copyright Ericsson AB 2017 - All Rights Reserved.
  *
  * This program is distributed in the hope that it will be useful, but
@@ -17,6 +17,7 @@
  */
 
 #include "clmtest.h"
+#include "base/ncs_main_papi.h"
 
 static SaClmClusterNodeT clusterNode_1;
 static SaClmClusterNodeT_4 clusterNode_4;
@@ -24,7 +25,7 @@ static SaClmNodeIdT nodeId;
 static SaTimeT timeout = 10000000000ll;
 
 void saClmClusterNodeGet_01(void) {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks_1, 
&clmVersion_1),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet(clmHandle, nodeId, timeout, 
&clusterNode_1);
@@ -33,7 +34,7 @@ void saClmClusterNodeGet_01(void) {
 }
 
 void saClmClusterNodeGet_02(void) {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize_4(&clmHandle, &clmCallbacks_4, 
&clmVersion_4),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet_4(clmHandle, nodeId, timeout, 
&clusterNode_4);
@@ -42,28 +43,28 @@ void saClmClusterNodeGet_02(void) {
 }
 
 void saClmClusterNodeGet_03(void) {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks_1, 
&clmVersion_1),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet(0, nodeId, timeout, &clusterNode_1);
   safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK);
   test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
 
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks_1, 
&clmVersion_1),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet(-1, nodeId, timeout, &clusterNode_1);
   safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK);
   test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
 
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize_4(&clmHandle, &clmCallbacks_4, 
&clmVersion_4),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet_4(0, nodeId, timeout, &clusterNode_4);
   safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK);
   test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
 
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize_4(&clmHandle, &clmCallbacks_4, 
&clmVersion_4),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet_4(-1, nodeId, timeout, &clusterNode_4);
@@ -73,14 +74,14 @@ void saClmClusterNodeGet_03(void) {
 
 void saClmClusterNodeGet_04(void)
 {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks_1, 
&clmVersion_1),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet(clmHandle, nodeId, 0, &clusterNode_1);
   safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK);
   test_validate(rc, SA_AIS_OK);
 
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize_4(&clmHandle, &clmCallbacks_4, 
&clmVersion_4),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet_4(clmHandle, nodeId, 0, &clusterNode_4);
@@ -89,14 +90,14 @@ void saClmClusterNodeGet_04(void)
 }
 
 void saClmClusterNodeGet_05(void) {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks_1, 
&clmVersion_1),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet(clmHandle, nodeId, timeout, NULL);
   safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK);
   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
 
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   safassert(ClmTest::saClmInitialize_4(&clmHandle, &clmCallbacks_4, 
&clmVersion_4),
             SA_AIS_OK);
   rc = ClmTest::saClmClusterNodeGet_4(clmHandle, nodeId, timeout, NULL);
diff --git a/src/clm/apitest/tet_saClmClusterNodeGetAsync.cc 
b/src/clm/apitest/tet_saClmClusterNodeGetAsync.cc
index e6f4a1a9a..ae3fcace9 100644
--- a/src/clm/apitest/tet_saClmClusterNodeGetAsync.cc
+++ b/src/clm/apitest/tet_saClmClusterNodeGetAsync.cc
@@ -1,6 +1,6 @@
 /*      -*- OpenSAF  -*-
  *
- * (C) Copyright 13134308 The OpenSAF Foundation
+ * (C) Copyright 2008 The OpenSAF Foundation
  * Copyright Ericsson AB 2017 - All Rights Reserved.
  *
  * This program is distributed in the hope that it will be useful, but
@@ -17,6 +17,7 @@
  */
 
 #include "clmtest.h"
+#include "base/ncs_main_papi.h"
 
 static SaClmNodeIdT nodeId;
 static SaInvocationT invocation;
@@ -41,7 +42,7 @@ SaClmCallbacksT clmCallbacks1 = {nodeGetCallBack1, NULL};
 void saClmClusterNodeGetAsync_01(void) {
   /*struct pollfd fds[1];*/
   /*int ret;*/
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 600;
   SaAisErrorT rc;
 
@@ -64,7 +65,7 @@ void saClmClusterNodeGetAsync_01(void) {
 void saClmClusterNodeGetAsync_02(void) {
   struct pollfd fds[1];
   int ret;
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 700;
   SaAisErrorT rc;
 
@@ -85,7 +86,7 @@ void saClmClusterNodeGetAsync_02(void) {
 }
 
 void saClmClusterNodeGetAsync_03(void) {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 300;
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks1, 
&clmVersion_1),
             SA_AIS_OK);
@@ -113,7 +114,7 @@ void saClmClusterNodeGetAsync_03(void) {
 }
 
 void saClmClusterNodeGetAsync_04(void) {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 400;
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks1, 
&clmVersion_1),
             SA_AIS_OK);
@@ -124,7 +125,7 @@ void saClmClusterNodeGetAsync_04(void) {
 
 void saClmClusterNodeGetAsync_05(void)
 {
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 500;
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallbacks1, 
&clmVersion_1),
             SA_AIS_OK);
@@ -201,7 +202,7 @@ void saClmClusterNodeGetAsync_08(void) {
 void saClmClusterNodeGetAsync_09(void) {
   /*struct pollfd fds[1];*/
   /*int ret;*/
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 600;
   SaAisErrorT rc;
 
diff --git a/src/clm/apitest/tet_saClmClusterTrack.cc 
b/src/clm/apitest/tet_saClmClusterTrack.cc
index ff373e6d5..1b0275a6a 100644
--- a/src/clm/apitest/tet_saClmClusterTrack.cc
+++ b/src/clm/apitest/tet_saClmClusterTrack.cc
@@ -186,7 +186,7 @@ static void clmTrackbuf_4(
         notificationBuffer->notification[i]
         .clusterNode.nodeAddress.value);
 
-    printf("Node  nodeid  = %d\n",
+    printf("Node  nodeid  = %u\n",
            notificationBuffer->notification[i].clusterNode.nodeId);
   }
 }
diff --git a/src/clm/apitest/tet_saClmClusterTrackStop.cc 
b/src/clm/apitest/tet_saClmClusterTrackStop.cc
index 5dbeb02d8..4a5d0e0d0 100644
--- a/src/clm/apitest/tet_saClmClusterTrackStop.cc
+++ b/src/clm/apitest/tet_saClmClusterTrackStop.cc
@@ -15,7 +15,9 @@
  * Author(s): Emerson Network Power
  *
  */
+
 #include "clmtest.h"
+#include "base/ncs_main_papi.h"
 
 static SaUint8T trackFlags;
 static SaClmNodeIdT nodeId;
@@ -61,7 +63,7 @@ SaClmCallbacksT clmCallback11 = {nodeGetCallBack11, 
clmTrackCallback11};
 
 void saClmClusterTrackStop_01(void) {
   trackFlags = SA_TRACK_CURRENT;
-  nodeId = 131343;
+  nodeId = ncs_get_node_id();
   invocation = 600;
   safassert(ClmTest::saClmInitialize(&clmHandle, &clmCallback11, 
&clmVersion_1),
             SA_AIS_OK);
diff --git a/src/clm/apitest/tet_saClmDispatch.cc 
b/src/clm/apitest/tet_saClmDispatch.cc
index a7a907f0b..c3505a027 100644
--- a/src/clm/apitest/tet_saClmDispatch.cc
+++ b/src/clm/apitest/tet_saClmDispatch.cc
@@ -15,7 +15,9 @@
  * Author(s): Emerson Network Power
  *
  */
+
 #include "clmtest.h"
+#include "base/ncs_main_papi.h"
 
 static void nodeGetCallBack1(SaInvocationT invocation,
                             const SaClmClusterNodeT *clusterNode,
@@ -31,7 +33,7 @@ static SaInvocationT invocation;
 void saClmDispatch_01(void) {
   struct pollfd fds[1];
   int ret;
-  nodeId = 131343; /*node does not exist*/
+  nodeId = ncs_get_node_id(); /*node does not exist*/
   invocation = 600;
   SaAisErrorT rc;
 
@@ -68,7 +70,7 @@ void saClmDispatch_03(void) {
 void saClmDispatch_04(void) {
   struct pollfd fds[1];
   int ret;
-  nodeId = 131343; /*node does not exist*/
+  nodeId = ncs_get_node_id(); /*node does not exist*/
   invocation = 600;
   SaAisErrorT rc;
 
diff --git a/src/clm/apitest/tet_saClmResponse.cc 
b/src/clm/apitest/tet_saClmResponse.cc
index 7f1b520bf..1b4a48a49 100644
--- a/src/clm/apitest/tet_saClmResponse.cc
+++ b/src/clm/apitest/tet_saClmResponse.cc
@@ -69,7 +69,7 @@ static void clmTrackbuf_4(SaClmClusterNotificationBufferT_4 
*notificationBuffer)
         notificationBuffer->notification[i]
         .clusterNode.nodeAddress.value);
 
-    printf("Node  nodeid  = %d\n",
+    printf("Node  nodeid  = %u\n",
            notificationBuffer->notification[i].clusterNode.nodeId);
   }
 }
-- 
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to