From 51b7cdab76fdb6f00fcdbdf079af1ed792f4a3e8 Mon Sep 17 00:00:00 2001 From: Malte Bauch <malte.bauch@stud.h-da.de> Date: Wed, 27 Jan 2021 18:50:49 +0100 Subject: [PATCH] added all necessary grpc proto for the updated gosdnc --- api/proto/gosdnCLI.pb.go | 487 +++++++++++++++++++++++++++++++-------- api/proto/gosdnCLI.proto | 18 ++ nucleus/cli-handling.go | 90 ++++++-- 3 files changed, 484 insertions(+), 111 deletions(-) diff --git a/api/proto/gosdnCLI.pb.go b/api/proto/gosdnCLI.pb.go index 5a2810bd6..e6b624566 100644 --- a/api/proto/gosdnCLI.pb.go +++ b/api/proto/gosdnCLI.pb.go @@ -385,6 +385,53 @@ func (x *CreatePNDRequest) GetSbi() string { return "" } +type AllSBINamesReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SbiNames []string `protobuf:"bytes,1,rep,name=sbiNames,proto3" json:"sbiNames,omitempty"` +} + +func (x *AllSBINamesReply) Reset() { + *x = AllSBINamesReply{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdnCLI_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AllSBINamesReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AllSBINamesReply) ProtoMessage() {} + +func (x *AllSBINamesReply) ProtoReflect() protoreflect.Message { + mi := &file_gosdnCLI_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AllSBINamesReply.ProtoReflect.Descriptor instead. +func (*AllSBINamesReply) Descriptor() ([]byte, []int) { + return file_gosdnCLI_proto_rawDescGZIP(), []int{7} +} + +func (x *AllSBINamesReply) GetSbiNames() []string { + if x != nil { + return x.SbiNames + } + return nil +} + // type CreatePNDReply struct { state protoimpl.MessageState @@ -397,7 +444,7 @@ type CreatePNDReply struct { func (x *CreatePNDReply) Reset() { *x = CreatePNDReply{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[7] + mi := &file_gosdnCLI_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -410,7 +457,7 @@ func (x *CreatePNDReply) String() string { func (*CreatePNDReply) ProtoMessage() {} func (x *CreatePNDReply) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[7] + mi := &file_gosdnCLI_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -423,7 +470,7 @@ func (x *CreatePNDReply) ProtoReflect() protoreflect.Message { // Deprecated: Use CreatePNDReply.ProtoReflect.Descriptor instead. func (*CreatePNDReply) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{7} + return file_gosdnCLI_proto_rawDescGZIP(), []int{8} } func (x *CreatePNDReply) GetMessage() string { @@ -445,7 +492,7 @@ type AllPNDsReply struct { func (x *AllPNDsReply) Reset() { *x = AllPNDsReply{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[8] + mi := &file_gosdnCLI_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -458,7 +505,7 @@ func (x *AllPNDsReply) String() string { func (*AllPNDsReply) ProtoMessage() {} func (x *AllPNDsReply) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[8] + mi := &file_gosdnCLI_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -471,7 +518,7 @@ func (x *AllPNDsReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AllPNDsReply.ProtoReflect.Descriptor instead. func (*AllPNDsReply) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{8} + return file_gosdnCLI_proto_rawDescGZIP(), []int{9} } func (x *AllPNDsReply) GetPnds() []*PND { @@ -496,7 +543,7 @@ type PND struct { func (x *PND) Reset() { *x = PND{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[9] + mi := &file_gosdnCLI_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -509,7 +556,7 @@ func (x *PND) String() string { func (*PND) ProtoMessage() {} func (x *PND) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[9] + mi := &file_gosdnCLI_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -522,7 +569,7 @@ func (x *PND) ProtoReflect() protoreflect.Message { // Deprecated: Use PND.ProtoReflect.Descriptor instead. func (*PND) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{9} + return file_gosdnCLI_proto_rawDescGZIP(), []int{10} } func (x *PND) GetUuid() string { @@ -574,7 +621,7 @@ type Device struct { func (x *Device) Reset() { *x = Device{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[10] + mi := &file_gosdnCLI_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -587,7 +634,7 @@ func (x *Device) String() string { func (*Device) ProtoMessage() {} func (x *Device) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[10] + mi := &file_gosdnCLI_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -600,7 +647,7 @@ func (x *Device) ProtoReflect() protoreflect.Message { // Deprecated: Use Device.ProtoReflect.Descriptor instead. func (*Device) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{10} + return file_gosdnCLI_proto_rawDescGZIP(), []int{11} } func (x *Device) GetUuid() string { @@ -643,7 +690,7 @@ type AddDeviceRequest struct { func (x *AddDeviceRequest) Reset() { *x = AddDeviceRequest{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[11] + mi := &file_gosdnCLI_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -656,7 +703,7 @@ func (x *AddDeviceRequest) String() string { func (*AddDeviceRequest) ProtoMessage() {} func (x *AddDeviceRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[11] + mi := &file_gosdnCLI_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -669,7 +716,7 @@ func (x *AddDeviceRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AddDeviceRequest.ProtoReflect.Descriptor instead. func (*AddDeviceRequest) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{11} + return file_gosdnCLI_proto_rawDescGZIP(), []int{12} } func (x *AddDeviceRequest) GetUuidPND() string { @@ -697,7 +744,7 @@ type AddDeviceReply struct { func (x *AddDeviceReply) Reset() { *x = AddDeviceReply{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[12] + mi := &file_gosdnCLI_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -710,7 +757,7 @@ func (x *AddDeviceReply) String() string { func (*AddDeviceReply) ProtoMessage() {} func (x *AddDeviceReply) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[12] + mi := &file_gosdnCLI_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -723,7 +770,7 @@ func (x *AddDeviceReply) ProtoReflect() protoreflect.Message { // Deprecated: Use AddDeviceReply.ProtoReflect.Descriptor instead. func (*AddDeviceReply) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{12} + return file_gosdnCLI_proto_rawDescGZIP(), []int{13} } func (x *AddDeviceReply) GetMessage() string { @@ -733,6 +780,116 @@ func (x *AddDeviceReply) GetMessage() string { return "" } +type DeviceGetRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + UuidPND string `protobuf:"bytes,1,opt,name=uuidPND,proto3" json:"uuidPND,omitempty"` + UuidDevice string `protobuf:"bytes,2,opt,name=uuidDevice,proto3" json:"uuidDevice,omitempty"` + Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` +} + +func (x *DeviceGetRequest) Reset() { + *x = DeviceGetRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdnCLI_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceGetRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceGetRequest) ProtoMessage() {} + +func (x *DeviceGetRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdnCLI_proto_msgTypes[14] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceGetRequest.ProtoReflect.Descriptor instead. +func (*DeviceGetRequest) Descriptor() ([]byte, []int) { + return file_gosdnCLI_proto_rawDescGZIP(), []int{14} +} + +func (x *DeviceGetRequest) GetUuidPND() string { + if x != nil { + return x.UuidPND + } + return "" +} + +func (x *DeviceGetRequest) GetUuidDevice() string { + if x != nil { + return x.UuidDevice + } + return "" +} + +func (x *DeviceGetRequest) GetPath() string { + if x != nil { + return x.Path + } + return "" +} + +type DeviceGetReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *DeviceGetReply) Reset() { + *x = DeviceGetReply{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdnCLI_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeviceGetReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeviceGetReply) ProtoMessage() {} + +func (x *DeviceGetReply) ProtoReflect() protoreflect.Message { + mi := &file_gosdnCLI_proto_msgTypes[15] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeviceGetReply.ProtoReflect.Descriptor instead. +func (*DeviceGetReply) Descriptor() ([]byte, []int) { + return file_gosdnCLI_proto_rawDescGZIP(), []int{15} +} + +func (x *DeviceGetReply) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + // The response message containing a string with a goSDN log type LogReply struct { state protoimpl.MessageState @@ -745,7 +902,7 @@ type LogReply struct { func (x *LogReply) Reset() { *x = LogReply{} if protoimpl.UnsafeEnabled { - mi := &file_gosdnCLI_proto_msgTypes[13] + mi := &file_gosdnCLI_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -758,7 +915,7 @@ func (x *LogReply) String() string { func (*LogReply) ProtoMessage() {} func (x *LogReply) ProtoReflect() protoreflect.Message { - mi := &file_gosdnCLI_proto_msgTypes[13] + mi := &file_gosdnCLI_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -771,7 +928,7 @@ func (x *LogReply) ProtoReflect() protoreflect.Message { // Deprecated: Use LogReply.ProtoReflect.Descriptor instead. func (*LogReply) Descriptor() ([]byte, []int) { - return file_gosdnCLI_proto_rawDescGZIP(), []int{13} + return file_gosdnCLI_proto_rawDescGZIP(), []int{16} } func (x *LogReply) GetLog() string { @@ -809,7 +966,10 @@ var file_gosdnCLI_proto_rawDesc = []byte{ 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x62, 0x69, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x73, 0x62, 0x69, 0x22, 0x2a, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x09, 0x52, 0x03, 0x73, 0x62, 0x69, 0x22, 0x2e, 0x0a, 0x10, 0x41, 0x6c, 0x6c, 0x53, 0x42, 0x49, + 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x62, + 0x69, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x73, 0x62, + 0x69, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x22, 0x2a, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x4e, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x2e, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x50, 0x4e, 0x44, 0x73, 0x52, 0x65, 0x70, @@ -839,48 +999,66 @@ var file_gosdnCLI_proto_rawDesc = []byte{ 0x76, 0x69, 0x63, 0x65, 0x22, 0x2a, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x22, 0x1c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6c, 0x6f, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x32, 0x9f, - 0x04, 0x0a, 0x07, 0x47, 0x72, 0x70, 0x63, 0x43, 0x6c, 0x69, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, - 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, - 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x12, 0x3a, 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x16, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x68, 0x75, - 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0f, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, - 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x30, 0x01, 0x12, 0x35, 0x0a, 0x0b, - 0x54, 0x41, 0x50, 0x49, 0x47, 0x65, 0x74, 0x45, 0x64, 0x67, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, + 0x22, 0x60, 0x0a, 0x10, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x75, 0x69, 0x64, 0x50, 0x4e, 0x44, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x75, 0x75, 0x69, 0x64, 0x50, 0x4e, 0x44, 0x12, 0x1e, + 0x0a, 0x0a, 0x75, 0x75, 0x69, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x75, 0x75, 0x69, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, + 0x74, 0x68, 0x22, 0x2a, 0x0a, 0x0e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x1c, + 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x6f, + 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6c, 0x6f, 0x67, 0x32, 0xb0, 0x05, 0x0a, + 0x07, 0x47, 0x72, 0x70, 0x63, 0x43, 0x6c, 0x69, 0x12, 0x34, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, + 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x6c, + 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, + 0x0a, 0x08, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12, 0x16, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x68, 0x75, 0x74, 0x64, + 0x6f, 0x77, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0f, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x16, 0x2e, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, + 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4c, 0x6f, + 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x30, 0x01, 0x12, 0x35, 0x0a, 0x0b, 0x54, 0x41, + 0x50, 0x49, 0x47, 0x65, 0x74, 0x45, 0x64, 0x67, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, + 0x00, 0x12, 0x39, 0x0a, 0x0f, 0x54, 0x41, 0x50, 0x49, 0x47, 0x65, 0x74, 0x45, 0x64, 0x67, 0x65, + 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, + 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x35, 0x0a, 0x0b, + 0x54, 0x41, 0x50, 0x49, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x70, 0x6c, - 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0f, 0x54, 0x41, 0x50, 0x49, 0x47, 0x65, 0x74, 0x45, 0x64, - 0x67, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, - 0x41, 0x50, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x35, - 0x0a, 0x0b, 0x54, 0x41, 0x50, 0x49, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x12, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x54, 0x41, 0x50, 0x49, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, - 0x4e, 0x44, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x50, 0x4e, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x4e, 0x44, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x4e, - 0x44, 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x6c, 0x50, 0x4e, 0x44, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x12, 0x3d, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x12, 0x17, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, - 0x42, 0x50, 0x0a, 0x1e, 0x64, 0x65, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x66, 0x62, 0x69, 0x2e, - 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6c, 0x69, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x42, 0x0c, 0x63, 0x6c, 0x69, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, - 0x50, 0x01, 0x5a, 0x1e, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, - 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x63, 0x6f, 0x63, 0x73, 0x6e, 0x2f, 0x67, 0x6f, 0x73, - 0x64, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x09, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x4e, 0x44, + 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x4e, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x4e, 0x44, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x4e, 0x44, 0x73, + 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x41, 0x6c, 0x6c, 0x50, 0x4e, 0x44, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x43, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x41, 0x6c, 0x6c, 0x53, 0x42, 0x49, 0x4e, 0x61, 0x6d, 0x65, + 0x73, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x41, 0x6c, 0x6c, 0x53, 0x42, 0x49, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x70, + 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x09, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x41, 0x64, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x4a, 0x0a, 0x16, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x44, 0x65, 0x76, + 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, + 0x65, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, + 0x50, 0x0a, 0x1e, 0x64, 0x65, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x67, + 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6c, 0x69, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x42, 0x0c, 0x63, 0x6c, 0x69, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x50, + 0x01, 0x5a, 0x1e, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, + 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x63, 0x6f, 0x63, 0x73, 0x6e, 0x2f, 0x67, 0x6f, 0x73, 0x64, + 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -895,7 +1073,7 @@ func file_gosdnCLI_proto_rawDescGZIP() []byte { return file_gosdnCLI_proto_rawDescData } -var file_gosdnCLI_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_gosdnCLI_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_gosdnCLI_proto_goTypes = []interface{}{ (*HelloRequest)(nil), // 0: proto.HelloRequest (*HelloReply)(nil), // 1: proto.HelloReply @@ -904,39 +1082,46 @@ var file_gosdnCLI_proto_goTypes = []interface{}{ (*TAPIRequest)(nil), // 4: proto.TAPIRequest (*TAPIReply)(nil), // 5: proto.TAPIReply (*CreatePNDRequest)(nil), // 6: proto.CreatePNDRequest - (*CreatePNDReply)(nil), // 7: proto.CreatePNDReply - (*AllPNDsReply)(nil), // 8: proto.AllPNDsReply - (*PND)(nil), // 9: proto.PND - (*Device)(nil), // 10: proto.Device - (*AddDeviceRequest)(nil), // 11: proto.AddDeviceRequest - (*AddDeviceReply)(nil), // 12: proto.AddDeviceReply - (*LogReply)(nil), // 13: proto.LogReply - (*emptypb.Empty)(nil), // 14: google.protobuf.Empty + (*AllSBINamesReply)(nil), // 7: proto.AllSBINamesReply + (*CreatePNDReply)(nil), // 8: proto.CreatePNDReply + (*AllPNDsReply)(nil), // 9: proto.AllPNDsReply + (*PND)(nil), // 10: proto.PND + (*Device)(nil), // 11: proto.Device + (*AddDeviceRequest)(nil), // 12: proto.AddDeviceRequest + (*AddDeviceReply)(nil), // 13: proto.AddDeviceReply + (*DeviceGetRequest)(nil), // 14: proto.DeviceGetRequest + (*DeviceGetReply)(nil), // 15: proto.DeviceGetReply + (*LogReply)(nil), // 16: proto.LogReply + (*emptypb.Empty)(nil), // 17: google.protobuf.Empty } var file_gosdnCLI_proto_depIdxs = []int32{ - 9, // 0: proto.AllPNDsReply.pnds:type_name -> proto.PND - 10, // 1: proto.PND.devices:type_name -> proto.Device - 10, // 2: proto.AddDeviceRequest.device:type_name -> proto.Device + 10, // 0: proto.AllPNDsReply.pnds:type_name -> proto.PND + 11, // 1: proto.PND.devices:type_name -> proto.Device + 11, // 2: proto.AddDeviceRequest.device:type_name -> proto.Device 0, // 3: proto.GrpcCli.SayHello:input_type -> proto.HelloRequest 2, // 4: proto.GrpcCli.Shutdown:input_type -> proto.ShutdownRequest - 14, // 5: proto.GrpcCli.CreateLogStream:input_type -> google.protobuf.Empty + 17, // 5: proto.GrpcCli.CreateLogStream:input_type -> google.protobuf.Empty 4, // 6: proto.GrpcCli.TAPIGetEdge:input_type -> proto.TAPIRequest 4, // 7: proto.GrpcCli.TAPIGetEdgeNode:input_type -> proto.TAPIRequest 4, // 8: proto.GrpcCli.TAPIGetLink:input_type -> proto.TAPIRequest 6, // 9: proto.GrpcCli.CreatePND:input_type -> proto.CreatePNDRequest - 14, // 10: proto.GrpcCli.GetAllPNDs:input_type -> google.protobuf.Empty - 11, // 11: proto.GrpcCli.AddDevice:input_type -> proto.AddDeviceRequest - 1, // 12: proto.GrpcCli.SayHello:output_type -> proto.HelloReply - 3, // 13: proto.GrpcCli.Shutdown:output_type -> proto.ShutdownReply - 13, // 14: proto.GrpcCli.CreateLogStream:output_type -> proto.LogReply - 5, // 15: proto.GrpcCli.TAPIGetEdge:output_type -> proto.TAPIReply - 5, // 16: proto.GrpcCli.TAPIGetEdgeNode:output_type -> proto.TAPIReply - 5, // 17: proto.GrpcCli.TAPIGetLink:output_type -> proto.TAPIReply - 7, // 18: proto.GrpcCli.CreatePND:output_type -> proto.CreatePNDReply - 8, // 19: proto.GrpcCli.GetAllPNDs:output_type -> proto.AllPNDsReply - 12, // 20: proto.GrpcCli.AddDevice:output_type -> proto.AddDeviceReply - 12, // [12:21] is the sub-list for method output_type - 3, // [3:12] is the sub-list for method input_type + 17, // 10: proto.GrpcCli.GetAllPNDs:input_type -> google.protobuf.Empty + 17, // 11: proto.GrpcCli.GetAllSBINames:input_type -> google.protobuf.Empty + 12, // 12: proto.GrpcCli.AddDevice:input_type -> proto.AddDeviceRequest + 14, // 13: proto.GrpcCli.HandleDeviceGetRequest:input_type -> proto.DeviceGetRequest + 1, // 14: proto.GrpcCli.SayHello:output_type -> proto.HelloReply + 3, // 15: proto.GrpcCli.Shutdown:output_type -> proto.ShutdownReply + 16, // 16: proto.GrpcCli.CreateLogStream:output_type -> proto.LogReply + 5, // 17: proto.GrpcCli.TAPIGetEdge:output_type -> proto.TAPIReply + 5, // 18: proto.GrpcCli.TAPIGetEdgeNode:output_type -> proto.TAPIReply + 5, // 19: proto.GrpcCli.TAPIGetLink:output_type -> proto.TAPIReply + 8, // 20: proto.GrpcCli.CreatePND:output_type -> proto.CreatePNDReply + 9, // 21: proto.GrpcCli.GetAllPNDs:output_type -> proto.AllPNDsReply + 7, // 22: proto.GrpcCli.GetAllSBINames:output_type -> proto.AllSBINamesReply + 13, // 23: proto.GrpcCli.AddDevice:output_type -> proto.AddDeviceReply + 15, // 24: proto.GrpcCli.HandleDeviceGetRequest:output_type -> proto.DeviceGetReply + 14, // [14:25] is the sub-list for method output_type + 3, // [3:14] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -1033,7 +1218,7 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreatePNDReply); i { + switch v := v.(*AllSBINamesReply); i { case 0: return &v.state case 1: @@ -1045,7 +1230,7 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AllPNDsReply); i { + switch v := v.(*CreatePNDReply); i { case 0: return &v.state case 1: @@ -1057,7 +1242,7 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PND); i { + switch v := v.(*AllPNDsReply); i { case 0: return &v.state case 1: @@ -1069,7 +1254,7 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Device); i { + switch v := v.(*PND); i { case 0: return &v.state case 1: @@ -1081,7 +1266,7 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddDeviceRequest); i { + switch v := v.(*Device); i { case 0: return &v.state case 1: @@ -1093,7 +1278,7 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AddDeviceReply); i { + switch v := v.(*AddDeviceRequest); i { case 0: return &v.state case 1: @@ -1105,6 +1290,42 @@ func file_gosdnCLI_proto_init() { } } file_gosdnCLI_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddDeviceReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdnCLI_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceGetRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdnCLI_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeviceGetReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdnCLI_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*LogReply); i { case 0: return &v.state @@ -1123,7 +1344,7 @@ func file_gosdnCLI_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gosdnCLI_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, @@ -1166,8 +1387,12 @@ type GrpcCliClient interface { CreatePND(ctx context.Context, in *CreatePNDRequest, opts ...grpc.CallOption) (*CreatePNDReply, error) // GetAllPNDs GetAllPNDs(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*AllPNDsReply, error) + // GetAllSBIs + GetAllSBINames(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*AllSBINamesReply, error) // AddDevice AddDevice(ctx context.Context, in *AddDeviceRequest, opts ...grpc.CallOption) (*AddDeviceReply, error) + // HandleDeviceGetRequest + HandleDeviceGetRequest(ctx context.Context, in *DeviceGetRequest, opts ...grpc.CallOption) (*DeviceGetReply, error) } type grpcCliClient struct { @@ -1273,6 +1498,15 @@ func (c *grpcCliClient) GetAllPNDs(ctx context.Context, in *emptypb.Empty, opts return out, nil } +func (c *grpcCliClient) GetAllSBINames(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*AllSBINamesReply, error) { + out := new(AllSBINamesReply) + err := c.cc.Invoke(ctx, "/proto.GrpcCli/GetAllSBINames", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *grpcCliClient) AddDevice(ctx context.Context, in *AddDeviceRequest, opts ...grpc.CallOption) (*AddDeviceReply, error) { out := new(AddDeviceReply) err := c.cc.Invoke(ctx, "/proto.GrpcCli/AddDevice", in, out, opts...) @@ -1282,6 +1516,15 @@ func (c *grpcCliClient) AddDevice(ctx context.Context, in *AddDeviceRequest, opt return out, nil } +func (c *grpcCliClient) HandleDeviceGetRequest(ctx context.Context, in *DeviceGetRequest, opts ...grpc.CallOption) (*DeviceGetReply, error) { + out := new(DeviceGetReply) + err := c.cc.Invoke(ctx, "/proto.GrpcCli/HandleDeviceGetRequest", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // GrpcCliServer is the server API for GrpcCli service. type GrpcCliServer interface { // Sends a greeting @@ -1301,8 +1544,12 @@ type GrpcCliServer interface { CreatePND(context.Context, *CreatePNDRequest) (*CreatePNDReply, error) // GetAllPNDs GetAllPNDs(context.Context, *emptypb.Empty) (*AllPNDsReply, error) + // GetAllSBIs + GetAllSBINames(context.Context, *emptypb.Empty) (*AllSBINamesReply, error) // AddDevice AddDevice(context.Context, *AddDeviceRequest) (*AddDeviceReply, error) + // HandleDeviceGetRequest + HandleDeviceGetRequest(context.Context, *DeviceGetRequest) (*DeviceGetReply, error) } // UnimplementedGrpcCliServer can be embedded to have forward compatible implementations. @@ -1333,9 +1580,15 @@ func (*UnimplementedGrpcCliServer) CreatePND(context.Context, *CreatePNDRequest) func (*UnimplementedGrpcCliServer) GetAllPNDs(context.Context, *emptypb.Empty) (*AllPNDsReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetAllPNDs not implemented") } +func (*UnimplementedGrpcCliServer) GetAllSBINames(context.Context, *emptypb.Empty) (*AllSBINamesReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAllSBINames not implemented") +} func (*UnimplementedGrpcCliServer) AddDevice(context.Context, *AddDeviceRequest) (*AddDeviceReply, error) { return nil, status.Errorf(codes.Unimplemented, "method AddDevice not implemented") } +func (*UnimplementedGrpcCliServer) HandleDeviceGetRequest(context.Context, *DeviceGetRequest) (*DeviceGetReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method HandleDeviceGetRequest not implemented") +} func RegisterGrpcCliServer(s *grpc.Server, srv GrpcCliServer) { s.RegisterService(&_GrpcCli_serviceDesc, srv) @@ -1488,6 +1741,24 @@ func _GrpcCli_GetAllPNDs_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _GrpcCli_GetAllSBINames_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GrpcCliServer).GetAllSBINames(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.GrpcCli/GetAllSBINames", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GrpcCliServer).GetAllSBINames(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + func _GrpcCli_AddDevice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(AddDeviceRequest) if err := dec(in); err != nil { @@ -1506,6 +1777,24 @@ func _GrpcCli_AddDevice_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _GrpcCli_HandleDeviceGetRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeviceGetRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GrpcCliServer).HandleDeviceGetRequest(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/proto.GrpcCli/HandleDeviceGetRequest", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GrpcCliServer).HandleDeviceGetRequest(ctx, req.(*DeviceGetRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _GrpcCli_serviceDesc = grpc.ServiceDesc{ ServiceName: "proto.GrpcCli", HandlerType: (*GrpcCliServer)(nil), @@ -1538,10 +1827,18 @@ var _GrpcCli_serviceDesc = grpc.ServiceDesc{ MethodName: "GetAllPNDs", Handler: _GrpcCli_GetAllPNDs_Handler, }, + { + MethodName: "GetAllSBINames", + Handler: _GrpcCli_GetAllSBINames_Handler, + }, { MethodName: "AddDevice", Handler: _GrpcCli_AddDevice_Handler, }, + { + MethodName: "HandleDeviceGetRequest", + Handler: _GrpcCli_HandleDeviceGetRequest_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/api/proto/gosdnCLI.proto b/api/proto/gosdnCLI.proto index 72bba8df0..de0dc9d36 100644 --- a/api/proto/gosdnCLI.proto +++ b/api/proto/gosdnCLI.proto @@ -30,8 +30,12 @@ service GrpcCli { rpc CreatePND (CreatePNDRequest) returns (CreatePNDReply) {} // GetAllPNDs rpc GetAllPNDs(google.protobuf.Empty) returns (AllPNDsReply) {} + // GetAllSBIs + rpc GetAllSBINames(google.protobuf.Empty) returns (AllSBINamesReply) {} // AddDevice rpc AddDevice(AddDeviceRequest) returns (AddDeviceReply) {} + // HandleDeviceGetRequest + rpc HandleDeviceGetRequest(DeviceGetRequest) returns (DeviceGetReply) {} } // The request message containing the user's name. @@ -72,6 +76,10 @@ message CreatePNDRequest { string sbi = 3; } +message AllSBINamesReply { + repeated string sbiNames = 1; +} + // message CreatePNDReply { string message = 1; @@ -106,6 +114,16 @@ message AddDeviceReply { string message = 1; } +message DeviceGetRequest { + string uuidPND = 1; + string uuidDevice = 2; + string path = 3; +} + +message DeviceGetReply { + string message = 1; +} + // The response message containing a string with a goSDN log message LogReply { string log = 1; diff --git a/nucleus/cli-handling.go b/nucleus/cli-handling.go index 8fba4a5d3..2998d38c5 100644 --- a/nucleus/cli-handling.go +++ b/nucleus/cli-handling.go @@ -8,14 +8,18 @@ package nucleus import ( "context" - "github.com/google/uuid" - "github.com/spf13/viper" + "encoding/json" + "errors" "io" "net" "os" "sync" + "github.com/google/uuid" + "github.com/spf13/viper" + pb "code.fbi.h-da.de/cocsn/gosdn/api/proto" + "code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi" log "github.com/sirupsen/logrus" "google.golang.org/grpc" "google.golang.org/grpc/health" @@ -155,13 +159,14 @@ func (s *server) TAPIGetLink(ctx context.Context, in *pb.TAPIRequest) (*pb.TAPIR func (s *server) CreatePND(ctx context.Context, in *pb.CreatePNDRequest) (*pb.CreatePNDReply, error) { log.Info("Received: Create a PND with the name", in.GetName()) - path := viper.GetString("pnd.path") - sbi := &OpenConfig{} + sbi := s.core.southboundInterfaces[in.GetSbi()] + if sbi == nil { + log.Info("lul") + } id := uuid.New() s.core.principalNetworkDomains[id] = NewPND(in.GetName(), in.GetDescription(), sbi) - if err := s.core.savePNDs(path); err != nil { - log.Info(err) - } + //TODO: export + return &pb.CreatePNDReply{Message: "Created new PND: " + id.String()}, nil } @@ -182,32 +187,85 @@ func (s *server) GetAllPNDs(ctx context.Context, in *emptypb.Empty) (*pb.AllPNDs Uuid: uuidPND.String(), Name: pnd.GetName(), Description: pnd.GetDescription(), - Sbi: pnd.GetDefaultSBIName(), - Devices: devices} + Sbi: pnd.GetSBIs()["default"].SbiIdentifier(), + Devices: devices, + } pnds = append(pnds, &tmpPND) } return &pb.AllPNDsReply{Pnds: pnds}, nil } +func (s *server) GetAllSBINames(ctx context.Context, in *emptypb.Empty) (*pb.AllSBINamesReply, error) { + sbiNames := make([]string, len(s.core.southboundInterfaces)) + for _, s := range s.core.southboundInterfaces { + sbiNames = append(sbiNames, s.SbiIdentifier()) + } + return &pb.AllSBINamesReply{SbiNames: sbiNames}, nil +} + func (s *server) AddDevice(ctx context.Context, in *pb.AddDeviceRequest) (*pb.AddDeviceReply, error) { - path := viper.GetString("pnd.path") + log.Info("Received: AddDevice") uuidPND, err := uuid.Parse(in.UuidPND) + if err != nil { + return &pb.AddDeviceReply{Message: err.Error()}, err + } pnd := s.core.principalNetworkDomains[uuidPND] + sbi := s.core.principalNetworkDomains[uuidPND].GetSBIs()["default"] newDevice := Device{ Uuid: uuid.New(), - Device: nil, - SBI: nil, + Device: sbi.Schema().Root, + SBI: sbi, Config: DeviceConfig{ Address: in.Device.Address, Username: in.Device.Username, Password: in.Device.Password, }, + Transport: sbi.GetTransport(), } - devicesMap := pnd.(*pndImplementation).Devices + devicesMap := pnd.GetDevices() devicesMap[newDevice.Uuid] = newDevice - if err := s.core.savePNDs(path); err != nil { - log.Info(err) - } + //TODO: export + return &pb.AddDeviceReply{Message: "Added new Device: " + newDevice.Uuid.String()}, err } + +func (s *server) HandleDeviceGetRequest(ctx context.Context, in *pb.DeviceGetRequest) (*pb.DeviceGetReply, error) { + log.Info("Received: HandleDeviceGetRequest") + uuidPND, err := uuid.Parse(in.GetUuidPND()) + if err != nil { + return &pb.DeviceGetReply{Message: err.Error()}, err + } + uuidDevice, err := uuid.Parse(in.GetUuidDevice()) + if err != nil { + return &pb.DeviceGetReply{Message: err.Error()}, err + } + device, exists := s.core.principalNetworkDomains[uuidPND].GetDevices()[uuidDevice] + if exists != true { + err := errors.New("Couldnt find device: UUID is wrong") + return &pb.DeviceGetReply{Message: err.Error()}, err + } + cfg := &gnmi.Config{ + Addr: device.Config.Address, + Password: device.Config.Password, + Username: device.Config.Username, + } + ctxGnmi := gnmi.NewContext(context.Background(), cfg) + ctxGnmi = context.WithValue(ctxGnmi, "config", cfg) + + paths := []string{in.GetPath()} + req, err := gnmi.NewGetRequest(gnmi.SplitPaths(paths), "") + resp, err := GetWithRequest(ctxGnmi, req) + if err != nil { + return &pb.DeviceGetReply{Message: err.Error()}, err + } + if err := device.Add(resp); err != nil { + return &pb.DeviceGetReply{Message: err.Error()}, err + } + d, err := json.Marshal(device.Device) + if err != nil { + return &pb.DeviceGetReply{Message: err.Error()}, err + + } + return &pb.DeviceGetReply{Message: string(d)}, nil +} -- GitLab