diff --git a/api/go/gosdn/topology/link.pb.go b/api/go/gosdn/topology/link.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..a6ccea7d9d76de9798d2f27d4c5548b430d0b33b --- /dev/null +++ b/api/go/gosdn/topology/link.pb.go @@ -0,0 +1,221 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: gosdn/topology/link.proto + +package topology + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/descriptorpb" + 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 Link struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + SourceNode *Node `protobuf:"bytes,3,opt,name=sourceNode,proto3" json:"sourceNode,omitempty"` + TargetNode *Node `protobuf:"bytes,4,opt,name=targetNode,proto3" json:"targetNode,omitempty"` + SourcePort *Port `protobuf:"bytes,5,opt,name=sourcePort,proto3" json:"sourcePort,omitempty"` + TargetPort *Port `protobuf:"bytes,6,opt,name=targetPort,proto3" json:"targetPort,omitempty"` +} + +func (x *Link) Reset() { + *x = Link{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_link_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Link) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Link) ProtoMessage() {} + +func (x *Link) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_link_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 Link.ProtoReflect.Descriptor instead. +func (*Link) Descriptor() ([]byte, []int) { + return file_gosdn_topology_link_proto_rawDescGZIP(), []int{0} +} + +func (x *Link) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Link) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Link) GetSourceNode() *Node { + if x != nil { + return x.SourceNode + } + return nil +} + +func (x *Link) GetTargetNode() *Node { + if x != nil { + return x.TargetNode + } + return nil +} + +func (x *Link) GetSourcePort() *Port { + if x != nil { + return x.SourcePort + } + return nil +} + +func (x *Link) GetTargetPort() *Port { + if x != nil { + return x.TargetPort + } + return nil +} + +var File_gosdn_topology_link_proto protoreflect.FileDescriptor + +var file_gosdn_topology_link_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, + 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 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, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, + 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2f, 0x6e, 0x6f, 0x64, 0x65, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, + 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x82, 0x02, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x34, + 0x0a, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, + 0x6f, 0x67, 0x79, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x6f, + 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, + 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x0a, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, + 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, + 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, + 0x12, 0x34, 0x0a, 0x0a, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, + 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x50, 0x6f, 0x72, 0x74, 0x52, 0x0a, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x42, 0x34, 0x5a, 0x32, 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, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_gosdn_topology_link_proto_rawDescOnce sync.Once + file_gosdn_topology_link_proto_rawDescData = file_gosdn_topology_link_proto_rawDesc +) + +func file_gosdn_topology_link_proto_rawDescGZIP() []byte { + file_gosdn_topology_link_proto_rawDescOnce.Do(func() { + file_gosdn_topology_link_proto_rawDescData = protoimpl.X.CompressGZIP(file_gosdn_topology_link_proto_rawDescData) + }) + return file_gosdn_topology_link_proto_rawDescData +} + +var file_gosdn_topology_link_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_gosdn_topology_link_proto_goTypes = []interface{}{ + (*Link)(nil), // 0: gosdn.topology.Link + (*Node)(nil), // 1: gosdn.topology.Node + (*Port)(nil), // 2: gosdn.topology.Port +} +var file_gosdn_topology_link_proto_depIdxs = []int32{ + 1, // 0: gosdn.topology.Link.sourceNode:type_name -> gosdn.topology.Node + 1, // 1: gosdn.topology.Link.targetNode:type_name -> gosdn.topology.Node + 2, // 2: gosdn.topology.Link.sourcePort:type_name -> gosdn.topology.Port + 2, // 3: gosdn.topology.Link.targetPort:type_name -> gosdn.topology.Port + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_gosdn_topology_link_proto_init() } +func file_gosdn_topology_link_proto_init() { + if File_gosdn_topology_link_proto != nil { + return + } + file_gosdn_topology_node_proto_init() + file_gosdn_topology_port_proto_init() + if !protoimpl.UnsafeEnabled { + file_gosdn_topology_link_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Link); 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_topology_link_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_gosdn_topology_link_proto_goTypes, + DependencyIndexes: file_gosdn_topology_link_proto_depIdxs, + MessageInfos: file_gosdn_topology_link_proto_msgTypes, + }.Build() + File_gosdn_topology_link_proto = out.File + file_gosdn_topology_link_proto_rawDesc = nil + file_gosdn_topology_link_proto_goTypes = nil + file_gosdn_topology_link_proto_depIdxs = nil +} diff --git a/api/go/gosdn/topology/node.pb.go b/api/go/gosdn/topology/node.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..0c9330271dd3e7d66d7f8454d254091c32961090 --- /dev/null +++ b/api/go/gosdn/topology/node.pb.go @@ -0,0 +1,164 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: gosdn/topology/node.proto + +package topology + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/descriptorpb" + 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 Node struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Node) Reset() { + *x = Node{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_node_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Node) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Node) ProtoMessage() {} + +func (x *Node) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_node_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 Node.ProtoReflect.Descriptor instead. +func (*Node) Descriptor() ([]byte, []int) { + return file_gosdn_topology_node_proto_rawDescGZIP(), []int{0} +} + +func (x *Node) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Node) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +var File_gosdn_topology_node_proto protoreflect.FileDescriptor + +var file_gosdn_topology_node_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, + 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 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, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, + 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2a, 0x0a, 0x04, 0x4e, + 0x6f, 0x64, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x34, 0x5a, 0x32, 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, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_gosdn_topology_node_proto_rawDescOnce sync.Once + file_gosdn_topology_node_proto_rawDescData = file_gosdn_topology_node_proto_rawDesc +) + +func file_gosdn_topology_node_proto_rawDescGZIP() []byte { + file_gosdn_topology_node_proto_rawDescOnce.Do(func() { + file_gosdn_topology_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_gosdn_topology_node_proto_rawDescData) + }) + return file_gosdn_topology_node_proto_rawDescData +} + +var file_gosdn_topology_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_gosdn_topology_node_proto_goTypes = []interface{}{ + (*Node)(nil), // 0: gosdn.topology.Node +} +var file_gosdn_topology_node_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 +} + +func init() { file_gosdn_topology_node_proto_init() } +func file_gosdn_topology_node_proto_init() { + if File_gosdn_topology_node_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_gosdn_topology_node_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Node); 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_topology_node_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_gosdn_topology_node_proto_goTypes, + DependencyIndexes: file_gosdn_topology_node_proto_depIdxs, + MessageInfos: file_gosdn_topology_node_proto_msgTypes, + }.Build() + File_gosdn_topology_node_proto = out.File + file_gosdn_topology_node_proto_rawDesc = nil + file_gosdn_topology_node_proto_goTypes = nil + file_gosdn_topology_node_proto_depIdxs = nil +} diff --git a/api/go/gosdn/topology/port.pb.go b/api/go/gosdn/topology/port.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..f1583e32a7081da933a17ad45b41ba8f3e3e1dc3 --- /dev/null +++ b/api/go/gosdn/topology/port.pb.go @@ -0,0 +1,155 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: gosdn/topology/port.proto + +package topology + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/descriptorpb" + 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 Port struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *Port) Reset() { + *x = Port{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_port_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Port) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Port) ProtoMessage() {} + +func (x *Port) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_port_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 Port.ProtoReflect.Descriptor instead. +func (*Port) Descriptor() ([]byte, []int) { + return file_gosdn_topology_port_proto_rawDescGZIP(), []int{0} +} + +func (x *Port) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_gosdn_topology_port_proto protoreflect.FileDescriptor + +var file_gosdn_topology_port_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, + 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x67, 0x6f, 0x73, + 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 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, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, + 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, + 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x16, 0x0a, 0x04, 0x50, + 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x02, 0x69, 0x64, 0x42, 0x34, 0x5a, 0x32, 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, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_gosdn_topology_port_proto_rawDescOnce sync.Once + file_gosdn_topology_port_proto_rawDescData = file_gosdn_topology_port_proto_rawDesc +) + +func file_gosdn_topology_port_proto_rawDescGZIP() []byte { + file_gosdn_topology_port_proto_rawDescOnce.Do(func() { + file_gosdn_topology_port_proto_rawDescData = protoimpl.X.CompressGZIP(file_gosdn_topology_port_proto_rawDescData) + }) + return file_gosdn_topology_port_proto_rawDescData +} + +var file_gosdn_topology_port_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_gosdn_topology_port_proto_goTypes = []interface{}{ + (*Port)(nil), // 0: gosdn.topology.Port +} +var file_gosdn_topology_port_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 +} + +func init() { file_gosdn_topology_port_proto_init() } +func file_gosdn_topology_port_proto_init() { + if File_gosdn_topology_port_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_gosdn_topology_port_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Port); 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_topology_port_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_gosdn_topology_port_proto_goTypes, + DependencyIndexes: file_gosdn_topology_port_proto_depIdxs, + MessageInfos: file_gosdn_topology_port_proto_msgTypes, + }.Build() + File_gosdn_topology_port_proto = out.File + file_gosdn_topology_port_proto_rawDesc = nil + file_gosdn_topology_port_proto_goTypes = nil + file_gosdn_topology_port_proto_depIdxs = nil +} diff --git a/api/go/gosdn/topology/topology.pb.go b/api/go/gosdn/topology/topology.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..9119f79b6fa8e77fdd44a9ce358ef434382937f8 --- /dev/null +++ b/api/go/gosdn/topology/topology.pb.go @@ -0,0 +1,539 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc (unknown) +// source: gosdn/topology/topology.proto + +package topology + +import ( + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + _ "google.golang.org/protobuf/types/descriptorpb" + 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_topology_topology_proto_enumTypes[0].Descriptor() +} + +func (Status) Type() protoreflect.EnumType { + return &file_gosdn_topology_topology_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_topology_topology_proto_rawDescGZIP(), []int{0} +} + +type Topology struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Links []*Link `protobuf:"bytes,1,rep,name=links,proto3" json:"links,omitempty"` +} + +func (x *Topology) Reset() { + *x = Topology{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_topology_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Topology) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Topology) ProtoMessage() {} + +func (x *Topology) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_topology_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 Topology.ProtoReflect.Descriptor instead. +func (*Topology) Descriptor() ([]byte, []int) { + return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{0} +} + +func (x *Topology) GetLinks() []*Link { + if x != nil { + return x.Links + } + return nil +} + +// AddLink +type AddLinkRequest 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 *AddLinkRequest) Reset() { + *x = AddLinkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_topology_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddLinkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddLinkRequest) ProtoMessage() {} + +func (x *AddLinkRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_topology_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 AddLinkRequest.ProtoReflect.Descriptor instead. +func (*AddLinkRequest) Descriptor() ([]byte, []int) { + return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{1} +} + +func (x *AddLinkRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *AddLinkRequest) GetLink() *Link { + if x != nil { + return x.Link + } + return nil +} + +type AddLinkResponse 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 *AddLinkResponse) Reset() { + *x = AddLinkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_topology_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AddLinkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddLinkResponse) ProtoMessage() {} + +func (x *AddLinkResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_topology_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 AddLinkResponse.ProtoReflect.Descriptor instead. +func (*AddLinkResponse) Descriptor() ([]byte, []int) { + return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{2} +} + +func (x *AddLinkResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *AddLinkResponse) GetStatus() Status { + if x != nil { + return x.Status + } + return Status_STATUS_UNSPECIFIED +} + +// GetTopology +type GetTopologyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *GetTopologyRequest) Reset() { + *x = GetTopologyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_topology_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTopologyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTopologyRequest) ProtoMessage() {} + +func (x *GetTopologyRequest) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_topology_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 GetTopologyRequest.ProtoReflect.Descriptor instead. +func (*GetTopologyRequest) Descriptor() ([]byte, []int) { + return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{3} +} + +func (x *GetTopologyRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type GetTopologyResponse 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"` + Toplogy *Topology `protobuf:"bytes,3,opt,name=toplogy,proto3" json:"toplogy,omitempty"` +} + +func (x *GetTopologyResponse) Reset() { + *x = GetTopologyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_gosdn_topology_topology_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetTopologyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTopologyResponse) ProtoMessage() {} + +func (x *GetTopologyResponse) ProtoReflect() protoreflect.Message { + mi := &file_gosdn_topology_topology_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 GetTopologyResponse.ProtoReflect.Descriptor instead. +func (*GetTopologyResponse) Descriptor() ([]byte, []int) { + return file_gosdn_topology_topology_proto_rawDescGZIP(), []int{4} +} + +func (x *GetTopologyResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *GetTopologyResponse) GetStatus() Status { + if x != nil { + return x.Status + } + return Status_STATUS_UNSPECIFIED +} + +func (x *GetTopologyResponse) GetToplogy() *Topology { + if x != nil { + return x.Toplogy + } + return nil +} + +var File_gosdn_topology_topology_proto protoreflect.FileDescriptor + +var file_gosdn_topology_topology_proto_rawDesc = []byte{ + 0x0a, 0x1d, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, + 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x0e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 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, 0x20, 0x67, + 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x19, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2f, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2f, + 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x08, 0x54, 0x6f, + 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, + 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, + 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x05, 0x6c, 0x69, 0x6e, + 0x6b, 0x73, 0x22, 0x58, 0x0a, 0x0e, 0x41, 0x64, 0x64, 0x4c, 0x69, 0x6e, 0x6b, 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, 0x28, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x73, 0x64, 0x6e, 0x2e, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, + 0x79, 0x2e, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x5f, 0x0a, 0x0f, + 0x41, 0x64, 0x64, 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, 0x22, 0x32, 0x0a, + 0x12, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 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, 0x97, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, + 0x79, 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, 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, + 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, + 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, 0xe5, + 0x01, 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, 0x42, 0x34, 0x5a, 0x32, 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, 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_gosdn_topology_topology_proto_rawDescOnce sync.Once + file_gosdn_topology_topology_proto_rawDescData = file_gosdn_topology_topology_proto_rawDesc +) + +func file_gosdn_topology_topology_proto_rawDescGZIP() []byte { + file_gosdn_topology_topology_proto_rawDescOnce.Do(func() { + file_gosdn_topology_topology_proto_rawDescData = protoimpl.X.CompressGZIP(file_gosdn_topology_topology_proto_rawDescData) + }) + return file_gosdn_topology_topology_proto_rawDescData +} + +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_goTypes = []interface{}{ + (Status)(0), // 0: gosdn.topology.Status + (*Topology)(nil), // 1: gosdn.topology.Topology + (*AddLinkRequest)(nil), // 2: gosdn.topology.AddLinkRequest + (*AddLinkResponse)(nil), // 3: gosdn.topology.AddLinkResponse + (*GetTopologyRequest)(nil), // 4: gosdn.topology.GetTopologyRequest + (*GetTopologyResponse)(nil), // 5: gosdn.topology.GetTopologyResponse + (*Link)(nil), // 6: gosdn.topology.Link +} +var file_gosdn_topology_topology_proto_depIdxs = []int32{ + 6, // 0: gosdn.topology.Topology.links:type_name -> gosdn.topology.Link + 6, // 1: gosdn.topology.AddLinkRequest.link:type_name -> gosdn.topology.Link + 0, // 2: gosdn.topology.AddLinkResponse.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 + 2, // 5: gosdn.topology.TopologyService.AddLink:input_type -> gosdn.topology.AddLinkRequest + 4, // 6: gosdn.topology.TopologyService.GetTopology:input_type -> gosdn.topology.GetTopologyRequest + 3, // 7: gosdn.topology.TopologyService.AddLink:output_type -> gosdn.topology.AddLinkResponse + 5, // 8: gosdn.topology.TopologyService.GetTopology:output_type -> gosdn.topology.GetTopologyResponse + 7, // [7:9] is the sub-list for method output_type + 5, // [5:7] 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_topology_topology_proto_init() } +func file_gosdn_topology_topology_proto_init() { + if File_gosdn_topology_topology_proto != nil { + return + } + file_gosdn_topology_link_proto_init() + if !protoimpl.UnsafeEnabled { + file_gosdn_topology_topology_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Topology); 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[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddLinkRequest); 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[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AddLinkResponse); 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[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTopologyRequest); 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[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetTopologyResponse); 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_topology_topology_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_gosdn_topology_topology_proto_goTypes, + DependencyIndexes: file_gosdn_topology_topology_proto_depIdxs, + EnumInfos: file_gosdn_topology_topology_proto_enumTypes, + MessageInfos: file_gosdn_topology_topology_proto_msgTypes, + }.Build() + File_gosdn_topology_topology_proto = out.File + file_gosdn_topology_topology_proto_rawDesc = nil + file_gosdn_topology_topology_proto_goTypes = nil + file_gosdn_topology_topology_proto_depIdxs = nil +} diff --git a/api/go/gosdn/topology/topology.pb.gw.go b/api/go/gosdn/topology/topology.pb.gw.go new file mode 100644 index 0000000000000000000000000000000000000000..0bd7ba238d02ab3d564dd579a3fc89a28623642d --- /dev/null +++ b/api/go/gosdn/topology/topology.pb.gw.go @@ -0,0 +1,250 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: gosdn/topology/topology.proto + +/* +Package topology is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package topology + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_TopologyService_AddLink_0(ctx context.Context, marshaler runtime.Marshaler, client TopologyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AddLinkRequest + 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.AddLink(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TopologyService_AddLink_0(ctx context.Context, marshaler runtime.Marshaler, server TopologyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AddLinkRequest + 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.AddLink(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_TopologyService_GetTopology_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_TopologyService_GetTopology_0(ctx context.Context, marshaler runtime.Marshaler, client TopologyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetTopologyRequest + 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_GetTopology_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GetTopology(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_TopologyService_GetTopology_0(ctx context.Context, marshaler runtime.Marshaler, server TopologyServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetTopologyRequest + 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_GetTopology_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GetTopology(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterTopologyServiceHandlerServer registers the http handlers for service TopologyService to "mux". +// UnaryRPC :call TopologyServiceServer 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 RegisterTopologyServiceHandlerFromEndpoint instead. +func RegisterTopologyServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TopologyServiceServer) error { + + mux.Handle("POST", pattern_TopologyService_AddLink_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/AddLink", runtime.WithHTTPPathPattern("/topology/create")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TopologyService_AddLink_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_AddLink_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_TopologyService_GetTopology_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/GetTopology", runtime.WithHTTPPathPattern("/topology")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_TopologyService_GetTopology_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_GetTopology_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterTopologyServiceHandlerFromEndpoint is same as RegisterTopologyServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTopologyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTopologyServiceHandler(ctx, mux, conn) +} + +// RegisterTopologyServiceHandler registers the http handlers for service TopologyService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTopologyServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTopologyServiceHandlerClient(ctx, mux, NewTopologyServiceClient(conn)) +} + +// RegisterTopologyServiceHandlerClient registers the http handlers for service TopologyService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TopologyServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TopologyServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TopologyServiceClient" to call the correct interceptors. +func RegisterTopologyServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TopologyServiceClient) error { + + mux.Handle("POST", pattern_TopologyService_AddLink_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/AddLink", runtime.WithHTTPPathPattern("/topology/create")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TopologyService_AddLink_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_AddLink_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_TopologyService_GetTopology_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/GetTopology", runtime.WithHTTPPathPattern("/topology")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TopologyService_GetTopology_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_GetTopology_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + 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"}, "")) +) + +var ( + forward_TopologyService_AddLink_0 = runtime.ForwardResponseMessage + + forward_TopologyService_GetTopology_0 = runtime.ForwardResponseMessage +) diff --git a/api/go/gosdn/topology/topology_grpc.pb.go b/api/go/gosdn/topology/topology_grpc.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..646a8ebf30a472792a1af1e4267fbf8b65fdd054 --- /dev/null +++ b/api/go/gosdn/topology/topology_grpc.pb.go @@ -0,0 +1,145 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package topology + +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 + +// TopologyServiceClient is the client API for TopologyService 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 TopologyServiceClient interface { + // Creates roles, requires login beforehand. + // Requires highest permissions. + 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) +} + +type topologyServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewTopologyServiceClient(cc grpc.ClientConnInterface) TopologyServiceClient { + return &topologyServiceClient{cc} +} + +func (c *topologyServiceClient) AddLink(ctx context.Context, in *AddLinkRequest, opts ...grpc.CallOption) (*AddLinkResponse, error) { + out := new(AddLinkResponse) + err := c.cc.Invoke(ctx, "/gosdn.topology.TopologyService/AddLink", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *topologyServiceClient) GetTopology(ctx context.Context, in *GetTopologyRequest, opts ...grpc.CallOption) (*GetTopologyResponse, error) { + out := new(GetTopologyResponse) + err := c.cc.Invoke(ctx, "/gosdn.topology.TopologyService/GetTopology", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// TopologyServiceServer is the server API for TopologyService service. +// All implementations must embed UnimplementedTopologyServiceServer +// for forward compatibility +type TopologyServiceServer interface { + // Creates roles, requires login beforehand. + // Requires highest permissions. + AddLink(context.Context, *AddLinkRequest) (*AddLinkResponse, error) + // Requests all roles with their permissions, requires login beforehand. + // Requires highest permissions. + GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error) + mustEmbedUnimplementedTopologyServiceServer() +} + +// UnimplementedTopologyServiceServer must be embedded to have forward compatible implementations. +type UnimplementedTopologyServiceServer struct { +} + +func (UnimplementedTopologyServiceServer) AddLink(context.Context, *AddLinkRequest) (*AddLinkResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddLink not implemented") +} +func (UnimplementedTopologyServiceServer) GetTopology(context.Context, *GetTopologyRequest) (*GetTopologyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTopology not implemented") +} +func (UnimplementedTopologyServiceServer) mustEmbedUnimplementedTopologyServiceServer() {} + +// UnsafeTopologyServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to TopologyServiceServer will +// result in compilation errors. +type UnsafeTopologyServiceServer interface { + mustEmbedUnimplementedTopologyServiceServer() +} + +func RegisterTopologyServiceServer(s grpc.ServiceRegistrar, srv TopologyServiceServer) { + s.RegisterService(&TopologyService_ServiceDesc, srv) +} + +func _TopologyService_AddLink_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddLinkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TopologyServiceServer).AddLink(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.topology.TopologyService/AddLink", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TopologyServiceServer).AddLink(ctx, req.(*AddLinkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _TopologyService_GetTopology_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTopologyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(TopologyServiceServer).GetTopology(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/gosdn.topology.TopologyService/GetTopology", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(TopologyServiceServer).GetTopology(ctx, req.(*GetTopologyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// TopologyService_ServiceDesc is the grpc.ServiceDesc for TopologyService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var TopologyService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "gosdn.topology.TopologyService", + HandlerType: (*TopologyServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "AddLink", + Handler: _TopologyService_AddLink_Handler, + }, + { + MethodName: "GetTopology", + Handler: _TopologyService_GetTopology_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "gosdn/topology/topology.proto", +} diff --git a/api/openapiv2/gosdn_northbound.swagger.json b/api/openapiv2/gosdn_northbound.swagger.json index 9db819cb09f428c5d726f85f3e0e199d7a0ec429..4cd6a8a702f29bb36f5dbbcddcf980b41106a996 100644 --- a/api/openapiv2/gosdn_northbound.swagger.json +++ b/api/openapiv2/gosdn_northbound.swagger.json @@ -17,6 +17,9 @@ { "name": "PndService" }, + { + "name": "Collector" + }, { "name": "gNMI" }, @@ -30,19 +33,19 @@ "name": "CoreService" }, { - "name": "Collector" + "name": "CsbiService" }, { "name": "AuthService" }, { - "name": "UserService" + "name": "RoleService" }, { - "name": "CsbiService" + "name": "UserService" }, { - "name": "RoleService" + "name": "TopologyService" } ], "consumes": [ @@ -1031,6 +1034,71 @@ ] } }, + "/topology": { + "get": { + "summary": "Requests all roles with their permissions, requires login beforehand.\nRequires highest permissions.", + "operationId": "TopologyService_GetTopology", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/topologyGetTopologyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "timestamp", + "in": "query", + "required": false, + "type": "string", + "format": "int64" + } + ], + "tags": [ + "TopologyService" + ] + } + }, + "/topology/create": { + "post": { + "summary": "Creates roles, requires login beforehand.\nRequires highest permissions.", + "operationId": "TopologyService_AddLink", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/topologyAddLinkResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/topologyAddLinkRequest" + } + } + ], + "tags": [ + "TopologyService" + ] + } + }, "/users": { "get": { "summary": "Requests information about available users, requires login beforehand.\nRequires highest possible permissions.", @@ -2532,6 +2600,15 @@ "default": "TYPE_UNSPECIFIED", "title": "Changed according to style guide:\nhttps://docs.buf.build/best-practices/style-guide#enums" }, + "gosdntopologyStatus": { + "type": "string", + "enum": [ + "STATUS_UNSPECIFIED", + "STATUS_OK", + "STATUS_ERROR" + ], + "default": "STATUS_UNSPECIFIED" + }, "pndApiOperation": { "type": "string", "enum": [ @@ -2889,7 +2966,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\n Example 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\n Example 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\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 }" }, "rbacCreateRolesRequest": { "type": "object", @@ -3182,6 +3259,99 @@ } } }, + "topologyAddLinkRequest": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "link": { + "$ref": "#/definitions/topologyLink" + } + }, + "title": "AddLink" + }, + "topologyAddLinkResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "status": { + "$ref": "#/definitions/gosdntopologyStatus" + } + } + }, + "topologyGetTopologyResponse": { + "type": "object", + "properties": { + "timestamp": { + "type": "string", + "format": "int64" + }, + "status": { + "$ref": "#/definitions/gosdntopologyStatus" + }, + "toplogy": { + "$ref": "#/definitions/topologyTopology" + } + } + }, + "topologyLink": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "sourceNode": { + "$ref": "#/definitions/topologyNode" + }, + "targetNode": { + "$ref": "#/definitions/topologyNode" + }, + "sourcePort": { + "$ref": "#/definitions/topologyPort" + }, + "targetPort": { + "$ref": "#/definitions/topologyPort" + } + } + }, + "topologyNode": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + }, + "topologyPort": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "topologyTopology": { + "type": "object", + "properties": { + "links": { + "type": "array", + "items": { + "$ref": "#/definitions/topologyLink" + } + } + } + }, "transportGnmiTransportOption": { "type": "object", "properties": { diff --git a/api/proto/buf.lock b/api/proto/buf.lock index 7cb8f4758341bcff9abc299cf94495c376ebc368..609ccb0d975e8a80f3bd3e50c1df57a05dfc26b0 100644 --- a/api/proto/buf.lock +++ b/api/proto/buf.lock @@ -4,14 +4,8 @@ deps: - remote: buf.build owner: googleapis repository: googleapis - branch: main - commit: ebc3077fbae84b63a71f742dd72f7101 - digest: b1-gGcU24imC8L2I93v0LRssRMDGX0Fw9yrqgptNqVsTAU= - create_time: 2022-05-12T15:09:22.684487Z + commit: 7529bb85c9cd4c489dba05e04769c547 - remote: buf.build owner: grpc-ecosystem repository: grpc-gateway - branch: main - commit: febd9e8be39b4f4b878b9c64bcc203fd - digest: b1-K5jSHBrJ24jZXRgQgkmphZuP-cAL2b90ssKrgvDK2hU= - create_time: 2022-04-17T01:28:07.574665Z + commit: 00116f302b12478b85deb33b734e026c diff --git a/api/proto/gosdn/topology/link.proto b/api/proto/gosdn/topology/link.proto new file mode 100644 index 0000000000000000000000000000000000000000..70aee027733179856e95c9fc92c51670126d51fe --- /dev/null +++ b/api/proto/gosdn/topology/link.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; + +package gosdn.topology; + +import "google/api/annotations.proto"; +import "google/protobuf/descriptor.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +import "gosdn/topology/node.proto"; +import "gosdn/topology/port.proto"; + +option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology"; + +message Link { + string id = 1; + string name = 2; + Node sourceNode = 3; + Node targetNode = 4; + Port sourcePort = 5; + Port targetPort = 6; +} diff --git a/api/proto/gosdn/topology/node.proto b/api/proto/gosdn/topology/node.proto new file mode 100644 index 0000000000000000000000000000000000000000..ca06fab019f59cd8584b2dbe4f6b4d40b34dd267 --- /dev/null +++ b/api/proto/gosdn/topology/node.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; + +package gosdn.topology; + +import "google/api/annotations.proto"; +import "google/protobuf/descriptor.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + + +option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology"; + +message Node { + string id = 1; + string name = 2; +} diff --git a/api/proto/gosdn/topology/port.proto b/api/proto/gosdn/topology/port.proto new file mode 100644 index 0000000000000000000000000000000000000000..5124283b92784a55ddcf709f0548827edff4b4b1 --- /dev/null +++ b/api/proto/gosdn/topology/port.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; + +package gosdn.topology; + +import "google/api/annotations.proto"; +import "google/protobuf/descriptor.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + + +option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology"; + +message Port { + string id = 1; +} diff --git a/api/proto/gosdn/topology/topology.proto b/api/proto/gosdn/topology/topology.proto new file mode 100644 index 0000000000000000000000000000000000000000..d4a71d696d68bca0f5190152043e0afae64bea93 --- /dev/null +++ b/api/proto/gosdn/topology/topology.proto @@ -0,0 +1,134 @@ +syntax = "proto3"; + +package gosdn.topology; + +import "google/api/annotations.proto"; +import "google/protobuf/descriptor.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +import "gosdn/topology/link.proto"; + + +option go_package = "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/topology"; + +service TopologyService { + // Creates roles, requires login beforehand. + // Requires highest permissions. + rpc AddLink(AddLinkRequest) returns (AddLinkResponse) { + option (google.api.http) = { + post: "/topology/create" + body: "*" + }; + } + + // 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) { + option (google.api.http) = { + get: "/topology" + }; + } + + // // Updates roles by setting the provided permissions, requires login beforehand. + // // Requires highest permissions. + // rpc UpdateLink(UpdateRolesRequest) returns (UpdateRolesResponse) { + // option (google.api.http) = { + // post: "/topology/update" + // body: "*" + // }; + // } + + // // Deletes roles with their permissions, requires login beforehand. + // // Requires highest permissions. + // rpc DeleteLink(DeleteRolesRequest) returns (DeleteRolesResponse) { + // option (google.api.http) = { + // delete: "/topology/delete" + // }; + // } +} + +enum Status { + STATUS_UNSPECIFIED = 0; + STATUS_OK = 1; + STATUS_ERROR = 2; +} + +message Topology { + repeated Link links = 1; +} + +// AddLink +message AddLinkRequest { + int64 timestamp = 1; + Link link = 2; +} + +message AddLinkResponse { + int64 timestamp = 1; + 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 { + int64 timestamp = 1; +} + +message GetTopologyResponse { + int64 timestamp = 1; + Status status = 2; + Topology toplogy = 3; +} + +// // UpdateRoles +// message UpdateRolesRequest { +// int64 timestamp = 1; +// repeated Role roles = 2; +// } + +// message UpdateRolesResponse { +// int64 timestamp = 1; +// Status status = 2; +// } + +// // DeletePermissionsForRole +// message DeletePermissionsForRoleRequest { +// int64 timestamp = 1; +// string role_name = 2; +// repeated string permissions_to_delete = 3; +// } + +// 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; +// }