From a231a9e274fc66d1a7763a4d1d143f0563409c6a Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Tue, 27 Jan 2015 20:28:51 +0900 Subject: table: fix ipv6 JSON reggression Signed-off-by: FUJITA Tomonori --- table/path.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'table/path.go') 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(), + }) +} -- cgit v1.2.3