MCPcopy
hub / github.com/osrg/gobgp / TestRTCDeferralTimerStaleProtection

Function TestRTCDeferralTimerStaleProtection

pkg/server/server_test.go:3989–4136  ·  view source on GitHub ↗

Test to verify that stale RTC deferral timers are properly ignored when peer reconnects before timer expiration

(t *testing.T)

Source from the content-addressed store, hash-verified

3987// Test to verify that stale RTC deferral timers are properly ignored
3988// when peer reconnects before timer expiration
3989func TestRTCDeferralTimerStaleProtection(t *testing.T) {
3990 const (
3991 asn = 65001
3992 holdTime = 90
3993 peerAddr = "10.0.0.1"
3994 deferralTime = 2
3995 )
3996
3997 ctx := context.Background()
3998
3999 s := NewBgpServer()
4000 go s.Serve()
4001
4002 err := s.StartBgp(ctx, &api.StartBgpRequest{
4003 Global: &api.Global{
4004 Asn: asn,
4005 RouterId: "192.168.1.1",
4006 ListenPort: -1,
4007 },
4008 })
4009 require.NoError(t, err)
4010 defer s.StopBgp(ctx, &api.StopBgpRequest{})
4011
4012 err = s.SetLogLevel(ctx, &api.SetLogLevelRequest{Level: api.SetLogLevelRequest_LEVEL_DEBUG})
4013 require.NoError(t, err)
4014
4015 neighbor := &oc.Neighbor{
4016 Config: oc.NeighborConfig{
4017 NeighborAddress: netip.MustParseAddr(peerAddr),
4018 PeerAs: asn,
4019 },
4020 Transport: oc.Transport{
4021 Config: oc.TransportConfig{
4022 PassiveMode: true,
4023 },
4024 },
4025 AfiSafis: []oc.AfiSafi{
4026 {
4027 Config: oc.AfiSafiConfig{
4028 AfiSafiName: oc.AFI_SAFI_TYPE_RTC,
4029 Enabled: true,
4030 },
4031 RouteTargetMembership: oc.RouteTargetMembership{
4032 Config: oc.RouteTargetMembershipConfig{
4033 DeferralTime: deferralTime,
4034 },
4035 },
4036 },
4037 {
4038 Config: oc.AfiSafiConfig{
4039 AfiSafiName: oc.AFI_SAFI_TYPE_L3VPN_IPV4_UNICAST,
4040 Enabled: true,
4041 },
4042 },
4043 },
4044 }
4045
4046 wg := newPeerStateWaiter(s, api.PeerState_SESSION_STATE_ACTIVE)

Callers

nothing calls this directly

Calls 15

ServeMethod · 0.95
StartBgpMethod · 0.95
StopBgpMethod · 0.95
SetLogLevelMethod · 0.95
AddPeerMethod · 0.95
SetRemoteAddrMethod · 0.95
PushBgpMessageMethod · 0.95
NewPeerFromConfigStructFunction · 0.92
NewCapMultiProtocolFunction · 0.92
NewBGPOpenMessageFunction · 0.92
NewBGPKeepAliveMessageFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…