summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-08-03 11:12:31 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-08-08 14:11:14 +0900
commit2bad24a07764ff413b9222581c282ab12a16fdf1 (patch)
tree7d0fbb3c5df3148a0f35d5711763207a6b48e080
parentf8ee3626e9c9807ac2a5fc5e18e5f63d21fe0b8a (diff)
config/default: Validation for "afi-safi-name"
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r--config/default.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/config/default.go b/config/default.go
index 03a2479c..91194284 100644
--- a/config/default.go
+++ b/config/default.go
@@ -205,17 +205,19 @@ func setDefaultNeighborConfigValuesWithViper(v *viper.Viper, n *Neighbor, asn ui
if err != nil {
return err
}
- for i, af := range n.AfiSafis {
+ for i := range n.AfiSafis {
vv := viper.New()
if len(afs) > i {
vv.Set("afi-safi", afs[i])
}
- af.State.AfiSafiName = af.Config.AfiSafiName
+ if _, err := bgp.GetRouteFamily(string(n.AfiSafis[i].Config.AfiSafiName)); err != nil {
+ return err
+ }
+ n.AfiSafis[i].State.AfiSafiName = n.AfiSafis[i].Config.AfiSafiName
if !vv.IsSet("afi-safi.config.enabled") {
- af.Config.Enabled = true
+ n.AfiSafis[i].Config.Enabled = true
}
- af.MpGracefulRestart.State.Enabled = af.MpGracefulRestart.Config.Enabled
- n.AfiSafis[i] = af
+ n.AfiSafis[i].MpGracefulRestart.State.Enabled = n.AfiSafis[i].MpGracefulRestart.Config.Enabled
}
}