diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-09-23 11:58:53 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-09-25 18:17:06 +0900 |
commit | 8adeda1ad84b61090f6f46509e8a0eef5e4fec77 (patch) | |
tree | 760fa8030313b374cc9c56239f3817ec84fc0824 /config | |
parent | 92bfac20656fc30fb767bfbabf333671aa7a77f8 (diff) |
config: add mpls label range configuration
you can specify mpls label range from which gobgpd automatically assign to
vpn routes like below
```
[Global]
As = 65000
RouterId = "192.168.255.1"
[Global.MplsLabelRange]
MinLabel = 1000
MaxLabel = 1999
```
default values (min:16000, max:1048575) is taken from cisco ios xr.
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'config')
-rw-r--r-- | config/bgp_configs.go | 10 | ||||
-rw-r--r-- | config/default.go | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index cd8df79d..ae19a162 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -791,6 +791,14 @@ type Neighbors struct { NeighborList []Neighbor } +//struct for container gobgp:mpls-label-range +type MplsLabelRange struct { + // original -> gobgp:min-label + MinLabel uint32 + // original -> gobgp:max-label + MaxLabel uint32 +} + //struct for container gobgp:zebra type Zebra struct { // original -> gobgp:enabled @@ -1346,6 +1354,8 @@ type Global struct { Mrt Mrt // original -> gobgp:zebra Zebra Zebra + // original -> gobgp:mpls-label-range + MplsLabelRange MplsLabelRange } //struct for container bgp:bgp diff --git a/config/default.go b/config/default.go index d3160989..2170e0dd 100644 --- a/config/default.go +++ b/config/default.go @@ -10,6 +10,8 @@ const ( DEFAULT_HOLDTIME = 90 DEFAULT_IDLE_HOLDTIME_AFTER_RESET = 30 DEFAULT_CONNECT_RETRY = 120 + DEFAULT_MPLS_LABEL_MIN = 16000 + DEFAULT_MPLS_LABEL_MAX = 1048575 ) type neighbor struct { @@ -45,6 +47,14 @@ func SetDefaultConfigValues(md toml.MetaData, bt *Bgp) error { } } + if _, ok := global["Global.MplsLabelRange.MinLabel"]; !ok { + bt.Global.MplsLabelRange.MinLabel = DEFAULT_MPLS_LABEL_MIN + } + + if _, ok := global["Global.MplsLabelRange.MaxLabel"]; !ok { + bt.Global.MplsLabelRange.MaxLabel = DEFAULT_MPLS_LABEL_MAX + } + nidx := 0 for _, key := range md.Keys() { if !strings.HasPrefix(key.String(), "Neighbors.NeighborList") { |