diff options
-rw-r--r-- | table/path.go | 12 | ||||
-rw-r--r-- | table/table_manager_test.go | 9 |
2 files changed, 11 insertions, 10 deletions
diff --git a/table/path.go b/table/path.go index d5dbf7f5..a32b0e11 100644 --- a/table/path.go +++ b/table/path.go @@ -92,7 +92,7 @@ func NewBitmap(size int) *Bitmap { type originInfo struct { nlri bgp.AddrPrefixInterface source *PeerInfo - timestamp time.Time + timestamp int64 validation *Validation key string uuid uuid.UUID @@ -165,7 +165,7 @@ func NewPath(source *PeerInfo, nlri bgp.AddrPrefixInterface, isWithdraw bool, pa info: &originInfo{ nlri: nlri, source: source, - timestamp: timestamp, + timestamp: timestamp.Unix(), noImplicitWithdraw: noImplicitWithdraw, }, IsWithdraw: isWithdraw, @@ -315,11 +315,11 @@ func UpdatePathAttrs(global *config.Global, peer *config.Neighbor, info *PeerInf } func (path *Path) GetTimestamp() time.Time { - return path.OriginInfo().timestamp + return time.Unix(path.OriginInfo().timestamp, 0) } func (path *Path) setTimestamp(t time.Time) { - path.OriginInfo().timestamp = t + path.OriginInfo().timestamp = t.Unix() } func (path *Path) IsLocal() bool { @@ -1204,7 +1204,7 @@ func (p *Path) ToGlobal(vrf *Vrf) *Path { default: return p } - path := NewPath(p.OriginInfo().source, nlri, p.IsWithdraw, p.GetPathAttrs(), p.OriginInfo().timestamp, false) + path := NewPath(p.OriginInfo().source, nlri, p.IsWithdraw, p.GetPathAttrs(), p.GetTimestamp(), false) path.SetExtCommunities(vrf.ExportRt, false) path.delPathAttr(bgp.BGP_ATTR_TYPE_NEXT_HOP) path.setPathAttr(bgp.NewPathAttributeMpReachNLRI(nh.String(), []bgp.AddrPrefixInterface{nlri})) @@ -1229,7 +1229,7 @@ func (p *Path) ToLocal() *Path { default: return p } - path := NewPath(p.OriginInfo().source, nlri, p.IsWithdraw, p.GetPathAttrs(), p.OriginInfo().timestamp, false) + path := NewPath(p.OriginInfo().source, nlri, p.IsWithdraw, p.GetPathAttrs(), p.GetTimestamp(), false) path.delPathAttr(bgp.BGP_ATTR_TYPE_EXTENDED_COMMUNITIES) if f == bgp.RF_IPv4_VPN { diff --git a/table/table_manager_test.go b/table/table_manager_test.go index ec979bf6..cde35a4f 100644 --- a/table/table_manager_test.go +++ b/table/table_manager_test.go @@ -17,13 +17,14 @@ package table import ( _ "fmt" - "github.com/osrg/gobgp/packet/bgp" - log "github.com/sirupsen/logrus" - "github.com/stretchr/testify/assert" "net" "os" "testing" "time" + + "github.com/osrg/gobgp/packet/bgp" + log "github.com/sirupsen/logrus" + "github.com/stretchr/testify/assert" ) // process BGPUpdate message @@ -2129,7 +2130,7 @@ func TestProcessBGPUpdate_Timestamp(t *testing.T) { peer := peerR1() pList1 := ProcessMessage(m1, peer, time.Now()) path1 := pList1[0] - t1 := path1.OriginInfo().timestamp + t1 := path1.GetTimestamp() adjRib.Update(pList1) m2 := bgp.NewBGPUpdateMessage(nil, pathAttributes, nlri) |