diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-27 20:28:51 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-01-27 20:28:51 +0900 |
commit | a231a9e274fc66d1a7763a4d1d143f0563409c6a (patch) | |
tree | 116bb2e00459d452ee86fbe85e1e6cfec2981e83 /table/path.go | |
parent | 1a96b48b49bb1d38b36aad1c6532e9228c6b27b2 (diff) |
table: fix ipv6 JSON reggression
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'table/path.go')
-rw-r--r-- | table/path.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/table/path.go b/table/path.go index d847dc1d..f6ecf05c 100644 --- a/table/path.go +++ b/table/path.go @@ -290,3 +290,17 @@ func (ipv6p *IPv6Path) String() string { //str = str + fmt.Sprintf(" path attributes: %s, ", ipv6p.getPathAttributeMap()) return str } + +func (ipv6p *IPv6Path) MarshalJSON() ([]byte, error) { + return json.Marshal(struct { + Network string + Nexthop string + Attrs []bgp.PathAttributeInterface + Age float64 + }{ + Network: ipv6p.getPrefix(), + Nexthop: ipv6p.PathDefault.nexthop.String(), + Attrs: ipv6p.PathDefault.getPathAttrs(), + Age: time.Now().Sub(ipv6p.PathDefault.timestamp).Seconds(), + }) +} |