diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-08 23:33:49 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-05-08 23:33:49 +0900 |
commit | bff14d64f144c26b87010ecb574d355fdccd70de (patch) | |
tree | aa144beab94833b5b08cfdfae787e8f36f23751b /server/peer.go | |
parent | b36107ef849de13a7ca84948ce41e6d09b222cb3 (diff) |
cli: show configured and negotiated holdtime and keepalive interval
fujita@ubuntu:~/git/gobgp/gobgp$ go run main.go neighbor 10.0.255.1
BGP neighbor is 10.0.255.1, remote AS 65001
BGP version 4, remote router ID 192.168.0.1
BGP state = BGP_FSM_ESTABLISHED, up for 00:11:55
BGP OutQ = 0, Flops = 0
Hold time is 30, keepalive interval is 10 seconds
Configured hold time is 90, keepalive interval is 30 seconds
Neighbor capabilities:
MULTIPROTOCOL: advertised and received
ROUTE_REFRESH: advertised and received
FOUR_OCTET_AS_NUMBER: advertised and received
ROUTE_REFRESH_CISCO: received
Message statistics:
Sent Rcvd
Opens: 1 1
Notifications: 0 0
Updates: 1 1
Keepalives: 72 73
Route Refesh: 0 0
Discarded: 0 0
Total: 74 75
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/peer.go')
-rw-r--r-- | server/peer.go | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/server/peer.go b/server/peer.go index 7af2653e..604be36b 100644 --- a/server/peer.go +++ b/server/peer.go @@ -950,11 +950,13 @@ func (peer *Peer) ToApiStruct() *api.Peer { } conf := &api.PeerConf{ - RemoteIp: c.NeighborAddress.String(), - Id: peer.peerInfo.ID.To4().String(), - RemoteAs: c.PeerAs, - RemoteCap: capList, - LocalCap: []int32{int32(bgp.BGP_CAP_MULTIPROTOCOL), int32(bgp.BGP_CAP_ROUTE_REFRESH), int32(bgp.BGP_CAP_FOUR_OCTET_AS_NUMBER)}, + RemoteIp: c.NeighborAddress.String(), + Id: peer.peerInfo.ID.To4().String(), + RemoteAs: c.PeerAs, + RemoteCap: capList, + LocalCap: []int32{int32(bgp.BGP_CAP_MULTIPROTOCOL), int32(bgp.BGP_CAP_ROUTE_REFRESH), int32(bgp.BGP_CAP_FOUR_OCTET_AS_NUMBER)}, + KeepaliveInterval: uint32(peer.fsm.peerConfig.Timers.KeepaliveInterval), + Holdtime: uint32(peer.fsm.peerConfig.Timers.HoldTime), } s := c.BgpNeighborCommonState @@ -979,6 +981,15 @@ func (peer *Peer) ToApiStruct() *api.Peer { } } + keepalive := uint32(0) + if f.negotiatedHoldTime != 0 { + if f.negotiatedHoldTime < f.peerConfig.Timers.HoldTime { + keepalive = uint32(f.negotiatedHoldTime / 3) + } else { + keepalive = uint32(f.peerConfig.Timers.KeepaliveInterval) + } + } + info := &api.PeerInfo{ BgpState: f.state.String(), AdminState: f.adminState.String(), @@ -1004,6 +1015,8 @@ func (peer *Peer) ToApiStruct() *api.Peer { Advertized: advertized, OutQ: uint32(len(peer.outgoing)), Flops: s.Flops, + NegotiatedHoldtime: uint32(f.negotiatedHoldTime), + KeepaliveInterval: keepalive, } return &api.Peer{ |