forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vs-test]: not forward routes with no-export community (sonic-net#1774)
Signed-off-by: Sihui Han <[email protected]>
- Loading branch information
1 parent
deacbb8
commit b37540f
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
router bgp 65501 | ||
bgp router-id 1.1.1.1 | ||
no bgp default ipv4-unicast | ||
neighbor 10.0.0.1 remote-as 65502 | ||
address-family ipv4 | ||
neighbor 10.0.0.1 activate | ||
maximum-paths 64 | ||
exit-address-family | ||
neighbor 10.0.0.3 remote-as 65503 | ||
address-family ipv4 | ||
neighbor 10.0.0.3 activate | ||
maximum-paths 64 | ||
exit-address-family |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
neighbor 10.0.0.0 { | ||
router-id 1.1.1.2; | ||
local-address 10.0.0.1; | ||
local-as 65502; | ||
peer-as 65501; | ||
group-updates false; | ||
|
||
family{ | ||
ipv4 unicast; | ||
} | ||
|
||
static { | ||
route 1.1.1.1/32{ | ||
next-hop 10.0.0.1; | ||
community no-export; | ||
} | ||
route 2.2.2.2/32{ | ||
next-hop 10.0.0.1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
neighbor 10.0.0.2 { | ||
router-id 1.1.1.3; | ||
local-address 10.0.0.3; | ||
local-as 65503; | ||
peer-as 65501; | ||
group-updates false; | ||
|
||
family { | ||
ipv4 unicast; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from swsscommon import swsscommon | ||
import os | ||
import re | ||
import time | ||
import json | ||
|
||
def test_bounce(dvs): | ||
dvs.servers[0].runcmd("pkill -f exabgp") | ||
dvs.copy_file("/etc/quagga/", "bounce/files/bgpd.conf") | ||
dvs.runcmd("supervisorctl start bgpd") | ||
dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0") | ||
dvs.runcmd("ifconfig Ethernet0 up") | ||
|
||
dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4") | ||
dvs.runcmd("ifconfig Ethernet4 up") | ||
|
||
dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0") | ||
dvs.servers[0].runcmd("ifconfig eth0 up") | ||
|
||
dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0") | ||
dvs.servers[1].runcmd("ifconfig eth0 up") | ||
|
||
time.sleep(5) | ||
|
||
p1 = dvs.servers[0].runcmd_async("exabgp -d bounce/files/exabgp1.conf") | ||
p2 = dvs.servers[1].runcmd_async("exabgp -d bounce/files/exabgp2.conf") | ||
|
||
time.sleep(20) | ||
|
||
sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"]) | ||
all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"]) | ||
announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"]) | ||
|
||
p1.terminate() | ||
p1 = p1.wait() | ||
|
||
p2.terminate() | ||
p2 = p2.wait() | ||
|
||
print sum_res | ||
print announce_route | ||
assert "1.1.1.1/32" in all_route | ||
assert "1.1.1.1/32" not in announce_route | ||
assert "2.2.2.2/32" in all_route | ||
assert "2.2.2.2/32" in announce_route |