summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2017-11-01 14:11:18 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2017-11-03 18:54:04 +0900
commit9f4cd30e34b7aa4db860392b7934d58ec62348a0 (patch)
treea36f2c96c7a30441f300e234b7d118f1643a6142
parent1ce474d8b49a3f880317ed344e5fa6cbea8f1297 (diff)
cli: Accept stacked labels for EVPN macadv route
This patch enables "gobgp" command to accept the stacked labels field in EVPN MAC/IP Advertisement Route. Example: Specify stacked labels in comma separated format $ gobgp global rib -a evpn add macadv aa:bb:cc:dd:ee:ff 10.0.0.1 10 10,20 rd 65001:100 rt 65001:100 Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
-rw-r--r--gobgp/cmd/global.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/gobgp/cmd/global.go b/gobgp/cmd/global.go
index 15379430..f2904e8b 100644
--- a/gobgp/cmd/global.go
+++ b/gobgp/cmd/global.go
@@ -348,9 +348,13 @@ func ParseEvpnMacAdvArgs(args []string) (bgp.AddrPrefixInterface, []string, erro
if err != nil {
return nil, nil, fmt.Errorf("invalid eTag: %s. err: %s", args[2], err)
}
- label, err := strconv.Atoi(args[3])
- if err != nil {
- return nil, nil, fmt.Errorf("invalid label: %s. err: %s", args[3], err)
+ var labels []uint32
+ for _, l := range strings.SplitN(args[3], ",", 2) {
+ label, err := strconv.Atoi(l)
+ if err != nil {
+ return nil, nil, fmt.Errorf("invalid label: %s. err: %s", args[3], err)
+ }
+ labels = append(labels, uint32(label))
}
var rd bgp.RouteDistinguisherInterface
@@ -370,7 +374,7 @@ func ParseEvpnMacAdvArgs(args []string) (bgp.AddrPrefixInterface, []string, erro
MacAddress: mac,
IPAddressLength: uint8(iplen),
IPAddress: ip,
- Labels: []uint32{uint32(label)},
+ Labels: labels,
ETag: uint32(eTag),
}
nlri = bgp.NewEVPNNLRI(bgp.EVPN_ROUTE_TYPE_MAC_IP_ADVERTISEMENT, 0, macIpAdv)