summaryrefslogtreecommitdiffhomepage
path: root/config
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-03-20 00:09:44 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-03-20 00:09:44 +0900
commit731f4fa3ea2ea58b1dccdb62eb14a407594c81d8 (patch)
tree4aa29c89ab7824a66475674b0db9377695ebe812 /config
parent66ac5a1051267c5d915461a2556ef33e8ac9e670 (diff)
server: support mrt dump rotation like Quagga
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r--config/bgp_configs.go41
-rw-r--r--config/serve.go4
2 files changed, 41 insertions, 4 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
diff --git a/config/serve.go b/config/serve.go
index 9cb3b31e..cb213ed8 100644
--- a/config/serve.go
+++ b/config/serve.go
@@ -30,7 +30,7 @@ func ReadConfigfileServe(path, format string, configCh chan BgpConfigSet) {
Neighbors []Neighbor `mapstructure:"neighbors"`
RpkiServers []RpkiServer `mapstructure:"rpki-servers"`
BmpServers []BmpServer `mapstructure:"bmp-servers"`
- Mrt Mrt `mapstructure:"mrt"`
+ Mrt []Mrt `mapstructure:"mrt"`
DefinedSets DefinedSets `mapstructure:"defined-sets"`
PolicyDefinitions []PolicyDefinition `mapstructure:"policy-definitions"`
}{}
@@ -46,7 +46,7 @@ func ReadConfigfileServe(path, format string, configCh chan BgpConfigSet) {
Neighbors: c.Neighbors,
RpkiServers: c.RpkiServers,
BmpServers: c.BmpServers,
- Mrt: c.Mrt,
+ MrtDump: c.Mrt,
}
err = SetDefaultConfigValues(v, b)
if err != nil {