diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-20 00:09:44 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-20 00:09:44 +0900 |
commit | 731f4fa3ea2ea58b1dccdb62eb14a407594c81d8 (patch) | |
tree | 4aa29c89ab7824a66475674b0db9377695ebe812 /config/bgp_configs.go | |
parent | 66ac5a1051267c5d915461a2556ef33e8ac9e670 (diff) |
server: support mrt dump rotation like Quagga
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'config/bgp_configs.go')
-rw-r--r-- | config/bgp_configs.go | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index eda8ce98..104d7d06 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -789,6 +789,39 @@ func (v BmpRouteMonitoringPolicyType) Validate() error { return nil } +// typedef for identity gobgp:mrt-type +type MrtType string + +const ( + MRT_TYPE_UPDATES MrtType = "updates" + MRT_TYPE_TABLE MrtType = "table" +) + +var MrtTypeToIntMap = map[MrtType]int{ + MRT_TYPE_UPDATES: 0, + MRT_TYPE_TABLE: 1, +} + +func (v MrtType) ToInt() int { + i, ok := MrtTypeToIntMap[v] + if !ok { + return -1 + } + return i +} + +var IntToMrtTypeMap = map[int]MrtType{ + 0: MRT_TYPE_UPDATES, + 1: MRT_TYPE_TABLE, +} + +func (v MrtType) Validate() error { + if _, ok := MrtTypeToIntMap[v]; !ok { + return fmt.Errorf("invalid MrtType: %s", v) + } + return nil +} + // typedef for identity gobgp:rpki-validation-result-type type RpkiValidationResultType string @@ -830,8 +863,12 @@ func (v RpkiValidationResultType) Validate() error { //struct for container gobgp:mrt type Mrt struct { + // original -> gobgp:dump-type + DumpType MrtType `mapstructure:"dump-type"` // original -> gobgp:file-name FileName string `mapstructure:"file-name"` + // original -> gobgp:interval + Interval uint64 `mapstructure:"interval"` } //struct for container gobgp:state @@ -2070,8 +2107,8 @@ type Bgp struct { RpkiServers []RpkiServer `mapstructure:"rpki-servers"` // original -> gobgp:bmp-servers BmpServers []BmpServer `mapstructure:"bmp-servers"` - // original -> gobgp:mrt - Mrt Mrt `mapstructure:"mrt"` + // original -> gobgp:mrt-dump + MrtDump []Mrt `mapstructure:"mrt-dump"` } //struct for container bgp-pol:set-ext-community-method |