Skip to content
Snippets Groups Projects
Commit 9fd75432 authored by Malte Bauch's avatar Malte Bauch Committed by Fabian Seidl
Browse files

Apply 1 suggestion(s) to 1 file(s)

parent 04584650
No related branches found
No related tags found
1 merge request!625Resolve "The mechanism to watch devices during controller start currently only supports watching the same path for each device"
Pipeline #170763 failed
This commit is part of merge request !625. Comments created here will be created in the context of that merge request.
...@@ -216,22 +216,7 @@ func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.Subscrib ...@@ -216,22 +216,7 @@ func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.Subscrib
// Paths should be provided in the following format [][]string{{"system", "config", "hostname"}}. // Paths should be provided in the following format [][]string{{"system", "config", "hostname"}}.
func (n *NetworkElementWatcher) mergeGnmiSubscriptions(gNMISusbcriptionPathsFromMne, gNMISusbcriptionPathsFromConfig [][]string) [][]string { func (n *NetworkElementWatcher) mergeGnmiSubscriptions(gNMISusbcriptionPathsFromMne, gNMISusbcriptionPathsFromConfig [][]string) [][]string {
// create slice with all elements // create slice with all elements
var tempJoinedPaths = gNMISusbcriptionPathsFromMne var tempJoinedPaths = append(gNMISusbcriptionPathsFromMne, gNMISusbcriptionPathsFromConfig...)
for _, configPath := range gNMISusbcriptionPathsFromConfig {
tempJoinedPaths = append(tempJoinedPaths, configPath)
}
// sort slice
sort.Slice(tempJoinedPaths[:], func(i, j int) bool {
for elem := range tempJoinedPaths[i] {
if tempJoinedPaths[i][elem] == tempJoinedPaths[j][elem] {
continue
}
return tempJoinedPaths[i][elem] < tempJoinedPaths[j][elem]
}
return false
})
// remove duplicates // remove duplicates
inResult := make(map[string]bool) inResult := make(map[string]bool)
...@@ -245,4 +230,5 @@ func (n *NetworkElementWatcher) mergeGnmiSubscriptions(gNMISusbcriptionPathsFrom ...@@ -245,4 +230,5 @@ func (n *NetworkElementWatcher) mergeGnmiSubscriptions(gNMISusbcriptionPathsFrom
} }
return joinedPaths return joinedPaths
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment