Skip to content
Snippets Groups Projects

Resolve "Requesting information from the Controller via NBI takes very long"

All threads resolved!
8 files
+ 195
129
Compare changes
  • Side-by-side
  • Inline
Files
8
+ 48
0
package config
import (
"bufio"
"fmt"
"os"
"path/filepath"
"strings"
)
const (
defaultGnmiSubscriptionFilePath = "controller/configs/gNMISubscriptions.txt"
)
var gnmiSubscriptionPaths [][]string
// ReadGnmiSubscriptionPaths reads the paths the watcher should subscribe to provided in a file.
func ReadGnmiSubscriptionPaths() error {
currentDir, err := os.Getwd()
if err != nil {
return err
}
filePath := filepath.Join(currentDir, defaultGnmiSubscriptionFilePath)
f, err := os.Open(filePath)
if err != nil {
return err
}
defer f.Close()
scanner := bufio.NewScanner(f)
for scanner.Scan() {
path := strings.Split(scanner.Text(), "/")
gnmiSubscriptionPaths = append(gnmiSubscriptionPaths, path)
}
fmt.Println(gnmiSubscriptionPaths)
return nil
}
// GetGnmiSubscriptionPaths returns the paths the watcher should subscribe to.
func GetGnmiSubscriptionPaths() [][]string {
return gnmiSubscriptionPaths
}
Loading