Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

// this is config displayed on the main page
const JTSO_VERSION string = "1.1.0"
const JTSO_VERSION string = "1.1.1"

type PortalConfig struct {
Https bool
Expand Down
17 changes: 13 additions & 4 deletions gnmicollect/node.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package gnmicollect

import "strings"
import (
"jtso/logger"
"strings"
)

type TrieNode struct {
children map[string]*TrieNode
Expand Down Expand Up @@ -124,8 +127,7 @@ func (n *TreeNode) Traverse(f func(node *TreeNode)) {
}
}

/// For gnmi once only - to auto detect aliasing

// / For gnmi once only - to auto detect aliasing
func Insert(root *TrieNode, base string, xpath string) {

// Normalize xpath starting with "./" -> concatenate with the base path
Expand All @@ -138,27 +140,34 @@ func Insert(root *TrieNode, base string, xpath string) {
node := root

for _, p := range parts {

if node.children == nil {
node.children = make(map[string]*TrieNode)

}
if _, ok := node.children[p]; !ok {
node.children[p] = &TrieNode{}

}
node = node.children[p]
node.count++

}
}

func CollectPrefixes(node *TrieNode, path []string, result *[]string) {
logger.Log.Infof("DEBUG: Collecting prefixes at node with count %d and path %v", node.count, path)
for seg, child := range node.children {
if child.count >= 2 {
logger.Log.Infof("DEBUG: Collecting prefix for segment %s with count %d", seg, child.count)
if child.count >= 1 {
// Copy path to avoid slice corruption from append reusing underlying array
newPath := make([]string, len(path)+1)
copy(newPath, path)
newPath[len(path)] = seg

stop := false
for _, gc := range child.children {
logger.Log.Infof("DEBUG: Checking grandchild %v with count %d", gc, gc.count)
if gc.count < 2 {
stop = true
break
Expand Down
2 changes: 2 additions & 0 deletions gnmicollect/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ Loop:

rootAlias := &TrieNode{}
for _, k := range fieldKeys {
logger.Log.Infof("DEBUG: Field extracted: %s with tags %v", k, fieldMap[k])
f := Field{
Name: k,
Monitor: false,
Expand All @@ -768,6 +769,7 @@ Loop:

// to detect alias then
Insert(rootAlias, o.Path, k)
logger.Log.Infof("DEBUG: Inserted in Trie with base %s and xpath %s", o.Path, k)
}

// Provision Alias if found out.
Expand Down
Loading