diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 10:06:47 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2018-11-16 12:23:18 +0900 |
commit | c1bca2555919f9f2a7dd9d13dc3e14a4bf6a589a (patch) | |
tree | 3a19cc12f27f146df079e03a487acea492e8d595 /pkg/server | |
parent | 893dbd5c074c097f0c9921d3131a072011fb7e6a (diff) |
use google/protobuf/timestamp.proto
use google/protobuf/timestamp.proto instead of our own way to
represent time.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'pkg/server')
-rw-r--r-- | pkg/server/grpc_server.go | 8 | ||||
-rw-r--r-- | pkg/server/server.go | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go index 98b28b00..54d4b28d 100644 --- a/pkg/server/grpc_server.go +++ b/pkg/server/grpc_server.go @@ -28,6 +28,7 @@ import ( "time" farm "github.com/dgryski/go-farm" + "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" "github.com/golang/protobuf/ptypes/empty" log "github.com/sirupsen/logrus" @@ -115,10 +116,11 @@ func newValidationFromTableStruct(v *table.Validation) *api.RPKIValidation { func toPathAPI(binNlri []byte, binPattrs [][]byte, anyNlri *any.Any, anyPattrs []*any.Any, path *table.Path, v *table.Validation) *api.Path { nlri := path.GetNlri() + t, _ := ptypes.TimestampProto(path.GetTimestamp()) p := &api.Path{ Nlri: binNlri, Pattrs: binPattrs, - Age: path.GetTimestamp().Unix(), + Age: t, IsWithdraw: path.IsWithdraw, ValidationDetail: newValidationFromTableStruct(v), Family: &api.Family{Afi: api.Family_Afi(nlri.AFI()), Safi: api.Family_Safi(nlri.SAFI())}, @@ -615,8 +617,6 @@ func newNeighborFromAPIStruct(a *api.Peer) (*config.Neighbor, error) { if a.Timers.State != nil { pconf.Timers.State.KeepaliveInterval = float64(a.Timers.State.KeepaliveInterval) pconf.Timers.State.NegotiatedHoldTime = float64(a.Timers.State.NegotiatedHoldTime) - pconf.Timers.State.Uptime = int64(a.Timers.State.Uptime) - pconf.Timers.State.Downtime = int64(a.Timers.State.Downtime) } } if a.RouteReflector != nil { @@ -723,8 +723,6 @@ func newPeerGroupFromAPIStruct(a *api.PeerGroup) (*config.PeerGroup, error) { if a.Timers.State != nil { pconf.Timers.State.KeepaliveInterval = float64(a.Timers.State.KeepaliveInterval) pconf.Timers.State.NegotiatedHoldTime = float64(a.Timers.State.NegotiatedHoldTime) - pconf.Timers.State.Uptime = int64(a.Timers.State.Uptime) - pconf.Timers.State.Downtime = int64(a.Timers.State.Downtime) } } if a.RouteReflector != nil { diff --git a/pkg/server/server.go b/pkg/server/server.go index 256105aa..ce4f3b22 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -3380,8 +3380,8 @@ func (s *BgpServer) ListRpki(ctx context.Context, r *api.ListRpkiRequest, fn fun RemotePort: uint32(r.Config.Port), }, State: &api.RPKIState{ - Uptime: r.State.Uptime, - Downtime: r.State.Downtime, + Uptime: config.ProtoTimestamp(r.State.Uptime), + Downtime: config.ProtoTimestamp(r.State.Downtime), Up: r.State.Up, RecordIpv4: r.State.RecordsV4, RecordIpv6: r.State.RecordsV6, |