diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-08-03 11:12:31 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-08-08 14:11:14 +0900 |
commit | 2bad24a07764ff413b9222581c282ab12a16fdf1 (patch) | |
tree | 7d0fbb3c5df3148a0f35d5711763207a6b48e080 /config | |
parent | f8ee3626e9c9807ac2a5fc5e18e5f63d21fe0b8a (diff) |
config/default: Validation for "afi-safi-name"
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/default.go | 12 |
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 } } |