summaryrefslogtreecommitdiffhomepage
path: root/packet
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-05 20:06:28 -0800
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-01-05 20:06:28 -0800
commitb2c5151fe6a197d77cee700c95fb8c0ba616b5fe (patch)
tree4a9fc8ad84248a38081ab874ff3311b0d8f218cc /packet
parentb896584828aaf7f6287842f34dc37f15c0cde1b8 (diff)
cli: improve rib presentation
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'packet')
-rw-r--r--packet/bgp.go28
1 files changed, 2 insertions, 26 deletions
diff --git a/packet/bgp.go b/packet/bgp.go
index 527ebb7a..f7427973 100644
--- a/packet/bgp.go
+++ b/packet/bgp.go
@@ -1554,36 +1554,12 @@ func (p *PathAttributeCommunities) Serialize() ([]byte, error) {
}
func (p *PathAttributeCommunities) MarshalJSON() ([]byte, error) {
- wellKnown := map[uint32]string{
- 0xffff0000: "planned-shut",
- 0xffff0001: "accept-own",
- 0xffff0002: "ROUTE_FILTER_TRANSLATED_v4",
- 0xffff0003: "ROUTE_FILTER_v4",
- 0xffff0004: "ROUTE_FILTER_TRANSLATED_v6",
- 0xffff0005: "ROUTE_FILTER_v6",
- 0xffff0006: "LLGR_STALE",
- 0xffff0007: "NO_LLGR",
- 0xFFFFFF01: "NO_EXPORT",
- 0xFFFFFF02: "NO_ADVERTISE",
- 0xFFFFFF03: "NO_EXPORT_SUBCONFED",
- 0xFFFFFF04: "NOPEER"}
-
- l := make([]string, len(p.Value))
- for i, v := range p.Value {
- s, found := wellKnown[v]
- if found {
- l[i] = s
- } else {
- l[i] = fmt.Sprintf("%d:%d", (v&0xffff0000)>>16, v&0xffff)
- }
- }
-
return json.Marshal(struct {
Type string
- Value []string
+ Value []uint32
}{
Type: p.Type.String(),
- Value: l,
+ Value: p.Value,
})
}