Skip to content

Commit b37540f

Browse files
sihuihan88lguohan
authored andcommitted
[vs-test]: not forward routes with no-export community (sonic-net#1774)
Signed-off-by: Sihui Han <[email protected]>
1 parent deacbb8 commit b37540f

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
router bgp 65501
2+
bgp router-id 1.1.1.1
3+
no bgp default ipv4-unicast
4+
neighbor 10.0.0.1 remote-as 65502
5+
address-family ipv4
6+
neighbor 10.0.0.1 activate
7+
maximum-paths 64
8+
exit-address-family
9+
neighbor 10.0.0.3 remote-as 65503
10+
address-family ipv4
11+
neighbor 10.0.0.3 activate
12+
maximum-paths 64
13+
exit-address-family
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
neighbor 10.0.0.0 {
2+
router-id 1.1.1.2;
3+
local-address 10.0.0.1;
4+
local-as 65502;
5+
peer-as 65501;
6+
group-updates false;
7+
8+
family{
9+
ipv4 unicast;
10+
}
11+
12+
static {
13+
route 1.1.1.1/32{
14+
next-hop 10.0.0.1;
15+
community no-export;
16+
}
17+
route 2.2.2.2/32{
18+
next-hop 10.0.0.1;
19+
}
20+
}
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
neighbor 10.0.0.2 {
2+
router-id 1.1.1.3;
3+
local-address 10.0.0.3;
4+
local-as 65503;
5+
peer-as 65501;
6+
group-updates false;
7+
8+
family {
9+
ipv4 unicast;
10+
}
11+
}
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
from swsscommon import swsscommon
2+
import os
3+
import re
4+
import time
5+
import json
6+
7+
def test_bounce(dvs):
8+
dvs.servers[0].runcmd("pkill -f exabgp")
9+
dvs.copy_file("/etc/quagga/", "bounce/files/bgpd.conf")
10+
dvs.runcmd("supervisorctl start bgpd")
11+
dvs.runcmd("ip addr add 10.0.0.0/31 dev Ethernet0")
12+
dvs.runcmd("ifconfig Ethernet0 up")
13+
14+
dvs.runcmd("ip addr add 10.0.0.2/31 dev Ethernet4")
15+
dvs.runcmd("ifconfig Ethernet4 up")
16+
17+
dvs.servers[0].runcmd("ip addr add 10.0.0.1/31 dev eth0")
18+
dvs.servers[0].runcmd("ifconfig eth0 up")
19+
20+
dvs.servers[1].runcmd("ip addr add 10.0.0.3/31 dev eth0")
21+
dvs.servers[1].runcmd("ifconfig eth0 up")
22+
23+
time.sleep(5)
24+
25+
p1 = dvs.servers[0].runcmd_async("exabgp -d bounce/files/exabgp1.conf")
26+
p2 = dvs.servers[1].runcmd_async("exabgp -d bounce/files/exabgp2.conf")
27+
28+
time.sleep(20)
29+
30+
sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"])
31+
all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"])
32+
announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"])
33+
34+
p1.terminate()
35+
p1 = p1.wait()
36+
37+
p2.terminate()
38+
p2 = p2.wait()
39+
40+
print sum_res
41+
print announce_route
42+
assert "1.1.1.1/32" in all_route
43+
assert "1.1.1.1/32" not in announce_route
44+
assert "2.2.2.2/32" in all_route
45+
assert "2.2.2.2/32" in announce_route

0 commit comments

Comments
 (0)