summaryrefslogtreecommitdiffhomepage
path: root/api
diff options
context:
space:
mode:
authorkishiguro <ishi@hash-set.com>2016-11-29 16:26:07 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-12-04 19:41:41 -0800
commit499a5fd6c30d8c53284a0669dfd11e201dfda679 (patch)
tree5c7fc237a99bad0e523e92c936e435dbda24459d /api
parente4a4b3e382f120e672c27ca08abafcb1bc464825 (diff)
client: AddNeighbor API doesn't include apply-policy information
Diffstat (limited to 'api')
-rw-r--r--api/grpc_server.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/api/grpc_server.go b/api/grpc_server.go
index 51a80bff..264279be 100644
--- a/api/grpc_server.go
+++ b/api/grpc_server.go
@@ -95,6 +95,31 @@ func NewPeerFromConfigStruct(pconf *config.Neighbor) *Peer {
families = append(families, uint32(family))
}
}
+ applyPolicy := &ApplyPolicy{}
+ if len(pconf.ApplyPolicy.Config.ImportPolicyList) != 0 {
+ applyPolicy.ImportPolicy = &PolicyAssignment{
+ Type: PolicyType_IMPORT,
+ }
+ for _, pname := range pconf.ApplyPolicy.Config.ImportPolicyList {
+ applyPolicy.ImportPolicy.Policies = append(applyPolicy.ImportPolicy.Policies, &Policy{Name: pname})
+ }
+ }
+ if len(pconf.ApplyPolicy.Config.ExportPolicyList) != 0 {
+ applyPolicy.ExportPolicy = &PolicyAssignment{
+ Type: PolicyType_EXPORT,
+ }
+ for _, pname := range pconf.ApplyPolicy.Config.ExportPolicyList {
+ applyPolicy.ExportPolicy.Policies = append(applyPolicy.ExportPolicy.Policies, &Policy{Name: pname})
+ }
+ }
+ if len(pconf.ApplyPolicy.Config.InPolicyList) != 0 {
+ applyPolicy.InPolicy = &PolicyAssignment{
+ Type: PolicyType_IN,
+ }
+ for _, pname := range pconf.ApplyPolicy.Config.InPolicyList {
+ applyPolicy.InPolicy.Policies = append(applyPolicy.InPolicy.Policies, &Policy{Name: pname})
+ }
+ }
prefixLimits := make([]*PrefixLimit, 0, len(pconf.AfiSafis))
for _, family := range pconf.AfiSafis {
if c := family.PrefixLimit.Config; c.MaxPrefixes > 0 {
@@ -123,7 +148,8 @@ func NewPeerFromConfigStruct(pconf *config.Neighbor) *Peer {
localCap = append(localCap, c)
}
return &Peer{
- Families: families,
+ Families: families,
+ ApplyPolicy: applyPolicy,
Conf: &PeerConf{
NeighborAddress: pconf.Config.NeighborAddress,
Id: s.RemoteRouterId,