diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-05-17 14:29:51 +0900 |
---|---|---|
committer | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-05-22 13:12:02 +0900 |
commit | c37b50a024f4b90edf390b3f60d3df0f6c1901e2 (patch) | |
tree | c0725435f63340dda7944f9f5d1d1ff3c43164b2 /config | |
parent | 5bb073815657d605c77376a51e6219a593eb7af6 (diff) |
config: Add interval seconds for BMP stats reports
This patch suppose the default interval of the BMP stats reports is
0 which disable this feature and the range of this interval is 15
though 65535 seconds to follow Junos OS configuration.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/bgp_configs.go | 5 | ||||
-rw-r--r-- | config/default.go | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 848b21b7..9deb98dd 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -1169,6 +1169,8 @@ type BmpServerConfig struct { Port uint32 `mapstructure:"port" json:"port,omitempty"` // original -> gobgp:route-monitoring-policy RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy" json:"route-monitoring-policy,omitempty"` + // original -> gobgp:statistics-timeout + StatisticsTimeout uint16 `mapstructure:"statistics-timeout" json:"statistics-timeout,omitempty"` } func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool { @@ -1184,6 +1186,9 @@ func (lhs *BmpServerConfig) Equal(rhs *BmpServerConfig) bool { if lhs.RouteMonitoringPolicy != rhs.RouteMonitoringPolicy { return false } + if lhs.StatisticsTimeout != rhs.StatisticsTimeout { + return false + } return true } diff --git a/config/default.go b/config/default.go index cafe19ae..7587fad8 100644 --- a/config/default.go +++ b/config/default.go @@ -267,6 +267,10 @@ func setDefaultConfigValuesWithViper(v *viper.Viper, b *BgpConfigSet) error { if server.Config.Port == 0 { server.Config.Port = bmp.BMP_DEFAULT_PORT } + // statistics-timeout is uint16 value and implicitly less than 65536 + if server.Config.StatisticsTimeout != 0 && server.Config.StatisticsTimeout < 15 { + return fmt.Errorf("too small statistics-timeout value: %d", server.Config.StatisticsTimeout) + } b.BmpServers[idx] = server } |