diff --git a/context.go b/context.go index c2f4b497..bbf1da09 100644 --- a/context.go +++ b/context.go @@ -43,12 +43,6 @@ func work(jctx *JCtx, statusch chan bool) { var opts []grpc.DialOption vendor, err := getVendor(jctx) - if *conTestData && vendor.consumeTestData != nil { - vendor.consumeTestData(jctx) - statusch <- false - return - } - if opts, err = getGPRCDialOptions(jctx, vendor); err != nil { jLog(jctx, fmt.Sprintf("%v", err)) statusch <- false diff --git a/influx.go b/influx.go index 88f4a498..cab8c4ae 100644 --- a/influx.go +++ b/influx.go @@ -69,7 +69,7 @@ func pointAcculumator(jctx *JCtx) { freq := jctx.config.Influx.AccumulatorFrequency accumulatorCh := make(chan *metricIDB, 1024*10) jctx.influxCtx.accumulatorCh = accumulatorCh - jLog(jctx, fmt.Sprintln("Accumulator frequency:", freq)) + jLog(jctx, fmt.Sprintln("Accumulator frequency:", freq)) ticker := time.NewTicker(time.Duration(freq) * time.Millisecond) diff --git a/multi_vendor.go b/multi_vendor.go index 6c65e62c..6e621d80 100644 --- a/multi_vendor.go +++ b/multi_vendor.go @@ -14,7 +14,6 @@ type vendor struct { sendLoginCheck func(*JCtx, *grpc.ClientConn) error dialExt func(*JCtx) grpc.DialOption subscribe func(*grpc.ClientConn, *JCtx, chan<- bool) SubErrorCode - consumeTestData func(*JCtx) } func getVendor(jctx *JCtx) (*vendor, error) { @@ -38,7 +37,6 @@ func newJuniperJUNOS() *vendor { sendLoginCheck: loginCheckJunos, dialExt: nil, subscribe: subscribeJunos, - consumeTestData: nil, } } @@ -49,6 +47,5 @@ func newCiscoIOSXR() *vendor { sendLoginCheck: nil, dialExt: dialExtensionXR, subscribe: subscribeXR, - consumeTestData: consumeTestDataXR, } } diff --git a/subscribe_cisco_iosxr.go b/subscribe_cisco_iosxr.go index 540179bd..b99cad00 100644 --- a/subscribe_cisco_iosxr.go +++ b/subscribe_cisco_iosxr.go @@ -7,7 +7,6 @@ import ( "fmt" "io" "io/ioutil" - "log" "os" "path/filepath" "strconv" @@ -162,93 +161,6 @@ func generateTestData(jctx *JCtx, data []byte) { } } -func consumeTestDataXR(jctx *JCtx) { - schema, err := getXRSchema(jctx) - if err != nil { - jLog(jctx, fmt.Sprintf("%s", err)) - return - } - - sizeFileContent, err := ioutil.ReadFile(jctx.file + ".testmeta") - if err != nil { - log.Printf("%v", err) - return - } - - data, err := os.Open(jctx.file + ".testbytes") - if err != nil { - log.Printf("%v data: %v", err, data) - return - } - defer data.Close() - - testRes, err := os.Create(jctx.file + ".testres") - if err != nil { - log.Printf("%v data: %v", err, data) - return - } - jctx.testRes = testRes - defer testRes.Close() - - sizes := strings.Split(string(sizeFileContent), ":") - for _, size := range sizes { - if size != "" { - n, err := strconv.ParseInt(size, 10, 64) - if err != nil { - fmt.Printf("%v\n", err) - return - } - fmt.Printf("Reading %d bytes\n", n) - d := make([]byte, n) - bytesRead, err := data.Read(d) - if err != nil { - fmt.Printf("%v\n", err) - return - } - if int64(bytesRead) != n { - fmt.Printf("want %d got %d", n, bytesRead) - return - } - message := new(telemetry.Telemetry) - err = proto.Unmarshal(d, message) - if err != nil { - fmt.Printf("%v\n", err) - return - } - path := message.GetEncodingPath() - if path == "" { - jLog(jctx, "Device did not send encoding path - ignoring this message") - continue - } - - ePath := strings.Split(path, "/") - if len(ePath) == 1 { - jLog(jctx, fmt.Sprintf("The message matched with top-level subscription %s\n", ePath)) - for _, nodes := range schema.nodes { - for _, node := range nodes { - if strings.Compare(ePath[0], node.Name) == 0 { - for _, fields := range message.GetDataGpbkv() { - parentPath := []string{node.Name} - processTopLevelMsg(jctx, node, fields, parentPath) - } - } - } - } - } else if len(ePath) >= 2 { - jLog(jctx, fmt.Sprintf("Multi level path %s", ePath)) - for _, nodes := range schema.nodes { - for _, node := range nodes { - if strings.Compare(ePath[0], node.Name) == 0 { - processMultiLevelMsg(jctx, node, ePath, message) - } - } - } - - } - } - } -} - func handleOnePath(schema *schema, id int64, path string, conn *grpc.ClientConn, jctx *JCtx, statusch chan<- bool, datach chan<- struct{}) { c := pb.NewGRPCConfigOperClient(conn)