Skip to content
Snippets Groups Projects

Resolve "The mechanism to watch devices during controller start currently only supports watching the same path for each device"

All threads resolved!
1 file
+ 2
16
Compare changes
  • Side-by-side
  • Inline
@@ -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
 
}
}
Loading