Skip to content

Commit

Permalink
Additional test cases for webpa_notification
Browse files Browse the repository at this point in the history
  • Loading branch information
suvi-123 committed Dec 19, 2023
1 parent edd7f95 commit 4be5f83
Show file tree
Hide file tree
Showing 5 changed files with 702 additions and 90 deletions.
7 changes: 6 additions & 1 deletion source/broadband/include/webpa_notification.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ typedef struct
* @brief Function pointer for Notification callback
*/
typedef void (*notifyCB)(NotifyData *notifyDataPtr);

#if defined(BUILD_YOCTO)
#define WEBPA_CFG_FILE "/nvram/webpa_cfg.json"
#else
#define WEBPA_CFG_FILE "/tmp/webpa_dummy.json"
#endif
/*----------------------------------------------------------------------------*/
/* Function Prototypes */
/*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -131,4 +135,5 @@ WDMP_STATUS validate_conn_client_notify_data(char *notify_param_name, char* inte
* @return status.
*/
WDMP_STATUS validate_webpa_notification_data(char *notify_param_name, char *write_id);
static void notifyCallback(NotifyData *notifyData);

30 changes: 16 additions & 14 deletions source/broadband/webpa_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,30 +442,30 @@ int getComponentDetails(char *parameterName,char ***compName,char ***dbusPath, i
#endif
snprintf(dst_pathname_cr, sizeof(dst_pathname_cr),"%s%s", l_Subsystem, CCSP_DBUS_INTERFACE_CR);
walStrncpy(tempParamName, parameterName,sizeof(tempParamName));
WalPrint("======= start of getComponentDetails ========\n");
WalInfo("======= start of getComponentDetails ========\n");
if(cachingStatus == 1)
{
WalPrint("Component caching is ready, fetch component details from cache\n");
WalInfo("Component caching is ready, fetch component details from cache\n");
index = getComponentInfoFromCache(tempParamName, objectName, tempCompName, tempDbusPath);
}
else
{
WalPrint("Component caching is not yet ready, fetch component details from stack\n");
WalInfo("Component caching is not yet ready, fetch component details from stack\n");
index = -1;
}
WalPrint("index : %d\n",index);
WalInfo("index : %d\n",index);
// Cannot identify the component from cache, make DBUS call to fetch component
if(index == -1 || ComponentValArray[index].comp_size > 2 || SubComponentValArray[index].comp_size >= 2) //comp size anything > 2 and sub comp size >1 . TCCBR-5475 allows dbus calls when sub comp size>1.
{
WalPrint("in if for size >2\n");
WalInfo("in if for size >2\n");
// GET Component for parameter from stack
if(index > 0 && ComponentValArray[index].comp_size > 2)
{
WalPrint("ComponentValArray[index].comp_size : %d\n",ComponentValArray[index].comp_size);
WalInfo("ComponentValArray[index].comp_size : %d\n",ComponentValArray[index].comp_size);
}
else if(index > 0 && SubComponentValArray[index].comp_size >= 2)
{
WalPrint("SubComponentValArray[index].comp_size : %d\n",SubComponentValArray[index].comp_size);
WalInfo("SubComponentValArray[index].comp_size : %d\n",SubComponentValArray[index].comp_size);
}
retIndex = IndexMpa_WEBPAtoCPE(tempParamName);
if(retIndex == -1)
Expand All @@ -485,11 +485,11 @@ int getComponentDetails(char *parameterName,char ***compName,char ***dbusPath, i
*error = 1;
return ret;
}
WalPrint("Get component for parameterName : %s from stack\n",tempParamName);
WalInfo("Get component for parameterName : %s from stack\n",tempParamName);

ret = CcspBaseIf_discComponentSupportingNamespace(bus_handle,
dst_pathname_cr, tempParamName, l_Subsystem, &ppComponents, &size);
WalPrint("size : %d, ret : %d\n",size,ret);
WalInfo("size : %d, ret : %d\n",size,ret);

if (ret == CCSP_SUCCESS)
{
Expand Down Expand Up @@ -535,7 +535,7 @@ int getComponentDetails(char *parameterName,char ***compName,char ***dbusPath, i
{
WalPrint("(*compName)[%d] : %s, (*dbusPath)[%d] : %s\n",i,(*compName)[i],i, (*dbusPath)[i]);
}
WalPrint("======= End of getComponentDetails ret =%d ========\n",ret);
WalInfo("======= End of getComponentDetails ret =%d ========\n",ret);
return CCSP_SUCCESS;
}

Expand All @@ -544,7 +544,7 @@ void prepareParamGroups(ParamCompList **ParamGroup,int paramCount,int cnt1,char
int cnt2 =0, subParamCount =0,matchFlag = 0, tempCount=0;
tempCount =*compCount;
ParamCompList *localParamGroup = *ParamGroup;
WalPrint("============ start of prepareParamGroups ===========\n");
WalInfo("============ start of prepareParamGroups ===========\n");
if(*ParamGroup == NULL)
{
WalPrint("ParamCompList is null initializing\n");
Expand Down Expand Up @@ -609,7 +609,7 @@ void prepareParamGroups(ParamCompList **ParamGroup,int paramCount,int cnt1,char
}
*compCount = tempCount;
*ParamGroup = localParamGroup;
WalPrint("============ End of prepareParamGroups compCount =%d===========\n",*compCount);
WalInfo("============ End of prepareParamGroups compCount =%d===========\n",*compCount);

}

Expand Down Expand Up @@ -813,7 +813,7 @@ void IndexMpa_CPEtoWEBPA(char **ppParameterName)
IndexMap[j].WebPaInstanceNumber,
restDmlString);
WAL_FREE(pParameterName);
WalPrint("pDmIntString : %s\n",pDmIntString);
WalInfo("pDmIntString : %s\n",pDmIntString);
*ppParameterName = pDmIntString;
return;
}
Expand All @@ -839,8 +839,10 @@ char * getParameterValue(char *paramName)
char *paramValue = (char *) malloc(sizeof(char)*64);
paramCount = sizeof(getParamList)/sizeof(getParamList[0]);
param_t **parametervalArr = (param_t **) malloc(sizeof(param_t *) * paramCount);

WalInfo("-----------before getValues----------\n");
getValues(getParamList, paramCount, 0, NULL,&parametervalArr, &count, &ret);
WalInfo("-----------After getValues----------\n");


if (ret == WDMP_SUCCESS )
{
Expand Down
Loading

0 comments on commit 4be5f83

Please sign in to comment.