From a6f0bf7191a7724f8aa2daa3cc3e8d3e93204ea4 Mon Sep 17 00:00:00 2001 From: RahulRengeshOfficial Date: Tue, 16 Dec 2025 01:42:51 +0530 Subject: [PATCH 1/5] Update estb_firmware_context.go --- dataapi/estb_firmware_context.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dataapi/estb_firmware_context.go b/dataapi/estb_firmware_context.go index 8c0826f1..af2c2df0 100644 --- a/dataapi/estb_firmware_context.go +++ b/dataapi/estb_firmware_context.go @@ -246,17 +246,19 @@ func AddEstbFirmwareContext(ws *xhttp.XconfServer, r *http.Request, contextMap m if xAccountId != nil && xAccountId.GetAccountId() != "" { accountProducts, err := ws.GroupServiceConnector.GetAccountProducts(xAccountId.GetAccountId(), fields) if err != nil { - log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") - } else { + log.WithFields(log.Fields{"error": err, "accountId": xAccountId.GetAccountId()}).Error("Error getting AccountService information") + } else if len(accountProducts) > 0 { if partner, ok := accountProducts["Partner"]; ok && partner != "" { contextMap[common.PARTNER_ID] = partner } + } else { + log.WithFields(fields).Warn("Empty or nil response from ADA keyspace") } } } } else { //err both the service - log.WithFields(log.Fields{"error": err}).Error("Both the Account Service calls have been disabled") + log.Error("Both the Account Service calls have been disabled") } AddContextFromTaggingService(ws, contextMap, satToken, "", false, fields) AddGroupServiceFTContext(Ws, common.ESTB_MAC, contextMap, true, fields) From 02bdcd194f207aeec812b1e5000a6d97b45afbd8 Mon Sep 17 00:00:00 2001 From: RahulRengeshOfficial Date: Tue, 16 Dec 2025 01:44:16 +0530 Subject: [PATCH 2/5] Update estb_firmware_context.go --- dataapi/estb_firmware_context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dataapi/estb_firmware_context.go b/dataapi/estb_firmware_context.go index af2c2df0..d5707503 100644 --- a/dataapi/estb_firmware_context.go +++ b/dataapi/estb_firmware_context.go @@ -246,7 +246,7 @@ func AddEstbFirmwareContext(ws *xhttp.XconfServer, r *http.Request, contextMap m if xAccountId != nil && xAccountId.GetAccountId() != "" { accountProducts, err := ws.GroupServiceConnector.GetAccountProducts(xAccountId.GetAccountId(), fields) if err != nil { - log.WithFields(log.Fields{"error": err, "accountId": xAccountId.GetAccountId()}).Error("Error getting AccountService information") + log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") } else if len(accountProducts) > 0 { if partner, ok := accountProducts["Partner"]; ok && partner != "" { contextMap[common.PARTNER_ID] = partner From 8ff1bfbb22f0ca75f226ca755162383138c4c687 Mon Sep 17 00:00:00 2001 From: RahulRengeshOfficial Date: Tue, 16 Dec 2025 17:49:35 +0530 Subject: [PATCH 3/5] Update estb_firmware_context.go --- dataapi/estb_firmware_context.go | 39 +++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/dataapi/estb_firmware_context.go b/dataapi/estb_firmware_context.go index d5707503..fa9a662e 100644 --- a/dataapi/estb_firmware_context.go +++ b/dataapi/estb_firmware_context.go @@ -238,23 +238,50 @@ func AddEstbFirmwareContext(ws *xhttp.XconfServer, r *http.Request, contextMap m } } } else if Xc.EnableAccountDataService { - if util.IsValidMacAddress(contextMap[common.ESTB_MAC_ADDRESS]) || util.IsValidMacAddress(contextMap[common.ECM_MAC_ADDRESS]) { - xAccountId, err := ws.GroupServiceConnector.GetAccountIdData(contextMap[common.ECM_MAC_ADDRESS], fields) + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: EnableAccountDataService=true, starting ADA keyspace retrieval flow")) + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: ContextMap keys available: ESTB_MAC='%s', ECM_MAC='%s', ECM_MAC_PARAM='%s'", contextMap[common.ESTB_MAC], contextMap[common.ECM_MAC], contextMap[common.ECM_MAC_PARAM])) + // Use ECM_MAC (normalized key after NormalizeCommonContext), fallback to ECM_MAC_PARAM (URL parameter) + ecmMacValue := contextMap[common.ECM_MAC] + if ecmMacValue == "" { + ecmMacValue = contextMap[common.ECM_MAC_PARAM] + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: ECM_MAC empty, using fallback ECM_MAC_PARAM='%s'", ecmMacValue)) + } + if util.IsValidMacAddress(contextMap[common.ESTB_MAC]) || util.IsValidMacAddress(ecmMacValue) { + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: Valid MAC address found, calling XAC endpoint with ecmMacValue='%s'", ecmMacValue)) + xAccountId, err := ws.GroupServiceConnector.GetAccountIdData(ecmMacValue, fields) if err != nil { - log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") + log.WithFields(log.Fields{"error": err}).Error("ADA_DEBUG: XAC call failed - Error getting AccountIdData from XAC keyspace") + } else { + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: XAC call successful, received xAccountId object")) } if xAccountId != nil && xAccountId.GetAccountId() != "" { + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: AccountId retrieved from XAC='%s', calling ADA endpoint", xAccountId.GetAccountId())) accountProducts, err := ws.GroupServiceConnector.GetAccountProducts(xAccountId.GetAccountId(), fields) if err != nil { - log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") - } else if len(accountProducts) > 0 { + log.WithFields(log.Fields{"error": err, "accountId": xAccountId.GetAccountId()}).Error("ADA_DEBUG: ADA call failed - Error getting AccountProducts from ADA keyspace") + } else { + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: ADA call successful, received accountProducts map with %d entries", len(accountProducts))) + } + if len(accountProducts) > 0 { + log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: AccountProducts map contents: %v", accountProducts)) if partner, ok := accountProducts["Partner"]; ok && partner != "" { contextMap[common.PARTNER_ID] = partner + log.WithFields(fields).Info(fmt.Sprintf("ADA_DEBUG: Partner successfully extracted from ADA keyspace and set in contextMap: '%s'", partner)) + } else { + log.WithFields(fields).Warn("ADA_DEBUG: Partner field missing or empty in accountProducts map from ADA keyspace") } } else { - log.WithFields(fields).Warn("Empty or nil response from ADA keyspace") + log.WithFields(fields).Warn("ADA_DEBUG: Empty accountProducts map received from ADA keyspace (len=0)") + } + } else { + if xAccountId == nil { + log.WithFields(fields).Warn("ADA_DEBUG: XAC returned nil xAccountId object") + } else { + log.WithFields(fields).Warn("ADA_DEBUG: XAC returned empty AccountId string") } } + } else { + log.WithFields(fields).Warn(fmt.Sprintf("ADA_DEBUG: No valid MAC address found in contextMap - ESTB_MAC='%s', ECM_MAC='%s', ecmMacValue='%s'", contextMap[common.ESTB_MAC], contextMap[common.ECM_MAC], ecmMacValue)) } } else { //err both the service From 47b70ba4c5f794d12b23b77eef5263134c6a4d6a Mon Sep 17 00:00:00 2001 From: RahulRengeshOfficial Date: Tue, 16 Dec 2025 17:53:42 +0530 Subject: [PATCH 4/5] Update estb_firmware_context.go --- dataapi/estb_firmware_context.go | 31 +++---------------------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/dataapi/estb_firmware_context.go b/dataapi/estb_firmware_context.go index fa9a662e..c2884877 100644 --- a/dataapi/estb_firmware_context.go +++ b/dataapi/estb_firmware_context.go @@ -238,50 +238,25 @@ func AddEstbFirmwareContext(ws *xhttp.XconfServer, r *http.Request, contextMap m } } } else if Xc.EnableAccountDataService { - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: EnableAccountDataService=true, starting ADA keyspace retrieval flow")) - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: ContextMap keys available: ESTB_MAC='%s', ECM_MAC='%s', ECM_MAC_PARAM='%s'", contextMap[common.ESTB_MAC], contextMap[common.ECM_MAC], contextMap[common.ECM_MAC_PARAM])) - // Use ECM_MAC (normalized key after NormalizeCommonContext), fallback to ECM_MAC_PARAM (URL parameter) ecmMacValue := contextMap[common.ECM_MAC] if ecmMacValue == "" { ecmMacValue = contextMap[common.ECM_MAC_PARAM] - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: ECM_MAC empty, using fallback ECM_MAC_PARAM='%s'", ecmMacValue)) } if util.IsValidMacAddress(contextMap[common.ESTB_MAC]) || util.IsValidMacAddress(ecmMacValue) { - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: Valid MAC address found, calling XAC endpoint with ecmMacValue='%s'", ecmMacValue)) xAccountId, err := ws.GroupServiceConnector.GetAccountIdData(ecmMacValue, fields) if err != nil { - log.WithFields(log.Fields{"error": err}).Error("ADA_DEBUG: XAC call failed - Error getting AccountIdData from XAC keyspace") - } else { - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: XAC call successful, received xAccountId object")) + log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") } if xAccountId != nil && xAccountId.GetAccountId() != "" { - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: AccountId retrieved from XAC='%s', calling ADA endpoint", xAccountId.GetAccountId())) accountProducts, err := ws.GroupServiceConnector.GetAccountProducts(xAccountId.GetAccountId(), fields) if err != nil { - log.WithFields(log.Fields{"error": err, "accountId": xAccountId.GetAccountId()}).Error("ADA_DEBUG: ADA call failed - Error getting AccountProducts from ADA keyspace") - } else { - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: ADA call successful, received accountProducts map with %d entries", len(accountProducts))) - } - if len(accountProducts) > 0 { - log.WithFields(fields).Debug(fmt.Sprintf("ADA_DEBUG: AccountProducts map contents: %v", accountProducts)) + log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") + } else if len(accountProducts) > 0 { if partner, ok := accountProducts["Partner"]; ok && partner != "" { contextMap[common.PARTNER_ID] = partner - log.WithFields(fields).Info(fmt.Sprintf("ADA_DEBUG: Partner successfully extracted from ADA keyspace and set in contextMap: '%s'", partner)) - } else { - log.WithFields(fields).Warn("ADA_DEBUG: Partner field missing or empty in accountProducts map from ADA keyspace") } - } else { - log.WithFields(fields).Warn("ADA_DEBUG: Empty accountProducts map received from ADA keyspace (len=0)") - } - } else { - if xAccountId == nil { - log.WithFields(fields).Warn("ADA_DEBUG: XAC returned nil xAccountId object") - } else { - log.WithFields(fields).Warn("ADA_DEBUG: XAC returned empty AccountId string") } } - } else { - log.WithFields(fields).Warn(fmt.Sprintf("ADA_DEBUG: No valid MAC address found in contextMap - ESTB_MAC='%s', ECM_MAC='%s', ecmMacValue='%s'", contextMap[common.ESTB_MAC], contextMap[common.ECM_MAC], ecmMacValue)) } } else { //err both the service From fdb593338c598449f92d693710d549e47b07013b Mon Sep 17 00:00:00 2001 From: RahulRengeshOfficial Date: Tue, 16 Dec 2025 18:04:55 +0530 Subject: [PATCH 5/5] Update estb_firmware_context.go --- dataapi/estb_firmware_context.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dataapi/estb_firmware_context.go b/dataapi/estb_firmware_context.go index c2884877..f822300f 100644 --- a/dataapi/estb_firmware_context.go +++ b/dataapi/estb_firmware_context.go @@ -251,9 +251,14 @@ func AddEstbFirmwareContext(ws *xhttp.XconfServer, r *http.Request, contextMap m accountProducts, err := ws.GroupServiceConnector.GetAccountProducts(xAccountId.GetAccountId(), fields) if err != nil { log.WithFields(log.Fields{"error": err}).Error("Error getting AccountService information") - } else if len(accountProducts) > 0 { - if partner, ok := accountProducts["Partner"]; ok && partner != "" { - contextMap[common.PARTNER_ID] = partner + } else { + if len(accountProducts) == 0 { + log.WithFields(fields).Warn("Empty or nil response from ADA keyspace") + } else { + // Successfully retrieved, update context + if partner, ok := accountProducts["Partner"]; ok && partner != "" { + contextMap[common.PARTNER_ID] = partner + } } } }