From 7289637f33723cb0ef3c5bc7053bb0419b2c90b2 Mon Sep 17 00:00:00 2001 From: Fabian Seidl <fabian.seidl@h-da.de> Date: Tue, 14 Jan 2025 14:11:30 +0000 Subject: [PATCH] Resolve "Improve subscription logging" See merge request danet/gosdn!1156 --- controller/nucleus/networkElementWatcher.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controller/nucleus/networkElementWatcher.go b/controller/nucleus/networkElementWatcher.go index 8b542d086..07ad775f2 100644 --- a/controller/nucleus/networkElementWatcher.go +++ b/controller/nucleus/networkElementWatcher.go @@ -200,6 +200,8 @@ func (n *NetworkElementWatcher) StopAndRemoveNetworkElementSubscription(subID uu // handleSubscribeResponse takes the subscribe response and additional information about the network element to distinguish // from which network element a subscribe response was sent including improved error handling. func (n *NetworkElementWatcher) handleSubscribeResponse(subscriptionInfo *transport.SubscriptionInformation, workerName string) { + log.Debugf("Received Subscribe response: MNE ID: %s, MNE Name: %s, SubResponse: %v", subscriptionInfo.NetworkElementID, subscriptionInfo.NetworkElementName, subscriptionInfo.SubResponse) + if subscriptionInfo.SubResponse == nil { // Note: This needs proper error handling, no idea how yet. Simply logging would lead to spam in the console // if the target that was subscribed to is not reachable anymore. @@ -232,6 +234,11 @@ func (n *NetworkElementWatcher) handleSubscribeResponse(subscriptionInfo *transp func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.SubscribeResponse_Update, subscriptionInfo *transport.SubscriptionInformation) { pathsAndValues := make(map[string]string, len(resp.Update.Update)) + if resp.Update == nil || len(resp.Update.Update) == 0 { + log.Debugf("handleSubscribeResponseUpdate empty update or updates; Update: %v, InnerUpdates: %v", resp.Update, resp.Update.Update) + return + } + for _, update := range resp.Update.Update { pathString, err := ygot.PathToString(update.Path) if err != nil { -- GitLab