From 090fb37f83b25cb325ca557c5c7760e961f708fe Mon Sep 17 00:00:00 2001 From: vadvolo Date: Sat, 22 Nov 2025 15:12:38 +0000 Subject: [PATCH 1/6] feat: Add Telnet support to gnetcli server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add StreamerType enum (ssh/telnet) to proto - Add streamer_type field to HostParams - Update server.go to select SSH or Telnet streamer based on streamer_type - Add WithPort option to telnet streamer - Update Python SDK with streamer_type support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- grpc_sdk/python/gnetclisdk/client.py | 2 + pkg/server/devuath.go | 2 +- pkg/server/proto/server.pb.go | 902 ++++++++++----------------- pkg/server/proto/server.proto | 6 + pkg/server/proto/server_grpc.pb.go | 43 +- pkg/server/proto/server_pb2.py | 76 ++- pkg/server/proto/server_pb2.pyi | 16 +- pkg/server/proto/server_pb2_grpc.py | 165 ++++- pkg/server/server.go | 117 ++-- pkg/streamer/telnet/telnet.go | 15 +- 10 files changed, 654 insertions(+), 690 deletions(-) diff --git a/grpc_sdk/python/gnetclisdk/client.py b/grpc_sdk/python/gnetclisdk/client.py index 6ab2116..509d6f3 100644 --- a/grpc_sdk/python/gnetclisdk/client.py +++ b/grpc_sdk/python/gnetclisdk/client.py @@ -72,6 +72,7 @@ class HostParams: hostname: Optional[str] = None credentials: Optional[Credentials] = None ip: Optional[str] = None + streamer_type: Optional[server_pb2.StreamerType] = None # server_pb2.StreamerType_ssh or server_pb2.StreamerType_telnet def make_pb(self) -> server_pb2.HostParams: creds_pb: Optional[server_pb2.Credentials] = None @@ -83,6 +84,7 @@ def make_pb(self) -> server_pb2.HostParams: credentials=creds_pb, device=self.device, ip=self.ip, + streamer_type=self.streamer_type if self.streamer_type is not None else server_pb2.StreamerType.StreamerType_ssh, ) return pbcmd diff --git a/pkg/server/devuath.go b/pkg/server/devuath.go index 4e9040a..de79c9d 100644 --- a/pkg/server/devuath.go +++ b/pkg/server/devuath.go @@ -43,7 +43,7 @@ func (m authApp) GetHostParams(host string, params *pb.HostParams) (hostParams, if err != nil { return hostParams{}, err } - res := NewHostParams(creds, params.GetDevice(), ip, port, proxyJump, controlPath, connectHost) + res := NewHostParams(creds, params.GetDevice(), ip, port, proxyJump, controlPath, connectHost, params.GetStreamerType()) return res, nil } diff --git a/pkg/server/proto/server.pb.go b/pkg/server/proto/server.pb.go index 6176636..e67cc64 100644 --- a/pkg/server/proto/server.pb.go +++ b/pkg/server/proto/server.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.3 +// protoc-gen-go v1.36.10 +// protoc v6.33.1 // source: server.proto package gnetcli @@ -13,6 +13,7 @@ import ( emptypb "google.golang.org/protobuf/types/known/emptypb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -123,6 +124,52 @@ func (DeviceResultStatus) EnumDescriptor() ([]byte, []int) { return file_server_proto_rawDescGZIP(), []int{1} } +type StreamerType int32 + +const ( + StreamerType_StreamerType_ssh StreamerType = 0 + StreamerType_StreamerType_telnet StreamerType = 1 +) + +// Enum value maps for StreamerType. +var ( + StreamerType_name = map[int32]string{ + 0: "StreamerType_ssh", + 1: "StreamerType_telnet", + } + StreamerType_value = map[string]int32{ + "StreamerType_ssh": 0, + "StreamerType_telnet": 1, + } +) + +func (x StreamerType) Enum() *StreamerType { + p := new(StreamerType) + *p = x + return p +} + +func (x StreamerType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (StreamerType) Descriptor() protoreflect.EnumDescriptor { + return file_server_proto_enumTypes[2].Descriptor() +} + +func (StreamerType) Type() protoreflect.EnumType { + return &file_server_proto_enumTypes[2] +} + +func (x StreamerType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use StreamerType.Descriptor instead. +func (StreamerType) EnumDescriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{2} +} + type FileStatus int32 const ( @@ -162,11 +209,11 @@ func (x FileStatus) String() string { } func (FileStatus) Descriptor() protoreflect.EnumDescriptor { - return file_server_proto_enumTypes[2].Descriptor() + return file_server_proto_enumTypes[3].Descriptor() } func (FileStatus) Type() protoreflect.EnumType { - return &file_server_proto_enumTypes[2] + return &file_server_proto_enumTypes[3] } func (x FileStatus) Number() protoreflect.EnumNumber { @@ -175,26 +222,23 @@ func (x FileStatus) Number() protoreflect.EnumNumber { // Deprecated: Use FileStatus.Descriptor instead. func (FileStatus) EnumDescriptor() ([]byte, []int) { - return file_server_proto_rawDescGZIP(), []int{2} + return file_server_proto_rawDescGZIP(), []int{3} } type QA struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Question string `protobuf:"bytes,1,opt,name=question,proto3" json:"question,omitempty"` + Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"` + NotSendNl bool `protobuf:"varint,3,opt,name=not_send_nl,json=notSendNl,proto3" json:"not_send_nl,omitempty"` unknownFields protoimpl.UnknownFields - - Question string `protobuf:"bytes,1,opt,name=question,proto3" json:"question,omitempty"` - Answer string `protobuf:"bytes,2,opt,name=answer,proto3" json:"answer,omitempty"` - NotSendNl bool `protobuf:"varint,3,opt,name=not_send_nl,json=notSendNl,proto3" json:"not_send_nl,omitempty"` + sizeCache protoimpl.SizeCache } func (x *QA) Reset() { *x = QA{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *QA) String() string { @@ -205,7 +249,7 @@ func (*QA) ProtoMessage() {} func (x *QA) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -242,21 +286,18 @@ func (x *QA) GetNotSendNl() bool { } type Credentials struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Login string `protobuf:"bytes,1,opt,name=login,proto3" json:"login,omitempty"` + Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` unknownFields protoimpl.UnknownFields - - Login string `protobuf:"bytes,1,opt,name=login,proto3" json:"login,omitempty"` - Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Credentials) Reset() { *x = Credentials{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Credentials) String() string { @@ -267,7 +308,7 @@ func (*Credentials) ProtoMessage() {} func (x *Credentials) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -297,27 +338,24 @@ func (x *Credentials) GetPassword() string { } type CMD struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` + Trace bool `protobuf:"varint,3,opt,name=trace,proto3" json:"trace,omitempty"` + Qa []*QA `protobuf:"bytes,4,rep,name=qa,proto3" json:"qa,omitempty"` + ReadTimeout float64 `protobuf:"fixed64,5,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` + CmdTimeout float64 `protobuf:"fixed64,6,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` + StringResult bool `protobuf:"varint,8,opt,name=string_result,json=stringResult,proto3" json:"string_result,omitempty"` + HostParams *HostParams `protobuf:"bytes,9,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` - Trace bool `protobuf:"varint,3,opt,name=trace,proto3" json:"trace,omitempty"` - Qa []*QA `protobuf:"bytes,4,rep,name=qa,proto3" json:"qa,omitempty"` - ReadTimeout float64 `protobuf:"fixed64,5,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` - CmdTimeout float64 `protobuf:"fixed64,6,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` - StringResult bool `protobuf:"varint,8,opt,name=string_result,json=stringResult,proto3" json:"string_result,omitempty"` - HostParams *HostParams `protobuf:"bytes,9,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CMD) Reset() { *x = CMD{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMD) String() string { @@ -328,7 +366,7 @@ func (*CMD) ProtoMessage() {} func (x *CMD) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -400,23 +438,20 @@ func (x *CMD) GetHostParams() *HostParams { } type Device struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - PromptExpression string `protobuf:"bytes,2,opt,name=prompt_expression,json=promptExpression,proto3" json:"prompt_expression,omitempty"` - ErrorExpression string `protobuf:"bytes,3,opt,name=error_expression,json=errorExpression,proto3" json:"error_expression,omitempty"` - PagerExpression string `protobuf:"bytes,4,opt,name=pager_expression,json=pagerExpression,proto3" json:"pager_expression,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + PromptExpression string `protobuf:"bytes,2,opt,name=prompt_expression,json=promptExpression,proto3" json:"prompt_expression,omitempty"` + ErrorExpression string `protobuf:"bytes,3,opt,name=error_expression,json=errorExpression,proto3" json:"error_expression,omitempty"` + PagerExpression string `protobuf:"bytes,4,opt,name=pager_expression,json=pagerExpression,proto3" json:"pager_expression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Device) Reset() { *x = Device{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Device) String() string { @@ -427,7 +462,7 @@ func (*Device) ProtoMessage() {} func (x *Device) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -471,24 +506,21 @@ func (x *Device) GetPagerExpression() string { } type CMDNetconf struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` + Json bool `protobuf:"varint,3,opt,name=json,proto3" json:"json,omitempty"` + ReadTimeout float64 `protobuf:"fixed64,4,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` // read timeout in seconds + CmdTimeout float64 `protobuf:"fixed64,5,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` // command execution timeout in seconds unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Cmd string `protobuf:"bytes,2,opt,name=cmd,proto3" json:"cmd,omitempty"` - Json bool `protobuf:"varint,3,opt,name=json,proto3" json:"json,omitempty"` - ReadTimeout float64 `protobuf:"fixed64,4,opt,name=read_timeout,json=readTimeout,proto3" json:"read_timeout,omitempty"` // read timeout in seconds - CmdTimeout float64 `protobuf:"fixed64,5,opt,name=cmd_timeout,json=cmdTimeout,proto3" json:"cmd_timeout,omitempty"` // command execution timeout in seconds + sizeCache protoimpl.SizeCache } func (x *CMDNetconf) Reset() { *x = CMDNetconf{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMDNetconf) String() string { @@ -499,7 +531,7 @@ func (*CMDNetconf) ProtoMessage() {} func (x *CMDNetconf) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -550,21 +582,18 @@ func (x *CMDNetconf) GetCmdTimeout() float64 { } type CMDTraceItem struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Operation TraceOperation `protobuf:"varint,1,opt,name=operation,proto3,enum=gnetcli.TraceOperation" json:"operation,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` unknownFields protoimpl.UnknownFields - - Operation TraceOperation `protobuf:"varint,1,opt,name=operation,proto3,enum=gnetcli.TraceOperation" json:"operation,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CMDTraceItem) Reset() { *x = CMDTraceItem{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMDTraceItem) String() string { @@ -575,7 +604,7 @@ func (*CMDTraceItem) ProtoMessage() {} func (x *CMDTraceItem) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -605,24 +634,22 @@ func (x *CMDTraceItem) GetData() []byte { } type HostParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Credentials *Credentials `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"` + Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` + Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` + Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"` + StreamerType StreamerType `protobuf:"varint,6,opt,name=streamer_type,json=streamerType,proto3,enum=gnetcli.StreamerType" json:"streamer_type,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Credentials *Credentials `protobuf:"bytes,2,opt,name=credentials,proto3" json:"credentials,omitempty"` - Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` - Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` - Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"` + sizeCache protoimpl.SizeCache } func (x *HostParams) Reset() { *x = HostParams{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *HostParams) String() string { @@ -633,7 +660,7 @@ func (*HostParams) ProtoMessage() {} func (x *HostParams) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -683,26 +710,30 @@ func (x *HostParams) GetIp() string { return "" } +func (x *HostParams) GetStreamerType() StreamerType { + if x != nil { + return x.StreamerType + } + return StreamerType_StreamerType_ssh +} + type CMDResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Out []byte `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` + OutStr string `protobuf:"bytes,2,opt,name=out_str,json=outStr,proto3" json:"out_str,omitempty"` + Error []byte `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` + ErrorStr string `protobuf:"bytes,4,opt,name=error_str,json=errorStr,proto3" json:"error_str,omitempty"` + Trace []*CMDTraceItem `protobuf:"bytes,5,rep,name=trace,proto3" json:"trace,omitempty"` + Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` unknownFields protoimpl.UnknownFields - - Out []byte `protobuf:"bytes,1,opt,name=out,proto3" json:"out,omitempty"` - OutStr string `protobuf:"bytes,2,opt,name=out_str,json=outStr,proto3" json:"out_str,omitempty"` - Error []byte `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` - ErrorStr string `protobuf:"bytes,4,opt,name=error_str,json=errorStr,proto3" json:"error_str,omitempty"` - Trace []*CMDTraceItem `protobuf:"bytes,5,rep,name=trace,proto3" json:"trace,omitempty"` - Status int32 `protobuf:"varint,6,opt,name=status,proto3" json:"status,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CMDResult) Reset() { *x = CMDResult{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CMDResult) String() string { @@ -713,7 +744,7 @@ func (*CMDResult) ProtoMessage() {} func (x *CMDResult) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -771,21 +802,18 @@ func (x *CMDResult) GetStatus() int32 { } type DeviceResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Res DeviceResultStatus `protobuf:"varint,1,opt,name=res,proto3,enum=gnetcli.DeviceResultStatus" json:"res,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` unknownFields protoimpl.UnknownFields - - Res DeviceResultStatus `protobuf:"varint,1,opt,name=res,proto3,enum=gnetcli.DeviceResultStatus" json:"res,omitempty"` - Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + sizeCache protoimpl.SizeCache } func (x *DeviceResult) Reset() { *x = DeviceResult{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *DeviceResult) String() string { @@ -796,7 +824,7 @@ func (*DeviceResult) ProtoMessage() {} func (x *DeviceResult) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -826,23 +854,20 @@ func (x *DeviceResult) GetError() string { } type FileDownloadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` + Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` + HostParams *HostParams `protobuf:"bytes,5,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Paths []string `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty"` - Device string `protobuf:"bytes,3,opt,name=device,proto3" json:"device,omitempty"` - HostParams *HostParams `protobuf:"bytes,5,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FileDownloadRequest) Reset() { *x = FileDownloadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileDownloadRequest) String() string { @@ -853,7 +878,7 @@ func (*FileDownloadRequest) ProtoMessage() {} func (x *FileDownloadRequest) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -897,22 +922,19 @@ func (x *FileDownloadRequest) GetHostParams() *HostParams { } type FileData struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Status FileStatus `protobuf:"varint,3,opt,name=status,proto3,enum=gnetcli.FileStatus" json:"status,omitempty"` unknownFields protoimpl.UnknownFields - - Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` - Status FileStatus `protobuf:"varint,3,opt,name=status,proto3,enum=gnetcli.FileStatus" json:"status,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FileData) Reset() { *x = FileData{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileData) String() string { @@ -923,7 +945,7 @@ func (*FileData) ProtoMessage() {} func (x *FileData) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -960,23 +982,20 @@ func (x *FileData) GetStatus() FileStatus { } type FileUploadRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` + Files []*FileData `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"` + HostParams *HostParams `protobuf:"bytes,6,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` unknownFields protoimpl.UnknownFields - - Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` - Device string `protobuf:"bytes,4,opt,name=device,proto3" json:"device,omitempty"` - Files []*FileData `protobuf:"bytes,3,rep,name=files,proto3" json:"files,omitempty"` - HostParams *HostParams `protobuf:"bytes,6,opt,name=host_params,json=hostParams,proto3" json:"host_params,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FileUploadRequest) Reset() { *x = FileUploadRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FileUploadRequest) String() string { @@ -987,7 +1006,7 @@ func (*FileUploadRequest) ProtoMessage() {} func (x *FileUploadRequest) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1031,20 +1050,17 @@ func (x *FileUploadRequest) GetHostParams() *HostParams { } type FilesResult struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Files []*FileData `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` unknownFields protoimpl.UnknownFields - - Files []*FileData `protobuf:"bytes,1,rep,name=files,proto3" json:"files,omitempty"` + sizeCache protoimpl.SizeCache } func (x *FilesResult) Reset() { *x = FilesResult{} - if protoimpl.UnsafeEnabled { - mi := &file_server_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_server_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *FilesResult) String() string { @@ -1055,7 +1071,7 @@ func (*FilesResult) ProtoMessage() {} func (x *FilesResult) ProtoReflect() protoreflect.Message { mi := &file_server_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1079,249 +1095,176 @@ func (x *FilesResult) GetFiles() []*FileData { var File_server_proto protoreflect.FileDescriptor -var file_server_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x58, 0x0a, 0x02, 0x51, 0x41, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6e, 0x73, 0x77, 0x65, 0x72, 0x12, 0x1e, 0x0a, 0x0b, - 0x6e, 0x6f, 0x74, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x6e, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x09, 0x6e, 0x6f, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6c, 0x22, 0x3f, 0x0a, 0x0b, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, - 0x6f, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, - 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0xfd, 0x01, - 0x0a, 0x03, 0x43, 0x4d, 0x44, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x6d, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, - 0x72, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, - 0x65, 0x12, 0x1b, 0x0a, 0x02, 0x71, 0x61, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x51, 0x41, 0x52, 0x02, 0x71, 0x61, 0x12, 0x21, - 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x6d, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x63, 0x6d, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x34, 0x0a, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, - 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x9f, 0x01, - 0x0a, 0x06, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, - 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x45, - 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x29, 0x0a, 0x10, 0x70, 0x61, 0x67, 0x65, 0x72, 0x5f, 0x65, 0x78, - 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x70, 0x61, 0x67, 0x65, 0x72, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, - 0x8a, 0x01, 0x0a, 0x0a, 0x43, 0x4d, 0x44, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, 0x12, 0x12, - 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, - 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x63, 0x6d, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61, 0x64, - 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0b, - 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x63, - 0x6d, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, - 0x52, 0x0a, 0x63, 0x6d, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x59, 0x0a, 0x0c, - 0x43, 0x4d, 0x44, 0x54, 0x72, 0x61, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x35, 0x0a, 0x09, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x17, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x94, 0x01, 0x0a, 0x0a, 0x48, 0x6f, 0x73, 0x74, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x63, 0x72, - 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x14, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x73, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, - 0x6c, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x22, 0xae, - 0x01, 0x0a, 0x09, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6f, 0x75, 0x74, 0x12, 0x17, - 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6f, 0x75, 0x74, 0x53, 0x74, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1b, 0x0a, - 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x53, 0x74, 0x72, 0x12, 0x2b, 0x0a, 0x05, 0x74, 0x72, - 0x61, 0x63, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x67, 0x6e, 0x65, 0x74, - 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x54, 0x72, 0x61, 0x63, 0x65, 0x49, 0x74, 0x65, 0x6d, - 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, - 0x53, 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, - 0x2d, 0x0a, 0x03, 0x72, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x67, - 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x03, 0x72, 0x65, 0x73, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, - 0x72, 0x72, 0x6f, 0x72, 0x22, 0x8d, 0x01, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x6f, 0x77, - 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x68, 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, - 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, - 0x0a, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x48, 0x6f, - 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5f, 0x0a, 0x08, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, - 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, - 0x6c, 0x69, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, - 0x6f, 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, - 0x16, 0x0a, 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, - 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, - 0x12, 0x34, 0x0a, 0x0b, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, - 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x68, 0x6f, 0x73, 0x74, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x36, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x27, 0x0a, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x2a, 0x66, - 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x14, 0x0a, 0x10, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x6f, - 0x74, 0x73, 0x65, 0x74, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x10, 0x01, 0x12, 0x13, 0x0a, - 0x0f, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, - 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x72, 0x65, 0x61, 0x64, 0x10, 0x03, 0x2a, 0x48, 0x0a, 0x12, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x11, 0x0a, 0x0d, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x6f, 0x74, 0x73, 0x65, 0x74, 0x10, 0x00, 0x12, - 0x0d, 0x0a, 0x09, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6f, 0x6b, 0x10, 0x01, 0x12, 0x10, - 0x0a, 0x0c, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, - 0x2a, 0x7d, 0x0a, 0x0a, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x15, - 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6e, 0x6f, 0x74, - 0x73, 0x65, 0x74, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x5f, 0x6f, 0x6b, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x10, 0x02, 0x12, 0x18, - 0x0a, 0x14, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6e, 0x6f, 0x74, - 0x5f, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x03, 0x12, 0x15, 0x0a, 0x11, 0x46, 0x69, 0x6c, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x69, 0x73, 0x5f, 0x64, 0x69, 0x72, 0x10, 0x04, 0x32, - 0x8c, 0x05, 0x0a, 0x07, 0x47, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x12, 0x64, 0x0a, 0x0f, 0x53, - 0x65, 0x74, 0x75, 0x70, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x13, - 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x24, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x1e, 0x22, 0x19, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x74, - 0x75, 0x70, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x01, - 0x2a, 0x12, 0x41, 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x0c, 0x2e, 0x67, 0x6e, 0x65, 0x74, - 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x1a, 0x12, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, - 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x17, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x11, 0x22, 0x0c, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x65, - 0x63, 0x3a, 0x01, 0x2a, 0x12, 0x32, 0x0a, 0x08, 0x45, 0x78, 0x65, 0x63, 0x43, 0x68, 0x61, 0x74, - 0x12, 0x0c, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x1a, 0x12, - 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x52, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x44, - 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x0f, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, - 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x1a, 0x15, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, - 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1d, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x61, - 0x64, 0x64, 0x5f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, 0x0b, - 0x45, 0x78, 0x65, 0x63, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, 0x12, 0x13, 0x2e, 0x67, 0x6e, - 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, - 0x1a, 0x12, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x61, - 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x78, 0x65, 0x63, 0x5f, 0x6e, 0x65, 0x74, 0x63, 0x6f, - 0x6e, 0x66, 0x3a, 0x01, 0x2a, 0x12, 0x40, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x4e, 0x65, 0x74, - 0x63, 0x6f, 0x6e, 0x66, 0x43, 0x68, 0x61, 0x74, 0x12, 0x13, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, - 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x4e, 0x65, 0x74, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x12, 0x2e, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x43, 0x4d, 0x44, 0x52, 0x65, 0x73, 0x75, 0x6c, - 0x74, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x5c, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, - 0x6f, 0x61, 0x64, 0x12, 0x1c, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, 0x69, - 0x6c, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x14, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x73, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x1c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x16, 0x22, - 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x73, 0x3a, 0x01, 0x2a, 0x12, 0x57, 0x0a, 0x06, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, - 0x1a, 0x2e, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x55, 0x70, - 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, - 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x0e, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x3a, 0x01, 0x2a, 0x42, 0x37, - 0x5a, 0x35, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x6e, 0x6e, - 0x65, 0x74, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x2f, 0x70, - 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, - 0x67, 0x6e, 0x65, 0x74, 0x63, 0x6c, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_server_proto_rawDesc = "" + + "\n" + + "\fserver.proto\x12\agnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\"X\n" + + "\x02QA\x12\x1a\n" + + "\bquestion\x18\x01 \x01(\tR\bquestion\x12\x16\n" + + "\x06answer\x18\x02 \x01(\tR\x06answer\x12\x1e\n" + + "\vnot_send_nl\x18\x03 \x01(\bR\tnotSendNl\"?\n" + + "\vCredentials\x12\x14\n" + + "\x05login\x18\x01 \x01(\tR\x05login\x12\x1a\n" + + "\bpassword\x18\x02 \x01(\tR\bpassword\"\xfd\x01\n" + + "\x03CMD\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x10\n" + + "\x03cmd\x18\x02 \x01(\tR\x03cmd\x12\x14\n" + + "\x05trace\x18\x03 \x01(\bR\x05trace\x12\x1b\n" + + "\x02qa\x18\x04 \x03(\v2\v.gnetcli.QAR\x02qa\x12!\n" + + "\fread_timeout\x18\x05 \x01(\x01R\vreadTimeout\x12\x1f\n" + + "\vcmd_timeout\x18\x06 \x01(\x01R\n" + + "cmdTimeout\x12#\n" + + "\rstring_result\x18\b \x01(\bR\fstringResult\x124\n" + + "\vhost_params\x18\t \x01(\v2\x13.gnetcli.HostParamsR\n" + + "hostParams\"\x9f\x01\n" + + "\x06Device\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12+\n" + + "\x11prompt_expression\x18\x02 \x01(\tR\x10promptExpression\x12)\n" + + "\x10error_expression\x18\x03 \x01(\tR\x0ferrorExpression\x12)\n" + + "\x10pager_expression\x18\x04 \x01(\tR\x0fpagerExpression\"\x8a\x01\n" + + "\n" + + "CMDNetconf\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x10\n" + + "\x03cmd\x18\x02 \x01(\tR\x03cmd\x12\x12\n" + + "\x04json\x18\x03 \x01(\bR\x04json\x12!\n" + + "\fread_timeout\x18\x04 \x01(\x01R\vreadTimeout\x12\x1f\n" + + "\vcmd_timeout\x18\x05 \x01(\x01R\n" + + "cmdTimeout\"Y\n" + + "\fCMDTraceItem\x125\n" + + "\toperation\x18\x01 \x01(\x0e2\x17.gnetcli.TraceOperationR\toperation\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\"\xd0\x01\n" + + "\n" + + "HostParams\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x126\n" + + "\vcredentials\x18\x02 \x01(\v2\x14.gnetcli.CredentialsR\vcredentials\x12\x12\n" + + "\x04port\x18\x03 \x01(\x05R\x04port\x12\x16\n" + + "\x06device\x18\x04 \x01(\tR\x06device\x12\x0e\n" + + "\x02ip\x18\x05 \x01(\tR\x02ip\x12:\n" + + "\rstreamer_type\x18\x06 \x01(\x0e2\x15.gnetcli.StreamerTypeR\fstreamerType\"\xae\x01\n" + + "\tCMDResult\x12\x10\n" + + "\x03out\x18\x01 \x01(\fR\x03out\x12\x17\n" + + "\aout_str\x18\x02 \x01(\tR\x06outStr\x12\x14\n" + + "\x05error\x18\x03 \x01(\fR\x05error\x12\x1b\n" + + "\terror_str\x18\x04 \x01(\tR\berrorStr\x12+\n" + + "\x05trace\x18\x05 \x03(\v2\x15.gnetcli.CMDTraceItemR\x05trace\x12\x16\n" + + "\x06status\x18\x06 \x01(\x05R\x06status\"S\n" + + "\fDeviceResult\x12-\n" + + "\x03res\x18\x01 \x01(\x0e2\x1b.gnetcli.DeviceResultStatusR\x03res\x12\x14\n" + + "\x05error\x18\x02 \x01(\tR\x05error\"\x8d\x01\n" + + "\x13FileDownloadRequest\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x14\n" + + "\x05paths\x18\x02 \x03(\tR\x05paths\x12\x16\n" + + "\x06device\x18\x03 \x01(\tR\x06device\x124\n" + + "\vhost_params\x18\x05 \x01(\v2\x13.gnetcli.HostParamsR\n" + + "hostParams\"_\n" + + "\bFileData\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\x12+\n" + + "\x06status\x18\x03 \x01(\x0e2\x13.gnetcli.FileStatusR\x06status\"\x9e\x01\n" + + "\x11FileUploadRequest\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12\x16\n" + + "\x06device\x18\x04 \x01(\tR\x06device\x12'\n" + + "\x05files\x18\x03 \x03(\v2\x11.gnetcli.FileDataR\x05files\x124\n" + + "\vhost_params\x18\x06 \x01(\v2\x13.gnetcli.HostParamsR\n" + + "hostParams\"6\n" + + "\vFilesResult\x12'\n" + + "\x05files\x18\x01 \x03(\v2\x11.gnetcli.FileDataR\x05files*f\n" + + "\x0eTraceOperation\x12\x14\n" + + "\x10Operation_notset\x10\x00\x12\x15\n" + + "\x11Operation_unknown\x10\x01\x12\x13\n" + + "\x0fOperation_write\x10\x02\x12\x12\n" + + "\x0eOperation_read\x10\x03*H\n" + + "\x12DeviceResultStatus\x12\x11\n" + + "\rDevice_notset\x10\x00\x12\r\n" + + "\tDevice_ok\x10\x01\x12\x10\n" + + "\fDevice_error\x10\x02*=\n" + + "\fStreamerType\x12\x14\n" + + "\x10StreamerType_ssh\x10\x00\x12\x17\n" + + "\x13StreamerType_telnet\x10\x01*}\n" + + "\n" + + "FileStatus\x12\x15\n" + + "\x11FileStatus_notset\x10\x00\x12\x11\n" + + "\rFileStatus_ok\x10\x01\x12\x14\n" + + "\x10FileStatus_error\x10\x02\x12\x18\n" + + "\x14FileStatus_not_found\x10\x03\x12\x15\n" + + "\x11FileStatus_is_dir\x10\x042\x8c\x05\n" + + "\aGnetcli\x12d\n" + + "\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e:\x01*\"\x19/api/v1/setup_host_params\x12A\n" + + "\x04Exec\x12\f.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11:\x01*\"\f/api/v1/exec\x122\n" + + "\bExecChat\x12\f.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x010\x01\x12R\n" + + "\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17:\x01*\"\x12/api/v1/add_device\x12W\n" + + "\vExecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19:\x01*\"\x14/api/v1/exec_netconf\x12@\n" + + "\x0fExecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x010\x01\x12\\\n" + + "\bDownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16:\x01*\"\x11/api/v1/downloads\x12W\n" + + "\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13:\x01*\"\x0e/api/v1/uploadB7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3" var ( file_server_proto_rawDescOnce sync.Once - file_server_proto_rawDescData = file_server_proto_rawDesc + file_server_proto_rawDescData []byte ) func file_server_proto_rawDescGZIP() []byte { file_server_proto_rawDescOnce.Do(func() { - file_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_server_proto_rawDescData) + file_server_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_server_proto_rawDesc), len(file_server_proto_rawDesc))) }) return file_server_proto_rawDescData } -var file_server_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_server_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_server_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_server_proto_goTypes = []interface{}{ +var file_server_proto_goTypes = []any{ (TraceOperation)(0), // 0: gnetcli.TraceOperation (DeviceResultStatus)(0), // 1: gnetcli.DeviceResultStatus - (FileStatus)(0), // 2: gnetcli.FileStatus - (*QA)(nil), // 3: gnetcli.QA - (*Credentials)(nil), // 4: gnetcli.Credentials - (*CMD)(nil), // 5: gnetcli.CMD - (*Device)(nil), // 6: gnetcli.Device - (*CMDNetconf)(nil), // 7: gnetcli.CMDNetconf - (*CMDTraceItem)(nil), // 8: gnetcli.CMDTraceItem - (*HostParams)(nil), // 9: gnetcli.HostParams - (*CMDResult)(nil), // 10: gnetcli.CMDResult - (*DeviceResult)(nil), // 11: gnetcli.DeviceResult - (*FileDownloadRequest)(nil), // 12: gnetcli.FileDownloadRequest - (*FileData)(nil), // 13: gnetcli.FileData - (*FileUploadRequest)(nil), // 14: gnetcli.FileUploadRequest - (*FilesResult)(nil), // 15: gnetcli.FilesResult - (*emptypb.Empty)(nil), // 16: google.protobuf.Empty + (StreamerType)(0), // 2: gnetcli.StreamerType + (FileStatus)(0), // 3: gnetcli.FileStatus + (*QA)(nil), // 4: gnetcli.QA + (*Credentials)(nil), // 5: gnetcli.Credentials + (*CMD)(nil), // 6: gnetcli.CMD + (*Device)(nil), // 7: gnetcli.Device + (*CMDNetconf)(nil), // 8: gnetcli.CMDNetconf + (*CMDTraceItem)(nil), // 9: gnetcli.CMDTraceItem + (*HostParams)(nil), // 10: gnetcli.HostParams + (*CMDResult)(nil), // 11: gnetcli.CMDResult + (*DeviceResult)(nil), // 12: gnetcli.DeviceResult + (*FileDownloadRequest)(nil), // 13: gnetcli.FileDownloadRequest + (*FileData)(nil), // 14: gnetcli.FileData + (*FileUploadRequest)(nil), // 15: gnetcli.FileUploadRequest + (*FilesResult)(nil), // 16: gnetcli.FilesResult + (*emptypb.Empty)(nil), // 17: google.protobuf.Empty } var file_server_proto_depIdxs = []int32{ - 3, // 0: gnetcli.CMD.qa:type_name -> gnetcli.QA - 9, // 1: gnetcli.CMD.host_params:type_name -> gnetcli.HostParams + 4, // 0: gnetcli.CMD.qa:type_name -> gnetcli.QA + 10, // 1: gnetcli.CMD.host_params:type_name -> gnetcli.HostParams 0, // 2: gnetcli.CMDTraceItem.operation:type_name -> gnetcli.TraceOperation - 4, // 3: gnetcli.HostParams.credentials:type_name -> gnetcli.Credentials - 8, // 4: gnetcli.CMDResult.trace:type_name -> gnetcli.CMDTraceItem - 1, // 5: gnetcli.DeviceResult.res:type_name -> gnetcli.DeviceResultStatus - 9, // 6: gnetcli.FileDownloadRequest.host_params:type_name -> gnetcli.HostParams - 2, // 7: gnetcli.FileData.status:type_name -> gnetcli.FileStatus - 13, // 8: gnetcli.FileUploadRequest.files:type_name -> gnetcli.FileData - 9, // 9: gnetcli.FileUploadRequest.host_params:type_name -> gnetcli.HostParams - 13, // 10: gnetcli.FilesResult.files:type_name -> gnetcli.FileData - 9, // 11: gnetcli.Gnetcli.SetupHostParams:input_type -> gnetcli.HostParams - 5, // 12: gnetcli.Gnetcli.Exec:input_type -> gnetcli.CMD - 5, // 13: gnetcli.Gnetcli.ExecChat:input_type -> gnetcli.CMD - 6, // 14: gnetcli.Gnetcli.AddDevice:input_type -> gnetcli.Device - 7, // 15: gnetcli.Gnetcli.ExecNetconf:input_type -> gnetcli.CMDNetconf - 7, // 16: gnetcli.Gnetcli.ExecNetconfChat:input_type -> gnetcli.CMDNetconf - 12, // 17: gnetcli.Gnetcli.Download:input_type -> gnetcli.FileDownloadRequest - 14, // 18: gnetcli.Gnetcli.Upload:input_type -> gnetcli.FileUploadRequest - 16, // 19: gnetcli.Gnetcli.SetupHostParams:output_type -> google.protobuf.Empty - 10, // 20: gnetcli.Gnetcli.Exec:output_type -> gnetcli.CMDResult - 10, // 21: gnetcli.Gnetcli.ExecChat:output_type -> gnetcli.CMDResult - 11, // 22: gnetcli.Gnetcli.AddDevice:output_type -> gnetcli.DeviceResult - 10, // 23: gnetcli.Gnetcli.ExecNetconf:output_type -> gnetcli.CMDResult - 10, // 24: gnetcli.Gnetcli.ExecNetconfChat:output_type -> gnetcli.CMDResult - 15, // 25: gnetcli.Gnetcli.Download:output_type -> gnetcli.FilesResult - 16, // 26: gnetcli.Gnetcli.Upload:output_type -> google.protobuf.Empty - 19, // [19:27] is the sub-list for method output_type - 11, // [11:19] is the sub-list for method input_type - 11, // [11:11] is the sub-list for extension type_name - 11, // [11:11] is the sub-list for extension extendee - 0, // [0:11] is the sub-list for field type_name + 5, // 3: gnetcli.HostParams.credentials:type_name -> gnetcli.Credentials + 2, // 4: gnetcli.HostParams.streamer_type:type_name -> gnetcli.StreamerType + 9, // 5: gnetcli.CMDResult.trace:type_name -> gnetcli.CMDTraceItem + 1, // 6: gnetcli.DeviceResult.res:type_name -> gnetcli.DeviceResultStatus + 10, // 7: gnetcli.FileDownloadRequest.host_params:type_name -> gnetcli.HostParams + 3, // 8: gnetcli.FileData.status:type_name -> gnetcli.FileStatus + 14, // 9: gnetcli.FileUploadRequest.files:type_name -> gnetcli.FileData + 10, // 10: gnetcli.FileUploadRequest.host_params:type_name -> gnetcli.HostParams + 14, // 11: gnetcli.FilesResult.files:type_name -> gnetcli.FileData + 10, // 12: gnetcli.Gnetcli.SetupHostParams:input_type -> gnetcli.HostParams + 6, // 13: gnetcli.Gnetcli.Exec:input_type -> gnetcli.CMD + 6, // 14: gnetcli.Gnetcli.ExecChat:input_type -> gnetcli.CMD + 7, // 15: gnetcli.Gnetcli.AddDevice:input_type -> gnetcli.Device + 8, // 16: gnetcli.Gnetcli.ExecNetconf:input_type -> gnetcli.CMDNetconf + 8, // 17: gnetcli.Gnetcli.ExecNetconfChat:input_type -> gnetcli.CMDNetconf + 13, // 18: gnetcli.Gnetcli.Download:input_type -> gnetcli.FileDownloadRequest + 15, // 19: gnetcli.Gnetcli.Upload:input_type -> gnetcli.FileUploadRequest + 17, // 20: gnetcli.Gnetcli.SetupHostParams:output_type -> google.protobuf.Empty + 11, // 21: gnetcli.Gnetcli.Exec:output_type -> gnetcli.CMDResult + 11, // 22: gnetcli.Gnetcli.ExecChat:output_type -> gnetcli.CMDResult + 12, // 23: gnetcli.Gnetcli.AddDevice:output_type -> gnetcli.DeviceResult + 11, // 24: gnetcli.Gnetcli.ExecNetconf:output_type -> gnetcli.CMDResult + 11, // 25: gnetcli.Gnetcli.ExecNetconfChat:output_type -> gnetcli.CMDResult + 16, // 26: gnetcli.Gnetcli.Download:output_type -> gnetcli.FilesResult + 17, // 27: gnetcli.Gnetcli.Upload:output_type -> google.protobuf.Empty + 20, // [20:28] is the sub-list for method output_type + 12, // [12:20] is the sub-list for method input_type + 12, // [12:12] is the sub-list for extension type_name + 12, // [12:12] is the sub-list for extension extendee + 0, // [0:12] is the sub-list for field type_name } func init() { file_server_proto_init() } @@ -1329,170 +1272,12 @@ func file_server_proto_init() { if File_server_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*QA); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Credentials); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMD); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Device); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMDNetconf); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMDTraceItem); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*HostParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CMDResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeviceResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileDownloadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileData); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FileUploadRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*FilesResult); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_server_proto_rawDesc, - NumEnums: 3, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_server_proto_rawDesc), len(file_server_proto_rawDesc)), + NumEnums: 4, NumMessages: 13, NumExtensions: 0, NumServices: 1, @@ -1503,7 +1288,6 @@ func file_server_proto_init() { MessageInfos: file_server_proto_msgTypes, }.Build() File_server_proto = out.File - file_server_proto_rawDesc = nil file_server_proto_goTypes = nil file_server_proto_depIdxs = nil } diff --git a/pkg/server/proto/server.proto b/pkg/server/proto/server.proto index 6a905df..9856964 100644 --- a/pkg/server/proto/server.proto +++ b/pkg/server/proto/server.proto @@ -56,6 +56,11 @@ enum DeviceResultStatus { Device_error = 2; } +enum StreamerType { + StreamerType_ssh = 0; + StreamerType_telnet = 1; +} + message CMDTraceItem { TraceOperation operation = 1; bytes data = 2; @@ -67,6 +72,7 @@ message HostParams { int32 port = 3; string device = 4; string ip = 5; + StreamerType streamer_type = 6; } message CMDResult { diff --git a/pkg/server/proto/server_grpc.pb.go b/pkg/server/proto/server_grpc.pb.go index c2518c7..ef12091 100644 --- a/pkg/server/proto/server_grpc.pb.go +++ b/pkg/server/proto/server_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v6.33.1 +// source: server.proto package gnetcli @@ -15,6 +19,17 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + Gnetcli_SetupHostParams_FullMethodName = "/gnetcli.Gnetcli/SetupHostParams" + Gnetcli_Exec_FullMethodName = "/gnetcli.Gnetcli/Exec" + Gnetcli_ExecChat_FullMethodName = "/gnetcli.Gnetcli/ExecChat" + Gnetcli_AddDevice_FullMethodName = "/gnetcli.Gnetcli/AddDevice" + Gnetcli_ExecNetconf_FullMethodName = "/gnetcli.Gnetcli/ExecNetconf" + Gnetcli_ExecNetconfChat_FullMethodName = "/gnetcli.Gnetcli/ExecNetconfChat" + Gnetcli_Download_FullMethodName = "/gnetcli.Gnetcli/Download" + Gnetcli_Upload_FullMethodName = "/gnetcli.Gnetcli/Upload" +) + // GnetcliClient is the client API for Gnetcli service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -39,7 +54,7 @@ func NewGnetcliClient(cc grpc.ClientConnInterface) GnetcliClient { func (c *gnetcliClient) SetupHostParams(ctx context.Context, in *HostParams, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/SetupHostParams", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_SetupHostParams_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -48,7 +63,7 @@ func (c *gnetcliClient) SetupHostParams(ctx context.Context, in *HostParams, opt func (c *gnetcliClient) Exec(ctx context.Context, in *CMD, opts ...grpc.CallOption) (*CMDResult, error) { out := new(CMDResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/Exec", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_Exec_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -56,7 +71,7 @@ func (c *gnetcliClient) Exec(ctx context.Context, in *CMD, opts ...grpc.CallOpti } func (c *gnetcliClient) ExecChat(ctx context.Context, opts ...grpc.CallOption) (Gnetcli_ExecChatClient, error) { - stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[0], "/gnetcli.Gnetcli/ExecChat", opts...) + stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[0], Gnetcli_ExecChat_FullMethodName, opts...) if err != nil { return nil, err } @@ -88,7 +103,7 @@ func (x *gnetcliExecChatClient) Recv() (*CMDResult, error) { func (c *gnetcliClient) AddDevice(ctx context.Context, in *Device, opts ...grpc.CallOption) (*DeviceResult, error) { out := new(DeviceResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/AddDevice", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_AddDevice_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -97,7 +112,7 @@ func (c *gnetcliClient) AddDevice(ctx context.Context, in *Device, opts ...grpc. func (c *gnetcliClient) ExecNetconf(ctx context.Context, in *CMDNetconf, opts ...grpc.CallOption) (*CMDResult, error) { out := new(CMDResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/ExecNetconf", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_ExecNetconf_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -105,7 +120,7 @@ func (c *gnetcliClient) ExecNetconf(ctx context.Context, in *CMDNetconf, opts .. } func (c *gnetcliClient) ExecNetconfChat(ctx context.Context, opts ...grpc.CallOption) (Gnetcli_ExecNetconfChatClient, error) { - stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[1], "/gnetcli.Gnetcli/ExecNetconfChat", opts...) + stream, err := c.cc.NewStream(ctx, &Gnetcli_ServiceDesc.Streams[1], Gnetcli_ExecNetconfChat_FullMethodName, opts...) if err != nil { return nil, err } @@ -137,7 +152,7 @@ func (x *gnetcliExecNetconfChatClient) Recv() (*CMDResult, error) { func (c *gnetcliClient) Download(ctx context.Context, in *FileDownloadRequest, opts ...grpc.CallOption) (*FilesResult, error) { out := new(FilesResult) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/Download", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_Download_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -146,7 +161,7 @@ func (c *gnetcliClient) Download(ctx context.Context, in *FileDownloadRequest, o func (c *gnetcliClient) Upload(ctx context.Context, in *FileUploadRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { out := new(emptypb.Empty) - err := c.cc.Invoke(ctx, "/gnetcli.Gnetcli/Upload", in, out, opts...) + err := c.cc.Invoke(ctx, Gnetcli_Upload_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -219,7 +234,7 @@ func _Gnetcli_SetupHostParams_Handler(srv interface{}, ctx context.Context, dec } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/SetupHostParams", + FullMethod: Gnetcli_SetupHostParams_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).SetupHostParams(ctx, req.(*HostParams)) @@ -237,7 +252,7 @@ func _Gnetcli_Exec_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/Exec", + FullMethod: Gnetcli_Exec_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).Exec(ctx, req.(*CMD)) @@ -281,7 +296,7 @@ func _Gnetcli_AddDevice_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/AddDevice", + FullMethod: Gnetcli_AddDevice_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).AddDevice(ctx, req.(*Device)) @@ -299,7 +314,7 @@ func _Gnetcli_ExecNetconf_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/ExecNetconf", + FullMethod: Gnetcli_ExecNetconf_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).ExecNetconf(ctx, req.(*CMDNetconf)) @@ -343,7 +358,7 @@ func _Gnetcli_Download_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/Download", + FullMethod: Gnetcli_Download_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).Download(ctx, req.(*FileDownloadRequest)) @@ -361,7 +376,7 @@ func _Gnetcli_Upload_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/gnetcli.Gnetcli/Upload", + FullMethod: Gnetcli_Upload_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(GnetcliServer).Upload(ctx, req.(*FileUploadRequest)) diff --git a/pkg/server/proto/server_pb2.py b/pkg/server/proto/server_pb2.py index 9d0b77a..2cd547b 100644 --- a/pkg/server/proto/server_pb2.py +++ b/pkg/server/proto/server_pb2.py @@ -1,12 +1,22 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE # source: server.proto -# Protobuf Python Version: 4.25.1 +# Protobuf Python Version: 6.31.1 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 6, + 31, + 1, + '', + 'server.proto' +) # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() @@ -16,32 +26,34 @@ from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x12\x07gnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\";\n\x02QA\x12\x10\n\x08question\x18\x01 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x02 \x01(\t\x12\x13\n\x0bnot_send_nl\x18\x03 \x01(\x08\".\n\x0b\x43redentials\x12\r\n\x05login\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xb4\x01\n\x03\x43MD\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\r\n\x05trace\x18\x03 \x01(\x08\x12\x17\n\x02qa\x18\x04 \x03(\x0b\x32\x0b.gnetcli.QA\x12\x14\n\x0cread_timeout\x18\x05 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x06 \x01(\x01\x12\x15\n\rstring_result\x18\x08 \x01(\x08\x12(\n\x0bhost_params\x18\t \x01(\x0b\x32\x13.gnetcli.HostParams\"e\n\x06\x44\x65vice\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11prompt_expression\x18\x02 \x01(\t\x12\x18\n\x10\x65rror_expression\x18\x03 \x01(\t\x12\x18\n\x10pager_expression\x18\x04 \x01(\t\"`\n\nCMDNetconf\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\x0c\n\x04json\x18\x03 \x01(\x08\x12\x14\n\x0cread_timeout\x18\x04 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x05 \x01(\x01\"H\n\x0c\x43MDTraceItem\x12*\n\toperation\x18\x01 \x01(\x0e\x32\x17.gnetcli.TraceOperation\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"o\n\nHostParams\x12\x0c\n\x04host\x18\x01 \x01(\t\x12)\n\x0b\x63redentials\x18\x02 \x01(\x0b\x32\x14.gnetcli.Credentials\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12\n\n\x02ip\x18\x05 \x01(\t\"\x81\x01\n\tCMDResult\x12\x0b\n\x03out\x18\x01 \x01(\x0c\x12\x0f\n\x07out_str\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\x0c\x12\x11\n\terror_str\x18\x04 \x01(\t\x12$\n\x05trace\x18\x05 \x03(\x0b\x32\x15.gnetcli.CMDTraceItem\x12\x0e\n\x06status\x18\x06 \x01(\x05\"G\n\x0c\x44\x65viceResult\x12(\n\x03res\x18\x01 \x01(\x0e\x32\x1b.gnetcli.DeviceResultStatus\x12\r\n\x05\x65rror\x18\x02 \x01(\t\"l\n\x13\x46ileDownloadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x03 \x01(\t\x12(\n\x0bhost_params\x18\x05 \x01(\x0b\x32\x13.gnetcli.HostParams\"K\n\x08\x46ileData\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12#\n\x06status\x18\x03 \x01(\x0e\x32\x13.gnetcli.FileStatus\"}\n\x11\x46ileUploadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12 \n\x05\x66iles\x18\x03 \x03(\x0b\x32\x11.gnetcli.FileData\x12(\n\x0bhost_params\x18\x06 \x01(\x0b\x32\x13.gnetcli.HostParams\"/\n\x0b\x46ilesResult\x12 \n\x05\x66iles\x18\x01 \x03(\x0b\x32\x11.gnetcli.FileData*f\n\x0eTraceOperation\x12\x14\n\x10Operation_notset\x10\x00\x12\x15\n\x11Operation_unknown\x10\x01\x12\x13\n\x0fOperation_write\x10\x02\x12\x12\n\x0eOperation_read\x10\x03*H\n\x12\x44\x65viceResultStatus\x12\x11\n\rDevice_notset\x10\x00\x12\r\n\tDevice_ok\x10\x01\x12\x10\n\x0c\x44\x65vice_error\x10\x02*}\n\nFileStatus\x12\x15\n\x11\x46ileStatus_notset\x10\x00\x12\x11\n\rFileStatus_ok\x10\x01\x12\x14\n\x10\x46ileStatus_error\x10\x02\x12\x18\n\x14\x46ileStatus_not_found\x10\x03\x12\x15\n\x11\x46ileStatus_is_dir\x10\x04\x32\x8c\x05\n\x07Gnetcli\x12\x64\n\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/api/v1/setup_host_params:\x01*\x12\x41\n\x04\x45xec\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/api/v1/exec:\x01*\x12\x32\n\x08\x45xecChat\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12R\n\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/api/v1/add_device:\x01*\x12W\n\x0b\x45xecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/api/v1/exec_netconf:\x01*\x12@\n\x0f\x45xecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12\\\n\x08\x44ownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/api/v1/downloads:\x01*\x12W\n\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x0e/api/v1/upload:\x01*B7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x12\x07gnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\";\n\x02QA\x12\x10\n\x08question\x18\x01 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x02 \x01(\t\x12\x13\n\x0bnot_send_nl\x18\x03 \x01(\x08\".\n\x0b\x43redentials\x12\r\n\x05login\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xb4\x01\n\x03\x43MD\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\r\n\x05trace\x18\x03 \x01(\x08\x12\x17\n\x02qa\x18\x04 \x03(\x0b\x32\x0b.gnetcli.QA\x12\x14\n\x0cread_timeout\x18\x05 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x06 \x01(\x01\x12\x15\n\rstring_result\x18\x08 \x01(\x08\x12(\n\x0bhost_params\x18\t \x01(\x0b\x32\x13.gnetcli.HostParams\"e\n\x06\x44\x65vice\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11prompt_expression\x18\x02 \x01(\t\x12\x18\n\x10\x65rror_expression\x18\x03 \x01(\t\x12\x18\n\x10pager_expression\x18\x04 \x01(\t\"`\n\nCMDNetconf\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\x0c\n\x04json\x18\x03 \x01(\x08\x12\x14\n\x0cread_timeout\x18\x04 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x05 \x01(\x01\"H\n\x0c\x43MDTraceItem\x12*\n\toperation\x18\x01 \x01(\x0e\x32\x17.gnetcli.TraceOperation\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"\x9d\x01\n\nHostParams\x12\x0c\n\x04host\x18\x01 \x01(\t\x12)\n\x0b\x63redentials\x18\x02 \x01(\x0b\x32\x14.gnetcli.Credentials\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12\n\n\x02ip\x18\x05 \x01(\t\x12,\n\rstreamer_type\x18\x06 \x01(\x0e\x32\x15.gnetcli.StreamerType\"\x81\x01\n\tCMDResult\x12\x0b\n\x03out\x18\x01 \x01(\x0c\x12\x0f\n\x07out_str\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\x0c\x12\x11\n\terror_str\x18\x04 \x01(\t\x12$\n\x05trace\x18\x05 \x03(\x0b\x32\x15.gnetcli.CMDTraceItem\x12\x0e\n\x06status\x18\x06 \x01(\x05\"G\n\x0c\x44\x65viceResult\x12(\n\x03res\x18\x01 \x01(\x0e\x32\x1b.gnetcli.DeviceResultStatus\x12\r\n\x05\x65rror\x18\x02 \x01(\t\"l\n\x13\x46ileDownloadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x03 \x01(\t\x12(\n\x0bhost_params\x18\x05 \x01(\x0b\x32\x13.gnetcli.HostParams\"K\n\x08\x46ileData\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12#\n\x06status\x18\x03 \x01(\x0e\x32\x13.gnetcli.FileStatus\"}\n\x11\x46ileUploadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12 \n\x05\x66iles\x18\x03 \x03(\x0b\x32\x11.gnetcli.FileData\x12(\n\x0bhost_params\x18\x06 \x01(\x0b\x32\x13.gnetcli.HostParams\"/\n\x0b\x46ilesResult\x12 \n\x05\x66iles\x18\x01 \x03(\x0b\x32\x11.gnetcli.FileData*f\n\x0eTraceOperation\x12\x14\n\x10Operation_notset\x10\x00\x12\x15\n\x11Operation_unknown\x10\x01\x12\x13\n\x0fOperation_write\x10\x02\x12\x12\n\x0eOperation_read\x10\x03*H\n\x12\x44\x65viceResultStatus\x12\x11\n\rDevice_notset\x10\x00\x12\r\n\tDevice_ok\x10\x01\x12\x10\n\x0c\x44\x65vice_error\x10\x02*=\n\x0cStreamerType\x12\x14\n\x10StreamerType_ssh\x10\x00\x12\x17\n\x13StreamerType_telnet\x10\x01*}\n\nFileStatus\x12\x15\n\x11\x46ileStatus_notset\x10\x00\x12\x11\n\rFileStatus_ok\x10\x01\x12\x14\n\x10\x46ileStatus_error\x10\x02\x12\x18\n\x14\x46ileStatus_not_found\x10\x03\x12\x15\n\x11\x46ileStatus_is_dir\x10\x04\x32\x8c\x05\n\x07Gnetcli\x12\x64\n\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/api/v1/setup_host_params:\x01*\x12\x41\n\x04\x45xec\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/api/v1/exec:\x01*\x12\x32\n\x08\x45xecChat\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12R\n\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/api/v1/add_device:\x01*\x12W\n\x0b\x45xecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/api/v1/exec_netconf:\x01*\x12@\n\x0f\x45xecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12\\\n\x08\x44ownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/api/v1/downloads:\x01*\x12W\n\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x0e/api/v1/upload:\x01*B7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'server_pb2', _globals) -if _descriptor._USE_C_DESCRIPTORS == False: - _globals['DESCRIPTOR']._options = None +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._serialized_options = b'Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetcli' - _globals['_GNETCLI'].methods_by_name['SetupHostParams']._options = None + _globals['_GNETCLI'].methods_by_name['SetupHostParams']._loaded_options = None _globals['_GNETCLI'].methods_by_name['SetupHostParams']._serialized_options = b'\202\323\344\223\002\036\"\031/api/v1/setup_host_params:\001*' - _globals['_GNETCLI'].methods_by_name['Exec']._options = None + _globals['_GNETCLI'].methods_by_name['Exec']._loaded_options = None _globals['_GNETCLI'].methods_by_name['Exec']._serialized_options = b'\202\323\344\223\002\021\"\014/api/v1/exec:\001*' - _globals['_GNETCLI'].methods_by_name['AddDevice']._options = None + _globals['_GNETCLI'].methods_by_name['AddDevice']._loaded_options = None _globals['_GNETCLI'].methods_by_name['AddDevice']._serialized_options = b'\202\323\344\223\002\027\"\022/api/v1/add_device:\001*' - _globals['_GNETCLI'].methods_by_name['ExecNetconf']._options = None + _globals['_GNETCLI'].methods_by_name['ExecNetconf']._loaded_options = None _globals['_GNETCLI'].methods_by_name['ExecNetconf']._serialized_options = b'\202\323\344\223\002\031\"\024/api/v1/exec_netconf:\001*' - _globals['_GNETCLI'].methods_by_name['Download']._options = None + _globals['_GNETCLI'].methods_by_name['Download']._loaded_options = None _globals['_GNETCLI'].methods_by_name['Download']._serialized_options = b'\202\323\344\223\002\026\"\021/api/v1/downloads:\001*' - _globals['_GNETCLI'].methods_by_name['Upload']._options = None + _globals['_GNETCLI'].methods_by_name['Upload']._loaded_options = None _globals['_GNETCLI'].methods_by_name['Upload']._serialized_options = b'\202\323\344\223\002\023\"\016/api/v1/upload:\001*' - _globals['_TRACEOPERATION']._serialized_start=1332 - _globals['_TRACEOPERATION']._serialized_end=1434 - _globals['_DEVICERESULTSTATUS']._serialized_start=1436 - _globals['_DEVICERESULTSTATUS']._serialized_end=1508 - _globals['_FILESTATUS']._serialized_start=1510 - _globals['_FILESTATUS']._serialized_end=1635 + _globals['_TRACEOPERATION']._serialized_start=1379 + _globals['_TRACEOPERATION']._serialized_end=1481 + _globals['_DEVICERESULTSTATUS']._serialized_start=1483 + _globals['_DEVICERESULTSTATUS']._serialized_end=1555 + _globals['_STREAMERTYPE']._serialized_start=1557 + _globals['_STREAMERTYPE']._serialized_end=1618 + _globals['_FILESTATUS']._serialized_start=1620 + _globals['_FILESTATUS']._serialized_end=1745 _globals['_QA']._serialized_start=84 _globals['_QA']._serialized_end=143 _globals['_CREDENTIALS']._serialized_start=145 @@ -54,20 +66,20 @@ _globals['_CMDNETCONF']._serialized_end=575 _globals['_CMDTRACEITEM']._serialized_start=577 _globals['_CMDTRACEITEM']._serialized_end=649 - _globals['_HOSTPARAMS']._serialized_start=651 - _globals['_HOSTPARAMS']._serialized_end=762 - _globals['_CMDRESULT']._serialized_start=765 - _globals['_CMDRESULT']._serialized_end=894 - _globals['_DEVICERESULT']._serialized_start=896 - _globals['_DEVICERESULT']._serialized_end=967 - _globals['_FILEDOWNLOADREQUEST']._serialized_start=969 - _globals['_FILEDOWNLOADREQUEST']._serialized_end=1077 - _globals['_FILEDATA']._serialized_start=1079 - _globals['_FILEDATA']._serialized_end=1154 - _globals['_FILEUPLOADREQUEST']._serialized_start=1156 - _globals['_FILEUPLOADREQUEST']._serialized_end=1281 - _globals['_FILESRESULT']._serialized_start=1283 - _globals['_FILESRESULT']._serialized_end=1330 - _globals['_GNETCLI']._serialized_start=1638 - _globals['_GNETCLI']._serialized_end=2290 + _globals['_HOSTPARAMS']._serialized_start=652 + _globals['_HOSTPARAMS']._serialized_end=809 + _globals['_CMDRESULT']._serialized_start=812 + _globals['_CMDRESULT']._serialized_end=941 + _globals['_DEVICERESULT']._serialized_start=943 + _globals['_DEVICERESULT']._serialized_end=1014 + _globals['_FILEDOWNLOADREQUEST']._serialized_start=1016 + _globals['_FILEDOWNLOADREQUEST']._serialized_end=1124 + _globals['_FILEDATA']._serialized_start=1126 + _globals['_FILEDATA']._serialized_end=1201 + _globals['_FILEUPLOADREQUEST']._serialized_start=1203 + _globals['_FILEUPLOADREQUEST']._serialized_end=1328 + _globals['_FILESRESULT']._serialized_start=1330 + _globals['_FILESRESULT']._serialized_end=1377 + _globals['_GNETCLI']._serialized_start=1748 + _globals['_GNETCLI']._serialized_end=2400 # @@protoc_insertion_point(module_scope) diff --git a/pkg/server/proto/server_pb2.pyi b/pkg/server/proto/server_pb2.pyi index 2b1409c..e147da4 100644 --- a/pkg/server/proto/server_pb2.pyi +++ b/pkg/server/proto/server_pb2.pyi @@ -4,7 +4,8 @@ from google.protobuf.internal import containers as _containers from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message -from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union +from collections.abc import Iterable as _Iterable, Mapping as _Mapping +from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union DESCRIPTOR: _descriptor.FileDescriptor @@ -21,6 +22,11 @@ class DeviceResultStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): Device_ok: _ClassVar[DeviceResultStatus] Device_error: _ClassVar[DeviceResultStatus] +class StreamerType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + StreamerType_ssh: _ClassVar[StreamerType] + StreamerType_telnet: _ClassVar[StreamerType] + class FileStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () FileStatus_notset: _ClassVar[FileStatus] @@ -35,6 +41,8 @@ Operation_read: TraceOperation Device_notset: DeviceResultStatus Device_ok: DeviceResultStatus Device_error: DeviceResultStatus +StreamerType_ssh: StreamerType +StreamerType_telnet: StreamerType FileStatus_notset: FileStatus FileStatus_ok: FileStatus FileStatus_error: FileStatus @@ -114,18 +122,20 @@ class CMDTraceItem(_message.Message): def __init__(self, operation: _Optional[_Union[TraceOperation, str]] = ..., data: _Optional[bytes] = ...) -> None: ... class HostParams(_message.Message): - __slots__ = ("host", "credentials", "port", "device", "ip") + __slots__ = ("host", "credentials", "port", "device", "ip", "streamer_type") HOST_FIELD_NUMBER: _ClassVar[int] CREDENTIALS_FIELD_NUMBER: _ClassVar[int] PORT_FIELD_NUMBER: _ClassVar[int] DEVICE_FIELD_NUMBER: _ClassVar[int] IP_FIELD_NUMBER: _ClassVar[int] + STREAMER_TYPE_FIELD_NUMBER: _ClassVar[int] host: str credentials: Credentials port: int device: str ip: str - def __init__(self, host: _Optional[str] = ..., credentials: _Optional[_Union[Credentials, _Mapping]] = ..., port: _Optional[int] = ..., device: _Optional[str] = ..., ip: _Optional[str] = ...) -> None: ... + streamer_type: StreamerType + def __init__(self, host: _Optional[str] = ..., credentials: _Optional[_Union[Credentials, _Mapping]] = ..., port: _Optional[int] = ..., device: _Optional[str] = ..., ip: _Optional[str] = ..., streamer_type: _Optional[_Union[StreamerType, str]] = ...) -> None: ... class CMDResult(_message.Message): __slots__ = ("out", "out_str", "error", "error_str", "trace", "status") diff --git a/pkg/server/proto/server_pb2_grpc.py b/pkg/server/proto/server_pb2_grpc.py index 489f79d..1145f94 100644 --- a/pkg/server/proto/server_pb2_grpc.py +++ b/pkg/server/proto/server_pb2_grpc.py @@ -1,10 +1,30 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc +import warnings from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 from . import server_pb2 as server__pb2 +GRPC_GENERATED_VERSION = '1.76.0' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + ' but the generated code in server_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + class GnetcliStub(object): """Missing associated documentation comment in .proto file.""" @@ -19,42 +39,42 @@ def __init__(self, channel): '/gnetcli.Gnetcli/SetupHostParams', request_serializer=server__pb2.HostParams.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) self.Exec = channel.unary_unary( '/gnetcli.Gnetcli/Exec', request_serializer=server__pb2.CMD.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.ExecChat = channel.stream_stream( '/gnetcli.Gnetcli/ExecChat', request_serializer=server__pb2.CMD.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.AddDevice = channel.unary_unary( '/gnetcli.Gnetcli/AddDevice', request_serializer=server__pb2.Device.SerializeToString, response_deserializer=server__pb2.DeviceResult.FromString, - ) + _registered_method=True) self.ExecNetconf = channel.unary_unary( '/gnetcli.Gnetcli/ExecNetconf', request_serializer=server__pb2.CMDNetconf.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.ExecNetconfChat = channel.stream_stream( '/gnetcli.Gnetcli/ExecNetconfChat', request_serializer=server__pb2.CMDNetconf.SerializeToString, response_deserializer=server__pb2.CMDResult.FromString, - ) + _registered_method=True) self.Download = channel.unary_unary( '/gnetcli.Gnetcli/Download', request_serializer=server__pb2.FileDownloadRequest.SerializeToString, response_deserializer=server__pb2.FilesResult.FromString, - ) + _registered_method=True) self.Upload = channel.unary_unary( '/gnetcli.Gnetcli/Upload', request_serializer=server__pb2.FileUploadRequest.SerializeToString, response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, - ) + _registered_method=True) class GnetcliServicer(object): @@ -155,6 +175,7 @@ def add_GnetcliServicer_to_server(servicer, server): generic_handler = grpc.method_handlers_generic_handler( 'gnetcli.Gnetcli', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('gnetcli.Gnetcli', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. @@ -172,11 +193,21 @@ def SetupHostParams(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/SetupHostParams', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/SetupHostParams', server__pb2.HostParams.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Exec(request, @@ -189,11 +220,21 @@ def Exec(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/Exec', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Exec', server__pb2.CMD.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def ExecChat(request_iterator, @@ -206,11 +247,21 @@ def ExecChat(request_iterator, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.stream_stream(request_iterator, target, '/gnetcli.Gnetcli/ExecChat', + return grpc.experimental.stream_stream( + request_iterator, + target, + '/gnetcli.Gnetcli/ExecChat', server__pb2.CMD.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def AddDevice(request, @@ -223,11 +274,21 @@ def AddDevice(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/AddDevice', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/AddDevice', server__pb2.Device.SerializeToString, server__pb2.DeviceResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def ExecNetconf(request, @@ -240,11 +301,21 @@ def ExecNetconf(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/ExecNetconf', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/ExecNetconf', server__pb2.CMDNetconf.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def ExecNetconfChat(request_iterator, @@ -257,11 +328,21 @@ def ExecNetconfChat(request_iterator, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.stream_stream(request_iterator, target, '/gnetcli.Gnetcli/ExecNetconfChat', + return grpc.experimental.stream_stream( + request_iterator, + target, + '/gnetcli.Gnetcli/ExecNetconfChat', server__pb2.CMDNetconf.SerializeToString, server__pb2.CMDResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Download(request, @@ -274,11 +355,21 @@ def Download(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/Download', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Download', server__pb2.FileDownloadRequest.SerializeToString, server__pb2.FilesResult.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) @staticmethod def Upload(request, @@ -291,8 +382,18 @@ def Upload(request, wait_for_ready=None, timeout=None, metadata=None): - return grpc.experimental.unary_unary(request, target, '/gnetcli.Gnetcli/Upload', + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Upload', server__pb2.FileUploadRequest.SerializeToString, google_dot_protobuf_dot_empty__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/pkg/server/server.go b/pkg/server/server.go index 9da392f..1213c4f 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -32,6 +32,7 @@ import ( pb "github.com/annetutil/gnetcli/pkg/server/proto" "github.com/annetutil/gnetcli/pkg/streamer" "github.com/annetutil/gnetcli/pkg/streamer/ssh" + "github.com/annetutil/gnetcli/pkg/streamer/telnet" gtrace "github.com/annetutil/gnetcli/pkg/trace" ) @@ -63,13 +64,14 @@ type Server struct { } type hostParams struct { - port int - device string - creds credentials.Credentials - ip netip.Addr - proxyJump string - controlPath string - host string + port int + device string + creds credentials.Credentials + ip netip.Addr + proxyJump string + controlPath string + host string + streamerType pb.StreamerType } func makeGRPCDeviceExecError(err error) error { @@ -88,15 +90,16 @@ func makeGRPCDeviceExecError(err error) error { return rv.Err() } -func NewHostParams(creds credentials.Credentials, device string, ip netip.Addr, port int, proxyJump, controlPath, host string) hostParams { +func NewHostParams(creds credentials.Credentials, device string, ip netip.Addr, port int, proxyJump, controlPath, host string, streamerType pb.StreamerType) hostParams { return hostParams{ - port: port, - device: device, - creds: creds, - ip: ip, - proxyJump: proxyJump, - controlPath: controlPath, - host: host, + port: port, + device: device, + creds: creds, + ip: ip, + proxyJump: proxyJump, + controlPath: controlPath, + host: host, + streamerType: streamerType, } } @@ -174,34 +177,51 @@ func (m *Server) makeDevice(hostname string, params hostParams, add func(op gtra creds = defcreds } deviceType := params.GetDevice() - streamerOpts := []ssh.StreamerOption{ssh.WithLogger(logger), ssh.WithTrace(add)} connHost, port := m.makeConnectArg(hostname, params) - if port > 0 { - streamerOpts = append(streamerOpts, ssh.WithPort(port)) - } - if params.proxyJump != "" { - jumpHostParams, err := m.getHostParams(params.proxyJump, nil) - if err != nil { - return nil, fmt.Errorf("unable to get host params for ssh tunnel to %s:%w", params.proxyJump, err) + + var connector streamer.Connector + + // Choose streamer based on streamer type + if params.streamerType == pb.StreamerType_StreamerType_telnet { + // Telnet streamer + telnetOpts := []telnet.StreamerOption{telnet.WithLogger(logger), telnet.WithTrace(add)} + if port > 0 { + telnetOpts = append(telnetOpts, telnet.WithPort(port)) } - opts := []ssh.SSHTunnelOption{ssh.SSHTunnelWithLogger(logger)} - if len(jumpHostParams.controlPath) > 0 { - opts = append(opts, ssh.SSHTunnelWithControlFIle(jumpHostParams.controlPath)) + connector = telnet.NewStreamer(connHost, creds, telnetOpts...) + logger.Debug("using telnet streamer", zap.String("host", connHost), zap.Int("port", port)) + } else { + // SSH streamer (default) + streamerOpts := []ssh.StreamerOption{ssh.WithLogger(logger), ssh.WithTrace(add)} + if port > 0 { + streamerOpts = append(streamerOpts, ssh.WithPort(port)) } - connHost = params.host - tun := ssh.NewSSHTunnel(jumpHostParams.host, jumpHostParams.GetCredentials(), opts...) - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - err = tun.CreateConnect(ctx) - if err != nil { - return nil, fmt.Errorf("unable to open ssh tunnel to %s:%w", params.proxyJump, err) + if params.proxyJump != "" { + jumpHostParams, err := m.getHostParams(params.proxyJump, nil) + if err != nil { + return nil, fmt.Errorf("unable to get host params for ssh tunnel to %s:%w", params.proxyJump, err) + } + opts := []ssh.SSHTunnelOption{ssh.SSHTunnelWithLogger(logger)} + if len(jumpHostParams.controlPath) > 0 { + opts = append(opts, ssh.SSHTunnelWithControlFIle(jumpHostParams.controlPath)) + } + connHost = params.host + tun := ssh.NewSSHTunnel(jumpHostParams.host, jumpHostParams.GetCredentials(), opts...) + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + err = tun.CreateConnect(ctx) + if err != nil { + return nil, fmt.Errorf("unable to open ssh tunnel to %s:%w", params.proxyJump, err) + } + streamerOpts = append(streamerOpts, ssh.WithSSHTunnel(tun)) } - streamerOpts = append(streamerOpts, ssh.WithSSHTunnel(tun)) - } - if params.controlPath != "" { - streamerOpts = append(streamerOpts, ssh.WithSSHControlFIle(params.controlPath)) + if params.controlPath != "" { + streamerOpts = append(streamerOpts, ssh.WithSSHControlFIle(params.controlPath)) + } + connector = ssh.NewStreamer(connHost, creds, streamerOpts...) + logger.Debug("using ssh streamer", zap.String("host", connHost), zap.Int("port", port)) } - connector := ssh.NewStreamer(connHost, creds, streamerOpts...) + devFab, ok := m.deviceMaps[deviceType] if !ok { return nil, fmt.Errorf("unknown device %v", deviceType) @@ -426,7 +446,7 @@ func (m *Server) SetupHostParams(ctx context.Context, cmdHostParams *pb.HostPara if err != nil { return nil, err } - params := NewHostParams(nil, cmdHostParams.GetDevice(), ip, port, "", "", "") + params := NewHostParams(nil, cmdHostParams.GetDevice(), ip, port, "", "", "", cmdHostParams.GetStreamerType()) m.updateHostParams(cmdHostParams.GetHost(), params) return &emptypb.Empty{}, nil } @@ -471,10 +491,11 @@ func (m *Server) getHostParams(hostname string, cmdParams *pb.HostParams) (hostP credsParsed = creds } cmdHostParams = &hostParams{ - port: port, - device: cmdParams.Device, - creds: credsParsed, - ip: ip, + port: port, + device: cmdParams.Device, + creds: credsParsed, + ip: ip, + streamerType: cmdParams.GetStreamerType(), } } var res hostParams @@ -495,13 +516,15 @@ func (m *Server) getHostParams(hostname string, cmdParams *pb.HostParams) (hostP } } else { res = hostParams{ - port: 0, - device: "", - creds: defaultCreds, - ip: netip.Addr{}, + port: 0, + device: "", + creds: defaultCreds, + ip: netip.Addr{}, + streamerType: pb.StreamerType_StreamerType_ssh, } if cmdParams != nil { res.device = cmdParams.Device + res.streamerType = cmdParams.GetStreamerType() } } // proxyJump only supported in defaultHostParams diff --git a/pkg/streamer/telnet/telnet.go b/pkg/streamer/telnet/telnet.go index eeccf7a..bb957cc 100644 --- a/pkg/streamer/telnet/telnet.go +++ b/pkg/streamer/telnet/telnet.go @@ -59,6 +59,7 @@ type Streamer struct { credentials credentials.Credentials logger *zap.Logger host string + port int conn net.Conn stdoutBuffer chan []byte stdoutBufferExtra []byte @@ -95,8 +96,12 @@ func (m *Streamer) SetCredentialsInterceptor(inter func(credentials.Credentials) } func (m *Streamer) Init(ctx context.Context) error { - m.logger.Debug("open connection", zap.String("host", m.host)) - conn, err := streamer.TCPDialCtx(ctx, "tcp", fmt.Sprintf("%s:%d", m.host, defaultPort)) + port := m.port + if port == 0 { + port = defaultPort + } + m.logger.Debug("open connection", zap.String("host", m.host), zap.Int("port", port)) + conn, err := streamer.TCPDialCtx(ctx, "tcp", fmt.Sprintf("%s:%d", m.host, port)) if err != nil { return err } @@ -179,6 +184,12 @@ func WithTrace(trace trace.CB) StreamerOption { } } +func WithPort(port int) StreamerOption { + return func(h *Streamer) { + h.port = port + } +} + func (m *Streamer) Close() { if m.conn != nil { _ = m.conn.Close() From 91d87e16e730447e9171cf2ec79393ca151cd197 Mon Sep 17 00:00:00 2001 From: vadvolo Date: Sat, 22 Nov 2025 15:22:03 +0000 Subject: [PATCH 2/6] fix: Replace proto symlink with actual files for pip install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove symlink to pkg/server/proto - Copy proto files directly to gnetclisdk/proto/ - Add __init__.py files for proper package structure - Update setup.py to use find_packages() 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- grpc_sdk/python/gnetclisdk/__init__.py | 1 + grpc_sdk/python/gnetclisdk/proto | 1 - grpc_sdk/python/gnetclisdk/proto/__init__.py | 0 .../python/gnetclisdk/proto/server_pb2.py | 85 ++++ .../python/gnetclisdk/proto/server_pb2.pyi | 202 +++++++++ .../gnetclisdk/proto/server_pb2_grpc.py | 399 ++++++++++++++++++ grpc_sdk/python/setup.py | 5 +- 7 files changed, 690 insertions(+), 3 deletions(-) create mode 100644 grpc_sdk/python/gnetclisdk/__init__.py delete mode 120000 grpc_sdk/python/gnetclisdk/proto create mode 100644 grpc_sdk/python/gnetclisdk/proto/__init__.py create mode 100644 grpc_sdk/python/gnetclisdk/proto/server_pb2.py create mode 100644 grpc_sdk/python/gnetclisdk/proto/server_pb2.pyi create mode 100644 grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py diff --git a/grpc_sdk/python/gnetclisdk/__init__.py b/grpc_sdk/python/gnetclisdk/__init__.py new file mode 100644 index 0000000..3ad76bc --- /dev/null +++ b/grpc_sdk/python/gnetclisdk/__init__.py @@ -0,0 +1 @@ +# gnetclisdk package diff --git a/grpc_sdk/python/gnetclisdk/proto b/grpc_sdk/python/gnetclisdk/proto deleted file mode 120000 index 74bb82c..0000000 --- a/grpc_sdk/python/gnetclisdk/proto +++ /dev/null @@ -1 +0,0 @@ -../../../pkg/server/proto \ No newline at end of file diff --git a/grpc_sdk/python/gnetclisdk/proto/__init__.py b/grpc_sdk/python/gnetclisdk/proto/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/grpc_sdk/python/gnetclisdk/proto/server_pb2.py b/grpc_sdk/python/gnetclisdk/proto/server_pb2.py new file mode 100644 index 0000000..2cd547b --- /dev/null +++ b/grpc_sdk/python/gnetclisdk/proto/server_pb2.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# NO CHECKED-IN PROTOBUF GENCODE +# source: server.proto +# Protobuf Python Version: 6.31.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import runtime_version as _runtime_version +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +_runtime_version.ValidateProtobufRuntimeVersion( + _runtime_version.Domain.PUBLIC, + 6, + 31, + 1, + '', + 'server.proto' +) +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x12\x07gnetcli\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\";\n\x02QA\x12\x10\n\x08question\x18\x01 \x01(\t\x12\x0e\n\x06\x61nswer\x18\x02 \x01(\t\x12\x13\n\x0bnot_send_nl\x18\x03 \x01(\x08\".\n\x0b\x43redentials\x12\r\n\x05login\x18\x01 \x01(\t\x12\x10\n\x08password\x18\x02 \x01(\t\"\xb4\x01\n\x03\x43MD\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\r\n\x05trace\x18\x03 \x01(\x08\x12\x17\n\x02qa\x18\x04 \x03(\x0b\x32\x0b.gnetcli.QA\x12\x14\n\x0cread_timeout\x18\x05 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x06 \x01(\x01\x12\x15\n\rstring_result\x18\x08 \x01(\x08\x12(\n\x0bhost_params\x18\t \x01(\x0b\x32\x13.gnetcli.HostParams\"e\n\x06\x44\x65vice\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x19\n\x11prompt_expression\x18\x02 \x01(\t\x12\x18\n\x10\x65rror_expression\x18\x03 \x01(\t\x12\x18\n\x10pager_expression\x18\x04 \x01(\t\"`\n\nCMDNetconf\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0b\n\x03\x63md\x18\x02 \x01(\t\x12\x0c\n\x04json\x18\x03 \x01(\x08\x12\x14\n\x0cread_timeout\x18\x04 \x01(\x01\x12\x13\n\x0b\x63md_timeout\x18\x05 \x01(\x01\"H\n\x0c\x43MDTraceItem\x12*\n\toperation\x18\x01 \x01(\x0e\x32\x17.gnetcli.TraceOperation\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"\x9d\x01\n\nHostParams\x12\x0c\n\x04host\x18\x01 \x01(\t\x12)\n\x0b\x63redentials\x18\x02 \x01(\x0b\x32\x14.gnetcli.Credentials\x12\x0c\n\x04port\x18\x03 \x01(\x05\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12\n\n\x02ip\x18\x05 \x01(\t\x12,\n\rstreamer_type\x18\x06 \x01(\x0e\x32\x15.gnetcli.StreamerType\"\x81\x01\n\tCMDResult\x12\x0b\n\x03out\x18\x01 \x01(\x0c\x12\x0f\n\x07out_str\x18\x02 \x01(\t\x12\r\n\x05\x65rror\x18\x03 \x01(\x0c\x12\x11\n\terror_str\x18\x04 \x01(\t\x12$\n\x05trace\x18\x05 \x03(\x0b\x32\x15.gnetcli.CMDTraceItem\x12\x0e\n\x06status\x18\x06 \x01(\x05\"G\n\x0c\x44\x65viceResult\x12(\n\x03res\x18\x01 \x01(\x0e\x32\x1b.gnetcli.DeviceResultStatus\x12\r\n\x05\x65rror\x18\x02 \x01(\t\"l\n\x13\x46ileDownloadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\r\n\x05paths\x18\x02 \x03(\t\x12\x0e\n\x06\x64\x65vice\x18\x03 \x01(\t\x12(\n\x0bhost_params\x18\x05 \x01(\x0b\x32\x13.gnetcli.HostParams\"K\n\x08\x46ileData\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x12#\n\x06status\x18\x03 \x01(\x0e\x32\x13.gnetcli.FileStatus\"}\n\x11\x46ileUploadRequest\x12\x0c\n\x04host\x18\x01 \x01(\t\x12\x0e\n\x06\x64\x65vice\x18\x04 \x01(\t\x12 \n\x05\x66iles\x18\x03 \x03(\x0b\x32\x11.gnetcli.FileData\x12(\n\x0bhost_params\x18\x06 \x01(\x0b\x32\x13.gnetcli.HostParams\"/\n\x0b\x46ilesResult\x12 \n\x05\x66iles\x18\x01 \x03(\x0b\x32\x11.gnetcli.FileData*f\n\x0eTraceOperation\x12\x14\n\x10Operation_notset\x10\x00\x12\x15\n\x11Operation_unknown\x10\x01\x12\x13\n\x0fOperation_write\x10\x02\x12\x12\n\x0eOperation_read\x10\x03*H\n\x12\x44\x65viceResultStatus\x12\x11\n\rDevice_notset\x10\x00\x12\r\n\tDevice_ok\x10\x01\x12\x10\n\x0c\x44\x65vice_error\x10\x02*=\n\x0cStreamerType\x12\x14\n\x10StreamerType_ssh\x10\x00\x12\x17\n\x13StreamerType_telnet\x10\x01*}\n\nFileStatus\x12\x15\n\x11\x46ileStatus_notset\x10\x00\x12\x11\n\rFileStatus_ok\x10\x01\x12\x14\n\x10\x46ileStatus_error\x10\x02\x12\x18\n\x14\x46ileStatus_not_found\x10\x03\x12\x15\n\x11\x46ileStatus_is_dir\x10\x04\x32\x8c\x05\n\x07Gnetcli\x12\x64\n\x0fSetupHostParams\x12\x13.gnetcli.HostParams\x1a\x16.google.protobuf.Empty\"$\x82\xd3\xe4\x93\x02\x1e\"\x19/api/v1/setup_host_params:\x01*\x12\x41\n\x04\x45xec\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x17\x82\xd3\xe4\x93\x02\x11\"\x0c/api/v1/exec:\x01*\x12\x32\n\x08\x45xecChat\x12\x0c.gnetcli.CMD\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12R\n\tAddDevice\x12\x0f.gnetcli.Device\x1a\x15.gnetcli.DeviceResult\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x12/api/v1/add_device:\x01*\x12W\n\x0b\x45xecNetconf\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x1f\x82\xd3\xe4\x93\x02\x19\"\x14/api/v1/exec_netconf:\x01*\x12@\n\x0f\x45xecNetconfChat\x12\x13.gnetcli.CMDNetconf\x1a\x12.gnetcli.CMDResult\"\x00(\x01\x30\x01\x12\\\n\x08\x44ownload\x12\x1c.gnetcli.FileDownloadRequest\x1a\x14.gnetcli.FilesResult\"\x1c\x82\xd3\xe4\x93\x02\x16\"\x11/api/v1/downloads:\x01*\x12W\n\x06Upload\x12\x1a.gnetcli.FileUploadRequest\x1a\x16.google.protobuf.Empty\"\x19\x82\xd3\xe4\x93\x02\x13\"\x0e/api/v1/upload:\x01*B7Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetclib\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'server_pb2', _globals) +if not _descriptor._USE_C_DESCRIPTORS: + _globals['DESCRIPTOR']._loaded_options = None + _globals['DESCRIPTOR']._serialized_options = b'Z5github.com/annetutil/gnetcli/pkg/server/proto;gnetcli' + _globals['_GNETCLI'].methods_by_name['SetupHostParams']._loaded_options = None + _globals['_GNETCLI'].methods_by_name['SetupHostParams']._serialized_options = b'\202\323\344\223\002\036\"\031/api/v1/setup_host_params:\001*' + _globals['_GNETCLI'].methods_by_name['Exec']._loaded_options = None + _globals['_GNETCLI'].methods_by_name['Exec']._serialized_options = b'\202\323\344\223\002\021\"\014/api/v1/exec:\001*' + _globals['_GNETCLI'].methods_by_name['AddDevice']._loaded_options = None + _globals['_GNETCLI'].methods_by_name['AddDevice']._serialized_options = b'\202\323\344\223\002\027\"\022/api/v1/add_device:\001*' + _globals['_GNETCLI'].methods_by_name['ExecNetconf']._loaded_options = None + _globals['_GNETCLI'].methods_by_name['ExecNetconf']._serialized_options = b'\202\323\344\223\002\031\"\024/api/v1/exec_netconf:\001*' + _globals['_GNETCLI'].methods_by_name['Download']._loaded_options = None + _globals['_GNETCLI'].methods_by_name['Download']._serialized_options = b'\202\323\344\223\002\026\"\021/api/v1/downloads:\001*' + _globals['_GNETCLI'].methods_by_name['Upload']._loaded_options = None + _globals['_GNETCLI'].methods_by_name['Upload']._serialized_options = b'\202\323\344\223\002\023\"\016/api/v1/upload:\001*' + _globals['_TRACEOPERATION']._serialized_start=1379 + _globals['_TRACEOPERATION']._serialized_end=1481 + _globals['_DEVICERESULTSTATUS']._serialized_start=1483 + _globals['_DEVICERESULTSTATUS']._serialized_end=1555 + _globals['_STREAMERTYPE']._serialized_start=1557 + _globals['_STREAMERTYPE']._serialized_end=1618 + _globals['_FILESTATUS']._serialized_start=1620 + _globals['_FILESTATUS']._serialized_end=1745 + _globals['_QA']._serialized_start=84 + _globals['_QA']._serialized_end=143 + _globals['_CREDENTIALS']._serialized_start=145 + _globals['_CREDENTIALS']._serialized_end=191 + _globals['_CMD']._serialized_start=194 + _globals['_CMD']._serialized_end=374 + _globals['_DEVICE']._serialized_start=376 + _globals['_DEVICE']._serialized_end=477 + _globals['_CMDNETCONF']._serialized_start=479 + _globals['_CMDNETCONF']._serialized_end=575 + _globals['_CMDTRACEITEM']._serialized_start=577 + _globals['_CMDTRACEITEM']._serialized_end=649 + _globals['_HOSTPARAMS']._serialized_start=652 + _globals['_HOSTPARAMS']._serialized_end=809 + _globals['_CMDRESULT']._serialized_start=812 + _globals['_CMDRESULT']._serialized_end=941 + _globals['_DEVICERESULT']._serialized_start=943 + _globals['_DEVICERESULT']._serialized_end=1014 + _globals['_FILEDOWNLOADREQUEST']._serialized_start=1016 + _globals['_FILEDOWNLOADREQUEST']._serialized_end=1124 + _globals['_FILEDATA']._serialized_start=1126 + _globals['_FILEDATA']._serialized_end=1201 + _globals['_FILEUPLOADREQUEST']._serialized_start=1203 + _globals['_FILEUPLOADREQUEST']._serialized_end=1328 + _globals['_FILESRESULT']._serialized_start=1330 + _globals['_FILESRESULT']._serialized_end=1377 + _globals['_GNETCLI']._serialized_start=1748 + _globals['_GNETCLI']._serialized_end=2400 +# @@protoc_insertion_point(module_scope) diff --git a/grpc_sdk/python/gnetclisdk/proto/server_pb2.pyi b/grpc_sdk/python/gnetclisdk/proto/server_pb2.pyi new file mode 100644 index 0000000..e147da4 --- /dev/null +++ b/grpc_sdk/python/gnetclisdk/proto/server_pb2.pyi @@ -0,0 +1,202 @@ +from google.api import annotations_pb2 as _annotations_pb2 +from google.protobuf import empty_pb2 as _empty_pb2 +from google.protobuf.internal import containers as _containers +from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from collections.abc import Iterable as _Iterable, Mapping as _Mapping +from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union + +DESCRIPTOR: _descriptor.FileDescriptor + +class TraceOperation(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + Operation_notset: _ClassVar[TraceOperation] + Operation_unknown: _ClassVar[TraceOperation] + Operation_write: _ClassVar[TraceOperation] + Operation_read: _ClassVar[TraceOperation] + +class DeviceResultStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + Device_notset: _ClassVar[DeviceResultStatus] + Device_ok: _ClassVar[DeviceResultStatus] + Device_error: _ClassVar[DeviceResultStatus] + +class StreamerType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + StreamerType_ssh: _ClassVar[StreamerType] + StreamerType_telnet: _ClassVar[StreamerType] + +class FileStatus(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): + __slots__ = () + FileStatus_notset: _ClassVar[FileStatus] + FileStatus_ok: _ClassVar[FileStatus] + FileStatus_error: _ClassVar[FileStatus] + FileStatus_not_found: _ClassVar[FileStatus] + FileStatus_is_dir: _ClassVar[FileStatus] +Operation_notset: TraceOperation +Operation_unknown: TraceOperation +Operation_write: TraceOperation +Operation_read: TraceOperation +Device_notset: DeviceResultStatus +Device_ok: DeviceResultStatus +Device_error: DeviceResultStatus +StreamerType_ssh: StreamerType +StreamerType_telnet: StreamerType +FileStatus_notset: FileStatus +FileStatus_ok: FileStatus +FileStatus_error: FileStatus +FileStatus_not_found: FileStatus +FileStatus_is_dir: FileStatus + +class QA(_message.Message): + __slots__ = ("question", "answer", "not_send_nl") + QUESTION_FIELD_NUMBER: _ClassVar[int] + ANSWER_FIELD_NUMBER: _ClassVar[int] + NOT_SEND_NL_FIELD_NUMBER: _ClassVar[int] + question: str + answer: str + not_send_nl: bool + def __init__(self, question: _Optional[str] = ..., answer: _Optional[str] = ..., not_send_nl: bool = ...) -> None: ... + +class Credentials(_message.Message): + __slots__ = ("login", "password") + LOGIN_FIELD_NUMBER: _ClassVar[int] + PASSWORD_FIELD_NUMBER: _ClassVar[int] + login: str + password: str + def __init__(self, login: _Optional[str] = ..., password: _Optional[str] = ...) -> None: ... + +class CMD(_message.Message): + __slots__ = ("host", "cmd", "trace", "qa", "read_timeout", "cmd_timeout", "string_result", "host_params") + HOST_FIELD_NUMBER: _ClassVar[int] + CMD_FIELD_NUMBER: _ClassVar[int] + TRACE_FIELD_NUMBER: _ClassVar[int] + QA_FIELD_NUMBER: _ClassVar[int] + READ_TIMEOUT_FIELD_NUMBER: _ClassVar[int] + CMD_TIMEOUT_FIELD_NUMBER: _ClassVar[int] + STRING_RESULT_FIELD_NUMBER: _ClassVar[int] + HOST_PARAMS_FIELD_NUMBER: _ClassVar[int] + host: str + cmd: str + trace: bool + qa: _containers.RepeatedCompositeFieldContainer[QA] + read_timeout: float + cmd_timeout: float + string_result: bool + host_params: HostParams + def __init__(self, host: _Optional[str] = ..., cmd: _Optional[str] = ..., trace: bool = ..., qa: _Optional[_Iterable[_Union[QA, _Mapping]]] = ..., read_timeout: _Optional[float] = ..., cmd_timeout: _Optional[float] = ..., string_result: bool = ..., host_params: _Optional[_Union[HostParams, _Mapping]] = ...) -> None: ... + +class Device(_message.Message): + __slots__ = ("name", "prompt_expression", "error_expression", "pager_expression") + NAME_FIELD_NUMBER: _ClassVar[int] + PROMPT_EXPRESSION_FIELD_NUMBER: _ClassVar[int] + ERROR_EXPRESSION_FIELD_NUMBER: _ClassVar[int] + PAGER_EXPRESSION_FIELD_NUMBER: _ClassVar[int] + name: str + prompt_expression: str + error_expression: str + pager_expression: str + def __init__(self, name: _Optional[str] = ..., prompt_expression: _Optional[str] = ..., error_expression: _Optional[str] = ..., pager_expression: _Optional[str] = ...) -> None: ... + +class CMDNetconf(_message.Message): + __slots__ = ("host", "cmd", "json", "read_timeout", "cmd_timeout") + HOST_FIELD_NUMBER: _ClassVar[int] + CMD_FIELD_NUMBER: _ClassVar[int] + JSON_FIELD_NUMBER: _ClassVar[int] + READ_TIMEOUT_FIELD_NUMBER: _ClassVar[int] + CMD_TIMEOUT_FIELD_NUMBER: _ClassVar[int] + host: str + cmd: str + json: bool + read_timeout: float + cmd_timeout: float + def __init__(self, host: _Optional[str] = ..., cmd: _Optional[str] = ..., json: bool = ..., read_timeout: _Optional[float] = ..., cmd_timeout: _Optional[float] = ...) -> None: ... + +class CMDTraceItem(_message.Message): + __slots__ = ("operation", "data") + OPERATION_FIELD_NUMBER: _ClassVar[int] + DATA_FIELD_NUMBER: _ClassVar[int] + operation: TraceOperation + data: bytes + def __init__(self, operation: _Optional[_Union[TraceOperation, str]] = ..., data: _Optional[bytes] = ...) -> None: ... + +class HostParams(_message.Message): + __slots__ = ("host", "credentials", "port", "device", "ip", "streamer_type") + HOST_FIELD_NUMBER: _ClassVar[int] + CREDENTIALS_FIELD_NUMBER: _ClassVar[int] + PORT_FIELD_NUMBER: _ClassVar[int] + DEVICE_FIELD_NUMBER: _ClassVar[int] + IP_FIELD_NUMBER: _ClassVar[int] + STREAMER_TYPE_FIELD_NUMBER: _ClassVar[int] + host: str + credentials: Credentials + port: int + device: str + ip: str + streamer_type: StreamerType + def __init__(self, host: _Optional[str] = ..., credentials: _Optional[_Union[Credentials, _Mapping]] = ..., port: _Optional[int] = ..., device: _Optional[str] = ..., ip: _Optional[str] = ..., streamer_type: _Optional[_Union[StreamerType, str]] = ...) -> None: ... + +class CMDResult(_message.Message): + __slots__ = ("out", "out_str", "error", "error_str", "trace", "status") + OUT_FIELD_NUMBER: _ClassVar[int] + OUT_STR_FIELD_NUMBER: _ClassVar[int] + ERROR_FIELD_NUMBER: _ClassVar[int] + ERROR_STR_FIELD_NUMBER: _ClassVar[int] + TRACE_FIELD_NUMBER: _ClassVar[int] + STATUS_FIELD_NUMBER: _ClassVar[int] + out: bytes + out_str: str + error: bytes + error_str: str + trace: _containers.RepeatedCompositeFieldContainer[CMDTraceItem] + status: int + def __init__(self, out: _Optional[bytes] = ..., out_str: _Optional[str] = ..., error: _Optional[bytes] = ..., error_str: _Optional[str] = ..., trace: _Optional[_Iterable[_Union[CMDTraceItem, _Mapping]]] = ..., status: _Optional[int] = ...) -> None: ... + +class DeviceResult(_message.Message): + __slots__ = ("res", "error") + RES_FIELD_NUMBER: _ClassVar[int] + ERROR_FIELD_NUMBER: _ClassVar[int] + res: DeviceResultStatus + error: str + def __init__(self, res: _Optional[_Union[DeviceResultStatus, str]] = ..., error: _Optional[str] = ...) -> None: ... + +class FileDownloadRequest(_message.Message): + __slots__ = ("host", "paths", "device", "host_params") + HOST_FIELD_NUMBER: _ClassVar[int] + PATHS_FIELD_NUMBER: _ClassVar[int] + DEVICE_FIELD_NUMBER: _ClassVar[int] + HOST_PARAMS_FIELD_NUMBER: _ClassVar[int] + host: str + paths: _containers.RepeatedScalarFieldContainer[str] + device: str + host_params: HostParams + def __init__(self, host: _Optional[str] = ..., paths: _Optional[_Iterable[str]] = ..., device: _Optional[str] = ..., host_params: _Optional[_Union[HostParams, _Mapping]] = ...) -> None: ... + +class FileData(_message.Message): + __slots__ = ("path", "data", "status") + PATH_FIELD_NUMBER: _ClassVar[int] + DATA_FIELD_NUMBER: _ClassVar[int] + STATUS_FIELD_NUMBER: _ClassVar[int] + path: str + data: bytes + status: FileStatus + def __init__(self, path: _Optional[str] = ..., data: _Optional[bytes] = ..., status: _Optional[_Union[FileStatus, str]] = ...) -> None: ... + +class FileUploadRequest(_message.Message): + __slots__ = ("host", "device", "files", "host_params") + HOST_FIELD_NUMBER: _ClassVar[int] + DEVICE_FIELD_NUMBER: _ClassVar[int] + FILES_FIELD_NUMBER: _ClassVar[int] + HOST_PARAMS_FIELD_NUMBER: _ClassVar[int] + host: str + device: str + files: _containers.RepeatedCompositeFieldContainer[FileData] + host_params: HostParams + def __init__(self, host: _Optional[str] = ..., device: _Optional[str] = ..., files: _Optional[_Iterable[_Union[FileData, _Mapping]]] = ..., host_params: _Optional[_Union[HostParams, _Mapping]] = ...) -> None: ... + +class FilesResult(_message.Message): + __slots__ = ("files",) + FILES_FIELD_NUMBER: _ClassVar[int] + files: _containers.RepeatedCompositeFieldContainer[FileData] + def __init__(self, files: _Optional[_Iterable[_Union[FileData, _Mapping]]] = ...) -> None: ... diff --git a/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py b/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py new file mode 100644 index 0000000..1145f94 --- /dev/null +++ b/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py @@ -0,0 +1,399 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc +import warnings + +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 +from . import server_pb2 as server__pb2 + +GRPC_GENERATED_VERSION = '1.76.0' +GRPC_VERSION = grpc.__version__ +_version_not_supported = False + +try: + from grpc._utilities import first_version_is_lower + _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) +except ImportError: + _version_not_supported = True + +if _version_not_supported: + raise RuntimeError( + f'The grpc package installed is at version {GRPC_VERSION},' + + ' but the generated code in server_pb2_grpc.py depends on' + + f' grpcio>={GRPC_GENERATED_VERSION}.' + + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' + ) + + +class GnetcliStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SetupHostParams = channel.unary_unary( + '/gnetcli.Gnetcli/SetupHostParams', + request_serializer=server__pb2.HostParams.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + _registered_method=True) + self.Exec = channel.unary_unary( + '/gnetcli.Gnetcli/Exec', + request_serializer=server__pb2.CMD.SerializeToString, + response_deserializer=server__pb2.CMDResult.FromString, + _registered_method=True) + self.ExecChat = channel.stream_stream( + '/gnetcli.Gnetcli/ExecChat', + request_serializer=server__pb2.CMD.SerializeToString, + response_deserializer=server__pb2.CMDResult.FromString, + _registered_method=True) + self.AddDevice = channel.unary_unary( + '/gnetcli.Gnetcli/AddDevice', + request_serializer=server__pb2.Device.SerializeToString, + response_deserializer=server__pb2.DeviceResult.FromString, + _registered_method=True) + self.ExecNetconf = channel.unary_unary( + '/gnetcli.Gnetcli/ExecNetconf', + request_serializer=server__pb2.CMDNetconf.SerializeToString, + response_deserializer=server__pb2.CMDResult.FromString, + _registered_method=True) + self.ExecNetconfChat = channel.stream_stream( + '/gnetcli.Gnetcli/ExecNetconfChat', + request_serializer=server__pb2.CMDNetconf.SerializeToString, + response_deserializer=server__pb2.CMDResult.FromString, + _registered_method=True) + self.Download = channel.unary_unary( + '/gnetcli.Gnetcli/Download', + request_serializer=server__pb2.FileDownloadRequest.SerializeToString, + response_deserializer=server__pb2.FilesResult.FromString, + _registered_method=True) + self.Upload = channel.unary_unary( + '/gnetcli.Gnetcli/Upload', + request_serializer=server__pb2.FileUploadRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + _registered_method=True) + + +class GnetcliServicer(object): + """Missing associated documentation comment in .proto file.""" + + def SetupHostParams(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Exec(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ExecChat(self, request_iterator, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def AddDevice(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ExecNetconf(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def ExecNetconfChat(self, request_iterator, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Download(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def Upload(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_GnetcliServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SetupHostParams': grpc.unary_unary_rpc_method_handler( + servicer.SetupHostParams, + request_deserializer=server__pb2.HostParams.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + 'Exec': grpc.unary_unary_rpc_method_handler( + servicer.Exec, + request_deserializer=server__pb2.CMD.FromString, + response_serializer=server__pb2.CMDResult.SerializeToString, + ), + 'ExecChat': grpc.stream_stream_rpc_method_handler( + servicer.ExecChat, + request_deserializer=server__pb2.CMD.FromString, + response_serializer=server__pb2.CMDResult.SerializeToString, + ), + 'AddDevice': grpc.unary_unary_rpc_method_handler( + servicer.AddDevice, + request_deserializer=server__pb2.Device.FromString, + response_serializer=server__pb2.DeviceResult.SerializeToString, + ), + 'ExecNetconf': grpc.unary_unary_rpc_method_handler( + servicer.ExecNetconf, + request_deserializer=server__pb2.CMDNetconf.FromString, + response_serializer=server__pb2.CMDResult.SerializeToString, + ), + 'ExecNetconfChat': grpc.stream_stream_rpc_method_handler( + servicer.ExecNetconfChat, + request_deserializer=server__pb2.CMDNetconf.FromString, + response_serializer=server__pb2.CMDResult.SerializeToString, + ), + 'Download': grpc.unary_unary_rpc_method_handler( + servicer.Download, + request_deserializer=server__pb2.FileDownloadRequest.FromString, + response_serializer=server__pb2.FilesResult.SerializeToString, + ), + 'Upload': grpc.unary_unary_rpc_method_handler( + servicer.Upload, + request_deserializer=server__pb2.FileUploadRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'gnetcli.Gnetcli', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + server.add_registered_method_handlers('gnetcli.Gnetcli', rpc_method_handlers) + + + # This class is part of an EXPERIMENTAL API. +class Gnetcli(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def SetupHostParams(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/SetupHostParams', + server__pb2.HostParams.SerializeToString, + google_dot_protobuf_dot_empty__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Exec(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Exec', + server__pb2.CMD.SerializeToString, + server__pb2.CMDResult.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def ExecChat(request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_stream( + request_iterator, + target, + '/gnetcli.Gnetcli/ExecChat', + server__pb2.CMD.SerializeToString, + server__pb2.CMDResult.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def AddDevice(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/AddDevice', + server__pb2.Device.SerializeToString, + server__pb2.DeviceResult.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def ExecNetconf(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/ExecNetconf', + server__pb2.CMDNetconf.SerializeToString, + server__pb2.CMDResult.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def ExecNetconfChat(request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.stream_stream( + request_iterator, + target, + '/gnetcli.Gnetcli/ExecNetconfChat', + server__pb2.CMDNetconf.SerializeToString, + server__pb2.CMDResult.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Download(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Download', + server__pb2.FileDownloadRequest.SerializeToString, + server__pb2.FilesResult.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) + + @staticmethod + def Upload(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary( + request, + target, + '/gnetcli.Gnetcli/Upload', + server__pb2.FileUploadRequest.SerializeToString, + google_dot_protobuf_dot_empty__pb2.Empty.FromString, + options, + channel_credentials, + insecure, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + _registered_method=True) diff --git a/grpc_sdk/python/setup.py b/grpc_sdk/python/setup.py index e5c7447..a4281ce 100644 --- a/grpc_sdk/python/setup.py +++ b/grpc_sdk/python/setup.py @@ -1,5 +1,5 @@ import os -from setuptools import setup +from setuptools import setup, find_packages with open("README.md") as f: readme = f.read() @@ -17,7 +17,8 @@ author_email="gescheit12@gmail.com", url="https://github.com/annetutil/gnetcli", license="MIT", - package_dir={"gnetclisdk": "gnetclisdk"}, + packages=find_packages(), + include_package_data=True, install_requires=list(requirements.splitlines()), classifiers=[ "Development Status :: 3 - Alpha", From 9662ff7c371421945ed62f726dbb43a79ee7b278 Mon Sep 17 00:00:00 2001 From: vadvolo Date: Mon, 24 Nov 2025 09:19:51 +0000 Subject: [PATCH 3/6] Fix E128 indentation errors in server_pb2_grpc.py --- .../gnetclisdk/proto/server_pb2_grpc.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py b/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py index 1145f94..ec1e903 100644 --- a/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py +++ b/grpc_sdk/python/gnetclisdk/proto/server_pb2_grpc.py @@ -346,15 +346,15 @@ def ExecNetconfChat(request_iterator, @staticmethod def Download(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): return grpc.experimental.unary_unary( request, target, @@ -373,15 +373,15 @@ def Download(request, @staticmethod def Upload(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): return grpc.experimental.unary_unary( request, target, From 9b3e10aad9df827528e8f61aabf82c978ae63d6a Mon Sep 17 00:00:00 2001 From: vadvolo Date: Tue, 25 Nov 2025 00:06:29 +0000 Subject: [PATCH 4/6] Fix leading backspace handling in terminal parser - Handle backspace at position 0 without trying to delete previous char - Add test cases for leading backspaces and pager clearing patterns - Fixes panic: slice bounds out of range [-1:] --- pkg/terminal/parser.go | 6 +++++- pkg/terminal/parser_test.go | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pkg/terminal/parser.go b/pkg/terminal/parser.go index e2e0746..8fb7367 100644 --- a/pkg/terminal/parser.go +++ b/pkg/terminal/parser.go @@ -184,7 +184,11 @@ func (m *Parser) parse() ([]byte, error) { } m.pos = lineStart - 1 } else if char == BS { - if m.pos > 0 && m.data[m.pos-1] == NEWLINE { // do not delete behind newline + if m.pos == 0 { + // Leading backspace - nothing to delete, just remove the BS itself + m.data = slices.Delete(m.data, m.pos, m.pos+1) + m.pos-- + } else if m.data[m.pos-1] == NEWLINE { // do not delete behind newline m.data = slices.Delete(m.data, m.pos, m.pos+1) m.pos-- } else { diff --git a/pkg/terminal/parser_test.go b/pkg/terminal/parser_test.go index ee6ed19..864d062 100644 --- a/pkg/terminal/parser_test.go +++ b/pkg/terminal/parser_test.go @@ -111,6 +111,21 @@ func TestBS2(t *testing.T) { assert.Equal(t, "0 \r\n|access", string(res)) } +func TestLeadingBS(t *testing.T) { + // Test case: leading backspaces (should be ignored as there's nothing to delete) + res, err := Parse([]byte("\b\b\binterface GigabitEthernet1/38")) + assert.NoError(t, err) + assert.Equal(t, "interface GigabitEthernet1/38", string(res)) +} + +func TestPagerBackspaces(t *testing.T) { + // Test case from real Cisco telnet output with pager clearing + // Pattern: backspaces + spaces + backspaces (clearing "-- More --" prompt) + res, err := Parse([]byte("\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\binterface GigabitEthernet1/38")) + assert.NoError(t, err) + assert.Equal(t, "interface GigabitEthernet1/38", string(res)) +} + func check(t *testing.T, want string, s string) { res, err := Parse([]byte(s)) assert.NoError(t, err) From acc5f9c611e4392667158d7a3bbe073d7d29783f Mon Sep 17 00:00:00 2001 From: vadvolo Date: Tue, 25 Nov 2025 01:00:45 +0000 Subject: [PATCH 5/6] Fix telnet pager handling to preserve newlines and prevent text corruption MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes two issues with telnet pager handling that caused configuration lines to be corrupted when fetching device configs: 1. **Newline preservation**: The pager pattern `\r\n --More--` was consuming the `\r\n` that should separate configuration lines. Now we restore the `\r\n` after the pager is answered to prevent lines from merging together. 2. **Backspace clearing sequence stripping**: After answering the pager, Cisco devices send a sequence of backspaces, spaces, and backspaces to clear the "--More--" prompt from the terminal. Since we already remove the pager pattern from the buffer, these control sequences would incorrectly delete real content. Added stripPagerClearingSequence() to detect and remove these clearing patterns. Example of the issue fixed: - Before: "description BG_W451-Obrenov no switchport" (truncated & merged) - After: "description BG_W451-ObrenovacStocnjak" + "no switchport" (separate lines) Changes: - Added stripPagerClearingSequence() function to detect and remove backspace clearing patterns (\b{n} + spaces + \b{n}) - Added pagerAnswered flag to track when to strip clearing sequences - Restore \r\n in pager handling to preserve line breaks - Added comprehensive tests for pager newline preservation - Added tests for stripPagerClearingSequence() function Related to earlier fix for leading backspace handling in parser.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pkg/device/genericcli/genericcli.go | 58 ++++++++++++++++ pkg/device/genericcli/genericcli_test.go | 88 ++++++++++++++++++++++++ pkg/terminal/parser_test.go | 25 +++++++ 3 files changed, 171 insertions(+) diff --git a/pkg/device/genericcli/genericcli.go b/pkg/device/genericcli/genericcli.go index b8e0d49..946d9fb 100644 --- a/pkg/device/genericcli/genericcli.go +++ b/pkg/device/genericcli/genericcli.go @@ -27,6 +27,52 @@ var ErrorCLILogin = errors.New("CLI login is not supported") const AnyNLPattern = `(\r\n|\n)` const DefaultCLIConnectTimeout = 15 * time.Second +// stripPagerClearingSequence removes terminal control sequences used to clear pager prompts +// Pagers like Cisco's "--More--" send backspaces + spaces + backspaces to clear the prompt +// after answering. Since we strip the pager from the buffer, these sequences would delete +// actual content. This function detects and removes such sequences. +func stripPagerClearingSequence(data []byte) []byte { + // Pattern: \b{n} + spaces{m} + \b{k} + // Common pattern: \b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b + + if len(data) == 0 { + return data + } + + // Count leading backspaces (BS = 0x08) + leadingBS := 0 + for leadingBS < len(data) && data[leadingBS] == 0x08 { + leadingBS++ + } + + if leadingBS == 0 { + return data // No leading backspaces, not a clearing sequence + } + + // Count spaces after backspaces + spaces := 0 + pos := leadingBS + for pos < len(data) && data[pos] == ' ' { + spaces++ + pos++ + } + + // Count trailing backspaces + trailingBS := 0 + for pos < len(data) && data[pos] == 0x08 { + trailingBS++ + pos++ + } + + // If we have the pattern BS+spaces+BS, it's a pager clearing sequence + // Strip it to prevent deletion of actual content + if leadingBS > 0 && spaces > 0 && trailingBS > 0 { + return data[pos:] + } + + return data +} + const ( promptExprName = "prompt" passwdErrExprName = "passwordError" @@ -581,6 +627,7 @@ func GenericExecute(command cmd.Cmd, connector streamer.Connector, cli GenericCL } cbLimit := 100 seenEcho := false + pagerAnswered := false // Track if we just answered a pager for { // pager loop match, err := connector.ReadTo(ctx, exprs) if err != nil { @@ -603,6 +650,13 @@ func GenericExecute(command cmd.Cmd, connector streamer.Connector, cli GenericCL continue } mbefore := match.GetBefore() + + // If we just answered a pager, strip the clearing backspace sequence + // that the device sends to erase the "--More--" prompt from the terminal + if pagerAnswered { + mbefore = stripPagerClearingSequence(mbefore) + pagerAnswered = false + } if !seenEcho { if matchName == questionExprName { // caught question before echo // check for echo, drop it and proceed with question @@ -667,6 +721,8 @@ func GenericExecute(command cmd.Cmd, connector streamer.Connector, cli GenericCL break } else if matchName == pagerExprName { // next page buffer.Write(mbefore) + // Restore the \r\n that was consumed by the pager pattern + buffer.Write([]byte("\r\n")) if store, ok := match.GetMatchedGroups()["store"]; ok { buffer.Write(store) } @@ -675,6 +731,8 @@ func GenericExecute(command cmd.Cmd, connector streamer.Connector, cli GenericCL if err != nil { return nil, fmt.Errorf("write error %w", err) } + // Mark that we answered pager, so next read will strip clearing sequences + pagerAnswered = true } else if matchName == questionExprName { // question question := match.GetMatched() logger.Debug("QuestionHandler question", zap.ByteString("question", question)) diff --git a/pkg/device/genericcli/genericcli_test.go b/pkg/device/genericcli/genericcli_test.go index 752ae79..be8b648 100644 --- a/pkg/device/genericcli/genericcli_test.go +++ b/pkg/device/genericcli/genericcli_test.go @@ -309,3 +309,91 @@ func TestQuestionWithAnswerNotSendNL(t *testing.T) { require.NoError(t, resErr) require.Equal(t, cmdRes, []cmd.CmdRes{cmd.NewCmdRes(nil)}) } +func TestPagerPreservesNewline(t *testing.T) { + logger := zap.Must(zap.NewDevelopmentConfig().Build()) + dialog := [][]gmock.Action{ + { + gmock.Send(""), + gmock.Expect("show config\n"), + gmock.SendEcho("show config\r\n"), + gmock.Send(" description BG_W451-ObrenovacStocnjak\r\n"), + gmock.Send(" --More-- "), + gmock.Expect(" "), + gmock.Send("\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b no switchport\r\n"), + gmock.Send(""), + gmock.Close(), + }, + } + + actions := gmock.ConcatMultipleSlices(dialog) + cmdRes, resErr, serverErr, err := gmock.RunCmd(func(connector streamer.Connector) device.Device { + promptExpression := `(\r\n|^)(?P(<\w+>))$` + pagerExpression := `\r\n --More-- $` + cli := MakeGenericCLI( + expr.NewSimpleExprLast200().FromPattern(promptExpression), + expr.NewSimpleExprLast200().FromPattern(``), + WithPager(expr.NewSimpleExprLast200().FromPattern(pagerExpression)), + ) + dev := MakeGenericDevice(cli, connector, WithDevLogger(logger)) + return &dev + }, actions, []cmd.Cmd{cmd.NewCmd("show config")}, logger) + + require.NoError(t, err) + require.NoError(t, serverErr) + require.NoError(t, resErr) + require.Len(t, cmdRes, 1) + + // Verify that the newline is preserved between lines + // Note: \r\n is normalized to \n by the terminal parser + output := string(cmdRes[0].Output()) + require.Contains(t, output, "description BG_W451-ObrenovacStocnjak\n") + require.Contains(t, output, " no switchport") + // Ensure they're on separate lines, not merged + require.NotContains(t, output, "ObrenovacStocnjak no switchport") +} + +func TestStripPagerClearingSequence(t *testing.T) { + tests := []struct { + name string + input []byte + expected []byte + }{ + { + name: "Cisco pager clearing pattern", + input: []byte("\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b no switchport\r\n"), + expected: []byte(" no switchport\r\n"), + }, + { + name: "No clearing pattern", + input: []byte(" no switchport\r\n"), + expected: []byte(" no switchport\r\n"), + }, + { + name: "Only backspaces (no spaces)", + input: []byte("\b\b\b\b\btext"), + expected: []byte("\b\b\b\b\btext"), // Not a clearing pattern + }, + { + name: "Empty input", + input: []byte(""), + expected: []byte(""), + }, + { + name: "Backspaces and spaces but no trailing backspaces", + input: []byte("\b\b\b text"), + expected: []byte("\b\b\b text"), // Not a complete clearing pattern + }, + { + name: "Multiple lines after clearing", + input: []byte("\b\b\b\b\b \b\b\b\b\binterface GigabitEthernet1/38\r\n!\r\n"), + expected: []byte("interface GigabitEthernet1/38\r\n!\r\n"), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := stripPagerClearingSequence(tt.input) + require.Equal(t, tt.expected, result, "stripPagerClearingSequence(%q) = %q, want %q", tt.input, result, tt.expected) + }) + } +} diff --git a/pkg/terminal/parser_test.go b/pkg/terminal/parser_test.go index 864d062..acd9562 100644 --- a/pkg/terminal/parser_test.go +++ b/pkg/terminal/parser_test.go @@ -126,6 +126,31 @@ func TestPagerBackspaces(t *testing.T) { assert.Equal(t, "interface GigabitEthernet1/38", string(res)) } +func TestCiscoPagerMidLine(t *testing.T) { + // Cisco pager appearing after description line + // Real output: "description CCR-Dudovi-Po1\r\n --More-- " + // Then after space, backspaces clear the pager + // Expected: description line should remain intact + input := []byte(" description CCR-Dudovi-Po1\r\n --More-- \b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\bno switchport") + res, err := Parse(input) + assert.NoError(t, err) + fmt.Printf("Result: %q\n", string(res)) + // Should preserve the full description + assert.Contains(t, string(res), "description CCR-Dudovi-Po1") + assert.Contains(t, string(res), "no switchport") + assert.Equal(t, " description CCR-Dudovi-Po1\r\nno switchport", string(res)) +} + +func TestCiscoPagerTooManyBackspaces(t *testing.T) { + // If there are 11 backspaces but only 10 chars in " --More-- " + // the extra backspace might eat the newline + input := []byte(" description CCR-Dudovi-Po1\r\n --More-- \b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\bno switchport") + res, err := Parse(input) + assert.NoError(t, err) + fmt.Printf("Result with extra BS: %q\n", string(res)) + // This might incorrectly eat the \n +} + func check(t *testing.T, want string, s string) { res, err := Parse([]byte(s)) assert.NoError(t, err) From 7930dd8aefa0b4df3b15217f3287c0d71f2cfec3 Mon Sep 17 00:00:00 2001 From: vadvolo Date: Sun, 18 Jan 2026 14:42:16 +0000 Subject: [PATCH 6/6] add asa device into InitDefaultDeviceMapping --- pkg/devconf/devconf.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/devconf/devconf.go b/pkg/devconf/devconf.go index 585246b..41dc8e4 100644 --- a/pkg/devconf/devconf.go +++ b/pkg/devconf/devconf.go @@ -2,6 +2,7 @@ package devconf import ( "fmt" + "github.com/annetutil/gnetcli/pkg/device/asa" "os" "regexp" "strings" @@ -227,6 +228,7 @@ func InitDefaultDeviceMapping(logger *zap.Logger) map[string]func(streamer.Conne "netconf": netconf.BindDeviceOpts(netconf.NewDevice, netconf.WithLogger(logger)), "aruos": GenericCLIWrapper(aruos.NewDevice, logger), "eltex": GenericCLIWrapper(eltex.NewDevice, logger), + "asa": GenericCLIWrapper(asa.NewDevice, logger), } return deviceMaps }