diff --git a/api/go/gosdn/core/core.pb.go b/api/go/gosdn/core/core.pb.go deleted file mode 100644 index a1245905879aa218d02abb2ec77586b45d045ef1..0000000000000000000000000000000000000000 --- a/api/go/gosdn/core/core.pb.go +++ /dev/null @@ -1,834 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc (unknown) -// source: gosdn/core/core.proto - -package core - -import ( - pnd "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" - _ "google.golang.org/genproto/googleapis/api/annotations" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Status int32 - -const ( - Status_STATUS_UNSPECIFIED Status = 0 - Status_STATUS_OK Status = 1 - Status_STATUS_ERROR Status = 2 -) - -// Enum value maps for Status. -var ( - Status_name = map[int32]string{ - 0: "STATUS_UNSPECIFIED", - 1: "STATUS_OK", - 2: "STATUS_ERROR", - } - Status_value = map[string]int32{ - "STATUS_UNSPECIFIED": 0, - "STATUS_OK": 1, - "STATUS_ERROR": 2, - } -) - -func (x Status) Enum() *Status { - p := new(Status) - *p = x - return p -} - -func (x Status) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Status) Descriptor() protoreflect.EnumDescriptor { - return file_gosdn_core_core_proto_enumTypes[0].Descriptor() -} - -func (Status) Type() protoreflect.EnumType { - return &file_gosdn_core_core_proto_enumTypes[0] -} - -func (x Status) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Status.Descriptor instead. -func (Status) EnumDescriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{0} -} - -type GetPndRequest 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. - Pid string `protobuf:"bytes,2,opt,name=pid,proto3" json:"pid,omitempty"` -} - -func (x *GetPndRequest) Reset() { - *x = GetPndRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPndRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPndRequest) ProtoMessage() {} - -func (x *GetPndRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[0] - 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 GetPndRequest.ProtoReflect.Descriptor instead. -func (*GetPndRequest) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{0} -} - -func (x *GetPndRequest) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *GetPndRequest) GetPid() string { - if x != nil { - return x.Pid - } - return "" -} - -type GetPndResponse 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. - Pnd *pnd.PrincipalNetworkDomain `protobuf:"bytes,2,opt,name=pnd,proto3" json:"pnd,omitempty"` -} - -func (x *GetPndResponse) Reset() { - *x = GetPndResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPndResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPndResponse) ProtoMessage() {} - -func (x *GetPndResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[1] - 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 GetPndResponse.ProtoReflect.Descriptor instead. -func (*GetPndResponse) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{1} -} - -func (x *GetPndResponse) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *GetPndResponse) GetPnd() *pnd.PrincipalNetworkDomain { - if x != nil { - return x.Pnd - } - return nil -} - -type GetPndListRequest 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. -} - -func (x *GetPndListRequest) Reset() { - *x = GetPndListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPndListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPndListRequest) ProtoMessage() {} - -func (x *GetPndListRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[2] - 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 GetPndListRequest.ProtoReflect.Descriptor instead. -func (*GetPndListRequest) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{2} -} - -func (x *GetPndListRequest) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -type GetPndListResponse 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. - Pnd []*pnd.PrincipalNetworkDomain `protobuf:"bytes,2,rep,name=pnd,proto3" json:"pnd,omitempty"` -} - -func (x *GetPndListResponse) Reset() { - *x = GetPndListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPndListResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GetPndListResponse) ProtoMessage() {} - -func (x *GetPndListResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_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 GetPndListResponse.ProtoReflect.Descriptor instead. -func (*GetPndListResponse) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{3} -} - -func (x *GetPndListResponse) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *GetPndListResponse) GetPnd() []*pnd.PrincipalNetworkDomain { - if x != nil { - return x.Pnd - } - return nil -} - -type CreatePndListRequest 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. - Pnd []*PndCreateProperties `protobuf:"bytes,2,rep,name=pnd,proto3" json:"pnd,omitempty"` -} - -func (x *CreatePndListRequest) Reset() { - *x = CreatePndListRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreatePndListRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreatePndListRequest) ProtoMessage() {} - -func (x *CreatePndListRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[4] - 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 CreatePndListRequest.ProtoReflect.Descriptor instead. -func (*CreatePndListRequest) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{4} -} - -func (x *CreatePndListRequest) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *CreatePndListRequest) GetPnd() []*PndCreateProperties { - if x != nil { - return x.Pnd - } - return nil -} - -type PndCreateProperties struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` -} - -func (x *PndCreateProperties) Reset() { - *x = PndCreateProperties{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PndCreateProperties) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PndCreateProperties) ProtoMessage() {} - -func (x *PndCreateProperties) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[5] - 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 PndCreateProperties.ProtoReflect.Descriptor instead. -func (*PndCreateProperties) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{5} -} - -func (x *PndCreateProperties) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PndCreateProperties) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -type CreatePndListResponse 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. - Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=gosdn.core.Status" json:"status,omitempty"` -} - -func (x *CreatePndListResponse) Reset() { - *x = CreatePndListResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *CreatePndListResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*CreatePndListResponse) ProtoMessage() {} - -func (x *CreatePndListResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[6] - 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 CreatePndListResponse.ProtoReflect.Descriptor instead. -func (*CreatePndListResponse) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{6} -} - -func (x *CreatePndListResponse) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *CreatePndListResponse) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_STATUS_UNSPECIFIED -} - -type DeletePndRequest 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. - Pid string `protobuf:"bytes,4,opt,name=pid,proto3" json:"pid,omitempty"` -} - -func (x *DeletePndRequest) Reset() { - *x = DeletePndRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeletePndRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeletePndRequest) ProtoMessage() {} - -func (x *DeletePndRequest) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_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 DeletePndRequest.ProtoReflect.Descriptor instead. -func (*DeletePndRequest) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{7} -} - -func (x *DeletePndRequest) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *DeletePndRequest) GetPid() string { - if x != nil { - return x.Pid - } - return "" -} - -type DeletePndResponse 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. - Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=gosdn.core.Status" json:"status,omitempty"` -} - -func (x *DeletePndResponse) Reset() { - *x = DeletePndResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_gosdn_core_core_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DeletePndResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DeletePndResponse) ProtoMessage() {} - -func (x *DeletePndResponse) ProtoReflect() protoreflect.Message { - mi := &file_gosdn_core_core_proto_msgTypes[8] - 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 DeletePndResponse.ProtoReflect.Descriptor instead. -func (*DeletePndResponse) Descriptor() ([]byte, []int) { - return file_gosdn_core_core_proto_rawDescGZIP(), []int{8} -} - -func (x *DeletePndResponse) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *DeletePndResponse) GetStatus() Status { - if x != nil { - return x.Status - } - return Status_STATUS_UNSPECIFIED -} - -var File_gosdn_core_core_proto protoreflect.FileDescriptor - -var file_gosdn_core_core_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x13, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x70, 0x6e, 0x64, 0x2f, 0x70, 0x6e, 0x64, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x3f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x6e, 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, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0x63, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6e, - 0x64, 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, 0x33, 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, - 0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, - 0x6b, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x03, 0x70, 0x6e, 0x64, 0x22, 0x31, 0x0a, 0x11, - 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 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, 0x22, - 0x67, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 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, 0x33, 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x50, 0x72, 0x69, - 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x44, 0x6f, 0x6d, - 0x61, 0x69, 0x6e, 0x52, 0x03, 0x70, 0x6e, 0x64, 0x22, 0x67, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 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, 0x31, - 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x6f, - 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x03, 0x70, 0x6e, - 0x64, 0x22, 0x4b, 0x0a, 0x13, 0x50, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 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, 0x22, 0x61, - 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 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, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x22, 0x42, 0x0a, 0x10, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6e, 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, 0x70, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x70, 0x69, 0x64, 0x22, 0x5d, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, - 0x6e, 0x64, 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, 0x2a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x2a, 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, 0x32, 0x85, 0x03, 0x0a, 0x0b, 0x43, 0x6f, 0x72, 0x65, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x50, 0x6e, - 0x64, 0x12, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, - 0x65, 0x74, 0x50, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x67, - 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, - 0x12, 0x0a, 0x2f, 0x70, 0x6e, 0x64, 0x2f, 0x7b, 0x70, 0x69, 0x64, 0x7d, 0x12, 0x5a, 0x0a, 0x0a, - 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1d, 0x2e, 0x67, 0x6f, 0x73, - 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, 0x6f, 0x73, 0x64, - 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0d, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x07, 0x12, 0x05, 0x2f, 0x70, 0x6e, 0x64, 0x73, 0x12, 0x66, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x2e, 0x67, 0x6f, 0x73, 0x64, - 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6e, 0x64, - 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x6f, - 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, - 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x10, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x3a, 0x01, 0x2a, 0x22, 0x05, 0x2f, 0x70, 0x6e, 0x64, 0x73, - 0x12, 0x5d, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6e, 0x64, 0x12, 0x1c, 0x2e, - 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x50, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x67, 0x6f, - 0x73, 0x64, 0x6e, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, - 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, 0x93, - 0x02, 0x0d, 0x2a, 0x0b, 0x2f, 0x70, 0x6e, 0x64, 0x73, 0x2f, 0x7b, 0x70, 0x69, 0x64, 0x7d, 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, 0x6f, 0x72, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_gosdn_core_core_proto_rawDescOnce sync.Once - file_gosdn_core_core_proto_rawDescData = file_gosdn_core_core_proto_rawDesc -) - -func file_gosdn_core_core_proto_rawDescGZIP() []byte { - file_gosdn_core_core_proto_rawDescOnce.Do(func() { - file_gosdn_core_core_proto_rawDescData = protoimpl.X.CompressGZIP(file_gosdn_core_core_proto_rawDescData) - }) - return file_gosdn_core_core_proto_rawDescData -} - -var file_gosdn_core_core_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_gosdn_core_core_proto_msgTypes = make([]protoimpl.MessageInfo, 9) -var file_gosdn_core_core_proto_goTypes = []interface{}{ - (Status)(0), // 0: gosdn.core.Status - (*GetPndRequest)(nil), // 1: gosdn.core.GetPndRequest - (*GetPndResponse)(nil), // 2: gosdn.core.GetPndResponse - (*GetPndListRequest)(nil), // 3: gosdn.core.GetPndListRequest - (*GetPndListResponse)(nil), // 4: gosdn.core.GetPndListResponse - (*CreatePndListRequest)(nil), // 5: gosdn.core.CreatePndListRequest - (*PndCreateProperties)(nil), // 6: gosdn.core.PndCreateProperties - (*CreatePndListResponse)(nil), // 7: gosdn.core.CreatePndListResponse - (*DeletePndRequest)(nil), // 8: gosdn.core.DeletePndRequest - (*DeletePndResponse)(nil), // 9: gosdn.core.DeletePndResponse - (*pnd.PrincipalNetworkDomain)(nil), // 10: gosdn.pnd.PrincipalNetworkDomain -} -var file_gosdn_core_core_proto_depIdxs = []int32{ - 10, // 0: gosdn.core.GetPndResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain - 10, // 1: gosdn.core.GetPndListResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain - 6, // 2: gosdn.core.CreatePndListRequest.pnd:type_name -> gosdn.core.PndCreateProperties - 0, // 3: gosdn.core.CreatePndListResponse.status:type_name -> gosdn.core.Status - 0, // 4: gosdn.core.DeletePndResponse.status:type_name -> gosdn.core.Status - 1, // 5: gosdn.core.CoreService.GetPnd:input_type -> gosdn.core.GetPndRequest - 3, // 6: gosdn.core.CoreService.GetPndList:input_type -> gosdn.core.GetPndListRequest - 5, // 7: gosdn.core.CoreService.CreatePndList:input_type -> gosdn.core.CreatePndListRequest - 8, // 8: gosdn.core.CoreService.DeletePnd:input_type -> gosdn.core.DeletePndRequest - 2, // 9: gosdn.core.CoreService.GetPnd:output_type -> gosdn.core.GetPndResponse - 4, // 10: gosdn.core.CoreService.GetPndList:output_type -> gosdn.core.GetPndListResponse - 7, // 11: gosdn.core.CoreService.CreatePndList:output_type -> gosdn.core.CreatePndListResponse - 9, // 12: gosdn.core.CoreService.DeletePnd:output_type -> gosdn.core.DeletePndResponse - 9, // [9:13] is the sub-list for method output_type - 5, // [5:9] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name -} - -func init() { file_gosdn_core_core_proto_init() } -func file_gosdn_core_core_proto_init() { - if File_gosdn_core_core_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_gosdn_core_core_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPndRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPndResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPndListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPndListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreatePndListRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PndCreateProperties); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreatePndListResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletePndRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_gosdn_core_core_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DeletePndResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_gosdn_core_core_proto_rawDesc, - NumEnums: 1, - NumMessages: 9, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_gosdn_core_core_proto_goTypes, - DependencyIndexes: file_gosdn_core_core_proto_depIdxs, - EnumInfos: file_gosdn_core_core_proto_enumTypes, - MessageInfos: file_gosdn_core_core_proto_msgTypes, - }.Build() - File_gosdn_core_core_proto = out.File - file_gosdn_core_core_proto_rawDesc = nil - file_gosdn_core_core_proto_goTypes = nil - file_gosdn_core_core_proto_depIdxs = nil -} diff --git a/api/go/gosdn/core/core_grpc.pb.go b/api/go/gosdn/core/core_grpc.pb.go deleted file mode 100644 index 700014550c269e4c75b5f8f5cca584ba3fe15a7b..0000000000000000000000000000000000000000 --- a/api/go/gosdn/core/core_grpc.pb.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. - -package core - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// CoreServiceClient is the client API for CoreService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type CoreServiceClient interface { - // Allows to request a specific Principal Network Domain. - GetPnd(ctx context.Context, in *GetPndRequest, opts ...grpc.CallOption) (*GetPndResponse, error) - // Allows to request all Principal Network Domains. - GetPndList(ctx context.Context, in *GetPndListRequest, opts ...grpc.CallOption) (*GetPndListResponse, error) - // Allows create a Principal Network Domain. - CreatePndList(ctx context.Context, in *CreatePndListRequest, opts ...grpc.CallOption) (*CreatePndListResponse, error) - // Allows to delete a specific Principal Network Domain. - DeletePnd(ctx context.Context, in *DeletePndRequest, opts ...grpc.CallOption) (*DeletePndResponse, error) -} - -type coreServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewCoreServiceClient(cc grpc.ClientConnInterface) CoreServiceClient { - return &coreServiceClient{cc} -} - -func (c *coreServiceClient) GetPnd(ctx context.Context, in *GetPndRequest, opts ...grpc.CallOption) (*GetPndResponse, error) { - out := new(GetPndResponse) - err := c.cc.Invoke(ctx, "/gosdn.core.CoreService/GetPnd", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *coreServiceClient) GetPndList(ctx context.Context, in *GetPndListRequest, opts ...grpc.CallOption) (*GetPndListResponse, error) { - out := new(GetPndListResponse) - err := c.cc.Invoke(ctx, "/gosdn.core.CoreService/GetPndList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *coreServiceClient) CreatePndList(ctx context.Context, in *CreatePndListRequest, opts ...grpc.CallOption) (*CreatePndListResponse, error) { - out := new(CreatePndListResponse) - err := c.cc.Invoke(ctx, "/gosdn.core.CoreService/CreatePndList", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *coreServiceClient) DeletePnd(ctx context.Context, in *DeletePndRequest, opts ...grpc.CallOption) (*DeletePndResponse, error) { - out := new(DeletePndResponse) - err := c.cc.Invoke(ctx, "/gosdn.core.CoreService/DeletePnd", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// CoreServiceServer is the server API for CoreService service. -// All implementations must embed UnimplementedCoreServiceServer -// for forward compatibility -type CoreServiceServer interface { - // Allows to request a specific Principal Network Domain. - GetPnd(context.Context, *GetPndRequest) (*GetPndResponse, error) - // Allows to request all Principal Network Domains. - GetPndList(context.Context, *GetPndListRequest) (*GetPndListResponse, error) - // Allows create a Principal Network Domain. - CreatePndList(context.Context, *CreatePndListRequest) (*CreatePndListResponse, error) - // Allows to delete a specific Principal Network Domain. - DeletePnd(context.Context, *DeletePndRequest) (*DeletePndResponse, error) - mustEmbedUnimplementedCoreServiceServer() -} - -// UnimplementedCoreServiceServer must be embedded to have forward compatible implementations. -type UnimplementedCoreServiceServer struct { -} - -func (UnimplementedCoreServiceServer) GetPnd(context.Context, *GetPndRequest) (*GetPndResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPnd not implemented") -} -func (UnimplementedCoreServiceServer) GetPndList(context.Context, *GetPndListRequest) (*GetPndListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPndList not implemented") -} -func (UnimplementedCoreServiceServer) CreatePndList(context.Context, *CreatePndListRequest) (*CreatePndListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreatePndList not implemented") -} -func (UnimplementedCoreServiceServer) DeletePnd(context.Context, *DeletePndRequest) (*DeletePndResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeletePnd not implemented") -} -func (UnimplementedCoreServiceServer) mustEmbedUnimplementedCoreServiceServer() {} - -// UnsafeCoreServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to CoreServiceServer will -// result in compilation errors. -type UnsafeCoreServiceServer interface { - mustEmbedUnimplementedCoreServiceServer() -} - -func RegisterCoreServiceServer(s grpc.ServiceRegistrar, srv CoreServiceServer) { - s.RegisterService(&CoreService_ServiceDesc, srv) -} - -func _CoreService_GetPnd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPndRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoreServiceServer).GetPnd(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gosdn.core.CoreService/GetPnd", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServiceServer).GetPnd(ctx, req.(*GetPndRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CoreService_GetPndList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetPndListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoreServiceServer).GetPndList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gosdn.core.CoreService/GetPndList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServiceServer).GetPndList(ctx, req.(*GetPndListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CoreService_CreatePndList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreatePndListRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoreServiceServer).CreatePndList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gosdn.core.CoreService/CreatePndList", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServiceServer).CreatePndList(ctx, req.(*CreatePndListRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _CoreService_DeletePnd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(DeletePndRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(CoreServiceServer).DeletePnd(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/gosdn.core.CoreService/DeletePnd", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(CoreServiceServer).DeletePnd(ctx, req.(*DeletePndRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// CoreService_ServiceDesc is the grpc.ServiceDesc for CoreService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var CoreService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "gosdn.core.CoreService", - HandlerType: (*CoreServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetPnd", - Handler: _CoreService_GetPnd_Handler, - }, - { - MethodName: "GetPndList", - Handler: _CoreService_GetPndList_Handler, - }, - { - MethodName: "CreatePndList", - Handler: _CoreService_CreatePndList_Handler, - }, - { - MethodName: "DeletePnd", - Handler: _CoreService_DeletePnd_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "gosdn/core/core.proto", -} diff --git a/api/go/gosdn/pnd/pnd.pb.go b/api/go/gosdn/pnd/pnd.pb.go index 36823b3b134a33fabbfb274c4644dac7b0c272d1..67e3a310cebcac5d768e56d678bbe503d2c65d32 100644 --- a/api/go/gosdn/pnd/pnd.pb.go +++ b/api/go/gosdn/pnd/pnd.pb.go @@ -25,6 +25,55 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type Status int32 + +const ( + Status_STATUS_UNSPECIFIED Status = 0 + Status_STATUS_OK Status = 1 + Status_STATUS_ERROR Status = 2 +) + +// Enum value maps for Status. +var ( + Status_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "STATUS_OK", + 2: "STATUS_ERROR", + } + Status_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "STATUS_OK": 1, + "STATUS_ERROR": 2, + } +) + +func (x Status) Enum() *Status { + p := new(Status) + *p = x + return p +} + +func (x Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Status) Descriptor() protoreflect.EnumDescriptor { + return file_gosdn_pnd_pnd_proto_enumTypes[0].Descriptor() +} + +func (Status) Type() protoreflect.EnumType { + return &file_gosdn_pnd_pnd_proto_enumTypes[0] +} + +func (x Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Status.Descriptor instead. +func (Status) EnumDescriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{0} +} + type PrincipalNetworkDomain struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -88,6 +137,493 @@ func (x *PrincipalNetworkDomain) GetDescription() string { return "" } +type GetPndRequest 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. + Pid string `protobuf:"bytes,2,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (x *GetPndRequest) Reset() { + *x = GetPndRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPndRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPndRequest) ProtoMessage() {} + +func (x *GetPndRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[1] + 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 GetPndRequest.ProtoReflect.Descriptor instead. +func (*GetPndRequest) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{1} +} + +func (x *GetPndRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetPndRequest) GetPid() string { + if x != nil { + return x.Pid + } + return "" +} + +type GetPndResponse 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. + Pnd *PrincipalNetworkDomain `protobuf:"bytes,2,opt,name=pnd,proto3" json:"pnd,omitempty"` +} + +func (x *GetPndResponse) Reset() { + *x = GetPndResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPndResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPndResponse) ProtoMessage() {} + +func (x *GetPndResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[2] + 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 GetPndResponse.ProtoReflect.Descriptor instead. +func (*GetPndResponse) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{2} +} + +func (x *GetPndResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetPndResponse) GetPnd() *PrincipalNetworkDomain { + if x != nil { + return x.Pnd + } + return nil +} + +type GetPndListRequest 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. +} + +func (x *GetPndListRequest) Reset() { + *x = GetPndListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPndListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPndListRequest) ProtoMessage() {} + +func (x *GetPndListRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_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 GetPndListRequest.ProtoReflect.Descriptor instead. +func (*GetPndListRequest) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{3} +} + +func (x *GetPndListRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type GetPndListResponse 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. + Pnd []*PrincipalNetworkDomain `protobuf:"bytes,2,rep,name=pnd,proto3" json:"pnd,omitempty"` +} + +func (x *GetPndListResponse) Reset() { + *x = GetPndListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetPndListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetPndListResponse) ProtoMessage() {} + +func (x *GetPndListResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[4] + 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 GetPndListResponse.ProtoReflect.Descriptor instead. +func (*GetPndListResponse) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{4} +} + +func (x *GetPndListResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetPndListResponse) GetPnd() []*PrincipalNetworkDomain { + if x != nil { + return x.Pnd + } + return nil +} + +type CreatePndListRequest 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. + Pnd []*PndCreateProperties `protobuf:"bytes,2,rep,name=pnd,proto3" json:"pnd,omitempty"` +} + +func (x *CreatePndListRequest) Reset() { + *x = CreatePndListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePndListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePndListRequest) ProtoMessage() {} + +func (x *CreatePndListRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[5] + 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 CreatePndListRequest.ProtoReflect.Descriptor instead. +func (*CreatePndListRequest) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{5} +} + +func (x *CreatePndListRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *CreatePndListRequest) GetPnd() []*PndCreateProperties { + if x != nil { + return x.Pnd + } + return nil +} + +type PndCreateProperties struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` +} + +func (x *PndCreateProperties) Reset() { + *x = PndCreateProperties{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PndCreateProperties) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PndCreateProperties) ProtoMessage() {} + +func (x *PndCreateProperties) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[6] + 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 PndCreateProperties.ProtoReflect.Descriptor instead. +func (*PndCreateProperties) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{6} +} + +func (x *PndCreateProperties) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *PndCreateProperties) GetDescription() string { + if x != nil { + return x.Description + } + return "" +} + +type CreatePndListResponse 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. + Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=gosdn.pnd.Status" json:"status,omitempty"` +} + +func (x *CreatePndListResponse) Reset() { + *x = CreatePndListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePndListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePndListResponse) ProtoMessage() {} + +func (x *CreatePndListResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_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 CreatePndListResponse.ProtoReflect.Descriptor instead. +func (*CreatePndListResponse) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{7} +} + +func (x *CreatePndListResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *CreatePndListResponse) GetStatus() Status { + if x != nil { + return x.Status + } + return Status_STATUS_UNSPECIFIED +} + +type DeletePndRequest 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. + Pid string `protobuf:"bytes,4,opt,name=pid,proto3" json:"pid,omitempty"` +} + +func (x *DeletePndRequest) Reset() { + *x = DeletePndRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePndRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePndRequest) ProtoMessage() {} + +func (x *DeletePndRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[8] + 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 DeletePndRequest.ProtoReflect.Descriptor instead. +func (*DeletePndRequest) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{8} +} + +func (x *DeletePndRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *DeletePndRequest) GetPid() string { + if x != nil { + return x.Pid + } + return "" +} + +type DeletePndResponse 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. + Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=gosdn.pnd.Status" json:"status,omitempty"` +} + +func (x *DeletePndResponse) Reset() { + *x = DeletePndResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeletePndResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeletePndResponse) ProtoMessage() {} + +func (x *DeletePndResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_pnd_pnd_proto_msgTypes[9] + 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 DeletePndResponse.ProtoReflect.Descriptor instead. +func (*DeletePndResponse) Descriptor() ([]byte, []int) { + return file_gosdn_pnd_pnd_proto_rawDescGZIP(), []int{9} +} + +func (x *DeletePndResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *DeletePndResponse) GetStatus() Status { + if x != nil { + return x.Status + } + return Status_STATUS_UNSPECIFIED +} + var File_gosdn_pnd_pnd_proto protoreflect.FileDescriptor var file_gosdn_pnd_pnd_proto_rawDesc = []byte{ @@ -111,27 +647,102 @@ var file_gosdn_pnd_pnd_proto_rawDesc = []byte{ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x32, 0x0c, 0x0a, 0x0a, 0x50, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x42, 0xae, 0x02, 0x5a, 0x2d, 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, - 0x70, 0x6e, 0x64, 0x92, 0x41, 0xfb, 0x01, 0x12, 0xf8, 0x01, 0x0a, 0x10, 0x67, 0x6f, 0x53, 0x44, - 0x4e, 0x20, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x4d, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x73, 0x70, - 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, - 0x20, 0x47, 0x6f, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x67, 0x6f, 0x53, 0x44, 0x4e, 0x20, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x62, 0x6f, 0x75, 0x6e, - 0x64, 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3e, 0x0a, 0x18, 0x67, - 0x6f, 0x53, 0x44, 0x4e, 0x20, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x20, - 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, - 0x2f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, - 0x65, 0x2f, 0x64, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2a, 0x50, 0x0a, 0x14, 0x42, - 0x53, 0x44, 0x20, 0x33, 0x2d, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x20, 0x4c, 0x69, 0x63, 0x65, - 0x6e, 0x73, 0x65, 0x12, 0x38, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x63, 0x6f, 0x64, - 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x64, 0x61, - 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x2d, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, - 0x61, 0x73, 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x03, 0x30, - 0x2e, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6f, 0x6e, 0x22, 0x3f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x50, 0x6e, 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, 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x70, 0x69, 0x64, 0x22, 0x63, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 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, 0x33, 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x21, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x50, 0x72, + 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x44, 0x6f, + 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x03, 0x70, 0x6e, 0x64, 0x22, 0x31, 0x0a, 0x11, 0x47, 0x65, 0x74, + 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 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, 0x22, 0x67, 0x0a, 0x12, + 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 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, 0x33, 0x0a, 0x03, 0x70, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, + 0x70, 0x61, 0x6c, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, + 0x52, 0x03, 0x70, 0x6e, 0x64, 0x22, 0x66, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 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, 0x30, 0x0a, 0x03, 0x70, + 0x6e, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, + 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x50, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x69, 0x65, 0x73, 0x52, 0x03, 0x70, 0x6e, 0x64, 0x22, 0x4b, 0x0a, + 0x13, 0x50, 0x6e, 0x64, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, + 0x74, 0x69, 0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 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, 0x22, 0x60, 0x0a, 0x15, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 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, 0x29, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x42, 0x0a, 0x10, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6e, 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, 0x70, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x70, 0x69, 0x64, + 0x22, 0x5c, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6e, 0x64, 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, 0x29, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2a, 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, 0x32, 0xfc, 0x02, 0x0a, 0x0a, 0x50, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x12, 0x51, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x12, 0x18, 0x2e, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, + 0x2e, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x12, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0c, 0x12, 0x0a, 0x2f, 0x70, 0x6e, 0x64, 0x2f, 0x7b, 0x70, + 0x69, 0x64, 0x7d, 0x12, 0x58, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, + 0x74, 0x12, 0x1c, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x47, 0x65, + 0x74, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x0d, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x07, 0x12, 0x05, 0x2f, 0x70, 0x6e, 0x64, 0x73, 0x12, 0x64, 0x0a, + 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1f, + 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x20, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x6e, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x10, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0a, 0x3a, 0x01, 0x2a, 0x22, 0x05, 0x2f, 0x70, + 0x6e, 0x64, 0x73, 0x12, 0x5b, 0x0a, 0x09, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x50, 0x6e, 0x64, + 0x12, 0x1b, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x50, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x70, 0x6e, 0x64, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x50, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x0d, 0x2a, 0x0b, 0x2f, 0x70, 0x6e, 0x64, 0x73, 0x2f, 0x7b, 0x70, 0x69, 0x64, 0x7d, + 0x42, 0xae, 0x02, 0x5a, 0x2d, 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, 0x70, + 0x6e, 0x64, 0x92, 0x41, 0xfb, 0x01, 0x12, 0xf8, 0x01, 0x0a, 0x10, 0x67, 0x6f, 0x53, 0x44, 0x4e, + 0x20, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x4d, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x20, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x20, 0x73, 0x70, 0x65, + 0x63, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x61, 0x6e, 0x64, 0x20, + 0x47, 0x6f, 0x20, 0x63, 0x6f, 0x64, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, + 0x67, 0x6f, 0x53, 0x44, 0x4e, 0x20, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x62, 0x6f, 0x75, 0x6e, 0x64, + 0x20, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x22, 0x3e, 0x0a, 0x18, 0x67, 0x6f, + 0x53, 0x44, 0x4e, 0x20, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x20, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x22, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, + 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, + 0x2f, 0x64, 0x61, 0x6e, 0x65, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2a, 0x50, 0x0a, 0x14, 0x42, 0x53, + 0x44, 0x20, 0x33, 0x2d, 0x43, 0x6c, 0x61, 0x75, 0x73, 0x65, 0x20, 0x4c, 0x69, 0x63, 0x65, 0x6e, + 0x73, 0x65, 0x12, 0x38, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x63, 0x6f, 0x64, 0x65, + 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x64, 0x61, 0x6e, + 0x65, 0x74, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x2d, 0x2f, 0x62, 0x6c, 0x6f, 0x62, 0x2f, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x2f, 0x4c, 0x49, 0x43, 0x45, 0x4e, 0x53, 0x45, 0x32, 0x03, 0x30, 0x2e, + 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -146,16 +757,40 @@ func file_gosdn_pnd_pnd_proto_rawDescGZIP() []byte { return file_gosdn_pnd_pnd_proto_rawDescData } -var file_gosdn_pnd_pnd_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_gosdn_pnd_pnd_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_gosdn_pnd_pnd_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_gosdn_pnd_pnd_proto_goTypes = []interface{}{ - (*PrincipalNetworkDomain)(nil), // 0: gosdn.pnd.PrincipalNetworkDomain + (Status)(0), // 0: gosdn.pnd.Status + (*PrincipalNetworkDomain)(nil), // 1: gosdn.pnd.PrincipalNetworkDomain + (*GetPndRequest)(nil), // 2: gosdn.pnd.GetPndRequest + (*GetPndResponse)(nil), // 3: gosdn.pnd.GetPndResponse + (*GetPndListRequest)(nil), // 4: gosdn.pnd.GetPndListRequest + (*GetPndListResponse)(nil), // 5: gosdn.pnd.GetPndListResponse + (*CreatePndListRequest)(nil), // 6: gosdn.pnd.CreatePndListRequest + (*PndCreateProperties)(nil), // 7: gosdn.pnd.PndCreateProperties + (*CreatePndListResponse)(nil), // 8: gosdn.pnd.CreatePndListResponse + (*DeletePndRequest)(nil), // 9: gosdn.pnd.DeletePndRequest + (*DeletePndResponse)(nil), // 10: gosdn.pnd.DeletePndResponse } var file_gosdn_pnd_pnd_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 1, // 0: gosdn.pnd.GetPndResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain + 1, // 1: gosdn.pnd.GetPndListResponse.pnd:type_name -> gosdn.pnd.PrincipalNetworkDomain + 7, // 2: gosdn.pnd.CreatePndListRequest.pnd:type_name -> gosdn.pnd.PndCreateProperties + 0, // 3: gosdn.pnd.CreatePndListResponse.status:type_name -> gosdn.pnd.Status + 0, // 4: gosdn.pnd.DeletePndResponse.status:type_name -> gosdn.pnd.Status + 2, // 5: gosdn.pnd.PndService.GetPnd:input_type -> gosdn.pnd.GetPndRequest + 4, // 6: gosdn.pnd.PndService.GetPndList:input_type -> gosdn.pnd.GetPndListRequest + 6, // 7: gosdn.pnd.PndService.CreatePndList:input_type -> gosdn.pnd.CreatePndListRequest + 9, // 8: gosdn.pnd.PndService.DeletePnd:input_type -> gosdn.pnd.DeletePndRequest + 3, // 9: gosdn.pnd.PndService.GetPnd:output_type -> gosdn.pnd.GetPndResponse + 5, // 10: gosdn.pnd.PndService.GetPndList:output_type -> gosdn.pnd.GetPndListResponse + 8, // 11: gosdn.pnd.PndService.CreatePndList:output_type -> gosdn.pnd.CreatePndListResponse + 10, // 12: gosdn.pnd.PndService.DeletePnd:output_type -> gosdn.pnd.DeletePndResponse + 9, // [9:13] is the sub-list for method output_type + 5, // [5:9] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_gosdn_pnd_pnd_proto_init() } @@ -176,19 +811,128 @@ func file_gosdn_pnd_pnd_proto_init() { return nil } } + file_gosdn_pnd_pnd_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPndRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPndResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPndListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetPndListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePndListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PndCreateProperties); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePndListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePndRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_gosdn_pnd_pnd_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeletePndResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_gosdn_pnd_pnd_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, + NumEnums: 1, + NumMessages: 10, NumExtensions: 0, NumServices: 1, }, GoTypes: file_gosdn_pnd_pnd_proto_goTypes, DependencyIndexes: file_gosdn_pnd_pnd_proto_depIdxs, + EnumInfos: file_gosdn_pnd_pnd_proto_enumTypes, MessageInfos: file_gosdn_pnd_pnd_proto_msgTypes, }.Build() File_gosdn_pnd_pnd_proto = out.File diff --git a/api/go/gosdn/core/core.pb.gw.go b/api/go/gosdn/pnd/pnd.pb.gw.go similarity index 59% rename from api/go/gosdn/core/core.pb.gw.go rename to api/go/gosdn/pnd/pnd.pb.gw.go index 8c56242b632551449573f8c7e56c895e2fe3c12f..41d1dcef34d17229babb16ecb5099280fefa6db4 100644 --- a/api/go/gosdn/core/core.pb.gw.go +++ b/api/go/gosdn/pnd/pnd.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: gosdn/core/core.proto +// source: gosdn/pnd/pnd.proto /* -Package core is a reverse proxy. +Package pnd is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package core +package pnd import ( "context" @@ -32,10 +32,10 @@ var _ = utilities.NewDoubleArray var _ = metadata.Join var ( - filter_CoreService_GetPnd_0 = &utilities.DoubleArray{Encoding: map[string]int{"pid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_PndService_GetPnd_0 = &utilities.DoubleArray{Encoding: map[string]int{"pid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.Marshaler, client CoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_PndService_GetPnd_0(ctx context.Context, marshaler runtime.Marshaler, client PndServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetPndRequest var metadata runtime.ServerMetadata @@ -59,7 +59,7 @@ func request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.Marshal if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CoreService_GetPnd_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PndService_GetPnd_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -68,7 +68,7 @@ func request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.Marshal } -func local_request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.Marshaler, server CoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_PndService_GetPnd_0(ctx context.Context, marshaler runtime.Marshaler, server PndServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetPndRequest var metadata runtime.ServerMetadata @@ -92,7 +92,7 @@ func local_request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.M if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CoreService_GetPnd_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PndService_GetPnd_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -102,17 +102,17 @@ func local_request_CoreService_GetPnd_0(ctx context.Context, marshaler runtime.M } var ( - filter_CoreService_GetPndList_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} + filter_PndService_GetPndList_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_CoreService_GetPndList_0(ctx context.Context, marshaler runtime.Marshaler, client CoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_PndService_GetPndList_0(ctx context.Context, marshaler runtime.Marshaler, client PndServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetPndListRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CoreService_GetPndList_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PndService_GetPndList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -121,14 +121,14 @@ func request_CoreService_GetPndList_0(ctx context.Context, marshaler runtime.Mar } -func local_request_CoreService_GetPndList_0(ctx context.Context, marshaler runtime.Marshaler, server CoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_PndService_GetPndList_0(ctx context.Context, marshaler runtime.Marshaler, server PndServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetPndListRequest var metadata runtime.ServerMetadata if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CoreService_GetPndList_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PndService_GetPndList_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -137,7 +137,7 @@ func local_request_CoreService_GetPndList_0(ctx context.Context, marshaler runti } -func request_CoreService_CreatePndList_0(ctx context.Context, marshaler runtime.Marshaler, client CoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_PndService_CreatePndList_0(ctx context.Context, marshaler runtime.Marshaler, client PndServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreatePndListRequest var metadata runtime.ServerMetadata @@ -154,7 +154,7 @@ func request_CoreService_CreatePndList_0(ctx context.Context, marshaler runtime. } -func local_request_CoreService_CreatePndList_0(ctx context.Context, marshaler runtime.Marshaler, server CoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_PndService_CreatePndList_0(ctx context.Context, marshaler runtime.Marshaler, server PndServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CreatePndListRequest var metadata runtime.ServerMetadata @@ -172,10 +172,10 @@ func local_request_CoreService_CreatePndList_0(ctx context.Context, marshaler ru } var ( - filter_CoreService_DeletePnd_0 = &utilities.DoubleArray{Encoding: map[string]int{"pid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_PndService_DeletePnd_0 = &utilities.DoubleArray{Encoding: map[string]int{"pid": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) -func request_CoreService_DeletePnd_0(ctx context.Context, marshaler runtime.Marshaler, client CoreServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_PndService_DeletePnd_0(ctx context.Context, marshaler runtime.Marshaler, client PndServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq DeletePndRequest var metadata runtime.ServerMetadata @@ -199,7 +199,7 @@ func request_CoreService_DeletePnd_0(ctx context.Context, marshaler runtime.Mars if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CoreService_DeletePnd_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PndService_DeletePnd_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -208,7 +208,7 @@ func request_CoreService_DeletePnd_0(ctx context.Context, marshaler runtime.Mars } -func local_request_CoreService_DeletePnd_0(ctx context.Context, marshaler runtime.Marshaler, server CoreServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_PndService_DeletePnd_0(ctx context.Context, marshaler runtime.Marshaler, server PndServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq DeletePndRequest var metadata runtime.ServerMetadata @@ -232,7 +232,7 @@ func local_request_CoreService_DeletePnd_0(ctx context.Context, marshaler runtim if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_CoreService_DeletePnd_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_PndService_DeletePnd_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } @@ -241,24 +241,24 @@ func local_request_CoreService_DeletePnd_0(ctx context.Context, marshaler runtim } -// RegisterCoreServiceHandlerServer registers the http handlers for service CoreService to "mux". -// UnaryRPC :call CoreServiceServer directly. +// RegisterPndServiceHandlerServer registers the http handlers for service PndService to "mux". +// UnaryRPC :call PndServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterCoreServiceHandlerFromEndpoint instead. -func RegisterCoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CoreServiceServer) error { +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPndServiceHandlerFromEndpoint instead. +func RegisterPndServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PndServiceServer) error { - mux.Handle("GET", pattern_CoreService_GetPnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_PndService_GetPnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.core.CoreService/GetPnd", runtime.WithHTTPPathPattern("/pnd/{pid}")) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.pnd.PndService/GetPnd", runtime.WithHTTPPathPattern("/pnd/{pid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CoreService_GetPnd_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PndService_GetPnd_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -266,22 +266,22 @@ func RegisterCoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } - forward_CoreService_GetPnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_GetPnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_CoreService_GetPndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_PndService_GetPndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.core.CoreService/GetPndList", runtime.WithHTTPPathPattern("/pnds")) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.pnd.PndService/GetPndList", runtime.WithHTTPPathPattern("/pnds")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CoreService_GetPndList_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PndService_GetPndList_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -289,22 +289,22 @@ func RegisterCoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } - forward_CoreService_GetPndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_GetPndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_CoreService_CreatePndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_PndService_CreatePndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.core.CoreService/CreatePndList", runtime.WithHTTPPathPattern("/pnds")) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.pnd.PndService/CreatePndList", runtime.WithHTTPPathPattern("/pnds")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CoreService_CreatePndList_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PndService_CreatePndList_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -312,22 +312,22 @@ func RegisterCoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } - forward_CoreService_CreatePndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_CreatePndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("DELETE", pattern_CoreService_DeletePnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("DELETE", pattern_PndService_DeletePnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.core.CoreService/DeletePnd", runtime.WithHTTPPathPattern("/pnds/{pid}")) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/gosdn.pnd.PndService/DeletePnd", runtime.WithHTTPPathPattern("/pnds/{pid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_CoreService_DeletePnd_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_PndService_DeletePnd_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -335,16 +335,16 @@ func RegisterCoreServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux return } - forward_CoreService_DeletePnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_DeletePnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } -// RegisterCoreServiceHandlerFromEndpoint is same as RegisterCoreServiceHandler but +// RegisterPndServiceHandlerFromEndpoint is same as RegisterPndServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterCoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { +func RegisterPndServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { conn, err := grpc.Dial(endpoint, opts...) if err != nil { return err @@ -364,99 +364,99 @@ func RegisterCoreServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.Se }() }() - return RegisterCoreServiceHandler(ctx, mux, conn) + return RegisterPndServiceHandler(ctx, mux, conn) } -// RegisterCoreServiceHandler registers the http handlers for service CoreService to "mux". +// RegisterPndServiceHandler registers the http handlers for service PndService to "mux". // The handlers forward requests to the grpc endpoint over "conn". -func RegisterCoreServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterCoreServiceHandlerClient(ctx, mux, NewCoreServiceClient(conn)) +func RegisterPndServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterPndServiceHandlerClient(ctx, mux, NewPndServiceClient(conn)) } -// RegisterCoreServiceHandlerClient registers the http handlers for service CoreService -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CoreServiceClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CoreServiceClient" +// RegisterPndServiceHandlerClient registers the http handlers for service PndService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PndServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PndServiceClient" // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "CoreServiceClient" to call the correct interceptors. -func RegisterCoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CoreServiceClient) error { +// "PndServiceClient" to call the correct interceptors. +func RegisterPndServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PndServiceClient) error { - mux.Handle("GET", pattern_CoreService_GetPnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_PndService_GetPnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.core.CoreService/GetPnd", runtime.WithHTTPPathPattern("/pnd/{pid}")) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.pnd.PndService/GetPnd", runtime.WithHTTPPathPattern("/pnd/{pid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CoreService_GetPnd_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PndService_GetPnd_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_CoreService_GetPnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_GetPnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_CoreService_GetPndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_PndService_GetPndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.core.CoreService/GetPndList", runtime.WithHTTPPathPattern("/pnds")) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.pnd.PndService/GetPndList", runtime.WithHTTPPathPattern("/pnds")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CoreService_GetPndList_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PndService_GetPndList_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_CoreService_GetPndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_GetPndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("POST", pattern_CoreService_CreatePndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("POST", pattern_PndService_CreatePndList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.core.CoreService/CreatePndList", runtime.WithHTTPPathPattern("/pnds")) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.pnd.PndService/CreatePndList", runtime.WithHTTPPathPattern("/pnds")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CoreService_CreatePndList_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PndService_CreatePndList_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_CoreService_CreatePndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_CreatePndList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("DELETE", pattern_CoreService_DeletePnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("DELETE", pattern_PndService_DeletePnd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.core.CoreService/DeletePnd", runtime.WithHTTPPathPattern("/pnds/{pid}")) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/gosdn.pnd.PndService/DeletePnd", runtime.WithHTTPPathPattern("/pnds/{pid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_CoreService_DeletePnd_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_PndService_DeletePnd_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_CoreService_DeletePnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_PndService_DeletePnd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -464,21 +464,21 @@ func RegisterCoreServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux } var ( - pattern_CoreService_GetPnd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"pnd", "pid"}, "")) + pattern_PndService_GetPnd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"pnd", "pid"}, "")) - pattern_CoreService_GetPndList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"pnds"}, "")) + pattern_PndService_GetPndList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"pnds"}, "")) - pattern_CoreService_CreatePndList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"pnds"}, "")) + pattern_PndService_CreatePndList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"pnds"}, "")) - pattern_CoreService_DeletePnd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"pnds", "pid"}, "")) + pattern_PndService_DeletePnd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 1, 0, 4, 1, 5, 1}, []string{"pnds", "pid"}, "")) ) var ( - forward_CoreService_GetPnd_0 = runtime.ForwardResponseMessage + forward_PndService_GetPnd_0 = runtime.ForwardResponseMessage - forward_CoreService_GetPndList_0 = runtime.ForwardResponseMessage + forward_PndService_GetPndList_0 = runtime.ForwardResponseMessage - forward_CoreService_CreatePndList_0 = runtime.ForwardResponseMessage + forward_PndService_CreatePndList_0 = runtime.ForwardResponseMessage - forward_CoreService_DeletePnd_0 = runtime.ForwardResponseMessage + forward_PndService_DeletePnd_0 = runtime.ForwardResponseMessage ) diff --git a/api/go/gosdn/pnd/pnd_grpc.pb.go b/api/go/gosdn/pnd/pnd_grpc.pb.go index 85cb369c25fd9b1e8904b820bca9998b771d9f74..a950afabd482543ecf9c023b5d580e8d8bbdfacf 100644 --- a/api/go/gosdn/pnd/pnd_grpc.pb.go +++ b/api/go/gosdn/pnd/pnd_grpc.pb.go @@ -3,7 +3,10 @@ package pnd import ( + context "context" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" ) // This is a compile-time assertion to ensure that this generated file @@ -15,6 +18,14 @@ 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 PndServiceClient interface { + // Allows to request a specific Principal Network Domain. + GetPnd(ctx context.Context, in *GetPndRequest, opts ...grpc.CallOption) (*GetPndResponse, error) + // Allows to request all Principal Network Domains. + GetPndList(ctx context.Context, in *GetPndListRequest, opts ...grpc.CallOption) (*GetPndListResponse, error) + // Allows create a Principal Network Domain. + CreatePndList(ctx context.Context, in *CreatePndListRequest, opts ...grpc.CallOption) (*CreatePndListResponse, error) + // Allows to delete a specific Principal Network Domain. + DeletePnd(ctx context.Context, in *DeletePndRequest, opts ...grpc.CallOption) (*DeletePndResponse, error) } type pndServiceClient struct { @@ -25,10 +36,54 @@ func NewPndServiceClient(cc grpc.ClientConnInterface) PndServiceClient { return &pndServiceClient{cc} } +func (c *pndServiceClient) GetPnd(ctx context.Context, in *GetPndRequest, opts ...grpc.CallOption) (*GetPndResponse, error) { + out := new(GetPndResponse) + err := c.cc.Invoke(ctx, "/gosdn.pnd.PndService/GetPnd", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pndServiceClient) GetPndList(ctx context.Context, in *GetPndListRequest, opts ...grpc.CallOption) (*GetPndListResponse, error) { + out := new(GetPndListResponse) + err := c.cc.Invoke(ctx, "/gosdn.pnd.PndService/GetPndList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pndServiceClient) CreatePndList(ctx context.Context, in *CreatePndListRequest, opts ...grpc.CallOption) (*CreatePndListResponse, error) { + out := new(CreatePndListResponse) + err := c.cc.Invoke(ctx, "/gosdn.pnd.PndService/CreatePndList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *pndServiceClient) DeletePnd(ctx context.Context, in *DeletePndRequest, opts ...grpc.CallOption) (*DeletePndResponse, error) { + out := new(DeletePndResponse) + err := c.cc.Invoke(ctx, "/gosdn.pnd.PndService/DeletePnd", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // PndServiceServer is the server API for PndService service. // All implementations must embed UnimplementedPndServiceServer // for forward compatibility type PndServiceServer interface { + // Allows to request a specific Principal Network Domain. + GetPnd(context.Context, *GetPndRequest) (*GetPndResponse, error) + // Allows to request all Principal Network Domains. + GetPndList(context.Context, *GetPndListRequest) (*GetPndListResponse, error) + // Allows create a Principal Network Domain. + CreatePndList(context.Context, *CreatePndListRequest) (*CreatePndListResponse, error) + // Allows to delete a specific Principal Network Domain. + DeletePnd(context.Context, *DeletePndRequest) (*DeletePndResponse, error) mustEmbedUnimplementedPndServiceServer() } @@ -36,6 +91,18 @@ type PndServiceServer interface { type UnimplementedPndServiceServer struct { } +func (UnimplementedPndServiceServer) GetPnd(context.Context, *GetPndRequest) (*GetPndResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPnd not implemented") +} +func (UnimplementedPndServiceServer) GetPndList(context.Context, *GetPndListRequest) (*GetPndListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetPndList not implemented") +} +func (UnimplementedPndServiceServer) CreatePndList(context.Context, *CreatePndListRequest) (*CreatePndListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePndList not implemented") +} +func (UnimplementedPndServiceServer) DeletePnd(context.Context, *DeletePndRequest) (*DeletePndResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeletePnd not implemented") +} func (UnimplementedPndServiceServer) mustEmbedUnimplementedPndServiceServer() {} // UnsafePndServiceServer may be embedded to opt out of forward compatibility for this service. @@ -49,13 +116,102 @@ func RegisterPndServiceServer(s grpc.ServiceRegistrar, srv PndServiceServer) { s.RegisterService(&PndService_ServiceDesc, srv) } +func _PndService_GetPnd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPndRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PndServiceServer).GetPnd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.pnd.PndService/GetPnd", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PndServiceServer).GetPnd(ctx, req.(*GetPndRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PndService_GetPndList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetPndListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PndServiceServer).GetPndList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.pnd.PndService/GetPndList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PndServiceServer).GetPndList(ctx, req.(*GetPndListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PndService_CreatePndList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePndListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PndServiceServer).CreatePndList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.pnd.PndService/CreatePndList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PndServiceServer).CreatePndList(ctx, req.(*CreatePndListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PndService_DeletePnd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeletePndRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PndServiceServer).DeletePnd(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.pnd.PndService/DeletePnd", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PndServiceServer).DeletePnd(ctx, req.(*DeletePndRequest)) + } + return interceptor(ctx, in, info, handler) +} + // PndService_ServiceDesc is the grpc.ServiceDesc for PndService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var PndService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "gosdn.pnd.PndService", HandlerType: (*PndServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{}, - Metadata: "gosdn/pnd/pnd.proto", + Methods: []grpc.MethodDesc{ + { + MethodName: "GetPnd", + Handler: _PndService_GetPnd_Handler, + }, + { + MethodName: "GetPndList", + Handler: _PndService_GetPndList_Handler, + }, + { + MethodName: "CreatePndList", + Handler: _PndService_CreatePndList_Handler, + }, + { + MethodName: "DeletePnd", + Handler: _PndService_DeletePnd_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "gosdn/pnd/pnd.proto", } diff --git a/api/openapiv2/gosdn_northbound.swagger.json b/api/openapiv2/gosdn_northbound.swagger.json index 7f0a4e49abc1e975f525c964bc7b8fdf00d9a00f..a780ced854791f69871d6c27196455464d7756bf 100644 --- a/api/openapiv2/gosdn_northbound.swagger.json +++ b/api/openapiv2/gosdn_northbound.swagger.json @@ -14,6 +14,9 @@ } }, "tags": [ + { + "name": "PndService" + }, { "name": "Collector" }, @@ -32,9 +35,6 @@ { "name": "ConfigurationManagementService" }, - { - "name": "CoreService" - }, { "name": "CsbiService" }, @@ -394,12 +394,12 @@ "/pnd/{pid}": { "get": { "summary": "Allows to request a specific Principal Network Domain.", - "operationId": "CoreService_GetPnd", + "operationId": "PndService_GetPnd", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/coreGetPndResponse" + "$ref": "#/definitions/pndGetPndResponse" } }, "default": { @@ -425,19 +425,19 @@ } ], "tags": [ - "CoreService" + "PndService" ] } }, "/pnds": { "get": { "summary": "Allows to request all Principal Network Domains.", - "operationId": "CoreService_GetPndList", + "operationId": "PndService_GetPndList", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/coreGetPndListResponse" + "$ref": "#/definitions/pndGetPndListResponse" } }, "default": { @@ -457,17 +457,17 @@ } ], "tags": [ - "CoreService" + "PndService" ] }, "post": { "summary": "Allows create a Principal Network Domain.", - "operationId": "CoreService_CreatePndList", + "operationId": "PndService_CreatePndList", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/coreCreatePndListResponse" + "$ref": "#/definitions/pndCreatePndListResponse" } }, "default": { @@ -483,24 +483,24 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/coreCreatePndListRequest" + "$ref": "#/definitions/pndCreatePndListRequest" } } ], "tags": [ - "CoreService" + "PndService" ] } }, "/pnds/{pid}": { "delete": { "summary": "Allows to delete a specific Principal Network Domain.", - "operationId": "CoreService_DeletePnd", + "operationId": "PndService_DeletePnd", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/coreDeletePndResponse" + "$ref": "#/definitions/pndDeletePndResponse" } }, "default": { @@ -526,7 +526,7 @@ } ], "tags": [ - "CoreService" + "PndService" ] } }, @@ -1746,83 +1746,6 @@ } } }, - "coreCreatePndListRequest": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "int64" - }, - "pnd": { - "type": "array", - "items": { - "$ref": "#/definitions/corePndCreateProperties" - } - } - } - }, - "coreCreatePndListResponse": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "int64" - }, - "status": { - "$ref": "#/definitions/gosdncoreStatus" - } - } - }, - "coreDeletePndResponse": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "int64" - }, - "status": { - "$ref": "#/definitions/gosdncoreStatus" - } - } - }, - "coreGetPndListResponse": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "int64" - }, - "pnd": { - "type": "array", - "items": { - "$ref": "#/definitions/pndPrincipalNetworkDomain" - } - } - } - }, - "coreGetPndResponse": { - "type": "object", - "properties": { - "timestamp": { - "type": "string", - "format": "int64" - }, - "pnd": { - "$ref": "#/definitions/pndPrincipalNetworkDomain" - } - } - }, - "corePndCreateProperties": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - } - } - }, "csbiAck": { "type": "object", "properties": { @@ -2902,15 +2825,6 @@ ], "default": "STATUS_UNSPECIFIED" }, - "gosdncoreStatus": { - "type": "string", - "enum": [ - "STATUS_UNSPECIFIED", - "STATUS_OK", - "STATUS_ERROR" - ], - "default": "STATUS_UNSPECIFIED" - }, "gosdncsbiDeleteResponse": { "type": "object", "properties": { @@ -3087,6 +3001,15 @@ } } }, + "gosdnpndStatus": { + "type": "string", + "enum": [ + "STATUS_UNSPECIFIED", + "STATUS_OK", + "STATUS_ERROR" + ], + "default": "STATUS_UNSPECIFIED" + }, "gosdnrbacRole": { "type": "object", "properties": { @@ -3746,6 +3669,83 @@ } } }, + "pndCreatePndListRequest": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "pnd": { + "type": "array", + "items": { + "$ref": "#/definitions/pndPndCreateProperties" + } + } + } + }, + "pndCreatePndListResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "status": { + "$ref": "#/definitions/gosdnpndStatus" + } + } + }, + "pndDeletePndResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "status": { + "$ref": "#/definitions/gosdnpndStatus" + } + } + }, + "pndGetPndListResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "pnd": { + "type": "array", + "items": { + "$ref": "#/definitions/pndPrincipalNetworkDomain" + } + } + } + }, + "pndGetPndResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "pnd": { + "$ref": "#/definitions/pndPrincipalNetworkDomain" + } + } + }, + "pndPndCreateProperties": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + } + } + }, "pndPrincipalNetworkDomain": { "type": "object", "properties": { @@ -3769,7 +3769,7 @@ } }, "additionalProperties": {}, - "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\nExample 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\nExample 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" }, "rbacCreateRolesRequest": { "type": "object", diff --git a/api/proto/buf.lock b/api/proto/buf.lock index eb6dc2d672c1eb688f5287d2f303d1d1b93ff6a6..619f052b03f003ef0084f3c8cfafead89cdeebfe 100644 --- a/api/proto/buf.lock +++ b/api/proto/buf.lock @@ -4,8 +4,10 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - commit: 463926e7ee924d46ad0a726e1cf4eacd + commit: cc916c31859748a68fd229a3c8d7a2e8 + digest: shake256:469b049d0eb04203d5272062636c078decefc96fec69739159c25d85349c50c34c7706918a8b216c5c27f76939df48452148cff8c5c3ae77fa6ba5c25c1b8bf8 - remote: buf.build owner: grpc-ecosystem repository: grpc-gateway commit: a1ecdc58eccd49aa8bea2a7a9022dc27 + digest: shake256:efdd86fbdc42e8b7259fe461a49656827a03fb7cba0b3b9eb622ca10654ec6beccb9a051229c1553ccd89ed3e95d69ad4d7c799f1da3f3f1bd447b7947a4893e diff --git a/api/proto/gosdn/core/core.proto b/api/proto/gosdn/core/core.proto deleted file mode 100644 index d5cb66784a835febdffa181233b1cc9136fae1e8..0000000000000000000000000000000000000000 --- a/api/proto/gosdn/core/core.proto +++ /dev/null @@ -1,87 +0,0 @@ -syntax = "proto3"; - -package gosdn.core; - -import "google/api/annotations.proto"; -import "gosdn/pnd/pnd.proto"; - -option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core"; - -service CoreService { - // Allows to request a specific Principal Network Domain. - rpc GetPnd(GetPndRequest) returns (GetPndResponse) { - option (google.api.http) = { - get: "/pnd/{pid}" - }; - } - // Allows to request all Principal Network Domains. - rpc GetPndList(GetPndListRequest) returns (GetPndListResponse) { - option (google.api.http) = { - get: "/pnds" - }; - } - // Allows create a Principal Network Domain. - rpc CreatePndList(CreatePndListRequest) returns (CreatePndListResponse) { - option (google.api.http) = { - post: "/pnds" - body: "*" - }; - } - // Allows to delete a specific Principal Network Domain. - rpc DeletePnd(DeletePndRequest) returns (DeletePndResponse) { - option (google.api.http) = { - delete: "/pnds/{pid}" - }; - } -} - - -message GetPndRequest { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - string pid = 2; -} - -message GetPndResponse { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - .gosdn.pnd.PrincipalNetworkDomain pnd = 2; -} - -message GetPndListRequest { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. -} - -message GetPndListResponse { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - repeated .gosdn.pnd.PrincipalNetworkDomain pnd = 2; - } - -message CreatePndListRequest { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - repeated PndCreateProperties pnd = 2; -} - -message PndCreateProperties { - string name = 1; - string description = 2; -} - -message CreatePndListResponse { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - Status status = 2; -} - -message DeletePndRequest { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - string pid = 4; -} - -message DeletePndResponse { - int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. - Status status = 2; -} - -enum Status { - STATUS_UNSPECIFIED = 0; - STATUS_OK = 1; - STATUS_ERROR = 2; -} diff --git a/api/proto/gosdn/pnd/pnd.proto b/api/proto/gosdn/pnd/pnd.proto index a12edbcf4a2c51ce8d64a3a2902828f205e148b0..1de8f871158dbc9578b9394f4adc5e9862f32706 100644 --- a/api/proto/gosdn/pnd/pnd.proto +++ b/api/proto/gosdn/pnd/pnd.proto @@ -28,7 +28,31 @@ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { }; service PndService { - + // Allows to request a specific Principal Network Domain. + rpc GetPnd(GetPndRequest) returns (GetPndResponse) { + option (google.api.http) = { + get: "/pnd/{pid}" + }; + } + // Allows to request all Principal Network Domains. + rpc GetPndList(GetPndListRequest) returns (GetPndListResponse) { + option (google.api.http) = { + get: "/pnds" + }; + } + // Allows create a Principal Network Domain. + rpc CreatePndList(CreatePndListRequest) returns (CreatePndListResponse) { + option (google.api.http) = { + post: "/pnds" + body: "*" + }; + } + // Allows to delete a specific Principal Network Domain. + rpc DeletePnd(DeletePndRequest) returns (DeletePndResponse) { + option (google.api.http) = { + delete: "/pnds/{pid}" + }; + } } message PrincipalNetworkDomain { @@ -36,3 +60,53 @@ message PrincipalNetworkDomain { string name = 2; string description = 3; } + +message GetPndRequest { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + string pid = 2; +} + +message GetPndResponse { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + .gosdn.pnd.PrincipalNetworkDomain pnd = 2; +} + +message GetPndListRequest { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. +} + +message GetPndListResponse { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + repeated .gosdn.pnd.PrincipalNetworkDomain pnd = 2; +} + +message CreatePndListRequest { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + repeated PndCreateProperties pnd = 2; +} + +message PndCreateProperties { + string name = 1; + string description = 2; +} + +message CreatePndListResponse { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + Status status = 2; +} + +message DeletePndRequest { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + string pid = 4; +} + +message DeletePndResponse { + int64 timestamp = 1; // Timestamp in nanoseconds since Epoch. + Status status = 2; +} + +enum Status { + STATUS_UNSPECIFIED = 0; + STATUS_OK = 1; + STATUS_ERROR = 2; +} diff --git a/applications/venv-manager/venv-manager/venv-manager.go b/applications/venv-manager/venv-manager/venv-manager.go index 8d9743e22052df5b0a8d7a1cfda76b154228747f..bac53503615d1a5f1be0b6c992dd0f0b9240e17d 100644 --- a/applications/venv-manager/venv-manager/venv-manager.go +++ b/applications/venv-manager/venv-manager/venv-manager.go @@ -10,8 +10,8 @@ import ( "time" configMgmtPb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/configurationmanagement" - corePb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" + ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" topologyPb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology" "code.fbi.h-da.de/danet/gosdn/applications/venv-manager/containerlab" link "code.fbi.h-da.de/danet/gosdn/applications/venv-manager/links" @@ -103,8 +103,8 @@ func (v *VenvManager) sendSDNConfigData(sdnConfigData *string) error { ctx := context.Background() - coreService := corePb.NewCoreServiceClient(conn) - pndRes, err := coreService.GetPndList(ctx, &corePb.GetPndListRequest{Timestamp: getTimestamp()}) + pndService := ppb.NewPndServiceClient(conn) + pndRes, err := pndService.GetPndList(ctx, &ppb.GetPndListRequest{Timestamp: getTimestamp()}) if err != nil { return err } @@ -147,9 +147,8 @@ func (v *VenvManager) getSDNConfigData() (*string, error) { ctx := context.Background() - //get PND, might remove later because we won't support PND in the future - coreService := corePb.NewCoreServiceClient(conn) - pndRes, err := coreService.GetPndList(ctx, &corePb.GetPndListRequest{Timestamp: getTimestamp()}) + pndService := ppb.NewPndServiceClient(conn) + pndRes, err := pndService.GetPndList(ctx, &ppb.GetPndListRequest{Timestamp: getTimestamp()}) if err != nil { return nil, err } @@ -224,9 +223,8 @@ func (v *VenvManager) getTopologyData() (*topologyPb.GetTopologyResponse, error) ctx := context.Background() - //get PND, might remove later because we won't support PND in the future - coreService := corePb.NewCoreServiceClient(conn) - pndRes, err := coreService.GetPndList(ctx, &corePb.GetPndListRequest{Timestamp: getTimestamp()}) + pndService := ppb.NewPndServiceClient(conn) + pndRes, err := pndService.GetPndList(ctx, &ppb.GetPndListRequest{Timestamp: getTimestamp()}) if err != nil { return nil, err } diff --git a/cli/adapter/PndAdapter.go b/cli/adapter/PndAdapter.go index c1e15c2bf02384f3a29f7601783ed308a61cfdd3..ab86379dab85a296147dd39f67442106ccf2428d 100644 --- a/cli/adapter/PndAdapter.go +++ b/cli/adapter/PndAdapter.go @@ -3,9 +3,9 @@ package adapter import ( "context" - "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" prb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-registry" + ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport" "code.fbi.h-da.de/danet/gosdn/controller/api" "code.fbi.h-da.de/danet/gosdn/controller/customerrs" @@ -79,7 +79,7 @@ func (p *PndAdapter) RemoveNetworkElement(ctx context.Context, did uuid.UUID) (* } // RemovePnd removes a PND from the controller. -func (p *PndAdapter) RemovePnd(ctx context.Context, pid uuid.UUID) (*core.DeletePndResponse, error) { +func (p *PndAdapter) RemovePnd(ctx context.Context, pid uuid.UUID) (*ppb.DeletePndResponse, error) { return api.DeletePnd(ctx, p.endpoint, pid.String()) } diff --git a/cli/cmd/pndCreate.go b/cli/cmd/pndCreate.go index 2346fca2cf12837d68329eeef9a00ece6ac82ba1..5c3c83d53cbf3946cf23854cbd72b2538d291fb1 100644 --- a/cli/cmd/pndCreate.go +++ b/cli/cmd/pndCreate.go @@ -32,7 +32,7 @@ POSSIBILITY OF SUCH DAMAGE. package cmd import ( - "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" + ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" "code.fbi.h-da.de/danet/gosdn/controller/api" "github.com/pterm/pterm" "github.com/spf13/cobra" @@ -57,7 +57,7 @@ A description must be passed as positional argument.`, return err } - if resp.Status == core.Status_STATUS_OK { + if resp.Status == ppb.Status_STATUS_OK { spinner.Success("PND has been created with name: ", pndName) } else { spinner.Fail("Failed creating the PND with name: ", pndName) diff --git a/controller/api/grpc.go b/controller/api/grpc.go index f1f9491d60e3e7d011ba6f1c72b99149baebf41c..76ae474e08d0581fe2f80d0dba6546dd693c8c85 100644 --- a/controller/api/grpc.go +++ b/controller/api/grpc.go @@ -4,7 +4,6 @@ import ( "context" "time" - pb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" nbi "code.fbi.h-da.de/danet/gosdn/controller/northbound/client" log "github.com/sirupsen/logrus" @@ -24,7 +23,7 @@ func init() { // Init initialises the CLI client. func Init(ctx context.Context, addr string) error { - resp, err := GetAllCore(ctx, addr) + resp, err := GetAllPnds(ctx, addr) if err != nil { return err } @@ -40,21 +39,21 @@ func Init(ctx context.Context, addr string) error { // GetIds requests all UUID information from the controller. func GetIds(ctx context.Context, addr string) ([]*ppb.PrincipalNetworkDomain, error) { - resp, err := GetAllCore(ctx, addr) + resp, err := GetAllPnds(ctx, addr) if err != nil { return nil, err } return resp.Pnd, nil } -// GetAllCore requests all PNDs. -func GetAllCore(ctx context.Context, addr string) (*pb.GetPndListResponse, error) { - coreClient, err := nbi.CoreClient(addr, dialOptions...) +// GetAllPnds requests all PNDs. +func GetAllPnds(ctx context.Context, addr string) (*ppb.GetPndListResponse, error) { + pndClient, err := nbi.PndClient(addr, dialOptions...) if err != nil { return nil, err } - req := &pb.GetPndListRequest{ + req := &ppb.GetPndListRequest{ Timestamp: time.Now().UnixNano(), } - return coreClient.GetPndList(ctx, req) + return pndClient.GetPndList(ctx, req) } diff --git a/controller/api/initialise_test.go b/controller/api/initialise_test.go index 867581cd8409ba97de1aba637b66aaf435032ade..f5623392d679c39e9b4ae136535b2e159a8c13c3 100644 --- a/controller/api/initialise_test.go +++ b/controller/api/initialise_test.go @@ -8,7 +8,6 @@ import ( "time" - cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" rpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-registry" @@ -237,7 +236,6 @@ func bootstrapUnitTest() { func(u uuid.UUID, c chan networkelement.Details) {}, ) - cpb.RegisterCoreServiceServer(s, northbound.Core) ppb.RegisterPndServiceServer(s, northbound.Pnd) apb.RegisterAuthServiceServer(s, northbound.Auth) apb.RegisterUserServiceServer(s, northbound.User) diff --git a/controller/api/pnd.go b/controller/api/pnd.go index 2adbda11c96f1c6858cd951a7004ef8ccc3606d1..c47eb5897df5ed20764206c1b620cc83a9f46671 100644 --- a/controller/api/pnd.go +++ b/controller/api/pnd.go @@ -5,21 +5,21 @@ import ( "errors" "time" - pb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" + ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" nbi "code.fbi.h-da.de/danet/gosdn/controller/northbound/client" ) // AddPnd takes a name, description and SBI UUID to create a new // PrincipalNetworkDomain on the controller. -func AddPnd(ctx context.Context, addr, name, description string) (*pb.CreatePndListResponse, error) { - coreClient, err := nbi.CoreClient(addr, dialOptions...) +func AddPnd(ctx context.Context, addr, name, description string) (*ppb.CreatePndListResponse, error) { + pndClient, err := nbi.PndClient(addr, dialOptions...) if err != nil { return nil, err } - req := &pb.CreatePndListRequest{ + req := &ppb.CreatePndListRequest{ Timestamp: time.Now().UnixNano(), - Pnd: []*pb.PndCreateProperties{ + Pnd: []*ppb.PndCreateProperties{ { Name: name, Description: description, @@ -27,13 +27,13 @@ func AddPnd(ctx context.Context, addr, name, description string) (*pb.CreatePndL }, } - return coreClient.CreatePndList(ctx, req) + return pndClient.CreatePndList(ctx, req) } // GetPnd requests one PrincipalNetworkDomain from the // controller. -func GetPnd(ctx context.Context, addr string, args string) (*pb.GetPndResponse, error) { - coreClient, err := nbi.CoreClient(addr, dialOptions...) +func GetPnd(ctx context.Context, addr string, args string) (*ppb.GetPndResponse, error) { + pndClient, err := nbi.PndClient(addr, dialOptions...) if err != nil { return nil, err } @@ -41,37 +41,37 @@ func GetPnd(ctx context.Context, addr string, args string) (*pb.GetPndResponse, return nil, errors.New("not enough arguments") } - req := &pb.GetPndRequest{ + req := &ppb.GetPndRequest{ Timestamp: time.Now().UnixNano(), Pid: args, } - return coreClient.GetPnd(ctx, req) + return pndClient.GetPnd(ctx, req) } // GetPnds requests all PrincipalNetworkDomains from the // controller. -func GetPnds(ctx context.Context, addr string, args ...string) (*pb.GetPndListResponse, error) { - coreClient, err := nbi.CoreClient(addr, dialOptions...) +func GetPnds(ctx context.Context, addr string, args ...string) (*ppb.GetPndListResponse, error) { + pndClient, err := nbi.PndClient(addr, dialOptions...) if err != nil { return nil, err } - req := &pb.GetPndListRequest{ + req := &ppb.GetPndListRequest{ Timestamp: time.Now().UnixNano(), } - return coreClient.GetPndList(ctx, req) + return pndClient.GetPndList(ctx, req) } // DeletePnd requests a deletion of the provided PND. -func DeletePnd(ctx context.Context, addr string, pid string) (*pb.DeletePndResponse, error) { - coreClient, err := nbi.CoreClient(addr, dialOptions...) +func DeletePnd(ctx context.Context, addr string, pid string) (*ppb.DeletePndResponse, error) { + pndClient, err := nbi.PndClient(addr, dialOptions...) if err != nil { return nil, err } - req := &pb.DeletePndRequest{ + req := &ppb.DeletePndRequest{ Timestamp: time.Now().UnixNano(), Pid: pid, } - return coreClient.DeletePnd(ctx, req) + return pndClient.DeletePnd(ctx, req) } diff --git a/controller/controller.go b/controller/controller.go index 1f3ba0e7f5dcb821eb24f8068b2269a73c065c4a..b0ef5f14d5665931ac14c3ee644eb055f2ed22ef 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -21,7 +21,6 @@ import ( apppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/app" cmpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/configurationmanagement" - pb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" pipb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-internal" @@ -216,7 +215,6 @@ func startGrpc() error { callback, ) - pb.RegisterCoreServiceServer(c.grpcServer, c.nbi.Core) ppb.RegisterPndServiceServer(c.grpcServer, c.nbi.Pnd) cpb.RegisterCsbiServiceServer(c.grpcServer, c.nbi.Csbi) apb.RegisterAuthServiceServer(c.grpcServer, c.nbi.Auth) diff --git a/controller/http.go b/controller/http.go index 4d52509d8452b1c325db03114a9b833503bdcb92..dae22922bde93e023810c80a2e2ea26c6851758d 100644 --- a/controller/http.go +++ b/controller/http.go @@ -15,8 +15,8 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" - cgw "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" mnegw "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" + pgw "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" agw "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/rbac" tgw "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology" ) @@ -51,17 +51,11 @@ func run() error { } opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} - err = cgw.RegisterCoreServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts) + err = pgw.RegisterPndServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts) if err != nil { return err } - // TODO: add when pnd service, has any functions again - // err = pgw.RegisterPndServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts) - // if err != nil { - // return err - // } - err = agw.RegisterAuthServiceHandlerFromEndpoint(ctx, mux, *grpcServerEndpoint, opts) if err != nil { return err diff --git a/controller/northbound/client/core.go b/controller/northbound/client/core.go deleted file mode 100644 index 1f2e18b17f8268b468ababd90b1d09fc8a39c818..0000000000000000000000000000000000000000 --- a/controller/northbound/client/core.go +++ /dev/null @@ -1,17 +0,0 @@ -package client - -import ( - pb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" - "google.golang.org/grpc" -) - -// CoreClient returns a client for the gRPC Core service. It takes -// the address of the gRPC endpoint and optional grpc.DialOption -// as argument. -func CoreClient(addr string, opts ...grpc.DialOption) (pb.CoreServiceClient, error) { - conn, err := grpc.Dial(addr, opts...) - if err != nil { - return nil, err - } - return pb.NewCoreServiceClient(conn), nil -} diff --git a/controller/northbound/server/core.go b/controller/northbound/server/core.go deleted file mode 100644 index 13027611838f126e34f15095e6dd709e831d499d..0000000000000000000000000000000000000000 --- a/controller/northbound/server/core.go +++ /dev/null @@ -1,137 +0,0 @@ -package server - -import ( - "context" - "time" - - pb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" - cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" - ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" - "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain" - "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkelement" - "code.fbi.h-da.de/danet/gosdn/controller/interfaces/plugin" - "code.fbi.h-da.de/danet/gosdn/controller/metrics" - "code.fbi.h-da.de/danet/gosdn/controller/nucleus" - "code.fbi.h-da.de/danet/gosdn/controller/store" - "github.com/google/uuid" - "github.com/prometheus/client_golang/prometheus" -) - -// CoreServer represents a core server. -type CoreServer struct { - pb.UnimplementedCoreServiceServer - pndService networkdomain.Service - pluginService plugin.Service - csbiClient cpb.CsbiServiceClient - pndCallbackFn func(uuid.UUID, chan networkelement.Details) -} - -// NewCoreServer receives a pndStore and returns a new coreServer. -func NewCoreServer(pndService networkdomain.Service, pluginService plugin.Service, pndCallbackFn func(uuid.UUID, chan networkelement.Details), csbiClient cpb.CsbiServiceClient) *CoreServer { - return &CoreServer{ - pndService: pndService, - pluginService: pluginService, - pndCallbackFn: pndCallbackFn, - csbiClient: csbiClient, - } -} - -// GetPnd returns a existing pnd. -func (s CoreServer) GetPnd(ctx context.Context, request *pb.GetPndRequest) (*pb.GetPndResponse, error) { - labels := prometheus.Labels{"service": "core", "rpc": "get"} - start := metrics.StartHook(labels, grpcRequestsTotal) - defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - - pndID, err := uuid.Parse(request.Pid) - if err != nil { - return nil, handleRPCError(labels, err) - } - - storedPnd, err := s.pndService.Get(store.Query{ID: pndID}) - if err != nil { - return nil, err - } - - pnd := &ppb.PrincipalNetworkDomain{ - Id: storedPnd.ID().String(), - Name: storedPnd.GetName(), - Description: storedPnd.GetDescription(), - } - - return &pb.GetPndResponse{ - Timestamp: time.Now().UnixNano(), - Pnd: pnd, - }, nil -} - -// GetPndList returns all existing pnds. -func (s CoreServer) GetPndList(ctx context.Context, request *pb.GetPndListRequest) (*pb.GetPndListResponse, error) { - labels := prometheus.Labels{"service": "core", "rpc": "get"} - start := metrics.StartHook(labels, grpcRequestsTotal) - defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - - pndList, err := s.pndService.GetAll() - if err != nil { - return nil, err - } - - pnds := make([]*ppb.PrincipalNetworkDomain, len(pndList)) - for i, pnd := range pndList { - pnds[i] = &ppb.PrincipalNetworkDomain{ - Id: pnd.ID().String(), - Name: pnd.GetName(), - Description: pnd.GetDescription(), - } - } - return &pb.GetPndListResponse{ - Timestamp: time.Now().UnixNano(), - Pnd: pnds, - }, nil -} - -// CreatePndList creates a pnd list. -func (s CoreServer) CreatePndList(ctx context.Context, request *pb.CreatePndListRequest) (*pb.CreatePndListResponse, error) { - labels := prometheus.Labels{"service": "core", "rpc": "set"} - start := metrics.StartHook(labels, grpcRequestsTotal) - defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - for _, r := range request.Pnd { - pnd := nucleus.NewPND(uuid.New(), r.Name, r.Description) - - if err := s.pndService.Add(pnd); err != nil { - return nil, handleRPCError(labels, err) - } - } - return &pb.CreatePndListResponse{ - Timestamp: time.Now().UnixNano(), - Status: pb.Status_STATUS_OK, - }, nil -} - -// DeletePnd deletes an existing pnd. -func (s CoreServer) DeletePnd(ctx context.Context, request *pb.DeletePndRequest) (*pb.DeletePndResponse, error) { - labels := prometheus.Labels{"service": "core", "rpc": "set"} - start := metrics.StartHook(labels, grpcRequestsTotal) - defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) - - pndID, err := uuid.Parse(request.Pid) - if err != nil { - return nil, handleRPCError(labels, err) - } - - pnd, err := s.pndService.Get(store.Query{ID: pndID}) - if err != nil { - return nil, handleRPCError(labels, err) - } - err = s.pndService.Delete(pnd) - if err != nil { - return &pb.DeletePndResponse{ - Timestamp: time.Now().UnixNano(), - Status: pb.Status_STATUS_ERROR, - }, err - } - - return &pb.DeletePndResponse{ - Timestamp: time.Now().UnixNano(), - Status: pb.Status_STATUS_OK, - }, nil -} diff --git a/controller/northbound/server/core_test.go b/controller/northbound/server/core_test.go deleted file mode 100644 index 2a0853ea266405dc8db20be2cf48d18692c47229..0000000000000000000000000000000000000000 --- a/controller/northbound/server/core_test.go +++ /dev/null @@ -1,229 +0,0 @@ -package server - -import ( - "context" - "reflect" - "testing" - "time" - - pb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core" - cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" - mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" - rpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-registry" - eventservice "code.fbi.h-da.de/danet/gosdn/controller/eventService" - "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkelement" - "code.fbi.h-da.de/danet/gosdn/controller/mocks" - "code.fbi.h-da.de/danet/gosdn/controller/nucleus" - "github.com/google/uuid" - "github.com/stretchr/testify/mock" - "google.golang.org/grpc" -) - -func getTestCoreServer(t *testing.T) *CoreServer { - var err error - pndUUID, err = uuid.Parse(pndID) - if err != nil { - t.Fatal(err) - } - - pendingChangeUUID, err = uuid.Parse(pendingChangeID) - if err != nil { - t.Fatal(err) - } - - committedChangeUUID, err = uuid.Parse(committedChangeID) - if err != nil { - t.Fatal(err) - } - - mneUUID, err = uuid.Parse(mneID) - if err != nil { - t.Fatal(err) - } - - mockNetworkElement = &nucleus.CommonNetworkElement{ - Plugin: &mocks.Plugin{}, - //Plugin: &openconfig.Device{ - // System: &openconfig.OpenconfigSystem_System{ - // Config: &openconfig.OpenconfigSystem_System_Config{ - // Hostname: &hostname, - // DomainName: &domainname, - // }, - // }, - //}, - UUID: mneUUID, - } - - mockNetworkElement.(*nucleus.CommonNetworkElement).SetTransport(&mocks.Transport{}) - mockNetworkElement.(*nucleus.CommonNetworkElement).SetName(hostname) - - mockChange := &mocks.Change{} - mockChange.On("Age").Return(time.Hour) - mockChange.On("State").Return(mnepb.ChangeState_CHANGE_STATE_INCONSISTENT) - - mockPnd = &mocks.NetworkDomain{} - mockPnd.On("ID").Return(pndUUID) - mockPnd.On("GetName").Return("test") - mockPnd.On("GetDescription").Return("test") - mockPnd.On("Devices").Return([]uuid.UUID{mneUUID}) - mockPnd.On("PendingChanges").Return([]uuid.UUID{pendingChangeUUID}) - mockPnd.On("CommittedChanges").Return([]uuid.UUID{committedChangeUUID}) - mockPnd.On("GetChange", mock.Anything).Return(mockChange, nil) - mockPnd.On("AddNetworkElement", mock.Anything, mock.Anything, mock.Anything).Return(nil) - mockPnd.On("GetNetworkElement", mock.Anything).Return(mockNetworkElement, nil) - mockPnd.On("Commit", mock.Anything).Return(nil) - mockPnd.On("Confirm", mock.Anything).Return(nil) - mockPnd.On("ChangeMNE", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(uuid.Nil, nil) - mockPnd.On("Request", mock.Anything, mock.Anything).Return(nil, nil) - mockPnd.On("GetAll").Return(mockPnd) - - pndStore := nucleus.NewMemoryPndStore() - - pndService := nucleus.NewPndService(pndStore) - if err := pndService.Add(mockPnd); err != nil { - t.Fatal(err) - } - - eventService := eventservice.NewMockEventService() - pluginStore := nucleus.NewMemoryPluginStore() - - regsitryClient := rpb.NewPluginRegistryServiceClient(&grpc.ClientConn{}) - - c := NewCoreServer(pndService, nucleus.NewPluginService(pluginStore, eventService, nucleus.NewPluginThroughReattachConfig, regsitryClient), func(u uuid.UUID, c chan networkelement.Details) {}, cpb.NewCsbiServiceClient(&grpc.ClientConn{})) - - return c -} - -func Test_core_Set(t *testing.T) { - type args struct { - ctx context.Context - request *pb.CreatePndListRequest - } - tests := []struct { - name string - args args - want *pb.CreatePndListResponse - wantErr bool - }{ - { - name: "default", - args: args{ - ctx: context.Background(), - request: &pb.CreatePndListRequest{ - Pnd: []*pb.PndCreateProperties{ - { - Name: "test", - Description: "test", - }, - }, - }, - }, - want: &pb.CreatePndListResponse{ - Status: pb.Status_STATUS_OK, - }, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - s := getTestCoreServer(t) - got, err := s.CreatePndList(tt.args.ctx, tt.args.request) - if (err != nil) != tt.wantErr { - t.Errorf("core.Set() error = %v, wantErr %v", err, tt.wantErr) - return - } - tt.want.Timestamp = got.Timestamp - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("core.Set() = %v, want %v", got, tt.want) - } - }) - } -} - -func Test_core_GetPnd(t *testing.T) { - type args struct { - ctx context.Context - request *pb.GetPndRequest - } - tests := []struct { - name string - args args - want []string - wantErr bool - }{ - { - name: "default", - args: args{ - ctx: context.Background(), - request: &pb.GetPndRequest{ - Pid: pndID, - }, - }, - want: []string{ - pndID, - "test", - "test", - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - s := getTestCoreServer(t) - resp, err := s.GetPnd(tt.args.ctx, tt.args.request) - if (err != nil) != tt.wantErr { - t.Errorf("core.GetPnd() error = %v, wantErr %v", err, tt.wantErr) - return - } - - if tt.name == "default" { - got := []string{ - resp.Pnd.Id, - resp.Pnd.Name, - resp.Pnd.Description, - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("core.GetPnd() = %v, want %v", got, tt.want) - } - } - }) - } -} - -func Test_core_GetPndList(t *testing.T) { - type args struct { - ctx context.Context - request *pb.GetPndListRequest - } - tests := []struct { - name string - args args - want []string - length int - wantErr bool - }{ - { - name: "getAll", - args: args{ - ctx: context.Background(), - request: &pb.GetPndListRequest{ - Timestamp: time.Now().UnixNano(), - }, - }, - length: 1, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - s := getTestCoreServer(t) - resp, err := s.GetPndList(tt.args.ctx, tt.args.request) - if (err != nil) != tt.wantErr { - t.Errorf("core.GetPndList() error = %v, wantErr %v", err, tt.wantErr) - return - } - length := len(resp.Pnd) - if tt.length != length { - t.Errorf("core.GetPndList() = %v, want %v", length, tt.length) - } - }) - } -} diff --git a/controller/northbound/server/nbi.go b/controller/northbound/server/nbi.go index 72bdc63014dfb7fea372377522d2d2656e422f85..e454af5236443120fd1e041b89a64e55db5941f6 100644 --- a/controller/northbound/server/nbi.go +++ b/controller/northbound/server/nbi.go @@ -27,7 +27,6 @@ import ( // gRPC services used provided. type NorthboundInterface struct { Pnd *PndServer - Core *CoreServer Csbi *CsbiServer Plugin *PluginInternalServer Auth *AuthServer @@ -60,8 +59,7 @@ func NewNBI( pndCallbackFn func(uuid.UUID, chan networkelement.Details), ) *NorthboundInterface { return &NorthboundInterface{ - Pnd: NewPndServer(pndService), - Core: NewCoreServer(pndService, pluginService, pndCallbackFn, csbiClient), + Pnd: NewPndServer(pndService, pluginService, pndCallbackFn, csbiClient), Csbi: NewCsbiServer(pnds), Plugin: NewPluginInternalServer(pluginRegistryClient, pluginService), Auth: NewAuthServer(&jwt, users), diff --git a/controller/northbound/server/pnd.go b/controller/northbound/server/pnd.go index 8c1cb3460a98e925bffa45218ea1570f16a9939e..8bbd8e5dc722d20f4d03e5ba4d2ad7269c47d24d 100644 --- a/controller/northbound/server/pnd.go +++ b/controller/northbound/server/pnd.go @@ -1,19 +1,136 @@ package server import ( + "context" + "time" + + cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain" + "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkelement" + "code.fbi.h-da.de/danet/gosdn/controller/interfaces/plugin" + "code.fbi.h-da.de/danet/gosdn/controller/metrics" + "code.fbi.h-da.de/danet/gosdn/controller/nucleus" + "code.fbi.h-da.de/danet/gosdn/controller/store" + "github.com/google/uuid" + "github.com/prometheus/client_golang/prometheus" ) -// PndServer implements a pnd server. +// PndServer represents a core server. type PndServer struct { ppb.UnimplementedPndServiceServer - pndService networkdomain.Service + pndService networkdomain.Service + pluginService plugin.Service + csbiClient cpb.CsbiServiceClient + pndCallbackFn func(uuid.UUID, chan networkelement.Details) } -// NewPndServer receives a pndStore and returns a new pndServer. -func NewPndServer(pndService networkdomain.Service) *PndServer { +// NewPndServer receives a pndStore and returns a new PndServer. +func NewPndServer(pndService networkdomain.Service, pluginService plugin.Service, pndCallbackFn func(uuid.UUID, chan networkelement.Details), csbiClient cpb.CsbiServiceClient) *PndServer { return &PndServer{ - pndService: pndService, + pndService: pndService, + pluginService: pluginService, + pndCallbackFn: pndCallbackFn, + csbiClient: csbiClient, + } +} + +// GetPnd returns a existing pnd. +func (s PndServer) GetPnd(ctx context.Context, request *ppb.GetPndRequest) (*ppb.GetPndResponse, error) { + labels := prometheus.Labels{"service": "core", "rpc": "get"} + start := metrics.StartHook(labels, grpcRequestsTotal) + defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) + + pndID, err := uuid.Parse(request.Pid) + if err != nil { + return nil, handleRPCError(labels, err) + } + + storedPnd, err := s.pndService.Get(store.Query{ID: pndID}) + if err != nil { + return nil, err + } + + pnd := &ppb.PrincipalNetworkDomain{ + Id: storedPnd.ID().String(), + Name: storedPnd.GetName(), + Description: storedPnd.GetDescription(), + } + + return &ppb.GetPndResponse{ + Timestamp: time.Now().UnixNano(), + Pnd: pnd, + }, nil +} + +// GetPndList returns all existing pnds. +func (s PndServer) GetPndList(ctx context.Context, request *ppb.GetPndListRequest) (*ppb.GetPndListResponse, error) { + labels := prometheus.Labels{"service": "core", "rpc": "get"} + start := metrics.StartHook(labels, grpcRequestsTotal) + defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) + + pndList, err := s.pndService.GetAll() + if err != nil { + return nil, err } + + pnds := make([]*ppb.PrincipalNetworkDomain, len(pndList)) + for i, pnd := range pndList { + pnds[i] = &ppb.PrincipalNetworkDomain{ + Id: pnd.ID().String(), + Name: pnd.GetName(), + Description: pnd.GetDescription(), + } + } + return &ppb.GetPndListResponse{ + Timestamp: time.Now().UnixNano(), + Pnd: pnds, + }, nil +} + +// CreatePndList creates a pnd list. +func (s PndServer) CreatePndList(ctx context.Context, request *ppb.CreatePndListRequest) (*ppb.CreatePndListResponse, error) { + labels := prometheus.Labels{"service": "core", "rpc": "set"} + start := metrics.StartHook(labels, grpcRequestsTotal) + defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) + for _, r := range request.Pnd { + pnd := nucleus.NewPND(uuid.New(), r.Name, r.Description) + + if err := s.pndService.Add(pnd); err != nil { + return nil, handleRPCError(labels, err) + } + } + return &ppb.CreatePndListResponse{ + Timestamp: time.Now().UnixNano(), + Status: ppb.Status_STATUS_OK, + }, nil +} + +// DeletePnd deletes an existing pnd. +func (s PndServer) DeletePnd(ctx context.Context, request *ppb.DeletePndRequest) (*ppb.DeletePndResponse, error) { + labels := prometheus.Labels{"service": "core", "rpc": "set"} + start := metrics.StartHook(labels, grpcRequestsTotal) + defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) + + pndID, err := uuid.Parse(request.Pid) + if err != nil { + return nil, handleRPCError(labels, err) + } + + pnd, err := s.pndService.Get(store.Query{ID: pndID}) + if err != nil { + return nil, handleRPCError(labels, err) + } + err = s.pndService.Delete(pnd) + if err != nil { + return &ppb.DeletePndResponse{ + Timestamp: time.Now().UnixNano(), + Status: ppb.Status_STATUS_ERROR, + }, err + } + + return &ppb.DeletePndResponse{ + Timestamp: time.Now().UnixNano(), + Status: ppb.Status_STATUS_OK, + }, nil } diff --git a/controller/northbound/server/pnd_test.go b/controller/northbound/server/pnd_test.go index ad745861c33f75121472357b70d6212594f3ebf3..cf6ddd0e26ce803d5ffca1672354d23ba2e0e398 100644 --- a/controller/northbound/server/pnd_test.go +++ b/controller/northbound/server/pnd_test.go @@ -1,20 +1,280 @@ package server -// import ( -// "context" -// "testing" -// "time" - -// mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" -// spb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound" -// eventservice "code.fbi.h-da.de/danet/gosdn/controller/eventService" -// "code.fbi.h-da.de/danet/gosdn/controller/mocks" -// "code.fbi.h-da.de/danet/gosdn/controller/nucleus" -// "code.fbi.h-da.de/danet/gosdn/models/generated/openconfig" -// "github.com/google/uuid" -// "github.com/openconfig/gnmi/proto/gnmi" -// "github.com/stretchr/testify/mock" -// ) +import ( + // "code.fbi.h-da.de/danet/gosdn/models/generated/openconfig" + // "github.com/openconfig/gnmi/proto/gnmi" + + "context" + "reflect" + "testing" + "time" + + cpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/csbi" + mnepb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/networkelement" + rpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/plugin-registry" + ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd" + eventservice "code.fbi.h-da.de/danet/gosdn/controller/eventService" + "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkelement" + "code.fbi.h-da.de/danet/gosdn/controller/mocks" + "code.fbi.h-da.de/danet/gosdn/controller/nucleus" + "github.com/google/uuid" + "github.com/stretchr/testify/mock" + "google.golang.org/grpc" +) + +func getTestPndServer(t *testing.T) *PndServer { + var err error + pndUUID, err = uuid.Parse(pndID) + if err != nil { + t.Fatal(err) + } + + pendingChangeUUID, err = uuid.Parse(pendingChangeID) + if err != nil { + t.Fatal(err) + } + + committedChangeUUID, err = uuid.Parse(committedChangeID) + if err != nil { + t.Fatal(err) + } + + mneUUID, err = uuid.Parse(mneID) + if err != nil { + t.Fatal(err) + } + + mockNetworkElement = &nucleus.CommonNetworkElement{ + Plugin: &mocks.Plugin{}, + //Plugin: &openconfig.Device{ + // System: &openconfig.OpenconfigSystem_System{ + // Config: &openconfig.OpenconfigSystem_System_Config{ + // Hostname: &hostname, + // DomainName: &domainname, + // }, + // }, + //}, + UUID: mneUUID, + } + + mockNetworkElement.(*nucleus.CommonNetworkElement).SetTransport(&mocks.Transport{}) + mockNetworkElement.(*nucleus.CommonNetworkElement).SetName(hostname) + + mockChange := &mocks.Change{} + mockChange.On("Age").Return(time.Hour) + mockChange.On("State").Return(mnepb.ChangeState_CHANGE_STATE_INCONSISTENT) + + mockPnd = &mocks.NetworkDomain{} + mockPnd.On("ID").Return(pndUUID) + mockPnd.On("GetName").Return("test") + mockPnd.On("GetDescription").Return("test") + mockPnd.On("Devices").Return([]uuid.UUID{mneUUID}) + mockPnd.On("PendingChanges").Return([]uuid.UUID{pendingChangeUUID}) + mockPnd.On("CommittedChanges").Return([]uuid.UUID{committedChangeUUID}) + mockPnd.On("GetChange", mock.Anything).Return(mockChange, nil) + mockPnd.On("AddNetworkElement", mock.Anything, mock.Anything, mock.Anything).Return(nil) + mockPnd.On("GetNetworkElement", mock.Anything).Return(mockNetworkElement, nil) + mockPnd.On("Commit", mock.Anything).Return(nil) + mockPnd.On("Confirm", mock.Anything).Return(nil) + mockPnd.On("ChangeMNE", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(uuid.Nil, nil) + mockPnd.On("Request", mock.Anything, mock.Anything).Return(nil, nil) + mockPnd.On("GetAll").Return(mockPnd) + + pndStore := nucleus.NewMemoryPndStore() + + pndService := nucleus.NewPndService(pndStore) + if err := pndService.Add(mockPnd); err != nil { + t.Fatal(err) + } + + eventService := eventservice.NewMockEventService() + pluginStore := nucleus.NewMemoryPluginStore() + + regsitryClient := rpb.NewPluginRegistryServiceClient(&grpc.ClientConn{}) + + c := NewPndServer(pndService, nucleus.NewPluginService(pluginStore, eventService, nucleus.NewPluginThroughReattachConfig, regsitryClient), func(u uuid.UUID, c chan networkelement.Details) {}, cpb.NewCsbiServiceClient(&grpc.ClientConn{})) + + return c +} + +func Test_Pnd_Set(t *testing.T) { + type args struct { + ctx context.Context + request *ppb.CreatePndListRequest + } + tests := []struct { + name string + args args + want *ppb.CreatePndListResponse + wantErr bool + }{ + { + name: "default", + args: args{ + ctx: context.Background(), + request: &ppb.CreatePndListRequest{ + Pnd: []*ppb.PndCreateProperties{ + { + Name: "test", + Description: "test", + }, + }, + }, + }, + want: &ppb.CreatePndListResponse{ + Status: ppb.Status_STATUS_OK, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := getTestPndServer(t) + got, err := s.CreatePndList(tt.args.ctx, tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("pnd.Set() error = %v, wantErr %v", err, tt.wantErr) + return + } + tt.want.Timestamp = got.Timestamp + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("pnd.Set() = %v, want %v", got, tt.want) + } + }) + } +} + +func Test_Pnd_GetPnd(t *testing.T) { + type args struct { + ctx context.Context + request *ppb.GetPndRequest + } + tests := []struct { + name string + args args + want []string + wantErr bool + }{ + { + name: "default", + args: args{ + ctx: context.Background(), + request: &ppb.GetPndRequest{ + Pid: pndID, + }, + }, + want: []string{ + pndID, + "test", + "test", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := getTestPndServer(t) + resp, err := s.GetPnd(tt.args.ctx, tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("pnd.GetPnd() error = %v, wantErr %v", err, tt.wantErr) + return + } + + if tt.name == "default" { + got := []string{ + resp.Pnd.Id, + resp.Pnd.Name, + resp.Pnd.Description, + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("pnd.GetPnd() = %v, want %v", got, tt.want) + } + } + }) + } +} + +func Test_Pnd_GetPndList(t *testing.T) { + type args struct { + ctx context.Context + request *ppb.GetPndListRequest + } + tests := []struct { + name string + args args + want []string + length int + wantErr bool + }{ + { + name: "getAll", + args: args{ + ctx: context.Background(), + request: &ppb.GetPndListRequest{ + Timestamp: time.Now().UnixNano(), + }, + }, + length: 1, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := getTestPndServer(t) + resp, err := s.GetPndList(tt.args.ctx, tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("pnd.GetPndList() error = %v, wantErr %v", err, tt.wantErr) + return + } + length := len(resp.Pnd) + if tt.length != length { + t.Errorf("pnd.GetPndList() = %v, want %v", length, tt.length) + } + }) + } +} + +func Test_Pnd_DeletePnd(t *testing.T) { + deleteUUID := uuid.NewString() + + type args struct { + ctx context.Context + request *ppb.DeletePndRequest + } + tests := []struct { + name string + args args + want ppb.Status + wantErr bool + }{ + { + name: "delete", + args: args{ + ctx: context.Background(), + request: &ppb.DeletePndRequest{ + Timestamp: time.Now().UnixNano(), + Pid: deleteUUID, + }, + }, + want: ppb.Status_STATUS_OK, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + s := getTestPndServer(t) + _ = s.pndService.Add(nucleus.NewPND(uuid.MustParse(deleteUUID), "toBeDeleted", "something something delete")) + + resp, err := s.DeletePnd(tt.args.ctx, tt.args.request) + if (err != nil) != tt.wantErr { + t.Errorf("pnd.GetPndList() error = %v, wantErr %v", err, tt.wantErr) + return + } + + pnds, _ := s.pndService.GetAll() + + if tt.want != resp.Status || len(pnds) != 1 { + t.Errorf("pnd.DeletePnd() = %v, %v, want %v, %v", resp.Status, len(pnds), tt.want, 1) + } + }) + } +} // func getTestPndServer(t *testing.T) *PndServer { // var err error