Skip to content

Commit bb6e83f

Browse files
sumukhatvEdenGri
authored andcommitted
Use 'default' VRF when VRF name is not provided (sonic-net#2368)
While adding static routes, if VRF name is not present, use default VRF
1 parent 6dcc9ab commit bb6e83f

File tree

2 files changed

+56
-55
lines changed

2 files changed

+56
-55
lines changed

config/main.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@ def cli_sroute_to_config(ctx, command_str, strict_nh = True):
10191019
elif 'prefix' in prefix_str:
10201020
# prefix_str: ['prefix', ip]
10211021
ip_prefix = prefix_str[1]
1022+
vrf_name = "default"
10221023
else:
10231024
ctx.fail("prefix is not in pattern!")
10241025

@@ -5314,7 +5315,7 @@ def add_route(ctx, command_str):
53145315

53155316
# Check if exist entry with key
53165317
keys = config_db.get_keys('STATIC_ROUTE')
5317-
if key in keys:
5318+
if tuple(key.split("|")) in keys:
53185319
# If exist update current entry
53195320
current_entry = config_db.get_entry('STATIC_ROUTE', key)
53205321

@@ -5339,7 +5340,7 @@ def del_route(ctx, command_str):
53395340
key, route = cli_sroute_to_config(ctx, command_str, strict_nh=False)
53405341
keys = config_db.get_keys('STATIC_ROUTE')
53415342
prefix_tuple = tuple(key.split('|'))
5342-
if not key in keys and not prefix_tuple in keys:
5343+
if not tuple(key.split("|")) in keys and not prefix_tuple in keys:
53435344
ctx.fail('Route {} doesnt exist'.format(key))
53445345
else:
53455346
# If not defined nexthop or intf name remove entire route

0 commit comments

Comments
 (0)