summaryrefslogtreecommitdiffhomepage
path: root/table
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2015-04-04 23:46:01 +0000
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-04-14 08:10:28 +0900
commit75f835725deb42b00d5f746828f2738d15e3bc4f (patch)
tree5294cc59377f51896fd75a57cdb776f5e2f8bf54 /table
parent18bbb843d2e025af8e1ffd33b7c9a09d1a19c565 (diff)
api: use gRPC instead of REST
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table')
-rw-r--r--table/destination.go8
-rw-r--r--table/path.go16
2 files changed, 12 insertions, 12 deletions
diff --git a/table/destination.go b/table/destination.go
index 72350d8a..aae02822 100644
--- a/table/destination.go
+++ b/table/destination.go
@@ -111,7 +111,7 @@ func (dd *DestinationDefault) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Prefix string
Paths []Path
- BestPathIdx int
+ BestPathIdx int `json:"best_path_idx"`
}{
Prefix: prefix.String(),
Paths: dd.knownPathList,
@@ -929,7 +929,7 @@ func (ipv6d *IPv6Destination) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Prefix string
Paths []Path
- BestPathIdx int
+ BestPathIdx int `json:"best_path_idx"`
}{
Prefix: prefix.String(),
Paths: ipv6d.knownPathList,
@@ -985,7 +985,7 @@ func (ipv4vpnd *IPv4VPNDestination) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Prefix string
Paths []Path
- BestPathIdx int
+ BestPathIdx int `json:"best_path_idx"`
}{
Prefix: prefix.String(),
Paths: ipv4vpnd.knownPathList,
@@ -1023,7 +1023,7 @@ func (evpnd *EVPNDestination) MarshalJSON() ([]byte, error) {
return json.Marshal(struct {
Prefix string
Paths []Path
- BestPathIdx int
+ BestPathIdx int `json:"best_path_idx"`
}{
Prefix: nlri.String(),
Paths: evpnd.knownPathList,
diff --git a/table/path.go b/table/path.go
index c7329587..fddde7d3 100644
--- a/table/path.go
+++ b/table/path.go
@@ -175,12 +175,12 @@ func (pd *PathDefault) MarshalJSON() ([]byte, error) {
Network string
Nexthop string
Attrs []bgp.PathAttributeInterface
- Age float64
+ Age int64
}{
Network: pd.getPrefix(),
Nexthop: pd.GetNexthop().String(),
Attrs: pd.getPathAttrs(),
- Age: time.Now().Sub(pd.timestamp).Seconds(),
+ Age: int64(time.Now().Sub(pd.timestamp).Seconds()),
})
}
@@ -399,12 +399,12 @@ func (ipv6p *IPv6Path) MarshalJSON() ([]byte, error) {
Network string
Nexthop string
Attrs []bgp.PathAttributeInterface
- Age float64
+ Age int64
}{
Network: ipv6p.getPrefix(),
Nexthop: ipv6p.PathDefault.GetNexthop().String(),
Attrs: ipv6p.PathDefault.getPathAttrs(),
- Age: time.Now().Sub(ipv6p.PathDefault.timestamp).Seconds(),
+ Age: int64(time.Now().Sub(ipv6p.PathDefault.timestamp).Seconds()),
})
}
@@ -451,12 +451,12 @@ func (ipv4vpnp *IPv4VPNPath) MarshalJSON() ([]byte, error) {
Network string
Nexthop string
Attrs []bgp.PathAttributeInterface
- Age float64
+ Age int64
}{
Network: ipv4vpnp.getPrefix(),
Nexthop: ipv4vpnp.PathDefault.GetNexthop().String(),
Attrs: ipv4vpnp.PathDefault.getPathAttrs(),
- Age: time.Now().Sub(ipv4vpnp.PathDefault.timestamp).Seconds(),
+ Age: int64(time.Now().Sub(ipv4vpnp.PathDefault.timestamp).Seconds()),
})
}
@@ -503,11 +503,11 @@ func (evpnp *EVPNPath) MarshalJSON() ([]byte, error) {
Network string
Nexthop string
Attrs []bgp.PathAttributeInterface
- Age float64
+ Age int64
}{
Network: evpnp.getPrefix(),
Nexthop: evpnp.PathDefault.GetNexthop().String(),
Attrs: evpnp.PathDefault.getPathAttrs(),
- Age: time.Now().Sub(evpnp.PathDefault.timestamp).Seconds(),
+ Age: int64(time.Now().Sub(evpnp.PathDefault.timestamp).Seconds()),
})
}