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 <[email protected]>
This commit is contained in:
IWASE Yusuke
2017-05-22 13:12:02 +09:00
parent 5bb0738156
commit c37b50a024
5 changed files with 27 additions and 0 deletions
+5
View File
@@ -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
}
+4
View File
@@ -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
}
+11
View File
@@ -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
+2
View File
@@ -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"
+5
View File
@@ -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 {