Closed Junchao-Mellanox closed 2 years ago
@qiluo-msft could you please help to signoff? Due to permission issue we cannot add label. Can you please help to add required for 202111 label?
Hi @qiluo-msft , could you please review and sign-off?
Hi @qiluo-msft - Can you please direct this PR to the relevant maintainer ?
@qiluo-msft due to limited permission please add a label of bug as well as requested for 202111
def get_vlan_interface_oid_map(db):
you can add a new parameter blocking
with default value True
.
Change the internal blocking accordingly. No need to check exists
.
The benefit is to keep old behavior, and allow client code to change behavior case by case.
In reply to: 1067627217
Refers to: src/swsssdk/port_util.py:162 in 9beb381. [](commit_id = 9beb381db7c2910b407252287bd2820f4f4b5e47, deletion_comment = False)
def get_vlan_interface_oid_map(db):
you can add a new parameter
blocking
with default valueTrue
.Change the internal blocking accordingly. No need to check
exists
.The benefit is to keep old behavior, and allow client code to change behavior case by case.
Refers to: src/swsssdk/port_util.py:162 in 9beb381. [](commit_id = 9beb381, deletion_comment = False)
Hi @qiluo-msft , I would like to confirm your comment here:
def get_vlan_interface_oid_map(db, blocking=True):
...
get_vlan_interface_oid_map(db, blocking=False)
Correct?
def get_vlan_interface_oid_map(db):
you can add a new parameter
blocking
with default valueTrue
. Change the internal blocking accordingly. No need to checkexists
. The benefit is to keep old behavior, and allow client code to change behavior case by case. Refers to: src/swsssdk/port_util.py:162 in 9beb381. [](commit_id = 9beb381, deletion_comment = False)Hi @qiluo-msft , I would like to confirm your comment here:
- add a parameter to get_vlan_interface_oid_map
def get_vlan_interface_oid_map(db, blocking=True): ...
- and change snmpagent code to call it like:
get_vlan_interface_oid_map(db, blocking=False)
Correct?
--- a/src/swsssdk/port_util.py
+++ b/src/swsssdk/port_util.py
@@ -164,13 +164,13 @@ def get_rif_port_map(db):
return rif_port_oid_map
-def get_vlan_interface_oid_map(db):
+def get_vlan_interface_oid_map(db, blocking=True):
"""
Get Vlan Interface names and sai oids
"""
db.connect('COUNTERS_DB')
- rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=True)
- rif_type_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_TYPE_MAP', blocking=True)
+ rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=blocking)
+ rif_type_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_TYPE_MAP', blocking=blocking)
@mlok-nokia - fyi
@Junchao-Mellanox created snmp PR https://github.com/Azure/sonic-snmpagent/pull/246, depends on this PR.
I removed previous added unit test case as this change is hard to be covered by unit test.
@qiluo-msft could you please review and sign off?
/azpw run Azure.sonic-py-swsssdk
/AzurePipelines run Azure.sonic-py-swsssdk
Hi @qiluo-msft , I run the build locally and cannot reproduce the build failure. Could you please help take a look?
/azp run
@Junchao-Mellanox We recently add coverage >= 50% enforcement to most of the repos. Could you add a unit test to coverage the missing lines? https://dev.azure.com/mssonic/build/_build/results?buildId=82325&view=codecoverage-tab
Hi @qiluo-msft , could you please review and sign off?
@qiluo-msft - There is no 202111 branch for this repository. Is there a plan to open one ?
@vperumal @anamehra @VenkatCisco fyi
Why I did this?
port_util.get_vlan_interface_oid_map would raise exception when there is no RIF configured, and it would causes snmpagent not work. This PR is to fix it.
How I did this: check redis key exists first before calling get_all.