diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-04 17:05:57 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-08-14 07:51:42 +0900 |
commit | 411bf84633c6a88fa1d08b5238d74b55910cffd1 (patch) | |
tree | e6d9d399bcb82f0245fabe011e0d08ea11b137f0 /config/bgp_configs.go | |
parent | d4b8a858299acc7164f452c8aa4180695252f38e (diff) |
support mrt table dump (TABLE_DUMPv2 format)
Only global rib dumping is supported for now.
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 | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 1636073c..d144b47c 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -1032,17 +1032,19 @@ func (lhs *Zebra) Equal(rhs *Zebra) bool { return true } -//struct for container gobgp:mrt -type Mrt struct { +//struct for container gobgp:config +type MrtConfig 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"` + // original -> gobgp:dump-interval + DumpInterval uint64 `mapstructure:"dump-interval"` + // original -> gobgp:rotation-interval + RotationInterval uint64 `mapstructure:"rotation-interval"` } -func (lhs *Mrt) Equal(rhs *Mrt) bool { +func (lhs *MrtConfig) Equal(rhs *MrtConfig) bool { if lhs == nil || rhs == nil { return false } @@ -1052,7 +1054,27 @@ func (lhs *Mrt) Equal(rhs *Mrt) bool { if lhs.FileName != rhs.FileName { return false } - if lhs.Interval != rhs.Interval { + if lhs.DumpInterval != rhs.DumpInterval { + return false + } + if lhs.RotationInterval != rhs.RotationInterval { + return false + } + return true +} + +//struct for container gobgp:mrt +type Mrt struct { + // original -> gobgp:file-name + // original -> gobgp:mrt-config + Config MrtConfig `mapstructure:"config"` +} + +func (lhs *Mrt) Equal(rhs *Mrt) bool { + if lhs == nil || rhs == nil { + return false + } + if !lhs.Config.Equal(&(rhs.Config)) { return false } return true @@ -4280,10 +4302,10 @@ func (lhs *Bgp) Equal(rhs *Bgp) bool { { lmap := make(map[string]*Mrt) for i, l := range lhs.MrtDump { - lmap[mapkey(i, string(l.FileName))] = &lhs.MrtDump[i] + lmap[mapkey(i, string(l.Config.FileName))] = &lhs.MrtDump[i] } for i, r := range rhs.MrtDump { - if l, y := lmap[mapkey(i, string(r.FileName))]; !y { + if l, y := lmap[mapkey(i, string(r.Config.FileName))]; !y { return false } else if !r.Equal(l) { return false |