diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-12-26 19:24:46 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-12-26 19:24:46 -0800 |
commit | 7a2b3951160804c6895714621099168e8e56aa74 (patch) | |
tree | f847e72ac7fc6064774f5de1afca77c712d5809d /api | |
parent | 01157e466a510a9d7c7290c26a131734e7566261 (diff) |
add MOD_PATH API
Handle only one route unlike MOD_PATHS API. When the API returns an
uuid when a route is created. The uuid can be used to remove the route
later.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'api')
-rw-r--r-- | api/gobgp.pb.go | 58 | ||||
-rw-r--r-- | api/gobgp.proto | 13 |
2 files changed, 71 insertions, 0 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go index 92404f9b..14f0b3b5 100644 --- a/api/gobgp.pb.go +++ b/api/gobgp.pb.go @@ -11,6 +11,8 @@ It is generated from these files: It has these top-level messages: Error Arguments + ModPathArguments + ModPathResponse ModPathsArguments ModNeighborArguments MrtArguments @@ -348,6 +350,33 @@ func (m *Arguments) Reset() { *m = Arguments{} } func (m *Arguments) String() string { return proto.CompactTextString(m) } func (*Arguments) ProtoMessage() {} +type ModPathArguments struct { + Operation Operation `protobuf:"varint,1,opt,name=operation,enum=gobgpapi.Operation" json:"operation,omitempty"` + Resource Resource `protobuf:"varint,2,opt,name=resource,enum=gobgpapi.Resource" json:"resource,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name" json:"name,omitempty"` + Path *Path `protobuf:"bytes,4,opt,name=path" json:"path,omitempty"` + Uuid []byte `protobuf:"bytes,5,opt,name=uuid,proto3" json:"uuid,omitempty"` +} + +func (m *ModPathArguments) Reset() { *m = ModPathArguments{} } +func (m *ModPathArguments) String() string { return proto.CompactTextString(m) } +func (*ModPathArguments) ProtoMessage() {} + +func (m *ModPathArguments) GetPath() *Path { + if m != nil { + return m.Path + } + return nil +} + +type ModPathResponse struct { + Uuid []byte `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` +} + +func (m *ModPathResponse) Reset() { *m = ModPathResponse{} } +func (m *ModPathResponse) String() string { return proto.CompactTextString(m) } +func (*ModPathResponse) ProtoMessage() {} + type ModPathsArguments struct { Resource Resource `protobuf:"varint,1,opt,name=resource,enum=gobgpapi.Resource" json:"resource,omitempty"` Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` @@ -1190,6 +1219,8 @@ func (*Global) ProtoMessage() {} func init() { proto.RegisterType((*Error)(nil), "gobgpapi.Error") proto.RegisterType((*Arguments)(nil), "gobgpapi.Arguments") + proto.RegisterType((*ModPathArguments)(nil), "gobgpapi.ModPathArguments") + proto.RegisterType((*ModPathResponse)(nil), "gobgpapi.ModPathResponse") proto.RegisterType((*ModPathsArguments)(nil), "gobgpapi.ModPathsArguments") proto.RegisterType((*ModNeighborArguments)(nil), "gobgpapi.ModNeighborArguments") proto.RegisterType((*MrtArguments)(nil), "gobgpapi.MrtArguments") @@ -1269,6 +1300,7 @@ type GobgpApiClient interface { Shutdown(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (*Error, error) Enable(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (*Error, error) Disable(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (*Error, error) + ModPath(ctx context.Context, in *ModPathArguments, opts ...grpc.CallOption) (*ModPathResponse, error) ModPaths(ctx context.Context, opts ...grpc.CallOption) (GobgpApi_ModPathsClient, error) MonitorBestChanged(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (GobgpApi_MonitorBestChangedClient, error) MonitorPeerState(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (GobgpApi_MonitorPeerStateClient, error) @@ -1440,6 +1472,15 @@ func (c *gobgpApiClient) Disable(ctx context.Context, in *Arguments, opts ...grp return out, nil } +func (c *gobgpApiClient) ModPath(ctx context.Context, in *ModPathArguments, opts ...grpc.CallOption) (*ModPathResponse, error) { + out := new(ModPathResponse) + err := grpc.Invoke(ctx, "/gobgpapi.GobgpApi/ModPath", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *gobgpApiClient) ModPaths(ctx context.Context, opts ...grpc.CallOption) (GobgpApi_ModPathsClient, error) { stream, err := grpc.NewClientStream(ctx, &_GobgpApi_serviceDesc.Streams[1], c.cc, "/gobgpapi.GobgpApi/ModPaths", opts...) if err != nil { @@ -1877,6 +1918,7 @@ type GobgpApiServer interface { Shutdown(context.Context, *Arguments) (*Error, error) Enable(context.Context, *Arguments) (*Error, error) Disable(context.Context, *Arguments) (*Error, error) + ModPath(context.Context, *ModPathArguments) (*ModPathResponse, error) ModPaths(GobgpApi_ModPathsServer) error MonitorBestChanged(*Arguments, GobgpApi_MonitorBestChangedServer) error MonitorPeerState(*Arguments, GobgpApi_MonitorPeerStateServer) error @@ -2069,6 +2111,18 @@ func _GobgpApi_Disable_Handler(srv interface{}, ctx context.Context, dec func(in return out, nil } +func _GobgpApi_ModPath_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(ModPathArguments) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(GobgpApiServer).ModPath(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + func _GobgpApi_ModPaths_Handler(srv interface{}, stream grpc.ServerStream) error { return srv.(GobgpApiServer).ModPaths(&gobgpApiModPathsServer{stream}) } @@ -2469,6 +2523,10 @@ var _GobgpApi_serviceDesc = grpc.ServiceDesc{ Handler: _GobgpApi_Disable_Handler, }, { + MethodName: "ModPath", + Handler: _GobgpApi_ModPath_Handler, + }, + { MethodName: "ModMrt", Handler: _GobgpApi_ModMrt_Handler, }, diff --git a/api/gobgp.proto b/api/gobgp.proto index c34ac23b..296d7f18 100644 --- a/api/gobgp.proto +++ b/api/gobgp.proto @@ -33,6 +33,7 @@ service GobgpApi { rpc Shutdown(Arguments) returns (Error) {} rpc Enable(Arguments) returns (Error) {} rpc Disable(Arguments) returns (Error) {} + rpc ModPath(ModPathArguments) returns (ModPathResponse) {} rpc ModPaths(stream ModPathsArguments) returns (Error) {} rpc MonitorBestChanged(Arguments) returns (stream Destination) {} rpc MonitorPeerState(Arguments) returns (stream Peer) {} @@ -71,6 +72,18 @@ message Arguments { string name = 3; } +message ModPathArguments { + Operation operation = 1; + Resource resource = 2; + string name = 3; + Path path = 4; + bytes uuid = 5; +} + +message ModPathResponse { + bytes uuid = 1; +} + message ModPathsArguments { Resource resource = 1; string name = 2; |