summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
authorWataru Ishida <ishida.wataru@lab.ntt.co.jp>2017-05-05 11:19:40 -0400
committerWataru Ishida <ishida.wataru@lab.ntt.co.jp>2017-05-10 08:05:47 +0000
commit1f053c25c423c79471fbe1d5fb6c618bb67409df (patch)
treeba3c43da6df3e1163a754ff742f25a64d819d6e2 /api/grpc_server.go
parent540d77319c6eaa1eefd7b52df2a4771c7ee565ac (diff)
*: support remove private as
cli ``` $ gobgp n add <neighbor-addr> as <asn> remove-private-as (all|replace) ``` config ``` neighbor: config: peer-as: <asn> neighbor-address: <neighbor-addr> remove-private-as: all ``` Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api/grpc_server.go')
-rw-r--r--api/grpc_server.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go
index 15dde9ef..e1a21f49 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -144,6 +144,13 @@ func NewPeerFromConfigStruct(pconf *config.Neighbor) *Peer {
c, _ := cap.Serialize()
localCap = append(localCap, c)
}
+ var removePrivateAs PeerConf_RemovePrivateAs
+ switch pconf.Config.RemovePrivateAs {
+ case config.REMOVE_PRIVATE_AS_OPTION_ALL:
+ removePrivateAs = PeerConf_ALL
+ case config.REMOVE_PRIVATE_AS_OPTION_REPLACE:
+ removePrivateAs = PeerConf_REPLACE
+ }
return &Peer{
Families: families,
ApplyPolicy: applyPolicy,
@@ -164,6 +171,7 @@ func NewPeerFromConfigStruct(pconf *config.Neighbor) *Peer {
NeighborInterface: pconf.Config.NeighborInterface,
Vrf: pconf.Config.Vrf,
AllowOwnAs: uint32(pconf.AsPathOptions.Config.AllowOwnAs),
+ RemovePrivateAs: removePrivateAs,
},
Info: &PeerState{
BgpState: string(s.SessionState),
@@ -857,6 +865,13 @@ func NewNeighborFromAPIStruct(a *Peer) (*config.Neighbor, error) {
pconf.Config.Vrf = a.Conf.Vrf
pconf.AsPathOptions.Config.AllowOwnAs = uint8(a.Conf.AllowOwnAs)
+ switch a.Conf.RemovePrivateAs {
+ case PeerConf_ALL:
+ pconf.Config.RemovePrivateAs = config.REMOVE_PRIVATE_AS_OPTION_ALL
+ case PeerConf_REPLACE:
+ pconf.Config.RemovePrivateAs = config.REMOVE_PRIVATE_AS_OPTION_REPLACE
+ }
+
f := func(bufs [][]byte) ([]bgp.ParameterCapabilityInterface, error) {
var caps []bgp.ParameterCapabilityInterface
for _, buf := range bufs {