diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-23 16:19:04 -0800 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2014-12-23 16:19:04 -0800 |
commit | c66c6b3b0469346c4ce05354552be2dec1e46ffa (patch) | |
tree | 28ce5f50a10aa3df9485089e4df793fe28e21a14 | |
parent | b644f6b6bf6ef5c833f549664d45ff96ba962308 (diff) |
server: update Uptime and UpdateRecvTime
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | config/bgp_configs.go | 2 | ||||
-rw-r--r-- | server/peer.go | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/config/bgp_configs.go b/config/bgp_configs.go index 14d07fe9..be489e52 100644 --- a/config/bgp_configs.go +++ b/config/bgp_configs.go @@ -378,7 +378,7 @@ type BgpNeighborCommonStateType struct { // peer-state State uint32 // peer-uptime - Uptime uint64 + Uptime time.Time // BGP statistics // Open message input count diff --git a/server/peer.go b/server/peer.go index 23df06d9..5c26fc18 100644 --- a/server/peer.go +++ b/server/peer.go @@ -23,6 +23,7 @@ import ( "github.com/osrg/gobgp/table" "gopkg.in/tomb.v2" "net" + "time" ) type Peer struct { @@ -68,6 +69,7 @@ func (peer *Peer) handleBGPmessage(m *bgp.BGPMessage) { pathList := peer.adjRib.GetOutPathList(table.RF_IPv4_UC) peer.sendMessages(peer.path2update(pathList)) case bgp.BGP_MSG_UPDATE: + peer.peerConfig.BgpNeighborCommonState.UpdateRecvTime = time.Now() msg := table.NewProcessMessage(m, peer.fsm.peerInfo) pathList := msg.ToPathList() if len(pathList) == 0 { @@ -142,6 +144,7 @@ func (peer *Peer) loop() error { if nextState == bgp.BGP_FSM_ESTABLISHED { pathList := peer.adjRib.GetOutPathList(table.RF_IPv4_UC) peer.sendMessages(peer.path2update(pathList)) + peer.peerConfig.BgpNeighborCommonState.Uptime = time.Now() peer.peerConfig.BgpNeighborCommonState.EstablishedCount++ } if oldState == bgp.BGP_FSM_ESTABLISHED { |