diff options
author | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-02-17 18:03:49 +0900 |
---|---|---|
committer | Hiroshi Yokoi <yokoi.hiroshi@po.ntts.co.jp> | 2015-02-17 18:32:39 +0900 |
commit | d78c81be224e30ef21ec183e6c97000219683b48 (patch) | |
tree | 03adb5e382fcd21420e21c802184df8602d13161 /server/peer_test.go | |
parent | 43038c2e96e8ef7bcf2da145446fcd88c3007338 (diff) |
peer: support hold time 0
Diffstat (limited to 'server/peer_test.go')
-rw-r--r-- | server/peer_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/server/peer_test.go b/server/peer_test.go index 9e406e3e..9aa892dd 100644 --- a/server/peer_test.go +++ b/server/peer_test.go @@ -429,6 +429,34 @@ func TestPeerAdminShutdownReject(t *testing.T) { } +func TestPeerSelectSmallerHoldtime(t *testing.T) { + log.SetLevel(log.DebugLevel) + assert := assert.New(t) + m := NewMockConnection() + + globalConfig := config.GlobalType{} + peerConfig := config.NeighborType{} + peerConfig.PeerAs = 65001 + peerConfig.Timers.KeepaliveInterval = 5 + peer := makePeer(globalConfig, peerConfig) + peer.fsm.opensentHoldTime = 1 + peerConfig.Timers.HoldTime = 5 + peer.t.Go(peer.loop) + + pushPackets := func() { + opn := bgp.NewBGPOpenMessage(65001, 0, "10.0.0.1", []bgp.OptionParameterInterface{}) + o, _ := opn.Serialize() + m.setData(o) + } + go pushPackets() + + waitUntil(assert, bgp.BGP_FSM_ACTIVE, peer, 1000) + peer.acceptedConnCh <- m + waitUntil(assert, bgp.BGP_FSM_OPENCONFIRM, peer, 1000) + + assert.Equal(float64(0), peer.fsm.negotiatedHoldTime) +} + func assertCounter(assert *assert.Assertions, counter config.BgpNeighborCommonStateType) { assert.Equal(uint32(0), counter.OpenIn) assert.Equal(uint32(0), counter.OpenOut) |