From 3e658022e13d4978749273e5e15a1b6dd659bbfb Mon Sep 17 00:00:00 2001 From: Malte Bauch <malte.bauch@stud.h-da.de> Date: Wed, 23 Mar 2022 16:57:30 +0000 Subject: [PATCH] Resolve "Creating a new device with type plugin just returns a normal device" - This commit is a interim solution that allows to create new devices with the `--type plugin` flag. The orchestrator will only request capabilities of the provided device and build/return all the necessary files. Therefore the api has been adjusted to allow to 'only' create gostructs and do not fire up a whole csbi. - Additionaly the issue #176 has been addressed and the bug while creating multiple cSBIs has been fixed. Appending to the `.Methods` string of the global `SouthboundStruct` was the root cause for this bug. Creating a copy of `SouthboundStruct` and using the copy in the process fixes this issue. ## Related Issue <!--- This project only accepts merge requests related to open issues --> <!--- If suggesting a new feature or change, please discuss it in an issue first --> <!--- If fixing a bug, there should be an issue describing it with steps to reproduce --> <!--- Please link to the issue here: --> #175 , #176 Closes #175 --- api/go/gosdn/csbi/csbi.pb.go | 349 +++++++++++-------- api/go/gosdn/csbi/csbi_grpc.pb.go | 119 +++---- api/openapiv2/gosdn_northbound.swagger.json | 12 +- api/proto/buf.lock | 12 +- api/proto/gosdn/csbi/csbi.proto | 11 +- controller/nucleus/principalNetworkDomain.go | 70 ++-- csbi/deployment.go | 2 +- csbi/grpc.go | 81 ++--- csbi/write.go | 7 +- 9 files changed, 362 insertions(+), 301 deletions(-) diff --git a/api/go/gosdn/csbi/csbi.pb.go b/api/go/gosdn/csbi/csbi.pb.go index d6507cd6c..5cdb9a63c 100644 --- a/api/go/gosdn/csbi/csbi.pb.go +++ b/api/go/gosdn/csbi/csbi.pb.go @@ -125,7 +125,7 @@ func (x DeleteResponse_Status) Number() protoreflect.EnumNumber { // Deprecated: Use DeleteResponse_Status.Descriptor instead. func (DeleteResponse_Status) EnumDescriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{9, 0} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{10, 0} } type Syn struct { @@ -309,6 +309,61 @@ func (x *GetRequest) GetDid() []string { return nil } +type GetPayloadRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // Timestamp in nanoseconds since Epoch. + Did string `protobuf:"bytes,3,opt,name=did,proto3" json:"did,omitempty"` +} + +func (x *GetPayloadRequest) Reset() { + *x = GetPayloadRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_csbi_csbi_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPayloadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPayloadRequest) ProtoMessage() {} + +func (x *GetPayloadRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_csbi_csbi_proto_msgTypes[3] + 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 GetPayloadRequest.ProtoReflect.Descriptor instead. +func (*GetPayloadRequest) Descriptor() ([]byte, []int) { + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{3} +} + +func (x *GetPayloadRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetPayloadRequest) GetDid() string { + if x != nil { + return x.Did + } + return "" +} + type GetResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -321,7 +376,7 @@ type GetResponse struct { func (x *GetResponse) Reset() { *x = GetResponse{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[3] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -334,7 +389,7 @@ func (x *GetResponse) String() string { func (*GetResponse) ProtoMessage() {} func (x *GetResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[3] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -347,7 +402,7 @@ func (x *GetResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetResponse.ProtoReflect.Descriptor instead. func (*GetResponse) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{3} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{4} } func (x *GetResponse) GetTimestamp() int64 { @@ -377,7 +432,7 @@ type Deployment struct { func (x *Deployment) Reset() { *x = Deployment{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[4] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -390,7 +445,7 @@ func (x *Deployment) String() string { func (*Deployment) ProtoMessage() {} func (x *Deployment) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[4] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -403,7 +458,7 @@ func (x *Deployment) ProtoReflect() protoreflect.Message { // Deprecated: Use Deployment.ProtoReflect.Descriptor instead. func (*Deployment) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{4} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{5} } func (x *Deployment) GetId() string { @@ -439,7 +494,7 @@ type CreateRequest struct { func (x *CreateRequest) Reset() { *x = CreateRequest{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[5] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -452,7 +507,7 @@ func (x *CreateRequest) String() string { func (*CreateRequest) ProtoMessage() {} func (x *CreateRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[5] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -465,7 +520,7 @@ func (x *CreateRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead. func (*CreateRequest) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{5} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{6} } func (x *CreateRequest) GetTimestamp() int64 { @@ -494,7 +549,7 @@ type CreateResponse struct { func (x *CreateResponse) Reset() { *x = CreateResponse{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[6] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -507,7 +562,7 @@ func (x *CreateResponse) String() string { func (*CreateResponse) ProtoMessage() {} func (x *CreateResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[6] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -520,7 +575,7 @@ func (x *CreateResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead. func (*CreateResponse) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{6} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{7} } func (x *CreateResponse) GetTimestamp() int64 { @@ -548,7 +603,7 @@ type Payload struct { func (x *Payload) Reset() { *x = Payload{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[7] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -561,7 +616,7 @@ func (x *Payload) String() string { func (*Payload) ProtoMessage() {} func (x *Payload) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[7] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -574,7 +629,7 @@ func (x *Payload) ProtoReflect() protoreflect.Message { // Deprecated: Use Payload.ProtoReflect.Descriptor instead. func (*Payload) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{7} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{8} } func (x *Payload) GetChunk() []byte { @@ -596,7 +651,7 @@ type DeleteRequest struct { func (x *DeleteRequest) Reset() { *x = DeleteRequest{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[8] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -609,7 +664,7 @@ func (x *DeleteRequest) String() string { func (*DeleteRequest) ProtoMessage() {} func (x *DeleteRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[8] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -622,7 +677,7 @@ func (x *DeleteRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead. func (*DeleteRequest) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{8} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{9} } func (x *DeleteRequest) GetTimestamp() int64 { @@ -651,7 +706,7 @@ type DeleteResponse struct { func (x *DeleteResponse) Reset() { *x = DeleteResponse{} if protoimpl.UnsafeEnabled { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[9] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -664,7 +719,7 @@ func (x *DeleteResponse) String() string { func (*DeleteResponse) ProtoMessage() {} func (x *DeleteResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_csbi_csbi_proto_msgTypes[9] + mi := &file_gosdn_csbi_csbi_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -677,7 +732,7 @@ func (x *DeleteResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead. func (*DeleteResponse) Descriptor() ([]byte, []int) { - return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{9} + return file_gosdn_csbi_csbi_proto_rawDescGZIP(), []int{10} } func (x *DeleteResponse) GetTimestamp() int64 { @@ -718,90 +773,95 @@ var file_gosdn_csbi_csbi_proto_rawDesc = []byte{ 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6c, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x61, 0x6c, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x69, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x03, 0x64, 0x69, 0x64, 0x22, 0x65, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x52, 0x03, 0x64, 0x69, 0x64, 0x22, 0x43, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x50, 0x61, 0x79, 0x6c, + 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x69, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x69, 0x64, 0x22, 0x65, 0x0a, 0x0b, 0x47, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, + 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, + 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x22, 0x59, 0x0a, 0x0a, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x7a, 0x0a, 0x0d, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x4b, 0x0a, 0x10, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, + 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, + 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6c, + 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, + 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, + 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, + 0x74, 0x73, 0x22, 0x1f, 0x0a, 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x14, 0x0a, + 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, + 0x75, 0x6e, 0x6b, 0x22, 0x3f, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, - 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x52, - 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x59, 0x0a, 0x0a, - 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x27, - 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, - 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0x7a, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x4b, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x20, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, - 0x72, 0x74, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x12, 0x38, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, - 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, - 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, - 0x52, 0x0b, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x1f, 0x0a, - 0x07, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, - 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x3f, - 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, - 0x03, 0x64, 0x69, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x64, 0x69, 0x64, 0x22, - 0xac, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x12, 0x39, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x41, 0x0a, 0x06, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, - 0x09, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, - 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x2a, 0x85, - 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x41, 0x54, - 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x41, 0x4e, 0x4e, 0x4f, 0x55, 0x4e, 0x43, - 0x45, 0x44, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x42, 0x55, - 0x49, 0x4c, 0x54, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, - 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x45, 0x44, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, - 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, - 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x45, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x53, 0x53, 0x49, - 0x4f, 0x4e, 0x45, 0x44, 0x10, 0x05, 0x32, 0xb2, 0x03, 0x0a, 0x0b, 0x43, 0x73, 0x62, 0x69, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, - 0x62, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, - 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x16, 0x2e, - 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, - 0x62, 0x69, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x30, 0x01, 0x12, 0x3c, 0x0a, 0x0b, - 0x47, 0x65, 0x74, 0x4d, 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, - 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, - 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x30, 0x01, 0x12, 0x3f, 0x0a, 0x06, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, - 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, - 0x62, 0x69, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, - 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x0f, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, - 0x62, 0x69, 0x2e, 0x53, 0x79, 0x6e, 0x1a, 0x0f, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, - 0x73, 0x62, 0x69, 0x2e, 0x41, 0x63, 0x6b, 0x12, 0x42, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x47, 0x6f, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, - 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, - 0x69, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x30, 0x01, 0x42, 0x30, 0x5a, 0x2e, 0x63, - 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, - 0x64, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x67, 0x6f, 0x2f, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x63, 0x73, 0x62, 0x69, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x64, 0x69, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x03, 0x64, 0x69, 0x64, 0x22, 0xac, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x39, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, + 0x62, 0x69, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x22, 0x41, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, + 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, + 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4f, 0x4b, 0x10, + 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x52, 0x52, 0x4f, + 0x52, 0x10, 0x02, 0x2a, 0x85, 0x01, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x15, 0x0a, + 0x11, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x41, 0x4e, + 0x4e, 0x4f, 0x55, 0x4e, 0x43, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, + 0x54, 0x45, 0x5f, 0x42, 0x55, 0x49, 0x4c, 0x54, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, + 0x41, 0x54, 0x45, 0x5f, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x45, 0x44, 0x10, 0x03, 0x12, 0x11, + 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x52, 0x55, 0x4e, 0x4e, 0x49, 0x4e, 0x47, 0x10, + 0x04, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x45, 0x43, 0x4f, 0x4d, + 0x4d, 0x49, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x45, 0x44, 0x10, 0x05, 0x32, 0xc5, 0x03, 0x0a, 0x0b, + 0x43, 0x73, 0x62, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x36, 0x0a, 0x03, 0x47, + 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, + 0x47, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x47, 0x6f, 0x53, 0x74, 0x72, 0x75, + 0x63, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, + 0x47, 0x65, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x13, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x50, + 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x30, 0x01, 0x12, 0x43, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x4d, + 0x61, 0x6e, 0x69, 0x66, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, + 0x63, 0x73, 0x62, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, + 0x73, 0x62, 0x69, 0x2e, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x30, 0x01, 0x12, 0x3f, 0x0a, + 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, + 0x63, 0x73, 0x62, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, + 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x47, 0x6f, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, + 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, 0x6f, + 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, + 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x48, 0x65, 0x6c, 0x6c, + 0x6f, 0x12, 0x0f, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, 0x53, + 0x79, 0x6e, 0x1a, 0x0f, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x73, 0x62, 0x69, 0x2e, + 0x41, 0x63, 0x6b, 0x42, 0x30, 0x5a, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, + 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x64, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x67, 0x6f, + 0x73, 0x64, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x6f, 0x73, 0x64, 0x6e, + 0x2f, 0x63, 0x73, 0x62, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -817,43 +877,44 @@ func file_gosdn_csbi_csbi_proto_rawDescGZIP() []byte { } var file_gosdn_csbi_csbi_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_gosdn_csbi_csbi_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_gosdn_csbi_csbi_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_gosdn_csbi_csbi_proto_goTypes = []interface{}{ (State)(0), // 0: gosdn.csbi.State (DeleteResponse_Status)(0), // 1: gosdn.csbi.DeleteResponse.Status (*Syn)(nil), // 2: gosdn.csbi.Syn (*Ack)(nil), // 3: gosdn.csbi.Ack (*GetRequest)(nil), // 4: gosdn.csbi.GetRequest - (*GetResponse)(nil), // 5: gosdn.csbi.GetResponse - (*Deployment)(nil), // 6: gosdn.csbi.Deployment - (*CreateRequest)(nil), // 7: gosdn.csbi.CreateRequest - (*CreateResponse)(nil), // 8: gosdn.csbi.CreateResponse - (*Payload)(nil), // 9: gosdn.csbi.Payload - (*DeleteRequest)(nil), // 10: gosdn.csbi.DeleteRequest - (*DeleteResponse)(nil), // 11: gosdn.csbi.DeleteResponse - (*transport.TransportOption)(nil), // 12: gosdn.transport.TransportOption + (*GetPayloadRequest)(nil), // 5: gosdn.csbi.GetPayloadRequest + (*GetResponse)(nil), // 6: gosdn.csbi.GetResponse + (*Deployment)(nil), // 7: gosdn.csbi.Deployment + (*CreateRequest)(nil), // 8: gosdn.csbi.CreateRequest + (*CreateResponse)(nil), // 9: gosdn.csbi.CreateResponse + (*Payload)(nil), // 10: gosdn.csbi.Payload + (*DeleteRequest)(nil), // 11: gosdn.csbi.DeleteRequest + (*DeleteResponse)(nil), // 12: gosdn.csbi.DeleteResponse + (*transport.TransportOption)(nil), // 13: gosdn.transport.TransportOption } var file_gosdn_csbi_csbi_proto_depIdxs = []int32{ - 12, // 0: gosdn.csbi.Ack.transport_option:type_name -> gosdn.transport.TransportOption - 6, // 1: gosdn.csbi.GetResponse.deployments:type_name -> gosdn.csbi.Deployment + 13, // 0: gosdn.csbi.Ack.transport_option:type_name -> gosdn.transport.TransportOption + 7, // 1: gosdn.csbi.GetResponse.deployments:type_name -> gosdn.csbi.Deployment 0, // 2: gosdn.csbi.Deployment.state:type_name -> gosdn.csbi.State - 12, // 3: gosdn.csbi.CreateRequest.transport_option:type_name -> gosdn.transport.TransportOption - 6, // 4: gosdn.csbi.CreateResponse.deployments:type_name -> gosdn.csbi.Deployment + 13, // 3: gosdn.csbi.CreateRequest.transport_option:type_name -> gosdn.transport.TransportOption + 7, // 4: gosdn.csbi.CreateResponse.deployments:type_name -> gosdn.csbi.Deployment 1, // 5: gosdn.csbi.DeleteResponse.status:type_name -> gosdn.csbi.DeleteResponse.Status 4, // 6: gosdn.csbi.CsbiService.Get:input_type -> gosdn.csbi.GetRequest - 4, // 7: gosdn.csbi.CsbiService.GetGoStruct:input_type -> gosdn.csbi.GetRequest - 4, // 8: gosdn.csbi.CsbiService.GetManifest:input_type -> gosdn.csbi.GetRequest - 7, // 9: gosdn.csbi.CsbiService.Create:input_type -> gosdn.csbi.CreateRequest - 10, // 10: gosdn.csbi.CsbiService.Delete:input_type -> gosdn.csbi.DeleteRequest - 2, // 11: gosdn.csbi.CsbiService.Hello:input_type -> gosdn.csbi.Syn - 7, // 12: gosdn.csbi.CsbiService.CreateGoStruct:input_type -> gosdn.csbi.CreateRequest - 5, // 13: gosdn.csbi.CsbiService.Get:output_type -> gosdn.csbi.GetResponse - 9, // 14: gosdn.csbi.CsbiService.GetGoStruct:output_type -> gosdn.csbi.Payload - 9, // 15: gosdn.csbi.CsbiService.GetManifest:output_type -> gosdn.csbi.Payload - 8, // 16: gosdn.csbi.CsbiService.Create:output_type -> gosdn.csbi.CreateResponse - 11, // 17: gosdn.csbi.CsbiService.Delete:output_type -> gosdn.csbi.DeleteResponse - 3, // 18: gosdn.csbi.CsbiService.Hello:output_type -> gosdn.csbi.Ack - 9, // 19: gosdn.csbi.CsbiService.CreateGoStruct:output_type -> gosdn.csbi.Payload + 5, // 7: gosdn.csbi.CsbiService.GetGoStruct:input_type -> gosdn.csbi.GetPayloadRequest + 5, // 8: gosdn.csbi.CsbiService.GetManifest:input_type -> gosdn.csbi.GetPayloadRequest + 8, // 9: gosdn.csbi.CsbiService.Create:input_type -> gosdn.csbi.CreateRequest + 8, // 10: gosdn.csbi.CsbiService.CreateGoStruct:input_type -> gosdn.csbi.CreateRequest + 11, // 11: gosdn.csbi.CsbiService.Delete:input_type -> gosdn.csbi.DeleteRequest + 2, // 12: gosdn.csbi.CsbiService.Hello:input_type -> gosdn.csbi.Syn + 6, // 13: gosdn.csbi.CsbiService.Get:output_type -> gosdn.csbi.GetResponse + 10, // 14: gosdn.csbi.CsbiService.GetGoStruct:output_type -> gosdn.csbi.Payload + 10, // 15: gosdn.csbi.CsbiService.GetManifest:output_type -> gosdn.csbi.Payload + 9, // 16: gosdn.csbi.CsbiService.Create:output_type -> gosdn.csbi.CreateResponse + 9, // 17: gosdn.csbi.CsbiService.CreateGoStruct:output_type -> gosdn.csbi.CreateResponse + 12, // 18: gosdn.csbi.CsbiService.Delete:output_type -> gosdn.csbi.DeleteResponse + 3, // 19: gosdn.csbi.CsbiService.Hello:output_type -> gosdn.csbi.Ack 13, // [13:20] is the sub-list for method output_type 6, // [6:13] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name @@ -904,7 +965,7 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetResponse); i { + switch v := v.(*GetPayloadRequest); i { case 0: return &v.state case 1: @@ -916,7 +977,7 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Deployment); i { + switch v := v.(*GetResponse); i { case 0: return &v.state case 1: @@ -928,7 +989,7 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateRequest); i { + switch v := v.(*Deployment); i { case 0: return &v.state case 1: @@ -940,7 +1001,7 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateResponse); i { + switch v := v.(*CreateRequest); i { case 0: return &v.state case 1: @@ -952,7 +1013,7 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Payload); i { + switch v := v.(*CreateResponse); i { case 0: return &v.state case 1: @@ -964,7 +1025,7 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeleteRequest); i { + switch v := v.(*Payload); i { case 0: return &v.state case 1: @@ -976,6 +1037,18 @@ func file_gosdn_csbi_csbi_proto_init() { } } file_gosdn_csbi_csbi_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_csbi_csbi_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DeleteResponse); i { case 0: return &v.state @@ -994,7 +1067,7 @@ func file_gosdn_csbi_csbi_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gosdn_csbi_csbi_proto_rawDesc, NumEnums: 2, - NumMessages: 10, + NumMessages: 11, NumExtensions: 0, NumServices: 1, }, diff --git a/api/go/gosdn/csbi/csbi_grpc.pb.go b/api/go/gosdn/csbi/csbi_grpc.pb.go index 9811ad686..29099c0b5 100644 --- a/api/go/gosdn/csbi/csbi_grpc.pb.go +++ b/api/go/gosdn/csbi/csbi_grpc.pb.go @@ -19,12 +19,12 @@ const _ = grpc.SupportPackageIsVersion7 // 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. type CsbiServiceClient interface { Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) - GetGoStruct(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (CsbiService_GetGoStructClient, error) - GetManifest(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (CsbiService_GetManifestClient, error) + GetGoStruct(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (CsbiService_GetGoStructClient, error) + GetManifest(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (CsbiService_GetManifestClient, error) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) + CreateGoStruct(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) Hello(ctx context.Context, in *Syn, opts ...grpc.CallOption) (*Ack, error) - CreateGoStruct(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (CsbiService_CreateGoStructClient, error) } type csbiServiceClient struct { @@ -44,7 +44,7 @@ func (c *csbiServiceClient) Get(ctx context.Context, in *GetRequest, opts ...grp return out, nil } -func (c *csbiServiceClient) GetGoStruct(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (CsbiService_GetGoStructClient, error) { +func (c *csbiServiceClient) GetGoStruct(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (CsbiService_GetGoStructClient, error) { stream, err := c.cc.NewStream(ctx, &CsbiService_ServiceDesc.Streams[0], "/gosdn.csbi.CsbiService/GetGoStruct", opts...) if err != nil { return nil, err @@ -76,7 +76,7 @@ func (x *csbiServiceGetGoStructClient) Recv() (*Payload, error) { return m, nil } -func (c *csbiServiceClient) GetManifest(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (CsbiService_GetManifestClient, error) { +func (c *csbiServiceClient) GetManifest(ctx context.Context, in *GetPayloadRequest, opts ...grpc.CallOption) (CsbiService_GetManifestClient, error) { stream, err := c.cc.NewStream(ctx, &CsbiService_ServiceDesc.Streams[1], "/gosdn.csbi.CsbiService/GetManifest", opts...) if err != nil { return nil, err @@ -117,6 +117,15 @@ func (c *csbiServiceClient) Create(ctx context.Context, in *CreateRequest, opts return out, nil } +func (c *csbiServiceClient) CreateGoStruct(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) { + out := new(CreateResponse) + err := c.cc.Invoke(ctx, "/gosdn.csbi.CsbiService/CreateGoStruct", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *csbiServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) { out := new(DeleteResponse) err := c.cc.Invoke(ctx, "/gosdn.csbi.CsbiService/Delete", in, out, opts...) @@ -135,49 +144,17 @@ func (c *csbiServiceClient) Hello(ctx context.Context, in *Syn, opts ...grpc.Cal return out, nil } -func (c *csbiServiceClient) CreateGoStruct(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (CsbiService_CreateGoStructClient, error) { - stream, err := c.cc.NewStream(ctx, &CsbiService_ServiceDesc.Streams[2], "/gosdn.csbi.CsbiService/CreateGoStruct", opts...) - if err != nil { - return nil, err - } - x := &csbiServiceCreateGoStructClient{stream} - if err := x.ClientStream.SendMsg(in); err != nil { - return nil, err - } - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type CsbiService_CreateGoStructClient interface { - Recv() (*Payload, error) - grpc.ClientStream -} - -type csbiServiceCreateGoStructClient struct { - grpc.ClientStream -} - -func (x *csbiServiceCreateGoStructClient) Recv() (*Payload, error) { - m := new(Payload) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - // CsbiServiceServer is the server API for CsbiService service. // All implementations must embed UnimplementedCsbiServiceServer // for forward compatibility type CsbiServiceServer interface { Get(context.Context, *GetRequest) (*GetResponse, error) - GetGoStruct(*GetRequest, CsbiService_GetGoStructServer) error - GetManifest(*GetRequest, CsbiService_GetManifestServer) error + GetGoStruct(*GetPayloadRequest, CsbiService_GetGoStructServer) error + GetManifest(*GetPayloadRequest, CsbiService_GetManifestServer) error Create(context.Context, *CreateRequest) (*CreateResponse, error) + CreateGoStruct(context.Context, *CreateRequest) (*CreateResponse, error) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) Hello(context.Context, *Syn) (*Ack, error) - CreateGoStruct(*CreateRequest, CsbiService_CreateGoStructServer) error mustEmbedUnimplementedCsbiServiceServer() } @@ -188,24 +165,24 @@ type UnimplementedCsbiServiceServer struct { func (UnimplementedCsbiServiceServer) Get(context.Context, *GetRequest) (*GetResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") } -func (UnimplementedCsbiServiceServer) GetGoStruct(*GetRequest, CsbiService_GetGoStructServer) error { +func (UnimplementedCsbiServiceServer) GetGoStruct(*GetPayloadRequest, CsbiService_GetGoStructServer) error { return status.Errorf(codes.Unimplemented, "method GetGoStruct not implemented") } -func (UnimplementedCsbiServiceServer) GetManifest(*GetRequest, CsbiService_GetManifestServer) error { +func (UnimplementedCsbiServiceServer) GetManifest(*GetPayloadRequest, CsbiService_GetManifestServer) error { return status.Errorf(codes.Unimplemented, "method GetManifest not implemented") } func (UnimplementedCsbiServiceServer) Create(context.Context, *CreateRequest) (*CreateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Create not implemented") } +func (UnimplementedCsbiServiceServer) CreateGoStruct(context.Context, *CreateRequest) (*CreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateGoStruct not implemented") +} func (UnimplementedCsbiServiceServer) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") } func (UnimplementedCsbiServiceServer) Hello(context.Context, *Syn) (*Ack, error) { return nil, status.Errorf(codes.Unimplemented, "method Hello not implemented") } -func (UnimplementedCsbiServiceServer) CreateGoStruct(*CreateRequest, CsbiService_CreateGoStructServer) error { - return status.Errorf(codes.Unimplemented, "method CreateGoStruct not implemented") -} func (UnimplementedCsbiServiceServer) mustEmbedUnimplementedCsbiServiceServer() {} // UnsafeCsbiServiceServer may be embedded to opt out of forward compatibility for this service. @@ -238,7 +215,7 @@ func _CsbiService_Get_Handler(srv interface{}, ctx context.Context, dec func(int } func _CsbiService_GetGoStruct_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetRequest) + m := new(GetPayloadRequest) if err := stream.RecvMsg(m); err != nil { return err } @@ -259,7 +236,7 @@ func (x *csbiServiceGetGoStructServer) Send(m *Payload) error { } func _CsbiService_GetManifest_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(GetRequest) + m := new(GetPayloadRequest) if err := stream.RecvMsg(m); err != nil { return err } @@ -297,6 +274,24 @@ func _CsbiService_Create_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _CsbiService_CreateGoStruct_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CsbiServiceServer).CreateGoStruct(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.csbi.CsbiService/CreateGoStruct", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CsbiServiceServer).CreateGoStruct(ctx, req.(*CreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _CsbiService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DeleteRequest) if err := dec(in); err != nil { @@ -333,27 +328,6 @@ func _CsbiService_Hello_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _CsbiService_CreateGoStruct_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(CreateRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(CsbiServiceServer).CreateGoStruct(m, &csbiServiceCreateGoStructServer{stream}) -} - -type CsbiService_CreateGoStructServer interface { - Send(*Payload) error - grpc.ServerStream -} - -type csbiServiceCreateGoStructServer struct { - grpc.ServerStream -} - -func (x *csbiServiceCreateGoStructServer) Send(m *Payload) error { - return x.ServerStream.SendMsg(m) -} - // CsbiService_ServiceDesc is the grpc.ServiceDesc for CsbiService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -369,6 +343,10 @@ var CsbiService_ServiceDesc = grpc.ServiceDesc{ MethodName: "Create", Handler: _CsbiService_Create_Handler, }, + { + MethodName: "CreateGoStruct", + Handler: _CsbiService_CreateGoStruct_Handler, + }, { MethodName: "Delete", Handler: _CsbiService_Delete_Handler, @@ -389,11 +367,6 @@ var CsbiService_ServiceDesc = grpc.ServiceDesc{ Handler: _CsbiService_GetManifest_Handler, ServerStreams: true, }, - { - StreamName: "CreateGoStruct", - Handler: _CsbiService_CreateGoStruct_Handler, - ServerStreams: true, - }, }, Metadata: "gosdn/csbi/csbi.proto", } diff --git a/api/openapiv2/gosdn_northbound.swagger.json b/api/openapiv2/gosdn_northbound.swagger.json index bb12fd7ae..a2169e773 100644 --- a/api/openapiv2/gosdn_northbound.swagger.json +++ b/api/openapiv2/gosdn_northbound.swagger.json @@ -18,22 +18,22 @@ "name": "PndService" }, { - "name": "gNMI" - }, - { - "name": "AgentManager" + "name": "Collector" }, { "name": "SbiService" }, { - "name": "CoreService" + "name": "gNMI" }, { - "name": "Collector" + "name": "AgentManager" }, { "name": "CsbiService" + }, + { + "name": "CoreService" } ], "consumes": [ diff --git a/api/proto/buf.lock b/api/proto/buf.lock index 1e004ac13..1af83a296 100644 --- a/api/proto/buf.lock +++ b/api/proto/buf.lock @@ -5,13 +5,13 @@ deps: owner: googleapis repository: googleapis branch: main - commit: 74ce074c5dc540d5b9bcd9992bb0c147 - digest: b1-q1Y1o5WHb9MnNsBkGjMCRd7SUp_AGZp1LaIyjUVN65g= - create_time: 2022-03-19T15:03:27.862817Z + commit: 2de8fdf478b545239f089219bf532912 + digest: b1-8pfrYEi1AMHlTqsEo1vcBZQ0DwB8PYQdmYGm8m3PRr0= + create_time: 2022-03-22T15:09:37.061763Z - remote: buf.build owner: grpc-ecosystem repository: grpc-gateway branch: main - commit: c4ed84978f4845e8940539d492ccbb5e - digest: b1-0Cg-i1h3UH0LjQGlkzWVcgWydSLiI-xvBkMDO6JkYLQ= - create_time: 2022-03-12T22:22:17.581898Z + commit: f85c60ac38544f2d8f346491c9d916e5 + digest: b1-qqV9hYsmYDGNXfic_Vap4lKVarQS4-RGAllaxwnTljM= + create_time: 2022-03-21T20:28:59.8282Z diff --git a/api/proto/gosdn/csbi/csbi.proto b/api/proto/gosdn/csbi/csbi.proto index bb3c044ea..f2eb34a67 100644 --- a/api/proto/gosdn/csbi/csbi.proto +++ b/api/proto/gosdn/csbi/csbi.proto @@ -10,12 +10,12 @@ option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi"; // grpc-gateway definitions service CsbiService { rpc Get(GetRequest) returns (GetResponse); - rpc GetGoStruct(GetRequest) returns (stream Payload); - rpc GetManifest(GetRequest) returns (stream Payload); + rpc GetGoStruct(GetPayloadRequest) returns (stream Payload); + rpc GetManifest(GetPayloadRequest) returns (stream Payload); rpc Create(CreateRequest) returns (CreateResponse); + rpc CreateGoStruct(CreateRequest) returns (CreateResponse); rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Hello(Syn) returns (Ack); - rpc CreateGoStruct(CreateRequest) returns (stream Payload); } message Syn { @@ -35,6 +35,11 @@ message GetRequest { repeated string did = 3; } +message GetPayloadRequest { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + string did = 3; +} + message GetResponse { int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. repeated Deployment deployments = 2; diff --git a/controller/nucleus/principalNetworkDomain.go b/controller/nucleus/principalNetworkDomain.go index a0a5e26e3..5ecd5e57b 100644 --- a/controller/nucleus/principalNetworkDomain.go +++ b/controller/nucleus/principalNetworkDomain.go @@ -3,6 +3,7 @@ package nucleus import ( "context" "encoding/json" + "fmt" "io" "os" "path/filepath" @@ -498,27 +499,29 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string, TransportOption: opt.TransportOption, } log.WithField("transport option", csbiTransportOptions).Debug("gosdn gnmi transport options") - req := &cpb.GetRequest{ + req := &cpb.GetPayloadRequest{ Timestamp: time.Now().UnixNano(), - All: false, - Did: []string{d.Id}, + Did: d.Id, } - idd := uuid.New() ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) defer cancel() + // TODO: this is currently just a workaround needs major adjustments + // here and in csbi. gClient, err := pnd.csbiClient.GetGoStruct(ctx, req) if err != nil { return err } - csbiID, err := saveGenericClientStreamToFile(gClient, "gostructs.go", idd) + csbiID, err := saveGenericClientStreamToFile(gClient, "gostructs.go", uuid.New()) if err != nil { return err } + // TODO: this is currently just a workaround needs major adjustments + // here and in csbi. mClient, err := pnd.csbiClient.GetManifest(ctx, req) if err != nil { return err } - _, err = saveGenericClientStreamToFile(mClient, "plugin.yml", idd) + _, err = saveGenericClientStreamToFile(mClient, "plugin.yml", csbiID) if err != nil { return err } @@ -551,29 +554,55 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string, func (pnd *pndImplementation) requestPlugin(name string, opt *tpb.TransportOption) (southbound.SouthboundInterface, error) { ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) defer cancel() - req := &cpb.CreateRequest{ + cReq := &cpb.CreateRequest{ Timestamp: time.Now().UnixNano(), TransportOption: []*tpb.TransportOption{opt}, } - client, err := pnd.csbiClient.CreateGoStruct(ctx, req) + resp, err := pnd.csbiClient.CreateGoStruct(ctx, cReq) if err != nil { return nil, err } + // we only request one plugin + for _, dep := range resp.GetDeployments() { + gReq := &cpb.GetPayloadRequest{ + Timestamp: time.Now().UnixNano(), + Did: dep.GetId(), + } - id, err := saveGenericClientStreamToFile(client, "gostructs.go", uuid.New()) - if err != nil { - return nil, err - } + // TODO: this is currently just a workaround needs major adjustments + // here and in csbi. + gClient, err := pnd.csbiClient.GetGoStruct(ctx, gReq) + if err != nil { + return nil, err + } - sbi, err := NewSBI(spb.Type_TYPE_PLUGIN, id) - if err != nil { - return nil, err - } - err = pnd.sbic.Add(sbi) - if err != nil { - return nil, err + id, err := saveGenericClientStreamToFile(gClient, "gostructs.go", uuid.New()) + if err != nil { + return nil, err + } + // TODO: this is currently just a workaround needs major adjustments + // here and in csbi. + mClient, err := pnd.csbiClient.GetManifest(ctx, gReq) + if err != nil { + return nil, err + } + _, err = saveGenericClientStreamToFile(mClient, "plugin.yml", id) + if err != nil { + return nil, err + } + + sbi, err := NewSBI(spb.Type_TYPE_PLUGIN, id) + if err != nil { + return nil, err + } + err = pnd.sbic.Add(sbi) + if err != nil { + return nil, err + } + + return sbi, nil } - return sbi, nil + return nil, fmt.Errorf("requestPlugin: received deployment slice was empty.") } // GenericGrpcClient allows to distinguish between the different ygot @@ -588,7 +617,6 @@ type GenericGrpcClient interface { // 'plugin-folder'. Each 'gostructs.go' file is stored in its own folder based // on a new uuid.UUID. func saveGenericClientStreamToFile(t GenericGrpcClient, filename string, id uuid.UUID) (uuid.UUID, error) { - //id := uuid.New() folderName := viper.GetString("plugin-folder") path := filepath.Join(folderName, id.String(), filename) diff --git a/csbi/deployment.go b/csbi/deployment.go index 462b84718..47ae9e3a1 100644 --- a/csbi/deployment.go +++ b/csbi/deployment.go @@ -64,7 +64,7 @@ func (store DeploymentStore) Get(id uuid.UUID) (Deployment, error) { log.Tracef("requested %v from store", id) deployment := <-store.in if deployment.ID != id { - return Deployment{}, &errors.ErrNotFound{} + return Deployment{}, &errors.ErrNotFound{ID: id} } log.Tracef("received %v from store", id) log.Tracef("leaving Get func for %v", id) diff --git a/csbi/grpc.go b/csbi/grpc.go index a702ef9ed..85d17bbf4 100644 --- a/csbi/grpc.go +++ b/csbi/grpc.go @@ -36,6 +36,7 @@ type server struct { orchestrator Orchestrator } +// Get returns a set of the requested deployments. func (s server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error) { labels := prometheus.Labels{"rpc": "get"} start := time.Now() @@ -61,6 +62,8 @@ func (s server) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, e }, nil } +// Create creates a new cSBI; this includes generating a deployment, building +// the container, generating gostructs from the devices capabilites. func (s server) Create(ctx context.Context, req *pb.CreateRequest) (*pb.CreateResponse, error) { labels := prometheus.Labels{"rpc": "create"} start := promStartHook(labels, grpcRequestsTotal) @@ -89,19 +92,16 @@ func (s server) Create(ctx context.Context, req *pb.CreateRequest) (*pb.CreateRe }, nil } -func (s server) GetGoStruct(req *pb.GetRequest, stream pb.CsbiService_GetGoStructServer) error { +// GetGoStruct sends the gostruct file associated with the given deployment as +// grpc stream. +func (s server) GetGoStruct(req *pb.GetPayloadRequest, stream pb.CsbiService_GetGoStructServer) error { log.Info("started GetGoStruct") labels := prometheus.Labels{"rpc": "get_go_struct"} start := promStartHook(labels, grpcRequestsTotal) defer promEndHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - deploymentID, _ := uuid.Parse(req.Did[0]) - dep, err := s.orchestrator.Get(deploymentID) - if err != nil { - return handleRPCError(labels, err) - } - - file, err := os.Open(filepath.Join(dep.ID.String(), "gostructs.go")) + // TODO: sending the file should be refactored into own function + file, err := os.Open(filepath.Join(req.GetDid(), "gostructs.go")) if err != nil { return handleRPCError(labels, err) } @@ -127,21 +127,15 @@ func (s server) GetGoStruct(req *pb.GetRequest, stream pb.CsbiService_GetGoStruc return nil } -// NOTE: this will currently only work for a cSBI; not for a plugin -// TODO: parts can be refactored into own function -func (s server) GetManifest(req *pb.GetRequest, stream pb.CsbiService_GetManifestServer) error { - log.Info("started GetGoStruct") +// GetManifest sends the manifest file of the deployment as grpc stream. +func (s server) GetManifest(req *pb.GetPayloadRequest, stream pb.CsbiService_GetManifestServer) error { + log.Info("started GetManifest") labels := prometheus.Labels{"rpc": "get_manifest"} start := promStartHook(labels, grpcRequestsTotal) defer promEndHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - deploymentID, _ := uuid.Parse(req.Did[0]) - dep, err := s.orchestrator.Get(deploymentID) - if err != nil { - return handleRPCError(labels, err) - } - - file, err := os.Open(filepath.Join(dep.ID.String(), "plugin.yml")) + // TODO: sending the file should be refactored into own function + file, err := os.Open(filepath.Join(req.GetDid(), "plugin.yml")) if err != nil { return handleRPCError(labels, err) } @@ -167,50 +161,37 @@ func (s server) GetManifest(req *pb.GetRequest, stream pb.CsbiService_GetManifes return nil } -//TODO: Need for a deployment id -func (s server) CreateGoStruct(req *pb.CreateRequest, stream pb.CsbiService_CreateGoStructServer) error { - log.Info("started CreateGoStruct") - labels := prometheus.Labels{"rpc": "create_plugin"} +// CreateGoStruct generates a deployment and the corresponding ygot +// `gostruct.go` file from the YANG files discovered by requesting the devices +// capabilities. +func (s server) CreateGoStruct(ctx context.Context, req *pb.CreateRequest) (*pb.CreateResponse, error) { + labels := prometheus.Labels{"rpc": "create_gostruct"} start := promStartHook(labels, grpcRequestsTotal) defer promEndHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - ctx := context.Background() - for _, opt := range req.TransportOption { + deployments := make([]*pb.Deployment, len(req.TransportOption)) + for i, opt := range req.TransportOption { model, err := Discover(ctx, opt) if err != nil { - return handleRPCError(labels, err) + return nil, handleRPCError(labels, err) } d, err := Generate(ctx, model, s.orchestrator.Repository(), opt.Type) if err != nil { - return handleRPCError(labels, err) - } - file, err := os.Open(filepath.Join(d.ID.String(), "gostructs.go")) - if err != nil { - return handleRPCError(labels, err) + return nil, handleRPCError(labels, err) } - defer file.Close() - - buffer := make([]byte, int(MB)) - - for { - n, err := file.Read(buffer) - if err != nil { - if err != io.EOF { - fmt.Println(err) - } - break - } - log.WithField("n", n).Trace("read bytes") - payload := &pb.Payload{Chunk: buffer[:n]} - err = stream.Send(payload) - if err != nil { - return handleRPCError(labels, err) - } + deployments[i] = &pb.Deployment{ + Id: d.ID.String(), + Name: d.Name, + State: d.State, } } - return nil + return &pb.CreateResponse{ + Timestamp: time.Now().UnixNano(), + Deployments: deployments, + }, nil } +// Delete deletes the provided deployment. func (s server) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.DeleteResponse, error) { labels := prometheus.Labels{"rpc": "delete"} start := promStartHook(labels, grpcRequestsTotal) diff --git a/csbi/write.go b/csbi/write.go index dcd5188ec..7168431ff 100644 --- a/csbi/write.go +++ b/csbi/write.go @@ -118,12 +118,13 @@ func copyFile(path, filename string) error { func writeCode(path string, code *ygen.GeneratedGoCode, t spb.Type) error { code.CommonHeader = strings.TrimSuffix(code.CommonHeader, ")\n") code.CommonHeader = code.CommonHeader + southboundImportAmendmend + sbiStructCopy := southboundStruct if t == spb.Type_TYPE_CONTAINERISED { - southboundStruct.Methods = southboundStruct.Methods + southboundStructCsbiAmendmend + sbiStructCopy.Methods = sbiStructCopy.Methods + southboundStructCsbiAmendmend } else { - southboundStruct.Methods = southboundStruct.Methods + southboundStructPluginAmendmend + sbiStructCopy.Methods = sbiStructCopy.Methods + southboundStructPluginAmendmend } - code.Structs = append(code.Structs, southboundStruct) + code.Structs = append(code.Structs, sbiStructCopy) file := filepath.Join(path, "gostructs.go") generatedCode := genutil.OpenFile(file) defer genutil.SyncFile(generatedCode) -- GitLab