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

Add api and refactor controller to use new imports

parent fbd20e1a
Branches
No related tags found
1 merge request!253Migration in monorepo
Pipeline #97903 failed
Showing
with 10276 additions and 6 deletions
deps/github.com/
BSD 3-Clause License
Copyright (c) 2020, cocsn
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# goSDN API
Protocol buffer definitions for goSDN gRPC API. To generate you need [buf](https://buf.build/) and the following commands:
```sh
buf mod update proto
buf generate
```
version: v1
plugins:
- remote: buf.build/library/plugins/go:v1.27.1-1
out: go
opt:
- paths=source_relative
- remote: buf.build/library/plugins/go-grpc:v1.1.0-2
out: go
opt:
- paths=source_relative
- remote: buf.build/grpc-ecosystem/plugins/grpc-gateway:v2.7.2-1
out: go
opt:
- paths=source_relative
- remote: buf.build/grpc-ecosystem/plugins/openapiv2:v2.7.2-1
out: openapiv2
opt:
- allow_merge=true
- merge_file_name=gosdn_northbound
# - generate_unbound_methods=true
# - include_package_in_tags=false
version: v1
directories:
- proto
- deps
// go:generate protoc --proto_path=./proto --go_out=./go --go-grpc_out=./go --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative --proto_path=/Users/mk/go/src ./proto/gosdn/pnd/pnd.proto ./proto/gosdn/core/core.proto ./proto/gosdn/transport/transport.proto ./proto/gosdn/southbound/southbound.proto ./proto/gosdn/csbi/csbi.proto
package api
version: v1
lint:
use:
- DEFAULT
ignore:
- github.com/openconfig/gnmi/proto
- github.com/openconfig/gnmi/testing
breaking:
use:
- FILE
//
// Copyright 2020 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.1
// protoc (unknown)
// source: github.com/openconfig/gnmi/proto/collector/collector.proto
package gnmi
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ReconnectRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Target []string `protobuf:"bytes,1,rep,name=target,proto3" json:"target,omitempty"` // List of targets to reconnect.
}
func (x *ReconnectRequest) Reset() {
*x = ReconnectRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_github_com_openconfig_gnmi_proto_collector_collector_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ReconnectRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ReconnectRequest) ProtoMessage() {}
func (x *ReconnectRequest) ProtoReflect() protoreflect.Message {
mi := &file_github_com_openconfig_gnmi_proto_collector_collector_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 ReconnectRequest.ProtoReflect.Descriptor instead.
func (*ReconnectRequest) Descriptor() ([]byte, []int) {
return file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescGZIP(), []int{0}
}
func (x *ReconnectRequest) GetTarget() []string {
if x != nil {
return x.Target
}
return nil
}
type Nil struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Nil) Reset() {
*x = Nil{}
if protoimpl.UnsafeEnabled {
mi := &file_github_com_openconfig_gnmi_proto_collector_collector_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Nil) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Nil) ProtoMessage() {}
func (x *Nil) ProtoReflect() protoreflect.Message {
mi := &file_github_com_openconfig_gnmi_proto_collector_collector_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 Nil.ProtoReflect.Descriptor instead.
func (*Nil) Descriptor() ([]byte, []int) {
return file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescGZIP(), []int{1}
}
var File_github_com_openconfig_gnmi_proto_collector_collector_proto protoreflect.FileDescriptor
var file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDesc = []byte{
0x0a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65,
0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6e, 0x6d, 0x69, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2f, 0x63, 0x6f, 0x6c,
0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x6e,
0x6d, 0x69, 0x22, 0x2a, 0x0a, 0x10, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74,
0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x05,
0x0a, 0x03, 0x4e, 0x69, 0x6c, 0x32, 0x3d, 0x0a, 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
0x6f, 0x72, 0x12, 0x30, 0x0a, 0x09, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12,
0x16, 0x2e, 0x67, 0x6e, 0x6d, 0x69, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x09, 0x2e, 0x67, 0x6e, 0x6d, 0x69, 0x2e, 0x4e,
0x69, 0x6c, 0x22, 0x00, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x67, 0x6e,
0x6d, 0x69, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
0x6f, 0x72, 0x3b, 0x67, 0x6e, 0x6d, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescOnce sync.Once
file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescData = file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDesc
)
func file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescGZIP() []byte {
file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescOnce.Do(func() {
file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescData)
})
return file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDescData
}
var file_github_com_openconfig_gnmi_proto_collector_collector_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_github_com_openconfig_gnmi_proto_collector_collector_proto_goTypes = []interface{}{
(*ReconnectRequest)(nil), // 0: gnmi.ReconnectRequest
(*Nil)(nil), // 1: gnmi.Nil
}
var file_github_com_openconfig_gnmi_proto_collector_collector_proto_depIdxs = []int32{
0, // 0: gnmi.Collector.Reconnect:input_type -> gnmi.ReconnectRequest
1, // 1: gnmi.Collector.Reconnect:output_type -> gnmi.Nil
1, // [1:2] is the sub-list for method output_type
0, // [0:1] 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_github_com_openconfig_gnmi_proto_collector_collector_proto_init() }
func file_github_com_openconfig_gnmi_proto_collector_collector_proto_init() {
if File_github_com_openconfig_gnmi_proto_collector_collector_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_github_com_openconfig_gnmi_proto_collector_collector_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReconnectRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_github_com_openconfig_gnmi_proto_collector_collector_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Nil); 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_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_github_com_openconfig_gnmi_proto_collector_collector_proto_goTypes,
DependencyIndexes: file_github_com_openconfig_gnmi_proto_collector_collector_proto_depIdxs,
MessageInfos: file_github_com_openconfig_gnmi_proto_collector_collector_proto_msgTypes,
}.Build()
File_github_com_openconfig_gnmi_proto_collector_collector_proto = out.File
file_github_com_openconfig_gnmi_proto_collector_collector_proto_rawDesc = nil
file_github_com_openconfig_gnmi_proto_collector_collector_proto_goTypes = nil
file_github_com_openconfig_gnmi_proto_collector_collector_proto_depIdxs = nil
}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package gnmi
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
// CollectorClient is the client API for Collector 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 CollectorClient interface {
// Reconnect requests that the existing connections for one or more specified
// targets will be stopped and new connections established.
Reconnect(ctx context.Context, in *ReconnectRequest, opts ...grpc.CallOption) (*Nil, error)
}
type collectorClient struct {
cc grpc.ClientConnInterface
}
func NewCollectorClient(cc grpc.ClientConnInterface) CollectorClient {
return &collectorClient{cc}
}
func (c *collectorClient) Reconnect(ctx context.Context, in *ReconnectRequest, opts ...grpc.CallOption) (*Nil, error) {
out := new(Nil)
err := c.cc.Invoke(ctx, "/gnmi.Collector/Reconnect", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CollectorServer is the server API for Collector service.
// All implementations must embed UnimplementedCollectorServer
// for forward compatibility
type CollectorServer interface {
// Reconnect requests that the existing connections for one or more specified
// targets will be stopped and new connections established.
Reconnect(context.Context, *ReconnectRequest) (*Nil, error)
mustEmbedUnimplementedCollectorServer()
}
// UnimplementedCollectorServer must be embedded to have forward compatible implementations.
type UnimplementedCollectorServer struct {
}
func (UnimplementedCollectorServer) Reconnect(context.Context, *ReconnectRequest) (*Nil, error) {
return nil, status.Errorf(codes.Unimplemented, "method Reconnect not implemented")
}
func (UnimplementedCollectorServer) mustEmbedUnimplementedCollectorServer() {}
// UnsafeCollectorServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CollectorServer will
// result in compilation errors.
type UnsafeCollectorServer interface {
mustEmbedUnimplementedCollectorServer()
}
func RegisterCollectorServer(s grpc.ServiceRegistrar, srv CollectorServer) {
s.RegisterService(&Collector_ServiceDesc, srv)
}
func _Collector_Reconnect_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ReconnectRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CollectorServer).Reconnect(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.Collector/Reconnect",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CollectorServer).Reconnect(ctx, req.(*ReconnectRequest))
}
return interceptor(ctx, in, info, handler)
}
// Collector_ServiceDesc is the grpc.ServiceDesc for Collector service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Collector_ServiceDesc = grpc.ServiceDesc{
ServiceName: "gnmi.Collector",
HandlerType: (*CollectorServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Reconnect",
Handler: _Collector_Reconnect_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "github.com/openconfig/gnmi/proto/collector/collector.proto",
}
This diff is collapsed.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package gnmi
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
// GNMIClient is the client API for GNMI 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 GNMIClient interface {
// Capabilities allows the client to retrieve the set of capabilities that
// is supported by the target. This allows the target to validate the
// service version that is implemented and retrieve the set of models that
// the target supports. The models can then be specified in subsequent RPCs
// to restrict the set of data that is utilized.
// Reference: gNMI Specification Section 3.2
Capabilities(ctx context.Context, in *CapabilityRequest, opts ...grpc.CallOption) (*CapabilityResponse, error)
// Retrieve a snapshot of data from the target. A Get RPC requests that the
// target snapshots a subset of the data tree as specified by the paths
// included in the message and serializes this to be returned to the
// client using the specified encoding.
// Reference: gNMI Specification Section 3.3
Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
// Set allows the client to modify the state of data on the target. The
// paths to modified along with the new values that the client wishes
// to set the value to.
// Reference: gNMI Specification Section 3.4
Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error)
// Subscribe allows a client to request the target to send it values
// of particular paths within the data tree. These values may be streamed
// at a particular cadence (STREAM), sent one off on a long-lived channel
// (POLL), or sent as a one-off retrieval (ONCE).
// Reference: gNMI Specification Section 3.5
Subscribe(ctx context.Context, opts ...grpc.CallOption) (GNMI_SubscribeClient, error)
}
type gNMIClient struct {
cc grpc.ClientConnInterface
}
func NewGNMIClient(cc grpc.ClientConnInterface) GNMIClient {
return &gNMIClient{cc}
}
func (c *gNMIClient) Capabilities(ctx context.Context, in *CapabilityRequest, opts ...grpc.CallOption) (*CapabilityResponse, error) {
out := new(CapabilityResponse)
err := c.cc.Invoke(ctx, "/gnmi.gNMI/Capabilities", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gNMIClient) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error) {
out := new(GetResponse)
err := c.cc.Invoke(ctx, "/gnmi.gNMI/Get", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gNMIClient) Set(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*SetResponse, error) {
out := new(SetResponse)
err := c.cc.Invoke(ctx, "/gnmi.gNMI/Set", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *gNMIClient) Subscribe(ctx context.Context, opts ...grpc.CallOption) (GNMI_SubscribeClient, error) {
stream, err := c.cc.NewStream(ctx, &GNMI_ServiceDesc.Streams[0], "/gnmi.gNMI/Subscribe", opts...)
if err != nil {
return nil, err
}
x := &gNMISubscribeClient{stream}
return x, nil
}
type GNMI_SubscribeClient interface {
Send(*SubscribeRequest) error
Recv() (*SubscribeResponse, error)
grpc.ClientStream
}
type gNMISubscribeClient struct {
grpc.ClientStream
}
func (x *gNMISubscribeClient) Send(m *SubscribeRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *gNMISubscribeClient) Recv() (*SubscribeResponse, error) {
m := new(SubscribeResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// GNMIServer is the server API for GNMI service.
// All implementations must embed UnimplementedGNMIServer
// for forward compatibility
type GNMIServer interface {
// Capabilities allows the client to retrieve the set of capabilities that
// is supported by the target. This allows the target to validate the
// service version that is implemented and retrieve the set of models that
// the target supports. The models can then be specified in subsequent RPCs
// to restrict the set of data that is utilized.
// Reference: gNMI Specification Section 3.2
Capabilities(context.Context, *CapabilityRequest) (*CapabilityResponse, error)
// Retrieve a snapshot of data from the target. A Get RPC requests that the
// target snapshots a subset of the data tree as specified by the paths
// included in the message and serializes this to be returned to the
// client using the specified encoding.
// Reference: gNMI Specification Section 3.3
Get(context.Context, *GetRequest) (*GetResponse, error)
// Set allows the client to modify the state of data on the target. The
// paths to modified along with the new values that the client wishes
// to set the value to.
// Reference: gNMI Specification Section 3.4
Set(context.Context, *SetRequest) (*SetResponse, error)
// Subscribe allows a client to request the target to send it values
// of particular paths within the data tree. These values may be streamed
// at a particular cadence (STREAM), sent one off on a long-lived channel
// (POLL), or sent as a one-off retrieval (ONCE).
// Reference: gNMI Specification Section 3.5
Subscribe(GNMI_SubscribeServer) error
mustEmbedUnimplementedGNMIServer()
}
// UnimplementedGNMIServer must be embedded to have forward compatible implementations.
type UnimplementedGNMIServer struct {
}
func (UnimplementedGNMIServer) Capabilities(context.Context, *CapabilityRequest) (*CapabilityResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Capabilities not implemented")
}
func (UnimplementedGNMIServer) Get(context.Context, *GetRequest) (*GetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedGNMIServer) Set(context.Context, *SetRequest) (*SetResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Set not implemented")
}
func (UnimplementedGNMIServer) Subscribe(GNMI_SubscribeServer) error {
return status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
}
func (UnimplementedGNMIServer) mustEmbedUnimplementedGNMIServer() {}
// UnsafeGNMIServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GNMIServer will
// result in compilation errors.
type UnsafeGNMIServer interface {
mustEmbedUnimplementedGNMIServer()
}
func RegisterGNMIServer(s grpc.ServiceRegistrar, srv GNMIServer) {
s.RegisterService(&GNMI_ServiceDesc, srv)
}
func _GNMI_Capabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CapabilityRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GNMIServer).Capabilities(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.gNMI/Capabilities",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GNMIServer).Capabilities(ctx, req.(*CapabilityRequest))
}
return interceptor(ctx, in, info, handler)
}
func _GNMI_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GNMIServer).Get(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.gNMI/Get",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GNMIServer).Get(ctx, req.(*GetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _GNMI_Set_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(SetRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(GNMIServer).Set(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.gNMI/Set",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(GNMIServer).Set(ctx, req.(*SetRequest))
}
return interceptor(ctx, in, info, handler)
}
func _GNMI_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(GNMIServer).Subscribe(&gNMISubscribeServer{stream})
}
type GNMI_SubscribeServer interface {
Send(*SubscribeResponse) error
Recv() (*SubscribeRequest, error)
grpc.ServerStream
}
type gNMISubscribeServer struct {
grpc.ServerStream
}
func (x *gNMISubscribeServer) Send(m *SubscribeResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *gNMISubscribeServer) Recv() (*SubscribeRequest, error) {
m := new(SubscribeRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// GNMI_ServiceDesc is the grpc.ServiceDesc for GNMI service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var GNMI_ServiceDesc = grpc.ServiceDesc{
ServiceName: "gnmi.gNMI",
HandlerType: (*GNMIServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Capabilities",
Handler: _GNMI_Capabilities_Handler,
},
{
MethodName: "Get",
Handler: _GNMI_Get_Handler,
},
{
MethodName: "Set",
Handler: _GNMI_Set_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Subscribe",
Handler: _GNMI_Subscribe_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "github.com/openconfig/gnmi/proto/gnmi/gnmi.proto",
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package gnmi_fake
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
// AgentManagerClient is the client API for AgentManager 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 AgentManagerClient interface {
// Add adds an agent to the server.
Add(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Config, error)
// Remove removes an agent from the server.
Remove(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Config, error)
// Status returns the current status of an agent on the server.
Status(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Config, error)
}
type agentManagerClient struct {
cc grpc.ClientConnInterface
}
func NewAgentManagerClient(cc grpc.ClientConnInterface) AgentManagerClient {
return &agentManagerClient{cc}
}
func (c *agentManagerClient) Add(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Config, error) {
out := new(Config)
err := c.cc.Invoke(ctx, "/gnmi.fake.AgentManager/Add", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentManagerClient) Remove(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Config, error) {
out := new(Config)
err := c.cc.Invoke(ctx, "/gnmi.fake.AgentManager/Remove", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentManagerClient) Status(ctx context.Context, in *Config, opts ...grpc.CallOption) (*Config, error) {
out := new(Config)
err := c.cc.Invoke(ctx, "/gnmi.fake.AgentManager/Status", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentManagerServer is the server API for AgentManager service.
// All implementations must embed UnimplementedAgentManagerServer
// for forward compatibility
type AgentManagerServer interface {
// Add adds an agent to the server.
Add(context.Context, *Config) (*Config, error)
// Remove removes an agent from the server.
Remove(context.Context, *Config) (*Config, error)
// Status returns the current status of an agent on the server.
Status(context.Context, *Config) (*Config, error)
mustEmbedUnimplementedAgentManagerServer()
}
// UnimplementedAgentManagerServer must be embedded to have forward compatible implementations.
type UnimplementedAgentManagerServer struct {
}
func (UnimplementedAgentManagerServer) Add(context.Context, *Config) (*Config, error) {
return nil, status.Errorf(codes.Unimplemented, "method Add not implemented")
}
func (UnimplementedAgentManagerServer) Remove(context.Context, *Config) (*Config, error) {
return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented")
}
func (UnimplementedAgentManagerServer) Status(context.Context, *Config) (*Config, error) {
return nil, status.Errorf(codes.Unimplemented, "method Status not implemented")
}
func (UnimplementedAgentManagerServer) mustEmbedUnimplementedAgentManagerServer() {}
// UnsafeAgentManagerServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AgentManagerServer will
// result in compilation errors.
type UnsafeAgentManagerServer interface {
mustEmbedUnimplementedAgentManagerServer()
}
func RegisterAgentManagerServer(s grpc.ServiceRegistrar, srv AgentManagerServer) {
s.RegisterService(&AgentManager_ServiceDesc, srv)
}
func _AgentManager_Add_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Config)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentManagerServer).Add(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.fake.AgentManager/Add",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentManagerServer).Add(ctx, req.(*Config))
}
return interceptor(ctx, in, info, handler)
}
func _AgentManager_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Config)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentManagerServer).Remove(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.fake.AgentManager/Remove",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentManagerServer).Remove(ctx, req.(*Config))
}
return interceptor(ctx, in, info, handler)
}
func _AgentManager_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Config)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentManagerServer).Status(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/gnmi.fake.AgentManager/Status",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentManagerServer).Status(ctx, req.(*Config))
}
return interceptor(ctx, in, info, handler)
}
// AgentManager_ServiceDesc is the grpc.ServiceDesc for AgentManager service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AgentManager_ServiceDesc = grpc.ServiceDesc{
ServiceName: "gnmi.fake.AgentManager",
HandlerType: (*AgentManagerServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Add",
Handler: _AgentManager_Add_Handler,
},
{
MethodName: "Remove",
Handler: _AgentManager_Remove_Handler,
},
{
MethodName: "Status",
Handler: _AgentManager_Status_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "github.com/openconfig/gnmi/testing/fake/proto/fake.proto",
}
This diff is collapsed.
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 74ce074c5dc540d5b9bcd9992bb0c147
- remote: buf.build
owner: grpc-ecosystem
repository: grpc-gateway
commit: c4ed84978f4845e8940539d492ccbb5e
version: v1
deps:
- buf.build/googleapis/googleapis
- buf.build/grpc-ecosystem/grpc-gateway
lint:
use:
- DEFAULT
breaking:
use:
- FILE
package adapter package adapter
import ( import (
"code.fbi.h-da.de/danet/api/go/gosdn/core" "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/core"
ppb "code.fbi.h-da.de/danet/api/go/gosdn/pnd" ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
spb "code.fbi.h-da.de/danet/api/go/gosdn/southbound" spb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/southbound"
tpb "code.fbi.h-da.de/danet/api/go/gosdn/transport" tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
"code.fbi.h-da.de/danet/gosdn/controller/api" "code.fbi.h-da.de/danet/gosdn/controller/api"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/change" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/change"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
......
...@@ -4,8 +4,8 @@ import ( ...@@ -4,8 +4,8 @@ import (
"reflect" "reflect"
"testing" "testing"
ppb "code.fbi.h-da.de/danet/api/go/gosdn/pnd" ppb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/pnd"
tpb "code.fbi.h-da.de/danet/api/go/gosdn/transport" tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/change" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/change"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/device" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/device"
"code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain" "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment