From cda900d6d35170fcfe0c3ac8382271575eba077b Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Thu, 10 Jul 2025 12:20:18 +0530
Subject: [PATCH 01/21] Update Device_DeviceInfo.cpp
---
.../profiles/DeviceInfo/Device_DeviceInfo.cpp | 116 ++++++++++++++++++
1 file changed, 116 insertions(+)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index 7e94754e6..222e13acb 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4165,6 +4165,122 @@ int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerI
return retVal;
}
+int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggergetProfileData(HOSTIF_MsgData_t *stMsgData)
+{
+
+ stMsgData->paramtype = hostIf_StringType;
+ int retStatus = NOK;
+
+ const char *filename = "/etc/rrd/remote_debugger.json";
+ FILE *fp = nullptr;
+ char *fileBuf = nullptr;
+ long fileSz = 0;
+ size_t bytesRead = 0;
+ cJSON *root = nullptr;
+ cJSON *filtered = nullptr;
+ char *outStr = nullptr;
+ size_t outLen = 0;
+
+ RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF,
+ "[%s] Entering …\n", __FUNCTION__);
+
+
+ fp = fopen(filename, "rb");
+ if(!fp)
+ {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
+ "[%s] Cannot open %s\n", __FUNCTION__, filename);
+ goto CLEAN_UP;
+ }
+
+ if(fseek(fp, 0L, SEEK_END) != 0)
+ {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
+ "[%s] fseek failed\n", __FUNCTION__);
+ goto CLEAN_UP;
+ }
+ fileSz = ftell(fp);
+ rewind(fp);
+
+ fileBuf = (char*)malloc((size_t)fileSz + 1);
+ if(!fileBuf)
+ {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
+ "[%s] malloc(%ld) failed\n", __FUNCTION__, fileSz + 1);
+ goto CLEAN_UP;
+ }
+
+ bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
+ fileBuf[bytesRead] = '\0';
+ fclose(fp); fp = nullptr;
+
+
+ root = cJSON_Parse(fileBuf);
+ if(!root)
+ {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
+ "[%s] JSON parse error: %s\n",
+ __FUNCTION__, cJSON_GetErrorPtr());
+ goto CLEAN_UP;
+ }
+
+
+ filtered = cJSON_CreateObject();
+ if(!filtered)
+ goto CLEAN_UP;
+
+ for(cJSON *top = root->child; top; top = top->next)
+ {
+ if(top->type != cJSON_Object)
+ continue;
+
+ cJSON *arr = cJSON_CreateArray();
+ if(!arr)
+ goto CLEAN_UP;
+
+ for(cJSON *sub = top->child; sub; sub = sub->next)
+ cJSON_AddItemToArray(arr, cJSON_CreateString(sub->string));
+
+ if(cJSON_GetArraySize(arr) > 0)
+ cJSON_AddItemToObject(filtered, top->string, arr);
+ else
+ cJSON_Delete(arr);
+ }
+
+
+ outStr = cJSON_PrintUnformatted(filtered);
+ if(!outStr)
+ goto CLEAN_UP;
+
+
+ outLen = strlen(outStr);
+ if(outLen >= sizeof(stMsgData->paramValue))
+ outLen = sizeof(stMsgData->paramValue) - 1;
+
+ memcpy(stMsgData->paramValue, outStr, outLen);
+ stMsgData->paramValue[outLen] = '\0';
+ stMsgData->paramLen = outLen;
+
+
+ RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF,
+ "[%s] Extracted profile map: %s\n", __FUNCTION__, outStr);
+
+ retStatus = OK;
+
+CLEAN_UP:
+ if(fp) fclose(fp);
+ if(fileBuf) free(fileBuf);
+ cJSON_Delete(root);
+ cJSON_Delete(filtered);
+ if(outStr) free(outStr);
+
+ RDK_LOG((retStatus == OK) ? RDK_LOG_TRACE1 : RDK_LOG_ERROR,
+ LOG_TR69HOSTIF, "[%s] Leaving with %s\n",
+ __FUNCTION__, (retStatus == OK) ? "OK" : "NOK");
+
+ return retStatus;
+}
+
int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerWebCfgData (HOSTIF_MsgData_t *stMsgData)
{
char *issueStr = NULL;
From e8153cb87fc5cf27b3cbc54e9746526a0cd592ae Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Thu, 10 Jul 2025 12:21:30 +0530
Subject: [PATCH 02/21] Update Device_DeviceInfo.h
---
src/hostif/profiles/DeviceInfo/Device_DeviceInfo.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.h b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.h
index be3597b97..2ebed8e07 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.h
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.h
@@ -1227,6 +1227,7 @@ class hostIf_DeviceInfo {
int set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerIssueType(HOSTIF_MsgData_t *);
int set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerWebCfgData(HOSTIF_MsgData_t *);
+ int get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggergetProfileData(HOSTIF_MsgData_t *);
#endif
/*
* @brief set_Device_DeviceInfo_X_RDKCENTRAL_COM_RebootStopEnable
From 255b5d1d38e3c82bcc811e0f5fcb0a0c84ebe07d Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Thu, 10 Jul 2025 12:23:47 +0530
Subject: [PATCH 03/21] Update data-model-generic.xml
---
.../parodusClient/waldb/data-model/data-model-generic.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml b/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml
index 8702609b7..d9f808f0e 100755
--- a/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml
+++ b/src/hostif/parodusClient/waldb/data-model/data-model-generic.xml
@@ -3543,6 +3543,11 @@
+
+
+
+
+
From 90ae35d3d17eebe2e66f269d321fabc6c665280b Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Thu, 10 Jul 2025 12:29:11 +0530
Subject: [PATCH 04/21] Update hostIf_DeviceClient_ReqHandler.cpp
---
src/hostif/handlers/src/hostIf_DeviceClient_ReqHandler.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/hostif/handlers/src/hostIf_DeviceClient_ReqHandler.cpp b/src/hostif/handlers/src/hostIf_DeviceClient_ReqHandler.cpp
index afa49102b..00367c28b 100644
--- a/src/hostif/handlers/src/hostIf_DeviceClient_ReqHandler.cpp
+++ b/src/hostif/handlers/src/hostIf_DeviceClient_ReqHandler.cpp
@@ -490,6 +490,11 @@ int DeviceClientReqHandler::handleGetMsg(HOSTIF_MsgData_t *stMsgData)
{
ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_BootStatus(stMsgData);
}
+
+ else if(strcasecmp(stMsgData->paramName,"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKRemoteDebugger.getProfileData") == 0)
+ {
+ ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggergetProfileData(stMsgData);
+ }
else if (strcasecmp(stMsgData->paramName,"Device.DeviceInfo.X_RDKCENTRAL-COM_PreferredGatewayType") == 0)
{
ret = pIface->get_Device_DeviceInfo_X_RDKCENTRAL_COM_PreferredGatewayType(stMsgData);
From 87f6d500544460808cc508b623eb58ae3da4a9fd Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 11 Jul 2025 12:31:51 +0530
Subject: [PATCH 05/21] Update Device_DeviceInfo.cpp
---
src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index 222e13acb..bc5d36507 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4205,11 +4205,14 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
fileBuf = (char*)malloc((size_t)fileSz + 1);
if(!fileBuf)
{
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
- "[%s] malloc(%ld) failed\n", __FUNCTION__, fileSz + 1);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] malloc(%ld) failed\n", __FUNCTION__, fileSz + 1);
goto CLEAN_UP;
}
-
+ if(fileSz < 0 )
+ {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fileSz is being negative, Returning....\n", __FUNCTION__, fileSz + 1);
+ goto CLEAN_UP;
+ }
bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
fileBuf[bytesRead] = '\0';
fclose(fp); fp = nullptr;
From fa1270219c4f78d2adad6c4f9ad38aa5fb907b58 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 11 Jul 2025 12:55:46 +0530
Subject: [PATCH 06/21] Update Device_DeviceInfo.cpp
---
src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index bc5d36507..5229dffe9 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4210,7 +4210,7 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
}
if(fileSz < 0 )
{
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fileSz is being negative, Returning....\n", __FUNCTION__, fileSz + 1);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fileSz is being negative, Returning....\n", __FUNCTION__);
goto CLEAN_UP;
}
bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
From 93db3643b74702357a8c664b123213d9d2904138 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 11 Jul 2025 18:16:08 +0530
Subject: [PATCH 07/21] Update Device_DeviceInfo.cpp
---
.../profiles/DeviceInfo/Device_DeviceInfo.cpp | 58 +++++++------------
1 file changed, 22 insertions(+), 36 deletions(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index 5229dffe9..808f1a1cd 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4181,27 +4181,20 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
char *outStr = nullptr;
size_t outLen = 0;
- RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF,
- "[%s] Entering …\n", __FUNCTION__);
-
-
+ RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Entering …\n", __FUNCTION__);
fp = fopen(filename, "rb");
if(!fp)
{
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
- "[%s] Cannot open %s\n", __FUNCTION__, filename);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Cannot open %s\n", __FUNCTION__, filename);
goto CLEAN_UP;
}
-
if(fseek(fp, 0L, SEEK_END) != 0)
{
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
- "[%s] fseek failed\n", __FUNCTION__);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fseek failed\n", __FUNCTION__);
goto CLEAN_UP;
}
fileSz = ftell(fp);
rewind(fp);
-
fileBuf = (char*)malloc((size_t)fileSz + 1);
if(!fileBuf)
{
@@ -4216,58 +4209,54 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
fileBuf[bytesRead] = '\0';
fclose(fp); fp = nullptr;
-
-
root = cJSON_Parse(fileBuf);
if(!root)
{
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF,
- "[%s] JSON parse error: %s\n",
- __FUNCTION__, cJSON_GetErrorPtr());
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] JSON parse error: %s\n", __FUNCTION__, cJSON_GetErrorPtr());
goto CLEAN_UP;
}
-
-
filtered = cJSON_CreateObject();
if(!filtered)
+ {
goto CLEAN_UP;
-
+ }
for(cJSON *top = root->child; top; top = top->next)
{
if(top->type != cJSON_Object)
- continue;
-
+ {
+ continue;
+ }
cJSON *arr = cJSON_CreateArray();
if(!arr)
+ {
goto CLEAN_UP;
-
+ }
for(cJSON *sub = top->child; sub; sub = sub->next)
cJSON_AddItemToArray(arr, cJSON_CreateString(sub->string));
if(cJSON_GetArraySize(arr) > 0)
+ {
cJSON_AddItemToObject(filtered, top->string, arr);
+ }
else
- cJSON_Delete(arr);
+ {
+ cJSON_Delete(arr);
+ }
}
-
-
outStr = cJSON_PrintUnformatted(filtered);
if(!outStr)
+ {
goto CLEAN_UP;
-
-
+ }
outLen = strlen(outStr);
if(outLen >= sizeof(stMsgData->paramValue))
+ {
outLen = sizeof(stMsgData->paramValue) - 1;
-
+ }
memcpy(stMsgData->paramValue, outStr, outLen);
stMsgData->paramValue[outLen] = '\0';
stMsgData->paramLen = outLen;
-
-
- RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF,
- "[%s] Extracted profile map: %s\n", __FUNCTION__, outStr);
-
+ RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF, "[%s] Extracted profile map: %s\n", __FUNCTION__, outStr);
retStatus = OK;
CLEAN_UP:
@@ -4277,10 +4266,7 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
cJSON_Delete(filtered);
if(outStr) free(outStr);
- RDK_LOG((retStatus == OK) ? RDK_LOG_TRACE1 : RDK_LOG_ERROR,
- LOG_TR69HOSTIF, "[%s] Leaving with %s\n",
- __FUNCTION__, (retStatus == OK) ? "OK" : "NOK");
-
+ RDK_LOG((retStatus == OK) ? RDK_LOG_TRACE1 : RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with %s\n", __FUNCTION__, (retStatus == OK) ? "OK" : "NOK");
return retStatus;
}
From 33e2b50a19cbbba161675d3f711f2befc1c05562 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 11 Jul 2025 18:17:44 +0530
Subject: [PATCH 08/21] Update Device_DeviceInfo.cpp
---
src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index 808f1a1cd..8c2c5ac81 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4232,8 +4232,9 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
goto CLEAN_UP;
}
for(cJSON *sub = top->child; sub; sub = sub->next)
+ {
cJSON_AddItemToArray(arr, cJSON_CreateString(sub->string));
-
+ }
if(cJSON_GetArraySize(arr) > 0)
{
cJSON_AddItemToObject(filtered, top->string, arr);
From 5441b702ad40eb9523499670b9254ea3fcbda0cc Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Tue, 22 Jul 2025 16:25:34 +0530
Subject: [PATCH 09/21] Update Device_DeviceInfo.cpp
---
.../profiles/DeviceInfo/Device_DeviceInfo.cpp | 119 ++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index 8c2c5ac81..21a36d69b 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4165,6 +4165,124 @@ int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerI
return retVal;
}
+int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggergetProfileData(HOSTIF_MsgData_t *stMsgData)
+{
+ stMsgData->paramtype = hostIf_StringType;
+ int retStatus = NOK;
+
+ const char *filename = "/etc/rrd/remote_debugger.json";
+ FILE *fp = nullptr;
+ char *fileBuf = nullptr;
+ long fileSz = 0;
+ size_t bytesRead = 0;
+ cJSON *root = nullptr;
+ cJSON *filtered = nullptr;
+ char *outStr = nullptr;
+ size_t outLen = 0;
+
+ RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Entering …\n", __FUNCTION__);
+
+ fp = fopen(filename, "rb");
+ if (!fp) {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Cannot open %s\n", __FUNCTION__, filename);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ if (fseek(fp, 0L, SEEK_END) != 0) {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fseek failed\n", __FUNCTION__);
+ fclose(fp);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ fileSz = ftell(fp);
+ rewind(fp);
+ if (fileSz < 0) {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fileSz is negative, Returning....\n", __FUNCTION__);
+ fclose(fp);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ fileBuf = (char*)malloc((size_t)fileSz + 1);
+ if (!fileBuf) {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] malloc(%ld) failed\n", __FUNCTION__, fileSz + 1);
+ fclose(fp);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
+ fileBuf[bytesRead] = '\0';
+ fclose(fp); fp = nullptr;
+
+ root = cJSON_Parse(fileBuf);
+ if (!root) {
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] JSON parse error: %s\n", __FUNCTION__, cJSON_GetErrorPtr());
+ free(fileBuf);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ filtered = cJSON_CreateObject();
+ if (!filtered) {
+ free(fileBuf);
+ cJSON_Delete(root);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ for (cJSON *top = root->child; top; top = top->next) {
+ if (top->type != cJSON_Object) {
+ continue;
+ }
+ cJSON *arr = cJSON_CreateArray();
+ if (!arr) {
+ free(fileBuf);
+ cJSON_Delete(root);
+ cJSON_Delete(filtered);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+ for (cJSON *sub = top->child; sub; sub = sub->next) {
+ cJSON_AddItemToArray(arr, cJSON_CreateString(sub->string));
+ }
+ if (cJSON_GetArraySize(arr) > 0) {
+ cJSON_AddItemToObject(filtered, top->string, arr);
+ } else {
+ cJSON_Delete(arr);
+ }
+ }
+
+ outStr = cJSON_PrintUnformatted(filtered);
+ if (!outStr) {
+ free(fileBuf);
+ cJSON_Delete(root);
+ cJSON_Delete(filtered);
+ RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
+ return retStatus;
+ }
+
+ outLen = strlen(outStr);
+ if (outLen >= sizeof(stMsgData->paramValue)) {
+ outLen = sizeof(stMsgData->paramValue) - 1;
+ }
+ memcpy(stMsgData->paramValue, outStr, outLen);
+ stMsgData->paramValue[outLen] = '\0';
+ stMsgData->paramLen = outLen;
+ RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF, "[%s] Extracted profile map: %s\n", __FUNCTION__, outStr);
+ retStatus = OK;
+
+ free(fileBuf);
+ cJSON_Delete(root);
+ cJSON_Delete(filtered);
+ free(outStr);
+
+ RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Leaving with OK\n", __FUNCTION__);
+ return retStatus;
+}
+/*
int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggergetProfileData(HOSTIF_MsgData_t *stMsgData)
{
@@ -4331,6 +4449,7 @@ int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerW
return retVal;
}
+*/
#endif
int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RebootStopEnable(HOSTIF_MsgData_t *stMsgData)
From dc2505e06fca126353534a41c566625b4a30d850 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 25 Jul 2025 11:24:58 +0530
Subject: [PATCH 10/21] Update Device_DeviceInfo.cpp
---
src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index 21a36d69b..f92304be5 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4388,7 +4388,7 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
RDK_LOG((retStatus == OK) ? RDK_LOG_TRACE1 : RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with %s\n", __FUNCTION__, (retStatus == OK) ? "OK" : "NOK");
return retStatus;
}
-
+*/
int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerWebCfgData (HOSTIF_MsgData_t *stMsgData)
{
char *issueStr = NULL;
@@ -4449,7 +4449,6 @@ int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerW
return retVal;
}
-*/
#endif
int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RebootStopEnable(HOSTIF_MsgData_t *stMsgData)
From 5502c0c13c3f8687c172739ee852dd527e1afc34 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 25 Jul 2025 15:14:13 +0530
Subject: [PATCH 11/21] Update Device_DeviceInfo.cpp
---
.../profiles/DeviceInfo/Device_DeviceInfo.cpp | 106 ------------------
1 file changed, 106 deletions(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index f92304be5..e61796c8e 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4282,113 +4282,7 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Leaving with OK\n", __FUNCTION__);
return retStatus;
}
-/*
-int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggergetProfileData(HOSTIF_MsgData_t *stMsgData)
-{
-
- stMsgData->paramtype = hostIf_StringType;
- int retStatus = NOK;
-
- const char *filename = "/etc/rrd/remote_debugger.json";
- FILE *fp = nullptr;
- char *fileBuf = nullptr;
- long fileSz = 0;
- size_t bytesRead = 0;
- cJSON *root = nullptr;
- cJSON *filtered = nullptr;
- char *outStr = nullptr;
- size_t outLen = 0;
-
- RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Entering …\n", __FUNCTION__);
- fp = fopen(filename, "rb");
- if(!fp)
- {
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Cannot open %s\n", __FUNCTION__, filename);
- goto CLEAN_UP;
- }
- if(fseek(fp, 0L, SEEK_END) != 0)
- {
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fseek failed\n", __FUNCTION__);
- goto CLEAN_UP;
- }
- fileSz = ftell(fp);
- rewind(fp);
- fileBuf = (char*)malloc((size_t)fileSz + 1);
- if(!fileBuf)
- {
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] malloc(%ld) failed\n", __FUNCTION__, fileSz + 1);
- goto CLEAN_UP;
- }
- if(fileSz < 0 )
- {
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fileSz is being negative, Returning....\n", __FUNCTION__);
- goto CLEAN_UP;
- }
- bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
- fileBuf[bytesRead] = '\0';
- fclose(fp); fp = nullptr;
- root = cJSON_Parse(fileBuf);
- if(!root)
- {
- RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] JSON parse error: %s\n", __FUNCTION__, cJSON_GetErrorPtr());
- goto CLEAN_UP;
- }
- filtered = cJSON_CreateObject();
- if(!filtered)
- {
- goto CLEAN_UP;
- }
- for(cJSON *top = root->child; top; top = top->next)
- {
- if(top->type != cJSON_Object)
- {
- continue;
- }
- cJSON *arr = cJSON_CreateArray();
- if(!arr)
- {
- goto CLEAN_UP;
- }
- for(cJSON *sub = top->child; sub; sub = sub->next)
- {
- cJSON_AddItemToArray(arr, cJSON_CreateString(sub->string));
- }
- if(cJSON_GetArraySize(arr) > 0)
- {
- cJSON_AddItemToObject(filtered, top->string, arr);
- }
- else
- {
- cJSON_Delete(arr);
- }
- }
- outStr = cJSON_PrintUnformatted(filtered);
- if(!outStr)
- {
- goto CLEAN_UP;
- }
- outLen = strlen(outStr);
- if(outLen >= sizeof(stMsgData->paramValue))
- {
- outLen = sizeof(stMsgData->paramValue) - 1;
- }
- memcpy(stMsgData->paramValue, outStr, outLen);
- stMsgData->paramValue[outLen] = '\0';
- stMsgData->paramLen = outLen;
- RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF, "[%s] Extracted profile map: %s\n", __FUNCTION__, outStr);
- retStatus = OK;
-
-CLEAN_UP:
- if(fp) fclose(fp);
- if(fileBuf) free(fileBuf);
- cJSON_Delete(root);
- cJSON_Delete(filtered);
- if(outStr) free(outStr);
- RDK_LOG((retStatus == OK) ? RDK_LOG_TRACE1 : RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with %s\n", __FUNCTION__, (retStatus == OK) ? "OK" : "NOK");
- return retStatus;
-}
-*/
int hostIf_DeviceInfo::set_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerWebCfgData (HOSTIF_MsgData_t *stMsgData)
{
char *issueStr = NULL;
From 4104dc5c20319987f6c7e811c60fae6793bc92b9 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 25 Jul 2025 15:18:09 +0530
Subject: [PATCH 12/21] Update Device_DeviceInfo.cpp
---
.../profiles/DeviceInfo/Device_DeviceInfo.cpp | 55 ++++++++++---------
1 file changed, 29 insertions(+), 26 deletions(-)
diff --git a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
index e61796c8e..28dd3716e 100644
--- a/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
+++ b/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp
@@ -4169,7 +4169,6 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
{
stMsgData->paramtype = hostIf_StringType;
int retStatus = NOK;
-
const char *filename = "/etc/rrd/remote_debugger.json";
FILE *fp = nullptr;
char *fileBuf = nullptr;
@@ -4179,93 +4178,99 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
cJSON *filtered = nullptr;
char *outStr = nullptr;
size_t outLen = 0;
-
RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Entering …\n", __FUNCTION__);
-
fp = fopen(filename, "rb");
- if (!fp) {
+ if (!fp)
+ {
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Cannot open %s\n", __FUNCTION__, filename);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
-
- if (fseek(fp, 0L, SEEK_END) != 0) {
+ if (fseek(fp, 0L, SEEK_END) != 0)
+ {
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fseek failed\n", __FUNCTION__);
fclose(fp);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
-
fileSz = ftell(fp);
rewind(fp);
- if (fileSz < 0) {
+ if (fileSz < 0)
+ {
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] fileSz is negative, Returning....\n", __FUNCTION__);
fclose(fp);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
-
fileBuf = (char*)malloc((size_t)fileSz + 1);
- if (!fileBuf) {
+ if (!fileBuf)
+ {
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] malloc(%ld) failed\n", __FUNCTION__, fileSz + 1);
fclose(fp);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
-
bytesRead = fread(fileBuf, 1U, (size_t)fileSz, fp);
fileBuf[bytesRead] = '\0';
fclose(fp); fp = nullptr;
-
root = cJSON_Parse(fileBuf);
- if (!root) {
+ if (!root)
+ {
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] JSON parse error: %s\n", __FUNCTION__, cJSON_GetErrorPtr());
free(fileBuf);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
-
filtered = cJSON_CreateObject();
- if (!filtered) {
+ if (!filtered)
+ {
free(fileBuf);
cJSON_Delete(root);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
- for (cJSON *top = root->child; top; top = top->next) {
- if (top->type != cJSON_Object) {
+ for (cJSON *top = root->child; top; top = top->next)
+ {
+ if (top->type != cJSON_Object)
+ {
continue;
}
cJSON *arr = cJSON_CreateArray();
- if (!arr) {
+ if (!arr)
+ {
free(fileBuf);
cJSON_Delete(root);
cJSON_Delete(filtered);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
- for (cJSON *sub = top->child; sub; sub = sub->next) {
+ for (cJSON *sub = top->child; sub; sub = sub->next)
+ {
cJSON_AddItemToArray(arr, cJSON_CreateString(sub->string));
}
- if (cJSON_GetArraySize(arr) > 0) {
+ if (cJSON_GetArraySize(arr) > 0)
+ {
cJSON_AddItemToObject(filtered, top->string, arr);
- } else {
+ }
+ else
+ {
cJSON_Delete(arr);
}
}
outStr = cJSON_PrintUnformatted(filtered);
- if (!outStr) {
+ if (!outStr)
+ {
free(fileBuf);
cJSON_Delete(root);
cJSON_Delete(filtered);
RDK_LOG(RDK_LOG_ERROR, LOG_TR69HOSTIF, "[%s] Leaving with NOK\n", __FUNCTION__);
return retStatus;
}
-
outLen = strlen(outStr);
- if (outLen >= sizeof(stMsgData->paramValue)) {
+ if (outLen >= sizeof(stMsgData->paramValue))
+ {
outLen = sizeof(stMsgData->paramValue) - 1;
}
memcpy(stMsgData->paramValue, outStr, outLen);
@@ -4273,12 +4278,10 @@ int hostIf_DeviceInfo::get_Device_DeviceInfo_X_RDKCENTRAL_COM_RDKRemoteDebuggerg
stMsgData->paramLen = outLen;
RDK_LOG(RDK_LOG_INFO, LOG_TR69HOSTIF, "[%s] Extracted profile map: %s\n", __FUNCTION__, outStr);
retStatus = OK;
-
free(fileBuf);
cJSON_Delete(root);
cJSON_Delete(filtered);
free(outStr);
-
RDK_LOG(RDK_LOG_TRACE1, LOG_TR69HOSTIF, "[%s] Leaving with OK\n", __FUNCTION__);
return retStatus;
}
From 1b63a82935bcb4a9d67086f712b6ba4fa67acddc Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 22 Aug 2025 15:03:38 +0530
Subject: [PATCH 13/21] Update webpa_parameter.cpp
---
src/hostif/parodusClient/pal/webpa_parameter.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index 7d9856225..8218cf513 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -38,7 +38,7 @@
/* Function Prototypes */
/*----------------------------------------------------------------------------*/
static WDMP_STATUS GetParamInfo (const char *pParameterName, param_t ***parametervalPtrPtr, int *paramCountPtr,int paramIndex);
-static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam);
+static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam, DataModelParam *dmParam);
int isWildCardParam(const char *paramName);
static void converttohostIfType(char *ParamDataType,HostIf_ParamType_t* pParamType);
static void converttoWalType(HostIf_ParamType_t paramType,WAL_DATA_TYPE* pwalType);
@@ -358,7 +358,7 @@ static WDMP_STATUS GetParamInfo (const char *pParameterName, param_t ***paramete
(*parametervalPtrPtr)[index][wc_cnt].value = NULL;
// Convert Param.paramtype to ParamVal.type
- getRet = get_ParamValues_tr69hostIf (&Param);
+ getRet = get_ParamValues_tr69hostIf (&Param, NULL);
// Fill Only if we can able to get Proper value
if(WDMP_SUCCESS == getRet)
{
@@ -441,7 +441,7 @@ static WDMP_STATUS GetParamInfo (const char *pParameterName, param_t ***paramete
}
freeDataModelParam(dmParam);
Param.instanceNum = 0;
- ret = get_ParamValues_tr69hostIf (&Param);
+ ret = get_ParamValues_tr69hostIf (&Param, &dmParam);
if (ret == WDMP_SUCCESS)
{
int iParamValSize = MAX_PARAM_LENGTH;
@@ -652,7 +652,7 @@ static WAL_STATUS SetParamInfo(ParamVal paramVal, char * transactionID)
/**
* generic Api for get HostIf parameters
**/
-static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam)
+static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam, DataModelParam *dmParam)
{
int status = -1;
ptrParam->reqType = HOSTIF_GET;
@@ -660,6 +660,10 @@ static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam)
status = hostIf_GetMsgHandler(ptrParam);
if(status != 0) {
+ if (dmParam->defaultValue)
+ {
+ retStatus = WDMP_SUCCESS;
+ }
RDK_LOG(RDK_LOG_ERROR,LOG_PARODUS_IF,"[%s:%s:%d] Error in Get Message Handler : %d\n", __FILE__, __FUNCTION__, __LINE__, status);
retStatus =(WDMP_STATUS) convertFaultCodeToWalStatus(ptrParam->faultCode); // returning appropriate fault code for get
RDK_LOG(RDK_LOG_DEBUG,LOG_PARODUS_IF,"[%s:%d] return status of fault code: %d\n", __FUNCTION__, __LINE__, retStatus);
From 0738d8368cc86cdae180a5f58389b4a978036f1d Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 22 Aug 2025 21:15:23 +0530
Subject: [PATCH 14/21] Update webpa_parameter.cpp
---
src/hostif/parodusClient/pal/webpa_parameter.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index 8218cf513..002a40afe 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -663,6 +663,8 @@ static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam, DataMo
if (dmParam->defaultValue)
{
retStatus = WDMP_SUCCESS;
+ RDK_LOG(RDK_LOG_DEBUG,LOG_PARODUS_IF,"[%s:%d] return status success - inside if check : %d\n", __FUNCTION__, __LINE__, retStatus);
+ return retStatus;
}
RDK_LOG(RDK_LOG_ERROR,LOG_PARODUS_IF,"[%s:%s:%d] Error in Get Message Handler : %d\n", __FILE__, __FUNCTION__, __LINE__, status);
retStatus =(WDMP_STATUS) convertFaultCodeToWalStatus(ptrParam->faultCode); // returning appropriate fault code for get
From 2b231428259af6633c882d5336fea8d4972e986b Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Fri, 22 Aug 2025 21:23:47 +0530
Subject: [PATCH 15/21] Update webpa_parameter.cpp
---
src/hostif/parodusClient/pal/webpa_parameter.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index 002a40afe..a92873eb5 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -439,9 +439,9 @@ static WDMP_STATUS GetParamInfo (const char *pParameterName, param_t ***paramete
{
converttohostIfType (dmParam.dataType, &(Param.paramtype)); //CID:18170 - FORWARD NULL
}
- freeDataModelParam(dmParam);
Param.instanceNum = 0;
ret = get_ParamValues_tr69hostIf (&Param, &dmParam);
+ freeDataModelParam(dmParam);
if (ret == WDMP_SUCCESS)
{
int iParamValSize = MAX_PARAM_LENGTH;
From 24f28b2e5e8086a5e40b97342292a04ae361ec35 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Sat, 23 Aug 2025 21:06:48 +0530
Subject: [PATCH 16/21] Update webpa_parameter.cpp
---
src/hostif/parodusClient/pal/webpa_parameter.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index a92873eb5..3586cea08 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -663,8 +663,8 @@ static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam, DataMo
if (dmParam->defaultValue)
{
retStatus = WDMP_SUCCESS;
- RDK_LOG(RDK_LOG_DEBUG,LOG_PARODUS_IF,"[%s:%d] return status success - inside if check : %d\n", __FUNCTION__, __LINE__, retStatus);
- return retStatus;
+ RDK_LOG(RDK_LOG_DEBUG,LOG_PARODUS_IF,"[%s:%d] Default value present in datamodel : %d\n", __FUNCTION__, __LINE__, dmParam->defaultValue);
+ return WDMP_SUCCESS;
}
RDK_LOG(RDK_LOG_ERROR,LOG_PARODUS_IF,"[%s:%s:%d] Error in Get Message Handler : %d\n", __FILE__, __FUNCTION__, __LINE__, status);
retStatus =(WDMP_STATUS) convertFaultCodeToWalStatus(ptrParam->faultCode); // returning appropriate fault code for get
From 137d931dbbcbb30061d4de78d23f5aa00930f265 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Sat, 23 Aug 2025 23:07:20 +0530
Subject: [PATCH 17/21] Update webpa_parameter.cpp
---
src/hostif/parodusClient/pal/webpa_parameter.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index 3586cea08..0f57b2dcb 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -661,9 +661,7 @@ static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam, DataMo
if(status != 0) {
if (dmParam->defaultValue)
- {
- retStatus = WDMP_SUCCESS;
- RDK_LOG(RDK_LOG_DEBUG,LOG_PARODUS_IF,"[%s:%d] Default value present in datamodel : %d\n", __FUNCTION__, __LINE__, dmParam->defaultValue);
+ {
return WDMP_SUCCESS;
}
RDK_LOG(RDK_LOG_ERROR,LOG_PARODUS_IF,"[%s:%s:%d] Error in Get Message Handler : %d\n", __FILE__, __FUNCTION__, __LINE__, status);
From 8e011afa24cd7d56ef21ca1de82799971b65dc73 Mon Sep 17 00:00:00 2001
From: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com>
Date: Tue, 26 Aug 2025 09:53:47 +0530
Subject: [PATCH 18/21] Update webpa_parameter.cpp
---
src/hostif/parodusClient/pal/webpa_parameter.cpp | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index 0f57b2dcb..36762830e 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -661,7 +661,9 @@ static WDMP_STATUS get_ParamValues_tr69hostIf(HOSTIF_MsgData_t *ptrParam, DataMo
if(status != 0) {
if (dmParam->defaultValue)
- {
+ {
+ strncpy(ptrParam->paramValue, dmParam->defaultValue, MAX_PARAM_LENGTH - 1);
+ ptrParam->paramValue[MAX_PARAM_LENGTH - 1] = '\0';
return WDMP_SUCCESS;
}
RDK_LOG(RDK_LOG_ERROR,LOG_PARODUS_IF,"[%s:%s:%d] Error in Get Message Handler : %d\n", __FILE__, __FUNCTION__, __LINE__, status);
From b112be6f22ab852b37604562d3a4341d94160cdb Mon Sep 17 00:00:00 2001
From: Venkata Bojja
Date: Wed, 27 Aug 2025 13:41:58 -0400
Subject: [PATCH 19/21] 1.2.4 release changelog updates
---
CHANGELOG.md | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5c34d8147..25acc72d8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,8 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
+#### [1.2.4](https://github.com/rdkcentral/tr69hostif/compare/1.2.3...1.2.4)
+
+- RDKEMW-4759 - Review and Analyze the RRD Static Profiles for RDK devices [`#198`](https://github.com/rdkcentral/tr69hostif/pull/198)
+- RDKEMW-7135 : Gamepad RFC is not enabled by default [`#228`](https://github.com/rdkcentral/tr69hostif/pull/228)
+- RDKTV-38130-[RDKE_Trials][8.2p2s2]: Increase in "tr69hostif" crash with function "hostIf_WiFi_SSID::get_Device_WiFi_SSID_Fields" and "81598460" fingerprint [`#223`](https://github.com/rdkcentral/tr69hostif/pull/223)
+- Fix tr69hostif native build failure [`#232`](https://github.com/rdkcentral/tr69hostif/pull/232)
+- Rebase [`#209`](https://github.com/rdkcentral/tr69hostif/pull/209)
+- Merge tag '1.2.3' into develop [`84c45dd`](https://github.com/rdkcentral/tr69hostif/commit/84c45dd1c8bac75d25f06fbbc14575c02d8a153a)
+- Update Device_DeviceInfo.cpp [`5441b70`](https://github.com/rdkcentral/tr69hostif/commit/5441b702ad40eb9523499670b9254ea3fcbda0cc)
+- Update Device_DeviceInfo.cpp [`cda900d`](https://github.com/rdkcentral/tr69hostif/commit/cda900d6d35170fcfe0c3ac8382271575eba077b)
+
#### [1.2.3](https://github.com/rdkcentral/tr69hostif/compare/1.2.2...1.2.3)
+> 21 August 2025
+
- RDK-56291 - [RDKE] Increase L2 Test Coverage For Remote Debugger : Target 80% [ Phase 2 ] [`#227`](https://github.com/rdkcentral/tr69hostif/pull/227)
- [RDKEMW-5582] -[RDKE] tr69hostif.log contains any garbage data for the paramValue field [`#219`](https://github.com/rdkcentral/tr69hostif/pull/219)
- RDKEMW-6520: tr69hostif service starts before iarmbusd [`#218`](https://github.com/rdkcentral/tr69hostif/pull/218)
From 8eb32e51eb5c9512209d3d12f9ddc42aa8d369a5 Mon Sep 17 00:00:00 2001
From: madhubabutt <114217841+madhubabutt@users.noreply.github.com>
Date: Thu, 28 Aug 2025 21:13:17 +0530
Subject: [PATCH 20/21] RDK-57737 [ tr69hostif ] : L1 Functional Coverage from
31.2% to 75-80% (#225)
* RDK-57737 [ tr69hostif ] : L1 Functional Coverage from 31.2% to 75-80%
* Update Device_DeviceInfo.cpp
---------
Co-authored-by: mtirum011
---
dependent_rdk_pkg_installer.sh | 111 ++
run_ut.sh | 83 +-
src/configure.ac | 11 +-
.../httpserver/include/XrdkCentralComRFCVar.h | 8 +
src/hostif/httpserver/src/gtest/Makefile.am | 48 +
.../httpserver/src/gtest/gtest_httpserver.cpp | 393 ++++
src/hostif/httpserver/src/request_handler.cpp | 33 +
src/hostif/include/hostIf_utils.h | 4 +-
src/hostif/parodusClient/gtest/Makefile.am | 18 +-
src/hostif/parodusClient/gtest/dm_test.cpp | 510 +++++
src/hostif/parodusClient/pal/libpd.cpp | 12 +
.../parodusClient/pal/webpa_adapter.cpp | 12 +
src/hostif/parodusClient/pal/webpa_adapter.h | 4 +
.../parodusClient/pal/webpa_attribute.cpp | 24 +
.../parodusClient/pal/webpa_notification.cpp | 7 +
.../parodusClient/pal/webpa_parameter.cpp | 40 +
.../startParodus/startParodus.cpp | 2 +
.../parodusClient/startParodus/startParodus.h | 35 +
src/hostif/parodusClient/waldb/waldb.h | 8 +
.../profiles/DHCPv4/Device_DHCPv4_Client.cpp | 3 +-
.../profiles/DHCPv4/Device_DHCPv4_Client.h | 11 +-
src/hostif/profiles/DHCPv4/gtest/Makefile.am | 49 +
.../profiles/DHCPv4/gtest/gtest_dhcpv4.cpp | 100 +
src/hostif/profiles/Device/gtest/Makefile.am | 49 +
.../profiles/Device/gtest/gtest_device.cpp | 176 ++
src/hostif/profiles/Device/x_rdk_profile.h | 11 +
.../profiles/DeviceInfo/Device_DeviceInfo.cpp | 18 +-
.../profiles/DeviceInfo/Device_DeviceInfo.h | 35 +
.../Device_DeviceInfo_ProcessStatus.h | 8 +
.../DeviceInfo/XrdkCentralComBSStore.h | 18 +
.../DeviceInfo/XrdkCentralComBSStoreJournal.h | 10 +
.../profiles/DeviceInfo/XrdkCentralComRFC.h | 8 +
.../DeviceInfo/XrdkCentralComRFCStore.h | 4 +
.../profiles/DeviceInfo/gtest/Makefile.am | 4 +-
.../profiles/DeviceInfo/gtest/gtest_main.cpp | 1639 ++++++++++++++++-
.../Ethernet/Device_Ethernet_Interface.cpp | 6 +
.../profiles/Ethernet/gtest/Makefile.am | 50 +
.../Ethernet/gtest/gtest_ethernet.cpp | 410 +++++
src/hostif/profiles/Time/gtest/Makefile.am | 49 +
src/hostif/profiles/Time/gtest/gtest_time.cpp | 138 ++
src/hostif/src/gtest/Makefile.am | 49 +
src/hostif/src/gtest/gtest_src.cpp | 264 +++
src/integrationtest/conf/rfcVariable.ini | 2 +
src/unittest/stubs/dm_stubs.cpp | 6 +-
src/unittest/stubs/ds/aspectRatio.hpp | 10 +-
src/unittest/stubs/ds/audioEncoding.hpp | 14 +-
src/unittest/stubs/ds/audioOutputPort.hpp | 59 +-
src/unittest/stubs/ds/audioStereoMode.hpp | 6 +-
src/unittest/stubs/ds/frameRate.hpp | 8 +-
src/unittest/stubs/ds/host.hpp | 23 +-
src/unittest/stubs/ds/libprocps.cpp | 19 +
src/unittest/stubs/ds/manager.hpp | 4 +-
src/unittest/stubs/ds/pixelResolution.hpp | 4 +-
src/unittest/stubs/ds/videoDFC.hpp | 4 +-
src/unittest/stubs/ds/videoDevice.hpp | 39 +-
src/unittest/stubs/ds/videoOutputPort.hpp | 54 +-
src/unittest/stubs/ds/videoOutputPortType.hpp | 12 +-
src/unittest/stubs/ds/videoResolution.hpp | 25 +-
src/unittest/stubs/file_writer.cpp | 65 +
src/unittest/stubs/file_writer.h | 22 +
src/unittest/stubs/libparodus.h | 212 +++
src/unittest/stubs/libparodus_log.h | 84 +
src/unittest/stubs/rbus/include/rbus.h | 13 +-
.../stubs/rbus/include/rbus_property.h | 20 +-
src/unittest/stubs/rbus/include/rbus_value.h | 5 +-
src/unittest/stubs/rdk_debug.h | 1 +
src/unittest/stubs/rfcapi.h | 11 +-
src/unittest/stubs/tr181store.ini | 8 +
src/unittest/stubs/wrp-c.h | 298 +++
69 files changed, 5381 insertions(+), 119 deletions(-)
create mode 100644 dependent_rdk_pkg_installer.sh
create mode 100644 src/hostif/httpserver/src/gtest/Makefile.am
create mode 100644 src/hostif/httpserver/src/gtest/gtest_httpserver.cpp
create mode 100644 src/hostif/parodusClient/startParodus/startParodus.h
create mode 100644 src/hostif/profiles/DHCPv4/gtest/Makefile.am
create mode 100644 src/hostif/profiles/DHCPv4/gtest/gtest_dhcpv4.cpp
create mode 100644 src/hostif/profiles/Device/gtest/Makefile.am
create mode 100644 src/hostif/profiles/Device/gtest/gtest_device.cpp
create mode 100644 src/hostif/profiles/Ethernet/gtest/Makefile.am
create mode 100644 src/hostif/profiles/Ethernet/gtest/gtest_ethernet.cpp
create mode 100644 src/hostif/profiles/Time/gtest/Makefile.am
create mode 100644 src/hostif/profiles/Time/gtest/gtest_time.cpp
create mode 100644 src/hostif/src/gtest/Makefile.am
create mode 100644 src/hostif/src/gtest/gtest_src.cpp
create mode 100644 src/integrationtest/conf/rfcVariable.ini
create mode 100644 src/unittest/stubs/ds/libprocps.cpp
create mode 100644 src/unittest/stubs/file_writer.cpp
create mode 100644 src/unittest/stubs/file_writer.h
create mode 100644 src/unittest/stubs/libparodus.h
create mode 100644 src/unittest/stubs/libparodus_log.h
create mode 100644 src/unittest/stubs/wrp-c.h
diff --git a/dependent_rdk_pkg_installer.sh b/dependent_rdk_pkg_installer.sh
new file mode 100644
index 000000000..d4bc1afd4
--- /dev/null
+++ b/dependent_rdk_pkg_installer.sh
@@ -0,0 +1,111 @@
+##########################################################################
+# If not stated otherwise in this file or this component's LICENSE
+# file the following copyright and licenses apply:
+#
+# Copyright 2024 RDK Management
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##########################################################################
+
+# Clone and build rbus
+export RBUS_ROOT=/usr
+export RBUS_INSTALL_DIR=${RBUS_ROOT}/local
+mkdir -p $RBUS_INSTALL_DIR
+cd $RBUS_ROOT
+
+
+WORKDIR=/opt/WORKDIR
+mkdir -p $WORKDIR
+
+cd $WORKDIR
+git clone https://github.com/xmidt-org/trower-base64.git
+cd trower-base64
+meson setup build
+ninja -C build
+ninja -C build install
+cd $WORKDIR
+rm -rf trower-base64
+
+# cJson flavor used in RDK stack
+cd $WORKDIR
+git clone https://github.com/DaveGamble/cJSON.git
+cd cJSON
+mkdir build
+cd build
+cmake ..
+make && make install
+cd $WORKDIR
+rm -rf cJSON
+
+# Include WDMP package
+cd $WORKDIR
+git clone https://github.com/xmidt-org/wdmp-c.git
+cd wdmp-c
+sed -i '/WDMP_ERR_SESSION_IN_PROGRESS/a\ WDMP_ERR_INTERNAL_ERROR,\n WDMP_ERR_DEFAULT_VALUE,' src/wdmp-c.h
+cmake -H. -Bbuild -DBUILD_FOR_DESKTOP=ON -DCMAKE_BUILD_TYPE=Debug
+make -C build && make -C build install
+cd $WORKDIR
+rm -rf wdmp-c
+
+# Install dependencies of libparodus
+cd $WORKDIR
+git clone https://github.com/nanomsg/nanomsg.git
+cd nanomsg
+mkdir build
+cd build
+cmake ..
+cmake --build .
+cmake --build . --target install
+cd $WORKDIR
+rm -rf nanomsg
+
+git clone https://github.com/xmidt-org/cimplog.git
+cd cimplog
+git checkout 8a5fb3c2f182241d17f5342bea5b7688c28cd1fd
+mkdir build
+cd build
+cmake ..
+make && make install
+cd $WORKDIR
+rm -rf cimplog
+
+
+cd $WORKDIR
+git clone https://github.com/xmidt-org/wrp-c.git
+cd wrp-c
+git checkout 9587e8db33dbbfcd9b78ef66cc2eaf16dfb9afcf
+# replace 7a98138f27f27290e680bf8fbf1f8d1b089bf138 with 445880108a1d171f755ff6ac77e03fbebbb23729 in CMakeLists.txt
+# Message pack revision used in libparadous is not buildable with latest gcc versions
+sed -i 's/7a98138f27f27290e680bf8fbf1f8d1b089bf138/445880108a1d171f755ff6ac77e03fbebbb23729/g' CMakeLists.txt
+mkdir build
+cd build
+cmake ..
+make && make install
+cd $WORKDIR
+rm -rf wrp-c
+
+cd $WORKDIR
+git clone https://github.com/xmidt-org/libparodus.git
+cd libparodus
+# replace 7a98138f27f27290e680bf8fbf1f8d1b089bf138 with 445880108a1d171f755ff6ac77e03fbebbb23729 in CMakeLists.txt
+# Message pack revision used in libparadous is not buildable with latest gcc versions
+sed -i 's/7a98138f27f27290e680bf8fbf1f8d1b089bf138/445880108a1d171f755ff6ac77e03fbebbb23729/g' CMakeLists.txt
+mkdir build
+cd build
+cmake ..
+make && make install
+cd $WORKDIR
+rm -rf libparodus
+
+
+#rtrouted -f -l DEBUG
diff --git a/run_ut.sh b/run_ut.sh
index 92abdfec0..880235a74 100644
--- a/run_ut.sh
+++ b/run_ut.sh
@@ -18,7 +18,20 @@
# SPDX-License-Identifier: Apache-2.0
############################################################################
-
+WORKDIR=`pwd`
+sh dependent_rdk_pkg_installer.sh
+export ROOT=/usr
+
+cd $ROOT
+rm -rf remote_debugger
+rm -rf rdk-halif-device_settings
+rm -rf rdkvhal-devicesettings-raspberrypi4
+git clone https://github.com/rdkcentral/remote_debugger.git
+git clone https://github.com/rdkcentral/rdk-halif-device_settings.git
+git clone https://github.com/rdkcentral/rdkvhal-devicesettings-raspberrypi4.git
+
+cd $WORKDIR
+ls -l /usr/local/include/libparodus/
ENABLE_COV=false
if [ "x$1" = "x--enable-cov" ]; then
@@ -32,6 +45,9 @@ fi
apt-get update
apt-get -y install libtinyxml2-dev
apt-get -y install libsoup-3.0-dev
+apt-get -y install libprocps-dev
+apt-get -y install libnanomsg-dev
+apt-get -y install iproute2
sed '/<\/model>/d; /<\/dm:document>/d' ./src/hostif/parodusClient/waldb/data-model/data-model-tv.xml > ./src/hostif/parodusClient/waldb/data-model/data-model-merged.xml
sed '/> ./src/hostif/parodusClient/waldb/data-model/data-model-merged.xml
@@ -43,12 +59,25 @@ cp ./src/unittest/stubs/rfcdefaults.ini /tmp/rfcdefaults.ini
mkdir /opt/secure
mkdir /opt/secure/RFC
+mkdir -p /opt/secure/reboot/
+mkdir -p /opt/www/authService/
+mkdir -p /tmp/webpa
+mkdir -p /opt/persistent/
+mkdir -p /etc/rfcdefaults
+mkdir -p /etc/apparmor.d
cp ./src/unittest/stubs/tr181store.ini /opt/secure/RFC/tr181store.ini
+cp ./src/integrationtest/conf/bootstrap.ini /opt/secure/RFC/
+cp ./src/integrationtest/conf/rfcVariable.ini /opt/secure/RFC/
cp partners_defaults.json /etc/partners_defaults.json
cp ./src/unittest/stubs/partners_defaults_device.json /etc/partners_defaults_device.json
cp ./src/unittest/stubs/fwdnldstatus.txt /opt/fwdnldstatus.txt
+touch /tmp/timeReceivedNTP
+touch /tmp/webpa/start_time
+touch /opt/persistent/firstNtpTime
+
+
-export TOP_DIR=`pwd`
+export TOP_DIR=$WORKDIR
cd ./src/
automake --add-missing
@@ -64,13 +93,59 @@ echo "TOP_DIR = $TOP_DIR"
echo "**** Compiling data model gtest ****"
cd $TOP_DIR/src/hostif/parodusClient/gtest
rm dm_gtest
+sed -i '/getCurrentTime/,/^ *}/d' ../../src/hostIf_utils.cpp
make
./dm_gtest
echo "********************"
+echo "**** Compiling httpserver gtest ****"
+cd $TOP_DIR/src/hostif/httpserver/src/gtest
+rm httpserver_gtest
+sed -i '$a void getCurrentTime(struct timespec *timer)\n{\n clock_gettime(CLOCK_REALTIME, timer);\n}' ../../../src/hostIf_utils.cpp
+make clean
+make
+./httpserver_gtest
+echo "********************"
+
+echo "**** Compiling src gtest ****"
+cd $TOP_DIR/src/hostif/src/gtest
+rm src_gtest
+make clean
+make
+./src_gtest
+echo "********************"
+
+echo "**** Compiling DHCPv4 gtest ****"
+cd $TOP_DIR/src/hostif/profiles/DHCPv4/gtest
+rm dhcpv4_gtest
+make
+./dhcpv4_gtest
+echo "********************"
+
+echo "**** Compiling Device gtest ****"
+cd $TOP_DIR/src/hostif/profiles/Device/gtest
+rm device_gtest
+make
+./device_gtest
+echo "********************"
+
+echo "**** Compiling Ethernet gtest ****"
+cd $TOP_DIR/src/hostif/profiles/Ethernet/gtest
+rm ethernet_gtest
+make
+./ethernet_gtest
+echo "********************"
+
+echo "**** Compiling Time gtest ****"
+cd $TOP_DIR/src/hostif/profiles/Time/gtest
+rm time_gtest
+make
+./time_gtest
+echo "********************"
+
echo "**** Compiling DeviceInfo gtest ****"
cd $TOP_DIR/src/hostif/profiles/DeviceInfo/gtest
-rm devieInfo_gtest
+rm devieInfo_gtest /opt/www/authService/partnerId3.dat
make
./devieInfo_gtest
echo "********************"
@@ -80,7 +155,7 @@ cd $TOP_DIR
if [ "$ENABLE_COV" = true ]; then
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/gtest/*' '*/mocks/*' --output-file filtered.info
- lcov --extract filtered.info '*/src/hostif*' --output-file tr69hostif_coverage.info
+ lcov --extract filtered.info '*/src/hostif/httpserver/*' '*/src/hostif/parodusClient/*' '*/src/hostif/src/*' '*/src/hostif/profiles/DHCPv4/*' '*/src/hostif/profiles/Device/*' '*/src/hostif/profiles/DeviceInfo/*' '*/src/hostif/profiles/Ethernet/*' '*/src/hostif/profiles/Time/*' --output-file tr69hostif_coverage.info
lcov --list tr69hostif_coverage.info
fi
diff --git a/src/configure.ac b/src/configure.ac
index e704399ee..d62a94a95 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -69,8 +69,15 @@ AC_SUBST(T2_EVENT_FLAG)
# Generate the Makefile
AC_CONFIG_FILES([
- hostif/parodusClient/gtest/Makefile \
- hostif/profiles/DeviceInfo/gtest/Makefile])
+ hostif/parodusClient/gtest/Makefile
+ hostif/httpserver/src/gtest/Makefile
+ hostif/src/gtest/Makefile
+ hostif/profiles/DHCPv4/gtest/Makefile
+ hostif/profiles/Device/gtest/Makefile
+ hostif/profiles/Ethernet/gtest/Makefile
+ hostif/profiles/Time/gtest/Makefile
+ hostif/profiles/DeviceInfo/gtest/Makefile
+ ])
# Generate the configure script
AC_OUTPUT
diff --git a/src/hostif/httpserver/include/XrdkCentralComRFCVar.h b/src/hostif/httpserver/include/XrdkCentralComRFCVar.h
index 590ba90a8..0fdd1ce10 100644
--- a/src/hostif/httpserver/include/XrdkCentralComRFCVar.h
+++ b/src/hostif/httpserver/include/XrdkCentralComRFCVar.h
@@ -23,6 +23,10 @@
#include
#include
+#if defined(GTEST_ENABLE)
+#include
+#endif
+
using namespace std;
#define XRFC_VAR_STORE_RELOADCACHE "RFC_CONTROL_RELOADCACHE"
@@ -49,6 +53,10 @@ class XRFCVarStore
void initRFCVarFileName();
bool loadRFCVarIntoCache();
+#if defined(GTEST_ENABLE)
+ FRIEND_TEST(httpserverTest, initRFCVarFileName);
+ FRIEND_TEST(httpserverTest, loadRFCVarIntoCache);
+#endif
};
#endif // XRDKCENTRALCOMRFCVARSTORE_H
diff --git a/src/hostif/httpserver/src/gtest/Makefile.am b/src/hostif/httpserver/src/gtest/Makefile.am
new file mode 100644
index 000000000..ebdd454f0
--- /dev/null
+++ b/src/hostif/httpserver/src/gtest/Makefile.am
@@ -0,0 +1,48 @@
+################################################################################
+# Copyright 2024 Comcast Cable Communications Management, LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+################################################################################
+
+AUTOMAKE_OPTIONS = subdir-objects
+# Define the program name and the source files
+bin_PROGRAMS = httpserver_gtest
+
+# Define the include directories
+COMMON_CPPFLAGS = -std=c++11 -DGTEST_ENABLE -DPARODUS -I/usr/include -I/usr/include/cjson -I$(TOP_DIR)/src/hostif/include -I$(TOP_DIR)/src/hostif/profiles/DeviceInfo -I$(TOP_DIR)/src/unittest/stubs -I$(TOP_DIR)/src/unittest/stubs/ds -I$(TOP_DIR)/src/unittest/stubs/rbus/include -I$(TOP_DIR)/src/hostif/handlers/include -I$(TOP_DIR)/src/hostif/parodusClient/pal -I$(TOP_DIR)/src/hostif/parodusClient/waldb -I$(TOP_DIR)/src/hostif/httpserver/include -I$(TOP_DIR)/src/hostif/handlers/src -I/usr/include/rbus -I/usr/local/include/rbus -Isrc/unittest/stubs/rbus/include/
+
+if LIBSOUP3_ENABLE
+COMMON_CPPFLAGS += -I/usr/include/libsoup-3.0 -DLIBSOUP3_ENABLE
+else
+COMMON_CPPFLAGS += -I/usr/include/libsoup-2.4
+endif
+
+# Define the libraries to link against
+COMMON_LDADD = -lgtest -lgtest_main -lgmock_main -lgmock -lgcov $(GLIB_LIBS) -ltinyxml2 -lcjson -lcurl -lglib-2.0
+
+if LIBSOUP3_ENABLE
+COMMON_LDADD += -lsoup-3.0
+endif
+
+
+# Define the compiler flags
+COMMON_CXXFLAGS = -frtti $(GLIB_CFLAGS) $(SOUP_LIBS) -fprofile-arcs -ftest-coverage
+
+httpserver_gtest_SOURCES = $(TOP_DIR)/src/hostif/src/hostIf_utils.cpp $(TOP_DIR)/src/hostif/src/IniFile.cpp $(TOP_DIR)/src/unittest/stubs/secure_wrapper.c $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComRFCStore.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComRFC.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComBSStore.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComBSStoreJournal.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_NotificationHandler.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/webpa_notification.cpp $(TOP_DIR)/src/unittest/stubs/dm_stubs.cpp $(TOP_DIR)/src/hostif/parodusClient/waldb/waldb.cpp $(TOP_DIR)/src/unittest/stubs/wdmp-c.c $(TOP_DIR)/src/unittest/stubs/wdmp_internal.c $(TOP_DIR)/src/hostif/httpserver/src/http_server.cpp $(TOP_DIR)/src/hostif/httpserver/src/request_handler.cpp $(TOP_DIR)/src/hostif/httpserver/src/XrdkCentralComRFCVar.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo_Processor.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo_ProcessStatus.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/webpa_parameter.cpp $(TOP_DIR)/src/unittest/stubs/file_writer.cpp $(TOP_DIR)/src/hostif/httpserver/src/gtest/gtest_httpserver.cpp
+
+# Apply common properties to each program
+httpserver_gtest_CPPFLAGS = $(COMMON_CPPFLAGS)
+httpserver_gtest_CXXFLAGS = $(COMMON_CXXFLAGS)
+httpserver_gtest_LDADD = $(COMMON_LDADD)
diff --git a/src/hostif/httpserver/src/gtest/gtest_httpserver.cpp b/src/hostif/httpserver/src/gtest/gtest_httpserver.cpp
new file mode 100644
index 000000000..e21e11197
--- /dev/null
+++ b/src/hostif/httpserver/src/gtest/gtest_httpserver.cpp
@@ -0,0 +1,393 @@
+#include
+#include
+#include
+#include "hostIf_tr69ReqHandler.h"
+#include "hostIf_utils.h"
+#include "XrdkCentralComRFCStore.h"
+#include "XrdkCentralComBSStore.h"
+#include "XrdkCentralComBSStoreJournal.h"
+#include "Device_DeviceInfo_Processor.h"
+#include "Device_DeviceInfo_ProcessStatus.h"
+#include "XrdkCentralComRFCVar.h"
+#include "request_handler.h"
+#include "IniFile.h"
+#include "hostIf_utils.h"
+#include "hostIf_main.h"
+#include "webpa_notification.h"
+#include "webpa_parameter.h"
+#include "rbus_value.h"
+
+#include "rdk_debug.h"
+#include "waldb.h"
+#include "file_writer.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#include
+#include
+#ifdef __cplusplus
+}
+#endif
+
+#include "Device_DeviceInfo.h"
+
+#include
+#include "cJSON.h"
+
+#include
+#include
+
+#define GTEST_DEFAULT_RESULT_FILEPATH "/tmp/Gtest_Report/"
+#define GTEST_DEFAULT_RESULT_FILENAME "hostif_gtest_report.json"
+#define GTEST_REPORT_FILEPATH_SIZE 128
+
+using namespace std;
+
+XRFCStore* m_rfcStore;
+XBSStore* m_bsStore;
+XBSStoreJournal* m_bsStoreJournal;
+XRFCVarStore* m_varStore;
+
+std::mutex mtx_httpServerThreadDone;
+std::condition_variable cv_httpServerThreadDone;
+bool httpServerThreadDone = false;
+GThread *HTTPServerThread = NULL;
+char *HTTPServerName = (char *)"HTTPServerThread";
+GError *httpError = NULL;
+T_ARGLIST argList = {{'\0'}, 0};
+
+#ifdef GTEST_ENABLE
+extern DATA_TYPE (*getWdmpDataTypeFunc())(char * );
+extern HostIf_ParamType_t (*getHostIfParamTypeFunc())(DATA_TYPE wdmpDataType);
+bool (*validateParamValueFunc())(const string ¶mValue, HostIf_ParamType_t dataType);
+WDMP_STATUS (*handleRFCRequestFunc())(REQ_TYPE reqType, param_t *param);
+WDMP_STATUS (*invokeHostIfAPIFunc())(REQ_TYPE reqType, param_t *param, HostIf_Source_Type_t bsUpdate, const char *pcCallerID);
+WDMP_STATUS (*validateAgainstDataModelFunc())(REQ_TYPE reqType, char* paramName, const char* paramValue, DATA_TYPE *dataType, char **defaultValue, HostIf_Source_Type_t *bsUpdate);
+#endif
+
+TEST(httpserverTest,initRFCVarFileName){
+ m_varStore=XRFCVarStore::getInstance();
+ if(m_varStore)
+ {
+ m_varStore->initRFCVarFileName();
+ m_varStore->m_filename.erase(std::remove(m_varStore->m_filename.begin(),m_varStore->m_filename.end(),'"'),m_varStore->m_filename.end());
+ EXPECT_EQ(m_varStore->m_filename,"/opt/secure/RFC/rfcVariable.ini");
+ }
+}
+
+TEST(httpserverTest, loadRFCVarIntoCache) {
+ m_varStore = XRFCVarStore::getInstance();
+ if(m_varStore)
+ {
+ bool ret = m_varStore->loadRFCVarIntoCache();
+ EXPECT_EQ(ret, true);
+ }
+}
+
+TEST(httpserverTest, getValue) {
+ m_varStore = XRFCVarStore::getInstance();
+ const string key = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKRemoteDebugger.WebCfgData";
+ if(m_varStore)
+ {
+ string value = m_varStore->getValue(key);
+ EXPECT_EQ(value, "testCfg");
+ }
+}
+
+
+TEST(httpserverTest, getWdmpDataType) {
+ EXPECT_EQ(getWdmpDataTypeFunc()("string"), WDMP_STRING);
+ EXPECT_EQ(getWdmpDataTypeFunc()("boolean"), WDMP_BOOLEAN);
+ EXPECT_EQ(getWdmpDataTypeFunc()("unsignedInt"), WDMP_UINT);
+ EXPECT_EQ(getWdmpDataTypeFunc()("int"), WDMP_INT);
+ EXPECT_EQ(getWdmpDataTypeFunc()("unsignedLong"), WDMP_ULONG);
+ EXPECT_EQ(getWdmpDataTypeFunc()("dataTime"), WDMP_DATETIME);
+}
+
+TEST(httpserverTest, getHostIfParamType) {
+ EXPECT_EQ(getHostIfParamTypeFunc()(WDMP_STRING), hostIf_StringType);
+ EXPECT_EQ(getHostIfParamTypeFunc()(WDMP_INT), hostIf_IntegerType);
+ EXPECT_EQ(getHostIfParamTypeFunc()(WDMP_UINT), hostIf_UnsignedIntType);
+ EXPECT_EQ(getHostIfParamTypeFunc()(WDMP_BOOLEAN), hostIf_BooleanType);
+ EXPECT_EQ(getHostIfParamTypeFunc()(WDMP_DATETIME), hostIf_DateTimeType);
+ EXPECT_EQ(getHostIfParamTypeFunc()(WDMP_BASE64), hostIf_StringType);
+}
+
+TEST(httpserverTest, validateParamValue) {
+ const string sparamValue = "testimage";
+ HostIf_ParamType_t dataType = hostIf_StringType;
+ EXPECT_EQ(validateParamValueFunc()(sparamValue, dataType), true);
+
+ const string bparamValue = "0";
+ dataType = hostIf_BooleanType;
+ EXPECT_EQ(validateParamValueFunc()(bparamValue, dataType), true);
+
+ const string iparamValue = "12800";
+ dataType = hostIf_IntegerType;
+ EXPECT_EQ(validateParamValueFunc()(iparamValue, dataType), true);
+
+ const string uiparamValue = "12";
+ dataType = hostIf_UnsignedIntType;
+ EXPECT_EQ(validateParamValueFunc()(uiparamValue, dataType), true);
+}
+
+TEST(httpserverTest, handleRFCRequest_GET) {
+ param_t param;
+ memset(¶m,0,sizeof(param_t));
+ param.name = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RDKRemoteDebugger.IssueType");
+
+ REQ_TYPE reqType = GET;
+ WDMP_STATUS status = handleRFCRequestFunc()(reqType, ¶m);
+ EXPECT_EQ(status, WDMP_SUCCESS);
+
+ EXPECT_STREQ(param.value, "testtype");
+ free(param.name);
+}
+
+TEST(httpserverTest, handleRFCRequest_SET) {
+ param_t param;
+ memset(¶m,0,sizeof(param_t));
+ param.name = strdup(XRFC_VAR_STORE_RELOADCACHE);
+ param.value = strdup("true");
+
+ REQ_TYPE reqType = SET;
+ WDMP_STATUS status = handleRFCRequestFunc()(reqType, ¶m);
+ EXPECT_EQ(status, WDMP_SUCCESS);
+ free(param.name);
+ free(param.value);
+}
+
+TEST(httpserverTest, handleRFCInvalidRequest) {
+ param_t param;
+ memset(¶m,0,sizeof(param_t));
+ param.name = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.Control.ClearDB");
+ param.value = strdup("true");
+
+ REQ_TYPE reqType = SET;
+ WDMP_STATUS status = handleRFCRequestFunc()(reqType, ¶m);
+ EXPECT_EQ(status, WDMP_ERR_METHOD_NOT_SUPPORTED);
+ free(param.name);
+ free(param.value);
+}
+
+TEST(httpserverTest, invokeHostIfAPI) {
+ param_t param;
+ memset(¶m,0,sizeof(param_t));
+ param.name = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Airplay.Enable");
+ writeToTr181storeFile("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Airplay.Enable", "true", "/opt/secure/RFC/tr181store.ini", Plain);
+ const char *pcCallerID = "rfc";
+
+ HOSTIF_MsgData_t msgData = { 0 };
+ memset(&msgData,0,sizeof(HOSTIF_MsgData_t));
+ msgData.bsUpdate = HOSTIF_NONE;
+
+ REQ_TYPE reqType = GET;
+ WDMP_STATUS status = invokeHostIfAPIFunc()(reqType, ¶m, msgData.bsUpdate, pcCallerID);
+ EXPECT_EQ(status, WDMP_SUCCESS);
+
+}
+
+TEST(httpserverTest, validateAgainstDataModel_GET) {
+
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ HOSTIF_MsgData_t msgData = { 0 };
+ memset(&msgData,0,sizeof(HOSTIF_MsgData_t));
+ msgData.bsUpdate = HOSTIF_NONE;
+
+ char paramName [] = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable";
+ const char* paramValue = NULL;
+ DATA_TYPE dataType = WDMP_BOOLEAN;
+
+ REQ_TYPE reqType = GET;
+ char defaultValue[66];
+ char* defaultValuePtr = defaultValue;
+ WDMP_STATUS status = validateAgainstDataModelFunc()(reqType, paramName, paramValue, &dataType, &defaultValuePtr, &msgData.bsUpdate);
+ EXPECT_EQ(status, WDMP_SUCCESS);
+ EXPECT_STREQ(defaultValuePtr, "false");
+
+}
+
+TEST(httpserverTest, validateAgainstDataModel_SET_NullParam) {
+
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ HOSTIF_MsgData_t msgData = { 0 };
+ memset(&msgData,0,sizeof(HOSTIF_MsgData_t));
+ msgData.bsUpdate = HOSTIF_NONE;
+
+ char paramName [] = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName";
+ const char* paramValue = NULL;
+ DATA_TYPE dataType = WDMP_BOOLEAN;
+
+ REQ_TYPE reqType = SET;
+ char defaultValue[66];
+ char* defaultValuePtr = defaultValue;
+ WDMP_STATUS status = validateAgainstDataModelFunc()(SET, paramName, paramValue, &dataType, &defaultValuePtr, &msgData.bsUpdate);
+ EXPECT_EQ(status, WDMP_ERR_VALUE_IS_NULL);
+}
+
+TEST(httpserverTest, validateAgainstDataModel_SET_ReadOnly) {
+
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ HOSTIF_MsgData_t msgData = { 0 };
+ memset(&msgData,0,sizeof(HOSTIF_MsgData_t));
+ msgData.bsUpdate = HOSTIF_NONE;
+
+ char paramName [] = "Device.DeviceInfo.X_RDKCENTRAL-COM_xOpsDeviceMgmt.ReverseSSH.xOpsReverseSshStatus";
+ const char* paramValue = "reverseSsh";
+ DATA_TYPE dataType = WDMP_BOOLEAN;
+
+ REQ_TYPE reqType = SET;
+ char defaultValue[66];
+ char* defaultValuePtr = defaultValue;
+ WDMP_STATUS status = validateAgainstDataModelFunc()(SET, paramName, paramValue, &dataType, &defaultValuePtr, &msgData.bsUpdate);
+ EXPECT_EQ(status, WDMP_ERR_NOT_WRITABLE);
+}
+
+TEST(httpserverTest, handleRequest_GET) {
+
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ const char* pcCallerID = "rfc";
+ get_req_t *getReq = (get_req_t *)malloc(sizeof(get_req_t));
+ getReq->paramCnt = 1;
+ getReq->paramNames[0] = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.MOCASSH.Enable");
+ //getReq->paramNames[1] = strdup("Device.DeviceInfo.");
+ req_struct reqSt;
+ reqSt.reqType = GET; // Replace with actual enum value if it's defined
+ reqSt.u.getReq = getReq;
+
+
+ res_struct* respSt = handleRequest(pcCallerID, &reqSt);
+ EXPECT_EQ(respSt->retStatus[0], WDMP_ERR_DEFAULT_VALUE);
+}
+
+TEST(httpserverTest, handlewildRequest_GET) {
+
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ const char* pcCallerID = "rfc";
+ get_req_t *getReq = (get_req_t *)malloc(sizeof(get_req_t));
+ getReq->paramCnt = 1;
+ getReq->paramNames[0] = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Canary.");
+ //getReq->paramNames[1] = strdup("Device.DeviceInfo.");
+ req_struct reqSt;
+ reqSt.reqType = GET; // Replace with actual enum value if it's defined
+ reqSt.u.getReq = getReq;
+
+
+ res_struct* respSt = handleRequest(pcCallerID, &reqSt);
+ //EXPECT_EQ(respSt->retStatus[0], WDMP_ERR_DEFAULT_VALUE);
+ EXPECT_EQ(respSt->retStatus[0], 0);
+
+}
+
+TEST(httpserverTest, handleRequest_SET) {
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ const char* pcCallerID = "rfc";
+
+ param_t *params = (param_t *) malloc(sizeof(param_t) * 3);
+ params[0].name = strdup("Device.X_CISCO_COM_DeviceControl.RebootDevice");
+ params[0].value = strdup("true");
+ params[0].type = WDMP_BOOLEAN;
+
+ params[1].name = strdup("Device.DeviceInfo.");
+ params[1].value = strdup("true");
+ params[1].type = WDMP_BOOLEAN;
+
+ params[2].name = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.MOCASSH.Enable");
+ params[2].value = NULL;
+ params[2].type = WDMP_BOOLEAN;
+
+ set_req_t *setReq = (set_req_t *)malloc(sizeof(set_req_t));
+ setReq->param = params;
+ setReq->paramCnt = 3;
+
+ req_struct reqSt;
+ reqSt.reqType = SET; // Replace with actual enum value
+ reqSt.u.setReq = setReq;
+
+ res_struct* respSt = handleRequest(pcCallerID, &reqSt);
+ EXPECT_EQ(respSt->retStatus[0], WDMP_FAILURE);
+ EXPECT_EQ(respSt->retStatus[1], WDMP_ERR_WILDCARD_NOT_SUPPORTED);
+ EXPECT_EQ(respSt->retStatus[2], WDMP_ERR_VALUE_IS_NULL);
+}
+
+
+GTEST_API_ int main(int argc, char *argv[]){
+ char testresults_fullfilepath[GTEST_REPORT_FILEPATH_SIZE];
+ char buffer[GTEST_REPORT_FILEPATH_SIZE];
+
+ memset( testresults_fullfilepath, 0, GTEST_REPORT_FILEPATH_SIZE );
+ memset( buffer, 0, GTEST_REPORT_FILEPATH_SIZE );
+ snprintf( testresults_fullfilepath, GTEST_REPORT_FILEPATH_SIZE, "json:%s%s" , GTEST_DEFAULT_RESULT_FILEPATH , GTEST_DEFAULT_RESULT_FILENAME);
+
+ ::testing::GTEST_FLAG(output) = testresults_fullfilepath;
+ ::testing::InitGoogleMock(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/src/hostif/httpserver/src/request_handler.cpp b/src/hostif/httpserver/src/request_handler.cpp
index 20cf518f8..43e3e9543 100644
--- a/src/hostif/httpserver/src/request_handler.cpp
+++ b/src/hostif/httpserver/src/request_handler.cpp
@@ -738,3 +738,36 @@ res_struct* handleRequest(const char* pcCallerID, req_struct *reqSt)
RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"Leaving... %s\n", __FUNCTION__);
return respSt;
}
+
+#ifdef GTEST_ENABLE
+DATA_TYPE (*getWdmpDataTypeFunc())(char * )
+{
+ return &getWdmpDataType;
+}
+
+HostIf_ParamType_t (*getHostIfParamTypeFunc())(DATA_TYPE wdmpDataType)
+{
+ return &getHostIfParamType;
+}
+
+bool (*validateParamValueFunc())(const string ¶mValue, HostIf_ParamType_t dataType)
+{
+ return &validateParamValue;
+}
+
+WDMP_STATUS (*handleRFCRequestFunc())(REQ_TYPE reqType, param_t *param)
+{
+ return &handleRFCRequest;
+}
+
+WDMP_STATUS (*invokeHostIfAPIFunc())(REQ_TYPE reqType, param_t *param, HostIf_Source_Type_t bsUpdate, const char *pcCallerID)
+{
+ return &invokeHostIfAPI;
+}
+
+WDMP_STATUS (*validateAgainstDataModelFunc())(REQ_TYPE reqType, char* paramName, const char* paramValue, DATA_TYPE *dataType, char **
+defaultValue, HostIf_Source_Type_t *bsUpdate)
+{
+ return &validateAgainstDataModel;
+}
+#endif
diff --git a/src/hostif/include/hostIf_utils.h b/src/hostif/include/hostIf_utils.h
index d0b6ad7d2..aee1ce8f9 100755
--- a/src/hostif/include/hostIf_utils.h
+++ b/src/hostif/include/hostIf_utils.h
@@ -124,11 +124,13 @@ unsigned long string_to_ulong(const char *value);
bool string_to_bool(const char *value);
+std::string bool_to_string(bool value);
+
std::string getStringValue(HOSTIF_MsgData_t *stMsgData);
void putValue(HOSTIF_MsgData_t *stMsgData, const std::string &value);
-bool set_GatewayConnStatus();
+void set_GatewayConnStatus( bool enabled);
bool get_GatewayConnStatus();
/**
diff --git a/src/hostif/parodusClient/gtest/Makefile.am b/src/hostif/parodusClient/gtest/Makefile.am
index dbafed8ad..b24578528 100644
--- a/src/hostif/parodusClient/gtest/Makefile.am
+++ b/src/hostif/parodusClient/gtest/Makefile.am
@@ -22,16 +22,26 @@ AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = dm_gtest
# Define the include directories
-COMMON_CPPFLAGS = -std=c++11 -I$(TOP_DIR)/src/unittest/stubs -I/usr/include -I/usr/include/cjson -I$(TOP_DIR)/src/hostif/parodusClient/waldb/ -I$(TOP_DIR)/src/hostif/parodusClient/pal/ -I$(TOP_DIR)/src/hostif/include/ -I$(TOP_DIR)/src/hostif/profiles/DeviceInfo -I$(TOP_DIR)/src/unittest/stubs/rbus/include
+COMMON_CPPFLAGS = -std=c++11 -DGTEST_ENABLE -DUSE_DEV_PROPERTIES_CONF -DUSE_REMOTE_DEBUGGER -I/usr/include -I/usr/include/cjson -I$(TOP_DIR)/src/hostif/include -I$(TOP_DIR)/src/hostif/profiles/DeviceInfo -I$(TOP_DIR)/src/unittest/stubs -I$(TOP_DIR)/src/unittest/stubs/ds -I$(TOP_DIR)/src/unittest/stubs/rbus/include -I$(TOP_DIR)/src/hostif/handlers/include -I$(TOP_DIR)/src/hostif/parodusClient/pal -I$(TOP_DIR)/src/hostif/parodusClient/waldb -I$(TOP_DIR)/src/hostif/httpserver/include -I$(TOP_DIR)/src/hostif/handlers/src -I/usr/include/rbus -I/usr/local/include/rbus -Isrc/unittest/stubs/rbus/include/ -I$(TOP_DIR)/src/hostif/profiles/Time -I$(TOP_DIR)/src/hostif/profiles/Device -I$(TOP_DIR)/src/hostif/profiles/IP -I$(TOP_DIR)/src/hostif/profiles/STBService -I/usr/rdk-halif-device_settings/include/ -I/usr/rdkvhal-devicesettings-raspberrypi4/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I$(TOP_DIR)/src/hostif/profiles/Ethernet -I/usr/remote_debugger/src/ -I/usr/local/include/libparodus/ -I/usr/local/include/wrp-c/ -I$(TOP_DIR)/src/hostif/parodusClient/startParodus/
+
+if LIBSOUP3_ENABLE
+COMMON_CPPFLAGS += -I/usr/include/libsoup-3.0 -DLIBSOUP3_ENABLE
+else
+COMMON_CPPFLAGS += -I/usr/include/libsoup-2.4
+endif
# Define the libraries to link against
-COMMON_LDADD = -lgtest -lgtest_main -lgmock_main -lgmock -lgcov $(GLIB_LIBS) -ltinyxml2 -lcjson -lcurl
+COMMON_LDADD = -lgtest -lgtest_main -lgmock_main -lgmock -lgcov $(GLIB_LIBS) -ltinyxml2 -lcjson -lcurl -lglib-2.0 -llibparodus -lwrp-c -lnanomsg -lmsgpackc -ltrower-base64 -lcimplog
+
+if LIBSOUP3_ENABLE
+COMMON_LDADD += -lsoup-3.0
+endif
# Define the compiler flags
COMMON_CXXFLAGS = -frtti $(GLIB_CFLAGS) -fprofile-arcs -ftest-coverage
-# Define the source files
-dm_gtest_SOURCES = dm_test.cpp $(TOP_DIR)/src/hostif/parodusClient/waldb/waldb.cpp $(TOP_DIR)/src/hostif/src/hostIf_utils.cpp $(TOP_DIR)/src/unittest/stubs/secure_wrapper.c $(TOP_DIR)/src/unittest/stubs/dm_stubs.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComRFCStore.cpp
+
+dm_gtest_SOURCES = dm_test.cpp $(TOP_DIR)/src/hostif/parodusClient/startParodus/startParodus.cpp $(TOP_DIR)/src/hostif/src/hostIf_utils.cpp $(TOP_DIR)/src/hostif/src/IniFile.cpp $(TOP_DIR)/src/unittest/stubs/secure_wrapper.c $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComRFCStore.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComRFC.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComBSStore.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/XrdkCentralComBSStoreJournal.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_NotificationHandler.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/webpa_notification.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/webpa_attribute.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/webpa_parameter.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/libpd.cpp $(TOP_DIR)/src/hostif/parodusClient/pal/webpa_adapter.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_msgHandler.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_XrdkCentralT2_ReqHandler.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_IPClient_ReqHandler.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_DeviceClient_ReqHandler.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo_ProcessStatus_Process.cpp $(TOP_DIR)/src/hostif/profiles/Ethernet/Device_Ethernet_Interface.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Components_DisplayDevice.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_EthernetClient_ReqHandler.cpp $(TOP_DIR)/src/hostif/profiles/Ethernet/Device_Ethernet_Interface_Stats.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_TimeClient_ReqHandler.cpp $(TOP_DIR)/src/hostif/profiles/IP/Device_IP.cpp $(TOP_DIR)/src/hostif/profiles/IP/Device_IP_Interface.cpp $(TOP_DIR)/src/hostif/profiles/Time/Device_Time.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_updateHandler.cpp $(TOP_DIR)/src/hostif/profiles/Device/x_rdk_profile.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_dsClient_ReqHandler.cpp $(TOP_DIR)/src/hostif/handlers/src/hostIf_rbus_Dml_Provider.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Capabilities.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Components_SPDIF.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Components_VideoDecoder.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Components_AudioOutput.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Components_HDMI.cpp $(TOP_DIR)/src/hostif/profiles/STBService/Components_VideoOutput.cpp $(TOP_DIR)/src/hostif/profiles/IP/Device_IP_Interface_Stats.cpp $(TOP_DIR)/src/hostif/profiles/IP/Device_IP_ActivePort.cpp $(TOP_DIR)/src/hostif/profiles/IP/Device_IP_Diagnostics_IPPing.cpp $(TOP_DIR)/src/hostif/profiles/IP/Device_IP_Interface_IPv4Address.cpp $(TOP_DIR)/src/hostif/handlers/src/x_rdk_req_handler.cpp $(TOP_DIR)/src/unittest/stubs/dm_stubs.cpp $(TOP_DIR)/src/hostif/parodusClient/waldb/waldb.cpp $(TOP_DIR)/src/unittest/stubs/wdmp-c.c $(TOP_DIR)/src/unittest/stubs/wdmp_internal.c $(TOP_DIR)/src/hostif/httpserver/src/http_server.cpp $(TOP_DIR)/src/hostif/httpserver/src/request_handler.cpp $(TOP_DIR)/src/hostif/httpserver/src/XrdkCentralComRFCVar.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo_Processor.cpp $(TOP_DIR)/src/hostif/profiles/DeviceInfo/Device_DeviceInfo_ProcessStatus.cpp $(TOP_DIR)/src/unittest/stubs/ds/libprocps.cpp $(TOP_DIR)/src/unittest/stubs/file_writer.cpp
# Apply common properties to each program
dm_gtest_CPPFLAGS = $(COMMON_CPPFLAGS)
diff --git a/src/hostif/parodusClient/gtest/dm_test.cpp b/src/hostif/parodusClient/gtest/dm_test.cpp
index 27812bb8f..ade9dc19c 100644
--- a/src/hostif/parodusClient/gtest/dm_test.cpp
+++ b/src/hostif/parodusClient/gtest/dm_test.cpp
@@ -20,16 +20,62 @@
#include
#include
#include "dm_stubs.h"
+#include "startParodus.h"
+#include "file_writer.h"
+#include "webpa_notification.h"
+#include "webpa_parameter.h"
+#include "webpa_adapter.h"
+#include "libpd.h"
+#include "webpa_attribute.h"
+#include "rbus_value.h"
+#include "hostIf_tr69ReqHandler.h"
+#include "hostIf_utils.h"
+#include "wrp-c.h"
#include "waldb.h"
#include "wdmp-c.h"
using namespace std;
+
+#include
+#include
+
#define GTEST_DEFAULT_RESULT_FILEPATH "/tmp/Gtest_Report/"
#define GTEST_DEFAULT_RESULT_FILENAME "datamodel_gtest_report.json"
#define GTEST_REPORT_FILEPATH_SIZE 128
+extern GHashTable* paramMgrhash;
+
+std::mutex mtx_httpServerThreadDone;
+std::condition_variable cv_httpServerThreadDone;
+bool httpServerThreadDone = false;
+GThread *HTTPServerThread = NULL;
+char *HTTPServerName = (char *)"HTTPServerThread";
+GError *httpError = NULL;
+GHashTable* paramMgrhash = NULL;
+T_ARGLIST argList = {{'\0'}, 0};
+
+#ifdef GTEST_ENABLE
+extern void (*macToLowerFunc())(char macValue[],char macConverted[]);
+extern WDMP_STATUS (*GetParamInfoFunc()) (const char *pParameterName, param_t ***parametervalPtrPtr, int *paramCountPtr,int paramIndex);
+extern rbusValueType_t (*getRbusDataTypefromWebPAFunc())(WAL_DATA_TYPE type);
+extern DATA_TYPE (*mapRbusDataTypeToWebPAFunc())(rbusValueType_t type);
+WDMP_STATUS (*get_ParamValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *ptrParam);
+WAL_STATUS (*set_ParamValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *ptrParam);
+WAL_STATUS (*convertFaultCodeToWalStatusFunc())(faultCode_t faultCode);
+extern void (*converttohostIfTypeFunc())(char *ParamDataType,HostIf_ParamType_t* pParamType);
+void (*converttoWalTypeFunc())(HostIf_ParamType_t paramType,WAL_DATA_TYPE* pwalType);
+extern void (*get_parodus_urlFunc())(char *parodus_url, char *client_url);
+extern WDMP_STATUS (*validate_parameterFunc()) (param_t *param, int paramCount);
+extern WAL_STATUS (*get_AttribValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *ptrParam);
+extern WAL_STATUS (*set_AttribValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *param);
+extern WAL_STATUS (*getParamAttributesFunc()) (const char *pParameterName, AttrVal ***attr, int *TotalParams);
+extern WAL_STATUS (*setParamAttributesFunc()) (const char *pParameterName, const AttrVal *attArr);
+extern void (*setRebootReasonFunc()) (param_t param, WEBPA_SET_TYPE setType);
+extern long (*timeValDiffFunc()) (struct timespec *starttime, struct timespec *finishtime);
+#endif
+
TEST(datamodelTest, ParameterExistPositive2) {
/* Load the data model xml file*/
@@ -158,6 +204,470 @@ TEST(datamodelTest, ParameterListTest) {
DataModelParam dmParam = {0};
}
+TEST(datamodelTest, getNumberofInstances) {
+ int cnt = getNumberofInstances("Device.IP.Interface.{i}.");
+ EXPECT_EQ(0, 0);
+
+}
+
+TEST(datamodelTest, isWildCardParam) {
+ int wildParam = isWildCardParam("Device.DeviceInfo.");
+ EXPECT_EQ(wildParam, 1);
+}
+
+TEST(datamodelTest, isParamEndsWithInstance) {
+ int instance = isParamEndsWithInstance("Device.IP.Interface.{i}.");
+ EXPECT_EQ(instance, 0);
+}
+
+TEST(datamodelTest, getNumberOfDigitsInInstanceNumber) {
+ int instance = getNumberOfDigitsInInstanceNumber("Device.WiFi.SSID.123.Name", 17);
+ EXPECT_EQ(instance, 3);
+}
+
+TEST(datamodelTest, getChildParamNamesFromDataModel) {
+
+ /* Load the data model xml file*/
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+
+ char *ParamList = NULL;
+ char *ParamDataTypeList = NULL;
+
+ char *paramName = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.VideoTelemetry.";
+ int paramCount = 1;
+ DB_STATUS status = getChildParamNamesFromDataModel(getDataModelHandle(), paramName, &ParamList, &ParamDataTypeList, ¶mCount);
+ EXPECT_EQ(status, DB_SUCCESS);
+}
+
+TEST(datamodelTest, checkDataModelStatus) {
+ DB_STATUS status = checkDataModelStatus();
+ EXPECT_EQ(status, DB_SUCCESS);
+}
+
+TEST(datamodelTest, checkMatchingParameter) {
+ const char* attrValue = "a.b.c.{i}.";
+ char* paramName = "a.b.c.1.";
+ int ret = 0;
+ int retValue = checkMatchingParameter(attrValue, paramName, &ret);
+ EXPECT_EQ(retValue, 1);
+}
+
+TEST(startParodusTest, get_HWMAcAddress) {
+ write_on_file("/tmp/.macAddress", "D4:52:EE:DE:C6:FA");
+ std::string macAddr = get_HWMAcAddress();
+ EXPECT_EQ(macAddr, "D452EEDEC6FA");
+}
+
+TEST(startParodusTest, get_PartnerId) {
+ write_on_file("/opt/www/authService/partnerId3.dat", "sky");
+ std::string partnerId = get_PartnerId();
+ EXPECT_EQ(partnerId, "*,sky");
+}
+
+TEST(startParodusTest, get_RebootReason) {
+ std::string jsonData = "{\"reason\": \"PowerOnReset\", \"timestamp\": 1688914800}";
+ write_on_file("/opt/secure/reboot/previousreboot.info", jsonData);
+ std::string reboot_reason = get_RebootReason();
+ EXPECT_EQ(reboot_reason, "PowerOnReset");
+}
+
+TEST(startParodusTest, get_FwName) {
+ write_on_file("/version.txt", "imagename:ELTE11MWR_VBN_25Q3_sprint_20250814010729sdy_NG");
+ std::string fw_name = get_FwName();
+ EXPECT_EQ(fw_name, "ELTE11MWR_VBN_25Q3_sprint_20250814010729sdy_NG");
+}
+
+TEST(palTest, macToLower) {
+ char macValue[32] = "A8:4A:63:88:E9:B5";
+ char macConverted[32];
+ macConverted[0] = '\0';
+ macToLowerFunc()(macValue, macConverted);
+ EXPECT_STREQ(macConverted, "a84a6388e9b5");
+}
+
+TEST(palTest, getnotifyparamList) {
+ const char* json_data = R"({"Notify":["Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Canary.wakeUpStart","Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.Canary.wakeUpEnd"]})";
+ write_on_file("/tmp/notify.conf", json_data);
+ char **notifyParamList = NULL;
+ int ptrnotifyListSize = 3;
+ setNotifyConfigurationFile("/tmp/notify.conf");
+ int ret = getnotifyparamList(¬ifyParamList, &ptrnotifyListSize);
+ EXPECT_EQ(ret, 0);
+}
+
+TEST(palTest, getNotifySource) {
+ char* notificationSource = getNotifySource();
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, getRbusDataTypefromWebPA) {
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_STRING), RBUS_STRING);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_INT), RBUS_INT32);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_UINT), RBUS_UINT32);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_BOOLEAN), RBUS_BOOLEAN);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_DATETIME), RBUS_DATETIME);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_BASE64), RBUS_BYTES);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_LONG), RBUS_INT64);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_ULONG), RBUS_UINT64);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_FLOAT), RBUS_SINGLE);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_DOUBLE), RBUS_DOUBLE);
+ EXPECT_EQ(getRbusDataTypefromWebPAFunc()(WAL_BYTE), RBUS_BYTE);
+}
+
+TEST(palTest, mapRbusDataTypeToWebPA) {
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_BOOLEAN), WDMP_BOOLEAN);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_CHAR), WDMP_BYTE);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_INT16), WDMP_INT);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_UINT16), WDMP_UINT);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_INT64), WDMP_LONG);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_UINT64), WDMP_ULONG);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_STRING), WDMP_STRING);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_DATETIME), WDMP_DATETIME);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_DATETIME), WDMP_DATETIME);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_BYTES), WDMP_BASE64);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_SINGLE), WDMP_FLOAT);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_DOUBLE), WDMP_DOUBLE);
+ EXPECT_EQ(mapRbusDataTypeToWebPAFunc()(RBUS_PROPERTY), WDMP_NONE);
+}
+
+TEST(palTest, get_ParamValues_tr69hostIf) {
+ HOSTIF_MsgData_t param = { 0 };
+ memset(¶m,0,sizeof(HOSTIF_MsgData_t));
+ param.reqType = HOSTIF_GET;
+ strncpy (param.paramName, "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed", TR69HOSTIFMGR_MAX_PARAM_LEN - 1);
+ param.bsUpdate = HOSTIF_NONE;
+ param.requestor = HOSTIF_SRC_RFC;
+ param.paramtype = hostIf_IntegerType;
+ param.paramLen = sizeof(hostIf_IntegerType);
+
+ WDMP_STATUS status = get_ParamValues_tr69hostIfFunc()(¶m);
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, set_ParamValues_tr69hostIf) {
+ HOSTIF_MsgData_t param = { 0 };
+ memset(¶m,0,sizeof(HOSTIF_MsgData_t));
+ param.reqType = HOSTIF_SET;
+ strncpy (param.paramName, "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.LowSpeed", TR69HOSTIFMGR_MAX_PARAM_LEN - 1);
+ param.bsUpdate = HOSTIF_NONE;
+ param.requestor = HOSTIF_SRC_RFC;
+
+ put_boolean(param.paramValue, 13800);
+ param.paramtype = hostIf_IntegerType;
+ param.paramLen = sizeof(hostIf_IntegerType);
+
+ WAL_STATUS status = set_ParamValues_tr69hostIfFunc()(¶m);
+ EXPECT_EQ(0, 0);
+}
+TEST(palTest, convertFaultCodeToWalStatus) {
+ EXPECT_EQ(convertFaultCodeToWalStatusFunc()(fcNoFault), WAL_FAILURE);
+ EXPECT_EQ(convertFaultCodeToWalStatusFunc()(fcAttemptToSetaNonWritableParameter), WAL_ERR_NOT_WRITABLE);
+ EXPECT_EQ(convertFaultCodeToWalStatusFunc()(fcInvalidParameterName), WAL_ERR_INVALID_PARAMETER_NAME);
+ EXPECT_EQ(convertFaultCodeToWalStatusFunc()(fcInvalidParameterType), WAL_ERR_INVALID_PARAMETER_TYPE);
+ EXPECT_EQ(convertFaultCodeToWalStatusFunc()(fcInvalidParameterValue), WAL_ERR_INVALID_PARAMETER_VALUE);
+ EXPECT_EQ(convertFaultCodeToWalStatusFunc()(fcInternalError), WAL_FAILURE);
+}
+
+TEST(palTest, isWildCardParam) {
+ int ret = isWildCardParam("Device.DeviceInfo.");
+ EXPECT_EQ(ret, 1);
+}
+
+TEST(palTest, converttohostIfType) {
+ HostIf_ParamType_t pParamType;
+
+ converttohostIfTypeFunc()("string", &pParamType);
+ EXPECT_EQ(pParamType, hostIf_StringType);
+
+ converttohostIfTypeFunc()("unsignedInt", &pParamType);
+ EXPECT_EQ(pParamType, hostIf_UnsignedIntType);
+
+ converttohostIfTypeFunc()("int", &pParamType);
+ EXPECT_EQ(pParamType, hostIf_IntegerType);
+
+ converttohostIfTypeFunc()("unsignedLong", &pParamType);
+ EXPECT_EQ(pParamType, hostIf_UnsignedLongType);
+
+ converttohostIfTypeFunc()("boolean", &pParamType);
+ EXPECT_EQ(pParamType, hostIf_BooleanType);
+
+ converttohostIfTypeFunc()("hexBinary", &pParamType);
+ EXPECT_EQ(pParamType, hostIf_StringType);
+}
+
+TEST(palTest, GetParamInfo) {
+
+ DB_STATUS dbStatus = loadDataModel();
+ if(dbStatus != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(dbStatus, DB_SUCCESS);
+ const char *pParameterName = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Bootstrap.PartnerName";
+ param_t** parameterval = (param_t**) calloc(1, sizeof(param_t*));
+ EXPECT_NE(parameterval, nullptr);
+ int paramCountPtr = 0;
+ int index = 0;
+ WDMP_STATUS status = GetParamInfoFunc()(pParameterName, ¶meterval, ¶mCountPtr, index);
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, GetWildParamInfo) {
+ const char *pParameterName = "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.";
+ param_t **parametervalPtrPtr = (param_t**) calloc(3, sizeof(param_t*));
+ int paramCountPtr = 3;
+ int index = 0;
+ WDMP_STATUS status = GetParamInfoFunc()(pParameterName, ¶metervalPtrPtr, ¶mCountPtr, index);
+ EXPECT_EQ(status, WDMP_SUCCESS);
+
+ for (int i = 0; i < 3; i++) {
+ if (parametervalPtrPtr[i]) {
+ // If parametervalPtrPtr[i] points to dynamically allocated memory, free it
+ free(parametervalPtrPtr[i]);
+ parametervalPtrPtr[i] = NULL;
+ }
+ }
+ free(parametervalPtrPtr);
+ parametervalPtrPtr = NULL;
+}
+
+TEST(palTest, get_parodus_url) {
+ char parodus_url[256] = {0};
+ char client_url[256] = {0};
+ const char *webpaCfgFile = "{ \"ParodusURL\": \"tcp://parodus.xcal.tv:6666\", \"ParodusClientURL\": \"tcp://127.0.0.1:6666\" }";
+ write_on_file("/etc/webpa_cfg.json", webpaCfgFile);
+ get_parodus_urlFunc()(parodus_url, client_url);
+ EXPECT_STREQ(parodus_url, "tcp://parodus.xcal.tv:6666");
+ EXPECT_STREQ(client_url, "tcp://127.0.0.1:6666");
+}
+
+TEST(palTest, validate_parameter_wildcard) {
+ param_t *params = (param_t *) malloc(sizeof(param_t) * 1);
+
+ params[0].name = strdup("Device.DeviceInfo.");
+ params[0].value = strdup("true");
+ params[0].type = WDMP_BOOLEAN;
+ int paramCount = 1;
+
+ WDMP_STATUS status = validate_parameterFunc()(params, paramCount);
+ EXPECT_EQ(status, WDMP_ERR_WILDCARD_NOT_SUPPORTED);
+}
+
+TEST(palTest, validate_parameter_Null) {
+ param_t *params = (param_t *) malloc(sizeof(param_t) * 1);
+
+ int paramCount = 1;
+ params[0].name = strdup("Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.FWUpdate.Enable");
+ params[0].value = NULL;
+ params[0].type = WDMP_BOOLEAN;
+
+ WDMP_STATUS status = validate_parameterFunc()(params, paramCount);
+ EXPECT_EQ(status, WDMP_ERR_VALUE_IS_NULL);
+
+ free(params[0].name);
+ free(params[0].value);
+ free(params);
+}
+
+TEST(palTest, validate_parameter_NOT_Support) {
+ param_t *params = (param_t *) malloc(sizeof(param_t) * 1);
+
+ int paramCount = 1;
+ params[0].name = strdup("Device.DeviceInfo.Webpa.X_COMCAST-COM_CMC");
+ params[0].value = strdup("test");
+ params[0].type = WDMP_BOOLEAN;
+
+ WDMP_STATUS status = validate_parameterFunc()(params, paramCount);
+ EXPECT_EQ(status, WDMP_ERR_SET_OF_CMC_OR_CID_NOT_SUPPORTED);
+
+ free(params[0].name);
+ free(params[0].value);
+ free(params);
+}
+
+TEST(palTest, processRequest_GET) {
+ // Initialize paramMgrhash if not already done
+ /*if (paramMgrhash == NULL) {
+ paramMgrhash = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
+ } */
+
+ //Load the data model xml file
+ DB_STATUS status = loadDataModel();
+ if(status != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(status, DB_SUCCESS);
+
+ wrp_msg_t *wrp_msg;
+ wrp_msg_t *res_wrp_msg;
+
+ wrp_msg = (wrp_msg_t *)malloc(sizeof(wrp_msg_t));
+ res_wrp_msg = (wrp_msg_t *)malloc(sizeof(wrp_msg_t));
+ memset(res_wrp_msg, 0, sizeof(wrp_msg_t));
+ wrp_msg->msg_type = WRP_MSG_TYPE__REQ;
+
+ const char *payload = "{\"command\":\"GET\",\"names\":[\"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed\"]}";
+ wrp_msg->u.req.payload = (void*)payload;
+
+ wrp_msg->u.req.payload_size = strlen((char*)wrp_msg->u.req.payload);
+ processRequest((char*)wrp_msg->u.req.payload, (char*)wrp_msg->u.req.transaction_uuid, ((char **)(&(res_wrp_msg->u.req.payload))));
+ std::cout << "Response payload: " << (char*)res_wrp_msg->u.req.payload << std::endl;
+ char *json_response = (char*)res_wrp_msg->u.req.payload;
+ EXPECT_EQ(0, 0);
+}
+
+
+TEST(palTest, processRequest_SET) {
+ // Initialize paramMgrhash if not already done
+ /* if (paramMgrhash == NULL) {
+ paramMgrhash = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
+ } */
+
+ // Load the data model xml file
+ DB_STATUS status = loadDataModel();
+ if(status != DB_SUCCESS)
+ {
+ std::cout << "Error in Data Model Initialization" << std::endl;
+ }
+ else
+ {
+ std::cout << "Successfully initialize Data Model." << std::endl;
+ }
+ EXPECT_EQ(status, DB_SUCCESS);
+
+ wrp_msg_t *wrp_msg;
+ wrp_msg_t *res_wrp_msg;
+
+ wrp_msg = (wrp_msg_t *)malloc(sizeof(wrp_msg_t));
+ res_wrp_msg = (wrp_msg_t *)malloc(sizeof(wrp_msg_t));
+ memset(res_wrp_msg, 0, sizeof(wrp_msg_t));
+ wrp_msg->msg_type = WRP_MSG_TYPE__REQ;
+
+ const char *payload = "{\"command\":\"SET\",\"parameters\":[{\"name\":\"Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.LogUpload.LogServerUrl\",\"dataType\":0,\"value\":\"logs.xcal.tv\"}]}";
+ wrp_msg->u.req.payload = (void*)payload;
+
+ wrp_msg->u.req.payload_size = strlen((char*)wrp_msg->u.req.payload);
+ processRequest((char*)wrp_msg->u.req.payload, (char*)wrp_msg->u.req.transaction_uuid, ((char **)(&(res_wrp_msg->u.req.payload))));
+ std::cout << "Response payload: " << (char*)res_wrp_msg->u.req.payload << std::endl;
+ char *json_response = (char*)res_wrp_msg->u.req.payload;
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, get_AttribValues_tr69hostIf) {
+ HOSTIF_MsgData_t param = { 0 };
+ memset(¶m,0,sizeof(HOSTIF_MsgData_t));
+ param.reqType = HOSTIF_GET;
+ strncpy (param.paramName, "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable", TR69HOSTIFMGR_MAX_PARAM_LEN - 1);
+ param.bsUpdate = HOSTIF_NONE;
+ param.requestor = HOSTIF_SRC_RFC;
+
+ WAL_STATUS status = get_AttribValues_tr69hostIfFunc()(¶m);
+ EXPECT_EQ(status, WAL_ERR_INVALID_PARAM);
+}
+
+TEST(palTest, set_AttribValues_tr69hostIf) {
+ HOSTIF_MsgData_t param = { 0 };
+ memset(¶m,0,sizeof(HOSTIF_MsgData_t));
+ param.reqType = HOSTIF_SET;
+ strncpy (param.paramName, "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable", TR69HOSTIFMGR_MAX_PARAM_LEN - 1);
+ param.bsUpdate = HOSTIF_NONE;
+ param.requestor = HOSTIF_SRC_RFC;
+
+ put_boolean(param.paramValue, true);
+ param.paramtype = hostIf_BooleanType;
+ param.paramLen = sizeof(hostIf_BooleanType);
+
+ WAL_STATUS status = set_AttribValues_tr69hostIfFunc()(¶m);
+ EXPECT_EQ(status, 4);
+}
+
+TEST(palTest, getParamAttributes) {
+
+ const char *paramName = "Device.WiFi.SSID.1.SSID";
+ AttrVal **attributes = NULL;
+ int totalParams = 0;
+
+ WAL_STATUS status = getParamAttributesFunc()(paramName, &attributes, &totalParams);
+ EXPECT_EQ(status, WAL_ERR_INVALID_PARAM);
+}
+
+TEST(palTest, setParamAttributes) {
+
+ const char *paramName = "Device.WiFi.SSID.1.SSID";
+ AttrVal attr;
+
+ WAL_STATUS status = setParamAttributesFunc()(paramName, &attr);
+ EXPECT_EQ(status, WAL_SUCCESS);
+}
+
+
+TEST(webpaAdapterTest, setRebootReason) {
+ // Prepare a param_t with the reboot parameter and value
+ param_t param;
+ param.name = strdup("Device.X_CISCO_COM_DeviceControl.RebootDevice");
+ param.value = strdup("Device");
+ param.type = WDMP_STRING;
+
+ // Call setRebootReason and check for no crash (L1)
+ setRebootReasonFunc()(param, WEBPA_SET);
+
+ // Clean up
+ free(param.name);
+ free(param.value);
+
+ // L1: No assertion needed, just ensure no crash
+ EXPECT_EQ(0, 0);
+}
+
+
+TEST(palTest, notificationCallBack) {
+ notificationCallBack();
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, setInitialNotify) {
+ notificationCallBack();
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, registerNotifyCallback) {
+ registerNotifyCallback();
+ EXPECT_EQ(0, 0);
+}
+
+TEST(palTest, timeValDiff) {
+ struct timespec starttime = {
+ .tv_sec = 100,
+ .tv_nsec = 500000000 // 0.5 seconds
+ };
+
+ struct timespec endtime = {
+ .tv_sec = 102,
+ .tv_nsec = 200000000 // 0.2 seconds
+ };
+
+ long msec = timeValDiffFunc()(&starttime, &endtime);
+ EXPECT_EQ(msec, 1700);
+}
+
GTEST_API_ int main(int argc, char *argv[]){
char testresults_fullfilepath[GTEST_REPORT_FILEPATH_SIZE];
diff --git a/src/hostif/parodusClient/pal/libpd.cpp b/src/hostif/parodusClient/pal/libpd.cpp
index 65a652358..7e258f252 100644
--- a/src/hostif/parodusClient/pal/libpd.cpp
+++ b/src/hostif/parodusClient/pal/libpd.cpp
@@ -450,3 +450,15 @@ static long timeValDiff(struct timespec *starttime, struct timespec *finishtime)
msec+=(finishtime->tv_nsec-starttime->tv_nsec)/1000000;
return msec;
}
+
+#ifdef GTEST_ENABLE
+void (*get_parodus_urlFunc())(char *parodus_url, char *client_url)
+{
+ return &get_parodus_url;
+}
+
+long (*timeValDiffFunc()) (struct timespec *starttime, struct timespec *finishtime)
+{
+ return &timeValDiff;
+}
+#endif
diff --git a/src/hostif/parodusClient/pal/webpa_adapter.cpp b/src/hostif/parodusClient/pal/webpa_adapter.cpp
index 0fb13a991..6919db527 100644
--- a/src/hostif/parodusClient/pal/webpa_adapter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_adapter.cpp
@@ -501,3 +501,15 @@ void getCurrentTime(struct timespec *timer)
{
clock_gettime(CLOCK_REALTIME, timer);
}
+
+#ifdef GTEST_ENABLE
+WDMP_STATUS (*validate_parameterFunc()) (param_t *param, int paramCount)
+{
+ return &validate_parameter;
+}
+
+void (*setRebootReasonFunc()) (param_t param, WEBPA_SET_TYPE setType)
+{
+ return &setRebootReason;
+}
+#endif
diff --git a/src/hostif/parodusClient/pal/webpa_adapter.h b/src/hostif/parodusClient/pal/webpa_adapter.h
index 1b373587e..ad8142221 100644
--- a/src/hostif/parodusClient/pal/webpa_adapter.h
+++ b/src/hostif/parodusClient/pal/webpa_adapter.h
@@ -341,5 +341,9 @@ WAL_STATUS sendIoTMessage(const void *msg);
void getCurrentTime(struct timespec *timer);
+#ifdef GTEST_ENABLE
+void notificationCallBack();
+#endif
+
#endif /* _WEBPA_ADAPTER_H_ */
diff --git a/src/hostif/parodusClient/pal/webpa_attribute.cpp b/src/hostif/parodusClient/pal/webpa_attribute.cpp
index 123d41b16..73fa2681c 100644
--- a/src/hostif/parodusClient/pal/webpa_attribute.cpp
+++ b/src/hostif/parodusClient/pal/webpa_attribute.cpp
@@ -227,3 +227,27 @@ static WAL_STATUS setParamAttributes(const char *pParameterName, const AttrVal *
ret = set_AttribValues_tr69hostIf (&Param);
return ret;
}
+
+#ifdef GTEST_ENABLE
+WAL_STATUS (*get_AttribValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *ptrParam)
+{
+ return &get_AttribValues_tr69hostIf;
+}
+
+WAL_STATUS (*set_AttribValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *param)
+{
+ return &set_AttribValues_tr69hostIf;
+}
+
+WAL_STATUS (*getParamAttributesFunc()) (const char *pParameterName, AttrVal ***attr, int *TotalParams)
+{
+ return &getParamAttributes;
+}
+
+WAL_STATUS (*setParamAttributesFunc()) (const char *pParameterName, const AttrVal *attArr)
+{
+ return &setParamAttributes;
+}
+
+
+#endif
diff --git a/src/hostif/parodusClient/pal/webpa_notification.cpp b/src/hostif/parodusClient/pal/webpa_notification.cpp
index 473e0199b..81f52f0e4 100644
--- a/src/hostif/parodusClient/pal/webpa_notification.cpp
+++ b/src/hostif/parodusClient/pal/webpa_notification.cpp
@@ -249,3 +249,10 @@ int getnotifyparamList(char ***notifyParamList,int *ptrnotifyListSize)
}
return 0;
}
+
+#ifdef GTEST_ENABLE
+void (*macToLowerFunc())(char macValue[],char macConverted[])
+{
+ return &macToLower;
+}
+#endif
diff --git a/src/hostif/parodusClient/pal/webpa_parameter.cpp b/src/hostif/parodusClient/pal/webpa_parameter.cpp
index 7d9856225..aa504a528 100644
--- a/src/hostif/parodusClient/pal/webpa_parameter.cpp
+++ b/src/hostif/parodusClient/pal/webpa_parameter.cpp
@@ -788,3 +788,43 @@ static void converttoWalType(HostIf_ParamType_t paramType,WAL_DATA_TYPE* pwalTyp
}
}
+#ifdef GTEST_ENABLE
+WDMP_STATUS (*GetParamInfoFunc()) (const char *pParameterName, param_t ***parametervalPtrPtr, int *paramCountPtr,int paramIndex)
+{
+ return &GetParamInfo;
+}
+
+rbusValueType_t (*getRbusDataTypefromWebPAFunc())(WAL_DATA_TYPE type)
+{
+ return &getRbusDataTypefromWebPA;
+}
+
+DATA_TYPE (*mapRbusDataTypeToWebPAFunc()) (rbusValueType_t type)
+{
+ return &mapRbusDataTypeToWebPA;
+}
+WDMP_STATUS (*get_ParamValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *ptrParam)
+{
+ return &get_ParamValues_tr69hostIf;
+}
+
+WAL_STATUS (*set_ParamValues_tr69hostIfFunc()) (HOSTIF_MsgData_t *ptrParam)
+{
+ return &set_ParamValues_tr69hostIf;
+}
+
+WAL_STATUS (*convertFaultCodeToWalStatusFunc())(faultCode_t faultCode)
+{
+ return &convertFaultCodeToWalStatus;
+}
+
+void (*converttohostIfTypeFunc())(char *ParamDataType,HostIf_ParamType_t* pParamType)
+{
+ return &converttohostIfType;
+}
+
+void (*converttoWalTypeFunc())(HostIf_ParamType_t paramType,WAL_DATA_TYPE* pwalType)
+{
+ &converttoWalType;
+}
+#endif
diff --git a/src/hostif/parodusClient/startParodus/startParodus.cpp b/src/hostif/parodusClient/startParodus/startParodus.cpp
index 1b724ecf1..1ef133c08 100644
--- a/src/hostif/parodusClient/startParodus/startParodus.cpp
+++ b/src/hostif/parodusClient/startParodus/startParodus.cpp
@@ -269,6 +269,7 @@ std::string get_FwName()
return fw_name;
}
+#ifndef GTEST_ENABLE
int main(int argc, char *argv[])
{
try
@@ -530,3 +531,4 @@ int main(int argc, char *argv[])
return 0;
}
+#endif
diff --git a/src/hostif/parodusClient/startParodus/startParodus.h b/src/hostif/parodusClient/startParodus/startParodus.h
new file mode 100644
index 000000000..d38243578
--- /dev/null
+++ b/src/hostif/parodusClient/startParodus/startParodus.h
@@ -0,0 +1,35 @@
+/*
+ * If not stated otherwise in this file or this component's LICENSE file the
+ * following copyright and licenses apply:
+ *
+ * Copyright 2016 RDK Management
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+#ifndef STARTPARODUS_H_
+#define STARTPARODUS_H_
+
+#include
+#include