Skip to content
Snippets Groups Projects
Commit 5620fb48 authored by André Sterba's avatar André Sterba
Browse files

Add update and delete nbi calls to topology

parent b24d0719
No related branches found
No related tags found
5 merge requests!376Add additional example application hostname-checker,!349Northbound refactoring to implement NIB concept for devices,!343Add basic application framework and example application to show interaction between events an NBI,!339Create basic venv-manager for use with arista,!324Provide prototype implementation for topology handling
Pipeline #109288 passed
...@@ -119,7 +119,6 @@ func (x *Topology) GetLinks() []*Link { ...@@ -119,7 +119,6 @@ func (x *Topology) GetLinks() []*Link {
return nil return nil
} }
// AddLink
type AddLinkRequest struct { type AddLinkRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -230,7 +229,6 @@ func (x *AddLinkResponse) GetStatus() Status { ...@@ -230,7 +229,6 @@ func (x *AddLinkResponse) GetStatus() Status {
return Status_STATUS_UNSPECIFIED return Status_STATUS_UNSPECIFIED
} }
// GetTopology
type GetTopologyRequest struct { type GetTopologyRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -341,6 +339,226 @@ func (x *GetTopologyResponse) GetToplogy() *Topology { ...@@ -341,6 +339,226 @@ func (x *GetTopologyResponse) GetToplogy() *Topology {
return nil return nil
} }
type UpdateLinkRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Link *Link `protobuf:"bytes,2,opt,name=link,proto3" json:"link,omitempty"`
}
func (x *UpdateLinkRequest) Reset() {
*x = UpdateLinkRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_topology_topology_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateLinkRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateLinkRequest) ProtoMessage() {}
func (x *UpdateLinkRequest) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_topology_topology_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 UpdateLinkRequest.ProtoReflect.Descriptor instead.
func (*UpdateLinkRequest) Descriptor() ([]byte, []int) {
return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{5}
}
func (x *UpdateLinkRequest) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *UpdateLinkRequest) GetLink() *Link {
if x != nil {
return x.Link
}
return nil
}
type UpdateLinkResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=gosdn.topology.Status" json:"status,omitempty"`
}
func (x *UpdateLinkResponse) Reset() {
*x = UpdateLinkResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_topology_topology_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UpdateLinkResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UpdateLinkResponse) ProtoMessage() {}
func (x *UpdateLinkResponse) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_topology_topology_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 UpdateLinkResponse.ProtoReflect.Descriptor instead.
func (*UpdateLinkResponse) Descriptor() ([]byte, []int) {
return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{6}
}
func (x *UpdateLinkResponse) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *UpdateLinkResponse) GetStatus() Status {
if x != nil {
return x.Status
}
return Status_STATUS_UNSPECIFIED
}
type DeleteLinkRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
}
func (x *DeleteLinkRequest) Reset() {
*x = DeleteLinkRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_topology_topology_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteLinkRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteLinkRequest) ProtoMessage() {}
func (x *DeleteLinkRequest) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_topology_topology_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 DeleteLinkRequest.ProtoReflect.Descriptor instead.
func (*DeleteLinkRequest) Descriptor() ([]byte, []int) {
return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{7}
}
func (x *DeleteLinkRequest) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *DeleteLinkRequest) GetId() string {
if x != nil {
return x.Id
}
return ""
}
type DeleteLinkResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=gosdn.topology.Status" json:"status,omitempty"`
}
func (x *DeleteLinkResponse) Reset() {
*x = DeleteLinkResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_gosdn_topology_topology_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeleteLinkResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeleteLinkResponse) ProtoMessage() {}
func (x *DeleteLinkResponse) ProtoReflect() protoreflect.Message {
mi := &file_gosdn_topology_topology_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 DeleteLinkResponse.ProtoReflect.Descriptor instead.
func (*DeleteLinkResponse) Descriptor() ([]byte, []int) {
return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{8}
}
func (x *DeleteLinkResponse) GetTimestamp() int64 {
if x != nil {
return x.Timestamp
}
return 0
}
func (x *DeleteLinkResponse) GetStatus() Status {
if x != nil {
return x.Status
}
return Status_STATUS_UNSPECIFIED
}
var File_gosdn_topology_topology_proto protoreflect.FileDescriptor var File_gosdn_topology_topology_proto protoreflect.FileDescriptor
var file_gosdn_topology_topology_proto_rawDesc = []byte{ var file_gosdn_topology_topology_proto_rawDesc = []byte{
...@@ -383,30 +601,66 @@ var file_gosdn_topology_topology_proto_rawDesc = []byte{ ...@@ -383,30 +601,66 @@ var file_gosdn_topology_topology_proto_rawDesc = []byte{
0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x74, 0x6f, 0x70, 0x6c, 0x6f, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x74, 0x6f, 0x70, 0x6c, 0x6f,
0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x67, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e,
0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f,
0x67, 0x79, 0x52, 0x07, 0x74, 0x6f, 0x70, 0x6c, 0x6f, 0x67, 0x79, 0x2a, 0x41, 0x0a, 0x06, 0x53, 0x67, 0x79, 0x52, 0x07, 0x74, 0x6f, 0x70, 0x6c, 0x6f, 0x67, 0x79, 0x22, 0x5b, 0x0a, 0x11, 0x55,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20,
0x09, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x28,
0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, 0xe5, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67,
0x01, 0x0a, 0x0f, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x4c, 0x69,
0x63, 0x65, 0x12, 0x67, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x1e, 0x2e, 0x6e, 0x6b, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x62, 0x0a, 0x12, 0x55, 0x70, 0x64, 0x61,
0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x41, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c,
0x64, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28,
0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x41, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2e, 0x0a, 0x06,
0x64, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x67,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x53, 0x74,
0x6c, 0x6f, 0x67, 0x79, 0x2f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x69, 0x0a, 0x0b, 0x47, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x41, 0x0a, 0x11,
0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x12, 0x22, 0x2e, 0x67, 0x6f, 0x73, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01,
0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12,
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22,
0x62, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 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, 0x2e, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f,
0x6c, 0x6f, 0x67, 0x79, 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, 0xc6, 0x03, 0x0a, 0x0f, 0x54, 0x6f, 0x70, 0x6f, 0x6c,
0x6f, 0x67, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x67, 0x0a, 0x07, 0x41, 0x64,
0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x1e, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f,
0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f,
0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01,
0x2a, 0x22, 0x10, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2f, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x12, 0x69, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f,
0x67, 0x79, 0x12, 0x22, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c,
0x6f, 0x67, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74,
0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c,
0x6f, 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4,
0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x12, 0x70,
0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x21, 0x2e, 0x67,
0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x55, 0x70,
0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x22, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79,
0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x01, 0x2a, 0x22, 0x10,
0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65,
0x12, 0x6d, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x21,
0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e,
0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x6e, 0x73, 0x65, 0x22, 0x11, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0b, 0x12, 0x09, 0x2f, 0x74, 0x6f, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f,
0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x42, 0x34, 0x5a, 0x32, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x67, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x65, 0x73,
0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x64, 0x61, 0x6e, 0x65, 0x74, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x2a, 0x10, 0x2f,
0x2f, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x6f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42,
0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x62, 0x06, 0x70, 0x72, 0x34, 0x5a, 0x32, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61,
0x6f, 0x74, 0x6f, 0x33, 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, 0x74, 0x6f, 0x70,
0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
...@@ -422,7 +676,7 @@ func file_gosdn_topology_topology_proto_rawDescGZIP() []byte { ...@@ -422,7 +676,7 @@ func file_gosdn_topology_topology_proto_rawDescGZIP() []byte {
} }
var file_gosdn_topology_topology_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_gosdn_topology_topology_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_gosdn_topology_topology_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_gosdn_topology_topology_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_gosdn_topology_topology_proto_goTypes = []interface{}{ var file_gosdn_topology_topology_proto_goTypes = []interface{}{
(Status)(0), // 0: gosdn.topology.Status (Status)(0), // 0: gosdn.topology.Status
(*Topology)(nil), // 1: gosdn.topology.Topology (*Topology)(nil), // 1: gosdn.topology.Topology
...@@ -430,23 +684,34 @@ var file_gosdn_topology_topology_proto_goTypes = []interface{}{ ...@@ -430,23 +684,34 @@ var file_gosdn_topology_topology_proto_goTypes = []interface{}{
(*AddLinkResponse)(nil), // 3: gosdn.topology.AddLinkResponse (*AddLinkResponse)(nil), // 3: gosdn.topology.AddLinkResponse
(*GetTopologyRequest)(nil), // 4: gosdn.topology.GetTopologyRequest (*GetTopologyRequest)(nil), // 4: gosdn.topology.GetTopologyRequest
(*GetTopologyResponse)(nil), // 5: gosdn.topology.GetTopologyResponse (*GetTopologyResponse)(nil), // 5: gosdn.topology.GetTopologyResponse
(*Link)(nil), // 6: gosdn.topology.Link (*UpdateLinkRequest)(nil), // 6: gosdn.topology.UpdateLinkRequest
(*UpdateLinkResponse)(nil), // 7: gosdn.topology.UpdateLinkResponse
(*DeleteLinkRequest)(nil), // 8: gosdn.topology.DeleteLinkRequest
(*DeleteLinkResponse)(nil), // 9: gosdn.topology.DeleteLinkResponse
(*Link)(nil), // 10: gosdn.topology.Link
} }
var file_gosdn_topology_topology_proto_depIdxs = []int32{ var file_gosdn_topology_topology_proto_depIdxs = []int32{
6, // 0: gosdn.topology.Topology.links:type_name -> gosdn.topology.Link 10, // 0: gosdn.topology.Topology.links:type_name -> gosdn.topology.Link
6, // 1: gosdn.topology.AddLinkRequest.link:type_name -> gosdn.topology.Link 10, // 1: gosdn.topology.AddLinkRequest.link:type_name -> gosdn.topology.Link
0, // 2: gosdn.topology.AddLinkResponse.status:type_name -> gosdn.topology.Status 0, // 2: gosdn.topology.AddLinkResponse.status:type_name -> gosdn.topology.Status
0, // 3: gosdn.topology.GetTopologyResponse.status:type_name -> gosdn.topology.Status 0, // 3: gosdn.topology.GetTopologyResponse.status:type_name -> gosdn.topology.Status
1, // 4: gosdn.topology.GetTopologyResponse.toplogy:type_name -> gosdn.topology.Topology 1, // 4: gosdn.topology.GetTopologyResponse.toplogy:type_name -> gosdn.topology.Topology
2, // 5: gosdn.topology.TopologyService.AddLink:input_type -> gosdn.topology.AddLinkRequest 10, // 5: gosdn.topology.UpdateLinkRequest.link:type_name -> gosdn.topology.Link
4, // 6: gosdn.topology.TopologyService.GetTopology:input_type -> gosdn.topology.GetTopologyRequest 0, // 6: gosdn.topology.UpdateLinkResponse.status:type_name -> gosdn.topology.Status
3, // 7: gosdn.topology.TopologyService.AddLink:output_type -> gosdn.topology.AddLinkResponse 0, // 7: gosdn.topology.DeleteLinkResponse.status:type_name -> gosdn.topology.Status
5, // 8: gosdn.topology.TopologyService.GetTopology:output_type -> gosdn.topology.GetTopologyResponse 2, // 8: gosdn.topology.TopologyService.AddLink:input_type -> gosdn.topology.AddLinkRequest
7, // [7:9] is the sub-list for method output_type 4, // 9: gosdn.topology.TopologyService.GetTopology:input_type -> gosdn.topology.GetTopologyRequest
5, // [5:7] is the sub-list for method input_type 6, // 10: gosdn.topology.TopologyService.UpdateLink:input_type -> gosdn.topology.UpdateLinkRequest
5, // [5:5] is the sub-list for extension type_name 8, // 11: gosdn.topology.TopologyService.DeleteLink:input_type -> gosdn.topology.DeleteLinkRequest
5, // [5:5] is the sub-list for extension extendee 3, // 12: gosdn.topology.TopologyService.AddLink:output_type -> gosdn.topology.AddLinkResponse
0, // [0:5] is the sub-list for field type_name 5, // 13: gosdn.topology.TopologyService.GetTopology:output_type -> gosdn.topology.GetTopologyResponse
7, // 14: gosdn.topology.TopologyService.UpdateLink:output_type -> gosdn.topology.UpdateLinkResponse
9, // 15: gosdn.topology.TopologyService.DeleteLink:output_type -> gosdn.topology.DeleteLinkResponse
12, // [12:16] is the sub-list for method output_type
8, // [8:12] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
8, // [8:8] is the sub-list for extension extendee
0, // [0:8] is the sub-list for field type_name
} }
func init() { file_gosdn_topology_topology_proto_init() } func init() { file_gosdn_topology_topology_proto_init() }
...@@ -516,6 +781,54 @@ func file_gosdn_topology_topology_proto_init() { ...@@ -516,6 +781,54 @@ func file_gosdn_topology_topology_proto_init() {
return nil return nil
} }
} }
file_gosdn_topology_topology_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateLinkRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_gosdn_topology_topology_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UpdateLinkResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_gosdn_topology_topology_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteLinkRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_gosdn_topology_topology_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteLinkResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
} }
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
...@@ -523,7 +836,7 @@ func file_gosdn_topology_topology_proto_init() { ...@@ -523,7 +836,7 @@ func file_gosdn_topology_topology_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_gosdn_topology_topology_proto_rawDesc, RawDescriptor: file_gosdn_topology_topology_proto_rawDesc,
NumEnums: 1, NumEnums: 1,
NumMessages: 5, NumMessages: 9,
NumExtensions: 0, NumExtensions: 0,
NumServices: 1, NumServices: 1,
}, },
......
...@@ -101,6 +101,76 @@ func local_request_TopologyService_GetTopology_0(ctx context.Context, marshaler ...@@ -101,6 +101,76 @@ func local_request_TopologyService_GetTopology_0(ctx context.Context, marshaler
} }
func request_TopologyService_UpdateLink_0(ctx context.Context, marshaler runtime.Marshaler, client TopologyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateLinkRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.UpdateLink(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_TopologyService_UpdateLink_0(ctx context.Context, marshaler runtime.Marshaler, server TopologyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq UpdateLinkRequest
var metadata runtime.ServerMetadata
newReader, berr := utilities.IOReaderFactory(req.Body)
if berr != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
}
if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.UpdateLink(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_TopologyService_DeleteLink_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_TopologyService_DeleteLink_0(ctx context.Context, marshaler runtime.Marshaler, client TopologyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteLinkRequest
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_TopologyService_DeleteLink_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.DeleteLink(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_TopologyService_DeleteLink_0(ctx context.Context, marshaler runtime.Marshaler, server TopologyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteLinkRequest
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_TopologyService_DeleteLink_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.DeleteLink(ctx, &protoReq)
return msg, metadata, err
}
// RegisterTopologyServiceHandlerServer registers the http handlers for service TopologyService to "mux". // RegisterTopologyServiceHandlerServer registers the http handlers for service TopologyService to "mux".
// UnaryRPC :call TopologyServiceServer directly. // UnaryRPC :call TopologyServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
...@@ -153,6 +223,52 @@ func RegisterTopologyServiceHandlerServer(ctx context.Context, mux *runtime.Serv ...@@ -153,6 +223,52 @@ func RegisterTopologyServiceHandlerServer(ctx context.Context, mux *runtime.Serv
}) })
mux.Handle("POST", pattern_TopologyService_UpdateLink_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.topology.TopologyService/UpdateLink", runtime.WithHTTPPathPattern("/topology/update"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_TopologyService_UpdateLink_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 {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_TopologyService_UpdateLink_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("DELETE", pattern_TopologyService_DeleteLink_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.topology.TopologyService/DeleteLink", runtime.WithHTTPPathPattern("/topology/delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_TopologyService_DeleteLink_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 {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_TopologyService_DeleteLink_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
...@@ -234,6 +350,46 @@ func RegisterTopologyServiceHandlerClient(ctx context.Context, mux *runtime.Serv ...@@ -234,6 +350,46 @@ func RegisterTopologyServiceHandlerClient(ctx context.Context, mux *runtime.Serv
}) })
mux.Handle("POST", pattern_TopologyService_UpdateLink_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.topology.TopologyService/UpdateLink", runtime.WithHTTPPathPattern("/topology/update"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_TopologyService_UpdateLink_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_TopologyService_UpdateLink_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("DELETE", pattern_TopologyService_DeleteLink_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.topology.TopologyService/DeleteLink", runtime.WithHTTPPathPattern("/topology/delete"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_TopologyService_DeleteLink_0(rctx, inboundMarshaler, client, req, pathParams)
ctx = runtime.NewServerMetadataContext(ctx, md)
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
forward_TopologyService_DeleteLink_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
return nil return nil
} }
...@@ -241,10 +397,18 @@ var ( ...@@ -241,10 +397,18 @@ var (
pattern_TopologyService_AddLink_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"topology", "create"}, "")) pattern_TopologyService_AddLink_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"topology", "create"}, ""))
pattern_TopologyService_GetTopology_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"topology"}, "")) pattern_TopologyService_GetTopology_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0}, []string{"topology"}, ""))
pattern_TopologyService_UpdateLink_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"topology", "update"}, ""))
pattern_TopologyService_DeleteLink_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"topology", "delete"}, ""))
) )
var ( var (
forward_TopologyService_AddLink_0 = runtime.ForwardResponseMessage forward_TopologyService_AddLink_0 = runtime.ForwardResponseMessage
forward_TopologyService_GetTopology_0 = runtime.ForwardResponseMessage forward_TopologyService_GetTopology_0 = runtime.ForwardResponseMessage
forward_TopologyService_UpdateLink_0 = runtime.ForwardResponseMessage
forward_TopologyService_DeleteLink_0 = runtime.ForwardResponseMessage
) )
...@@ -18,12 +18,10 @@ const _ = grpc.SupportPackageIsVersion7 ...@@ -18,12 +18,10 @@ 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. // 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 TopologyServiceClient interface { type TopologyServiceClient interface {
// Creates roles, requires login beforehand.
// Requires highest permissions.
AddLink(ctx context.Context, in *AddLinkRequest, opts ...grpc.CallOption) (*AddLinkResponse, error) AddLink(ctx context.Context, in *AddLinkRequest, opts ...grpc.CallOption) (*AddLinkResponse, error)
// Requests all roles with their permissions, requires login beforehand.
// Requires highest permissions.
GetTopology(ctx context.Context, in *GetTopologyRequest, opts ...grpc.CallOption) (*GetTopologyResponse, error) GetTopology(ctx context.Context, in *GetTopologyRequest, opts ...grpc.CallOption) (*GetTopologyResponse, error)
UpdateLink(ctx context.Context, in *UpdateLinkRequest, opts ...grpc.CallOption) (*UpdateLinkResponse, error)
DeleteLink(ctx context.Context, in *DeleteLinkRequest, opts ...grpc.CallOption) (*DeleteLinkResponse, error)
} }
type topologyServiceClient struct { type topologyServiceClient struct {
...@@ -52,16 +50,32 @@ func (c *topologyServiceClient) GetTopology(ctx context.Context, in *GetTopology ...@@ -52,16 +50,32 @@ func (c *topologyServiceClient) GetTopology(ctx context.Context, in *GetTopology
return out, nil return out, nil
} }
func (c *topologyServiceClient) UpdateLink(ctx context.Context, in *UpdateLinkRequest, opts ...grpc.CallOption) (*UpdateLinkResponse, error) {
out := new(UpdateLinkResponse)
err := c.cc.Invoke(ctx, "/gosdn.topology.TopologyService/UpdateLink", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *topologyServiceClient) DeleteLink(ctx context.Context, in *DeleteLinkRequest, opts ...grpc.CallOption) (*DeleteLinkResponse, error) {
out := new(DeleteLinkResponse)
err := c.cc.Invoke(ctx, "/gosdn.topology.TopologyService/DeleteLink", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// TopologyServiceServer is the server API for TopologyService service. // TopologyServiceServer is the server API for TopologyService service.
// All implementations must embed UnimplementedTopologyServiceServer // All implementations must embed UnimplementedTopologyServiceServer
// for forward compatibility // for forward compatibility
type TopologyServiceServer interface { type TopologyServiceServer interface {
// Creates roles, requires login beforehand.
// Requires highest permissions.
AddLink(context.Context, *AddLinkRequest) (*AddLinkResponse, error) AddLink(context.Context, *AddLinkRequest) (*AddLinkResponse, error)
// Requests all roles with their permissions, requires login beforehand.
// Requires highest permissions.
GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error)
UpdateLink(context.Context, *UpdateLinkRequest) (*UpdateLinkResponse, error)
DeleteLink(context.Context, *DeleteLinkRequest) (*DeleteLinkResponse, error)
mustEmbedUnimplementedTopologyServiceServer() mustEmbedUnimplementedTopologyServiceServer()
} }
...@@ -75,6 +89,12 @@ func (UnimplementedTopologyServiceServer) AddLink(context.Context, *AddLinkReque ...@@ -75,6 +89,12 @@ func (UnimplementedTopologyServiceServer) AddLink(context.Context, *AddLinkReque
func (UnimplementedTopologyServiceServer) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error) { func (UnimplementedTopologyServiceServer) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTopology not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetTopology not implemented")
} }
func (UnimplementedTopologyServiceServer) UpdateLink(context.Context, *UpdateLinkRequest) (*UpdateLinkResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateLink not implemented")
}
func (UnimplementedTopologyServiceServer) DeleteLink(context.Context, *DeleteLinkRequest) (*DeleteLinkResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteLink not implemented")
}
func (UnimplementedTopologyServiceServer) mustEmbedUnimplementedTopologyServiceServer() {} func (UnimplementedTopologyServiceServer) mustEmbedUnimplementedTopologyServiceServer() {}
// UnsafeTopologyServiceServer may be embedded to opt out of forward compatibility for this service. // UnsafeTopologyServiceServer may be embedded to opt out of forward compatibility for this service.
...@@ -124,6 +144,42 @@ func _TopologyService_GetTopology_Handler(srv interface{}, ctx context.Context, ...@@ -124,6 +144,42 @@ func _TopologyService_GetTopology_Handler(srv interface{}, ctx context.Context,
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TopologyService_UpdateLink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateLinkRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TopologyServiceServer).UpdateLink(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gosdn.topology.TopologyService/UpdateLink",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TopologyServiceServer).UpdateLink(ctx, req.(*UpdateLinkRequest))
}
return interceptor(ctx, in, info, handler)
}
func _TopologyService_DeleteLink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteLinkRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TopologyServiceServer).DeleteLink(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gosdn.topology.TopologyService/DeleteLink",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TopologyServiceServer).DeleteLink(ctx, req.(*DeleteLinkRequest))
}
return interceptor(ctx, in, info, handler)
}
// TopologyService_ServiceDesc is the grpc.ServiceDesc for TopologyService service. // TopologyService_ServiceDesc is the grpc.ServiceDesc for TopologyService service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
...@@ -139,6 +195,14 @@ var TopologyService_ServiceDesc = grpc.ServiceDesc{ ...@@ -139,6 +195,14 @@ var TopologyService_ServiceDesc = grpc.ServiceDesc{
MethodName: "GetTopology", MethodName: "GetTopology",
Handler: _TopologyService_GetTopology_Handler, Handler: _TopologyService_GetTopology_Handler,
}, },
{
MethodName: "UpdateLink",
Handler: _TopologyService_UpdateLink_Handler,
},
{
MethodName: "DeleteLink",
Handler: _TopologyService_DeleteLink_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "gosdn/topology/topology.proto", Metadata: "gosdn/topology/topology.proto",
......
...@@ -1042,7 +1042,6 @@ ...@@ -1042,7 +1042,6 @@
}, },
"/topology": { "/topology": {
"get": { "get": {
"summary": "Requests all roles with their permissions, requires login beforehand.\nRequires highest permissions.",
"operationId": "TopologyService_GetTopology", "operationId": "TopologyService_GetTopology",
"responses": { "responses": {
"200": { "200": {
...@@ -1074,7 +1073,6 @@ ...@@ -1074,7 +1073,6 @@
}, },
"/topology/create": { "/topology/create": {
"post": { "post": {
"summary": "Creates roles, requires login beforehand.\nRequires highest permissions.",
"operationId": "TopologyService_AddLink", "operationId": "TopologyService_AddLink",
"responses": { "responses": {
"200": { "200": {
...@@ -1105,6 +1103,75 @@ ...@@ -1105,6 +1103,75 @@
] ]
} }
}, },
"/topology/delete": {
"delete": {
"operationId": "TopologyService_DeleteLink",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/topologyDeleteLinkResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "timestamp",
"in": "query",
"required": false,
"type": "string",
"format": "int64"
},
{
"name": "id",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"TopologyService"
]
}
},
"/topology/update": {
"post": {
"operationId": "TopologyService_UpdateLink",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/topologyUpdateLinkResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/googlerpcStatus"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/topologyUpdateLinkRequest"
}
}
],
"tags": [
"TopologyService"
]
}
},
"/users": { "/users": {
"get": { "get": {
"summary": "Requests information about available users, requires login beforehand.\nRequires highest possible permissions.", "summary": "Requests information about available users, requires login beforehand.\nRequires highest possible permissions.",
...@@ -3281,8 +3348,7 @@ ...@@ -3281,8 +3348,7 @@
"link": { "link": {
"$ref": "#/definitions/topologyLink" "$ref": "#/definitions/topologyLink"
} }
}, }
"title": "AddLink"
}, },
"topologyAddLinkResponse": { "topologyAddLinkResponse": {
"type": "object", "type": "object",
...@@ -3296,6 +3362,18 @@ ...@@ -3296,6 +3362,18 @@
} }
} }
}, },
"topologyDeleteLinkResponse": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "int64"
},
"status": {
"$ref": "#/definitions/gosdntopologyStatus"
}
}
},
"topologyGetTopologyResponse": { "topologyGetTopologyResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
...@@ -3364,6 +3442,30 @@ ...@@ -3364,6 +3442,30 @@
} }
} }
}, },
"topologyUpdateLinkRequest": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "int64"
},
"link": {
"$ref": "#/definitions/topologyLink"
}
}
},
"topologyUpdateLinkResponse": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "int64"
},
"status": {
"$ref": "#/definitions/gosdntopologyStatus"
}
}
},
"transportGnmiTransportOption": { "transportGnmiTransportOption": {
"type": "object", "type": "object",
"properties": { "properties": {
......
...@@ -4,7 +4,7 @@ deps: ...@@ -4,7 +4,7 @@ deps:
- remote: buf.build - remote: buf.build
owner: googleapis owner: googleapis
repository: googleapis repository: googleapis
commit: 868034942d3c4d24b722f6a834dd7bb2 commit: 18d0a6e7027c4a75811cd43a894346fe
- remote: buf.build - remote: buf.build
owner: grpc-ecosystem owner: grpc-ecosystem
repository: grpc-gateway repository: grpc-gateway
......
...@@ -12,8 +12,6 @@ import "gosdn/topology/link.proto"; ...@@ -12,8 +12,6 @@ import "gosdn/topology/link.proto";
option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology"; option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology";
service TopologyService { service TopologyService {
// Creates roles, requires login beforehand.
// Requires highest permissions.
rpc AddLink(AddLinkRequest) returns (AddLinkResponse) { rpc AddLink(AddLinkRequest) returns (AddLinkResponse) {
option (google.api.http) = { option (google.api.http) = {
post: "/topology/create" post: "/topology/create"
...@@ -21,38 +19,24 @@ service TopologyService { ...@@ -21,38 +19,24 @@ service TopologyService {
}; };
} }
// Requests one role with its permissions, requires login beforehand.
// Requires highest permissions.
// rpc GetRole(GetRoleRequest) returns (GetRoleResponse) {
// option (google.api.http) = {
// get: "/roles/get"
// };
// }
// Requests all roles with their permissions, requires login beforehand.
// Requires highest permissions.
rpc GetTopology(GetTopologyRequest) returns (GetTopologyResponse) { rpc GetTopology(GetTopologyRequest) returns (GetTopologyResponse) {
option (google.api.http) = { option (google.api.http) = {
get: "/topology" get: "/topology"
}; };
} }
// // Updates roles by setting the provided permissions, requires login beforehand. rpc UpdateLink(UpdateLinkRequest) returns (UpdateLinkResponse) {
// // Requires highest permissions. option (google.api.http) = {
// rpc UpdateLink(UpdateRolesRequest) returns (UpdateRolesResponse) { post: "/topology/update"
// option (google.api.http) = { body: "*"
// post: "/topology/update" };
// body: "*" }
// };
// } rpc DeleteLink(DeleteLinkRequest) returns (DeleteLinkResponse) {
option (google.api.http) = {
// // Deletes roles with their permissions, requires login beforehand. delete: "/topology/delete"
// // Requires highest permissions. };
// rpc DeleteLink(DeleteRolesRequest) returns (DeleteRolesResponse) { }
// option (google.api.http) = {
// delete: "/topology/delete"
// };
// }
} }
enum Status { enum Status {
...@@ -65,7 +49,6 @@ message Topology { ...@@ -65,7 +49,6 @@ message Topology {
repeated Link links = 1; repeated Link links = 1;
} }
// AddLink
message AddLinkRequest { message AddLinkRequest {
int64 timestamp = 1; int64 timestamp = 1;
Link link = 2; Link link = 2;
...@@ -76,19 +59,6 @@ message AddLinkResponse { ...@@ -76,19 +59,6 @@ message AddLinkResponse {
Status status = 2; Status status = 2;
} }
// // GetRole
// message GetRoleRequest {
// int64 timestamp = 1;
// string role_name = 2;
// }
// message GetRoleResponse {
// int64 timestamp = 1;
// Status status = 2;
// Role role = 3;
// }
// GetTopology
message GetTopologyRequest { message GetTopologyRequest {
int64 timestamp = 1; int64 timestamp = 1;
} }
...@@ -99,36 +69,23 @@ message GetTopologyResponse { ...@@ -99,36 +69,23 @@ message GetTopologyResponse {
Topology toplogy = 3; Topology toplogy = 3;
} }
// // UpdateRoles message UpdateLinkRequest {
// message UpdateRolesRequest { int64 timestamp = 1;
// int64 timestamp = 1; Link link = 2;
// repeated Role roles = 2; }
// }
message UpdateLinkResponse {
// message UpdateRolesResponse { int64 timestamp = 1;
// int64 timestamp = 1; Status status = 2;
// Status status = 2; }
// }
message DeleteLinkRequest {
// // DeletePermissionsForRole int64 timestamp = 1;
// message DeletePermissionsForRoleRequest { string id = 2;
// int64 timestamp = 1; }
// string role_name = 2;
// repeated string permissions_to_delete = 3; message DeleteLinkResponse {
// } int64 timestamp = 1;
Status status = 2;
// message DeletePermissionsForRoleResponse { }
// int64 timestamp = 1;
// Status status = 2;
// }
// // DeleteRoles
// message DeleteRolesRequest {
// int64 timestamp = 1;
// repeated string role_name = 2;
// }
// message DeleteRolesResponse {
// int64 timestamp = 1;
// Status status = 2;
// }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment