diff --git a/Makefile b/Makefile index 16aec48d2..172bd56f6 100644 --- a/Makefile +++ b/Makefile @@ -32,12 +32,17 @@ go.mod: $(GO_DEPS): go.mod $(PATCHES) # FIXME temporary workaround for crypto not downloading.. $(GO) get golang.org/x/crypto/ssh/terminal@e9b2fee46413 - $(GO) get github.com/openconfig/gnmi@d2b4e6a45802a75b3571a627519cae85a197fdda + $(GO) get github.com/jipanyang/gnxi@v0.0.0-20181221084354-f0a90cca6fd0 + $(GO) get github.com/openconfig/gnmi@v0.0.0-20200617225440-d2b4e6a45802 $(GO) mod vendor $(MGMT_COMMON_DIR)/patches/apply.sh vendor - cp -r $(GOPATH)/pkg/mod/golang.org/x/crypto@v0.0.0-20191206172530-e9b2fee46413 vendor/golang.org/x/crypto + cp -r $(GOPATH)/pkg/mod/golang.org/x/crypto@v0.0.0-20191206172530-e9b2fee46413/* vendor/golang.org/x/crypto/ + mkdir -p vendor/github.com/jipanyang/gnxi/ + cp -r $(GOPATH)/pkg/mod/github.com/jipanyang/gnxi@v0.0.0-20181221084354-f0a90cca6fd0/* vendor/github.com/jipanyang/gnxi/ chmod -R u+w vendor - patch -d vendor -p0 JwtRefreshInt { + return nil, status.Errorf(codes.InvalidArgument, "Invalid JWT Token") + } + + return &spb_jwt.RefreshResponse{Token: tokenResp(claims.Username, claims.Roles)}, nil + +} + +func (srv *Server) ClearNeighbors(ctx context.Context, req *spb.ClearNeighborsRequest) (*spb.ClearNeighborsResponse, error) { + ctx,err := authenticate(srv.config.UserAuth, ctx) + if err != nil { + return nil, err + } + log.V(1).Info("gNOI: Sonic ClearNeighbors") + log.V(1).Info("Request: ", req) + + resp := &spb.ClearNeighborsResponse{ + Output: &spb.ClearNeighborsResponse_Output { + }, + } + + reqstr, err := json.Marshal(req) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + jsresp, err:= transutil.TranslProcessAction("/sonic-neighbor:clear-neighbors", []byte(reqstr), ctx) + + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + err = json.Unmarshal(jsresp, resp) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + return resp, nil +} + +func (srv *Server) CopyConfig(ctx context.Context, req *spb.CopyConfigRequest) (*spb.CopyConfigResponse, error) { + ctx,err := authenticate(srv.config.UserAuth, ctx) + if err != nil { + return nil, err + } + log.V(1).Info("gNOI: Sonic CopyConfig") + + resp := &spb.CopyConfigResponse{ + Output: &spb.SonicOutput { + + }, + } + + reqstr, err := json.Marshal(req) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + jsresp, err:= transutil.TranslProcessAction("/sonic-config-mgmt:copy", []byte(reqstr), ctx) + + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + err = json.Unmarshal(jsresp, resp) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + return resp, nil +} + +func (srv *Server) ShowTechsupport(ctx context.Context, req *spb.TechsupportRequest) (*spb.TechsupportResponse, error) { + ctx,err := authenticate(srv.config.UserAuth, ctx) + if err != nil { + return nil, err + } + log.V(1).Info("gNOI: Sonic ShowTechsupport") + + resp := &spb.TechsupportResponse{ + Output: &spb.TechsupportResponse_Output { + + }, + } + + reqstr, err := json.Marshal(req) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + jsresp, err:= transutil.TranslProcessAction("/sonic-show-techsupport:sonic-show-techsupport-info", []byte(reqstr), ctx) + + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + err = json.Unmarshal(jsresp, resp) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + + return resp, nil +} + +func (srv *Server) ImageInstall(ctx context.Context, req *spb.ImageInstallRequest) (*spb.ImageInstallResponse, error) { + ctx,err := authenticate(srv.config.UserAuth, ctx) + if err != nil { + return nil, err + } + log.V(1).Info("gNOI: Sonic ImageInstall") + + resp := &spb.ImageInstallResponse{ + Output: &spb.SonicOutput { + + }, + } + + reqstr, err := json.Marshal(req) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + jsresp, err:= transutil.TranslProcessAction("/sonic-image-management:image-install", []byte(reqstr), ctx) + + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + err = json.Unmarshal(jsresp, resp) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + + return resp, nil +} + +func (srv *Server) ImageRemove(ctx context.Context, req *spb.ImageRemoveRequest) (*spb.ImageRemoveResponse, error) { + ctx,err := authenticate(srv.config.UserAuth, ctx) + if err != nil { + return nil, err + } + log.V(1).Info("gNOI: Sonic ImageRemove") + + resp := &spb.ImageRemoveResponse{ + Output: &spb.SonicOutput { + + }, + } + + reqstr, err := json.Marshal(req) + + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + jsresp, err:= transutil.TranslProcessAction("/sonic-image-management:image-remove", []byte(reqstr), ctx) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + err = json.Unmarshal(jsresp, resp) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + + return resp, nil +} + +func (srv *Server) ImageDefault(ctx context.Context, req *spb.ImageDefaultRequest) (*spb.ImageDefaultResponse, error) { + ctx,err := authenticate(srv.config.UserAuth, ctx) + if err != nil { + return nil, err + } + log.V(1).Info("gNOI: Sonic ImageDefault") + + resp := &spb.ImageDefaultResponse{ + Output: &spb.SonicOutput { + + }, + } + + reqstr, err := json.Marshal(req) + + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + jsresp, err:= transutil.TranslProcessAction("/sonic-image-management:image-default", []byte(reqstr), ctx) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + err = json.Unmarshal(jsresp, resp) + if err != nil { + return nil, status.Error(codes.Unknown, err.Error()) + } + + + return resp, nil +} diff --git a/gnmi_server/jwtAuth.go b/gnmi_server/jwtAuth.go new file mode 100644 index 000000000..7e3d9cd18 --- /dev/null +++ b/gnmi_server/jwtAuth.go @@ -0,0 +1,91 @@ +package gnmi + +import ( + "github.com/Azure/sonic-telemetry/common_utils" + "crypto/rand" + jwt "github.com/dgrijalva/jwt-go" + "github.com/golang/glog" + "golang.org/x/net/context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + spb "github.com/Azure/sonic-telemetry/proto/gnoi/jwt" + "time" +) + +var ( + JwtRefreshInt time.Duration + JwtValidInt time.Duration + hmacSampleSecret = make([]byte, 16) +) + +type Credentials struct { + Password string `json:"password"` + Username string `json:"username"` +} + +type Claims struct { + Username string `json:"username"` + Roles []string `json:"roles"` + jwt.StandardClaims +} + +func generateJWT(username string, roles []string, expire_dt time.Time) string { + // Create a new token object, specifying signing method and the claims + // you would like it to contain. + claims := &Claims{ + Username: username, + Roles: roles, + StandardClaims: jwt.StandardClaims{ + // In JWT, the expiry time is expressed as unix milliseconds + ExpiresAt: expire_dt.Unix(), + }, + } + token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims) + + // Sign and get the complete encoded token as a string using the secret + tokenString, _ := token.SignedString(hmacSampleSecret) + + return tokenString +} +func GenerateJwtSecretKey() { + rand.Read(hmacSampleSecret) +} + +func tokenResp(username string, roles []string) *spb.JwtToken { + exp_tm := time.Now().Add(JwtValidInt) + token := spb.JwtToken{AccessToken: generateJWT(username, roles, exp_tm), Type: "Bearer", ExpiresIn: int64(JwtValidInt / time.Second)} + return &token +} + +func JwtAuthenAndAuthor(ctx context.Context) (*spb.JwtToken, context.Context, error) { + rc, ctx := common_utils.GetContext(ctx) + var token spb.JwtToken + md, ok := metadata.FromIncomingContext(ctx) + if !ok { + return nil, ctx, status.Errorf(codes.Unknown, "Invalid context") + } + + if token_str, ok := md["access_token"]; ok { + token.AccessToken = token_str[0] + } else { + return nil, ctx, status.Errorf(codes.Unauthenticated, "No JWT Token Provided") + } + + claims := &Claims{} + tkn, err := jwt.ParseWithClaims(token.AccessToken, claims, func(token *jwt.Token) (interface{}, error) { + return hmacSampleSecret, nil + }) + if err != nil { + return &token, ctx, status.Errorf(codes.Unauthenticated, err.Error()) + } + if !tkn.Valid { + return &token, ctx, status.Errorf(codes.Unauthenticated, "Invalid JWT Token") + } + if err := PopulateAuthStruct(claims.Username, &rc.Auth, claims.Roles); err != nil { + glog.Infof("[%s] Failed to retrieve authentication information; %v", rc.ID, err) + return &token, ctx, status.Errorf(codes.Unauthenticated, "") + } + + return &token, ctx, nil +} diff --git a/gnmi_server/pamAuth.go b/gnmi_server/pamAuth.go new file mode 100644 index 000000000..682278a07 --- /dev/null +++ b/gnmi_server/pamAuth.go @@ -0,0 +1,112 @@ +package gnmi + +import ( + "github.com/Azure/sonic-telemetry/common_utils" + "errors" + "github.com/golang/glog" + "github.com/msteinert/pam" + "golang.org/x/crypto/ssh" + "os/user" +) + +type UserCredential struct { + Username string + Password string +} + +//PAM conversation handler. +func (u UserCredential) PAMConvHandler(s pam.Style, msg string) (string, error) { + + switch s { + case pam.PromptEchoOff: + return u.Password, nil + case pam.PromptEchoOn: + return u.Password, nil + case pam.ErrorMsg: + return "", nil + case pam.TextInfo: + return "", nil + default: + return "", errors.New("unrecognized conversation message style") + } +} + +// PAMAuthenticate performs PAM authentication for the user credentials provided +func (u UserCredential) PAMAuthenticate() error { + tx, err := pam.StartFunc("login", u.Username, u.PAMConvHandler) + if err != nil { + return err + } + return tx.Authenticate(0) +} + +func PAMAuthUser(u string, p string) error { + + cred := UserCredential{u, p} + err := cred.PAMAuthenticate() + return err +} +func GetUserRoles(usr *user.User) ([]string, error) { + // Lookup Roles + gids, err := usr.GroupIds() + if err != nil { + return nil, err + } + roles := make([]string, len(gids)) + for idx, gid := range gids { + group, err := user.LookupGroupId(gid) + if err != nil { + return nil, err + } + roles[idx] = group.Name + } + return roles, nil +} +func PopulateAuthStruct(username string, auth *common_utils.AuthInfo, r []string) error { + if len(r) == 0 { + AuthLock.Lock() + defer AuthLock.Unlock() + usr, err := user.Lookup(username) + if err != nil { + return err + } + + roles, err := GetUserRoles(usr) + if err != nil { + return err + } + auth.Roles = roles + } else { + auth.Roles = r + } + auth.User = username + + return nil +} + +func UserPwAuth(username string, passwd string) (bool, error) { + /* + * mgmt-framework container does not have access to /etc/passwd, /etc/group, + * /etc/shadow and /etc/tacplus_conf files of host. One option is to share + * /etc of host with /etc of container. For now disable this and use ssh + * for authentication. + */ + // err := PAMAuthUser(username, passwd) + + //Use ssh for authentication. + config := &ssh.ClientConfig{ + User: username, + Auth: []ssh.AuthMethod{ + ssh.Password(passwd), + }, + HostKeyCallback: ssh.InsecureIgnoreHostKey(), + } + c, err := ssh.Dial("tcp", "127.0.0.1:22", config) + if err != nil { + glog.Infof("Authentication failed. user=%s, error:%s", username, err.Error()) + return false, err + } + defer c.Conn.Close() + + return true, nil +} diff --git a/gnmi_server/server.go b/gnmi_server/server.go index d90888298..4b0a9e365 100644 --- a/gnmi_server/server.go +++ b/gnmi_server/server.go @@ -6,7 +6,7 @@ import ( "net" "strings" "sync" - + "github.com/Azure/sonic-telemetry/common_utils" log "github.com/golang/glog" "golang.org/x/net/context" "google.golang.org/grpc" @@ -14,9 +14,16 @@ import ( "google.golang.org/grpc/peer" "google.golang.org/grpc/reflection" "google.golang.org/grpc/status" - + "github.com/golang/protobuf/proto" + gnoi_system_pb "github.com/openconfig/gnoi/system" sdc "github.com/Azure/sonic-telemetry/sonic_data_client" gnmipb "github.com/openconfig/gnmi/proto/gnmi" + gnmi_extpb "github.com/openconfig/gnmi/proto/gnmi_ext" + spb_gnoi "github.com/Azure/sonic-telemetry/proto/gnoi" + spb "github.com/Azure/sonic-telemetry/proto" + "github.com/Azure/sonic-mgmt-common/translib" + spb_jwt_gnoi "github.com/Azure/sonic-telemetry/proto/gnoi/jwt" + "bytes" ) var ( @@ -33,14 +40,82 @@ type Server struct { cMu sync.Mutex clients map[string]*Client } - +type AuthTypes map[string]bool // Config is a collection of values for Server type Config struct { // Port for the Server to listen on. If 0 or unset the Server will pick a port // for this Server. Port int64 + UserAuth AuthTypes +} + +var AuthLock sync.Mutex + +func (i AuthTypes) String() string { + if i["none"] { + return "" + } + b := new(bytes.Buffer) + for key, value := range i { + if value { + fmt.Fprintf(b, "%s ", key) + } + } + return b.String() +} + +func (i AuthTypes) Any() bool { + if i["none"] { + return false + } + for _, value := range i { + if value { + return true + } + } + return false } +func (i AuthTypes) Enabled(mode string) bool { + if i["none"] { + return false + } + if value, exist := i[mode]; exist && value { + return true + } + return false +} + +func (i AuthTypes) Set(mode string) error { + modes := strings.Split(mode, ",") + for _, m := range modes { + m = strings.Trim(m, " ") + if m == "none" || m == "" { + i["none"] = true + return nil + } + + if _, exist := i[m]; !exist { + return fmt.Errorf("Expecting one or more of 'cert', 'password' or 'jwt'") + } + i[m] = true + } + return nil +} + +func (i AuthTypes) Unset(mode string) error { + modes := strings.Split(mode, ",") + for _, m := range modes { + m = strings.Trim(m, " ") + if _, exist := i[m]; !exist { + return fmt.Errorf("Expecting one or more of 'cert', 'password' or 'jwt'") + } + i[m] = false + } + return nil +} + + // New returns an initialized Server. func NewServer(config *Config, opts []grpc.ServerOption) (*Server, error) { if config == nil { @@ -64,6 +139,11 @@ func NewServer(config *Config, opts []grpc.ServerOption) (*Server, error) { return nil, fmt.Errorf("failed to open listener port %d: %v", srv.config.Port, err) } gnmipb.RegisterGNMIServer(srv.s, srv) + spb_jwt_gnoi.RegisterSonicJwtServiceServer(srv.s, srv) + if READ_WRITE_MODE { + gnoi_system_pb.RegisterSystemServer(srv.s, srv) + spb_gnoi.RegisterSonicServiceServer(srv.s, srv) + } log.V(1).Infof("Created Server on %s, read-only: %t", srv.Address(), !READ_WRITE_MODE) return srv, nil } @@ -88,9 +168,52 @@ func (srv *Server) Port() int64 { return srv.config.Port } +func authenticate(UserAuth AuthTypes, ctx context.Context) (context.Context,error) { + var err error + success := false + rc, ctx := common_utils.GetContext(ctx) + if !UserAuth.Any() { + //No Auth enabled + rc.Auth.AuthEnabled = false + return ctx, nil + } + rc.Auth.AuthEnabled = true + if UserAuth.Enabled("password") { + ctx, err = BasicAuthenAndAuthor(ctx) + if err == nil { + success = true + } + } + if !success && UserAuth.Enabled("jwt") { + _,ctx,err = JwtAuthenAndAuthor(ctx) + if err == nil { + success = true + } + } + if !success && UserAuth.Enabled("cert") { + ctx,err = ClientCertAuthenAndAuthor(ctx) + if err == nil { + success = true + } + } + + //Allow for future authentication mechanisms here... + + if !success { + return ctx,status.Error(codes.Unauthenticated, "Unauthenticated") + } + + return ctx,nil +} + // Subscribe implements the gNMI Subscribe RPC. -func (srv *Server) Subscribe(stream gnmipb.GNMI_SubscribeServer) error { +func (s *Server) Subscribe(stream gnmipb.GNMI_SubscribeServer) error { ctx := stream.Context() + ctx, err := authenticate(s.config.UserAuth, ctx) + if err != nil { + return err + } + pr, ok := peer.FromContext(ctx) if !ok { @@ -111,19 +234,19 @@ func (srv *Server) Subscribe(stream gnmipb.GNMI_SubscribeServer) error { c := NewClient(pr.Addr) - srv.cMu.Lock() - if oc, ok := srv.clients[c.String()]; ok { + s.cMu.Lock() + if oc, ok := s.clients[c.String()]; ok { log.V(2).Infof("Delete duplicate client %s", oc) oc.Close() - delete(srv.clients, c.String()) + delete(s.clients, c.String()) } - srv.clients[c.String()] = c - srv.cMu.Unlock() + s.clients[c.String()] = c + s.cMu.Unlock() - err := c.Run(stream) - srv.cMu.Lock() - delete(srv.clients, c.String()) - srv.cMu.Unlock() + err = c.Run(stream) + s.cMu.Lock() + delete(s.clients, c.String()) + s.cMu.Unlock() log.Flush() return err @@ -147,7 +270,10 @@ func (s *Server) checkEncodingAndModel(encoding gnmipb.Encoding, models []*gnmip // Get implements the Get RPC in gNMI spec. func (s *Server) Get(ctx context.Context, req *gnmipb.GetRequest) (*gnmipb.GetResponse, error) { - var err error + ctx, err := authenticate(s.config.UserAuth, ctx) + if err != nil { + return nil, err + } if req.GetType() != gnmipb.GetRequest_ALL { return nil, status.Errorf(codes.Unimplemented, "unsupported request type: %s", gnmipb.GetRequest_DataType_name[int32(req.GetType())]) @@ -169,6 +295,7 @@ func (s *Server) Get(ctx context.Context, req *gnmipb.GetRequest) (*gnmipb.GetRe } paths := req.GetPath() + extensions := req.GetExtension() target = prefix.GetTarget() log.V(5).Infof("GetRequest paths: %v", paths) @@ -180,7 +307,7 @@ func (s *Server) Get(ctx context.Context, req *gnmipb.GetRequest) (*gnmipb.GetRe dc, err = sdc.NewDbClient(paths, prefix) } else { /* If no prefix target is specified create new Transl Data Client . */ - dc, err = sdc.NewTranslClient(prefix, paths) + dc, err = sdc.NewTranslClient(prefix, paths, ctx, extensions) } if err != nil { @@ -208,104 +335,107 @@ func (s *Server) Get(ctx context.Context, req *gnmipb.GetRequest) (*gnmipb.GetRe return &gnmipb.GetResponse{Notification: notifications}, nil } -func (srv *Server) Set(ctx context.Context,req *gnmipb.SetRequest) (*gnmipb.SetResponse, error) { +func (s *Server) Set(ctx context.Context,req *gnmipb.SetRequest) (*gnmipb.SetResponse, error) { if !READ_WRITE_MODE { return nil, grpc.Errorf(codes.Unimplemented, "Telemetry is in read-only mode") } + ctx, err := authenticate(s.config.UserAuth, ctx) + if err != nil { + return nil, err + } var results []*gnmipb.UpdateResult - var err error /* Fetch the prefix. */ prefix := req.GetPrefix() - + extensions := req.GetExtension() /* Create Transl client. */ - dc, _ := sdc.NewTranslClient(prefix, nil) + dc, _ := sdc.NewTranslClient(prefix, nil, ctx, extensions) /* DELETE */ for _, path := range req.GetDelete() { log.V(2).Infof("Delete path: %v", path) - - err := dc.Set(path, nil, sdc.DELETE) - - if err != nil { - return nil, err - } - + res := gnmipb.UpdateResult{ Path: path, Op: gnmipb.UpdateResult_DELETE, - } - + } + /* Add to Set response results. */ - results = append(results, &res) - + results = append(results, &res) + } - + /* REPLACE */ for _, path := range req.GetReplace(){ log.V(2).Infof("Replace path: %v ", path) - - err = dc.Set(path.GetPath(), path.GetVal(), sdc.REPLACE) - - if err != nil { - return nil, err - } + res := gnmipb.UpdateResult{ Path: path.GetPath(), Op: gnmipb.UpdateResult_REPLACE, - } + } /* Add to Set response results. */ - results = append(results, &res) + results = append(results, &res) } - - + + /* UPDATE */ for _, path := range req.GetUpdate(){ log.V(2).Infof("Update path: %v ", path) - - err = dc.Set(path.GetPath(), path.GetVal(), sdc.UPDATE) - - if err != nil { - return nil, err - } - + res := gnmipb.UpdateResult{ Path: path.GetPath(), Op: gnmipb.UpdateResult_UPDATE, - } + } /* Add to Set response results. */ - results = append(results, &res) + results = append(results, &res) } - - - - return &gnmipb.SetResponse{ - Prefix: req.GetPrefix(), - Response: results, - }, nil + err = dc.Set(req.GetDelete(), req.GetReplace(), req.GetUpdate()) + + + + return &gnmipb.SetResponse{ + Prefix: req.GetPrefix(), + Response: results, + }, err } -// Capabilities method is not implemented. Refer to gnxi for examples with openconfig integration -func (srv *Server) Capabilities(context.Context, *gnmipb.CapabilityRequest) (*gnmipb.CapabilityResponse, error) { - - dc, _ := sdc.NewTranslClient(nil , nil) - - /* Fetch the client capabitlities. */ - supportedModels := dc.Capabilities() - suppModels := make([]*gnmipb.ModelData, len(supportedModels)) - - for index, model := range supportedModels { - suppModels[index] = &gnmipb.ModelData{ - Name: model.Name, - Organization: model.Organization, - Version: model.Version, - } +func (s *Server) Capabilities(ctx context.Context, req *gnmipb.CapabilityRequest) (*gnmipb.CapabilityResponse, error) { + ctx, err := authenticate(s.config.UserAuth, ctx) + if err != nil { + return nil, err + } + extensions := req.GetExtension() + dc, _ := sdc.NewTranslClient(nil , nil, ctx, extensions) + + /* Fetch the client capabitlities. */ + supportedModels := dc.Capabilities() + suppModels := make([]*gnmipb.ModelData, len(supportedModels)) + + for index, model := range supportedModels { + suppModels[index] = &gnmipb.ModelData{ + Name: model.Name, + Organization: model.Organization, + Version: model.Version, } + } + + sup_bver := spb.SupportedBundleVersions{ + BundleVersion: translib.GetYangBundleVersion().String(), + BaseVersion: translib.GetYangBaseVersion().String(), + } + sup_msg, _ := proto.Marshal(&sup_bver) + ext := gnmi_extpb.Extension{} + ext.Ext = &gnmi_extpb.Extension_RegisteredExt { + RegisteredExt: &gnmi_extpb.RegisteredExtension { + Id: spb.SUPPORTED_VERSIONS_EXT, + Msg: sup_msg}} + exts := []*gnmi_extpb.Extension{&ext} return &gnmipb.CapabilityResponse{SupportedModels: suppModels, SupportedEncodings: supportedEncodings, - GNMIVersion: "0.7.0"}, nil + GNMIVersion: "0.7.0", + Extension: exts}, nil } func isTargetDb ( target string) (bool) { diff --git a/gnmi_server/server_test.go b/gnmi_server/server_test.go index db1dfed90..07a6c880a 100644 --- a/gnmi_server/server_test.go +++ b/gnmi_server/server_test.go @@ -24,6 +24,7 @@ import ( "github.com/kylelemons/godebug/pretty" "github.com/openconfig/gnmi/client" pb "github.com/openconfig/gnmi/proto/gnmi" + ext_pb "github.com/openconfig/gnmi/proto/gnmi_ext" "github.com/openconfig/gnmi/value" "github.com/openconfig/ygot/ygot" @@ -34,9 +35,13 @@ import ( "google.golang.org/grpc/status" // Register supported client types. + spb "github.com/Azure/sonic-telemetry/proto" + sgpb "github.com/Azure/sonic-telemetry/proto/gnoi" sdc "github.com/Azure/sonic-telemetry/sonic_data_client" sdcfg "github.com/Azure/sonic-telemetry/sonic_db_config" gclient "github.com/jipanyang/gnmi/client/gnmi" + "github.com/jipanyang/gnxi/utils/xpath" + gnoi_system_pb "github.com/openconfig/gnoi/system" ) var clientTypes = []string{gclient.Type} @@ -80,23 +85,23 @@ func loadDBNotStrict(t *testing.T, rclient *redis.Client, mpi map[string]interfa } } -func createServer(t *testing.T) *Server { - certificate, err := testcert.NewCert() - if err != nil { - t.Errorf("could not load server key pair: %s", err) - } - tlsCfg := &tls.Config{ - ClientAuth: tls.RequestClientCert, - Certificates: []tls.Certificate{certificate}, - } - - opts := []grpc.ServerOption{grpc.Creds(credentials.NewTLS(tlsCfg))} - cfg := &Config{Port: 8081} - s, err := NewServer(cfg, opts) - if err != nil { - t.Errorf("Failed to create gNMI server: %v", err) - } - return s +func createServer(t *testing.T, port int64) *Server { + certificate, err := testcert.NewCert() + if err != nil { + t.Errorf("could not load server key pair: %s", err) + } + tlsCfg := &tls.Config{ + ClientAuth: tls.RequestClientCert, + Certificates: []tls.Certificate{certificate}, + } + + opts := []grpc.ServerOption{grpc.Creds(credentials.NewTLS(tlsCfg))} + cfg := &Config{Port: port} + s, err := NewServer(cfg, opts) + if err != nil { + t.Errorf("Failed to create gNMI server: %v", err) + } + return s } // runTestGet requests a path from the server by Get grpc call, and compares if @@ -584,7 +589,7 @@ func TestGnmiSet(t *testing.T) { if !READ_WRITE_MODE { t.Skip("skipping test in read-only mode.") } - s := createServer(t) + s := createServer(t, 8081) go runServer(t, s) prepareDbTranslib(t) @@ -682,7 +687,7 @@ func TestGnmiSet(t *testing.T) { func TestGnmiGet(t *testing.T) { //t.Log("Start server") - s := createServer(t) + s := createServer(t, 8081) go runServer(t, s) prepareDb(t) @@ -944,7 +949,7 @@ func TestGnmiGet(t *testing.T) { func TestGnmiGetTranslib(t *testing.T) { //t.Log("Start server") - s := createServer(t) + s := createServer(t, 8081) go runServer(t, s) prepareDbTranslib(t) @@ -2164,7 +2169,7 @@ func runTestSubscribe(t *testing.T) { } func TestGnmiSubscribe(t *testing.T) { - s := createServer(t) + s := createServer(t, 8081) go runServer(t, s) runTestSubscribe(t) @@ -2174,7 +2179,7 @@ func TestGnmiSubscribe(t *testing.T) { func TestCapabilities(t *testing.T) { //t.Log("Start server") - s := createServer(t) + s := createServer(t, 8085) go runServer(t, s) // prepareDb(t) @@ -2184,7 +2189,7 @@ func TestCapabilities(t *testing.T) { opts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))} //targetAddr := "30.57.185.38:8080" - targetAddr := "127.0.0.1:8081" + targetAddr := "127.0.0.1:8085" conn, err := grpc.Dial(targetAddr, opts...) if err != nil { t.Fatalf("Dialing to %q failed: %v", targetAddr, err) @@ -2206,6 +2211,210 @@ func TestCapabilities(t *testing.T) { } +func TestGNOI(t *testing.T) { + s := createServer(t, 8086) + go runServer(t, s) + defer s.s.Stop() + + // prepareDb(t) + + //t.Log("Start gNMI client") + tlsConfig := &tls.Config{InsecureSkipVerify: true} + opts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))} + + //targetAddr := "30.57.185.38:8080" + targetAddr := "127.0.0.1:8086" + conn, err := grpc.Dial(targetAddr, opts...) + if err != nil { + t.Fatalf("Dialing to %q failed: %v", targetAddr, err) + } + defer conn.Close() + + + ctx, cancel := context.WithTimeout(context.Background(), 240*time.Second) + defer cancel() + + t.Run("SystemTime", func(t *testing.T) { + sc := gnoi_system_pb.NewSystemClient(conn) + resp,err := sc.Time(ctx, new(gnoi_system_pb.TimeRequest)) + if err != nil { + t.Fatal(err.Error()) + } + ctime := uint64(time.Now().UnixNano()) + if ctime - resp.Time < 0 || ctime - resp.Time > 1e9 { + t.Fatalf("Invalid System Time %d", resp.Time) + } + }) + t.Run("SonicShowTechsupport", func(t *testing.T) { + sc := sgpb.NewSonicServiceClient(conn) + rtime := time.Now().AddDate(0,-1,0) + req := &sgpb.TechsupportRequest { + Input: &sgpb.TechsupportRequest_Input{ + Date: rtime.Format("20060102_150405"), + }, + } + resp,err := sc.ShowTechsupport(ctx, req) + if err != nil { + t.Fatal(err.Error()) + } + + if len(resp.Output.OutputFilename) == 0 { + t.Fatalf("Invalid Output Filename: %s", resp.Output.OutputFilename) + } + }) + + type configData struct { + source string + destination string + overwrite bool + status int32 + } + + var cfg_data = []configData { + configData{"running-configuration", "startup-configuration", false, 0}, + configData{"running-configuration", "file://etc/sonic/config_db_test.json", false, 0}, + configData{"file://etc/sonic/config_db_test.json", "running-configuration", false, 0}, + configData{"startup-configuration", "running-configuration", false, 0}, + configData{"file://etc/sonic/config_db_3.json", "running-configuration", false, 1}} + + for _,v := range cfg_data { + + t.Run("SonicCopyConfig", func(t *testing.T) { + sc := sgpb.NewSonicServiceClient(conn) + req := &sgpb.CopyConfigRequest { + Input: &sgpb.CopyConfigRequest_Input{ + Source: v.source, + Destination: v.destination, + Overwrite: v.overwrite, + }, + } + t.Logf("source: %s dest: %s overwrite: %t", v.source, v.destination, v.overwrite) + resp, err := sc.CopyConfig(ctx, req) + if err != nil { + t.Fatal(err.Error()) + } + if resp.Output.Status != v.status { + t.Fatalf("Copy Failed: status %d, %s", resp.Output.Status, resp.Output.StatusDetail) + } + }) + } +} + +func TestBundleVersion(t *testing.T) { + s := createServer(t, 8087) + go runServer(t, s) + defer s.s.Stop() + + // prepareDb(t) + + //t.Log("Start gNMI client") + tlsConfig := &tls.Config{InsecureSkipVerify: true} + opts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))} + + //targetAddr := "30.57.185.38:8080" + targetAddr := "127.0.0.1:8087" + conn, err := grpc.Dial(targetAddr, opts...) + if err != nil { + t.Fatalf("Dialing to %q failed: %v", targetAddr, err) + } + defer conn.Close() + + gClient := pb.NewGNMIClient(conn) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + t.Run("Invalid Bundle Version Format", func(t *testing.T) { + var pbPath *pb.Path + pbPath, err := xpath.ToGNMIPath("openconfig-interfaces:interfaces/interface[name=Ethernet0]/config") + prefix := pb.Path{Target: "OC-YANG"} + if err != nil { + t.Fatalf("error in unmarshaling path: %v", err) + } + bundleVersion := "50.0.0" + bv, err := proto.Marshal(&spb.BundleVersion{ + Version: bundleVersion, + }) + if err != nil { + t.Fatalf("%v", err) + } + req := &pb.GetRequest{ + Path: []*pb.Path{pbPath}, + Prefix: &prefix, + Encoding: pb.Encoding_JSON_IETF, + } + req.Extension = append(req.Extension, &ext_pb.Extension{ + Ext: &ext_pb.Extension_RegisteredExt { + RegisteredExt: &ext_pb.RegisteredExtension { + Id: spb.BUNDLE_VERSION_EXT, + Msg: bv, + }}}) + + + + _, err = gClient.Get(ctx, req) + gotRetStatus, ok := status.FromError(err) + if !ok { + t.Fatal("got a non-grpc error from grpc call") + } + if gotRetStatus.Code() != codes.NotFound { + t.Log("err: ", err) + t.Fatalf("got return code %v, want %v", gotRetStatus.Code(), codes.OK) + } + }) +} + +func TestBulkSet(t *testing.T) { + s := createServer(t, 8088) + go runServer(t, s) + defer s.s.Stop() + + // prepareDb(t) + + //t.Log("Start gNMI client") + tlsConfig := &tls.Config{InsecureSkipVerify: true} + opts := []grpc.DialOption{grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig))} + + //targetAddr := "30.57.185.38:8080" + targetAddr := "127.0.0.1:8088" + conn, err := grpc.Dial(targetAddr, opts...) + if err != nil { + t.Fatalf("Dialing to %q failed: %v", targetAddr, err) + } + defer conn.Close() + + gClient := pb.NewGNMIClient(conn) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + t.Run("Set Multiple mtu", func(t *testing.T) { + pbPath1, _ := xpath.ToGNMIPath("openconfig-interfaces:interfaces/interface[name=Ethernet0]/config/mtu") + v := &pb.TypedValue{ + Value: &pb.TypedValue_JsonIetfVal{JsonIetfVal: []byte("{\"mtu\": 9104}")}} + update1 := &pb.Update { + Path: pbPath1, + Val: v, + } + pbPath2, _ := xpath.ToGNMIPath("openconfig-interfaces:interfaces/interface[name=Ethernet4]/config/mtu") + v2 := &pb.TypedValue{ + Value: &pb.TypedValue_JsonIetfVal{JsonIetfVal: []byte("{\"mtu\": 9105}")}} + update2 := &pb.Update { + Path: pbPath2, + Val: v2, + } + + + req := &pb.SetRequest{ + Update: []*pb.Update{update1, update2}, + } + + _, err = gClient.Set(ctx, req) + _, ok := status.FromError(err) + if !ok { + t.Fatal("got a non-grpc error from grpc call") + } + + }) + +} + func init() { // Enable logs at UT setup flag.Lookup("v").Value.Set("10") diff --git a/gnoi_client/gnoi_client.go b/gnoi_client/gnoi_client.go new file mode 100644 index 000000000..3a049fcbd --- /dev/null +++ b/gnoi_client/gnoi_client.go @@ -0,0 +1,260 @@ +package main + +import ( + "google.golang.org/grpc" + gnoi_system_pb "github.com/openconfig/gnoi/system" + spb "github.com/Azure/sonic-telemetry/proto/gnoi" + spb_jwt "github.com/Azure/sonic-telemetry/proto/gnoi/jwt" + "context" + "os" + "os/signal" + "fmt" + "flag" + "google.golang.org/grpc/metadata" + "github.com/google/gnxi/utils/credentials" + "encoding/json" +) + +var ( + module = flag.String("module", "System", "gNOI Module") + rpc = flag.String("rpc", "Time", "rpc call in specified module to call") + target = flag.String("target", "localhost:8080", "Address:port of gNOI Server") + args = flag.String("jsonin", "", "RPC Arguments in json format") + jwtToken = flag.String("jwt_token", "", "JWT Token if required") + targetName = flag.String("target_name", "hostname.com", "The target name use to verify the hostname returned by TLS handshake") +) +func setUserCreds(ctx context.Context) context.Context { + if len(*jwtToken) > 0 { + ctx = metadata.AppendToOutgoingContext(ctx, "access_token", *jwtToken) + } + return ctx +} +func main() { + flag.Parse() + opts := credentials.ClientCredentials(*targetName) + + ctx, cancel := context.WithCancel(context.Background()) + go func() { + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt) + <-c + cancel() + }() + conn, err := grpc.Dial(*target, opts...) + if err != nil { + panic(err.Error()) + } + + switch *module { + case "System": + sc := gnoi_system_pb.NewSystemClient(conn) + switch *rpc { + case "Time": + systemTime(sc, ctx) + default: + panic("Invalid RPC Name") + } + case "Sonic": + switch *rpc { + case "showtechsupport": + sc := spb.NewSonicServiceClient(conn) + sonicShowTechSupport(sc, ctx) + case "copyConfig": + sc := spb.NewSonicServiceClient(conn) + copyConfig(sc, ctx) + case "authenticate": + sc := spb_jwt.NewSonicJwtServiceClient(conn) + authenticate(sc, ctx) + case "imageInstall": + sc := spb.NewSonicServiceClient(conn) + imageInstall(sc, ctx) + case "imageDefault": + sc := spb.NewSonicServiceClient(conn) + imageDefault(sc, ctx) + case "imageRemove": + sc := spb.NewSonicServiceClient(conn) + imageRemove(sc, ctx) + case "refresh": + sc := spb_jwt.NewSonicJwtServiceClient(conn) + refresh(sc, ctx) + case "clearNeighbors": + sc := spb.NewSonicServiceClient(conn) + clearNeighbors(sc, ctx) + default: + panic("Invalid RPC Name") + } + default: + panic("Invalid Module Name") + } + +} + +func systemTime(sc gnoi_system_pb.SystemClient, ctx context.Context) { + fmt.Println("System Time") + ctx = setUserCreds(ctx) + resp,err := sc.Time(ctx, new(gnoi_system_pb.TimeRequest)) + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} + +func sonicShowTechSupport(sc spb.SonicServiceClient, ctx context.Context) { + fmt.Println("Sonic ShowTechsupport") + ctx = setUserCreds(ctx) + req := &spb.TechsupportRequest { + Input: &spb.TechsupportRequest_Input{ + + }, + } + + json.Unmarshal([]byte(*args), req) + + resp,err := sc.ShowTechsupport(ctx, req) + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} + +func copyConfig(sc spb.SonicServiceClient, ctx context.Context) { + fmt.Println("Sonic CopyConfig") + ctx = setUserCreds(ctx) + req := &spb.CopyConfigRequest{ + Input: &spb.CopyConfigRequest_Input{}, + } + json.Unmarshal([]byte(*args), req) + + resp,err := sc.CopyConfig(ctx, req) + + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} +func imageInstall(sc spb.SonicServiceClient, ctx context.Context) { + fmt.Println("Sonic ImageInstall") + ctx = setUserCreds(ctx) + req := &spb.ImageInstallRequest{ + Input: &spb.ImageInstallRequest_Input{}, + } + json.Unmarshal([]byte(*args), req) + + resp,err := sc.ImageInstall(ctx, req) + + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} +func imageRemove(sc spb.SonicServiceClient, ctx context.Context) { + fmt.Println("Sonic ImageRemove") + ctx = setUserCreds(ctx) + req := &spb.ImageRemoveRequest{ + Input: &spb.ImageRemoveRequest_Input{}, + } + json.Unmarshal([]byte(*args), req) + + resp,err := sc.ImageRemove(ctx, req) + + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} + +func imageDefault(sc spb.SonicServiceClient, ctx context.Context) { + fmt.Println("Sonic ImageDefault") + ctx = setUserCreds(ctx) + req := &spb.ImageDefaultRequest{ + Input: &spb.ImageDefaultRequest_Input{}, + } + json.Unmarshal([]byte(*args), req) + + resp,err := sc.ImageDefault(ctx, req) + + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} + +func authenticate(sc spb_jwt.SonicJwtServiceClient, ctx context.Context) { + fmt.Println("Sonic Authenticate") + ctx = setUserCreds(ctx) + req := &spb_jwt.AuthenticateRequest {} + + json.Unmarshal([]byte(*args), req) + + resp,err := sc.Authenticate(ctx, req) + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} + +func refresh(sc spb_jwt.SonicJwtServiceClient, ctx context.Context) { + fmt.Println("Sonic Refresh") + ctx = setUserCreds(ctx) + req := &spb_jwt.RefreshRequest {} + + json.Unmarshal([]byte(*args), req) + + resp,err := sc.Refresh(ctx, req) + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} + +func clearNeighbors(sc spb.SonicServiceClient, ctx context.Context) { + fmt.Println("Sonic ClearNeighbors") + ctx = setUserCreds(ctx) + req := &spb.ClearNeighborsRequest{ + Input: &spb.ClearNeighborsRequest_Input{}, + } + json.Unmarshal([]byte(*args), req) + + resp,err := sc.ClearNeighbors(ctx, req) + + if err != nil { + panic(err.Error()) + } + respstr, err := json.Marshal(resp) + if err != nil { + panic(err.Error()) + } + fmt.Println(string(respstr)) +} diff --git a/go.sum b/go.sum index 80d1d39a7..2b65119f0 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,35 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= +github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/antchfx/jsonquery v1.0.0 h1:1Yhk496SrCoY6fJkFZqpXEqbwOw5sFtLns9la4NoK3I= +github.com/antchfx/jsonquery v1.0.0/go.mod h1:h7950pvPrUZzJIflNqsELgDQovTpPNa0rAHf8NwjegY= github.com/antchfx/jsonquery v1.1.0 h1:ZeqeHheI8WsEN5blUqZXZ30w2jrbFvlQIq5B7X7Z86E= github.com/antchfx/jsonquery v1.1.0/go.mod h1:h7950pvPrUZzJIflNqsELgDQovTpPNa0rAHf8NwjegY= +github.com/antchfx/jsonquery v1.1.4 h1:+OlFO3QS9wjU0MKx9MgHm5f6o6hdd4e9mUTp0wTjxlM= +github.com/antchfx/jsonquery v1.1.4/go.mod h1:cHs8r6Bymd8j6HI6Ej1IJbjahKvLBcIEh54dfmo+E9A= +github.com/antchfx/xmlquery v1.1.1-0.20191015122529-fe009d4cc63c h1:7PNiWdkjxIpDv6dqsTYbczOgPmiloDTV9qNeP8v66I8= +github.com/antchfx/xmlquery v1.1.1-0.20191015122529-fe009d4cc63c/go.mod h1:/+CnyD/DzHRnv2eRxrVbieRU/FIF6N0C+7oTtyUtCKk= github.com/antchfx/xmlquery v1.2.1 h1:wE4xjHrqOScP440wdv23Xkg0Gr8JryW0ptqodPH+y2U= github.com/antchfx/xmlquery v1.2.1/go.mod h1:/+CnyD/DzHRnv2eRxrVbieRU/FIF6N0C+7oTtyUtCKk= +github.com/antchfx/xmlquery v1.3.1 h1:nIKWdtnhrXtj0/IRUAAw2I7TfpHUa3zMnHvNmPXFg+w= +github.com/antchfx/xmlquery v1.3.1/go.mod h1:64w0Xesg2sTaawIdNqMB+7qaW/bSqkQm+ssPaCMWNnc= github.com/antchfx/xpath v1.1.2 h1:YziPrtM0gEJBnhdUGxYcIVYXZ8FXbtbovxOi+UW/yWQ= github.com/antchfx/xpath v1.1.2/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/antchfx/xpath v1.1.7/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/antchfx/xpath v1.1.10 h1:cJ0pOvEdN/WvYXxvRrzQH9x5QWKpzHacYO8qzCcDYAg= +github.com/antchfx/xpath v1.1.10/go.mod h1:Yee4kTMuNiPYJ7nSNorELQMr1J33uOpXDMByNYhvtNk= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d h1:zsO4lp+bjv5XvPTF58Vq+qgmZEYZttJK+CWtSZhKenI= +github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d/go.mod h1:f1iKL6ZhUWvbk7PdWVmOaak10o86cqMUYEmn1CZNGEI= github.com/c9s/goprocinfo v0.0.0-20191125144613-4acdd056c72d h1:MQGrhPHSxg08x+LKgQTOnnjfXt+p+128WCECqAYXJsU= github.com/c9s/goprocinfo v0.0.0-20191125144613-4acdd056c72d/go.mod h1:uEyr4WpAH4hio6LFriaPkL938XnrvLpNPmQHBdrmbIE= +github.com/c9s/goprocinfo v0.0.0-20200311234719-5750cbd54a3b h1:djdFzvwQ8aPNEGiXLnV3i10hYxwFWBjimcGxmt5gDuo= +github.com/c9s/goprocinfo v0.0.0-20200311234719-5750cbd54a3b/go.mod h1:uEyr4WpAH4hio6LFriaPkL938XnrvLpNPmQHBdrmbIE= github.com/cenkalti/backoff/v4 v4.0.0 h1:6VeaLF9aI+MAUQ95106HwWzYZgJJpZ4stumjj6RFYAU= github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -17,22 +37,39 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb h1:IT4JYU7k4ikYg1SCxNI1/Tieq/NFvh6dzLdgi7eu0tM= +github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb/go.mod h1:bH6Xx7IW64qjjJq8M2u4dxNaBiDfKK+z/3eGDpXEQhc= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/go-redis/redis v6.15.6+incompatible h1:H9evprGPLI8+ci7fxQx6WNZHJSb7be8FqJQRhdQZ5Sg= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= +github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-redis/redis v6.15.6+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U= +github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-redis/redis/v7 v7.0.0-beta.3.0.20190824101152-d19aba07b476/go.mod h1:xhhSbUMTsleRPur+Vgx9sUHtyN33bdjxY+9/0n9Ig8s= +github.com/go-redis/redis/v7 v7.2.0 h1:CrCexy/jYWZjW0AyVoHlcJUeZN19VWlbepTh1Vq6dJs= +github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= +github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -40,62 +77,109 @@ github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0 h1:aRz0NBceriICVtjhCgKkDvl+RudKu1CT6h0ZvUTrNfE= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/google/gnxi v0.0.0-20191016182648-6697a080bc2d h1:OtErLAncPdsEEhOI4ueR48dr6uThRIPkwWcOAdQ4LyI= github.com/google/gnxi v0.0.0-20191016182648-6697a080bc2d/go.mod h1:6kkMbKS62iZMyk1q0zukcqkEJwnIhcbgg/hmoFmRDZk= -github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/protobuf v3.11.4+incompatible/go.mod h1:lUQ9D1ePzbH2PrIS7ob/bjm9HXyH5WHB0Akwh7URreM= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.0 h1:0IKlLyQ3Hs9nDaiK5cSHAGmcQEIC8l2Ts1u6x5Dfrqg= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.0/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jipanyang/gnmi v0.0.0-20180820232453-cb4d464fa018 h1:M++7b2XCTGqQwqu+AB0B3XzXiV+vVawnXJ4tvxUMrTU= github.com/jipanyang/gnmi v0.0.0-20180820232453-cb4d464fa018/go.mod h1:+aiusdWGFuKzi7B8/Y75kTlIA3UDF+sUBfY5+1e2NLs= github.com/jipanyang/gnxi v0.0.0-20181221084354-f0a90cca6fd0 h1:Dr/hrfbZxVlT/VvLfv8glHZAf9dLfuTSCJQq7cRGydo= github.com/jipanyang/gnxi v0.0.0-20181221084354-f0a90cca6fd0/go.mod h1:vL9tMB3I625wwTPrEWmJ+kWrsHHFN/J79IEQD9knVi0= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/msteinert/pam v0.0.0-20190215180659-f29b9f28d6f9 h1:ZivaaKmjs9q90zi6I4gTLW6tbVGtlBjellr3hMYaly0= +github.com/msteinert/pam v0.0.0-20190215180659-f29b9f28d6f9/go.mod h1:np1wUFZ6tyoke22qDJZY40URn9Ae51gX7ljIWXN5TJs= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY= -github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1 h1:q/mM8GF/n0shIN8SaAZ0V+jnLPzen6WIVZdiwrRlMlo= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c h1:a380JP+B7xlMbEQOlha1buKhzBPXFqgFXplyWCEIGEY= -github.com/openconfig/gnmi v0.0.0-20190823184014-89b2bf29312c/go.mod h1:t+O9It+LKzfOAhKTT5O0ehDix+MTqbtT0T9t+7zzOvc= +github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/openconfig/gnmi v0.0.0-20200307010808-e7106f7f5493 h1:e/znXbq+Yiws97a4lJYlUeRw9OGxT2q27L4aMUb0GuM= github.com/openconfig/gnmi v0.0.0-20200307010808-e7106f7f5493/go.mod h1:jMSUQIR4z9WTtM58/QBHbElXAwbUnomFdty1aund1uY= +github.com/openconfig/gnmi v0.0.0-20200414194230-1597cc0f2600/go.mod h1:M/EcuapNQgvzxo1DDXHK4tx3QpYM/uG4l591v33jG2A= +github.com/openconfig/gnmi v0.0.0-20200428194327-ac853c8e2ab5 h1:YaMJaAf3AW67ecn9ocCPq5uSsIDvlUQcmM+nCFAJXUY= +github.com/openconfig/gnmi v0.0.0-20200428194327-ac853c8e2ab5/go.mod h1:M/EcuapNQgvzxo1DDXHK4tx3QpYM/uG4l591v33jG2A= github.com/openconfig/gnmi v0.0.0-20200617225440-d2b4e6a45802 h1:WXFwJlWOJINlwlyAZuNo4GdYZS6qPX36+rRUncLmN8Q= github.com/openconfig/gnmi v0.0.0-20200617225440-d2b4e6a45802/go.mod h1:M/EcuapNQgvzxo1DDXHK4tx3QpYM/uG4l591v33jG2A= -github.com/openconfig/goyang v0.0.0-20190924211109-064f9690516f h1:BaekRUaWpfaRBP3mShDZaNi4+EHbdli7D6YXc/TP3lo= -github.com/openconfig/goyang v0.0.0-20190924211109-064f9690516f/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU= +github.com/openconfig/gnoi v0.0.0-20191206155121-b4d663a26026 h1:LqWmMvsOBxqjWmW+EWSS3kxEGE3mh771zAx69549IoI= +github.com/openconfig/gnoi v0.0.0-20191206155121-b4d663a26026/go.mod h1:i43VWfb9tMz9b6MzLxTztJeBP4U0AAqscMSX7o507jk= +github.com/openconfig/gnoi v0.0.0-20200330143908-0b5aea31df40 h1:pI99VKs2+OcF9LuW0bJDJSp2b67qDSlvDI4kugPK+zM= +github.com/openconfig/gnoi v0.0.0-20200330143908-0b5aea31df40/go.mod h1:i43VWfb9tMz9b6MzLxTztJeBP4U0AAqscMSX7o507jk= github.com/openconfig/goyang v0.0.0-20200115183954-d0a48929f0ea/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU= github.com/openconfig/goyang v0.0.0-20200309174518-a00bece872fc h1:W6XYKuH3mxF5WFhsSQOPPN9DRDba1xz9lbUbQR3uHkg= github.com/openconfig/goyang v0.0.0-20200309174518-a00bece872fc/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU= +github.com/openconfig/goyang v0.0.0-20200328051049-f3d50fd25b33 h1:giwoPW7W3APrb2JUksjek+rAiSryYHMv+bzvh5UZRm8= +github.com/openconfig/goyang v0.0.0-20200328051049-f3d50fd25b33/go.mod h1:dhXaV0JgHJzdrHi2l+w0fZrwArtXL7jEFoiqLEdmkvU= github.com/openconfig/ygot v0.6.0 h1:kJJFPBrczC6TDnz/HMlFTJEdW2CuyUftV13XveIukg0= github.com/openconfig/ygot v0.6.0/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs= -github.com/openconfig/ygot v0.6.1-0.20190723223108-724a6b18a922 h1:zBLb75mrLMxabjsAhPk/2qxbht+BwHKFWBvRAB4Fd2U= -github.com/openconfig/ygot v0.6.1-0.20190723223108-724a6b18a922/go.mod h1:o30svNf7O0xK+R35tlx95odkDmZWS9JyWWQSmIhqwAs= github.com/openconfig/ygot v0.7.0/go.mod h1:5MwNX6DMP1QMf2eQjW+aJN/KNslVqRJtbfSL3SO6Urk= github.com/openconfig/ygot v0.7.1 h1:kqDRYQpowXTr7EhGwr2BBDKJzqs+H8aFYjffYQ8lBsw= github.com/openconfig/ygot v0.7.1/go.mod h1:5MwNX6DMP1QMf2eQjW+aJN/KNslVqRJtbfSL3SO6Urk= -github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3 h1:YtFkrqsMEj7YqpIhRteVxJxCeC3jJBieuLr0d4C4rSA= +github.com/openconfig/ygot v0.7.3 h1:quwFRwgRjKNsYU2NdnW483LLSQ5Y+GuY8UXICIClJL0= +github.com/openconfig/ygot v0.7.3/go.mod h1:U5806JUYdoshmrER+M8jpP758i8j+rt4mOFZTHPwtkQ= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pborman/getopt v0.0.0-20190409184431-ee0cd42419d3/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o= +github.com/philopon/go-toposort v0.0.0-20170620085441-9be86dbd762f h1:WyCn68lTiytVSkk7W1K9nBiSGTSRlUOdyTnSjwrIlok= +github.com/philopon/go-toposort v0.0.0-20170620085441-9be86dbd762f/go.mod h1:/iRjX3DdSK956SzsUdV55J+wIsQ+2IBWmBrB4RvZfk4= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/profile v1.4.0/go.mod h1:NWz/XGvpEW1FyYQ7fCx4dqYBLlfTcE+A9FLAkNKqjFE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/shirou/gopsutil v2.20.5+incompatible h1:tYH07UPoQt0OCQdgWWMgYHy3/a9bcxNpBIysykNIP7I= +github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/tredoe/fileutil v1.0.0/go.mod h1:PBayWPFCURwkmW0u6E8E8C6Jtd9ZzWq/U1iMa6BLRPg= +github.com/tredoe/goutil v0.0.0-20200111155331-68cefb6d3cdc/go.mod h1:dp4VPOLeEFYbsf1ikgd+uytWDnpCdMiTHMg6mh7hHuQ= +github.com/tredoe/osutil v1.0.5 h1:mfXjHBJU46GoJDOUcHyV895fauUuVikR9U8yRbGBrqw= +github.com/tredoe/osutil v1.0.5/go.mod h1:DDO4G4Mwys6NJi5JmEVLnfFbQWIfVVri8L6HuXb/v98= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79 h1:IaQbIIB2X/Mp/DKctl6ROxz1KyMlKp4uyvL6+kQ7C88= +golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -106,42 +190,54 @@ golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478 h1:l5EDrHhldLYb3ZRHDUhXF7Om7MvYXnkV9/iQNo1lX6g= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U= +golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4= +golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= +golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200319113533-08878b785e9c h1:5aI3/f/3eCZps9xwoEnmgfDJDhMbnJpfqeGpjVNgVEI= google.golang.org/genproto v0.0.0-20200319113533-08878b785e9c/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1 h1:wdKvqQk7IttEw92GoRyKG2IDrUIpgpj6H6m81yfeMW0= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -149,8 +245,9 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.20.1/go.mod h1:KqelGeouBkcbcuB3HCk4/YH2tmNLk6YSWA5LIWeI/lY= google.golang.org/protobuf v1.21.0 h1:qdOKuR/EIArgaWNjetjgTzgVTAZ+S/WXVrq9HW9zimw= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= diff --git a/patches/gnmi_get.patch b/patches/gnmi_get.patch new file mode 100644 index 000000000..5d27653fc --- /dev/null +++ b/patches/gnmi_get.patch @@ -0,0 +1,36 @@ +--- ./github.com/jipanyang/gnxi/gnmi_get/gnmi_get.go 2019-11-26 15:44:07.303598063 -0800 ++++ ./github.com/jipanyang/gnxi/gnmi_get/gnmi_get.go 2019-12-19 19:56:11.364223008 -0800 +@@ -30,7 +30,7 @@ + "github.com/google/gnxi/utils" + "github.com/google/gnxi/utils/credentials" + "github.com/jipanyang/gnxi/utils/xpath" +- ++ "google.golang.org/grpc/metadata" + pb "github.com/openconfig/gnmi/proto/gnmi" + ) + +@@ -63,11 +63,12 @@ + xPathFlags arrayFlags + pbPathFlags arrayFlags + pbModelDataFlags arrayFlags +- pathTarget = flag.String("xpath_target", "CONFIG_DB", "name of the target for which the path is a member") ++ pathTarget = flag.String("xpath_target", "", "name of the target for which the path is a member") + targetAddr = flag.String("target_addr", "localhost:10161", "The target address in the format of host:port") + targetName = flag.String("target_name", "hostname.com", "The target name use to verify the hostname returned by TLS handshake") + timeOut = flag.Duration("time_out", 10*time.Second, "Timeout for the Get request, 10 seconds by default") + encodingName = flag.String("encoding", "JSON_IETF", "value encoding format to be used") ++ jwtToken = flag.String("jwt_token", "", "JWT Token if required") + ) + + func main() { +@@ -88,6 +89,10 @@ + ctx, cancel := context.WithTimeout(context.Background(), *timeOut) + defer cancel() + ++ if len(*jwtToken) > 0 { ++ ctx = metadata.AppendToOutgoingContext(ctx, "access_token", *jwtToken) ++ } ++ + encoding, ok := pb.Encoding_value[*encodingName] + if !ok { + var gnmiEncodingList []string diff --git a/patches/gnmi_set.patch b/patches/gnmi_set.patch new file mode 100644 index 000000000..48b3c31f6 --- /dev/null +++ b/patches/gnmi_set.patch @@ -0,0 +1,86 @@ +--- ./github.com/jipanyang/gnxi/gnmi_set/gnmi_set.go 2019-11-26 15:44:07.303598063 -0800 ++++ ./github.com/jipanyang/gnxi/gnmi_set/gnmi_set.go 2020-02-12 10:13:46.247988021 -0800 +@@ -31,8 +31,9 @@ + + "github.com/google/gnxi/utils" + "github.com/google/gnxi/utils/credentials" +- "github.com/google/gnxi/utils/xpath" +- ++ //"github.com/google/gnxi/utils/xpath" ++ "github.com/jipanyang/gnxi/utils/xpath" ++ "google.golang.org/grpc/metadata" + pb "github.com/openconfig/gnmi/proto/gnmi" + ) + +@@ -54,16 +55,37 @@ + targetAddr = flag.String("target_addr", "localhost:10161", "The target address in the format of host:port") + targetName = flag.String("target_name", "hostname.com", "The target name use to verify the hostname returned by TLS handshake") + timeOut = flag.Duration("time_out", 10*time.Second, "Timeout for the Get request, 10 seconds by default") ++ pathTarget = flag.String("xpath_target", "", "name of the target for which the path is a member") ++ jwtToken = flag.String("jwt_token", "", "JWT Token if required") + ) + + func buildPbUpdateList(pathValuePairs []string) []*pb.Update { + var pbUpdateList []*pb.Update + for _, item := range pathValuePairs { +- pathValuePair := strings.SplitN(item, ":", 2) +- // TODO (leguo): check if any path attribute contains ':' ++ modName := strings.SplitN(item, "/", 3) ++ ++ pathValuePair := make([]string, 2) ++ lc := strings.LastIndex(modName[2],":") ++ ++ if lc == -1 { ++ log.Exitf("invalid path-value pair: %v", item) ++ } ++ pathValuePair_r := strings.SplitN(modName[2], ":", 2) ++ // pathValuePair[0] = modName[2][0:lc] ++ ++ pathValuePair[0] = "/" + modName[1] + "/" + pathValuePair_r[0] ++ ++ pathValuePair[1] = modName[2][lc+1:] ++ fmt.Println(pathValuePair[0]) ++ fmt.Println(pathValuePair[1]) ++ ++ + if len(pathValuePair) != 2 || len(pathValuePair[1]) == 0 { + log.Exitf("invalid path-value pair: %v", item) ++ log.Exitf("invalid path-value pair: %v", modName) + } ++ ++ + pbPath, err := xpath.ToGNMIPath(pathValuePair[0]) + if err != nil { + log.Exitf("error in parsing xpath %q to gnmi path", pathValuePair[0]) +@@ -144,8 +166,10 @@ + } + replaceList := buildPbUpdateList(replaceOpt) + updateList := buildPbUpdateList(updateOpt) +- ++ var prefix pb.Path ++ prefix.Target = *pathTarget + setRequest := &pb.SetRequest{ ++ Prefix: &prefix, + Delete: deleteList, + Replace: replaceList, + Update: updateList, +@@ -155,11 +179,17 @@ + utils.PrintProto(setRequest) + + cli := pb.NewGNMIClient(conn) +- setResponse, err := cli.Set(context.Background(), setRequest) ++ ctx, cancel := context.WithTimeout(context.Background(), *timeOut) ++ defer cancel() ++ ++ if len(*jwtToken) > 0 { ++ ctx = metadata.AppendToOutgoingContext(ctx, "access_token", *jwtToken) ++ } ++ setResponse, err := cli.Set(ctx, setRequest) + if err != nil { + log.Exitf("Set failed: %v", err) + } + +- fmt.Println("== getResponse:") ++ fmt.Println("== setResponse:") + utils.PrintProto(setResponse) + } diff --git a/proto/constants.go b/proto/constants.go new file mode 100644 index 000000000..eadbbf5ea --- /dev/null +++ b/proto/constants.go @@ -0,0 +1,4 @@ +package gnmi_sonic + +const BUNDLE_VERSION_EXT = 700 +const SUPPORTED_VERSIONS_EXT = 701 diff --git a/proto/dial_out.pb.go b/proto/dial_out.pb.go index 26e7854ac..4fe857120 100644 --- a/proto/dial_out.pb.go +++ b/proto/dial_out.pb.go @@ -6,12 +6,14 @@ Package gnmi_sonic is a generated protocol buffer package. It is generated from these files: dial_out.proto - sonic.proto sonic_internal.proto + sonic.proto It has these top-level messages: PublishResponse Value + SupportedBundleVersions + BundleVersion */ package gnmi_sonic diff --git a/proto/gnoi/README.md b/proto/gnoi/README.md new file mode 100644 index 000000000..a82390df7 --- /dev/null +++ b/proto/gnoi/README.md @@ -0,0 +1,2 @@ +export PATH=$PATH:$HOME/go/bin +protoc -I . -I ~/go/src --gofast_out=plugins=grpc:. *.proto diff --git a/proto/gnoi/jwt/sonic_gnoi_jwt.pb.go b/proto/gnoi/jwt/sonic_gnoi_jwt.pb.go new file mode 100644 index 000000000..35736bf76 --- /dev/null +++ b/proto/gnoi/jwt/sonic_gnoi_jwt.pb.go @@ -0,0 +1,1301 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: sonic_gnoi_jwt.proto + +package gnoi_sonic_jwt + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type JwtToken struct { + AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + ExpiresIn int64 `protobuf:"varint,3,opt,name=expires_in,json=expiresIn,proto3" json:"expires_in,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *JwtToken) Reset() { *m = JwtToken{} } +func (m *JwtToken) String() string { return proto.CompactTextString(m) } +func (*JwtToken) ProtoMessage() {} +func (*JwtToken) Descriptor() ([]byte, []int) { + return fileDescriptor_a2a81dd5b5518377, []int{0} +} +func (m *JwtToken) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *JwtToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_JwtToken.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *JwtToken) XXX_Merge(src proto.Message) { + xxx_messageInfo_JwtToken.Merge(m, src) +} +func (m *JwtToken) XXX_Size() int { + return m.Size() +} +func (m *JwtToken) XXX_DiscardUnknown() { + xxx_messageInfo_JwtToken.DiscardUnknown(m) +} + +var xxx_messageInfo_JwtToken proto.InternalMessageInfo + +func (m *JwtToken) GetAccessToken() string { + if m != nil { + return m.AccessToken + } + return "" +} + +func (m *JwtToken) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *JwtToken) GetExpiresIn() int64 { + if m != nil { + return m.ExpiresIn + } + return 0 +} + +type AuthenticateRequest struct { + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthenticateRequest) Reset() { *m = AuthenticateRequest{} } +func (m *AuthenticateRequest) String() string { return proto.CompactTextString(m) } +func (*AuthenticateRequest) ProtoMessage() {} +func (*AuthenticateRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a2a81dd5b5518377, []int{1} +} +func (m *AuthenticateRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthenticateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthenticateRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthenticateRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthenticateRequest.Merge(m, src) +} +func (m *AuthenticateRequest) XXX_Size() int { + return m.Size() +} +func (m *AuthenticateRequest) XXX_DiscardUnknown() { + xxx_messageInfo_AuthenticateRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthenticateRequest proto.InternalMessageInfo + +func (m *AuthenticateRequest) GetUsername() string { + if m != nil { + return m.Username + } + return "" +} + +func (m *AuthenticateRequest) GetPassword() string { + if m != nil { + return m.Password + } + return "" +} + +type AuthenticateResponse struct { + Token *JwtToken `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AuthenticateResponse) Reset() { *m = AuthenticateResponse{} } +func (m *AuthenticateResponse) String() string { return proto.CompactTextString(m) } +func (*AuthenticateResponse) ProtoMessage() {} +func (*AuthenticateResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a2a81dd5b5518377, []int{2} +} +func (m *AuthenticateResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *AuthenticateResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_AuthenticateResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *AuthenticateResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_AuthenticateResponse.Merge(m, src) +} +func (m *AuthenticateResponse) XXX_Size() int { + return m.Size() +} +func (m *AuthenticateResponse) XXX_DiscardUnknown() { + xxx_messageInfo_AuthenticateResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_AuthenticateResponse proto.InternalMessageInfo + +func (m *AuthenticateResponse) GetToken() *JwtToken { + if m != nil { + return m.Token + } + return nil +} + +type RefreshRequest struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RefreshRequest) Reset() { *m = RefreshRequest{} } +func (m *RefreshRequest) String() string { return proto.CompactTextString(m) } +func (*RefreshRequest) ProtoMessage() {} +func (*RefreshRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_a2a81dd5b5518377, []int{3} +} +func (m *RefreshRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RefreshRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RefreshRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RefreshRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_RefreshRequest.Merge(m, src) +} +func (m *RefreshRequest) XXX_Size() int { + return m.Size() +} +func (m *RefreshRequest) XXX_DiscardUnknown() { + xxx_messageInfo_RefreshRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_RefreshRequest proto.InternalMessageInfo + +type RefreshResponse struct { + Token *JwtToken `protobuf:"bytes,1,opt,name=Token,proto3" json:"Token,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RefreshResponse) Reset() { *m = RefreshResponse{} } +func (m *RefreshResponse) String() string { return proto.CompactTextString(m) } +func (*RefreshResponse) ProtoMessage() {} +func (*RefreshResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a2a81dd5b5518377, []int{4} +} +func (m *RefreshResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RefreshResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RefreshResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RefreshResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_RefreshResponse.Merge(m, src) +} +func (m *RefreshResponse) XXX_Size() int { + return m.Size() +} +func (m *RefreshResponse) XXX_DiscardUnknown() { + xxx_messageInfo_RefreshResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_RefreshResponse proto.InternalMessageInfo + +func (m *RefreshResponse) GetToken() *JwtToken { + if m != nil { + return m.Token + } + return nil +} + +func init() { + proto.RegisterType((*JwtToken)(nil), "gnoi.sonic_jwt.JwtToken") + proto.RegisterType((*AuthenticateRequest)(nil), "gnoi.sonic_jwt.AuthenticateRequest") + proto.RegisterType((*AuthenticateResponse)(nil), "gnoi.sonic_jwt.AuthenticateResponse") + proto.RegisterType((*RefreshRequest)(nil), "gnoi.sonic_jwt.RefreshRequest") + proto.RegisterType((*RefreshResponse)(nil), "gnoi.sonic_jwt.RefreshResponse") +} + +func init() { proto.RegisterFile("sonic_gnoi_jwt.proto", fileDescriptor_a2a81dd5b5518377) } + +var fileDescriptor_a2a81dd5b5518377 = []byte{ + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcd, 0x4e, 0xc2, 0x40, + 0x10, 0xa6, 0xe2, 0x0f, 0x0c, 0x04, 0xc8, 0xca, 0xa1, 0x69, 0x62, 0xc5, 0xea, 0x81, 0x8b, 0x25, + 0xc1, 0x27, 0xc0, 0x83, 0x89, 0x44, 0x2f, 0x85, 0x9b, 0x87, 0x5a, 0xea, 0x50, 0x16, 0xc3, 0x6e, + 0xed, 0x6e, 0xad, 0xbe, 0x89, 0x0f, 0xe3, 0x03, 0x78, 0xf4, 0x11, 0x0c, 0xbe, 0x88, 0xe9, 0xb6, + 0x34, 0x42, 0xd4, 0x83, 0xb7, 0xfd, 0xe6, 0xfb, 0xe6, 0x9b, 0x6f, 0x26, 0x0b, 0x6d, 0xc1, 0x19, + 0xf5, 0xdd, 0x80, 0x71, 0xea, 0xce, 0x13, 0x69, 0x87, 0x11, 0x97, 0x9c, 0x34, 0x52, 0x6c, 0x67, + 0xd4, 0x3c, 0x91, 0xc6, 0x69, 0x40, 0xe5, 0x2c, 0x9e, 0xd8, 0x3e, 0x5f, 0xf4, 0x02, 0x1e, 0xf0, + 0x9e, 0x92, 0x4d, 0xe2, 0xa9, 0x42, 0x0a, 0xa8, 0x57, 0xd6, 0x6e, 0xdd, 0x42, 0x65, 0x98, 0xc8, + 0x31, 0xbf, 0x47, 0x46, 0x8e, 0xa0, 0xee, 0xf9, 0x3e, 0x0a, 0xe1, 0xca, 0x14, 0xeb, 0x5a, 0x47, + 0xeb, 0x56, 0x9d, 0x5a, 0x56, 0xcb, 0x24, 0x04, 0xb6, 0xe5, 0x73, 0x88, 0xfa, 0x96, 0xa2, 0xd4, + 0x9b, 0x1c, 0x00, 0xe0, 0x53, 0x48, 0x23, 0x14, 0x2e, 0x65, 0x7a, 0xb9, 0xa3, 0x75, 0xcb, 0x4e, + 0x35, 0xaf, 0x5c, 0x32, 0xeb, 0x1a, 0xf6, 0x07, 0xb1, 0x9c, 0x21, 0x93, 0xd4, 0xf7, 0x24, 0x3a, + 0xf8, 0x10, 0xa3, 0x90, 0xc4, 0x80, 0x4a, 0x2c, 0x30, 0x62, 0xde, 0x02, 0xf3, 0x41, 0x05, 0x4e, + 0xb9, 0xd0, 0x13, 0x22, 0xe1, 0xd1, 0x5d, 0x3e, 0xa9, 0xc0, 0xd6, 0x05, 0xb4, 0xd7, 0xed, 0x44, + 0xc8, 0x99, 0x40, 0x62, 0xc3, 0xce, 0xb8, 0x48, 0x5d, 0xeb, 0xeb, 0xf6, 0xfa, 0x5d, 0xec, 0xd5, + 0x96, 0x4e, 0x26, 0xb3, 0x5a, 0xd0, 0x70, 0x70, 0x1a, 0xa1, 0x98, 0xe5, 0x89, 0xac, 0x01, 0x34, + 0x8b, 0xca, 0xff, 0x4c, 0xfb, 0xaf, 0x1a, 0x34, 0x47, 0x29, 0x3b, 0x4c, 0xe4, 0x08, 0xa3, 0x47, + 0xea, 0x23, 0xb9, 0x81, 0xfa, 0xf7, 0xc0, 0xe4, 0x78, 0xd3, 0xe4, 0x87, 0xeb, 0x18, 0x27, 0x7f, + 0x8b, 0xb2, 0x78, 0x56, 0x89, 0x5c, 0xc1, 0x5e, 0x9e, 0x99, 0x98, 0x9b, 0x2d, 0xeb, 0xeb, 0x19, + 0x87, 0xbf, 0xf2, 0x2b, 0xb7, 0xf3, 0xd6, 0xdb, 0xd2, 0xd4, 0xde, 0x97, 0xa6, 0xf6, 0xb1, 0x34, + 0xb5, 0x97, 0x4f, 0xb3, 0x34, 0xd9, 0x55, 0xbf, 0xe4, 0xec, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xdb, + 0xda, 0x4f, 0x99, 0x7c, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// SonicJwtServiceClient is the client API for SonicJwtService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SonicJwtServiceClient interface { + Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) + Refresh(ctx context.Context, in *RefreshRequest, opts ...grpc.CallOption) (*RefreshResponse, error) +} + +type sonicJwtServiceClient struct { + cc *grpc.ClientConn +} + +func NewSonicJwtServiceClient(cc *grpc.ClientConn) SonicJwtServiceClient { + return &sonicJwtServiceClient{cc} +} + +func (c *sonicJwtServiceClient) Authenticate(ctx context.Context, in *AuthenticateRequest, opts ...grpc.CallOption) (*AuthenticateResponse, error) { + out := new(AuthenticateResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic_jwt.SonicJwtService/Authenticate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sonicJwtServiceClient) Refresh(ctx context.Context, in *RefreshRequest, opts ...grpc.CallOption) (*RefreshResponse, error) { + out := new(RefreshResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic_jwt.SonicJwtService/Refresh", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SonicJwtServiceServer is the server API for SonicJwtService service. +type SonicJwtServiceServer interface { + Authenticate(context.Context, *AuthenticateRequest) (*AuthenticateResponse, error) + Refresh(context.Context, *RefreshRequest) (*RefreshResponse, error) +} + +// UnimplementedSonicJwtServiceServer can be embedded to have forward compatible implementations. +type UnimplementedSonicJwtServiceServer struct { +} + +func (*UnimplementedSonicJwtServiceServer) Authenticate(ctx context.Context, req *AuthenticateRequest) (*AuthenticateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Authenticate not implemented") +} +func (*UnimplementedSonicJwtServiceServer) Refresh(ctx context.Context, req *RefreshRequest) (*RefreshResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Refresh not implemented") +} + +func RegisterSonicJwtServiceServer(s *grpc.Server, srv SonicJwtServiceServer) { + s.RegisterService(&_SonicJwtService_serviceDesc, srv) +} + +func _SonicJwtService_Authenticate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AuthenticateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicJwtServiceServer).Authenticate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic_jwt.SonicJwtService/Authenticate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicJwtServiceServer).Authenticate(ctx, req.(*AuthenticateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SonicJwtService_Refresh_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RefreshRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicJwtServiceServer).Refresh(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic_jwt.SonicJwtService/Refresh", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicJwtServiceServer).Refresh(ctx, req.(*RefreshRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _SonicJwtService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.sonic_jwt.SonicJwtService", + HandlerType: (*SonicJwtServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Authenticate", + Handler: _SonicJwtService_Authenticate_Handler, + }, + { + MethodName: "Refresh", + Handler: _SonicJwtService_Refresh_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "sonic_gnoi_jwt.proto", +} + +func (m *JwtToken) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *JwtToken) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *JwtToken) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.ExpiresIn != 0 { + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(m.ExpiresIn)) + i-- + dAtA[i] = 0x18 + } + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0x12 + } + if len(m.AccessToken) > 0 { + i -= len(m.AccessToken) + copy(dAtA[i:], m.AccessToken) + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(len(m.AccessToken))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuthenticateRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AuthenticateRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthenticateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Password) > 0 { + i -= len(m.Password) + copy(dAtA[i:], m.Password) + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(len(m.Password))) + i-- + dAtA[i] = 0x12 + } + if len(m.Username) > 0 { + i -= len(m.Username) + copy(dAtA[i:], m.Username) + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(len(m.Username))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AuthenticateResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AuthenticateResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *AuthenticateResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *RefreshRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RefreshRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RefreshRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + return len(dAtA) - i, nil +} + +func (m *RefreshResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RefreshResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RefreshResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Token != nil { + { + size, err := m.Token.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoiJwt(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSonicGnoiJwt(dAtA []byte, offset int, v uint64) int { + offset -= sovSonicGnoiJwt(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *JwtToken) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.AccessToken) + if l > 0 { + n += 1 + l + sovSonicGnoiJwt(uint64(l)) + } + l = len(m.Type) + if l > 0 { + n += 1 + l + sovSonicGnoiJwt(uint64(l)) + } + if m.ExpiresIn != 0 { + n += 1 + sovSonicGnoiJwt(uint64(m.ExpiresIn)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AuthenticateRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Username) + if l > 0 { + n += 1 + l + sovSonicGnoiJwt(uint64(l)) + } + l = len(m.Password) + if l > 0 { + n += 1 + l + sovSonicGnoiJwt(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *AuthenticateResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovSonicGnoiJwt(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RefreshRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *RefreshResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Token != nil { + l = m.Token.Size() + n += 1 + l + sovSonicGnoiJwt(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSonicGnoiJwt(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSonicGnoiJwt(x uint64) (n int) { + return sovSonicGnoiJwt(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *JwtToken) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: JwtToken: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: JwtToken: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AccessToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccessToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Type = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ExpiresIn", wireType) + } + m.ExpiresIn = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ExpiresIn |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipSonicGnoiJwt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AuthenticateRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AuthenticateRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuthenticateRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Username = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Password = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoiJwt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AuthenticateResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AuthenticateResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuthenticateResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &JwtToken{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoiJwt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RefreshRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RefreshRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RefreshRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipSonicGnoiJwt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *RefreshResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RefreshResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RefreshResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Token", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Token == nil { + m.Token = &JwtToken{} + } + if err := m.Token.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoiJwt(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoiJwt + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSonicGnoiJwt(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSonicGnoiJwt + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSonicGnoiJwt + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSonicGnoiJwt + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSonicGnoiJwt + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSonicGnoiJwt = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSonicGnoiJwt = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSonicGnoiJwt = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/gnoi/jwt/sonic_gnoi_jwt.proto b/proto/gnoi/jwt/sonic_gnoi_jwt.proto new file mode 100644 index 000000000..a03f9ad70 --- /dev/null +++ b/proto/gnoi/jwt/sonic_gnoi_jwt.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; + +package gnoi.sonic_jwt; + +//option (types.gnoi_version) = "0.1.0"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; + +service SonicJwtService { + rpc Authenticate(AuthenticateRequest) returns (AuthenticateResponse) {} + rpc Refresh(RefreshRequest) returns (RefreshResponse) {} +} + +message JwtToken { + string access_token = 1; + string type = 2; + int64 expires_in = 3; +} +message AuthenticateRequest { + string username = 1; + string password = 2; +} + +message AuthenticateResponse { + JwtToken Token = 1; +} + +message RefreshRequest { +} + +message RefreshResponse { + JwtToken Token = 1; +} diff --git a/proto/gnoi/sonic_gnoi.pb.go b/proto/gnoi/sonic_gnoi.pb.go new file mode 100644 index 000000000..80f1f5093 --- /dev/null +++ b/proto/gnoi/sonic_gnoi.pb.go @@ -0,0 +1,4694 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: sonic_gnoi.proto + +package gnoi_sonic + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +type SonicOutput struct { + Status int32 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"` + StatusDetail string `protobuf:"bytes,2,opt,name=status_detail,json=statusDetail,proto3" json:"status-detail" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SonicOutput) Reset() { *m = SonicOutput{} } +func (m *SonicOutput) String() string { return proto.CompactTextString(m) } +func (*SonicOutput) ProtoMessage() {} +func (*SonicOutput) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{0} +} +func (m *SonicOutput) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *SonicOutput) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_SonicOutput.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *SonicOutput) XXX_Merge(src proto.Message) { + xxx_messageInfo_SonicOutput.Merge(m, src) +} +func (m *SonicOutput) XXX_Size() int { + return m.Size() +} +func (m *SonicOutput) XXX_DiscardUnknown() { + xxx_messageInfo_SonicOutput.DiscardUnknown(m) +} + +var xxx_messageInfo_SonicOutput proto.InternalMessageInfo + +func (m *SonicOutput) GetStatus() int32 { + if m != nil { + return m.Status + } + return 0 +} + +func (m *SonicOutput) GetStatusDetail() string { + if m != nil { + return m.StatusDetail + } + return "" +} + +type TechsupportRequest struct { + Input *TechsupportRequest_Input `protobuf:"bytes,1,opt,name=input,proto3" json:"sonic-show-techsupport:input" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TechsupportRequest) Reset() { *m = TechsupportRequest{} } +func (m *TechsupportRequest) String() string { return proto.CompactTextString(m) } +func (*TechsupportRequest) ProtoMessage() {} +func (*TechsupportRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{1} +} +func (m *TechsupportRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TechsupportRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TechsupportRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TechsupportRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_TechsupportRequest.Merge(m, src) +} +func (m *TechsupportRequest) XXX_Size() int { + return m.Size() +} +func (m *TechsupportRequest) XXX_DiscardUnknown() { + xxx_messageInfo_TechsupportRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_TechsupportRequest proto.InternalMessageInfo + +func (m *TechsupportRequest) GetInput() *TechsupportRequest_Input { + if m != nil { + return m.Input + } + return nil +} + +type TechsupportRequest_Input struct { + Date string `protobuf:"bytes,1,opt,name=date,proto3" json:"date,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TechsupportRequest_Input) Reset() { *m = TechsupportRequest_Input{} } +func (m *TechsupportRequest_Input) String() string { return proto.CompactTextString(m) } +func (*TechsupportRequest_Input) ProtoMessage() {} +func (*TechsupportRequest_Input) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{1, 0} +} +func (m *TechsupportRequest_Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TechsupportRequest_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TechsupportRequest_Input.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TechsupportRequest_Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_TechsupportRequest_Input.Merge(m, src) +} +func (m *TechsupportRequest_Input) XXX_Size() int { + return m.Size() +} +func (m *TechsupportRequest_Input) XXX_DiscardUnknown() { + xxx_messageInfo_TechsupportRequest_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_TechsupportRequest_Input proto.InternalMessageInfo + +func (m *TechsupportRequest_Input) GetDate() string { + if m != nil { + return m.Date + } + return "" +} + +type TechsupportResponse struct { + Output *TechsupportResponse_Output `protobuf:"bytes,1,opt,name=output,proto3" json:"sonic-show-techsupport:output" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TechsupportResponse) Reset() { *m = TechsupportResponse{} } +func (m *TechsupportResponse) String() string { return proto.CompactTextString(m) } +func (*TechsupportResponse) ProtoMessage() {} +func (*TechsupportResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{2} +} +func (m *TechsupportResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TechsupportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TechsupportResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TechsupportResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_TechsupportResponse.Merge(m, src) +} +func (m *TechsupportResponse) XXX_Size() int { + return m.Size() +} +func (m *TechsupportResponse) XXX_DiscardUnknown() { + xxx_messageInfo_TechsupportResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_TechsupportResponse proto.InternalMessageInfo + +func (m *TechsupportResponse) GetOutput() *TechsupportResponse_Output { + if m != nil { + return m.Output + } + return nil +} + +type TechsupportResponse_Output struct { + OutputFilename string `protobuf:"bytes,1,opt,name=output_filename,json=outputFilename,proto3" json:"output-filename" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TechsupportResponse_Output) Reset() { *m = TechsupportResponse_Output{} } +func (m *TechsupportResponse_Output) String() string { return proto.CompactTextString(m) } +func (*TechsupportResponse_Output) ProtoMessage() {} +func (*TechsupportResponse_Output) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{2, 0} +} +func (m *TechsupportResponse_Output) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TechsupportResponse_Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TechsupportResponse_Output.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TechsupportResponse_Output) XXX_Merge(src proto.Message) { + xxx_messageInfo_TechsupportResponse_Output.Merge(m, src) +} +func (m *TechsupportResponse_Output) XXX_Size() int { + return m.Size() +} +func (m *TechsupportResponse_Output) XXX_DiscardUnknown() { + xxx_messageInfo_TechsupportResponse_Output.DiscardUnknown(m) +} + +var xxx_messageInfo_TechsupportResponse_Output proto.InternalMessageInfo + +func (m *TechsupportResponse_Output) GetOutputFilename() string { + if m != nil { + return m.OutputFilename + } + return "" +} + +type ClearNeighborsRequest struct { + Input *ClearNeighborsRequest_Input `protobuf:"bytes,1,opt,name=input,proto3" json:"sonic-neighbor:input" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClearNeighborsRequest) Reset() { *m = ClearNeighborsRequest{} } +func (m *ClearNeighborsRequest) String() string { return proto.CompactTextString(m) } +func (*ClearNeighborsRequest) ProtoMessage() {} +func (*ClearNeighborsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{3} +} +func (m *ClearNeighborsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClearNeighborsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClearNeighborsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClearNeighborsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClearNeighborsRequest.Merge(m, src) +} +func (m *ClearNeighborsRequest) XXX_Size() int { + return m.Size() +} +func (m *ClearNeighborsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ClearNeighborsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ClearNeighborsRequest proto.InternalMessageInfo + +func (m *ClearNeighborsRequest) GetInput() *ClearNeighborsRequest_Input { + if m != nil { + return m.Input + } + return nil +} + +type ClearNeighborsRequest_Input struct { + Force bool `protobuf:"varint,1,opt,name=force,proto3" json:"force,omitempty"` + Family string `protobuf:"bytes,2,opt,name=family,proto3" json:"family,omitempty"` + Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` + Ifname string `protobuf:"bytes,4,opt,name=ifname,proto3" json:"ifname,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClearNeighborsRequest_Input) Reset() { *m = ClearNeighborsRequest_Input{} } +func (m *ClearNeighborsRequest_Input) String() string { return proto.CompactTextString(m) } +func (*ClearNeighborsRequest_Input) ProtoMessage() {} +func (*ClearNeighborsRequest_Input) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{3, 0} +} +func (m *ClearNeighborsRequest_Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClearNeighborsRequest_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClearNeighborsRequest_Input.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClearNeighborsRequest_Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClearNeighborsRequest_Input.Merge(m, src) +} +func (m *ClearNeighborsRequest_Input) XXX_Size() int { + return m.Size() +} +func (m *ClearNeighborsRequest_Input) XXX_DiscardUnknown() { + xxx_messageInfo_ClearNeighborsRequest_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_ClearNeighborsRequest_Input proto.InternalMessageInfo + +func (m *ClearNeighborsRequest_Input) GetForce() bool { + if m != nil { + return m.Force + } + return false +} + +func (m *ClearNeighborsRequest_Input) GetFamily() string { + if m != nil { + return m.Family + } + return "" +} + +func (m *ClearNeighborsRequest_Input) GetIp() string { + if m != nil { + return m.Ip + } + return "" +} + +func (m *ClearNeighborsRequest_Input) GetIfname() string { + if m != nil { + return m.Ifname + } + return "" +} + +type ClearNeighborsResponse struct { + Output *ClearNeighborsResponse_Output `protobuf:"bytes,1,opt,name=output,proto3" json:"sonic-neighbor:output" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClearNeighborsResponse) Reset() { *m = ClearNeighborsResponse{} } +func (m *ClearNeighborsResponse) String() string { return proto.CompactTextString(m) } +func (*ClearNeighborsResponse) ProtoMessage() {} +func (*ClearNeighborsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{4} +} +func (m *ClearNeighborsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClearNeighborsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClearNeighborsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClearNeighborsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClearNeighborsResponse.Merge(m, src) +} +func (m *ClearNeighborsResponse) XXX_Size() int { + return m.Size() +} +func (m *ClearNeighborsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ClearNeighborsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ClearNeighborsResponse proto.InternalMessageInfo + +func (m *ClearNeighborsResponse) GetOutput() *ClearNeighborsResponse_Output { + if m != nil { + return m.Output + } + return nil +} + +type ClearNeighborsResponse_Output struct { + Response string `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ClearNeighborsResponse_Output) Reset() { *m = ClearNeighborsResponse_Output{} } +func (m *ClearNeighborsResponse_Output) String() string { return proto.CompactTextString(m) } +func (*ClearNeighborsResponse_Output) ProtoMessage() {} +func (*ClearNeighborsResponse_Output) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{4, 0} +} +func (m *ClearNeighborsResponse_Output) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ClearNeighborsResponse_Output) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ClearNeighborsResponse_Output.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ClearNeighborsResponse_Output) XXX_Merge(src proto.Message) { + xxx_messageInfo_ClearNeighborsResponse_Output.Merge(m, src) +} +func (m *ClearNeighborsResponse_Output) XXX_Size() int { + return m.Size() +} +func (m *ClearNeighborsResponse_Output) XXX_DiscardUnknown() { + xxx_messageInfo_ClearNeighborsResponse_Output.DiscardUnknown(m) +} + +var xxx_messageInfo_ClearNeighborsResponse_Output proto.InternalMessageInfo + +func (m *ClearNeighborsResponse_Output) GetResponse() string { + if m != nil { + return m.Response + } + return "" +} + +type CopyConfigRequest struct { + Input *CopyConfigRequest_Input `protobuf:"bytes,1,opt,name=input,proto3" json:"sonic-config-mgmt:input" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CopyConfigRequest) Reset() { *m = CopyConfigRequest{} } +func (m *CopyConfigRequest) String() string { return proto.CompactTextString(m) } +func (*CopyConfigRequest) ProtoMessage() {} +func (*CopyConfigRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{5} +} +func (m *CopyConfigRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CopyConfigRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CopyConfigRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CopyConfigRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CopyConfigRequest.Merge(m, src) +} +func (m *CopyConfigRequest) XXX_Size() int { + return m.Size() +} +func (m *CopyConfigRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CopyConfigRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CopyConfigRequest proto.InternalMessageInfo + +func (m *CopyConfigRequest) GetInput() *CopyConfigRequest_Input { + if m != nil { + return m.Input + } + return nil +} + +type CopyConfigRequest_Input struct { + Source string `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"` + Overwrite bool `protobuf:"varint,2,opt,name=overwrite,proto3" json:"overwrite,omitempty"` + Destination string `protobuf:"bytes,3,opt,name=destination,proto3" json:"destination,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CopyConfigRequest_Input) Reset() { *m = CopyConfigRequest_Input{} } +func (m *CopyConfigRequest_Input) String() string { return proto.CompactTextString(m) } +func (*CopyConfigRequest_Input) ProtoMessage() {} +func (*CopyConfigRequest_Input) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{5, 0} +} +func (m *CopyConfigRequest_Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CopyConfigRequest_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CopyConfigRequest_Input.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CopyConfigRequest_Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_CopyConfigRequest_Input.Merge(m, src) +} +func (m *CopyConfigRequest_Input) XXX_Size() int { + return m.Size() +} +func (m *CopyConfigRequest_Input) XXX_DiscardUnknown() { + xxx_messageInfo_CopyConfigRequest_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_CopyConfigRequest_Input proto.InternalMessageInfo + +func (m *CopyConfigRequest_Input) GetSource() string { + if m != nil { + return m.Source + } + return "" +} + +func (m *CopyConfigRequest_Input) GetOverwrite() bool { + if m != nil { + return m.Overwrite + } + return false +} + +func (m *CopyConfigRequest_Input) GetDestination() string { + if m != nil { + return m.Destination + } + return "" +} + +type CopyConfigResponse struct { + Output *SonicOutput `protobuf:"bytes,1,opt,name=output,proto3" json:"sonic-config-mgmt:output" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CopyConfigResponse) Reset() { *m = CopyConfigResponse{} } +func (m *CopyConfigResponse) String() string { return proto.CompactTextString(m) } +func (*CopyConfigResponse) ProtoMessage() {} +func (*CopyConfigResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{6} +} +func (m *CopyConfigResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CopyConfigResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CopyConfigResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CopyConfigResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CopyConfigResponse.Merge(m, src) +} +func (m *CopyConfigResponse) XXX_Size() int { + return m.Size() +} +func (m *CopyConfigResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CopyConfigResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CopyConfigResponse proto.InternalMessageInfo + +func (m *CopyConfigResponse) GetOutput() *SonicOutput { + if m != nil { + return m.Output + } + return nil +} + +type ImageInstallRequest struct { + Input *ImageInstallRequest_Input `protobuf:"bytes,1,opt,name=input,proto3" json:"sonic-image-management:input" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageInstallRequest) Reset() { *m = ImageInstallRequest{} } +func (m *ImageInstallRequest) String() string { return proto.CompactTextString(m) } +func (*ImageInstallRequest) ProtoMessage() {} +func (*ImageInstallRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{7} +} +func (m *ImageInstallRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageInstallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageInstallRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageInstallRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageInstallRequest.Merge(m, src) +} +func (m *ImageInstallRequest) XXX_Size() int { + return m.Size() +} +func (m *ImageInstallRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImageInstallRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageInstallRequest proto.InternalMessageInfo + +func (m *ImageInstallRequest) GetInput() *ImageInstallRequest_Input { + if m != nil { + return m.Input + } + return nil +} + +type ImageInstallRequest_Input struct { + Imagename string `protobuf:"bytes,2,opt,name=imagename,proto3" json:"imagename,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageInstallRequest_Input) Reset() { *m = ImageInstallRequest_Input{} } +func (m *ImageInstallRequest_Input) String() string { return proto.CompactTextString(m) } +func (*ImageInstallRequest_Input) ProtoMessage() {} +func (*ImageInstallRequest_Input) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{7, 0} +} +func (m *ImageInstallRequest_Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageInstallRequest_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageInstallRequest_Input.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageInstallRequest_Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageInstallRequest_Input.Merge(m, src) +} +func (m *ImageInstallRequest_Input) XXX_Size() int { + return m.Size() +} +func (m *ImageInstallRequest_Input) XXX_DiscardUnknown() { + xxx_messageInfo_ImageInstallRequest_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageInstallRequest_Input proto.InternalMessageInfo + +func (m *ImageInstallRequest_Input) GetImagename() string { + if m != nil { + return m.Imagename + } + return "" +} + +type ImageInstallResponse struct { + Output *SonicOutput `protobuf:"bytes,1,opt,name=output,proto3" json:"sonic-image-management:output" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageInstallResponse) Reset() { *m = ImageInstallResponse{} } +func (m *ImageInstallResponse) String() string { return proto.CompactTextString(m) } +func (*ImageInstallResponse) ProtoMessage() {} +func (*ImageInstallResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{8} +} +func (m *ImageInstallResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageInstallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageInstallResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageInstallResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageInstallResponse.Merge(m, src) +} +func (m *ImageInstallResponse) XXX_Size() int { + return m.Size() +} +func (m *ImageInstallResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImageInstallResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageInstallResponse proto.InternalMessageInfo + +func (m *ImageInstallResponse) GetOutput() *SonicOutput { + if m != nil { + return m.Output + } + return nil +} + +type ImageRemoveRequest struct { + Input *ImageRemoveRequest_Input `protobuf:"bytes,1,opt,name=input,proto3" json:"sonic-image-management:input" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageRemoveRequest) Reset() { *m = ImageRemoveRequest{} } +func (m *ImageRemoveRequest) String() string { return proto.CompactTextString(m) } +func (*ImageRemoveRequest) ProtoMessage() {} +func (*ImageRemoveRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{9} +} +func (m *ImageRemoveRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageRemoveRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageRemoveRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageRemoveRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageRemoveRequest.Merge(m, src) +} +func (m *ImageRemoveRequest) XXX_Size() int { + return m.Size() +} +func (m *ImageRemoveRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImageRemoveRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageRemoveRequest proto.InternalMessageInfo + +func (m *ImageRemoveRequest) GetInput() *ImageRemoveRequest_Input { + if m != nil { + return m.Input + } + return nil +} + +type ImageRemoveRequest_Input struct { + Imagename string `protobuf:"bytes,1,opt,name=imagename,proto3" json:"imagename,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageRemoveRequest_Input) Reset() { *m = ImageRemoveRequest_Input{} } +func (m *ImageRemoveRequest_Input) String() string { return proto.CompactTextString(m) } +func (*ImageRemoveRequest_Input) ProtoMessage() {} +func (*ImageRemoveRequest_Input) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{9, 0} +} +func (m *ImageRemoveRequest_Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageRemoveRequest_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageRemoveRequest_Input.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageRemoveRequest_Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageRemoveRequest_Input.Merge(m, src) +} +func (m *ImageRemoveRequest_Input) XXX_Size() int { + return m.Size() +} +func (m *ImageRemoveRequest_Input) XXX_DiscardUnknown() { + xxx_messageInfo_ImageRemoveRequest_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageRemoveRequest_Input proto.InternalMessageInfo + +func (m *ImageRemoveRequest_Input) GetImagename() string { + if m != nil { + return m.Imagename + } + return "" +} + +type ImageRemoveResponse struct { + Output *SonicOutput `protobuf:"bytes,1,opt,name=output,proto3" json:"sonic-image-management:output" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageRemoveResponse) Reset() { *m = ImageRemoveResponse{} } +func (m *ImageRemoveResponse) String() string { return proto.CompactTextString(m) } +func (*ImageRemoveResponse) ProtoMessage() {} +func (*ImageRemoveResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{10} +} +func (m *ImageRemoveResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageRemoveResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageRemoveResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageRemoveResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageRemoveResponse.Merge(m, src) +} +func (m *ImageRemoveResponse) XXX_Size() int { + return m.Size() +} +func (m *ImageRemoveResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImageRemoveResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageRemoveResponse proto.InternalMessageInfo + +func (m *ImageRemoveResponse) GetOutput() *SonicOutput { + if m != nil { + return m.Output + } + return nil +} + +type ImageDefaultRequest struct { + Input *ImageDefaultRequest_Input `protobuf:"bytes,1,opt,name=input,proto3" json:"sonic-image-management:input" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageDefaultRequest) Reset() { *m = ImageDefaultRequest{} } +func (m *ImageDefaultRequest) String() string { return proto.CompactTextString(m) } +func (*ImageDefaultRequest) ProtoMessage() {} +func (*ImageDefaultRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{11} +} +func (m *ImageDefaultRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageDefaultRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageDefaultRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageDefaultRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageDefaultRequest.Merge(m, src) +} +func (m *ImageDefaultRequest) XXX_Size() int { + return m.Size() +} +func (m *ImageDefaultRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ImageDefaultRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageDefaultRequest proto.InternalMessageInfo + +func (m *ImageDefaultRequest) GetInput() *ImageDefaultRequest_Input { + if m != nil { + return m.Input + } + return nil +} + +type ImageDefaultRequest_Input struct { + Imagename string `protobuf:"bytes,1,opt,name=imagename,proto3" json:"imagename,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageDefaultRequest_Input) Reset() { *m = ImageDefaultRequest_Input{} } +func (m *ImageDefaultRequest_Input) String() string { return proto.CompactTextString(m) } +func (*ImageDefaultRequest_Input) ProtoMessage() {} +func (*ImageDefaultRequest_Input) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{11, 0} +} +func (m *ImageDefaultRequest_Input) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageDefaultRequest_Input) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageDefaultRequest_Input.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageDefaultRequest_Input) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageDefaultRequest_Input.Merge(m, src) +} +func (m *ImageDefaultRequest_Input) XXX_Size() int { + return m.Size() +} +func (m *ImageDefaultRequest_Input) XXX_DiscardUnknown() { + xxx_messageInfo_ImageDefaultRequest_Input.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageDefaultRequest_Input proto.InternalMessageInfo + +func (m *ImageDefaultRequest_Input) GetImagename() string { + if m != nil { + return m.Imagename + } + return "" +} + +type ImageDefaultResponse struct { + Output *SonicOutput `protobuf:"bytes,1,opt,name=output,proto3" json:"sonic-image-management:output" xml:",comment"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ImageDefaultResponse) Reset() { *m = ImageDefaultResponse{} } +func (m *ImageDefaultResponse) String() string { return proto.CompactTextString(m) } +func (*ImageDefaultResponse) ProtoMessage() {} +func (*ImageDefaultResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_75b35b752d70e98f, []int{12} +} +func (m *ImageDefaultResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ImageDefaultResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ImageDefaultResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ImageDefaultResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ImageDefaultResponse.Merge(m, src) +} +func (m *ImageDefaultResponse) XXX_Size() int { + return m.Size() +} +func (m *ImageDefaultResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ImageDefaultResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ImageDefaultResponse proto.InternalMessageInfo + +func (m *ImageDefaultResponse) GetOutput() *SonicOutput { + if m != nil { + return m.Output + } + return nil +} + +func init() { + proto.RegisterType((*SonicOutput)(nil), "gnoi.sonic.SonicOutput") + proto.RegisterType((*TechsupportRequest)(nil), "gnoi.sonic.TechsupportRequest") + proto.RegisterType((*TechsupportRequest_Input)(nil), "gnoi.sonic.TechsupportRequest.Input") + proto.RegisterType((*TechsupportResponse)(nil), "gnoi.sonic.TechsupportResponse") + proto.RegisterType((*TechsupportResponse_Output)(nil), "gnoi.sonic.TechsupportResponse.Output") + proto.RegisterType((*ClearNeighborsRequest)(nil), "gnoi.sonic.ClearNeighborsRequest") + proto.RegisterType((*ClearNeighborsRequest_Input)(nil), "gnoi.sonic.ClearNeighborsRequest.Input") + proto.RegisterType((*ClearNeighborsResponse)(nil), "gnoi.sonic.ClearNeighborsResponse") + proto.RegisterType((*ClearNeighborsResponse_Output)(nil), "gnoi.sonic.ClearNeighborsResponse.Output") + proto.RegisterType((*CopyConfigRequest)(nil), "gnoi.sonic.CopyConfigRequest") + proto.RegisterType((*CopyConfigRequest_Input)(nil), "gnoi.sonic.CopyConfigRequest.Input") + proto.RegisterType((*CopyConfigResponse)(nil), "gnoi.sonic.CopyConfigResponse") + proto.RegisterType((*ImageInstallRequest)(nil), "gnoi.sonic.ImageInstallRequest") + proto.RegisterType((*ImageInstallRequest_Input)(nil), "gnoi.sonic.ImageInstallRequest.Input") + proto.RegisterType((*ImageInstallResponse)(nil), "gnoi.sonic.ImageInstallResponse") + proto.RegisterType((*ImageRemoveRequest)(nil), "gnoi.sonic.ImageRemoveRequest") + proto.RegisterType((*ImageRemoveRequest_Input)(nil), "gnoi.sonic.ImageRemoveRequest.Input") + proto.RegisterType((*ImageRemoveResponse)(nil), "gnoi.sonic.ImageRemoveResponse") + proto.RegisterType((*ImageDefaultRequest)(nil), "gnoi.sonic.ImageDefaultRequest") + proto.RegisterType((*ImageDefaultRequest_Input)(nil), "gnoi.sonic.ImageDefaultRequest.Input") + proto.RegisterType((*ImageDefaultResponse)(nil), "gnoi.sonic.ImageDefaultResponse") +} + +func init() { proto.RegisterFile("sonic_gnoi.proto", fileDescriptor_75b35b752d70e98f) } + +var fileDescriptor_75b35b752d70e98f = []byte{ + // 838 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcb, 0x6e, 0xf3, 0x44, + 0x14, 0x8e, 0x4b, 0x13, 0x35, 0x27, 0x25, 0x7f, 0x99, 0xde, 0x22, 0xd3, 0xc6, 0xc1, 0x6d, 0xa1, + 0x5c, 0x9c, 0x4a, 0xed, 0xae, 0xcb, 0xb4, 0x42, 0x74, 0x41, 0x41, 0x4e, 0x17, 0xb0, 0x40, 0x91, + 0x93, 0x4c, 0x9c, 0x91, 0x6c, 0x8f, 0xb1, 0xc7, 0x2d, 0x15, 0x3c, 0x01, 0x4f, 0xc0, 0x96, 0x35, + 0x82, 0xe7, 0x60, 0xc9, 0x13, 0x58, 0x50, 0x58, 0x79, 0xc9, 0x13, 0xa0, 0xcc, 0x8c, 0x13, 0x3b, + 0x97, 0xba, 0x1b, 0xba, 0x9b, 0x99, 0xf3, 0xcd, 0xb9, 0x7c, 0xdf, 0xf1, 0x19, 0xc3, 0x56, 0x48, + 0x3d, 0x32, 0xe8, 0xd9, 0x1e, 0x25, 0x6d, 0x3f, 0xa0, 0x8c, 0x22, 0xe0, 0x6b, 0x7e, 0xac, 0x1a, + 0x36, 0x61, 0xe3, 0xa8, 0xdf, 0x1e, 0x50, 0xf7, 0xcc, 0xa6, 0x36, 0x3d, 0xe3, 0x90, 0x7e, 0x34, + 0xe2, 0x3b, 0xbe, 0xe1, 0x2b, 0x71, 0x55, 0xa7, 0x50, 0xeb, 0x4e, 0xee, 0x7d, 0x11, 0x31, 0x3f, + 0x62, 0x68, 0x0f, 0x2a, 0x21, 0xb3, 0x58, 0x14, 0x36, 0x94, 0x96, 0x72, 0x5a, 0x36, 0xe5, 0x0e, + 0x7d, 0x06, 0x6f, 0x8b, 0x55, 0x6f, 0x88, 0x99, 0x45, 0x9c, 0xc6, 0x5a, 0x4b, 0x39, 0xad, 0x76, + 0x8e, 0x92, 0x58, 0x93, 0x06, 0x43, 0x18, 0xfe, 0x8d, 0xb5, 0xfa, 0x77, 0xae, 0x73, 0xa9, 0x7f, + 0x32, 0xa0, 0xae, 0x8b, 0x3d, 0xa6, 0x9b, 0x9b, 0x02, 0x70, 0xcd, 0xed, 0xfa, 0xcf, 0x0a, 0xa0, + 0x3b, 0x3c, 0x18, 0x87, 0x91, 0xef, 0xd3, 0x80, 0x99, 0xf8, 0xdb, 0x08, 0x87, 0x0c, 0x79, 0x50, + 0x26, 0x9e, 0x1f, 0x31, 0x1e, 0xb7, 0x76, 0x7e, 0xdc, 0x9e, 0x95, 0xd4, 0x5e, 0x84, 0xb7, 0x6f, + 0x26, 0xd8, 0xce, 0x79, 0x12, 0x6b, 0x07, 0x1c, 0x63, 0x84, 0x63, 0xfa, 0x60, 0xb0, 0x19, 0xf0, + 0x92, 0x7b, 0x5b, 0x92, 0x8d, 0x08, 0xa3, 0xbe, 0x0b, 0x65, 0xee, 0x03, 0x21, 0x58, 0x1f, 0x5a, + 0x0c, 0xf3, 0xb8, 0x55, 0x93, 0xaf, 0xf5, 0x7f, 0x14, 0xd8, 0xce, 0x05, 0x0d, 0x7d, 0xea, 0x85, + 0x18, 0x85, 0x50, 0xa1, 0x9c, 0x27, 0x99, 0xe5, 0xfb, 0x2b, 0xb3, 0x14, 0x17, 0xda, 0x82, 0xd5, + 0xce, 0x45, 0x12, 0x6b, 0x87, 0x2b, 0xf2, 0x14, 0x0e, 0x97, 0x24, 0x2a, 0x43, 0xa9, 0x5f, 0x41, + 0x45, 0x8a, 0x73, 0x0b, 0x6f, 0xc4, 0x59, 0x6f, 0x44, 0x1c, 0xec, 0x59, 0xae, 0xcc, 0xba, 0x73, + 0x92, 0xc4, 0x9a, 0x34, 0x19, 0xa9, 0x69, 0x89, 0xc7, 0xba, 0x80, 0x7c, 0x2a, 0x11, 0xfa, 0x5f, + 0x0a, 0xec, 0x5e, 0x39, 0xd8, 0x0a, 0x6e, 0x31, 0xb1, 0xc7, 0x7d, 0x1a, 0x84, 0xa9, 0x1a, 0x24, + 0xaf, 0xc6, 0x07, 0xd9, 0x3a, 0x97, 0xde, 0x90, 0x82, 0x7c, 0x94, 0xc4, 0xda, 0x8e, 0x28, 0xd4, + 0x93, 0x88, 0x22, 0x21, 0xbe, 0x49, 0x85, 0xd8, 0x81, 0xf2, 0x88, 0x06, 0x03, 0x51, 0xd3, 0x86, + 0x29, 0x36, 0x93, 0x86, 0x1c, 0x59, 0x2e, 0x71, 0x1e, 0x45, 0xc7, 0x99, 0x72, 0x87, 0xea, 0xb0, + 0x46, 0xfc, 0xc6, 0x5b, 0xfc, 0x6c, 0x8d, 0xf8, 0x13, 0x1c, 0x19, 0x71, 0x4a, 0xd6, 0x05, 0x4e, + 0xec, 0xf4, 0xdf, 0x14, 0xd8, 0x9b, 0xcf, 0x58, 0xaa, 0xe9, 0xcd, 0xa9, 0xf9, 0xe1, 0x73, 0x55, + 0xe6, 0x05, 0xfd, 0x38, 0x89, 0xb5, 0xdd, 0xb9, 0x3a, 0x0b, 0x85, 0x3c, 0x9e, 0x0a, 0xa9, 0xc2, + 0x46, 0x20, 0x3d, 0xca, 0xbe, 0x9b, 0xee, 0xf5, 0x58, 0x81, 0x77, 0xae, 0xa8, 0xff, 0x78, 0x45, + 0xbd, 0x11, 0xb1, 0x53, 0x41, 0xc6, 0x79, 0x41, 0x8e, 0x72, 0xa9, 0xce, 0xa3, 0xa5, 0x18, 0x46, + 0x12, 0x6b, 0xfb, 0x22, 0xc9, 0x01, 0x37, 0x1b, 0xae, 0xed, 0x16, 0x7e, 0x18, 0xbd, 0x54, 0x8f, + 0xc9, 0x28, 0xa0, 0x51, 0x2a, 0x48, 0xd5, 0x94, 0x3b, 0x74, 0x00, 0x55, 0x7a, 0x8f, 0x83, 0x87, + 0x80, 0x30, 0xcc, 0x45, 0xd9, 0x30, 0x67, 0x07, 0xa8, 0x05, 0xb5, 0x21, 0x0e, 0x19, 0xf1, 0x2c, + 0x46, 0xa8, 0x27, 0x05, 0xca, 0x1e, 0xe9, 0x11, 0xa0, 0x6c, 0xc6, 0x52, 0x8c, 0xde, 0x9c, 0x18, + 0xfb, 0xd9, 0x0a, 0x33, 0x13, 0xaa, 0xd3, 0x4e, 0x62, 0xad, 0xb1, 0x58, 0x55, 0x11, 0xfb, 0xfa, + 0xaf, 0x0a, 0x6c, 0xdf, 0xb8, 0x96, 0x8d, 0x6f, 0xbc, 0x90, 0x59, 0x8e, 0x93, 0x32, 0x4b, 0xf3, + 0xcc, 0x9e, 0x64, 0xe3, 0x2e, 0xc1, 0x2f, 0x4e, 0x1e, 0x32, 0x01, 0x19, 0xae, 0xe5, 0x59, 0x36, + 0x9e, 0x84, 0x2c, 0x22, 0xf8, 0x24, 0x25, 0xf8, 0x00, 0xaa, 0xfc, 0x2e, 0xef, 0x5a, 0xd1, 0xdd, + 0xb3, 0x03, 0xfd, 0x07, 0xd8, 0xc9, 0x87, 0x97, 0x44, 0x0d, 0x5f, 0x4a, 0x54, 0x66, 0xe8, 0x2c, + 0xa4, 0x58, 0xc8, 0xd6, 0x2f, 0x0a, 0x20, 0x1e, 0xde, 0xc4, 0x2e, 0xbd, 0xc7, 0x2f, 0x99, 0xd2, + 0x8b, 0xf0, 0xff, 0x8b, 0x2b, 0x65, 0x9e, 0xab, 0xef, 0xa5, 0xb4, 0x69, 0xf4, 0x57, 0xa5, 0x6a, + 0xda, 0x58, 0xd7, 0x78, 0x64, 0x45, 0x0e, 0x7b, 0x71, 0x63, 0xe5, 0xf1, 0xaf, 0x46, 0x56, 0xda, + 0x58, 0xd3, 0xf0, 0xaf, 0xc9, 0xd6, 0xf9, 0x8f, 0xeb, 0xb0, 0xc9, 0x9d, 0x75, 0x71, 0x70, 0x4f, + 0x06, 0x18, 0xdd, 0xc1, 0x9b, 0xee, 0x98, 0x3e, 0x64, 0x5e, 0x4f, 0xd4, 0x7c, 0xfe, 0xf1, 0x57, + 0xb5, 0x82, 0x67, 0x57, 0x2f, 0xa1, 0xcf, 0x01, 0x66, 0x43, 0x06, 0x1d, 0x3e, 0x3b, 0x2e, 0xd5, + 0xe6, 0x2a, 0xf3, 0xd4, 0x5d, 0x17, 0x36, 0xb3, 0x1f, 0x23, 0xd2, 0x0a, 0xa6, 0x84, 0xda, 0x5a, + 0x0d, 0x98, 0x3a, 0xfd, 0x12, 0x6a, 0x99, 0xae, 0xcd, 0x57, 0xbd, 0xf8, 0x31, 0xa9, 0xda, 0x4a, + 0xfb, 0x42, 0x9a, 0x52, 0xda, 0x25, 0x69, 0xe6, 0x7b, 0x6e, 0x49, 0x9a, 0x73, 0x5d, 0xa1, 0x97, + 0xd0, 0xd7, 0x50, 0xcf, 0x3f, 0x86, 0xe8, 0xbd, 0xc2, 0xdf, 0x01, 0x55, 0x2f, 0x7e, 0x4b, 0xf5, + 0x52, 0x67, 0xeb, 0xf7, 0xa7, 0xa6, 0xf2, 0xc7, 0x53, 0x53, 0xf9, 0xf3, 0xa9, 0xa9, 0xfc, 0xf4, + 0x77, 0xb3, 0xd4, 0xaf, 0xf0, 0xbf, 0xd2, 0x8b, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x5c, + 0x3f, 0x62, 0xe4, 0x0a, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// SonicServiceClient is the client API for SonicService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SonicServiceClient interface { + ShowTechsupport(ctx context.Context, in *TechsupportRequest, opts ...grpc.CallOption) (*TechsupportResponse, error) + CopyConfig(ctx context.Context, in *CopyConfigRequest, opts ...grpc.CallOption) (*CopyConfigResponse, error) + ImageInstall(ctx context.Context, in *ImageInstallRequest, opts ...grpc.CallOption) (*ImageInstallResponse, error) + ImageRemove(ctx context.Context, in *ImageRemoveRequest, opts ...grpc.CallOption) (*ImageRemoveResponse, error) + ImageDefault(ctx context.Context, in *ImageDefaultRequest, opts ...grpc.CallOption) (*ImageDefaultResponse, error) + ClearNeighbors(ctx context.Context, in *ClearNeighborsRequest, opts ...grpc.CallOption) (*ClearNeighborsResponse, error) +} + +type sonicServiceClient struct { + cc *grpc.ClientConn +} + +func NewSonicServiceClient(cc *grpc.ClientConn) SonicServiceClient { + return &sonicServiceClient{cc} +} + +func (c *sonicServiceClient) ShowTechsupport(ctx context.Context, in *TechsupportRequest, opts ...grpc.CallOption) (*TechsupportResponse, error) { + out := new(TechsupportResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic.SonicService/ShowTechsupport", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sonicServiceClient) CopyConfig(ctx context.Context, in *CopyConfigRequest, opts ...grpc.CallOption) (*CopyConfigResponse, error) { + out := new(CopyConfigResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic.SonicService/CopyConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sonicServiceClient) ImageInstall(ctx context.Context, in *ImageInstallRequest, opts ...grpc.CallOption) (*ImageInstallResponse, error) { + out := new(ImageInstallResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic.SonicService/ImageInstall", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sonicServiceClient) ImageRemove(ctx context.Context, in *ImageRemoveRequest, opts ...grpc.CallOption) (*ImageRemoveResponse, error) { + out := new(ImageRemoveResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic.SonicService/ImageRemove", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sonicServiceClient) ImageDefault(ctx context.Context, in *ImageDefaultRequest, opts ...grpc.CallOption) (*ImageDefaultResponse, error) { + out := new(ImageDefaultResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic.SonicService/ImageDefault", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sonicServiceClient) ClearNeighbors(ctx context.Context, in *ClearNeighborsRequest, opts ...grpc.CallOption) (*ClearNeighborsResponse, error) { + out := new(ClearNeighborsResponse) + err := c.cc.Invoke(ctx, "/gnoi.sonic.SonicService/ClearNeighbors", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SonicServiceServer is the server API for SonicService service. +type SonicServiceServer interface { + ShowTechsupport(context.Context, *TechsupportRequest) (*TechsupportResponse, error) + CopyConfig(context.Context, *CopyConfigRequest) (*CopyConfigResponse, error) + ImageInstall(context.Context, *ImageInstallRequest) (*ImageInstallResponse, error) + ImageRemove(context.Context, *ImageRemoveRequest) (*ImageRemoveResponse, error) + ImageDefault(context.Context, *ImageDefaultRequest) (*ImageDefaultResponse, error) + ClearNeighbors(context.Context, *ClearNeighborsRequest) (*ClearNeighborsResponse, error) +} + +// UnimplementedSonicServiceServer can be embedded to have forward compatible implementations. +type UnimplementedSonicServiceServer struct { +} + +func (*UnimplementedSonicServiceServer) ShowTechsupport(ctx context.Context, req *TechsupportRequest) (*TechsupportResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ShowTechsupport not implemented") +} +func (*UnimplementedSonicServiceServer) CopyConfig(ctx context.Context, req *CopyConfigRequest) (*CopyConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CopyConfig not implemented") +} +func (*UnimplementedSonicServiceServer) ImageInstall(ctx context.Context, req *ImageInstallRequest) (*ImageInstallResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImageInstall not implemented") +} +func (*UnimplementedSonicServiceServer) ImageRemove(ctx context.Context, req *ImageRemoveRequest) (*ImageRemoveResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImageRemove not implemented") +} +func (*UnimplementedSonicServiceServer) ImageDefault(ctx context.Context, req *ImageDefaultRequest) (*ImageDefaultResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ImageDefault not implemented") +} +func (*UnimplementedSonicServiceServer) ClearNeighbors(ctx context.Context, req *ClearNeighborsRequest) (*ClearNeighborsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearNeighbors not implemented") +} + +func RegisterSonicServiceServer(s *grpc.Server, srv SonicServiceServer) { + s.RegisterService(&_SonicService_serviceDesc, srv) +} + +func _SonicService_ShowTechsupport_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TechsupportRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicServiceServer).ShowTechsupport(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic.SonicService/ShowTechsupport", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicServiceServer).ShowTechsupport(ctx, req.(*TechsupportRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SonicService_CopyConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CopyConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicServiceServer).CopyConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic.SonicService/CopyConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicServiceServer).CopyConfig(ctx, req.(*CopyConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SonicService_ImageInstall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImageInstallRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicServiceServer).ImageInstall(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic.SonicService/ImageInstall", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicServiceServer).ImageInstall(ctx, req.(*ImageInstallRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SonicService_ImageRemove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImageRemoveRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicServiceServer).ImageRemove(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic.SonicService/ImageRemove", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicServiceServer).ImageRemove(ctx, req.(*ImageRemoveRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SonicService_ImageDefault_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ImageDefaultRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicServiceServer).ImageDefault(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic.SonicService/ImageDefault", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicServiceServer).ImageDefault(ctx, req.(*ImageDefaultRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SonicService_ClearNeighbors_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ClearNeighborsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SonicServiceServer).ClearNeighbors(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gnoi.sonic.SonicService/ClearNeighbors", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SonicServiceServer).ClearNeighbors(ctx, req.(*ClearNeighborsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _SonicService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "gnoi.sonic.SonicService", + HandlerType: (*SonicServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ShowTechsupport", + Handler: _SonicService_ShowTechsupport_Handler, + }, + { + MethodName: "CopyConfig", + Handler: _SonicService_CopyConfig_Handler, + }, + { + MethodName: "ImageInstall", + Handler: _SonicService_ImageInstall_Handler, + }, + { + MethodName: "ImageRemove", + Handler: _SonicService_ImageRemove_Handler, + }, + { + MethodName: "ImageDefault", + Handler: _SonicService_ImageDefault_Handler, + }, + { + MethodName: "ClearNeighbors", + Handler: _SonicService_ClearNeighbors_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "sonic_gnoi.proto", +} + +func (m *SonicOutput) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SonicOutput) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SonicOutput) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.StatusDetail) > 0 { + i -= len(m.StatusDetail) + copy(dAtA[i:], m.StatusDetail) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.StatusDetail))) + i-- + dAtA[i] = 0x12 + } + if m.Status != 0 { + i = encodeVarintSonicGnoi(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TechsupportRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TechsupportRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TechsupportRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TechsupportRequest_Input) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TechsupportRequest_Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TechsupportRequest_Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Date) > 0 { + i -= len(m.Date) + copy(dAtA[i:], m.Date) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Date))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TechsupportResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TechsupportResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TechsupportResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TechsupportResponse_Output) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TechsupportResponse_Output) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TechsupportResponse_Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.OutputFilename) > 0 { + i -= len(m.OutputFilename) + copy(dAtA[i:], m.OutputFilename) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.OutputFilename))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClearNeighborsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClearNeighborsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClearNeighborsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClearNeighborsRequest_Input) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClearNeighborsRequest_Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClearNeighborsRequest_Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Ifname) > 0 { + i -= len(m.Ifname) + copy(dAtA[i:], m.Ifname) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Ifname))) + i-- + dAtA[i] = 0x22 + } + if len(m.Ip) > 0 { + i -= len(m.Ip) + copy(dAtA[i:], m.Ip) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Ip))) + i-- + dAtA[i] = 0x1a + } + if len(m.Family) > 0 { + i -= len(m.Family) + copy(dAtA[i:], m.Family) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Family))) + i-- + dAtA[i] = 0x12 + } + if m.Force { + i-- + if m.Force { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ClearNeighborsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClearNeighborsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClearNeighborsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ClearNeighborsResponse_Output) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ClearNeighborsResponse_Output) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ClearNeighborsResponse_Output) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Response) > 0 { + i -= len(m.Response) + copy(dAtA[i:], m.Response) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Response))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CopyConfigRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CopyConfigRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CopyConfigRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CopyConfigRequest_Input) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CopyConfigRequest_Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CopyConfigRequest_Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Destination) > 0 { + i -= len(m.Destination) + copy(dAtA[i:], m.Destination) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Destination))) + i-- + dAtA[i] = 0x1a + } + if m.Overwrite { + i-- + if m.Overwrite { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *CopyConfigResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CopyConfigResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CopyConfigResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageInstallRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageInstallRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageInstallRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageInstallRequest_Input) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageInstallRequest_Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageInstallRequest_Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Imagename) > 0 { + i -= len(m.Imagename) + copy(dAtA[i:], m.Imagename) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Imagename))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + +func (m *ImageInstallResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageInstallResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageInstallResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageRemoveRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageRemoveRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageRemoveRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageRemoveRequest_Input) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageRemoveRequest_Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageRemoveRequest_Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Imagename) > 0 { + i -= len(m.Imagename) + copy(dAtA[i:], m.Imagename) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Imagename))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageRemoveResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageRemoveResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageRemoveResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageDefaultRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageDefaultRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageDefaultRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Input != nil { + { + size, err := m.Input.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageDefaultRequest_Input) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageDefaultRequest_Input) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageDefaultRequest_Input) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Imagename) > 0 { + i -= len(m.Imagename) + copy(dAtA[i:], m.Imagename) + i = encodeVarintSonicGnoi(dAtA, i, uint64(len(m.Imagename))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ImageDefaultResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageDefaultResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageDefaultResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Output != nil { + { + size, err := m.Output.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintSonicGnoi(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintSonicGnoi(dAtA []byte, offset int, v uint64) int { + offset -= sovSonicGnoi(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *SonicOutput) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Status != 0 { + n += 1 + sovSonicGnoi(uint64(m.Status)) + } + l = len(m.StatusDetail) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TechsupportRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Input != nil { + l = m.Input.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TechsupportRequest_Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Date) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TechsupportResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Output != nil { + l = m.Output.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *TechsupportResponse_Output) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.OutputFilename) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClearNeighborsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Input != nil { + l = m.Input.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClearNeighborsRequest_Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Force { + n += 2 + } + l = len(m.Family) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + l = len(m.Ip) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + l = len(m.Ifname) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClearNeighborsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Output != nil { + l = m.Output.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ClearNeighborsResponse_Output) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Response) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CopyConfigRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Input != nil { + l = m.Input.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CopyConfigRequest_Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Source) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.Overwrite { + n += 2 + } + l = len(m.Destination) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *CopyConfigResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Output != nil { + l = m.Output.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageInstallRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Input != nil { + l = m.Input.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageInstallRequest_Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Imagename) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageInstallResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Output != nil { + l = m.Output.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageRemoveRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Input != nil { + l = m.Input.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageRemoveRequest_Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Imagename) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageRemoveResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Output != nil { + l = m.Output.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageDefaultRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Input != nil { + l = m.Input.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageDefaultRequest_Input) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Imagename) + if l > 0 { + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func (m *ImageDefaultResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Output != nil { + l = m.Output.Size() + n += 1 + l + sovSonicGnoi(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovSonicGnoi(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozSonicGnoi(x uint64) (n int) { + return sovSonicGnoi(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *SonicOutput) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: SonicOutput: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: SonicOutput: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StatusDetail", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StatusDetail = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TechsupportRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TechsupportRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TechsupportRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Input == nil { + m.Input = &TechsupportRequest_Input{} + } + if err := m.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TechsupportRequest_Input) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Date", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Date = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TechsupportResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TechsupportResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TechsupportResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Output == nil { + m.Output = &TechsupportResponse_Output{} + } + if err := m.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TechsupportResponse_Output) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Output: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutputFilename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutputFilename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClearNeighborsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClearNeighborsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClearNeighborsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Input == nil { + m.Input = &ClearNeighborsRequest_Input{} + } + if err := m.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClearNeighborsRequest_Input) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Force", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Force = bool(v != 0) + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Family", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Family = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ip", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ip = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ifname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ifname = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClearNeighborsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ClearNeighborsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ClearNeighborsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Output == nil { + m.Output = &ClearNeighborsResponse_Output{} + } + if err := m.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ClearNeighborsResponse_Output) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Output: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Output: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Response", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Response = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CopyConfigRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CopyConfigRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CopyConfigRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Input == nil { + m.Input = &CopyConfigRequest_Input{} + } + if err := m.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CopyConfigRequest_Input) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Overwrite", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Overwrite = bool(v != 0) + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Destination = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *CopyConfigResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CopyConfigResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CopyConfigResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Output == nil { + m.Output = &SonicOutput{} + } + if err := m.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageInstallRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageInstallRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageInstallRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Input == nil { + m.Input = &ImageInstallRequest_Input{} + } + if err := m.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageInstallRequest_Input) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Imagename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Imagename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageInstallResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageInstallResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageInstallResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Output == nil { + m.Output = &SonicOutput{} + } + if err := m.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageRemoveRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageRemoveRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageRemoveRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Input == nil { + m.Input = &ImageRemoveRequest_Input{} + } + if err := m.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageRemoveRequest_Input) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Imagename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Imagename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageRemoveResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageRemoveResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageRemoveResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Output == nil { + m.Output = &SonicOutput{} + } + if err := m.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageDefaultRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageDefaultRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageDefaultRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Input", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Input == nil { + m.Input = &ImageDefaultRequest_Input{} + } + if err := m.Input.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageDefaultRequest_Input) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Input: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Input: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Imagename", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Imagename = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ImageDefaultResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageDefaultResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageDefaultResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Output", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthSonicGnoi + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthSonicGnoi + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Output == nil { + m.Output = &SonicOutput{} + } + if err := m.Output.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipSonicGnoi(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthSonicGnoi + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipSonicGnoi(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowSonicGnoi + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthSonicGnoi + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupSonicGnoi + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthSonicGnoi + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthSonicGnoi = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowSonicGnoi = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupSonicGnoi = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/gnoi/sonic_gnoi.proto b/proto/gnoi/sonic_gnoi.proto new file mode 100644 index 000000000..51092dac3 --- /dev/null +++ b/proto/gnoi/sonic_gnoi.proto @@ -0,0 +1,94 @@ +syntax = "proto3"; + +package gnoi.sonic; + +//option (types.gnoi_version) = "0.1.0"; +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; + +service SonicService { + rpc ShowTechsupport (TechsupportRequest) returns (TechsupportResponse) {} + rpc CopyConfig(CopyConfigRequest) returns (CopyConfigResponse) {} + rpc ImageInstall(ImageInstallRequest) returns (ImageInstallResponse) {} + rpc ImageRemove(ImageRemoveRequest) returns (ImageRemoveResponse) {} + rpc ImageDefault(ImageDefaultRequest) returns (ImageDefaultResponse) {} + rpc ClearNeighbors(ClearNeighborsRequest) returns (ClearNeighborsResponse) {} +} + +message SonicOutput { + int32 status = 1; + string status_detail = 2 [(gogoproto.jsontag) = "status-detail", (gogoproto.moretags) = "xml:\",comment\""]; +} + +message TechsupportRequest { + message Input { + string date = 1; + } + Input input = 1 [(gogoproto.jsontag) = "sonic-show-techsupport:input", (gogoproto.moretags) = "xml:\",comment\""]; +} +message TechsupportResponse { + message Output { + string output_filename = 1 [(gogoproto.jsontag) = "output-filename", (gogoproto.moretags) = "xml:\",comment\""]; + } + Output output = 1 [(gogoproto.jsontag) = "sonic-show-techsupport:output", (gogoproto.moretags) = "xml:\",comment\""]; +} + +message ClearNeighborsRequest { + message Input { + bool force = 1; + string family = 2; + string ip = 3; + string ifname = 4; + } + Input input = 1 [(gogoproto.jsontag) = "sonic-neighbor:input", (gogoproto.moretags) = "xml:\",comment\""]; +} + +message ClearNeighborsResponse { + message Output { + string response = 1; + } + Output output = 1 [(gogoproto.jsontag) = "sonic-neighbor:output", (gogoproto.moretags) = "xml:\",comment\""]; +} + +message CopyConfigRequest { + message Input { + string source = 1; + bool overwrite = 2; + string destination = 3; + } + Input input = 1 [(gogoproto.jsontag) = "sonic-config-mgmt:input", (gogoproto.moretags) = "xml:\",comment\""]; +} +message CopyConfigResponse { + SonicOutput output = 1 [(gogoproto.jsontag) = "sonic-config-mgmt:output", (gogoproto.moretags) = "xml:\",comment\""]; +} + +message ImageInstallRequest { + message Input { + string imagename = 2; + } + Input input = 1 [(gogoproto.jsontag) = "sonic-image-management:input", (gogoproto.moretags) = "xml:\",comment\""]; +} +message ImageInstallResponse { + SonicOutput output = 1 [(gogoproto.jsontag) = "sonic-image-management:output", (gogoproto.moretags) = "xml:\",comment\""]; +} +message ImageRemoveRequest { + message Input { + string imagename = 1; + } + Input input = 1 [(gogoproto.jsontag) = "sonic-image-management:input", (gogoproto.moretags) = "xml:\",comment\""]; +} +message ImageRemoveResponse { + SonicOutput output = 1 [(gogoproto.jsontag) = "sonic-image-management:output", (gogoproto.moretags) = "xml:\",comment\""]; +} +message ImageDefaultRequest { + message Input { + string imagename = 1; + } + Input input = 1 [(gogoproto.jsontag) = "sonic-image-management:input", (gogoproto.moretags) = "xml:\",comment\""]; +} +message ImageDefaultResponse { + SonicOutput output = 1 [(gogoproto.jsontag) = "sonic-image-management:output", (gogoproto.moretags) = "xml:\",comment\""]; +} + diff --git a/proto/sonic.pb.go b/proto/sonic.pb.go index d2af6b680..94b439cd3 100644 --- a/proto/sonic.pb.go +++ b/proto/sonic.pb.go @@ -7,7 +7,6 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/openconfig/gnmi/proto/gnmi" -import sdcfg "github.com/Azure/sonic-telemetry/sonic_db_config" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -17,47 +16,114 @@ var _ = math.Inf // target - the name of the target for which the path is a member. Only set in prefix for a path. type Target int32 +const ( + Target_APPL_DB Target = 0 + Target_ASIC_DB Target = 1 + Target_COUNTERS_DB Target = 2 + Target_LOGLEVEL_DB Target = 3 + Target_CONFIG_DB Target = 4 + // PFC_WD_DB shares the the same db number with FLEX_COUNTER_DB + Target_PFC_WD_DB Target = 5 + Target_FLEX_COUNTER_DB Target = 5 + Target_STATE_DB Target = 6 + // For none-DB data + Target_OTHERS Target = 100 +) + var Target_name = map[int32]string{ + 0: "APPL_DB", + 1: "ASIC_DB", + 2: "COUNTERS_DB", + 3: "LOGLEVEL_DB", + 4: "CONFIG_DB", + 5: "PFC_WD_DB", + // Duplicate value: 5: "FLEX_COUNTER_DB", + 6: "STATE_DB", 100: "OTHERS", } var Target_value = map[string]int32{ + "APPL_DB": 0, + "ASIC_DB": 1, + "COUNTERS_DB": 2, + "LOGLEVEL_DB": 3, + "CONFIG_DB": 4, + "PFC_WD_DB": 5, + "FLEX_COUNTER_DB": 5, + "STATE_DB": 6, "OTHERS": 100, } func (x Target) String() string { return proto.EnumName(Target_name, int32(x)) } -func (Target) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } +func (Target) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } + +type SupportedBundleVersions struct { + BundleVersion string `protobuf:"bytes,1,opt,name=bundle_version,json=bundleVersion" json:"bundle_version,omitempty"` + BaseVersion string `protobuf:"bytes,2,opt,name=base_version,json=baseVersion" json:"base_version,omitempty"` +} + +func (m *SupportedBundleVersions) Reset() { *m = SupportedBundleVersions{} } +func (m *SupportedBundleVersions) String() string { return proto.CompactTextString(m) } +func (*SupportedBundleVersions) ProtoMessage() {} +func (*SupportedBundleVersions) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } + +func (m *SupportedBundleVersions) GetBundleVersion() string { + if m != nil { + return m.BundleVersion + } + return "" +} -func setTarget() { - db_list := sdcfg.GetDbList() - for dbname, v := range db_list { - id := v.(map[string]interface{})["id"].(float64) - Target_value[dbname] = int32(id) - Target_name[int32(id)] = dbname - } +func (m *SupportedBundleVersions) GetBaseVersion() string { + if m != nil { + return m.BaseVersion + } + return "" +} + +type BundleVersion struct { + Version string `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"` +} + +func (m *BundleVersion) Reset() { *m = BundleVersion{} } +func (m *BundleVersion) String() string { return proto.CompactTextString(m) } +func (*BundleVersion) ProtoMessage() {} +func (*BundleVersion) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } + +func (m *BundleVersion) GetVersion() string { + if m != nil { + return m.Version + } + return "" } func init() { - setTarget() + proto.RegisterType((*SupportedBundleVersions)(nil), "gnmi.sonic.SupportedBundleVersions") + proto.RegisterType((*BundleVersion)(nil), "gnmi.sonic.BundleVersion") proto.RegisterEnum("gnmi.sonic.Target", Target_name, Target_value) } -func init() { proto.RegisterFile("sonic.proto", fileDescriptor1) } - -var fileDescriptor1 = []byte{ - // 205 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x2c, 0xce, 0x4f, 0x4e, 0x84, 0x30, - 0x14, 0xc7, 0x71, 0x19, 0xb5, 0xea, 0x43, 0x33, 0xa4, 0xee, 0xe6, 0x08, 0x2e, 0xc0, 0xc4, 0x13, - 0x8c, 0xa5, 0x20, 0x49, 0x43, 0x09, 0xad, 0x7f, 0x76, 0x44, 0x10, 0x6b, 0x17, 0xb4, 0x04, 0xf1, - 0x28, 0xde, 0xd7, 0xbc, 0xe2, 0xae, 0x9f, 0x6f, 0x7e, 0x6d, 0x0a, 0xf1, 0xb7, 0x77, 0x76, 0x48, - 0xe7, 0xc5, 0xaf, 0x9e, 0x82, 0x71, 0x93, 0x4d, 0x43, 0x39, 0xdc, 0x1b, 0xbb, 0x7e, 0xfd, 0xf4, - 0xe9, 0xe0, 0xa7, 0xcc, 0xcf, 0xa3, 0x1b, 0xbc, 0xfb, 0xb4, 0x26, 0xc3, 0x45, 0x16, 0xd6, 0xdb, - 0x31, 0xdc, 0x08, 0xbe, 0xfb, 0x8d, 0x80, 0xe8, 0xf7, 0xc5, 0x8c, 0x2b, 0x8d, 0xe1, 0xe2, 0xd8, - 0x34, 0xa2, 0xcb, 0x1f, 0x93, 0x93, 0x00, 0x55, 0x31, 0x44, 0x44, 0xf7, 0x10, 0x33, 0xf9, 0x5c, - 0x6b, 0xde, 0x2a, 0x0c, 0x3b, 0x0c, 0x42, 0x96, 0x82, 0xbf, 0xf0, 0x30, 0x3f, 0xa5, 0x37, 0x70, - 0xc5, 0x64, 0x5d, 0x54, 0x25, 0xf2, 0x0c, 0xd9, 0x14, 0xac, 0x7b, 0xcd, 0x91, 0xe7, 0xf4, 0x16, - 0xf6, 0x85, 0xe0, 0x6f, 0xdd, 0xff, 0x23, 0x5b, 0xbc, 0x86, 0x4b, 0xa5, 0x8f, 0x9a, 0xa3, 0x08, - 0x05, 0x20, 0x52, 0x3f, 0xf1, 0x56, 0x25, 0x1f, 0x87, 0x5d, 0x12, 0xf5, 0x24, 0x7c, 0xef, 0xe1, - 0x2f, 0x00, 0x00, 0xff, 0xff, 0xca, 0x4e, 0xf3, 0x7a, 0xeb, 0x00, 0x00, 0x00, +func init() { proto.RegisterFile("sonic.proto", fileDescriptor2) } + +var fileDescriptor2 = []byte{ + // 279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xdf, 0x4e, 0xb3, 0x30, + 0x18, 0x87, 0x3f, 0xf8, 0x94, 0xb9, 0x97, 0xe1, 0x48, 0x3d, 0x70, 0xd9, 0x91, 0x2e, 0x31, 0x51, + 0x0f, 0xc0, 0xc4, 0x2b, 0xd8, 0x58, 0x99, 0x4b, 0xc8, 0x20, 0x80, 0xd3, 0x33, 0xb2, 0x42, 0xc5, + 0x26, 0xae, 0x25, 0xfc, 0xf1, 0x4e, 0xbc, 0x5f, 0xd3, 0x32, 0xa3, 0x3b, 0xeb, 0xf3, 0xe4, 0xe9, + 0xef, 0xe0, 0x05, 0xb3, 0x11, 0x9c, 0xe5, 0x4e, 0x55, 0x8b, 0x56, 0x20, 0x28, 0xf9, 0x9e, 0x39, + 0xca, 0x4c, 0x1f, 0x4a, 0xd6, 0xbe, 0x77, 0xc4, 0xc9, 0xc5, 0xde, 0x15, 0x15, 0xe5, 0xb9, 0xe0, + 0x6f, 0xac, 0x74, 0x65, 0xe1, 0xaa, 0xba, 0x7f, 0xaa, 0x1f, 0x8a, 0x67, 0x39, 0x5c, 0x26, 0x5d, + 0x55, 0x89, 0xba, 0xa5, 0xc5, 0xa2, 0xe3, 0xc5, 0x07, 0xdd, 0xd2, 0xba, 0x61, 0x82, 0x37, 0xe8, + 0x06, 0xce, 0x89, 0x32, 0xd9, 0x67, 0xaf, 0x26, 0xda, 0x95, 0x76, 0x3b, 0x8c, 0x2d, 0xf2, 0xb7, + 0x43, 0xd7, 0x30, 0x22, 0xbb, 0xe6, 0x37, 0xd2, 0x55, 0x64, 0x4a, 0x77, 0x48, 0x66, 0x77, 0x60, + 0x1d, 0x6d, 0xa3, 0x09, 0x0c, 0x8e, 0x37, 0x7f, 0xf0, 0xfe, 0x4b, 0x03, 0x23, 0xdd, 0xd5, 0x25, + 0x6d, 0x91, 0x09, 0x83, 0x79, 0x14, 0x05, 0xd9, 0x72, 0x61, 0xff, 0x53, 0x90, 0xac, 0x3d, 0x09, + 0x1a, 0x1a, 0x83, 0xe9, 0x85, 0xcf, 0x9b, 0x14, 0xc7, 0x89, 0x14, 0xba, 0x14, 0x41, 0xb8, 0x0a, + 0xf0, 0x16, 0xab, 0xfc, 0x3f, 0xb2, 0x60, 0xe8, 0x85, 0x1b, 0x7f, 0xbd, 0x92, 0x78, 0x22, 0x31, + 0xf2, 0xbd, 0xec, 0x65, 0x29, 0xf1, 0x14, 0x5d, 0xc0, 0xd8, 0x0f, 0xf0, 0x6b, 0x76, 0x18, 0xe9, + 0xe5, 0x08, 0xce, 0x92, 0x74, 0x9e, 0x62, 0x49, 0x06, 0x02, 0x30, 0xc2, 0xf4, 0x09, 0xc7, 0x89, + 0x5d, 0x4c, 0x75, 0x5b, 0x23, 0x86, 0x3a, 0xd7, 0xe3, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8, + 0xb8, 0x5a, 0xaf, 0x7b, 0x01, 0x00, 0x00, } diff --git a/proto/sonic.proto b/proto/sonic.proto index 9c7476a3e..e8fda3931 100644 --- a/proto/sonic.proto +++ b/proto/sonic.proto @@ -19,4 +19,13 @@ enum Target { STATE_DB = 6; // For none-DB data OTHERS = 100; -} \ No newline at end of file +} + +message SupportedBundleVersions { + string bundle_version = 1; + string base_version = 2; +} +message BundleVersion { + string version = 1; +} + diff --git a/proto/sonic_internal.pb.go b/proto/sonic_internal.pb.go index 1dadb5b3f..9d9edbd97 100644 --- a/proto/sonic_internal.pb.go +++ b/proto/sonic_internal.pb.go @@ -35,7 +35,7 @@ var State_value = map[string]int32{ func (x State) String() string { return proto.EnumName(State_name, int32(x)) } -func (State) EnumDescriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +func (State) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } // Value is the message that reprents a stream of updates for a given path, used internally. type Value struct { @@ -58,7 +58,7 @@ type Value struct { func (m *Value) Reset() { *m = Value{} } func (m *Value) String() string { return proto.CompactTextString(m) } func (*Value) ProtoMessage() {} -func (*Value) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } +func (*Value) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } func (m *Value) GetPrefix() *gnmi.Path { if m != nil { @@ -107,9 +107,9 @@ func init() { proto.RegisterEnum("gnmi.sonic.State", State_name, State_value) } -func init() { proto.RegisterFile("sonic_internal.proto", fileDescriptor2) } +func init() { proto.RegisterFile("sonic_internal.proto", fileDescriptor1) } -var fileDescriptor2 = []byte{ +var fileDescriptor1 = []byte{ // 269 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x8f, 0x4f, 0x4b, 0xc3, 0x30, 0x18, 0xc6, 0xcd, 0xfa, 0xc7, 0xed, 0x9d, 0x42, 0x09, 0x3b, 0x04, 0x11, 0x29, 0xf5, 0x52, 0x14, diff --git a/sonic_data_client/db_client.go b/sonic_data_client/db_client.go index dd5f8b374..68fab01e3 100644 --- a/sonic_data_client/db_client.go +++ b/sonic_data_client/db_client.go @@ -40,12 +40,12 @@ type Client interface { // data read from data source will be enqueued on to the priority queue // The service will stop upon detection of poll channel closing. // It should run as a go routine - PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup) - OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup) + PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) + OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) // Get return data from the data source in format of *spb.Value Get(w *sync.WaitGroup) ([]*spb.Value, error) // Set data based on path and value - Set(path *gnmipb.Path, t *gnmipb.TypedValue, op int) error + Set(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update) error // Capabilities of the switch Capabilities() []gnmipb.ModelData @@ -262,7 +262,7 @@ func streamSampleSubscription(c *DbClient, sub *gnmipb.Subscription, updateOnly } } -func (c *DbClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup) { +func (c *DbClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { c.w = w defer c.w.Done() c.q = q @@ -302,7 +302,7 @@ func (c *DbClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.W log.V(4).Infof("Sync done, poll time taken: %v ms", int64(time.Since(t1)/time.Millisecond)) } } -func (c *DbClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup) { +func (c *DbClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { return } func (c *DbClient) Get(w *sync.WaitGroup) ([]*spb.Value, error) { @@ -1160,7 +1160,7 @@ func dbTableKeySubscribe(c *DbClient, gnmiPath *gnmipb.Path, interval time.Durat } } -func (c *DbClient) Set(path *gnmipb.Path, t *gnmipb.TypedValue, flagop int) error { +func (c *DbClient) Set(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update) error { return nil } func (c *DbClient) Capabilities() []gnmipb.ModelData { diff --git a/sonic_data_client/non_db_client.go b/sonic_data_client/non_db_client.go index 70a79874c..12336a686 100644 --- a/sonic_data_client/non_db_client.go +++ b/sonic_data_client/non_db_client.go @@ -521,7 +521,7 @@ func runGetterAndSend(c *NonDbClient, gnmiPath *gnmipb.Path, getter dataGetFunc) return err } -func (c *NonDbClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup) { +func (c *NonDbClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { c.w = w defer c.w.Done() c.q = q @@ -547,7 +547,7 @@ func (c *NonDbClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *syn log.V(4).Infof("Sync done, poll time taken: %v ms", int64(time.Since(t1)/time.Millisecond)) } } -func (c *NonDbClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup) { +func (c *NonDbClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { return } func (c *NonDbClient) Get(w *sync.WaitGroup) ([]*spb.Value, error) { @@ -581,7 +581,7 @@ func (c *NonDbClient) Close() error { return nil } -func (c *NonDbClient) Set(path *gnmipb.Path, t *gnmipb.TypedValue, flagop int) error { +func (c *NonDbClient) Set(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update) error { return nil } func (c *NonDbClient) Capabilities() []gnmipb.ModelData { diff --git a/sonic_data_client/transl_data_client.go b/sonic_data_client/transl_data_client.go index 9e38ffd96..78cd663ee 100644 --- a/sonic_data_client/transl_data_client.go +++ b/sonic_data_client/transl_data_client.go @@ -5,15 +5,19 @@ import ( spb "github.com/Azure/sonic-telemetry/proto" transutil "github.com/Azure/sonic-telemetry/transl_utils" log "github.com/golang/glog" + "github.com/golang/protobuf/proto" gnmipb "github.com/openconfig/gnmi/proto/gnmi" + gnmi_extpb "github.com/openconfig/gnmi/proto/gnmi_ext" "github.com/Workiva/go-datastructures/queue" "sync" "time" "fmt" "reflect" "github.com/Azure/sonic-mgmt-common/translib" + "github.com/Azure/sonic-telemetry/common_utils" "bytes" "encoding/json" + "context" ) const ( @@ -32,14 +36,16 @@ type TranslClient struct { synced sync.WaitGroup // Control when to send gNMI sync_response w *sync.WaitGroup // wait for all sub go routines to finish mu sync.RWMutex // Mutex for data protection among routines for transl_client - + ctx context.Context //Contains Auth info and request info + extensions []*gnmi_extpb.Extension } -func NewTranslClient(prefix *gnmipb.Path, getpaths []*gnmipb.Path) (Client, error) { +func NewTranslClient(prefix *gnmipb.Path, getpaths []*gnmipb.Path, ctx context.Context, extensions []*gnmi_extpb.Extension) (Client, error) { var client TranslClient var err error - + client.ctx = ctx client.prefix = prefix + client.extensions = extensions if getpaths != nil { client.path2URI = make(map[*gnmipb.Path]string) /* Populate GNMI path to REST URL map. */ @@ -54,14 +60,19 @@ func NewTranslClient(prefix *gnmipb.Path, getpaths []*gnmipb.Path) (Client, erro } func (c *TranslClient) Get(w *sync.WaitGroup) ([]*spb.Value, error) { - + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx var values []*spb.Value ts := time.Now() + version := getBundleVersion(c.extensions) + if version != nil { + rc.BundleVersion = version + } /* Iterate through all GNMI paths. */ for gnmiPath, URIPath := range c.path2URI { /* Fill values for each GNMI path. */ - val, err := transutil.TranslProcessGet(URIPath, nil) + val, err := transutil.TranslProcessGet(URIPath, nil, c.ctx) if err != nil { return nil, err @@ -85,22 +96,35 @@ func (c *TranslClient) Get(w *sync.WaitGroup) ([]*spb.Value, error) { return values, nil } -func (c *TranslClient) Set(path *gnmipb.Path, val *gnmipb.TypedValue, flagop int) error { +func (c *TranslClient) Set(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update) error { + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx var uri string - var err error - - /* Convert the GNMI Path to URI. */ - transutil.ConvertToURI(c.prefix, path, &uri) - - if flagop == DELETE { - err = transutil.TranslProcessDelete(uri) - } else if flagop == REPLACE { - err = transutil.TranslProcessReplace(uri, val) - } else if flagop == UPDATE { - err = transutil.TranslProcessUpdate(uri, val) + version := getBundleVersion(c.extensions) + if version != nil { + rc.BundleVersion = version } - return err + if (len(delete) + len(replace) + len(update)) > 1 { + return transutil.TranslProcessBulk(delete, replace, update, c.prefix, c.ctx) + } else { + if len(delete) == 1 { + /* Convert the GNMI Path to URI. */ + transutil.ConvertToURI(c.prefix, delete[0], &uri) + return transutil.TranslProcessDelete(uri, c.ctx) + } + if len(replace) == 1 { + /* Convert the GNMI Path to URI. */ + transutil.ConvertToURI(c.prefix, replace[0].GetPath(), &uri) + return transutil.TranslProcessReplace(uri, replace[0].GetVal(), c.ctx) + } + if len(update) == 1 { + /* Convert the GNMI Path to URI. */ + transutil.ConvertToURI(c.prefix, update[0].GetPath(), &uri) + return transutil.TranslProcessUpdate(uri, update[0].GetVal(), c.ctx) + } + } + return nil } func enqueFatalMsgTranslib(c *TranslClient, msg string) { c.q.Put(Value{ @@ -117,11 +141,17 @@ type ticker_info struct{ } func (c *TranslClient) StreamRun(q *queue.PriorityQueue, stop chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx c.w = w + defer c.w.Done() c.q = q c.channel = stop - + version := getBundleVersion(c.extensions) + if version != nil { + rc.BundleVersion = version + } ticker_map := make(map[int][]*ticker_info) var cases []reflect.SelectCase @@ -189,21 +219,25 @@ func (c *TranslClient) StreamRun(q *queue.PriorityQueue, stop chan struct{}, w * return } } - //Send initial data now so we can send sync response. - val, err := transutil.TranslProcessGet(c.path2URI[sub.Path], nil) - if err != nil { - return - } - spbv := &spb.Value{ - Prefix: c.prefix, - Path: sub.Path, - Timestamp: time.Now().UnixNano(), - SyncResponse: false, - Val: val, + if !subscribe.UpdatesOnly { + //Send initial data now so we can send sync response. + val, err := transutil.TranslProcessGet(c.path2URI[sub.Path], nil, c.ctx) + if err != nil { + return + } + spbv := &spb.Value{ + Prefix: c.prefix, + Path: sub.Path, + Timestamp: time.Now().UnixNano(), + SyncResponse: false, + Val: val, + } + c.q.Put(Value{spbv}) + valueCache[c.path2URI[sub.Path]] = string(val.GetJsonIetfVal()) } - c.q.Put(Value{spbv}) - valueCache[c.path2URI[sub.Path]] = string(val.GetJsonIetfVal()) + addTimer(c, ticker_map, &cases, cases_map, interval, sub, false) + //Heartbeat intervals are valid for SAMPLE in the case suppress_redundant is specified if sub.SuppressRedundant && sub.HeartbeatInterval > 0 { if int(sub.HeartbeatInterval) < subSupport[i].MinInterval * int(time.Second) { @@ -252,7 +286,7 @@ func (c *TranslClient) StreamRun(q *queue.PriorityQueue, stop chan struct{}, w * for _,tick := range ticker_map[cases_map[chosen]] { fmt.Printf("tick, heartbeat: %t, path: %s", tick.heartbeat, c.path2URI[tick.sub.Path]) - val, err := transutil.TranslProcessGet(c.path2URI[tick.sub.Path], nil) + val, err := transutil.TranslProcessGet(c.path2URI[tick.sub.Path], nil, c.ctx) if err != nil { return } @@ -302,9 +336,20 @@ func addTimer(c *TranslClient, ticker_map map[int][]*ticker_info, cases *[]refle func TranslSubscribe(gnmiPaths []*gnmipb.Path, stringPaths []string, pathMap map[string]*gnmipb.Path, c *TranslClient, updates_only bool) { defer c.w.Done() + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx q := queue.NewPriorityQueue(1, false) var sync_done bool req := translib.SubscribeRequest{Paths:stringPaths, Q:q, Stop:c.channel} + if rc.BundleVersion != nil { + nver, err := translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("Subscribe operation failed with error =%v", err.Error()) + enqueFatalMsgTranslib(c, fmt.Sprintf("Subscribe operation failed with error =%v", err.Error())) + return + } + req.ClientVersion = nver + } translib.Subscribe(req) for { items, err := q.Get(1) @@ -363,12 +408,18 @@ func TranslSubscribe(gnmiPaths []*gnmipb.Path, stringPaths []string, pathMap map -func (c *TranslClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup) { +func (c *TranslClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx c.w = w defer c.w.Done() c.q = q c.channel = poll - + version := getBundleVersion(c.extensions) + if version != nil { + rc.BundleVersion = version + } + synced := false for { _, more := <-c.channel if !more { @@ -377,21 +428,23 @@ func (c *TranslClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sy } t1 := time.Now() for gnmiPath, URIPath := range c.path2URI { - val, err := transutil.TranslProcessGet(URIPath, nil) - if err != nil { - return - } + if synced || !subscribe.UpdatesOnly { + val, err := transutil.TranslProcessGet(URIPath, nil, c.ctx) + if err != nil { + return + } - spbv := &spb.Value{ - Prefix: c.prefix, - Path: gnmiPath, - Timestamp: time.Now().UnixNano(), - SyncResponse: false, - Val: val, - } + spbv := &spb.Value{ + Prefix: c.prefix, + Path: gnmiPath, + Timestamp: time.Now().UnixNano(), + SyncResponse: false, + Val: val, + } - c.q.Put(Value{spbv}) - log.V(6).Infof("Added spbv #%v", spbv) + c.q.Put(Value{spbv}) + log.V(6).Infof("Added spbv #%v", spbv) + } } c.q.Put(Value{ @@ -400,16 +453,22 @@ func (c *TranslClient) PollRun(q *queue.PriorityQueue, poll chan struct{}, w *sy SyncResponse: true, }, }) + synced = true log.V(4).Infof("Sync done, poll time taken: %v ms", int64(time.Since(t1)/time.Millisecond)) } } -func (c *TranslClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup) { +func (c *TranslClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sync.WaitGroup, subscribe *gnmipb.SubscriptionList) { + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx c.w = w defer c.w.Done() c.q = q c.channel = once - + version := getBundleVersion(c.extensions) + if version != nil { + rc.BundleVersion = version + } _, more := <-c.channel if !more { log.V(1).Infof("%v once channel closed, exiting onceDb routine", c) @@ -417,21 +476,23 @@ func (c *TranslClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sy } t1 := time.Now() for gnmiPath, URIPath := range c.path2URI { - val, err := transutil.TranslProcessGet(URIPath, nil) + val, err := transutil.TranslProcessGet(URIPath, nil, c.ctx) if err != nil { return } - spbv := &spb.Value{ - Prefix: c.prefix, - Path: gnmiPath, - Timestamp: time.Now().UnixNano(), - SyncResponse: false, - Val: val, - } + if !subscribe.UpdatesOnly && val != nil { + spbv := &spb.Value{ + Prefix: c.prefix, + Path: gnmiPath, + Timestamp: time.Now().UnixNano(), + SyncResponse: false, + Val: val, + } - c.q.Put(Value{spbv}) - log.V(6).Infof("Added spbv #%v", spbv) + c.q.Put(Value{spbv}) + log.V(6).Infof("Added spbv #%v", spbv) + } } c.q.Put(Value{ @@ -445,7 +506,12 @@ func (c *TranslClient) OnceRun(q *queue.PriorityQueue, once chan struct{}, w *sy } func (c *TranslClient) Capabilities() []gnmipb.ModelData { - + rc, ctx := common_utils.GetContext(c.ctx) + c.ctx = ctx + version := getBundleVersion(c.extensions) + if version != nil { + rc.BundleVersion = version + } /* Fetch the supported models. */ supportedModels := transutil.GetModels() return supportedModels @@ -454,3 +520,18 @@ func (c *TranslClient) Capabilities() []gnmipb.ModelData { func (c *TranslClient) Close() error { return nil } + +func getBundleVersion(extensions []*gnmi_extpb.Extension) *string { + for _,e := range extensions { + switch v := e.Ext.(type) { + case *gnmi_extpb.Extension_RegisteredExt: + if v.RegisteredExt.Id == spb.BUNDLE_VERSION_EXT { + var bv spb.BundleVersion + proto.Unmarshal(v.RegisteredExt.Msg, &bv) + return &bv.Version + } + + } + } + return nil +} diff --git a/telemetry/telemetry.go b/telemetry/telemetry.go index 84c8f3169..4ec580c6b 100644 --- a/telemetry/telemetry.go +++ b/telemetry/telemetry.go @@ -5,6 +5,7 @@ import ( "crypto/x509" "flag" "io/ioutil" + "time" log "github.com/golang/glog" "google.golang.org/grpc" @@ -15,6 +16,7 @@ import ( ) var ( + userAuth = gnmi.AuthTypes{"password": false, "cert": false, "jwt": false} port = flag.Int("port", -1, "port to listen on") // Certificate files. caCert = flag.String("ca_crt", "", "CA certificate for client certificate validation. Optional.") @@ -23,16 +25,36 @@ var ( insecure = flag.Bool("insecure", false, "Skip providing TLS cert and key, for testing only!") noTLS = flag.Bool("noTLS", false, "disable TLS, for testing only!") allowNoClientCert = flag.Bool("allow_no_client_auth", false, "When set, telemetry server will request but not require a client certificate.") + jwtRefInt = flag.Uint64("jwt_refresh_int", 900, "Seconds before JWT expiry the token can be refreshed.") + jwtValInt = flag.Uint64("jwt_valid_int", 3600, "Seconds that JWT token is valid for.") ) func main() { + flag.Var(userAuth, "client_auth", "Client auth mode(s) - none,cert,password") flag.Parse() + var defUserAuth gnmi.AuthTypes + if gnmi.READ_WRITE_MODE { + //In read/write mode we want to enable auth by default. + defUserAuth = gnmi.AuthTypes{"password": true, "cert": false, "jwt": true} + }else { + defUserAuth = gnmi.AuthTypes{"jwt": false, "password": false, "cert": false} + } + + if isFlagPassed("client_auth") { + log.V(1).Infof("client_auth provided") + }else { + log.V(1).Infof("client_auth not provided, using defaults.") + userAuth = defUserAuth + } + switch { case *port <= 0: log.Errorf("port must be > 0.") return } + gnmi.JwtRefreshInt = time.Duration(*jwtRefInt*uint64(time.Second)) + gnmi.JwtValidInt = time.Duration(*jwtValInt*uint64(time.Second)) cfg := &gnmi.Config{} cfg.Port = int64(*port) @@ -94,9 +116,19 @@ func main() { log.Exit("failed to append CA certificate") } tlsCfg.ClientCAs = certPool + } else { + if userAuth.Enabled("cert") { + userAuth.Unset("cert") + log.Warning("client_auth mode cert requires ca_crt option. Disabling cert mode authentication.") + } } opts = []grpc.ServerOption{grpc.Creds(credentials.NewTLS(tlsCfg))} + cfg := &gnmi.Config{} + cfg.Port = int64(*port) + cfg.UserAuth = userAuth + + gnmi.GenerateJwtSecretKey() } s, err := gnmi.NewServer(cfg, opts) @@ -105,7 +137,18 @@ func main() { return } + log.V(1).Infof("Auth Modes: ", userAuth) log.V(1).Infof("Starting RPC server on address: %s", s.Address()) s.Serve() // blocks until close log.Flush() } + +func isFlagPassed(name string) bool { + found := false + flag.Visit(func(f *flag.Flag) { + if f.Name == name { + found = true + } + }) + return found +} diff --git a/transl_utils/transl_utils.go b/transl_utils/transl_utils.go index 606aa2352..8b3009d1b 100644 --- a/transl_utils/transl_utils.go +++ b/transl_utils/transl_utils.go @@ -8,8 +8,40 @@ import ( log "github.com/golang/glog" gnmipb "github.com/openconfig/gnmi/proto/gnmi" "github.com/Azure/sonic-mgmt-common/translib" + "github.com/Azure/sonic-telemetry/common_utils" + "context" + "log/syslog" + "github.com/Azure/sonic-mgmt-common/translib/tlerr" + +) + +var ( + Writer *syslog.Writer ) +func __log_audit_msg(ctx context.Context, reqType string, uriPath string, err error) { + var err1 error + username := "invalid" + statusMsg := "failure" + if (err == nil) { + statusMsg = "success" + } + + if Writer == nil { + Writer, err1 = syslog.Dial("", "", (syslog.LOG_LOCAL4), "") + if (err1 != nil) { + log.V(2).Infof("Could not open connection to syslog with error =%v", err1.Error()) + return + } + } + + common_utils.GetUsername(ctx, &username) + + auditMsg := fmt.Sprintf("User \"%s\" request \"%s %s\" status - %s error - %s", + username, reqType, uriPath, statusMsg, err.Error()) + Writer.Info(auditMsg) +} + func GnmiTranslFullPath(prefix, path *gnmipb.Path) *gnmipb.Path { fullPath := &gnmipb.Path{Origin: path.Origin} @@ -75,18 +107,30 @@ func ConvertToURI(prefix *gnmipb.Path, path *gnmipb.Path, req *string) error { } /* Fill the values from TransLib. */ -func TranslProcessGet(uriPath string, op *string) (*gnmipb.TypedValue, error) { +func TranslProcessGet(uriPath string, op *string, ctx context.Context) (*gnmipb.TypedValue, error) { var jv []byte var data []byte - - req := translib.GetRequest{Path:uriPath} + rc, ctx := common_utils.GetContext(ctx) + + req := translib.GetRequest{Path:uriPath, User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}} + if rc.BundleVersion != nil { + nver, err := translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("GET operation failed with error =%v", err.Error()) + return nil, err + } + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } resp, err1 := translib.Get(req) if isTranslibSuccess(err1) { data = resp.Payload } else { - log.V(2).Infof("GET operation failed with error =%v", resp.ErrSrc) - return nil, fmt.Errorf("GET failed for this message") + log.V(2).Infof("GET operation failed with error =%v, %v", resp.ErrSrc, err1.Error()) + return nil, err1 } dst := new(bytes.Buffer) @@ -103,37 +147,57 @@ func TranslProcessGet(uriPath string, op *string) (*gnmipb.TypedValue, error) { } /* Delete request handling. */ -func TranslProcessDelete(uri string) error { +func TranslProcessDelete(uri string, ctx context.Context) error { var str3 string payload := []byte(str3) - req := translib.SetRequest{Path:uri, Payload:payload} + rc, ctx := common_utils.GetContext(ctx) + req := translib.SetRequest{Path:uri, Payload:payload, User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}} + if rc.BundleVersion != nil { + nver, err := translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("DELETE operation failed with error =%v", err.Error()) + return err + } + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } resp, err := translib.Delete(req) if err != nil{ - log.V(2).Infof("DELETE operation failed with error =%v", resp.ErrSrc) - return fmt.Errorf("DELETE failed for this message") + log.V(2).Infof("DELETE operation failed with error =%v, %v", resp.ErrSrc, err.Error()) + return err } return nil } /* Replace request handling. */ -func TranslProcessReplace(uri string, t *gnmipb.TypedValue) error { +func TranslProcessReplace(uri string, t *gnmipb.TypedValue, ctx context.Context) error { /* Form the CURL request and send to client . */ str := string(t.GetJsonIetfVal()) str3 := strings.Replace(str, "\n", "", -1) - log.V(2).Infof("Incoming JSON body is", str) + log.V(2).Info("Incoming JSON body is", str) payload := []byte(str3) - req := translib.SetRequest{Path:uri, Payload:payload} - resp, err1 := translib.Create(req) - if err1 != nil{ - //If Create fails, it may be due to object already existing/can not be created - // such as interface, in this case use Update. - resp, err1 = translib.Update(req) + rc, ctx := common_utils.GetContext(ctx) + req := translib.SetRequest{Path:uri, Payload:payload, User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}} + if rc.BundleVersion != nil { + nver, err := translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("REPLACE operation failed with error =%v", err.Error()) + return err + } + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true } + resp, err1 := translib.Replace(req) + if err1 != nil{ - log.V(2).Infof("REPLACE operation failed with error =%v", resp.ErrSrc) - return fmt.Errorf("REPLACE failed for this message") + log.V(2).Infof("REPLACE operation failed with error =%v, %v", resp.ErrSrc, err1.Error()) + return err1 } @@ -141,27 +205,195 @@ func TranslProcessReplace(uri string, t *gnmipb.TypedValue) error { } /* Update request handling. */ -func TranslProcessUpdate(uri string, t *gnmipb.TypedValue) error { +func TranslProcessUpdate(uri string, t *gnmipb.TypedValue, ctx context.Context) error { /* Form the CURL request and send to client . */ str := string(t.GetJsonIetfVal()) str3 := strings.Replace(str, "\n", "", -1) - log.V(2).Infof("Incoming JSON body is", str) + log.V(2).Info("Incoming JSON body is", str) payload := []byte(str3) - req := translib.SetRequest{Path:uri, Payload:payload} - resp, err := translib.Create(req) + rc, ctx := common_utils.GetContext(ctx) + req := translib.SetRequest{Path:uri, Payload:payload, User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}} + if rc.BundleVersion != nil { + nver, err := translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("UPDATE operation failed with error =%v", err.Error()) + return err + } + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } + resp, err := translib.Update(req) + if err != nil{ + switch err.(type) { + case tlerr.NotFoundError: + //If Update fails, it may be due to object not existing in this case use Replace to create and update the object. + resp, err = translib.Replace(req) + default: + log.V(2).Infof("UPDATE operation failed with error =%v, %v", resp.ErrSrc, err.Error()) + return err + } + } if err != nil{ - //If Create fails, it may be due to object already existing/can not be created - // such as interface, in this case use Update. - resp, err = translib.Update(req) + log.V(2).Infof("UPDATE operation failed with error =%v, %v", resp.ErrSrc, err.Error()) + return err + } + return nil +} + +func TranslProcessBulk(delete []*gnmipb.Path, replace []*gnmipb.Update, update []*gnmipb.Update, prefix *gnmipb.Path, ctx context.Context) error { + var br translib.BulkRequest + var uri string + + var deleteUri []string + var replaceUri []string + var updateUri []string + + rc, ctx := common_utils.GetContext(ctx) + log.V(2).Info("TranslProcessBulk Called") + var nver translib.Version + var err error + if rc.BundleVersion != nil { + nver, err = translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("Bundle Version Check failed with error =%v", err.Error()) + return err + } + } + for _,d := range delete { + ConvertToURI(prefix, d, &uri) + var str3 string + payload := []byte(str3) + req := translib.SetRequest{ + Path: uri, + Payload: payload, + User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}, + } + if rc.BundleVersion != nil { + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } + br.DeleteRequest = append(br.DeleteRequest, req) + deleteUri = append(deleteUri, uri) + } + for _,r := range replace { + ConvertToURI(prefix, r.GetPath(), &uri) + str := string(r.GetVal().GetJsonIetfVal()) + str3 := strings.Replace(str, "\n", "", -1) + log.V(2).Info("Incoming JSON body is", str) + payload := []byte(str3) + req := translib.SetRequest{ + Path: uri, + Payload: payload, + User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}, + } + if rc.BundleVersion != nil { + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } + br.ReplaceRequest = append(br.ReplaceRequest, req) + replaceUri = append(replaceUri, uri) + } + for _,u := range update { + ConvertToURI(prefix, u.GetPath(), &uri) + str := string(u.GetVal().GetJsonIetfVal()) + str3 := strings.Replace(str, "\n", "", -1) + log.V(2).Info("Incoming JSON body is", str) + payload := []byte(str3) + req := translib.SetRequest{ + Path: uri, + Payload: payload, + User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}, + } + if rc.BundleVersion != nil { + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } + br.UpdateRequest = append(br.UpdateRequest, req) + updateUri = append(updateUri, uri) } + + resp,err := translib.Bulk(br) + + i := 0 + for _,d := range resp.DeleteResponse { + __log_audit_msg(ctx, "DELETE", deleteUri[i], d.Err) + i++ + } + i = 0 + for _,r := range resp.ReplaceResponse { + __log_audit_msg(ctx, "REPLACE", replaceUri[i], r.Err) + i++ + } + i = 0 + for _,u := range resp.UpdateResponse { + __log_audit_msg(ctx, "UPDATE", updateUri[i], u.Err) + i++ + } + + var errors []string if err != nil{ - log.V(2).Infof("UPDATE operation failed with error =%v", resp.ErrSrc) - return fmt.Errorf("UPDATE failed for this message") + log.V(2).Info("BULK SET operation failed with error(s):") + for _,d := range resp.DeleteResponse { + if d.Err != nil { + log.V(2).Infof("%s=%v", d.Err.Error(), d.ErrSrc) + errors = append(errors, d.Err.Error()) + } + } + for _,r := range resp.ReplaceResponse { + if r.Err != nil { + log.V(2).Infof("%s=%v", r.Err.Error(), r.ErrSrc) + errors = append(errors, r.Err.Error()) + } + } + for _,u := range resp.UpdateResponse { + if u.Err != nil { + log.V(2).Infof("%s=%v", u.Err.Error(), u.ErrSrc) + errors = append(errors, u.Err.Error()) + } + } + return fmt.Errorf("SET failed: %s", strings.Join(errors, "; ")) } + return nil } +/* Action/rpc request handling. */ +func TranslProcessAction(uri string, payload []byte, ctx context.Context) ([]byte, error) { + rc, ctx := common_utils.GetContext(ctx) + req := translib.ActionRequest{User: translib.UserRoles{Name: rc.Auth.User, Roles: rc.Auth.Roles}} + if rc.BundleVersion != nil { + nver, err := translib.NewVersion(*rc.BundleVersion) + if err != nil { + log.V(2).Infof("Action operation failed with error =%v", err.Error()) + return nil, err + } + req.ClientVersion = nver + } + if rc.Auth.AuthEnabled { + req.AuthEnabled = true + } + req.Path = uri + req.Payload = payload + + resp, err := translib.Action(req) + __log_audit_msg(ctx, "ACTION", uri, err) + + if err != nil{ + log.V(2).Infof("Action operation failed with error =%v, %v", resp.ErrSrc, err.Error()) + return nil, err + } + return resp.Payload, nil +} + /* Fetch the supported models. */ func GetModels() []gnmipb.ModelData {