summaryrefslogtreecommitdiffhomepage
path: root/api/util.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-07-29 02:46:38 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-08-03 14:18:18 +0900
commit46b21a1725111dff416f483a12171d03359df3bf (patch)
tree07205415b6457c4c6b344c424a0afd197fda8240 /api/util.go
parent28ae39ae03a2d6c6727c82a93172003f5bd99d5d (diff)
mrt: support mrt rib dump of neighbor's local rib
This feature can be used in route-server env. CLI syntax changed like below $ gobgp mrt dump rib global [<interval>] $ gobgp mrt dump rib neighbor <neighbor addr> [<interval>] Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'api/util.go')
-rw-r--r--api/util.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/api/util.go b/api/util.go
index 677d4f6a..d1bd4649 100644
--- a/api/util.go
+++ b/api/util.go
@@ -26,3 +26,23 @@ var AF_RTC *AddressFamily = &AddressFamily{AFI_IP, SAFI_ROUTE_TARGET_CONSTRAINTS
func (lhs *AddressFamily) Equal(rhs *AddressFamily) bool {
return lhs.Afi == rhs.Afi && lhs.Safi == rhs.Safi
}
+
+func (af *AddressFamily) ShortString() string {
+ switch {
+ case af.Equal(AF_IPV4_UC):
+ return "ipv4"
+ case af.Equal(AF_IPV6_UC):
+ return "ipv6"
+ case af.Equal(AF_IPV4_VPN):
+ return "vpnv4"
+ case af.Equal(AF_IPV4_VPN):
+ return "vpnv6"
+ case af.Equal(AF_EVPN):
+ return "evpn"
+ case af.Equal(AF_ENCAP):
+ return "encap"
+ case af.Equal(AF_RTC):
+ return "rtc"
+ }
+ return "unknown"
+}