summaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-10-18 13:14:41 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-10-20 10:33:10 +0900
commit16234ccbb3bbd88759012c95efb690aa2eaba542 (patch)
tree1c6cc5caa7a645e60e2049916857c43933aa1854 /server
parentf61709a2a668f093a44badd127e412be8ed14b92 (diff)
cli: support defined-set configuration
prefix-set modification gobgp policy prefix add p0 10.0.0.0/24 10..15 neighbor-set modification gobgp policy neighbor add n0 10.0.0.1 as-path-set modification gobgp policy aspath add a0 '^100_200_300$' community-set modification gobgp policy community add c0 100:100 ext-community-set modification gobgp policy community add e0 rt:100:100 Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server')
-rw-r--r--server/server.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go
index 8867186c..18c2693e 100644
--- a/server/server.go
+++ b/server/server.go
@@ -1638,10 +1638,9 @@ func (server *BgpServer) handleGrpc(grpcReq *GrpcRequest) []*SenderMsg {
}
close(grpcReq.ResponseCh)
case REQ_MOD_DEFINED_SET:
- if err := server.handleGrpcModDefinedSet(grpcReq); err != nil {
- grpcReq.ResponseCh <- &GrpcResponse{
- ResponseErr: err,
- }
+ err := server.handleGrpcModDefinedSet(grpcReq)
+ grpcReq.ResponseCh <- &GrpcResponse{
+ ResponseErr: err,
}
close(grpcReq.ResponseCh)
case REQ_POLICY_ROUTEPOLICY, REQ_POLICY_ROUTEPOLICIES:
@@ -1698,6 +1697,7 @@ func (server *BgpServer) handleGrpcGetDefinedSet(grpcReq *GrpcRequest) error {
if !ok {
return fmt.Errorf("invalid defined-set type: %d", typ)
}
+ found := false
for _, s := range set {
if name != "" && name != s.Name() {
continue
@@ -1705,10 +1705,14 @@ func (server *BgpServer) handleGrpcGetDefinedSet(grpcReq *GrpcRequest) error {
grpcReq.ResponseCh <- &GrpcResponse{
Data: s.ToApiStruct(),
}
+ found = true
if name != "" {
break
}
}
+ if !found {
+ return fmt.Errorf("not found %s", name)
+ }
return nil
}