summaryrefslogtreecommitdiffhomepage
path: root/config/default.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/default.go')
-rw-r--r--config/default.go45
1 files changed, 24 insertions, 21 deletions
diff --git a/config/default.go b/config/default.go
index f0c37f66..cdb37c32 100644
--- a/config/default.go
+++ b/config/default.go
@@ -29,8 +29,8 @@ func SetDefaultConfigValues(md toml.MetaData, bt *Bgp) error {
}
}
- if _, ok := global["Global.AfiSafiList"]; !ok {
- bt.Global.AfiSafiList = []AfiSafi{
+ if _, ok := global["Global.AfiSafis.AfiSafiList"]; !ok {
+ bt.Global.AfiSafis.AfiSafiList = []AfiSafi{
AfiSafi{AfiSafiName: "ipv4-unicast"},
AfiSafi{AfiSafiName: "ipv6-unicast"},
AfiSafi{AfiSafiName: "l3vpn-ipv4-unicast"},
@@ -43,10 +43,10 @@ func SetDefaultConfigValues(md toml.MetaData, bt *Bgp) error {
nidx := 0
for _, key := range md.Keys() {
- if !strings.HasPrefix(key.String(), "NeighborList") {
+ if !strings.HasPrefix(key.String(), "Neighbors.NeighborList") {
continue
}
- if key.String() == "NeighborList" {
+ if key.String() == "Neighbors.NeighborList" {
neighbors = append(neighbors, neighbor{attributes: make(map[string]bool)})
nidx++
} else {
@@ -54,30 +54,33 @@ func SetDefaultConfigValues(md toml.MetaData, bt *Bgp) error {
}
}
for i, n := range neighbors {
- if _, ok := n.attributes["NeighborList.Timers.ConnectRetry"]; !ok {
- bt.NeighborList[i].Timers.HoldTime = float64(DEFAULT_CONNECT_RETRY)
+ neighbor := &bt.Neighbors.NeighborList[i]
+ timerConfig := &neighbor.Timers.TimersConfig
+
+ if _, ok := n.attributes["Neighbors.NeighborList.Timers.TimersConfig.ConnectRetry"]; !ok {
+ timerConfig.HoldTime = float64(DEFAULT_CONNECT_RETRY)
}
- if _, ok := n.attributes["NeighborList.Timers.HoldTime"]; !ok {
- bt.NeighborList[i].Timers.HoldTime = float64(DEFAULT_HOLDTIME)
+ if _, ok := n.attributes["Neighbors.NeighborList.Timers.TimersConfig.HoldTime"]; !ok {
+ timerConfig.HoldTime = float64(DEFAULT_HOLDTIME)
}
- if _, ok := n.attributes["NeighborList.Timers.KeepaliveInterval"]; !ok {
- bt.NeighborList[i].Timers.KeepaliveInterval = bt.NeighborList[i].Timers.HoldTime / 3
+ if _, ok := n.attributes["Neighbors.NeighborList.Timers.TimersConfig.KeepaliveInterval"]; !ok {
+ timerConfig.KeepaliveInterval = timerConfig.HoldTime / 3
}
- if _, ok := n.attributes["NeighborList.Timers.IdleHoldTimeAfterReset"]; !ok {
- bt.NeighborList[i].Timers.IdleHoldTimeAfterReset = float64(DEFAULT_IDLE_HOLDTIME_AFTER_RESET)
+ if _, ok := n.attributes["Neighbors.NeighborList.Timers.TimersConfig.IdleHoldTimeAfterReset"]; !ok {
+ timerConfig.IdleHoldTimeAfterReset = float64(DEFAULT_IDLE_HOLDTIME_AFTER_RESET)
}
- if _, ok := n.attributes["NeighborList.AfiSafiList"]; !ok {
- if bt.NeighborList[i].NeighborAddress.To4() != nil {
- bt.NeighborList[i].AfiSafiList = []AfiSafi{
+ if _, ok := n.attributes["Neighbors.NeighborList.AfiSafis.AfiSafiList"]; !ok {
+ if neighbor.NeighborConfig.NeighborAddress.To4() != nil {
+ neighbor.AfiSafis.AfiSafiList = []AfiSafi{
AfiSafi{AfiSafiName: "ipv4-unicast"}}
} else {
- bt.NeighborList[i].AfiSafiList = []AfiSafi{
+ neighbor.AfiSafis.AfiSafiList = []AfiSafi{
AfiSafi{AfiSafiName: "ipv6-unicast"}}
}
} else {
- for _, rf := range bt.NeighborList[i].AfiSafiList {
+ for _, rf := range neighbor.AfiSafis.AfiSafiList {
_, err := bgp.GetRouteFamily(rf.AfiSafiName)
if err != nil {
return err
@@ -85,11 +88,11 @@ func SetDefaultConfigValues(md toml.MetaData, bt *Bgp) error {
}
}
- if _, ok := n.attributes["NeighborList.PeerType"]; !ok {
- if bt.NeighborList[i].PeerAs != bt.Global.As {
- bt.NeighborList[i].PeerType = PEER_TYPE_EXTERNAL
+ if _, ok := n.attributes["Neighbors.NeighborList.NeighborConfig"]; !ok {
+ if neighbor.NeighborConfig.PeerAs != bt.Global.GlobalConfig.As {
+ neighbor.NeighborConfig.PeerType = PEER_TYPE_EXTERNAL
} else {
- bt.NeighborList[i].PeerType = PEER_TYPE_INTERNAL
+ neighbor.NeighborConfig.PeerType = PEER_TYPE_INTERNAL
}
}
}