-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check #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>
- Loading branch information
Showing
3 changed files
with
69 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,4 @@ | ||
router bgp 65501 | ||
bgp router-id 1.1.1.1 | ||
no bgp ebgp-requires-policy | ||
neighbor 10.10.10.1 remote-as 65502 |
17 changes: 17 additions & 0 deletions
17
platform/vs/tests/bgp/files/default_route/default_route.conf
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,17 @@ | ||
neighbor 10.10.10.0 { | ||
router-id 1.2.3.4; | ||
local-address 10.10.10.1; | ||
local-as 65502; | ||
peer-as 65501; | ||
group-updates false; | ||
|
||
family { | ||
ipv4 unicast; | ||
} | ||
|
||
static { | ||
route 0.0.0.0/0 { | ||
next-hop 10.10.10.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,48 @@ | ||
from swsscommon import swsscommon | ||
import os | ||
import re | ||
import time | ||
import json | ||
import pytest | ||
|
||
def test_DefaultRoute(dvs, testlog): | ||
|
||
dvs.copy_file("/etc/frr/", "bgp/files/default_route/bgpd.conf") | ||
dvs.runcmd("supervisorctl start bgpd") | ||
dvs.runcmd("ip addr add 10.10.10.0/31 dev Ethernet0") | ||
dvs.runcmd("config interface startup Ethernet0") | ||
dvs.runcmd("ip route del 0.0.0.0/0") | ||
dvs.runcmd("vtysh -c \"confgure terminal\" -c \"ip route 0.0.0.0/0 via 172.17.0.1 200\"") | ||
|
||
dvs.servers[0].runcmd("ip addr add 10.10.10.1/31 dev eth0") | ||
dvs.servers[0].runcmd("ifconfig eth0 up") | ||
|
||
time.sleep(5) | ||
|
||
print(dvs.runcmd("supervisorctl status")) | ||
|
||
p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/default_route/default_route.conf") | ||
|
||
time.sleep(10) | ||
|
||
(exit_code, output) = dvs.runcmd(["redis-cli", "hgetall", "ROUTE_TABLE:0.0.0.0/0"]) | ||
print(exit_code, output) | ||
|
||
# make sure 10.10.10.1 is the correct next hop for default route | ||
assert "10.10.10.1" in output | ||
|
||
# insert default route for table default | ||
dvs.runcmd("ip route add default via 172.17.0.1 table default") | ||
|
||
(exit_code, output) = dvs.runcmd(["redis-cli", "hgetall", "ROUTE_TABLE:0.0.0.0/0"]) | ||
print(exit_code, output) | ||
|
||
time.sleep(10) | ||
# make sure 10.10.10.1 is still the correct next hop for default route | ||
assert "10.10.10.1" in output | ||
|
||
p.terminate() | ||
p = p.wait() | ||
|
||
|
||
|