summaryrefslogtreecommitdiffhomepage
path: root/api/grpc_server.go
diff options
context:
space:
mode:
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 {