summaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-27 09:45:42 +0000
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-04-27 10:32:39 +0000
commitf99362e876873ebab5bcfa8a9e88e65200a9bac1 (patch)
treee26599591299f84e7001836694194d19a50356f4 /config
parentf6c70e980d41066df51ce8cf63f2351911391e47 (diff)
config: make listen config struct aligned with open-config model
have config/state container Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r--config/bgp_configs.go61
-rw-r--r--config/default.go8
2 files changed, 34 insertions, 35 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go
index d69995d1..96967bbc 100644
--- a/config/bgp_configs.go
+++ b/config/bgp_configs.go
@@ -2482,32 +2482,6 @@ func (lhs *Neighbor) Equal(rhs *Neighbor) bool {
return true
}
-//struct for container gobgp:listen-config
-type ListenConfig struct {
- // original -> gobgp:port
- Port int32 `mapstructure:"port"`
- // original -> gobgp:local-address
- LocalAddressList []string `mapstructure:"local-address-list"`
-}
-
-func (lhs *ListenConfig) Equal(rhs *ListenConfig) bool {
- if lhs == nil || rhs == nil {
- return false
- }
- if lhs.Port != rhs.Port {
- return false
- }
- if len(lhs.LocalAddressList) != len(rhs.LocalAddressList) {
- return false
- }
- for idx, l := range lhs.LocalAddressList {
- if l != rhs.LocalAddressList[idx] {
- return false
- }
- }
- return true
-}
-
//struct for container gobgp:mpls-label-range
type MplsLabelRange struct {
// original -> gobgp:min-label
@@ -3888,6 +3862,10 @@ type GlobalState struct {
TotalPaths uint32 `mapstructure:"total-paths"`
// original -> bgp-op:total-prefixes
TotalPrefixes uint32 `mapstructure:"total-prefixes"`
+ // original -> gobgp:port
+ Port int32 `mapstructure:"port"`
+ // original -> gobgp:local-address
+ LocalAddressList []string `mapstructure:"local-address-list"`
}
func (lhs *GlobalState) Equal(rhs *GlobalState) bool {
@@ -3906,6 +3884,17 @@ func (lhs *GlobalState) Equal(rhs *GlobalState) bool {
if lhs.TotalPrefixes != rhs.TotalPrefixes {
return false
}
+ if lhs.Port != rhs.Port {
+ return false
+ }
+ if len(lhs.LocalAddressList) != len(rhs.LocalAddressList) {
+ return false
+ }
+ for idx, l := range lhs.LocalAddressList {
+ if l != rhs.LocalAddressList[idx] {
+ return false
+ }
+ }
return true
}
@@ -3917,6 +3906,10 @@ type GlobalConfig struct {
// original -> bgp:router-id
//bgp:router-id's original type is inet:ipv4-address
RouterId string `mapstructure:"router-id"`
+ // original -> gobgp:port
+ Port int32 `mapstructure:"port"`
+ // original -> gobgp:local-address
+ LocalAddressList []string `mapstructure:"local-address-list"`
}
func (lhs *GlobalConfig) Equal(rhs *GlobalConfig) bool {
@@ -3929,6 +3922,17 @@ func (lhs *GlobalConfig) Equal(rhs *GlobalConfig) bool {
if lhs.RouterId != rhs.RouterId {
return false
}
+ if lhs.Port != rhs.Port {
+ return false
+ }
+ if len(lhs.LocalAddressList) != len(rhs.LocalAddressList) {
+ return false
+ }
+ for idx, l := range lhs.LocalAddressList {
+ if l != rhs.LocalAddressList[idx] {
+ return false
+ }
+ }
return true
}
@@ -3956,8 +3960,6 @@ type Global struct {
Zebra Zebra `mapstructure:"zebra"`
// original -> gobgp:mpls-label-range
MplsLabelRange MplsLabelRange `mapstructure:"mpls-label-range"`
- // original -> gobgp:listen-config
- ListenConfig ListenConfig `mapstructure:"listen-config"`
}
func (lhs *Global) Equal(rhs *Global) bool {
@@ -4010,9 +4012,6 @@ func (lhs *Global) Equal(rhs *Global) bool {
if !lhs.MplsLabelRange.Equal(&(rhs.MplsLabelRange)) {
return false
}
- if !lhs.ListenConfig.Equal(&(rhs.ListenConfig)) {
- return false
- }
return true
}
diff --git a/config/default.go b/config/default.go
index 613b0880..e6402ff7 100644
--- a/config/default.go
+++ b/config/default.go
@@ -45,12 +45,12 @@ func SetDefaultConfigValues(v *viper.Viper, b *BgpConfigSet) error {
}
}
- if b.Global.ListenConfig.Port == 0 {
- b.Global.ListenConfig.Port = bgp.BGP_PORT
+ if b.Global.Config.Port == 0 {
+ b.Global.Config.Port = bgp.BGP_PORT
}
- if len(b.Global.ListenConfig.LocalAddressList) == 0 {
- b.Global.ListenConfig.LocalAddressList = []string{"0.0.0.0", "::"}
+ if len(b.Global.Config.LocalAddressList) == 0 {
+ b.Global.Config.LocalAddressList = []string{"0.0.0.0", "::"}
}
for idx, server := range b.BmpServers {