From edc55a3b4d904cbc408f9b17151a4d3f10c53133 Mon Sep 17 00:00:00 2001 From: Fabian Seidl <fabian.seidl@h-da.de> Date: Tue, 18 Feb 2025 15:27:01 +0000 Subject: [PATCH 1/2] fix not being able to deal with uints --- controller/nucleus/networkElementWatcher.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/controller/nucleus/networkElementWatcher.go b/controller/nucleus/networkElementWatcher.go index 07ad775f2..a3351f054 100644 --- a/controller/nucleus/networkElementWatcher.go +++ b/controller/nucleus/networkElementWatcher.go @@ -245,7 +245,19 @@ 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 + } + + update.Val.GetUintVal() } mneID, err := uuid.Parse(subscriptionInfo.NetworkElementID) -- GitLab From ee0c07b252b9a137e62507eb8acd6eb31e01b8f8 Mon Sep 17 00:00:00 2001 From: Fabian Seidl <fabian.seidl@h-da.de> Date: Tue, 18 Feb 2025 15:28:23 +0000 Subject: [PATCH 2/2] remove unnecessary code --- controller/nucleus/networkElementWatcher.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/controller/nucleus/networkElementWatcher.go b/controller/nucleus/networkElementWatcher.go index a3351f054..a81fd7a9c 100644 --- a/controller/nucleus/networkElementWatcher.go +++ b/controller/nucleus/networkElementWatcher.go @@ -256,8 +256,6 @@ func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.Subscrib 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 } - - update.Val.GetUintVal() } mneID, err := uuid.Parse(subscriptionInfo.NetworkElementID) -- GitLab