Skip to content

Commit

Permalink
Merge branch 'sonic-net:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy authored Oct 29, 2024
2 parents 810b724 + 5b37ee6 commit 8a5801c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 8 additions & 8 deletions scripts/vnet_route_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def print_message(lvl, *args):
def check_vnet_cfg():
''' Returns True if VNET is configured in APP_DB or False if no VNET configuration.
'''
db = swsscommon.DBConnector('APPL_DB', 0)
db = swsscommon.DBConnector('APPL_DB', 0, True)

vnet_db_keys = swsscommon.Table(db, 'VNET_TABLE').getKeys()

Expand All @@ -85,7 +85,7 @@ def get_vnet_intfs():
''' Returns dictionary of VNETs and related VNET interfaces.
Format: { <vnet_name>: [ <vnet_rif_name> ] }
'''
db = swsscommon.DBConnector('APPL_DB', 0)
db = swsscommon.DBConnector('APPL_DB', 0, True)

intfs_table = swsscommon.Table(db, 'INTF_TABLE')
intfs_keys = swsscommon.Table(db, 'INTF_TABLE').getKeys()
Expand All @@ -109,7 +109,7 @@ def get_all_rifs_oids():
''' Returns dictionary of all router interfaces and their OIDs.
Format: { <rif_name>: <rif_oid> }
'''
db = swsscommon.DBConnector('COUNTERS_DB', 0)
db = swsscommon.DBConnector('COUNTERS_DB', 0, True)
rif_table = swsscommon.Table(db, 'COUNTERS_RIF_NAME_MAP')

rif_name_oid_map = dict(rif_table.get('')[1])
Expand Down Expand Up @@ -140,7 +140,7 @@ def get_vrf_entries():
''' Returns dictionary of VNET interfaces and corresponding VRF OIDs.
Format: { <vnet_rif_name>: <vrf_oid> }
'''
db = swsscommon.DBConnector('ASIC_DB', 0)
db = swsscommon.DBConnector('ASIC_DB', 0, True)
rif_table = swsscommon.Table(db, 'ASIC_STATE')

vnet_rifs_oids = get_vnet_rifs_oids()
Expand All @@ -162,7 +162,7 @@ def filter_out_vnet_ip2me_routes(vnet_routes):
''' Filters out IP2ME routes from the provided dictionary with VNET routes
Format: { <vnet_name>: { 'routes': [ <pfx/pfx_len> ], 'vrf_oid': <oid> } }
'''
db = swsscommon.DBConnector('APPL_DB', 0)
db = swsscommon.DBConnector('APPL_DB', 0, True)

all_rifs_db_keys = swsscommon.Table(db, 'INTF_TABLE').getKeys()
vnet_intfs = get_vnet_intfs()
Expand Down Expand Up @@ -198,7 +198,7 @@ def get_vnet_routes_from_app_db():
''' Returns dictionary of VNET routes configured per each VNET in APP_DB.
Format: { <vnet_name>: { 'routes': [ <pfx/pfx_len> ], 'vrf_oid': <oid> } }
'''
db = swsscommon.DBConnector('APPL_DB', 0)
db = swsscommon.DBConnector('APPL_DB', 0, True)

vnet_intfs = get_vnet_intfs()
vnet_vrfs = get_vrf_entries()
Expand Down Expand Up @@ -245,7 +245,7 @@ def get_vnet_routes_from_asic_db():
''' Returns dictionary of VNET routes configured per each VNET in ASIC_DB.
Format: { <vnet_name>: { 'routes': [ <pfx/pfx_len> ], 'vrf_oid': <oid> } }
'''
db = swsscommon.DBConnector('ASIC_DB', 0)
db = swsscommon.DBConnector('ASIC_DB', 0, True)

tbl = swsscommon.Table(db, 'ASIC_STATE')

Expand Down Expand Up @@ -363,7 +363,7 @@ def main():
# Don't run VNET routes consistancy logic if there is no VNET configuration
if not check_vnet_cfg():
return rc
asic_db = swsscommon.DBConnector('ASIC_DB', 0)
asic_db = swsscommon.DBConnector('ASIC_DB', 0, True)
virtual_router = swsscommon.Table(asic_db, 'ASIC_STATE:SAI_OBJECT_TYPE_VIRTUAL_ROUTER')
if virtual_router.getKeys() != []:
global default_vrf_oid
Expand Down
4 changes: 3 additions & 1 deletion tests/vnet_route_check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ def get(self, key):


db_conns = {"APPL_DB": APPL_DB, "ASIC_DB": ASIC_DB, "COUNTERS_DB": CNTR_DB}
def conn_side_effect(arg, _):


def conn_side_effect(arg, _, __):
return db_conns[arg]


Expand Down

0 comments on commit 8a5801c

Please sign in to comment.