-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[port_util] Allow system without ports in config db run without errors #109
Conversation
Signed-off-by: liora <[email protected]>
What if a user really want to block waiting for ports to appear? Can we set In reply to: 882500980 In reply to: 882500980 In reply to: 882500980 Refers to: src/swsssdk/port_util.py:60 in 40637b8. [](commit_id = 40637b8, deletion_comment = False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
Done, PR sonic-net/sonic-snmpagent#221 was updated to support this change. |
The unitest for this change is in PR sonic-net/sonic-snmpagent#221 |
@qiluo-msft can you please approve this commit? |
Signed-off-by: liora <[email protected]>
""" | ||
Get the Interface names from Counters DB | ||
""" | ||
db.connect('COUNTERS_DB') | ||
if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking=True) | ||
if_lag_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_LAG_NAME_MAP', blocking=True) | ||
if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 65,and 66, function get_all() cannot accept the non-keyword blocking
as a positional argument. It needs to be as keyword argument blocking=True
. This is a bug, please fix it as the previous.
@mlok-nokia |
Signed-off-by: liora [email protected]
What I did
Allow system with no ports in config db to run without errors/warnings.
This is needed for modular system which should boot and run properly without line cards.
How I did it
Check if table exists before calling get_all for it and return empty list if there are no ports in COUNTERS_PORT_NAME_MAP table in counters db.
How to verify it
Run snmpwalk on the root oid.
Important
This PR must be merged before PR sonic-net/sonic-snmpagent#221 is merged.