Skip to content

Commit

Permalink
RDKB-56227:DNS Connectivity Check RFC Support (#42)
Browse files Browse the repository at this point in the history
Reason for change: Control DNS connectivity check feature by RFC. RFC DML should be persistent on reboot and factory reset.
Test Procedure:
1.)Test the RFC DML Device.X_RDK_WanManager.DnsConnectivityCheck.Enable
Risks: Medium
Priority: P2
Signed-off-by: kulvendra singh <[email protected]>

Co-authored-by: Augusto S. Mainardi <[email protected]>
  • Loading branch information
kul2241 and guto86 authored Aug 7, 2024
1 parent 5255669 commit 331c8cd
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 48 deletions.
21 changes: 18 additions & 3 deletions config/RdkWanManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,24 @@
<syntax>string</syntax>
<writable>true</writable>
</parameter>
</parameters>
<objects>
</parameters>
<objects>
<object>
<name>DnsConnectivityCheck</name>
<objectType>object</objectType>
<functions>
<func_GetParamBoolValue>WanMgr_DnsConnectivityCheck_GetParamBoolValue</func_GetParamBoolValue>
<func_SetParamBoolValue>WanMgr_DnsConnectivityCheck_SetParamBoolValue</func_SetParamBoolValue>
</functions>
<parameters>
<parameter>
<name>Enable</name>
<type>boolean</type>
<syntax>bool</syntax>
<writable>true</writable>
</parameter>
</parameters>
</object>
<object>
<name>CPEInterface</name>
<objectType>dynamicTable</objectType>
Expand Down Expand Up @@ -177,7 +193,6 @@
<?endif?>
</parameters>
</object>

<object>
<name>Wan</name>
<objectType>object</objectType>
Expand Down
18 changes: 17 additions & 1 deletion config/RdkWanManager_v2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,24 @@
<syntax>string</syntax>
<writable>true</writable>
</parameter>
</parameters>
</parameters>
<objects>
<object>
<name>DnsConnectivityCheck</name>
<objectType>object</objectType>
<functions>
<func_GetParamBoolValue>WanMgr_DnsConnectivityCheck_GetParamBoolValue</func_GetParamBoolValue>
<func_SetParamBoolValue>WanMgr_DnsConnectivityCheck_SetParamBoolValue</func_SetParamBoolValue>
</functions>
<parameters>
<parameter>
<name>Enable</name>
<type>boolean</type>
<syntax>bool</syntax>
<writable>true</writable>
</parameter>
</parameters>
</object>
<object>
<name>Group</name>
<objectType>dynamicTable</objectType>
Expand Down
3 changes: 1 addition & 2 deletions source/TR-181/include/dmsb_tr181_psm_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#define PSM_WANMANAGER_IF_VIRIF_IP_V6SOURCE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.IPv6Source"
#define PSM_WANMANAGER_IF_VIRIF_IP_PREFERREDMODE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.PreferredMode"
#define PSM_WANMANAGER_IF_VIRIF_IP_MODE_FORCE_ENABLE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.ModeForceEnable"
#define PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE "dmsb.wanmanager.if.%d.VirtualInterface.%d.IP.ConnectivityCheckType"

#if defined(WAN_MANAGER_UNIFICATION_ENABLED)
#define PSM_WANMANAGER_IF_SELECTION_ENABLE "dmsb.wanmanager.if.%d.Selection.Enable"
Expand All @@ -64,7 +65,6 @@

#define PSM_WANMANAGER_IF_VIRIF_ENABLE_MAPT "dmsb.wanmanager.if.%d.VirtualInterface.%d.EnableMAPT"
#define PSM_WANMANAGER_IF_VIRIF_ENABLE_DSLITE "dmsb.wanmanager.if.%d.VirtualInterface.%d.EnableDSLite"
#define PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE "dmsb.wanmanager.if.%d.VirtualInterface.%d.EnableIPoE"

#define PSM_WANMANAGER_GROUP_POLICY "dmsb.wanmanager.group.%d.policy"
#define PSM_WANMANAGER_WANIFCOUNT "dmsb.wanmanager.wan.interfacecount"
Expand All @@ -83,7 +83,6 @@

#define PSM_WANMANAGER_IF_VIRIF_ENABLE_MAPT "dmsb.wanmanager.if.%d.EnableMAPT"
#define PSM_WANMANAGER_IF_VIRIF_ENABLE_DSLITE "dmsb.wanmanager.if.%d.EnableDSLite"
#define PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE "dmsb.wanmanager.if.%d.EnableIPoE"
#define PSM_WANMANAGER_IF_VIRIF_PPP_ENABLE "dmsb.wanmanager.if.%d.PPPEnable"
#define PSM_WANMANAGER_IF_WAN_PPP_LINKTYPE "dmsb.wanmanager.if.%d.PPPLinkType"
#define PSM_WANMANAGER_IF_WAN_PPP_IPCP_ENABLE "dmsb.wanmanager.if.%d.PPPIPCPEnable"
Expand Down
3 changes: 1 addition & 2 deletions source/TR-181/include/wanmgr_dml.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ typedef enum {
} CONNECTIVITY_STATUS;

typedef enum {
WAN_CONNECTIVITY_TYPE_NO_CHECK = 1,
WAN_CONNECTIVITY_TYPE_NO_CHECK,
WAN_CONNECTIVITY_TYPE_IHC,
WAN_CONNECTIVITY_TYPE_TAD,
} CONNECTIVITY_CHECK_TYPE;
Expand Down Expand Up @@ -514,7 +514,6 @@ typedef struct _DML_VIRTUAL_IFACE
BOOL Enable;
BOOL EnableMAPT;
BOOL EnableDSLite;
BOOL EnableIPoE;
DML_WAN_IFACE_STATUS Status;
DML_WAN_IFACE_STATUS RemoteStatus;
DML_VIRTUALIF_VLAN VLAN;
Expand Down
89 changes: 89 additions & 0 deletions source/TR-181/middle_layer_src/wanmgr_dml_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,92 @@ ULONG WanManagerGroup_Commit(ANSC_HANDLE hInsContext)
return ret;
}
#endif /* WAN_MANAGER_UNIFICATION_ENABLED */


/***********************************************************************
APIs for Object:
X_RDK_WanManager.DnsConnectivityCheck.
* WanMgr_DnsConnectivityCheck_GetParamBoolValue
* WanMgr_DnsConnectivityCheck_SetParamBoolValue
***********************************************************************/

/**********************************************************************
caller: owner of this object
prototype:
BOOL WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool);
description:
This function is called to retrieve Boolean parameter value;
argument: ANSC_HANDLE hInsContext,
The instance handle;
char* ParamName,
The parameter name;
BOOL* pBool
The buffer of returned boolean value;
return: TRUE if succeeded.
**********************************************************************/
BOOL
WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool)
{
BOOL ret = FALSE;

if (strcmp(ParamName, "Enable") == 0)
{
*pBool= WanMgr_GetDnsConnectivityCheck();
ret = TRUE;
}
return ret;
}

/**********************************************************************
caller: owner of this object
prototype:
BOOL WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue);
description:
This function is called to set BOOL parameter value;
argument: ANSC_HANDLE hInsContext,
The instance handle;
char* ParamName,
The parameter name;
BOOL bValue
The updated BOOL value;
return: TRUE if succeeded.
**********************************************************************/

BOOL WanMgr_DnsConnectivityCheck_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue)
{
BOOL ret = FALSE;

if (strcmp(ParamName, "Enable") == 0)
{
if ( WanMgr_SetDnsConnectivityCheck(bValue) == ANSC_STATUS_SUCCESS)
{
ret = TRUE;
}
}
return ret;
}

2 changes: 2 additions & 0 deletions source/TR-181/middle_layer_src/wanmgr_dml_apis.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ BOOL WanManager_SetParamStringValue(ANSC_HANDLE hInsContext, char* ParamName, ch
LONG WanManager_GetParamStringValue(ANSC_HANDLE hInsContext, char* ParamName, char* pValue, ULONG* pUlSize);
BOOL WanManager_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool);
BOOL WanManager_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue);
BOOL WanMgr_DnsConnectivityCheck_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL* pBool);
BOOL WanMgr_DnsConnectivityCheck_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL bValue);
#if defined(WAN_MANAGER_UNIFICATION_ENABLED)
BOOL WanManagerGroup_IsUpdated(ANSC_HANDLE hInsContext);
ULONG WanManagerGroup_Synchronize(ANSC_HANDLE hInsContext);
Expand Down
20 changes: 17 additions & 3 deletions source/TR-181/middle_layer_src/wanmgr_dml_iface_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,11 @@ BOOL WanIfCfg_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL*
}
if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0)
{
*pBool = pWanDmlIface->VirtIfList->EnableIPoE;
*pBool = FALSE;
if (pWanDmlIface->VirtIfList->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC)
{
*pBool = TRUE;
}
ret = TRUE;
}
if (strcmp(ParamName, "EnableMAPT") == 0)
Expand Down Expand Up @@ -1046,8 +1050,18 @@ BOOL WanIfCfg_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BOOL b
}
if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0)
{
pWanDmlIface->VirtIfList->EnableIPoE = bValue;
ret = TRUE;
CONNECTIVITY_CHECK_TYPE type = bValue? WAN_CONNECTIVITY_TYPE_IHC:WAN_CONNECTIVITY_TYPE_NO_CHECK;
/*the below condition is, to avoid multiple time same value set and
* unsetting value of IPOE and DNS RFC DML from eachother */
if((type != pWanDmlIface->VirtIfList->IP.ConnectivityCheckType) &&
((type != WAN_CONNECTIVITY_TYPE_NO_CHECK) ||
(pWanDmlIface->VirtIfList->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC)))
{
WanMgr_SetConnectivityCheckTypeToPSM(pWanDmlIface->VirtIfList, type);
pWanDmlIface->VirtIfList->IP.WCC_TypeChanged = TRUE;
pWanDmlIface->VirtIfList->IP.ConnectivityCheckType = type;
ret = TRUE;
}
}
if (strcmp(ParamName, "EnableMAPT") == 0)
{
Expand Down
20 changes: 17 additions & 3 deletions source/TR-181/middle_layer_src/wanmgr_dml_iface_v2_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,7 +1510,11 @@ BOOL WanVirtualIf_GetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BO
}
if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0)
{
*pBool = p_VirtIf->EnableIPoE;
*pBool = FALSE;
if (p_VirtIf->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC)
{
*pBool = TRUE;
}
ret = TRUE;
}
if (strcmp(ParamName, "EnableMAPT") == 0)
Expand Down Expand Up @@ -1586,8 +1590,18 @@ BOOL WanVirtualIf_SetParamBoolValue(ANSC_HANDLE hInsContext, char* ParamName, BO
}
if (strcmp(ParamName, "EnableIPoEHealthCheck") == 0)
{
p_VirtIf->EnableIPoE = bValue;
ret = TRUE;
CONNECTIVITY_CHECK_TYPE type = bValue? WAN_CONNECTIVITY_TYPE_IHC:WAN_CONNECTIVITY_TYPE_NO_CHECK;
/*the below condition is, to avoid multiple time same value set and
* unsetting value of IPOE and DNS RFC DML from eachother */
if((type != p_VirtIf->IP.ConnectivityCheckType) &&
((type != WAN_CONNECTIVITY_TYPE_NO_CHECK) ||
(p_VirtIf->IP.ConnectivityCheckType == WAN_CONNECTIVITY_TYPE_IHC)))
{
WanMgr_SetConnectivityCheckTypeToPSM(p_VirtIf, type);
p_VirtIf->IP.WCC_TypeChanged = TRUE;
p_VirtIf->IP.ConnectivityCheckType = type;
ret = TRUE;
}
}
if (strcmp(ParamName, "EnableMAPT") == 0)
{
Expand Down
3 changes: 3 additions & 0 deletions source/TR-181/middle_layer_src/wanmgr_plugin_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,9 @@ int ANSC_EXPORT_API WanManagerDmlInit(ULONG uMaxVersionSupported, void* hCosaPlu
pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManager_Validate", WanManager_Validate);
pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManager_Commit", WanManager_Commit);

pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanMgr_DnsConnectivityCheck_GetParamBoolValue", WanMgr_DnsConnectivityCheck_GetParamBoolValue);
pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanMgr_DnsConnectivityCheck_SetParamBoolValue", WanMgr_DnsConnectivityCheck_SetParamBoolValue);

#if defined(WAN_MANAGER_UNIFICATION_ENABLED)
pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManagerGroup_IsUpdated", WanManagerGroup_IsUpdated);
pPlugInfo->RegisterFunction(pPlugInfo->hContext, "WanManagerGroup_Synchronize", WanManagerGroup_Synchronize);
Expand Down
52 changes: 24 additions & 28 deletions source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU
char param_name[512];
CcspTraceInfo(("%s %d Update Wan Virtual iface Conf from PSM \n", __FUNCTION__, __LINE__));

pVirtIf->VirIfIdx = virtInsNum;

_ansc_memset(param_name, 0, sizeof(param_name));
_ansc_memset(param_value, 0, sizeof(param_value));
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE_MAPT, instancenum, (virtInsNum + 1));
Expand Down Expand Up @@ -252,19 +250,6 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU
pVirtIf->EnableDSLite = TRUE;
}

_ansc_memset(param_name, 0, sizeof(param_name));
_ansc_memset(param_value, 0, sizeof(param_value));
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE, instancenum, (virtInsNum + 1));
retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value));

if(strcmp(param_value, PSM_ENABLE_STRING_TRUE) == 0)
{
pVirtIf->EnableIPoE = TRUE;
CcspTraceInfo(("%s %d IP.ConnectivityCheckType set to WAN_CONNECTIVITY_TYPE_IHC \n", __FUNCTION__, __LINE__));
/* Set ConnectivityCheckType to IPOE Health Check if it is enabled. */
pVirtIf->IP.ConnectivityCheckType = WAN_CONNECTIVITY_TYPE_IHC;
}

_ansc_memset(param_name, 0, sizeof(param_name));
_ansc_memset(param_value, 0, sizeof(param_value));
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE, instancenum, (virtInsNum + 1));
Expand Down Expand Up @@ -380,6 +365,30 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU
{
pVirtIf->IP.ModeForceEnable = TRUE;
}

_ansc_memset(param_name, 0, sizeof(param_name));
_ansc_memset(param_value, 0, sizeof(param_value));
_ansc_sprintf(param_name, PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE, instancenum, (virtInsNum + 1));
retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value));
if(retPsmGet == CCSP_SUCCESS)
{
_ansc_sscanf(param_value, "%d", &(pVirtIf->IP.ConnectivityCheckType));
}
}

int get_Remote_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTUAL_IFACE * pVirtIf)
{
int retPsmGet = CCSP_SUCCESS;
char param_value[256] = {0};
char param_name[512] = {0};
CcspTraceInfo(("%s %d Update Remote Wan Virtual iface Conf from PSM \n", __FUNCTION__, __LINE__));

_ansc_sprintf(param_name, PSM_WANMANAGER_CONNECTIVITY_CHECK_TYPE, instancenum, (virtInsNum + 1));
retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value));
if(retPsmGet == CCSP_SUCCESS)
{
_ansc_sscanf(param_value, "%d", &(pVirtIf->IP.ConnectivityCheckType));
}
}

void WanMgr_getRemoteWanIfName(char *IfaceName,int Size)
Expand Down Expand Up @@ -480,19 +489,6 @@ int write_Virtual_Interface_ToPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU

CcspTraceInfo(("%s %d Entered\n", __FUNCTION__, __LINE__));

memset(param_value, 0, sizeof(param_value));
memset(param_name, 0, sizeof(param_name));
if(pVirtIf->EnableIPoE == TRUE)
{
_ansc_sprintf(param_value, "TRUE");
}
else
{
_ansc_sprintf(param_value, "FALSE");
}
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE_IPOE, instancenum, (virtInsNum + 1));
WanMgr_RdkBus_SetParamValuesToDB(param_name,param_value);

memset(param_value, 0, sizeof(param_value));
memset(param_name, 0, sizeof(param_name));
if(pVirtIf->EnableDSLite == TRUE)
Expand Down
1 change: 1 addition & 0 deletions source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ ANSC_STATUS WanMgr_RdkBus_setWanPolicy(DML_WAN_POLICY wan_policy, UINT groupId);
ANSC_STATUS WanMgr_Read_GroupConf_FromPSM(WANMGR_IFACE_GROUP *pGroup, UINT groupId);
ANSC_STATUS DmlSetVLANInUseToPSMDB(DML_VIRTUAL_IFACE * pVirtIf);
ANSC_STATUS DmlGetTotalNoOfWanInterfaces(int *wan_if_count);
int get_Remote_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTUAL_IFACE * pVirtIf);
#endif /* _WANMGR_RDKBUS_APIS_H_ */
Loading

0 comments on commit 331c8cd

Please sign in to comment.