summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-08-01 20:42:14 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-08 20:56:46 +0900
commitecd079e318e1c5d5aa2d2f1348a4ad1a37daec37 (patch)
treebc96bd7b3173b4ba2d32cdf268027bdf50ab89cd
parentef934f76a52df814d5c77f9d0c3f9acaeb0856d9 (diff)
api: add api to configure vrf
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
-rw-r--r--api/gobgp.pb.go199
-rw-r--r--api/gobgp.proto16
2 files changed, 205 insertions, 10 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go
index d37eaa3e..99973473 100644
--- a/api/gobgp.pb.go
+++ b/api/gobgp.pb.go
@@ -14,6 +14,7 @@ It has these top-level messages:
ModPathArguments
PolicyArguments
MrtArguments
+ ModVrfArguments
AddressFamily
RouteDistinguisher
GracefulRestartTuple
@@ -54,6 +55,7 @@ It has these top-level messages:
ApplyPolicy
MrtMessage
ROA
+ Vrf
*/
package api
@@ -84,19 +86,21 @@ const (
Resource_POLICY_COMMUNITY Resource = 7
Resource_POLICY_ROUTEPOLICY Resource = 8
Resource_POLICY_EXTCOMMUNITY Resource = 9
+ Resource_VRF Resource = 10
)
var Resource_name = map[int32]string{
- 0: "GLOBAL",
- 1: "LOCAL",
- 2: "ADJ_IN",
- 3: "ADJ_OUT",
- 4: "POLICY_PREFIX",
- 5: "POLICY_NEIGHBOR",
- 6: "POLICY_ASPATH",
- 7: "POLICY_COMMUNITY",
- 8: "POLICY_ROUTEPOLICY",
- 9: "POLICY_EXTCOMMUNITY",
+ 0: "GLOBAL",
+ 1: "LOCAL",
+ 2: "ADJ_IN",
+ 3: "ADJ_OUT",
+ 4: "POLICY_PREFIX",
+ 5: "POLICY_NEIGHBOR",
+ 6: "POLICY_ASPATH",
+ 7: "POLICY_COMMUNITY",
+ 8: "POLICY_ROUTEPOLICY",
+ 9: "POLICY_EXTCOMMUNITY",
+ 10: "VRF",
}
var Resource_value = map[string]int32{
"GLOBAL": 0,
@@ -109,6 +113,7 @@ var Resource_value = map[string]int32{
"POLICY_COMMUNITY": 7,
"POLICY_ROUTEPOLICY": 8,
"POLICY_EXTCOMMUNITY": 9,
+ "VRF": 10,
}
func (x Resource) String() string {
@@ -656,6 +661,22 @@ func (m *MrtArguments) GetAf() *AddressFamily {
return nil
}
+type ModVrfArguments struct {
+ Operation Operation `protobuf:"varint,1,opt,name=operation,enum=api.Operation" json:"operation,omitempty"`
+ Vrf *Vrf `protobuf:"bytes,2,opt,name=vrf" json:"vrf,omitempty"`
+}
+
+func (m *ModVrfArguments) Reset() { *m = ModVrfArguments{} }
+func (m *ModVrfArguments) String() string { return proto.CompactTextString(m) }
+func (*ModVrfArguments) ProtoMessage() {}
+
+func (m *ModVrfArguments) GetVrf() *Vrf {
+ if m != nil {
+ return m.Vrf
+ }
+ return nil
+}
+
type AddressFamily struct {
Afi AFI `protobuf:"varint,1,opt,enum=api.AFI" json:"Afi,omitempty"`
Safi SAFI `protobuf:"varint,2,opt,enum=api.SAFI" json:"Safi,omitempty"`
@@ -1412,6 +1433,17 @@ func (m *ROA) Reset() { *m = ROA{} }
func (m *ROA) String() string { return proto.CompactTextString(m) }
func (*ROA) ProtoMessage() {}
+type Vrf struct {
+ Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
+ Rd []byte `protobuf:"bytes,2,opt,name=rd,proto3" json:"rd,omitempty"`
+ ImportRt [][]byte `protobuf:"bytes,3,rep,name=import_rt,proto3" json:"import_rt,omitempty"`
+ ExportRt [][]byte `protobuf:"bytes,4,rep,name=export_rt,proto3" json:"export_rt,omitempty"`
+}
+
+func (m *Vrf) Reset() { *m = Vrf{} }
+func (m *Vrf) String() string { return proto.CompactTextString(m) }
+func (*Vrf) ProtoMessage() {}
+
func init() {
proto.RegisterEnum("api.Resource", Resource_name, Resource_value)
proto.RegisterEnum("api.Operation", Operation_name, Operation_value)
@@ -1454,6 +1486,9 @@ type GrpcClient interface {
MonitorPeerState(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (Grpc_MonitorPeerStateClient, error)
GetMrt(ctx context.Context, in *MrtArguments, opts ...grpc.CallOption) (Grpc_GetMrtClient, error)
GetRPKI(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (Grpc_GetRPKIClient, error)
+ GetVrfs(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (Grpc_GetVrfsClient, error)
+ GetVrf(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (Grpc_GetVrfClient, error)
+ ModVrf(ctx context.Context, in *ModVrfArguments, opts ...grpc.CallOption) (*Error, error)
}
type grpcClient struct {
@@ -1906,6 +1941,79 @@ func (x *grpcGetRPKIClient) Recv() (*ROA, error) {
return m, nil
}
+func (c *grpcClient) GetVrfs(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (Grpc_GetVrfsClient, error) {
+ stream, err := grpc.NewClientStream(ctx, &_Grpc_serviceDesc.Streams[11], c.cc, "/api.Grpc/GetVrfs", opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &grpcGetVrfsClient{stream}
+ if err := x.ClientStream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type Grpc_GetVrfsClient interface {
+ Recv() (*Vrf, error)
+ grpc.ClientStream
+}
+
+type grpcGetVrfsClient struct {
+ grpc.ClientStream
+}
+
+func (x *grpcGetVrfsClient) Recv() (*Vrf, error) {
+ m := new(Vrf)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func (c *grpcClient) GetVrf(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (Grpc_GetVrfClient, error) {
+ stream, err := grpc.NewClientStream(ctx, &_Grpc_serviceDesc.Streams[12], c.cc, "/api.Grpc/GetVrf", opts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &grpcGetVrfClient{stream}
+ if err := x.ClientStream.SendMsg(in); err != nil {
+ return nil, err
+ }
+ if err := x.ClientStream.CloseSend(); err != nil {
+ return nil, err
+ }
+ return x, nil
+}
+
+type Grpc_GetVrfClient interface {
+ Recv() (*Path, error)
+ grpc.ClientStream
+}
+
+type grpcGetVrfClient struct {
+ grpc.ClientStream
+}
+
+func (x *grpcGetVrfClient) Recv() (*Path, error) {
+ m := new(Path)
+ if err := x.ClientStream.RecvMsg(m); err != nil {
+ return nil, err
+ }
+ return m, nil
+}
+
+func (c *grpcClient) ModVrf(ctx context.Context, in *ModVrfArguments, opts ...grpc.CallOption) (*Error, error) {
+ out := new(Error)
+ err := grpc.Invoke(ctx, "/api.Grpc/ModVrf", in, out, c.cc, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// Server API for Grpc service
type GrpcServer interface {
@@ -1930,6 +2038,9 @@ type GrpcServer interface {
MonitorPeerState(*Arguments, Grpc_MonitorPeerStateServer) error
GetMrt(*MrtArguments, Grpc_GetMrtServer) error
GetRPKI(*Arguments, Grpc_GetRPKIServer) error
+ GetVrfs(*Arguments, Grpc_GetVrfsServer) error
+ GetVrf(*Arguments, Grpc_GetVrfServer) error
+ ModVrf(context.Context, *ModVrfArguments) (*Error, error)
}
func RegisterGrpcServer(s *grpc.Server, srv GrpcServer) {
@@ -2302,6 +2413,60 @@ func (x *grpcGetRPKIServer) Send(m *ROA) error {
return x.ServerStream.SendMsg(m)
}
+func _Grpc_GetVrfs_Handler(srv interface{}, stream grpc.ServerStream) error {
+ m := new(Arguments)
+ if err := stream.RecvMsg(m); err != nil {
+ return err
+ }
+ return srv.(GrpcServer).GetVrfs(m, &grpcGetVrfsServer{stream})
+}
+
+type Grpc_GetVrfsServer interface {
+ Send(*Vrf) error
+ grpc.ServerStream
+}
+
+type grpcGetVrfsServer struct {
+ grpc.ServerStream
+}
+
+func (x *grpcGetVrfsServer) Send(m *Vrf) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func _Grpc_GetVrf_Handler(srv interface{}, stream grpc.ServerStream) error {
+ m := new(Arguments)
+ if err := stream.RecvMsg(m); err != nil {
+ return err
+ }
+ return srv.(GrpcServer).GetVrf(m, &grpcGetVrfServer{stream})
+}
+
+type Grpc_GetVrfServer interface {
+ Send(*Path) error
+ grpc.ServerStream
+}
+
+type grpcGetVrfServer struct {
+ grpc.ServerStream
+}
+
+func (x *grpcGetVrfServer) Send(m *Path) error {
+ return x.ServerStream.SendMsg(m)
+}
+
+func _Grpc_ModVrf_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) {
+ in := new(ModVrfArguments)
+ if err := codec.Unmarshal(buf, in); err != nil {
+ return nil, err
+ }
+ out, err := srv.(GrpcServer).ModVrf(ctx, in)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
var _Grpc_serviceDesc = grpc.ServiceDesc{
ServiceName: "api.Grpc",
HandlerType: (*GrpcServer)(nil),
@@ -2346,6 +2511,10 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{
MethodName: "GetPolicyRoutePolicy",
Handler: _Grpc_GetPolicyRoutePolicy_Handler,
},
+ {
+ MethodName: "ModVrf",
+ Handler: _Grpc_ModVrf_Handler,
+ },
},
Streams: []grpc.StreamDesc{
{
@@ -2405,5 +2574,15 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{
Handler: _Grpc_GetRPKI_Handler,
ServerStreams: true,
},
+ {
+ StreamName: "GetVrfs",
+ Handler: _Grpc_GetVrfs_Handler,
+ ServerStreams: true,
+ },
+ {
+ StreamName: "GetVrf",
+ Handler: _Grpc_GetVrf_Handler,
+ ServerStreams: true,
+ },
},
}
diff --git a/api/gobgp.proto b/api/gobgp.proto
index 92f9fcf5..5e6fc867 100644
--- a/api/gobgp.proto
+++ b/api/gobgp.proto
@@ -41,6 +41,9 @@ service Grpc {
rpc MonitorPeerState(Arguments) returns (stream Peer) {}
rpc GetMrt(MrtArguments) returns (stream MrtMessage) {}
rpc GetRPKI(Arguments) returns (stream ROA) {}
+ rpc GetVrfs(Arguments) returns (stream Vrf) {}
+ rpc GetVrf(Arguments) returns (stream Path) {}
+ rpc ModVrf(ModVrfArguments) returns (Error) {}
}
message Error {
@@ -83,6 +86,11 @@ message MrtArguments {
string neighbor_address = 4;
}
+message ModVrfArguments {
+ Operation operation = 1;
+ Vrf vrf = 2;
+}
+
enum Resource {
GLOBAL = 0;
LOCAL = 1;
@@ -94,6 +102,7 @@ enum Resource {
POLICY_COMMUNITY = 7;
POLICY_ROUTEPOLICY = 8;
POLICY_EXTCOMMUNITY = 9;
+ VRF = 10;
}
enum Operation {
@@ -520,3 +529,10 @@ message ROA {
uint32 maxlen = 3;
string prefix = 4;
}
+
+message Vrf {
+ string name = 1;
+ bytes rd = 2;
+ repeated bytes import_rt = 3;
+ repeated bytes export_rt = 4;
+}