diff options
author | mageshgv <mageshgv@gmail.com> | 2019-10-08 14:35:33 -0700 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@gmail.com> | 2019-10-15 20:58:16 +0900 |
commit | 0235f7c67539e199eb59e7ffb09409e07a8d13e0 (patch) | |
tree | ce88a843a13a5f708268212176759ff54ae812f7 /pkg/server/server_test.go | |
parent | bfb371d0c2f543c7dd5ee4afa112a6546c886ec2 (diff) |
Support vrfs in zapi multipath
Diffstat (limited to 'pkg/server/server_test.go')
-rw-r--r-- | pkg/server/server_test.go | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index a390ce58..3cbf53a9 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -533,7 +533,8 @@ func TestMonitor(test *testing.T) { assert.Equal(1, len(b.PathList)) assert.Equal("10.0.0.0/24", b.PathList[0].GetNlri().String()) assert.False(b.PathList[0].IsWithdraw) - assert.Equal(0, len(b.Vrf)) + assert.Equal(1, len(b.Vrf)) + assert.True(b.Vrf[0]) // Withdraws the previous route. // NOTE: Withdraw should not require any path attribute. @@ -545,7 +546,8 @@ func TestMonitor(test *testing.T) { assert.Equal(1, len(b.PathList)) assert.Equal("10.0.0.0/24", b.PathList[0].GetNlri().String()) assert.True(b.PathList[0].IsWithdraw) - assert.Equal(0, len(b.Vrf)) + assert.Equal(1, len(b.Vrf)) + assert.True(b.Vrf[0]) // Stops the watcher still having an item. w.Stop() @@ -590,7 +592,7 @@ func TestMonitor(test *testing.T) { assert.False(u.PathList[0].IsWithdraw) // Withdraws the previous route. - // NOTE: Withdow should not require any path attribute. + // NOTE: Withdraw should not require any path attribute. if err := t.addPathList("", []*table.Path{table.NewPath(nil, bgp.NewIPAddrPrefix(24, "10.2.0.0"), true, nil, time.Now(), false)}); err != nil { log.Fatal(err) } @@ -620,7 +622,19 @@ func TestMonitor(test *testing.T) { assert.True(b.Vrf[1]) assert.True(b.Vrf[2]) - // Stops the watcher still having an item. + // Withdraw the route + if err := s.addPathList("vrf1", []*table.Path{table.NewPath(nil, bgp.NewIPAddrPrefix(24, "10.0.0.0"), true, attrs, time.Now(), false)}); err != nil { + log.Fatal(err) + } + ev = <-w.Event() + b = ev.(*watchEventBestPath) + assert.Equal(1, len(b.PathList)) + assert.Equal("111:111:10.0.0.0/24", b.PathList[0].GetNlri().String()) + assert.True(b.PathList[0].IsWithdraw) + assert.Equal(2, len(b.Vrf)) + assert.True(b.Vrf[1]) + assert.True(b.Vrf[2]) + w.Stop() } |