Skip to content

Commit 0486d02

Browse files
sumukhatvmdanish-kh
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 cff80d3 commit 0486d02

File tree

2 files changed

+56
-55
lines changed

2 files changed

+56
-55
lines changed

config/main.py

Lines changed: 3 additions & 2 deletions
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

@@ -5318,7 +5319,7 @@ def add_route(ctx, command_str):
53185319

53195320
# Check if exist entry with key
53205321
keys = config_db.get_keys('STATIC_ROUTE')
5321-
if key in keys:
5322+
if tuple(key.split("|")) in keys:
53225323
# If exist update current entry
53235324
current_entry = config_db.get_entry('STATIC_ROUTE', key)
53245325

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

0 commit comments

Comments
 (0)