diff options
author | Naoto Hanaue <hanaue.naoto@po.ntts.co.jp> | 2015-05-12 19:50:57 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-19 16:33:16 +0900 |
commit | 0349e0d69926a6cb16467fcd88edf69cbd0f524e (patch) | |
tree | e9e1ce9e4ee9313e7494d9cfb02b7806f83dd77b /api | |
parent | 77eaf6a051f7272a3217ab199f53aa3fc9d546a6 (diff) |
cli: add the show command for routing policy of neighbor
% gobgp -u 10.0.255.1 neighbor 10.0.0.3 policy
DefaultImportPolicy: ACCEPT
DefaultImportPolicy: ACCEPT
ImportPolicies:
PolicyName policy0:
StatementName st0:
Conditions:
PrefixSet: ps0 192.168.0.0/16 16..24
NeighborSet: ns0 10.0.0.2
MatchOption: ALL
Actions:
REJECT
PolicyName policy5:
ExportPolicies:
PolicyName policy1:
StatementName st1:
Conditions:
PrefixSet: ps1 192.168.20.0/24
192.168.200.0/24
NeighborSet: ns0 10.0.0.2
MatchOption: ALL
Actions:
REJECT
Diffstat (limited to 'api')
-rw-r--r-- | api/gobgp.pb.go | 53 | ||||
-rw-r--r-- | api/gobgp.proto | 10 |
2 files changed, 62 insertions, 1 deletions
diff --git a/api/gobgp.pb.go b/api/gobgp.pb.go index 8a54a2c7..2d8767a8 100644 --- a/api/gobgp.pb.go +++ b/api/gobgp.pb.go @@ -40,6 +40,7 @@ It has these top-level messages: Statement PolicyDefinition RoutingPolicy + ApplyPolicy */ package api @@ -1062,6 +1063,31 @@ func (m *RoutingPolicy) GetPolicyDifinition() []*PolicyDefinition { return nil } +type ApplyPolicy struct { + ImportPolicies []*PolicyDefinition `protobuf:"bytes,1,rep,name=import_policies" json:"import_policies,omitempty"` + DefaultImportPolicy int64 `protobuf:"varint,2,opt,name=default_import_policy" json:"default_import_policy,omitempty"` + ExportPolicies []*PolicyDefinition `protobuf:"bytes,3,rep,name=export_policies" json:"export_policies,omitempty"` + DefaultExportPolicy int64 `protobuf:"varint,4,opt,name=default_export_policy" json:"default_export_policy,omitempty"` +} + +func (m *ApplyPolicy) Reset() { *m = ApplyPolicy{} } +func (m *ApplyPolicy) String() string { return proto.CompactTextString(m) } +func (*ApplyPolicy) ProtoMessage() {} + +func (m *ApplyPolicy) GetImportPolicies() []*PolicyDefinition { + if m != nil { + return m.ImportPolicies + } + return nil +} + +func (m *ApplyPolicy) GetExportPolicies() []*PolicyDefinition { + if m != nil { + return m.ExportPolicies + } + return nil +} + func init() { proto.RegisterEnum("api.Resource", Resource_name, Resource_value) proto.RegisterEnum("api.Operation", Operation_name, Operation_value) @@ -1093,6 +1119,7 @@ type GrpcClient interface { 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, opts ...grpc.CallOption) (Grpc_ModPathClient, error) + GetNeighborPolicy(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (*ApplyPolicy, error) GetPolicyPrefixes(ctx context.Context, in *PolicyArguments, opts ...grpc.CallOption) (Grpc_GetPolicyPrefixesClient, error) GetPolicyPrefix(ctx context.Context, in *PolicyArguments, opts ...grpc.CallOption) (*PrefixSet, error) ModPolicyPrefix(ctx context.Context, opts ...grpc.CallOption) (Grpc_ModPolicyPrefixClient, error) @@ -1309,6 +1336,15 @@ func (x *grpcModPathClient) Recv() (*Error, error) { return m, nil } +func (c *grpcClient) GetNeighborPolicy(ctx context.Context, in *Arguments, opts ...grpc.CallOption) (*ApplyPolicy, error) { + out := new(ApplyPolicy) + err := grpc.Invoke(ctx, "/api.Grpc/GetNeighborPolicy", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *grpcClient) GetPolicyPrefixes(ctx context.Context, in *PolicyArguments, opts ...grpc.CallOption) (Grpc_GetPolicyPrefixesClient, error) { stream, err := grpc.NewClientStream(ctx, &_Grpc_serviceDesc.Streams[4], c.cc, "/api.Grpc/GetPolicyPrefixes", opts...) if err != nil { @@ -1478,6 +1514,7 @@ type GrpcServer interface { Enable(context.Context, *Arguments) (*Error, error) Disable(context.Context, *Arguments) (*Error, error) ModPath(Grpc_ModPathServer) error + GetNeighborPolicy(context.Context, *Arguments) (*ApplyPolicy, error) GetPolicyPrefixes(*PolicyArguments, Grpc_GetPolicyPrefixesServer) error GetPolicyPrefix(context.Context, *PolicyArguments) (*PrefixSet, error) ModPolicyPrefix(Grpc_ModPolicyPrefixServer) error @@ -1676,6 +1713,18 @@ func (x *grpcModPathServer) Recv() (*ModPathArguments, error) { return m, nil } +func _Grpc_GetNeighborPolicy_Handler(srv interface{}, ctx context.Context, codec grpc.Codec, buf []byte) (interface{}, error) { + in := new(Arguments) + if err := codec.Unmarshal(buf, in); err != nil { + return nil, err + } + out, err := srv.(GrpcServer).GetNeighborPolicy(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + func _Grpc_GetPolicyPrefixes_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(PolicyArguments) if err := stream.RecvMsg(m); err != nil { @@ -1838,6 +1887,10 @@ var _Grpc_serviceDesc = grpc.ServiceDesc{ Handler: _Grpc_Disable_Handler, }, { + MethodName: "GetNeighborPolicy", + Handler: _Grpc_GetNeighborPolicy_Handler, + }, + { MethodName: "GetPolicyPrefix", Handler: _Grpc_GetPolicyPrefix_Handler, }, diff --git a/api/gobgp.proto b/api/gobgp.proto index 98a72228..362c619a 100644 --- a/api/gobgp.proto +++ b/api/gobgp.proto @@ -32,6 +32,7 @@ service Grpc { rpc Enable(Arguments) returns (Error) {} rpc Disable(Arguments) returns (Error) {} rpc ModPath(stream ModPathArguments) returns (stream Error) {} + rpc GetNeighborPolicy(Arguments) returns (ApplyPolicy) {} rpc GetPolicyPrefixes(PolicyArguments) returns (stream PrefixSet) {} rpc GetPolicyPrefix(PolicyArguments) returns (PrefixSet) {} rpc ModPolicyPrefix(stream PolicyArguments) returns (stream Error) {} @@ -382,7 +383,7 @@ message Statement { Actions actions = 3; } -message PolicyDefinition{ +message PolicyDefinition { string policy_definition_name = 1; repeated Statement statement_list = 2; } @@ -390,3 +391,10 @@ message PolicyDefinition{ message RoutingPolicy { repeated PolicyDefinition policy_difinition = 1; } + +message ApplyPolicy { + repeated PolicyDefinition import_policies = 1; + int64 default_import_policy = 2; + repeated PolicyDefinition export_policies = 3; + int64 default_export_policy = 4; +}
\ No newline at end of file |