diff --git a/cli/http.go b/cli/http.go new file mode 100644 index 0000000000000000000000000000000000000000..2554574f2657fdd9dd845f1d77cdd7546a202300 --- /dev/null +++ b/cli/http.go @@ -0,0 +1,50 @@ +package cli + +import ( + "fmt" + log "github.com/sirupsen/logrus" + "io/ioutil" + "net/http" + "strings" +) + +const apiRoot = "/api?" + +var builder *strings.Builder + +func init() { + builder = &strings.Builder{} +} + +func HttpGet(apiEndpoint, f string, args ...string) error { + for _, p := range args { + builder.WriteString("&") + builder.WriteString(p) + } + resp, err := http.Get(apiEndpoint + apiRoot + "q=" + f + builder.String()) + if err != nil { + return err + } + builder.Reset() + switch resp.StatusCode { + case http.StatusOK: + defer resp.Body.Close() + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + fmt.Println(string(bytes)) + case http.StatusCreated: + defer resp.Body.Close() + bytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + fmt.Println(string(bytes)) + default: + log.WithFields(log.Fields{ + "status code": resp.StatusCode, + }).Error("operation unsuccessful") + } + return nil +} diff --git a/cli/target.go b/cli/target.go index c81936375abd30d3a251e075f0adaecbd2274028..cd35e87a352590ed8f26bdfc94583113d189cbc0 100644 --- a/cli/target.go +++ b/cli/target.go @@ -4,16 +4,13 @@ import ( "code.fbi.h-da.de/cocsn/gosdn/forks/google/gnmi" oc "code.fbi.h-da.de/cocsn/yang-models/generated/openconfig" "context" - "github.com/google/gnxi/utils/credentials" pb "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/goyang/pkg/yang" "github.com/openconfig/ygot/util" "github.com/openconfig/ygot/ygot" log "github.com/sirupsen/logrus" "google.golang.org/grpc" - "google.golang.org/grpc/codes" "google.golang.org/grpc/reflection" - "google.golang.org/grpc/status" "net" "reflect" ) @@ -39,12 +36,6 @@ func newServer(model *gnmi.Model, config []byte) (*server, error) { // Get overrides the Get func of gnmi.Target to provide user auth. func (s *server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error) { - msg, ok := credentials.AuthorizeUser(ctx) - if !ok { - log.Infof("denied a Get request: %v", msg) - return nil, status.Error(codes.PermissionDenied, msg) - } - log.Infof("allowed a Get request: %v", msg) return s.Server.Get(ctx, req) } @@ -64,7 +55,7 @@ func (s *server) Set(ctx context.Context, req *pb.SetRequest) (*pb.SetResponse, // Target starts a gNMI target listening on the specified port. func Target(bindAddr string) error { entries := make([]*yang.Entry, 0) - for _,e := range oc.SchemaTree { + for _, e := range oc.SchemaTree { entries = append(entries, e) } diff --git a/cli/ygot.go b/cli/ygot.go index a414ff2a8c43add11d4d99491fe342a49e9ab3f0..51b12852e6274d94279972793333ea3be3131657 100644 --- a/cli/ygot.go +++ b/cli/ygot.go @@ -1,12 +1,12 @@ package cli import ( - log "github.com/golang/glog" "github.com/openconfig/ygot/util" + log "github.com/sirupsen/logrus" ) func LeafPaths() error { - for _,v := range testSchema.SchemaTree { + for _, v := range testSchema.SchemaTree { entry, err := util.FindLeafRefSchema(v, "/interface/") if err != nil { log.Error(err) @@ -14,4 +14,4 @@ func LeafPaths() error { log.Info(entry) } return nil -} \ No newline at end of file +} diff --git a/cmd/addDevice.go b/cmd/addDevice.go new file mode 100644 index 0000000000000000000000000000000000000000..c534ec48dc91fd48651c0d4497708f35aae27847 --- /dev/null +++ b/cmd/addDevice.go @@ -0,0 +1,56 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "code.fbi.h-da.de/cocsn/gosdn/cli" + "github.com/spf13/cobra" +) + +// addDeviceCmd represents the addDevice command +var addDeviceCmd = &cobra.Command{ + Use: "add-device", + Short: "adds a device to the controller", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.HttpGet( + apiEndpoint, + "addDevice", + "address="+address, + "password="+password, + "username="+username, + ) + }, +} + +func init() { + cliCmd.AddCommand(addDeviceCmd) +} diff --git a/cmd/cli.go b/cmd/cli.go new file mode 100644 index 0000000000000000000000000000000000000000..ebe9af89ac336e0d8b737bbc7c9c6e35d85769f2 --- /dev/null +++ b/cmd/cli.go @@ -0,0 +1,56 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "errors" + "github.com/spf13/cobra" +) + +var uuid string +var apiEndpoint string + +// cliCmd represents the cli command +var cliCmd = &cobra.Command{ + Use: "cli", + Short: "", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return errors.New("no subcommand provided") + }, +} + +func init() { + rootCmd.AddCommand(cliCmd) + + cliCmd.PersistentFlags().StringVar(&uuid, "uuid", "", "uuid of the requested device") + cliCmd.PersistentFlags().StringVar(&apiEndpoint, "api-endpoint", "http://localhost:8080", "address of the target") +} diff --git a/cmd/cliSet.go b/cmd/cliSet.go new file mode 100644 index 0000000000000000000000000000000000000000..324915c72f906de5bbfd6dea0ab53768d5c3d0e8 --- /dev/null +++ b/cmd/cliSet.go @@ -0,0 +1,57 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "code.fbi.h-da.de/cocsn/gosdn/cli" + "github.com/spf13/cobra" +) + +// cliSetCmd represents the cliSet command +var cliSetCmd = &cobra.Command{ + Use: "set", + Short: "set a value on a device", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.HttpGet( + apiEndpoint, + "set", + "uuid="+uuid, + "path="+args[0], + "address="+address, + "value="+args[1], + ) + }, +} + +func init() { + cliCmd.AddCommand(cliSetCmd) +} diff --git a/cmd/getDevice.go b/cmd/getDevice.go new file mode 100644 index 0000000000000000000000000000000000000000..ea4b7271a93abef45649e7372836cb3c9389b16e --- /dev/null +++ b/cmd/getDevice.go @@ -0,0 +1,50 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "code.fbi.h-da.de/cocsn/gosdn/cli" + "github.com/spf13/cobra" +) + +// getDeviceCmd represents the getDevice command +var getDeviceCmd = &cobra.Command{ + Use: "get-device", + Short: "gets device information from the controller", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.HttpGet(apiEndpoint, "getDevice", "uuid="+uuid) + }, +} + +func init() { + cliCmd.AddCommand(getDeviceCmd) +} diff --git a/cmd/getIds.go b/cmd/getIds.go new file mode 100644 index 0000000000000000000000000000000000000000..adab3025ee9fe37196e2aa35d83aa3624a13b3f0 --- /dev/null +++ b/cmd/getIds.go @@ -0,0 +1,50 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "code.fbi.h-da.de/cocsn/gosdn/cli" + "github.com/spf13/cobra" +) + +// getIdsCmd represents the getIds command +var getIdsCmd = &cobra.Command{ + Use: "get-ids", + Short: "gets device IDs from the controller", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.HttpGet(apiEndpoint, "getIDs") + }, +} + +func init() { + cliCmd.AddCommand(getIdsCmd) +} diff --git a/cmd/request.go b/cmd/request.go new file mode 100644 index 0000000000000000000000000000000000000000..9cb4a00ae353c77062caaefaaf26364d8eb092d0 --- /dev/null +++ b/cmd/request.go @@ -0,0 +1,50 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "code.fbi.h-da.de/cocsn/gosdn/cli" + "github.com/spf13/cobra" +) + +// requestCmd represents the request command +var requestCmd = &cobra.Command{ + Use: "request", + Short: "requests a path from a specified device on the controller", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.HttpGet(apiEndpoint, "request", "uuid="+uuid, "path="+args[0]) + }, +} + +func init() { + cliCmd.AddCommand(requestCmd) +} diff --git a/cmd/requestAll.go b/cmd/requestAll.go new file mode 100644 index 0000000000000000000000000000000000000000..d3196783db09b47df0dc8fc51a01c3c5547fbb90 --- /dev/null +++ b/cmd/requestAll.go @@ -0,0 +1,50 @@ +/* +Copyright © 2021 da/net research group <danet.fbi.h-da.de> +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +*/ +package cmd + +import ( + "code.fbi.h-da.de/cocsn/gosdn/cli" + "github.com/spf13/cobra" +) + +// requestAllCmd represents the requestAll command +var requestAllCmd = &cobra.Command{ + Use: "request-all", + Short: "requests specified path from all devices on the controller", + Long: ``, + RunE: func(cmd *cobra.Command, args []string) error { + return cli.HttpGet(apiEndpoint, "requestAll", "path="+args[0]) + }, +} + +func init() { + cliCmd.AddCommand(requestAllCmd) +} diff --git a/cmd/root.go b/cmd/root.go index 66cdc3210192b7d22bfd981685f68c3d5df235f3..463bdcc35bb1427196a3374add90b5fb0868234f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -31,16 +31,14 @@ POSSIBILITY OF SUCH DAMAGE. package cmd import ( - "code.fbi.h-da.de/cocsn/gosdn/nucleus" - "context" - "fmt" - log "github.com/sirupsen/logrus" - "github.com/spf13/cobra" - "os" - - "github.com/spf13/viper" -) + "code.fbi.h-da.de/cocsn/gosdn/nucleus" + "context" + log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "os" + "github.com/spf13/viper" +) var cfgFile string var username string @@ -49,79 +47,74 @@ var address string var loglevel string var grpcPort string - // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Use: "gosdn", - Short: "starts the gosdn controller", - Long: `Set GOSDN_DEBUG environment variable to enalbe debug logging.`, - RunE: func(cmd *cobra.Command, args []string) error { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - return nucleus.Run(ctx) - }, + Use: "gosdn", + Short: "starts the gosdn controller", + Long: `Set GOSDN_DEBUG environment variable to enalbe debug logging.`, + RunE: func(cmd *cobra.Command, args []string) error { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + return nucleus.Run(ctx) + }, } // Execute adds all child commands to the root command and sets flags appropriately. // This is called by main.main(). It only needs to happen once to the rootCmd. func Execute() { - if err := rootCmd.Execute(); err != nil { - log.WithFields(log.Fields{ - - }).Error(err) - os.Exit(1) - } + if err := rootCmd.Execute(); err != nil { + log.WithFields(log.Fields{}).Error(err) + os.Exit(1) + } } func init() { - cobra.OnInitialize(initConfig) + cobra.OnInitialize(initConfig) - // Here you will define your flags and configuration settings. - // Cobra supports persistent flags, which, if defined here, - // will be global for your application. + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. - rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./configs/gosdn.toml)") - rootCmd.PersistentFlags().StringVarP(&username, "username", "u", "admin", "username for a gnmi resource") - rootCmd.PersistentFlags().StringVarP(&password, "password", "p", "arista", "password for a gnmi resource") - rootCmd.PersistentFlags().StringVarP(&username, "address", "a", "ceos-cocsn.apps.ocp.fbi.h-da.de:6030", "address to a gnmi resource") - rootCmd.PersistentFlags().StringVarP(&loglevel, "log-level", "l", "", "log level 'debug' or 'trace'") + rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./configs/gosdn.toml)") + rootCmd.PersistentFlags().StringVarP(&username, "username", "u", "admin", "username for a gnmi resource") + rootCmd.PersistentFlags().StringVarP(&password, "password", "p", "arista", "password for a gnmi resource") + rootCmd.PersistentFlags().StringVarP(&address, "address", "a", "ceos-cocsn.apps.ocp.fbi.h-da.de:6030", "address to a gnmi resource") + rootCmd.PersistentFlags().StringVarP(&loglevel, "log-level", "l", "", "log level 'debug' or 'trace'") - rootCmd.Flags().StringVar(&grpcPort, "grpc-port", "55055", "port for gRPC NBI") + rootCmd.Flags().StringVar(&grpcPort, "grpc-port", "55055", "port for gRPC NBI") } - // initConfig reads in config file and ENV variables if set. func initConfig() { - if cfgFile != "" { - // Use config file from the flag. - viper.SetConfigFile(cfgFile) - } else { - viper.AddConfigPath("./configs") - viper.AddConfigPath("/usr/local/etc/gosdn/") - viper.SetConfigType("toml") - viper.SetConfigName("gosdn") - } - - viper.AutomaticEnv() // read in environment variables that match - - // If a config file is found, read it in. - if err := viper.ReadInConfig(); err == nil { - fmt.Println("Using config file:", viper.ConfigFileUsed()) - } - - viper.SetDefault("socket", ":" + grpcPort) - - loglevel = viper.GetString("GOSDN_LOG") - log.SetReportCaller(true) - switch loglevel { - case "trace": - log.SetLevel(log.TraceLevel) - case "debug": - log.SetLevel(log.DebugLevel) - default: - log.SetLevel(log.InfoLevel) - log.SetFormatter(&log.JSONFormatter{}) - log.SetReportCaller(false) - } + if cfgFile != "" { + // Use config file from the flag. + viper.SetConfigFile(cfgFile) + } else { + viper.AddConfigPath("./configs") + viper.AddConfigPath("/usr/local/etc/gosdn/") + viper.SetConfigType("toml") + viper.SetConfigName("gosdn") + } + + viper.AutomaticEnv() // read in environment variables that match + + // If a config file is found, read it in. + if err := viper.ReadInConfig(); err == nil { + log.Debug("Using config file:", viper.ConfigFileUsed()) + } + + viper.SetDefault("socket", ":"+grpcPort) + + loglevel = viper.GetString("GOSDN_LOG") + log.SetReportCaller(true) + switch loglevel { + case "trace": + log.SetLevel(log.TraceLevel) + case "debug": + log.SetLevel(log.DebugLevel) + default: + log.SetLevel(log.InfoLevel) + log.SetFormatter(&log.JSONFormatter{}) + log.SetReportCaller(false) + } } - diff --git a/cmd/subscribe.go b/cmd/subscribe.go index 68b3cd99f83e291c66e34f238ede56231f185750..63f58fd72d02f21a7d1dfe9da45819797176e41b 100644 --- a/cmd/subscribe.go +++ b/cmd/subscribe.go @@ -42,7 +42,7 @@ var heartbeatInterval int64 var subscribeCmd = &cobra.Command{ Use: "subscribe", Short: "subscribe to target", - Long: `Starts a gNMI subscriber requersting the specified paths on the target and logs the response to stdout. + Long: `Starts a gNMI subscriber requesting the specified paths on the target and logs the response to stdout. Only 'stream' mode with 'sample' operation supported.`, RunE: func(cmd *cobra.Command, args []string) error { @@ -53,6 +53,6 @@ var subscribeCmd = &cobra.Command{ func init() { rootCmd.AddCommand(subscribeCmd) - subscribeCmd.Flags().Int64Var(&sampleInterval, "sample-rate", 5, "Sample rate per second.") - subscribeCmd.Flags().Int64Var(&heartbeatInterval, "heartbeat-rate", 1, "Heartbeat rate per second.") + subscribeCmd.Flags().Int64Var(&sampleInterval, "sample-rate", 5, "Sample rate per second.") + subscribeCmd.Flags().Int64Var(&heartbeatInterval, "heartbeat-rate", 1, "Heartbeat rate per second.") } diff --git a/forks/google/gnmi/modeldata/modeldata.go b/forks/google/gnmi/modeldata/modeldata.go deleted file mode 100644 index dac86fba7006a025ca17b448318dd73dcd3e41bf..0000000000000000000000000000000000000000 --- a/forks/google/gnmi/modeldata/modeldata.go +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2017 Google Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - https://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// Package modeldata contains the following model data in gnmi proto struct: -// openconfig-interfaces 2.0.0, -// openconfig-openflow 0.1.0, -// openconfig-platform 0.5.0, -// openconfig-system 0.2.0. -package modeldata - -import ( - pb "github.com/openconfig/gnmi/proto/gnmi" -) - -const ( - // OpenconfigInterfacesModel is the openconfig YANG model for interfaces. - OpenconfigInterfacesModel = "openconfig-interfaces" - // OpenconfigOpenflowModel is the openconfig YANG model for openflow. - OpenconfigOpenflowModel = "openconfig-openflow" - // OpenconfigPlatformModel is the openconfig YANG model for platform. - OpenconfigPlatformModel = "openconfig-platform" - // OpenconfigSystemModel is the openconfig YANG model for system. - OpenconfigSystemModel = "openconfig-system" -) - -var ( - // ModelData is a list of supported models. - ModelData = []*pb.ModelData{{ - Name: OpenconfigInterfacesModel, - Organization: "OpenConfig working group", - Version: "2.0.0", - }, { - Name: OpenconfigOpenflowModel, - Organization: "OpenConfig working group", - Version: "0.1.0", - }, { - Name: OpenconfigPlatformModel, - Organization: "OpenConfig working group", - Version: "0.5.0", - }, { - Name: OpenconfigSystemModel, - Organization: "OpenConfig working group", - Version: "0.2.0", - }} -) diff --git a/forks/google/gnmi/server.go b/forks/google/gnmi/server.go index 0cc56f64d062544d2ab1d5db5b00924e58285c6c..2f9416149ea5b861078378049a4e3a416b7bde7c 100644 --- a/forks/google/gnmi/server.go +++ b/forks/google/gnmi/server.go @@ -31,12 +31,12 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - log "github.com/golang/glog" "github.com/golang/protobuf/proto" "github.com/openconfig/gnmi/value" "github.com/openconfig/ygot/util" "github.com/openconfig/ygot/ygot" "github.com/openconfig/ygot/ytypes" + log "github.com/sirupsen/logrus" dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" pb "github.com/openconfig/gnmi/proto/gnmi" diff --git a/forks/google/gnmi/util.go b/forks/google/gnmi/util.go index 0a12c05bcc8b007b030831dea016c2e909ff046c..73d17b49f7cab79a20236681c773b50844060af4 100644 --- a/forks/google/gnmi/util.go +++ b/forks/google/gnmi/util.go @@ -4,8 +4,8 @@ import ( "fmt" "strconv" - log "github.com/golang/glog" "github.com/openconfig/goyang/pkg/yang" + log "github.com/sirupsen/logrus" pb "github.com/openconfig/gnmi/proto/gnmi" ) diff --git a/go.mod b/go.mod index a816066f9eb7c0960ae2db6f577903e529f16b7c..faee747e2c6223257200e9c73644d31ae0d0ee47 100644 --- a/go.mod +++ b/go.mod @@ -8,11 +8,9 @@ require ( github.com/aristanetworks/goarista v0.0.0-20201120222254-94a892eb0c6a github.com/go-openapi/runtime v0.19.22 github.com/go-openapi/strfmt v0.19.5 - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/protobuf v1.4.3 github.com/google/gnxi v0.0.0-20201221102247-c26672548161 github.com/google/uuid v1.1.2 - github.com/mitchellh/go-homedir v1.1.0 github.com/neo4j/neo4j-go-driver v1.8.3 github.com/openconfig/gnmi v0.0.0-20200617225440-d2b4e6a45802 github.com/openconfig/goyang v0.2.3 diff --git a/go.sum b/go.sum index 70db040bd062cdb899f48d595eeb96e3f317d264..dfffc0bc55001916b519a0c493f640160d99b12f 100644 --- a/go.sum +++ b/go.sum @@ -335,7 +335,6 @@ github.com/mholt/archiver/v3 v3.5.0/go.mod h1:qqTTPUK/HZPFgFQ/TJ3BzvTpF/dPtFVJXd github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= diff --git a/nucleus/controller.go b/nucleus/controller.go index f7477d6baf0dd5514442c1424d176a1ce0676179..e239bca0d3f6e3cc57d948ea8fffb3e10575ec4f 100644 --- a/nucleus/controller.go +++ b/nucleus/controller.go @@ -20,7 +20,7 @@ type Core struct { var c *Core //Initialize does start-up housekeeping like reading controller config files -func initialize() error { +func initialize(ctx context.Context) error { c = &Core{ database: database.Database{}, pndc: pndStore{}, @@ -38,7 +38,7 @@ func initialize() error { } // TODO: Start grpc listener here - if err := httpApi(); err != nil { + if err := httpApi(ctx); err != nil { return err } @@ -62,10 +62,8 @@ func createSouthboundInterfaces() error { } func Run(ctx context.Context) error { - if err := initialize(); err != nil { - log.WithFields(log.Fields{ - - }).Error(err) + if err := initialize(ctx); err != nil { + log.WithFields(log.Fields{}).Error(err) return err } log.WithFields(log.Fields{}).Info("initialisation finished") diff --git a/nucleus/errors.go b/nucleus/errors.go index 453dccf3b8b872085410f512e72906f08c2a96a5..1578ecb1615404a37a7c06021e35a6141280e3bb 100644 --- a/nucleus/errors.go +++ b/nucleus/errors.go @@ -12,6 +12,13 @@ func (e *ErrNilClient) Error() string { return fmt.Sprintf("client cannot be nil") } +type ErrNil struct { +} + +func (e *ErrNil) Error() string { + return fmt.Sprintf("struct cannot be nil") +} + type ErrNotFound struct { id interface{} } @@ -66,4 +73,4 @@ type ErrInvalidTransportOptions struct { func (e ErrInvalidTransportOptions) Error() string { return fmt.Sprintf("invalid transport options: %v", reflect.TypeOf(e.t)) -} \ No newline at end of file +} diff --git a/nucleus/gnmi_transport.go b/nucleus/gnmi_transport.go index 8ac57497b1df1eebd03018d1a7ff2ef8275daa6a..f496e67802955ad6fc30dc87f3befb605e89aa19 100644 --- a/nucleus/gnmi_transport.go +++ b/nucleus/gnmi_transport.go @@ -25,8 +25,8 @@ func NewGnmiTransport(opts *GnmiTransportOptions) (*Gnmi, error) { return nil, err } log.WithFields(log.Fields{ - "target": opts.Addr, - "tls": opts.TLS, + "target": opts.Addr, + "tls": opts.TLS, "encoding": opts.Encoding, }).Info("building new gNMI transport") return &Gnmi{ @@ -59,31 +59,35 @@ func (g *Gnmi) Get(ctx context.Context, params ...string) (interface{}, error) { // Set takes a slice of params. This slice must contain at least one operation. // It can contain an additional arbitrary amount of operations and extensions. -func (g *Gnmi) Set(ctx context.Context, params ...interface{}) (interface{}, error) { +func (g *Gnmi) Set(ctx context.Context, args ...interface{}) (interface{}, error) { if g.client == nil { return nil, &ErrNilClient{} } - if len(params) == 0 { + if len(args) == 0 { return nil, &ErrInvalidParameters{ f: "gnmi.Set()", r: "no parameters provided", } } - // Loop over params and create ops and exts - // Invalid params cause unhealable error + // Loop over args and create ops and exts + // Invalid args cause unhealable error ops := make([]*gnmi.Operation, 0) exts := make([]*gnmi_ext.Extension, 0) - for _, p := range params { + for _, p := range args { switch p.(type) { case *gnmi.Operation: - ops = append(ops, p.(*gnmi.Operation)) + op := p.(*gnmi.Operation) + if op.Target == "" { + op.Target = g.Options.Addr + } + ops = append(ops, op) case *gnmi_ext.Extension: exts = append(exts, p.(*gnmi_ext.Extension)) default: return nil, &ErrInvalidParameters{ f: "gnmi.Set()", - r: "params contain invalid type", + r: "args contain invalid type", } } } @@ -171,6 +175,9 @@ func (g *Gnmi) get(ctx context.Context, paths [][]string, origin string) (interf // getWithRequest takes a fully formed GetRequest, performs the Get, // and returns any response. func (g *Gnmi) getWithRequest(ctx context.Context, req *gpb.GetRequest) (interface{}, error) { + if req == nil { + return nil, &ErrNil{} + } log.WithFields(log.Fields{ "target": g.Options.Addr, "path": req.Path, @@ -190,15 +197,15 @@ func (g *Gnmi) set(ctx context.Context, setOps []*gnmi.Operation, targets := make([]string, len(setOps)) paths := make([][]string, len(setOps)) values := make([]string, len(setOps)) - for i,v := range setOps { + for i, v := range setOps { targets[i] = v.Target paths[i] = v.Path values[i] = v.Val } log.WithFields(log.Fields{ "targets": targets, - "paths": paths, - "values": values, + "paths": paths, + "values": values, }).Info("sending gNMI set request") return gnmi.Set(ctx, g.client, setOps, exts...) } @@ -209,9 +216,9 @@ func (g *Gnmi) subscribe(ctx context.Context) error { opts := ctx.Value("opts").(*gnmi.SubscribeOptions) go func() { log.WithFields(log.Fields{ - "address": opts.Target, - "paths": opts.Paths, - "mode": opts.Mode, + "address": opts.Target, + "paths": opts.Paths, + "mode": opts.Mode, "interval": opts.SampleInterval, }).Info("subscribed to gNMI target") for { diff --git a/nucleus/gnmi_transport_test.go b/nucleus/gnmi_transport_test.go index 246f46ecc024819457f65429ba55185876f7bfd4..9bc9a4de923b8d29fa0ca9ba5481f9b8e3ff51ca 100644 --- a/nucleus/gnmi_transport_test.go +++ b/nucleus/gnmi_transport_test.go @@ -8,11 +8,11 @@ import ( "code.fbi.h-da.de/cocsn/yang-models/generated/openconfig" "context" "errors" - log "github.com/golang/glog" gpb "github.com/openconfig/gnmi/proto/gnmi" "github.com/openconfig/gnmi/proto/gnmi_ext" "github.com/openconfig/goyang/pkg/yang" "github.com/openconfig/ygot/ytypes" + log "github.com/sirupsen/logrus" "github.com/stretchr/testify/mock" pb "google.golang.org/protobuf/proto" "os" @@ -23,6 +23,7 @@ import ( // TestMain bootstraps all tests. Humongous beast // TODO: Move somewhere more sensible func TestMain(m *testing.M) { + log.SetReportCaller(true) gnmiMessages = map[string]pb.Message{ "../test/proto/cap-resp-arista-ceos": &gpb.CapabilityResponse{}, "../test/proto/req-full-node": &gpb.GetRequest{}, @@ -640,4 +641,3 @@ func TestGnmi_set(t *testing.T) { }) } } - diff --git a/nucleus/http.go b/nucleus/http.go index 390c123ed25e47ba8bd2e5981691fd36970754fa..5d6e17763a453df3296dd274da715e8ffac5203e 100644 --- a/nucleus/http.go +++ b/nucleus/http.go @@ -2,6 +2,7 @@ package nucleus import ( "code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi" + "context" "fmt" "github.com/google/uuid" gpb "github.com/openconfig/gnmi/proto/gnmi" @@ -12,7 +13,7 @@ import ( const basePath = "/api" -func httpApi() (err error) { +func httpApi(ctx context.Context) (err error) { id := c.sbic.UUIDs()[0] sbi, err := c.sbic.get(id) if err != nil { @@ -63,6 +64,8 @@ func httpApi() (err error) { return } writer.WriteHeader(http.StatusCreated) + fmt.Fprintf(writer, "device added\n") + fmt.Fprintf(writer, "UUID: %v\n", d.Uuid) case "request": err = pnd.Request(id, query.Get("path")) if err != nil { @@ -108,6 +111,15 @@ func httpApi() (err error) { for i, id := range ids { fmt.Fprintf(writer, "%v: %v\n", i+1, id) } + case "set": + resp, err := pnd.(*pndImplementation).Set(id, query.Get("path"), query.Get("value")) + if err != nil { + writer.WriteHeader(http.StatusInternalServerError) + log.Error(err) + return + } + writer.WriteHeader(http.StatusOK) + fmt.Fprintln(writer, resp) default: writer.WriteHeader(http.StatusBadRequest) } diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go index e0b9fe815fa5293a0ea23d85a77aee444953939d..23e58212f0588c6e7fc72e09f6407d61e0a5a10a 100644 --- a/nucleus/principalNetworkDomain.go +++ b/nucleus/principalNetworkDomain.go @@ -1,6 +1,7 @@ package nucleus import ( + "code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi" "context" log "github.com/sirupsen/logrus" @@ -151,13 +152,13 @@ func (pnd *pndImplementation) MarshalDevice(uuid uuid.UUID) (string, error) { return "", err } log.WithFields(log.Fields{ - "pnd": pnd.id, + "pnd": pnd.id, "device": uuid, }).Info("marshalled device") return string(jsonTree), nil } -//Request sends a get request to a specific device +// Request sends a get request to a specific device func (pnd *pndImplementation) Request(uuid uuid.UUID, path string) error { d, err := pnd.getDevice(uuid) if err != nil { @@ -175,7 +176,7 @@ func (pnd *pndImplementation) Request(uuid uuid.UUID, path string) error { return nil } -//RequestAll sends a request for all registered devices +// RequestAll sends a request for all registered devices func (pnd *pndImplementation) RequestAll(path string) error { for _, k := range pnd.devices.UUIDs() { if err := pnd.Request(k, path); err != nil { @@ -183,8 +184,30 @@ func (pnd *pndImplementation) RequestAll(path string) error { } } log.WithFields(log.Fields{ - "pnd": pnd.id, + "pnd": pnd.id, "path": path, }).Info("sent request to all devices") return nil } + +// Set sets the value to the given device path +// TODO: Design commit/confirm mechanism +func (pnd *pndImplementation) Set(uuid uuid.UUID, path string, value string) (interface{}, error) { + d, err := pnd.getDevice(uuid) + if err != nil { + return nil, err + } + ctx := context.Background() + + // TODO: Move to transport dependent func + opts := []interface{}{ + &gnmi.Operation{ + Type: "update", + Origin: "", + Target: "", + Path: gnmi.SplitPath(path), + Val: value, + }, + } + return d.Transport.Set(ctx, opts...) +} diff --git a/nucleus/util/proto/cap-resp-arista-ceos_test b/nucleus/util/proto/cap-resp-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..009569457324faf59d7bf00bb1915f2f3ccc2ec2 --- /dev/null +++ b/nucleus/util/proto/cap-resp-arista-ceos_test @@ -0,0 +1,298 @@ + +< +arista-exp-eos-vxlan$Arista Networks <http://arista.com/> +B +ietf-netconf2IETF NETCONF (Network Configuration) Working Group +< +arista-rpol-augments$Arista Networks <http://arista.com/> +C +arista-exp-eos-igmpsnooping$Arista Networks <http://arista.com/> +8 +openconfig-vlan-typesOpenConfig working group3.1.0 +? +openconfig-system-managementOpenConfig working group0.3.0 +8 +arista-eos-types$Arista Networks <http://arista.com/> +< +openconfig-openflow-typesOpenConfig working group0.1.2 +7 +openconfig-aaa-typesOpenConfig working group0.4.1 +9 +openconfig-srte-policyOpenConfig working group0.2.1 +9 +openconfig-relay-agentOpenConfig working group0.1.1 +C +openconfig-hercules-qos!OpenConfig Hercules Working Group0.1.0 +1 +openconfig-extensionsOpenConfig working group +/ +arista-mpls-deviationsArista Networks, Inc. +< +arista-vlan-augments$Arista Networks <http://arista.com/> +: +openconfig-platform-cpuOpenConfig working group0.1.1 +< +openconfig-routing-policyOpenConfig working group3.1.1 += +openconfig-isis-lsdb-typesOpenConfig working group0.4.2 +3 +openconfig-if-ipOpenConfig working group3.0.0 +; +arista-pim-augments$Arista Networks <http://arista.com/> +4 +openconfig-if-poeOpenConfig working group0.1.1 +- +arista-isis-augmentsArista Networks, Inc. +8 +openconfig-ospf-typesOpenConfig working group0.1.3 +/ +arista-intf-deviationsArista Networks, Inc. +5 +openconfig-mpls-srOpenConfig working group3.0.1 +: +openconfig-packet-matchOpenConfig working group1.1.1 +8 +openconfig-inet-typesOpenConfig working group0.3.3 +9 +openconfig-if-ethernetOpenConfig working group2.8.1 +5 +openconfig-pf-srteOpenConfig working group0.2.0 +2 +openconfig-mplsOpenConfig working group3.1.0 +# + +arista-cliArista Networks, Inc. += +openconfig-system-terminalOpenConfig working group0.3.1 +: +openconfig-platform-psuOpenConfig working group0.2.1 +8 +openconfig-yang-typesOpenConfig working group0.2.1 +8 +openconfig-lldp-typesOpenConfig working group0.1.1 +7 +openconfig-if-tunnelOpenConfig working group0.1.1 +6 +openconfig-messagesOpenConfig working group0.0.1 +B +openconfig-platform-transceiverOpenConfig working group0.7.1 +1 +openconfig-pimOpenConfig working group0.2.0 +@ +openconfig-packet-match-typesOpenConfig working group1.0.2 +C + openconfig-segment-routing-typesOpenConfig working group0.2.0 +: +openconfig-policy-typesOpenConfig working group3.1.1 +/ +arista-lldp-deviationsArista Networks, Inc. +B +openconfig-network-instance-l3OpenConfig working group0.11.1 +E +arista-exp-eos-qos-acl-config$Arista Networks <http://arista.com/> +5 +openconfig-licenseOpenConfig working group0.2.0 +: +openconfig-platform-fanOpenConfig working group0.1.1 +/ +arista-system-augmentsArista Networks, Inc. +2 +openconfig-isisOpenConfig working group0.6.0 +H +/arista-network-instance-notsupported-deviationsArista Networks, Inc. +B +)arista-interfaces-notsupported-deviationsArista Networks, Inc. +< +arista-mpls-augments$Arista Networks <http://arista.com/> +3 +arista-openflow-deviationsArista Networks, Inc. +7 +openconfig-platformOpenConfig working group0.12.2 +D +arista-exp-eos-varp-net-inst$Arista Networks <http://arista.com/> +9 +openconfig-ospf-policyOpenConfig working group0.1.3 +6 +openconfig-if-typesOpenConfig working group0.2.1 +: +arista-exp-eos-qos$Arista Networks <http://arista.com/> +2 +openconfig-igmpOpenConfig working group0.2.0 +) +arista-gnoi-certArista Networks, Inc. +/ +arista-isis-deviationsArista Networks, Inc. +4 +openconfig-systemOpenConfig working group0.9.1 +> +arista-vlan-deviations$Arista Networks <http://arista.com/> +# +vlan-translationArista Networks +; +openconfig-local-routingOpenConfig working group1.1.0 +@ +arista-exp-eos-varp-intf$Arista Networks <http://arista.com/> +; +arista-exp-eos-mlag$Arista Networks <http://arista.com/> +8 +openconfig-igmp-typesOpenConfig working group0.1.1 +1 +openconfig-aftOpenConfig working group0.4.1 +- +arista-srte-augmentsArista Networks, Inc. +E +arista-relay-agent-deviations$Arista Networks <http://arista.com/> +7 +openconfig-mpls-rsvpOpenConfig working group3.0.2 +1 +openconfig-aaaOpenConfig working group0.4.3 +6 +arista-exp-eos$Arista Networks <http://arista.com/> +H +openconfig-hercules-platform!OpenConfig Hercules Working Group0.2.0 +. +arista-acl-deviationsArista Networks, Inc. +/ +arista-lacp-deviationsArista Networks, Inc. +? +ietf-interfaces,IETF NETMOD (Network Modeling) Working Group +. +arista-bgp-deviationsArista Networks, Inc. +< +openconfig-platform-typesOpenConfig working group1.0.0 +; +"arista-acl-notsupported-deviationsArista Networks, Inc. +3 +openconfig-typesOpenConfig working group0.6.0 +M +ietf-yang-types:IETF NETMOD (NETCONF Data Modeling Language) Working Group +1 +openconfig-qosOpenConfig working group0.2.3 +. +arista-bfd-deviationsArista Networks, Inc. +@ +'arista-messages-notsupported-deviationsArista Networks, Inc. +9 +openconfig-alarm-typesOpenConfig working group0.2.1 +< +#arista-exp-eos-l2protocolforwardingArista Networks, Inc. +6 +openconfig-openflowOpenConfig working group0.1.2 +> +%arista-system-notsupported-deviationsArista Networks, Inc. +7 +openconfig-pim-typesOpenConfig working group0.1.1 +2 +openconfig-vlanOpenConfig working group3.2.0 +F +-arista-routing-policy-notsupported-deviationsArista Networks, Inc. +7 +openconfig-aft-typesOpenConfig Working Group0.3.4 +, +arista-aft-augmentsArista Networks, Inc. +< +arista-lacp-augments$Arista Networks <http://arista.com/> +1 +openconfig-bfdOpenConfig working group0.2.1 +< +openconfig-system-loggingOpenConfig working group0.3.1 +4 +openconfig-alarmsOpenConfig working group0.3.2 +8 +openconfig-isis-typesOpenConfig working group0.4.2 +? +openconfig-platform-linecardOpenConfig working group0.1.2 +< +#arista-lldp-notsupported-deviationsArista Networks, Inc. +, +arista-exp-eos-evpnArista Networks, Inc. +5 +openconfig-rib-bgpOpenConfig working group0.7.0 +@ +'arista-platform-notsupported-deviationsArista Networks, Inc. +@ +arista-exp-eos-multicast$Arista Networks <http://arista.com/> +; +"arista-bfd-notsupported-deviationsArista Networks, Inc. +? +openconfig-policy-forwardingOpenConfig working group0.2.1 +2 +openconfig-lacpOpenConfig working group1.1.1 +- +arista-lldp-augmentsArista Networks, Inc. +; +arista-bfd-augments$Arista Networks <http://arista.com/> +1 +openconfig-bgpOpenConfig working group6.0.0 + +iana-if-typeIANA +/ +arista-rpol-deviationsArista Networks, Inc. +; +openconfig-rib-bgp-typesOpenConfig working group0.5.0 +M +ietf-inet-types:IETF NETMOD (NETCONF Data Modeling Language) Working Group +8 +openconfig-bgp-policyOpenConfig working group6.0.1 +< +arista-intf-augments$Arista Networks <http://arista.com/> +8 +arista-local-routing-deviationsArista Networks, Inc. +8 +openconfig-interfacesOpenConfig working group2.4.3 +: +openconfig-if-aggregateOpenConfig working group2.4.3 +/ +arista-srte-deviationsArista Networks, Inc. +A +arista-exp-eos-qos-config$Arista Networks <http://arista.com/> +2 +openconfig-lldpOpenConfig working group0.2.1 +J +openconfig-hercules-interfaces!OpenConfig Hercules Working Group0.2.0 +6 +openconfig-mpls-ldpOpenConfig working group3.0.2 +8 +openconfig-mpls-typesOpenConfig working group3.2.0 +M +ietf-netconf-monitoring2IETF NETCONF (Network Configuration) Working Group +7 +openconfig-bgp-typesOpenConfig working group5.2.0 +< +#arista-lacp-notsupported-deviationsArista Networks, Inc. +E +,arista-local-routing-notsupported-deviationsArista Networks, Inc. +, +arista-bgp-augmentsArista Networks, Inc. +2 +arista-netinst-deviationsArista Networks, Inc. +; +"arista-bgp-notsupported-deviationsArista Networks, Inc. +D +!openconfig-network-instance-typesOpenConfig working group0.8.2 +1 +openconfig-aclOpenConfig working group1.1.1 +7 +openconfig-qos-typesOpenConfig working group0.2.1 +5 +openconfig-procmonOpenConfig working group0.4.0 +, +arista-qos-augmentsArista Networks, Inc. +; +openconfig-platform-portOpenConfig working group0.3.3 +4 +openconfig-ospfv2OpenConfig working group0.2.2 +1 +arista-system-deviationsArista Networks, Inc. +> +openconfig-transport-typesOpenConfig working group0.11.0 +? +openconfig-network-instanceOpenConfig working group0.14.0 ++ +arista-rpc-netconfArista Networks, Inc. += +openconfig-segment-routingOpenConfig working group0.3.0 +; +"arista-qos-notsupported-deviationsArista Networks, Inc. +C +arista-exp-eos-vxlan-config$Arista Networks <http://arista.com/>�0.7.0 \ No newline at end of file diff --git a/nucleus/util/proto/req-full-node-arista-ceos_test b/nucleus/util/proto/req-full-node-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..6223295e2984b8002ea5573e8fbbecb77ba9dc6d Binary files /dev/null and b/nucleus/util/proto/req-full-node-arista-ceos_test differ diff --git a/nucleus/util/proto/req-full-node_test b/nucleus/util/proto/req-full-node_test new file mode 100644 index 0000000000000000000000000000000000000000..087f7d8275a07a95d6809081bab6ccecfa81a9f1 --- /dev/null +++ b/nucleus/util/proto/req-full-node_test @@ -0,0 +1,7 @@ +2 + +interfaces + interface + +interfaces + interface( \ No newline at end of file diff --git a/nucleus/util/proto/req-interfaces-arista-ceos_test b/nucleus/util/proto/req-interfaces-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..e444e33aa6d44fc9ca4538f5a030df6c8d88a708 --- /dev/null +++ b/nucleus/util/proto/req-interfaces-arista-ceos_test @@ -0,0 +1,5 @@ + + +interfaces + +interfaces( \ No newline at end of file diff --git a/nucleus/util/proto/req-interfaces-interface-arista-ceos_test b/nucleus/util/proto/req-interfaces-interface-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..087f7d8275a07a95d6809081bab6ccecfa81a9f1 --- /dev/null +++ b/nucleus/util/proto/req-interfaces-interface-arista-ceos_test @@ -0,0 +1,7 @@ +2 + +interfaces + interface + +interfaces + interface( \ No newline at end of file diff --git a/nucleus/util/proto/req-interfaces-wildcard_test b/nucleus/util/proto/req-interfaces-wildcard_test new file mode 100644 index 0000000000000000000000000000000000000000..bd113697d2f21f1dbd7a3a881c6ab70cd4ec4644 --- /dev/null +++ b/nucleus/util/proto/req-interfaces-wildcard_test @@ -0,0 +1,12 @@ +c + +interfaces +interface[name=*] +state +name + +interfaces + interface +name* +state +name( \ No newline at end of file diff --git a/nucleus/util/proto/resp-full-node-arista-ceos_test b/nucleus/util/proto/resp-full-node-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..9bcd16e666a683a570c5141eb01b4ed16ad52b8b Binary files /dev/null and b/nucleus/util/proto/resp-full-node-arista-ceos_test differ diff --git a/nucleus/util/proto/resp-full-node_test b/nucleus/util/proto/resp-full-node_test new file mode 100644 index 0000000000000000000000000000000000000000..4614be84e811d8a96624192f082c97ec9edf76be --- /dev/null +++ b/nucleus/util/proto/resp-full-node_test @@ -0,0 +1,7 @@ + +�""�" +0 + +interfaces + interface +nameEthernet510�"Z�"{"openconfig-interfaces:config":{"description":"","enabled":true,"arista-intf-augments:load-interval":300,"loopback-mode":false,"mtu":0,"name":"Ethernet510","openconfig-vlan:tpid":"openconfig-vlan-types:TPID_0X8100","type":"iana-if-type:ethernetCsmacd"},"openconfig-if-ethernet:ethernet":{"config":{"arista-intf-augments:fec-encoding":{"disabled":false,"fire-code":false,"reed-solomon":false,"reed-solomon544":false},"openconfig-hercules-interfaces:forwarding-viable":true,"mac-address":"00:00:00:00:00:00","port-speed":"SPEED_UNKNOWN","arista-intf-augments:sfp-1000base-t":false},"arista-intf-augments:pfc":{"priorities":{"priority":[{"index":0,"state":{"in-frames":"0","index":0,"out-frames":"0"}},{"index":1,"state":{"in-frames":"0","index":1,"out-frames":"0"}},{"index":2,"state":{"in-frames":"0","index":2,"out-frames":"0"}},{"index":3,"state":{"in-frames":"0","index":3,"out-frames":"0"}},{"index":4,"state":{"in-frames":"0","index":4,"out-frames":"0"}},{"index":5,"state":{"in-frames":"0","index":5,"out-frames":"0"}},{"index":6,"state":{"in-frames":"0","index":6,"out-frames":"0"}},{"index":7,"state":{"in-frames":"0","index":7,"out-frames":"0"}}]}},"state":{"auto-negotiate":false,"counters":{"in-crc-errors":"0","in-fragment-frames":"0","in-jabber-frames":"0","in-mac-control-frames":"0","in-mac-pause-frames":"0","in-oversize-frames":"0","out-mac-control-frames":"0","out-mac-pause-frames":"0"},"duplex-mode":"FULL","enable-flow-control":false,"openconfig-hercules-interfaces:forwarding-viable":true,"hw-mac-address":"02:42:c0:a8:02:41","mac-address":"02:42:c0:a8:02:41","negotiated-port-speed":"SPEED_UNKNOWN","port-speed":"SPEED_UNKNOWN","arista-intf-augments:supported-speeds":["SPEED_5GB","SPEED_25GB","SPEED_50GB","SPEED_100GB","SPEED_10MB","SPEED_100GB_2LANE","SPEED_100MB","SPEED_1GB","SPEED_2500MB","SPEED_400GB","SPEED_10GB","SPEED_40GB","SPEED_200GB_4LANE","SPEED_200GB_8LANE","SPEED_50GB_1LANE"]}},"openconfig-interfaces:hold-time":{"config":{"down":0,"up":0},"state":{"down":0,"up":0}},"openconfig-interfaces:name":"Ethernet510","openconfig-interfaces:state":{"admin-status":"UP","counters":{"in-broadcast-pkts":"294224","in-discards":"0","in-errors":"0","in-fcs-errors":"0","in-multicast-pkts":"1412","in-octets":"72226989","in-unicast-pkts":"642","out-broadcast-pkts":"0","out-discards":"0","out-errors":"0","out-multicast-pkts":"0","out-octets":"0","out-unicast-pkts":"0"},"description":"","enabled":true,"openconfig-platform-port:hardware-port":"Port510","ifindex":510,"arista-intf-augments:inactive":false,"last-change":"1612959137249521152","loopback-mode":false,"mtu":0,"name":"Ethernet510","oper-status":"UP","openconfig-vlan:tpid":"openconfig-vlan-types:TPID_0X8100","type":"iana-if-type:ethernetCsmacd"},"openconfig-interfaces:subinterfaces":{"subinterface":[{"config":{"description":"","enabled":true,"index":0},"index":0,"openconfig-if-ip:ipv4":{"config":{"dhcp-client":false,"enabled":true,"mtu":1500},"state":{"dhcp-client":false,"enabled":true,"mtu":1500},"unnumbered":{"config":{"enabled":false},"state":{"enabled":false}}},"openconfig-if-ip:ipv6":{"addresses":{"address":[{"config":{"ip":"fdfd::ce05","prefix-length":64},"ip":"fdfd::ce05","state":{"ip":"fdfd::ce05","origin":"STATIC","prefix-length":64,"status":"PREFERRED"}}]},"config":{"dhcp-client":false,"enabled":false,"mtu":1500},"neighbors":{"neighbor":[{"config":{"ip":"fdfd::1"},"ip":"fdfd::1","state":{"ip":"fdfd::1","link-layer-address":"74:83:c2:fe:86:ad","neighbor-state":"REACHABLE","origin":"DYNAMIC"}},{"config":{"ip":"fe80::7683:c2ff:fefe:86ad"},"ip":"fe80::7683:c2ff:fefe:86ad","state":{"ip":"fe80::7683:c2ff:fefe:86ad","link-layer-address":"74:83:c2:fe:86:ad","neighbor-state":"REACHABLE","origin":"DYNAMIC"}},{"config":{"ip":"fe80::c3:43ff:fec5:da0b"},"ip":"fe80::c3:43ff:fec5:da0b","state":{"ip":"fe80::c3:43ff:fec5:da0b","link-layer-address":"02:c3:43:c5:da:0b","neighbor-state":"REACHABLE","origin":"DYNAMIC"}},{"config":{"ip":"fdfd::28"},"ip":"fdfd::28","state":{"ip":"fdfd::28","link-layer-address":"02:c3:43:c5:da:0b","neighbor-state":"REACHABLE","origin":"DYNAMIC"}},{"config":{"ip":"fe80::1"},"ip":"fe80::1","state":{"ip":"fe80::1","link-layer-address":"74:83:c2:fe:86:ad","neighbor-state":"REACHABLE","origin":"DYNAMIC"}}]},"state":{"dhcp-client":false,"enabled":false,"mtu":1500}},"state":{"counters":{"in-fcs-errors":"0"},"description":"","enabled":true,"index":0}}]}} \ No newline at end of file diff --git a/nucleus/util/proto/resp-interfaces-arista-ceos_test b/nucleus/util/proto/resp-interfaces-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..58e139172f4264b079f1f61ec7f27fe454129734 --- /dev/null +++ b/nucleus/util/proto/resp-interfaces-arista-ceos_test @@ -0,0 +1,5 @@ + +�"� + + +interfaces�Z�{"openconfig-interfaces:interface":[{"config":{"description":"","enabled":true,"arista-intf-augments:load-interval":300,"loopback-mode":false,"mtu":0,"name":"Ethernet510","openconfig-vlan:tpid":"openconfig-vlan-types:TPID_0X8100","type":"iana-if-type:ethernetCsmacd"},"openconfig-if-ethernet:ethernet":{"config":{"arista-intf-augments:fec-encoding":{"disabled":false,"fire-code":false,"reed-solomon":false,"reed-solomon544":false},"openconfig-hercules-interfaces:forwarding-viable":true,"mac-address":"00:00:00:00:00:00","port-speed":"SPEED_UNKNOWN","arista-intf-augments:sfp-1000base-t":false},"arista-intf-augments:pfc":{"priorities":{"priority":[{"index":0,"state":{"in-frames":"0","index":0,"out-frames":"0"}},{"index":1,"state":{"in-frames":"0","index":1,"out-frames":"0"}},{"index":2,"state":{"in-frames":"0","index":2,"out-frames":"0"}},{"index":3,"state":{"in-frames":"0","index":3,"out-frames":"0"}},{"index":4,"state":{"in-frames":"0","index":4,"out-frames":"0"}},{"index":5,"state":{"in-frames":"0","index":5,"out-frames":"0"}},{"index":6,"state":{"in-frames":"0","index":6,"out-frames":"0"}},{"index":7,"state":{"in-frames":"0","index":7,"out-frames":"0"}}]}},"state":{"auto-negotiate":false,"counters":{"in-crc-errors":"0","in-fragment-frames":"0","in-jabber-frames":"0","in-mac-control-frames":"0","in-mac-pause-frames":"0","in-oversize-frames":"0","out-mac-control-frames":"0","out-mac-pause-frames":"0"},"duplex-mode":"FULL","enable-flow-control":false,"openconfig-hercules-interfaces:forwarding-viable":true,"hw-mac-address":"02:42:c0:a8:02:42","mac-address":"02:42:c0:a8:02:42","negotiated-port-speed":"SPEED_UNKNOWN","port-speed":"SPEED_UNKNOWN","arista-intf-augments:supported-speeds":["SPEED_200GB_8LANE","SPEED_100MB","SPEED_1GB","SPEED_10GB","SPEED_400GB","SPEED_40GB","SPEED_2500MB","SPEED_50GB","SPEED_50GB_1LANE","SPEED_25GB","SPEED_100GB","SPEED_100GB_2LANE","SPEED_10MB","SPEED_200GB_4LANE","SPEED_5GB"]}},"hold-time":{"config":{"down":0,"up":0},"state":{"down":0,"up":0}},"name":"Ethernet510","state":{"admin-status":"UP","counters":{"in-broadcast-pkts":"344691","in-discards":"0","in-errors":"0","in-fcs-errors":"0","in-multicast-pkts":"1","in-octets":"93260151","in-unicast-pkts":"0","out-broadcast-pkts":"0","out-discards":"0","out-errors":"0","out-multicast-pkts":"0","out-octets":"0","out-unicast-pkts":"0"},"description":"","enabled":true,"openconfig-platform-port:hardware-port":"Port510","ifindex":510,"arista-intf-augments:inactive":false,"last-change":"1614091948142304000","loopback-mode":false,"mtu":0,"name":"Ethernet510","oper-status":"UP","openconfig-vlan:tpid":"openconfig-vlan-types:TPID_0X8100","type":"iana-if-type:ethernetCsmacd"},"subinterfaces":{"subinterface":[{"config":{"description":"","enabled":true,"index":0},"index":0,"openconfig-if-ip:ipv4":{"config":{"dhcp-client":false,"enabled":false,"mtu":1500},"state":{"dhcp-client":false,"enabled":false,"mtu":1500},"unnumbered":{"config":{"enabled":false},"state":{"enabled":false}}},"openconfig-if-ip:ipv6":{"config":{"dhcp-client":false,"enabled":false,"mtu":1500},"state":{"dhcp-client":false,"enabled":false,"mtu":1500}},"state":{"counters":{"in-fcs-errors":"0"},"description":"","enabled":true,"index":0}}]}}]} \ No newline at end of file diff --git a/nucleus/util/proto/resp-interfaces-interface-arista-ceos_test b/nucleus/util/proto/resp-interfaces-interface-arista-ceos_test new file mode 100644 index 0000000000000000000000000000000000000000..05f0804b1153e5982ff5d5e4d4a32d9d6d6be7d0 --- /dev/null +++ b/nucleus/util/proto/resp-interfaces-interface-arista-ceos_test @@ -0,0 +1,7 @@ + +�"� +0 + +interfaces + interface +nameEthernet510�Z�{"openconfig-interfaces:config":{"description":"","enabled":true,"arista-intf-augments:load-interval":300,"loopback-mode":false,"mtu":0,"name":"Ethernet510","openconfig-vlan:tpid":"openconfig-vlan-types:TPID_0X8100","type":"iana-if-type:ethernetCsmacd"},"openconfig-if-ethernet:ethernet":{"config":{"arista-intf-augments:fec-encoding":{"disabled":false,"fire-code":false,"reed-solomon":false,"reed-solomon544":false},"openconfig-hercules-interfaces:forwarding-viable":true,"mac-address":"00:00:00:00:00:00","port-speed":"SPEED_UNKNOWN","arista-intf-augments:sfp-1000base-t":false},"arista-intf-augments:pfc":{"priorities":{"priority":[{"index":0,"state":{"in-frames":"0","index":0,"out-frames":"0"}},{"index":1,"state":{"in-frames":"0","index":1,"out-frames":"0"}},{"index":2,"state":{"in-frames":"0","index":2,"out-frames":"0"}},{"index":3,"state":{"in-frames":"0","index":3,"out-frames":"0"}},{"index":4,"state":{"in-frames":"0","index":4,"out-frames":"0"}},{"index":5,"state":{"in-frames":"0","index":5,"out-frames":"0"}},{"index":6,"state":{"in-frames":"0","index":6,"out-frames":"0"}},{"index":7,"state":{"in-frames":"0","index":7,"out-frames":"0"}}]}},"state":{"auto-negotiate":false,"counters":{"in-crc-errors":"0","in-fragment-frames":"0","in-jabber-frames":"0","in-mac-control-frames":"0","in-mac-pause-frames":"0","in-oversize-frames":"0","out-mac-control-frames":"0","out-mac-pause-frames":"0"},"duplex-mode":"FULL","enable-flow-control":false,"openconfig-hercules-interfaces:forwarding-viable":true,"hw-mac-address":"02:42:c0:a8:02:42","mac-address":"02:42:c0:a8:02:42","negotiated-port-speed":"SPEED_UNKNOWN","port-speed":"SPEED_UNKNOWN","arista-intf-augments:supported-speeds":["SPEED_200GB_8LANE","SPEED_100MB","SPEED_1GB","SPEED_10GB","SPEED_400GB","SPEED_40GB","SPEED_2500MB","SPEED_50GB","SPEED_50GB_1LANE","SPEED_25GB","SPEED_100GB","SPEED_100GB_2LANE","SPEED_10MB","SPEED_200GB_4LANE","SPEED_5GB"]}},"openconfig-interfaces:hold-time":{"config":{"down":0,"up":0},"state":{"down":0,"up":0}},"openconfig-interfaces:name":"Ethernet510","openconfig-interfaces:state":{"admin-status":"UP","counters":{"in-broadcast-pkts":"344691","in-discards":"0","in-errors":"0","in-fcs-errors":"0","in-multicast-pkts":"1","in-octets":"93260151","in-unicast-pkts":"0","out-broadcast-pkts":"0","out-discards":"0","out-errors":"0","out-multicast-pkts":"0","out-octets":"0","out-unicast-pkts":"0"},"description":"","enabled":true,"openconfig-platform-port:hardware-port":"Port510","ifindex":510,"arista-intf-augments:inactive":false,"last-change":"1614091948142304000","loopback-mode":false,"mtu":0,"name":"Ethernet510","oper-status":"UP","openconfig-vlan:tpid":"openconfig-vlan-types:TPID_0X8100","type":"iana-if-type:ethernetCsmacd"},"openconfig-interfaces:subinterfaces":{"subinterface":[{"config":{"description":"","enabled":true,"index":0},"index":0,"openconfig-if-ip:ipv4":{"config":{"dhcp-client":false,"enabled":false,"mtu":1500},"state":{"dhcp-client":false,"enabled":false,"mtu":1500},"unnumbered":{"config":{"enabled":false},"state":{"enabled":false}}},"openconfig-if-ip:ipv6":{"config":{"dhcp-client":false,"enabled":false,"mtu":1500},"state":{"dhcp-client":false,"enabled":false,"mtu":1500}},"state":{"counters":{"in-fcs-errors":"0"},"description":"","enabled":true,"index":0}}]}} \ No newline at end of file diff --git a/nucleus/util/proto/resp-interfaces-wildcard_test b/nucleus/util/proto/resp-interfaces-wildcard_test new file mode 100644 index 0000000000000000000000000000000000000000..50cb9f4c7021af0340d92cde6f1320ffb066e68d --- /dev/null +++ b/nucleus/util/proto/resp-interfaces-wildcard_test @@ -0,0 +1,10 @@ + +T"R +A + +interfaces + interface +nameEthernet510 +state +name +Ethernet510 \ No newline at end of file diff --git a/nucleus/util/proto/resp-set-system-config-hostname_test b/nucleus/util/proto/resp-set-system-config-hostname_test new file mode 100644 index 0000000000000000000000000000000000000000..c656ee5bb56b47d1e306627823c577d1b51d6988 --- /dev/null +++ b/nucleus/util/proto/resp-set-system-config-hostname_test @@ -0,0 +1,8 @@ +>: +system +config +hostname +system +config + +hostname �����ȶ \ No newline at end of file diff --git a/test/targets.go b/test/targets.go index ec405e446314e00a341a03765b283d14a51c1b00..309b818471b71581a3efe2ffa2bf65baf0b639b0 100644 --- a/test/targets.go +++ b/test/targets.go @@ -64,13 +64,13 @@ func GnmiTarget(stop chan bool, bindAddr string) error { } entries := make([]*yang.Entry, 0) - for _,e := range oc.SchemaTree { + for _, e := range oc.SchemaTree { entries = append(entries, e) } modelData, err := util.FindModelData(entries) if err != nil { - return err + log.Error(err) } // Google stuff from here