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 | |
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>
-rw-r--r-- | config/bgp_configs.go | 5 | ||||
-rw-r--r-- | config/default.go | 4 | ||||
-rw-r--r-- | docs/sources/bmp.md | 11 | ||||
-rw-r--r-- | docs/sources/configuration.md | 2 | ||||
-rw-r--r-- | tools/pyang_plugins/gobgp.yang | 5 |
5 files changed, 27 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 } diff --git a/docs/sources/bmp.md b/docs/sources/bmp.md index 574a23d9..e6f6e2bb 100644 --- a/docs/sources/bmp.md +++ b/docs/sources/bmp.md @@ -52,6 +52,17 @@ Enable all policies support as follows: route-monitoring-policy = "all" ``` +To enable BMP stats reports, specify the interval seconds to send statistics messages. +The default value is 0 and no statistics messages are sent. +Please note the range of this interval is 15 though 65535 seconds. + +```toml +[[bmp-servers]] + [bmp-servers.config] + address = "127.0.0.1" + port=11019 + statistics-timeout = 3600 +``` ## <a name="verify"> Verification diff --git a/docs/sources/configuration.md b/docs/sources/configuration.md index c00b04fa..7403834c 100644 --- a/docs/sources/configuration.md +++ b/docs/sources/configuration.md @@ -30,6 +30,8 @@ [bmp-servers.config] address = "127.0.0.1" port = 11019 + route-monitoring-policy = "pre-policy" + statistics-timeout = 3600 [[mrt-dump]] dump-type = "updates" diff --git a/tools/pyang_plugins/gobgp.yang b/tools/pyang_plugins/gobgp.yang index 47f34540..b9bd5f6c 100644 --- a/tools/pyang_plugins/gobgp.yang +++ b/tools/pyang_plugins/gobgp.yang @@ -553,6 +553,11 @@ module gobgp { type bmp-route-monitoring-policy-type; default PRE-POLICY; } + leaf statistics-timeout { + type uint16; + description + "Interval seconds of statistics messages sent to BMP server"; + } } grouping gobgp-bmp-server-state { |