The following code is not correct. The rdegetrole command can be found on all nodes. However if it is used on a PL node it will report Fail insted of ACTIVE or STANDBY
On PL node:
rdegetrole
rda_get_role failed
In file tet_ntf_clm.c:
// Add these test cases on other than active controller.
int rc = 0;
char role[80];
rc = system("which rdegetrole");
if (rc == 0) {
printf("This is a controller node\n");
// Command rdegetrole exists means a controller.
memset(buffer, '\0', sizeof(buffer));
memset(role, '\0', sizeof(role));
strcpy(buffer, "rdegetrole");
fp = popen(buffer, "r");
if (fgets(role, sizeof(role), fp) != NULL) {
if ((ptr = strchr(role, '\n')) != NULL)
ptr = '\0';
if (!strcmp((char )role, "ACTIVE")) {
// printf("Active controller node\n");
pclose(fp);
return;
}
}
pclose(fp);
} else {
printf("This is a payload node\n");
}
Test cases did not fail because of this problem. CLM tests cannot be executed on the active and the test for this actually works. Text written when running test cases is misleading.
I have created a fix for this and will send it for review/push even if it just fix the misleading printout
The meaning of this code is to not load test suite 40 if ntf test is excuted on an active SC node.
Thsi si actually working but comments in the code and prontouts to the user is misleading e.g. when running on a payload note the printout says that it is running on a SC node but wit "some luck" the check that it is not active works.
Since this problem does not make any tests fail I have changed priority to minor.
commit 35bbc53c10ebb37d7d792895db4849ab67f3792b
Author: Lennart Lund lennart.lund@ericsson.com
Date: Fri Jun 30 12:13:06 2017 +0200