From 4ec95fc5abc75b5f1187735418b6d45a4becb58f Mon Sep 17 00:00:00 2001 From: Fabian Seidl <fabian.seidl@h-da.de> Date: Tue, 18 Feb 2025 15:41:22 +0000 Subject: [PATCH] Fix not being able to deal with uints from subscribers See merge request danet/gosdn!1218 --- controller/nucleus/networkElementWatcher.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controller/nucleus/networkElementWatcher.go b/controller/nucleus/networkElementWatcher.go index 07ad775f2..a81fd7a9c 100644 --- a/controller/nucleus/networkElementWatcher.go +++ b/controller/nucleus/networkElementWatcher.go @@ -245,7 +245,17 @@ func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.Subscrib log.Errorf("Error trying to create a string from path: %v", err) } - pathsAndValues[pathString] = update.Val.GetStringVal() + switch v := update.GetVal().GetValue().(type) { + case *gpb.TypedValue_StringVal: + pathsAndValues[pathString] = update.Val.GetStringVal() + case *gpb.TypedValue_JsonIetfVal: + pathsAndValues[pathString] = string(update.GetVal().GetJsonIetfVal()) + case *gpb.TypedValue_UintVal: + pathsAndValues[pathString] = fmt.Sprintf("%d", update.Val.GetUintVal()) + default: + log.Errorf("The given value of type: %T, provided by a SubResponse from network element with ID: %s is not supported", v, subscriptionInfo.NetworkElementID) + return + } } mneID, err := uuid.Parse(subscriptionInfo.NetworkElementID) -- GitLab