Skip to content

Commit

Permalink
RDKB-57254 : MAP-T Unification (#72)
Browse files Browse the repository at this point in the history
RDKB-57254 : MAP-T Unification

Reason for change: MAP-T Unification

Test Procedure: Regression Test on MAPT lines

Risks: none
Priority: P1

Signed-off-by: parthiban.selvaraj <[email protected]>
  • Loading branch information
S-Parthiban-Selvaraj authored Dec 11, 2024
1 parent 10ecb7a commit 2037c24
Show file tree
Hide file tree
Showing 20 changed files with 1,525 additions and 565 deletions.
12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ AC_ARG_ENABLE([gtestapp],
[echo "Gtestapp is disabled"])
AM_CONDITIONAL([WITH_GTEST_SUPPORT], [test x$GTEST_SUPPORT_ENABLED = xtrue])

AC_ARG_ENABLE([wanunificationsupport],
AS_HELP_STRING([--enable-wanunificationsupport],[enable wan unification support (default is no)]),
[
case "${enableval}" in
yes) WAN_UNIFICATION_SUPPORT_ENABLED=true;;
no) WAN_UNIFICATION_SUPPORT_ENABLED=false;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-wanunificationsupport ]);;
esac
],
[echo "mapt unification is disabled"])
AM_CONDITIONAL(WAN_UNIFICATION_ENABLED, test "x$WAN_UNIFICATION_SUPPORT_ENABLED" = xtrue)

dnl Checks for header files.
AC_CHECK_HEADERS([limits.h memory.h stdlib.h string.h sys/socket.h unistd.h])

Expand Down
9 changes: 7 additions & 2 deletions source/TR-181/include/wanmgr_dml.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ typedef struct _WANMGR_IPV4_DATA
uint32_t downstreamCurrRate; /** Downstream rate */
char dhcpServerId[BUFLEN_64]; /** Dhcp server id */
char dhcpState[BUFLEN_64]; /** Dhcp state. */
uint32_t leaseTime; /** Lease time, , if addressAssigned==TRUE */
uint32_t leaseTime; /** Lease time */
#endif
} WANMGR_IPV4_DATA;

Expand All @@ -340,6 +340,11 @@ typedef struct _WANMGR_IPV6_DATA
#endif
} WANMGR_IPV6_DATA;

typedef struct _WANMGR_IPV6_RA_DATA
{
char defaultRoute[INET6_ADDRSTRLEN];
uint32_t defRouteLifeTime;
} WANMGR_IPV6_RA_DATA;

typedef struct _DML_WANIFACE_IP
{
Expand All @@ -355,7 +360,6 @@ typedef struct _DML_WANIFACE_IP
BOOL RestartConnectivityCheck;
BOOL WCC_TypeChanged; // Flag to notify change in ConnectivityCheckType
BOOL RefreshDHCP;
BOOL RestartV6Client; //This is a workaround to restart dhcpv6 client for the platform where PAM configures IPv6. !FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE
DML_WAN_IP_MODE Mode;
DML_WAN_IP_PREFERRED_MODE PreferredMode;
DML_WAN_IP_PREFERRED_MODE SelectedMode;
Expand All @@ -368,6 +372,7 @@ typedef struct _DML_WANIFACE_IP
BOOL Ipv6Renewed;
WANMGR_IPV4_DATA Ipv4Data;
WANMGR_IPV6_DATA Ipv6Data;
WANMGR_IPV6_RA_DATA Ipv6Route;
ipc_dhcpv4_data_t* pIpcIpv4Data;
ipc_dhcpv6_data_t* pIpcIpv6Data;
UINT Dhcp4cPid;
Expand Down
69 changes: 28 additions & 41 deletions source/TR-181/middle_layer_src/wanmgr_rbus_handler_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1661,33 +1661,40 @@ static void CPEInterface_AsyncMethodHandler(
{
char AliasName[64] = {0};
snprintf(AliasName, sizeof(AliasName), "REMOTE_%s" , pValue);
strncpy( pWanIfaceData->AliasName, AliasName,sizeof(pWanIfaceData->AliasName)-1 );
//Set Alias name of Virtual interface
strncpy( pWanIfaceData->VirtIfList->Alias, AliasName,sizeof(pWanIfaceData->VirtIfList->Alias)-1 );
//Register the interface again if Alias changed
int rc = -1;
rc = rbusTable_registerRow(rbusHandle, WANMGR_INFACE_TABLE, (cpeInterfaceIndex+1), AliasName);
if(rc != RBUS_ERROR_SUCCESS)
if(strcmp(AliasName,pWanIfaceData->AliasName) !=0)
{
CcspTraceError(("%s %d - Iterface(%d) Table (%s) Registartion failed \n",
__FUNCTION__, __LINE__, (cpeInterfaceIndex+1), WANMGR_INFACE_TABLE));
}
#if defined(WAN_MANAGER_UNIFICATION_ENABLED)
char tmpVIfTableName[256] = {0};
for(int VirId=0; VirId< pWanDmlIfaceData->data.NoOfVirtIfs; VirId++)
{
snprintf(tmpVIfTableName, sizeof(tmpVIfTableName), WANMGR_VIRTUAL_INFACE_TABLE_ALIAS, AliasName);
rc = rbusTable_registerRow(rbusHandle, tmpVIfTableName, (VirId+1), AliasName); //TODO: NEW_DESIGN get Alias name for virtual table
strncpy( pWanIfaceData->AliasName, AliasName,sizeof(pWanIfaceData->AliasName)-1 );
//Set Alias name of Virtual interface
strncpy( pWanIfaceData->VirtIfList->Alias, AliasName,sizeof(pWanIfaceData->VirtIfList->Alias)-1 );
//Register the interface again if Alias changed
char param_name[256] = {0};
snprintf(param_name,sizeof(param_name), "%s.%d", WANMGR_INFACE_TABLE, (cpeInterfaceIndex+1));
rbusTable_unregisterRow(rbusHandle, param_name);

int rc = -1;
rc = rbusTable_registerRow(rbusHandle, WANMGR_INFACE_TABLE, (cpeInterfaceIndex+1), AliasName);
if(rc != RBUS_ERROR_SUCCESS)
{
CcspTraceError(("%s %d - VirtualInterface(%d) Table (%s) Registartion failed, Error=%d \n", __FUNCTION__, __LINE__, (VirId+1), tmpVIfTableName, rc));
CcspTraceError(("%s %d - Iterface(%d) Table (%s) Registartion failed \n",
__FUNCTION__, __LINE__, (cpeInterfaceIndex+1), WANMGR_INFACE_TABLE));
}
else
#if defined(WAN_MANAGER_UNIFICATION_ENABLED)
char tmpVIfTableName[256] = {0};
for(int VirId=0; VirId< pWanDmlIfaceData->data.NoOfVirtIfs; VirId++)
{
CcspTraceInfo(("%s %d - VirtualInterface(%d) Table (%s) Registartion Successfully, AliasName(%s)\n", __FUNCTION__, __LINE__, (VirId+1), tmpVIfTableName, AliasName));
snprintf(tmpVIfTableName, sizeof(tmpVIfTableName), WANMGR_VIRTUAL_INFACE_TABLE_ALIAS, AliasName);
rc = rbusTable_registerRow(rbusHandle, tmpVIfTableName, (VirId+1), AliasName); //TODO: NEW_DESIGN get Alias name for virtual table
if(rc != RBUS_ERROR_SUCCESS)
{
CcspTraceError(("%s %d - VirtualInterface(%d) Table (%s) Registartion failed, Error=%d \n", __FUNCTION__, __LINE__, (VirId+1), tmpVIfTableName, rc));
}
else
{
CcspTraceInfo(("%s %d - VirtualInterface(%d) Table (%s) Registartion Successfully, AliasName(%s)\n", __FUNCTION__, __LINE__, (VirId+1), tmpVIfTableName, AliasName));
}
}
}
#endif
}
}
else if( WANMGR_PHY_STATUS_CHECK )
{
Expand Down Expand Up @@ -1888,7 +1895,7 @@ ANSC_STATUS WanMgr_Configure_TAD_WCC(DML_VIRTUAL_IFACE *p_VirtIf, WCC_EVENT Eve
snprintf(pTADEvent->IPv4_DNS_Servers, sizeof(pTADEvent->IPv4_DNS_Servers), "%s,%s",p_VirtIf->IP.Ipv4Data.dnsServer,p_VirtIf->IP.Ipv4Data.dnsServer1);
snprintf(pTADEvent->IPv4_Gateway, sizeof(pTADEvent->IPv4_Gateway), "%s",p_VirtIf->IP.Ipv4Data.gateway);
snprintf(pTADEvent->IPv6_DNS_Servers, sizeof(pTADEvent->IPv6_DNS_Servers), "%s,%s",p_VirtIf->IP.Ipv6Data.nameserver,p_VirtIf->IP.Ipv6Data.nameserver1);
//TODO: Add Ipv6 gateway address after integrating with DHCP manager. Currently, wanmanager doesn't have information of IPv6 gateway address
snprintf(pTADEvent->IPv6_Gateway, sizeof(pTADEvent->IPv6_Gateway), "%s",p_VirtIf->IP.Ipv6Route.defaultRoute,p_VirtIf->IP.Ipv6Route.defaultRoute);
pTADEvent->Event = Event;

//Run in thread to avoid mutex deadlock between WanManager and rbus handle
Expand Down Expand Up @@ -1959,26 +1966,6 @@ void *WanMgr_Configure_WCC_Thread(void *arg)
snprintf(pTADEvent->IPv6_DNS_Servers, sizeof(pTADEvent->IPv6_DNS_Servers), "%s,", strtok(MeshWANInterfaceUla, "/"));
snprintf(pTADEvent->IPv6_Gateway, sizeof(pTADEvent->IPv6_Gateway), "%s", strtok(MeshWANInterfaceUla, "/"));
}
else //TODO: Workaround to fetch Ipv6 gateway address from the routing table. This should be removed after integrating DHCPmanager
{
FILE *fp_route;
char command[BUFLEN_256] = {0};
char buffer[BUFLEN_256] ={0};
snprintf(command, sizeof(command), "ip -6 route show default | grep %s | awk '{print $3}'", pTADEvent->IfaceName);
fp_route = popen(command, "r");
if(fp_route != NULL)
{
if (fgets(buffer, BUFLEN_256, fp_route) != NULL)
{
char *token = strtok(buffer, "\n"); // get string up until newline character
if (token)
{
strncpy(pTADEvent->IPv6_Gateway, token, sizeof(pTADEvent->IPv6_Gateway)-1);
}
}
pclose(fp_route);
}
}

// set IPv6 nameserver list
CcspTraceInfo(("%s %d: IPv6_DNS_Servers %s \n", __FUNCTION__, __LINE__, pTADEvent->IPv6_DNS_Servers));
Expand Down
4 changes: 0 additions & 4 deletions source/TR-181/middle_layer_src/wanmgr_rdkbus_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,11 @@ int get_Virtual_Interface_FromPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU
pVirtIf->Enable = TRUE;
}

#if defined(FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE) /* TODO: This is a workaround for the platforms using same Wan Name.*/
_ansc_memset(param_name, 0, sizeof(param_name));
_ansc_memset(param_value, 0, sizeof(param_value));
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_NAME, instancenum, (virtInsNum + 1));
retPsmGet = WanMgr_RdkBus_GetParamValuesFromDB(param_name,param_value,sizeof(param_value));
AnscCopyString(pVirtIf->Name, param_value);
#endif

_ansc_memset(param_name, 0, sizeof(param_name));
_ansc_memset(param_value, 0, sizeof(param_value));
Expand Down Expand Up @@ -530,13 +528,11 @@ int write_Virtual_Interface_ToPSM(ULONG instancenum, ULONG virtInsNum ,DML_VIRTU
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_ENABLE, instancenum, (virtInsNum + 1));
WanMgr_RdkBus_SetParamValuesToDB(param_name,param_value);

#if defined(FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE) /* TODO: This is a workaround for the platforms using same Wan Name.*/
memset(param_value, 0, sizeof(param_value));
memset(param_name, 0, sizeof(param_name));
AnscCopyString(param_value, pVirtIf->Name);
_ansc_sprintf(param_name, PSM_WANMANAGER_IF_VIRIF_NAME, instancenum, (virtInsNum + 1));
WanMgr_RdkBus_SetParamValuesToDB(param_name,param_value);
#endif

memset(param_value, 0, sizeof(param_value));
memset(param_name, 0, sizeof(param_name));
Expand Down
4 changes: 2 additions & 2 deletions source/TR-181/middle_layer_src/wanmgr_rdkbus_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,14 +967,14 @@ ANSC_STATUS WanMgr_RdkBus_setDhcpv6DnsServerInfo(void)
#if defined(FEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE)
ANSC_STATUS WanMgr_RdkBus_setWanIpInterfaceData(DML_VIRTUAL_IFACE* pVirtIf)
{
ANSC_STATUS retStatus = ANSC_STATUS_FAILURE;
ANSC_STATUS retStatus = ANSC_STATUS_SUCCESS;
char dmQuery[BUFLEN_256] = {0};
snprintf(dmQuery, sizeof(dmQuery)-1, "%s.LowerLayers", pVirtIf->IP.Interface);
if(pVirtIf->PPP.Enable == TRUE)
{
retStatus = WanMgr_RdkBus_SetParamValues( PAM_COMPONENT_NAME, PAM_DBUS_PATH, dmQuery, pVirtIf->PPP.Interface, ccsp_string, TRUE );
CcspTraceInfo(("%s %d - Updating %s => %s\n", __FUNCTION__, __LINE__,dmQuery, pVirtIf->PPP.Interface));
}else
}else if(pVirtIf->VLAN.Enable == TRUE)
{
retStatus = WanMgr_RdkBus_SetParamValues( PAM_COMPONENT_NAME, PAM_DBUS_PATH, dmQuery, pVirtIf->VLAN.VLANInUse, ccsp_string, TRUE );
CcspTraceInfo(("%s %d - Updating %s => %s\n", __FUNCTION__, __LINE__,dmQuery,pVirtIf->VLAN.VLANInUse));
Expand Down
Loading

0 comments on commit 2037c24

Please sign in to comment.