Skip to content

Commit

Permalink
Revert "[route] Fix of static route redistribution in test_static_rou…
Browse files Browse the repository at this point in the history
…te (sonic-net#3785)" (sonic-net#4131)

This reverts commit d3510a7.

With sonic-net/sonic-buildimage#7492, the static route redistribution should automatically enable/disable via bgpcfgd. Therefore, we should not enable/disable route redistribution in tests.
  • Loading branch information
shi-su authored and vmittal-msft committed Sep 28, 2021
1 parent 30dbcda commit c97e346
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions tests/route/test_static_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,6 @@ def check_route_redistribution(duthost, prefix, ipv6, removed=False):
assert prefix in adv_routes


def route_redistribution_static(duthost, ipv6, removed=False):
mg_facts = duthost.minigraph_facts(host=duthost.hostname)["ansible_facts"]
if ipv6:
duthost.shell("vtysh -c 'configure terminal' -c 'router bgp {}' -c 'address-family ipv6' -c '{}redistribute static'".format(mg_facts["minigraph_bgp_asn"],
"no " if removed else ''))
else:
duthost.shell("vtysh -c 'configure terminal' -c 'router bgp {}' -c '{}redistribute static'".format(mg_facts["minigraph_bgp_asn"],
"no " if removed else ''))


def run_static_route_test(duthost, ptfadapter, ptfhost, tbinfo, prefix, nexthop_addrs, prefix_len, nexthop_devs, ipv6=False, config_reload_test=False):
# Clean up arp or ndp
clear_arp_ndp(duthost, ipv6=ipv6)
Expand All @@ -160,8 +150,6 @@ def run_static_route_test(duthost, ptfadapter, ptfhost, tbinfo, prefix, nexthop_
add_ipaddr(ptfadapter, ptfhost, nexthop_addrs, prefix_len, nexthop_devs, ipv6=ipv6)

try:
# Enable redistribution of static routes
route_redistribution_static(duthost, ipv6)
# Add static route
duthost.shell("sonic-db-cli CONFIG_DB hmset 'STATIC_ROUTE|{}' nexthop {}".format(prefix, ",".join(nexthop_addrs)))
time.sleep(5)
Expand All @@ -177,7 +165,6 @@ def run_static_route_test(duthost, ptfadapter, ptfhost, tbinfo, prefix, nexthop_
if config_reload_test:
duthost.shell('config save -y')
config_reload(duthost, wait=350)
route_redistribution_static(duthost, ipv6)
generate_and_verify_traffic(duthost, ptfadapter, tbinfo, ip_dst, nexthop_devs, ipv6=ipv6)
check_route_redistribution(duthost, prefix, ipv6)

Expand All @@ -191,8 +178,7 @@ def run_static_route_test(duthost, ptfadapter, ptfhost, tbinfo, prefix, nexthop_
# Check the advertised route get removed
time.sleep(5)
check_route_redistribution(duthost, prefix, ipv6, removed=True)
# Disable redistribution of static routes
route_redistribution_static(duthost, ipv6, removed=True)

# Config save if the saved config_db was updated
if config_reload_test:
duthost.shell('config save -y')
Expand Down

0 comments on commit c97e346

Please sign in to comment.