summaryrefslogtreecommitdiffhomepage
path: root/internal/pkg/config
diff options
context:
space:
mode:
authorJieJhih Jhang <aawer12345tw@yahoo.com.tw>2019-03-23 21:52:06 +0800
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-03-25 20:11:44 +0900
commit80ff3a325cbced352489fa4ea4b570e5f08062ef (patch)
tree86ecd1732490a907cda674b10de71d52c4df42b0 /internal/pkg/config
parenta61191604194e0ab1a4500ba57ecbec5de88b2e3 (diff)
support BMP sysName and sysDescr configuration
Diffstat (limited to 'internal/pkg/config')
-rw-r--r--internal/pkg/config/bgp_configs.go18
-rw-r--r--internal/pkg/config/default.go7
2 files changed, 25 insertions, 0 deletions
diff --git a/internal/pkg/config/bgp_configs.go b/internal/pkg/config/bgp_configs.go
index a49bfe57..f5a8215b 100644
--- a/internal/pkg/config/bgp_configs.go
+++ b/internal/pkg/config/bgp_configs.go
@@ -1394,6 +1394,12 @@ type BmpServerState struct {
// Enable feature for mirroring of received BGP messages
// mainly for debugging purpose.
RouteMirroringEnabled bool `mapstructure:"route-mirroring-enabled" json:"route-mirroring-enabled,omitempty"`
+ // original -> gobgp:sys-name
+ // Reference to the SysName of the BMP server.
+ SysName string `mapstructure:"sys-name" json:"sys-name,omitempty"`
+ // original -> gobgp:sys-descr
+ // Reference to the SysDescr of the BMP server.
+ SysDescr string `mapstructure:"sys-descr" json:"sys-descr,omitempty"`
}
// struct for container gobgp:config.
@@ -1417,6 +1423,12 @@ type BmpServerConfig struct {
// Enable feature for mirroring of received BGP messages
// mainly for debugging purpose.
RouteMirroringEnabled bool `mapstructure:"route-mirroring-enabled" json:"route-mirroring-enabled,omitempty"`
+ // original -> gobgp:sys-name
+ // Reference to the SysName of the BMP server.
+ SysName string `mapstructure:"sys-name" json:"sys-name,omitempty"`
+ // original -> gobgp:sys-descr
+ // Reference to the SysDescr of the BMP server.
+ SysDescr string `mapstructure:"sys-descr" json:"sys-descr,omitempty"`
}
func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool {
@@ -1438,6 +1450,12 @@ func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool {
if lhs.RouteMirroringEnabled != rhs.RouteMirroringEnabled {
return false
}
+ if lhs.SysName != rhs.SysName {
+ return false
+ }
+ if lhs.SysDescr != rhs.SysDescr {
+ return false
+ }
return true
}
diff --git a/internal/pkg/config/default.go b/internal/pkg/config/default.go
index 13e1267c..9bec51be 100644
--- a/internal/pkg/config/default.go
+++ b/internal/pkg/config/default.go
@@ -349,7 +349,14 @@ func setDefaultConfigValuesWithViper(v *viper.Viper, b *BgpConfigSet) error {
return err
}
+ bmpSysPrefix := "Gobgp-R"
for idx, server := range b.BmpServers {
+ if server.Config.SysName == "" {
+ server.Config.SysName = bmpSysPrefix + strconv.Itoa(idx)
+ }
+ if server.Config.SysDescr == "" {
+ server.Config.SysDescr = "Gobgp Version: master"
+ }
if server.Config.Port == 0 {
server.Config.Port = bmp.BMP_DEFAULT_PORT
}