From aff1c244ad0d88a814f2ce573800717ccd08b450 Mon Sep 17 00:00:00 2001 From: ISHIDA Wataru Date: Wed, 30 Dec 2015 20:50:27 +0900 Subject: bmp: use watcher infra to implement bmp feature Signed-off-by: ISHIDA Wataru --- config/bgp_configs.go | 56 +++++++++++++++++++++++++-------------------------- config/default.go | 4 ++-- 2 files changed, 30 insertions(+), 30 deletions(-) (limited to 'config') diff --git a/config/bgp_configs.go b/config/bgp_configs.go index d5f6975d..24fc2535 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -443,32 +443,6 @@ func (v RpkiValidationResultType) Validate() error { return nil } -//struct for container gobgp:state -type BmpServerState struct { -} - -//struct for container gobgp:config -type BmpServerConfig struct { - // original -> gobgp:address - //gobgp:address's original type is inet:ip-address - Address string `mapstructure:"address"` - // original -> gobgp:port - Port uint32 `mapstructure:"port"` - // original -> gobgp:route-monitoring-policy - RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy"` -} - -//struct for container gobgp:bmp-server -type BmpServer struct { - // original -> gobgp:address - //gobgp:address's original type is inet:ip-address - Address string `mapstructure:"address"` - // original -> gobgp:bmp-server-config - Config BmpServerConfig `mapstructure:"config"` - // original -> gobgp:bmp-server-state - State BmpServerState `mapstructure:"state"` -} - //struct for container gobgp:rpki-received type RpkiReceived struct { // original -> gobgp:serial-notify @@ -1119,6 +1093,32 @@ type Mrt struct { FileName string `mapstructure:"file-name"` } +//struct for container gobgp:state +type BmpServerState struct { +} + +//struct for container gobgp:config +type BmpServerConfig struct { + // original -> gobgp:address + //gobgp:address's original type is inet:ip-address + Address string `mapstructure:"address"` + // original -> gobgp:port + Port uint32 `mapstructure:"port"` + // original -> gobgp:route-monitoring-policy + RouteMonitoringPolicy BmpRouteMonitoringPolicyType `mapstructure:"route-monitoring-policy"` +} + +//struct for container gobgp:bmp-server +type BmpServer struct { + // original -> gobgp:address + //gobgp:address's original type is inet:ip-address + Address string `mapstructure:"address"` + // original -> gobgp:bmp-server-config + Config BmpServerConfig `mapstructure:"config"` + // original -> gobgp:bmp-server-state + State BmpServerState `mapstructure:"state"` +} + //struct for container bgp-mp:l2vpn-evpn type L2vpnEvpn struct { // original -> bgp-mp:prefix-limit @@ -1649,6 +1649,8 @@ type Global struct { AfiSafis []AfiSafi `mapstructure:"afi-safis"` // original -> rpol:apply-policy ApplyPolicy ApplyPolicy `mapstructure:"apply-policy"` + // original -> gobgp:bmp-servers + BmpServers []BmpServer `mapstructure:"bmp-servers"` // original -> gobgp:mrt Mrt Mrt `mapstructure:"mrt"` // original -> gobgp:zebra @@ -1669,8 +1671,6 @@ type Bgp struct { PeerGroups []PeerGroup `mapstructure:"peer-groups"` // original -> gobgp:rpki-servers RpkiServers []RpkiServer `mapstructure:"rpki-servers"` - // original -> gobgp:bmp-servers - BmpServers []BmpServer `mapstructure:"bmp-servers"` } //struct for container bgp-pol:set-ext-community-method diff --git a/config/default.go b/config/default.go index 82a17446..c0764c44 100644 --- a/config/default.go +++ b/config/default.go @@ -39,11 +39,11 @@ func SetDefaultConfigValues(v *viper.Viper, b *Bgp) error { b.Global.ListenConfig.Port = bgp.BGP_PORT } - for idx, server := range b.BmpServers { + for idx, server := range b.Global.BmpServers { if server.Config.Port == 0 { server.Config.Port = bgp.BMP_DEFAULT_PORT } - b.BmpServers[idx] = server + b.Global.BmpServers[idx] = server } if !v.IsSet("global.mpls-label-range.min-label") { -- cgit v1.2.3