summaryrefslogtreecommitdiffhomepage
path: root/server/server_test.go
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-06-29 08:58:47 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2018-06-29 08:58:47 +0900
commitdb6683bfbfee3a6e04e78d6af40bbdb9f4fcd317 (patch)
tree1cb852253b2219363dd0db4513eff750f5d11d83 /server/server_test.go
parentf265c314af0ab82924da5ffba38b2f0e5428724d (diff)
server: exclude RTC for softreset if not specified
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Diffstat (limited to 'server/server_test.go')
-rw-r--r--server/server_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/server/server_test.go b/server/server_test.go
index b7a03490..4a6495e4 100644
--- a/server/server_test.go
+++ b/server/server_test.go
@@ -676,3 +676,32 @@ func TestGracefulRestartTimerExpired(t *testing.T) {
}
}
}
+
+func TestFamiliesForSoftreset(t *testing.T) {
+ f := func(f bgp.RouteFamily) config.AfiSafi {
+ return config.AfiSafi{
+ State: config.AfiSafiState{
+ Family: f,
+ },
+ }
+ }
+ peer := &Peer{
+ fsm: &FSM{
+ pConf: &config.Neighbor{
+ AfiSafis: []config.AfiSafi{f(bgp.RF_RTC_UC), f(bgp.RF_IPv4_UC), f(bgp.RF_IPv6_UC)},
+ },
+ },
+ }
+
+ families := familiesForSoftreset(peer, bgp.RF_IPv4_UC)
+ assert.Equal(t, len(families), 1)
+ assert.Equal(t, families[0], bgp.RF_IPv4_UC)
+
+ families = familiesForSoftreset(peer, bgp.RF_RTC_UC)
+ assert.Equal(t, len(families), 1)
+ assert.Equal(t, families[0], bgp.RF_RTC_UC)
+
+ families = familiesForSoftreset(peer, bgp.RouteFamily(0))
+ assert.Equal(t, len(families), 2)
+ assert.NotContains(t, families, bgp.RF_RTC_UC)
+}