Skip to content

Commit b9ccfbe

Browse files
committed
[vstest]: add default vs test
Check sonic-net#6483 add test to make sure default route change in eth0 does not affect the default route in the default vrf Signed-off-by: Guohan Lu <lguohan@gmail.com>
1 parent 46b3bd5 commit b9ccfbe

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
router bgp 65501
2+
bgp router-id 1.1.1.1
3+
no bgp ebgp-requires-policy
4+
neighbor 10.10.10.1 remote-as 65502
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
neighbor 10.10.10.0 {
2+
router-id 1.2.3.4;
3+
local-address 10.10.10.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 0.0.0.0/0 {
14+
next-hop 10.10.10.1;
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
from swsscommon import swsscommon
2+
import os
3+
import re
4+
import time
5+
import json
6+
import pytest
7+
8+
def test_DefaultRoute(dvs, testlog):
9+
10+
dvs.copy_file("/etc/frr/", "bgp/files/default_route/bgpd.conf")
11+
dvs.runcmd("supervisorctl start bgpd")
12+
dvs.runcmd("ip addr add 10.10.10.0/31 dev Ethernet0")
13+
dvs.runcmd("config interface startup Ethernet0")
14+
dvs.runcmd("ip route del 0.0.0.0/0")
15+
dvs.runcmd("vtysh -c \"confgure terminal\" -c \"ip route 0.0.0.0/0 via 172.17.0.1 200\"")
16+
17+
dvs.servers[0].runcmd("ip addr add 10.10.10.1/31 dev eth0")
18+
dvs.servers[0].runcmd("ifconfig eth0 up")
19+
20+
time.sleep(5)
21+
22+
print(dvs.runcmd("supervisorctl status"))
23+
24+
p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/default_route/default_route.conf")
25+
26+
time.sleep(10)
27+
28+
(exit_code, output) = dvs.runcmd(["redis-cli", "hgetall", "ROUTE_TABLE:0.0.0.0/0"])
29+
print(exit_code, output)
30+
31+
# make sure 10.10.10.1 is the correct next hop for default route
32+
assert "10.10.10.1" in output
33+
34+
# insert default route for table default
35+
dvs.runcmd("ip route add default via 172.17.0.1 table default")
36+
37+
(exit_code, output) = dvs.runcmd(["redis-cli", "hgetall", "ROUTE_TABLE:0.0.0.0/0"])
38+
print(exit_code, output)
39+
40+
time.sleep(10)
41+
# make sure 10.10.10.1 is still the correct next hop for default route
42+
assert "10.10.10.1" in output
43+
44+
p.terminate()
45+
p = p.wait()
46+
47+
48+

0 commit comments

Comments
 (0)