diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-03-11 15:32:39 +0000 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-20 22:26:54 +0900 |
commit | c9ec21fe3250551b0e02fa4c7dcf776996aa2af2 (patch) | |
tree | 20411019000de398b5e94b7e017240c0b5e705f5 | |
parent | 444d48662ea7b2f8dcd56a5590d7b820552ad21a (diff) |
config: add 'Global.AfiSafiList' default value
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | config/default.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/config/default.go b/config/default.go index 5820ef01..103a8084 100644 --- a/config/default.go +++ b/config/default.go @@ -17,6 +17,23 @@ type neighbor struct { func SetDefaultConfigValues(md toml.MetaData, bt *Bgp) error { neighbors := []neighbor{} + global := make(map[string]bool) + + for _, key := range md.Keys() { + if !strings.HasPrefix(key.String(), "Global") { + continue + } + if key.String() != "Global" { + global[key.String()] = true + } + } + + if _, ok := global["Global.AfiSafiList"]; !ok { + bt.Global.AfiSafiList = []AfiSafi{ + AfiSafi{AfiSafiName: "ipv4-unicast"}, + AfiSafi{AfiSafiName: "ipv6-unicast"}, + } + } nidx := 0 for _, key := range md.Keys() { |