Skip to content
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

Merged
merged 2 commits into from
Sep 1, 2021

Conversation

liorghub
Copy link
Contributor

@liorghub liorghub commented Jun 28, 2021

Signed-off-by: liora liora@nvidia.com

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.

@qiluo-msft
Copy link
Contributor

qiluo-msft commented Jul 19, 2021

def get_interface_oid_map(db):

What if a user really want to block waiting for ports to appear? Can we set blocking=True as default paramter so application could migrate behavior incrementally?


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)

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@liorghub
Copy link
Contributor Author

liorghub commented Jul 25, 2021

def get_interface_oid_map(db):

What if a user really want to block waiting for ports to appear? Can we set blocking=True as default paramter so application could migrate behavior incrementally?

Refers to: src/swsssdk/port_util.py:60 in 40637b8. [](commit_id = 40637b8, deletion_comment = False)

Done, PR sonic-net/sonic-snmpagent#221 was updated to support this change.

@liorghub
Copy link
Contributor Author

The unitest for this change is in PR sonic-net/sonic-snmpagent#221

@liorghub
Copy link
Contributor Author

@qiluo-msft can you please approve this commit?
Only when this commit is in we can merge PR sonic-net/sonic-snmpagent#221.

@qiluo-msft qiluo-msft merged commit 740a44c into sonic-net:master Sep 1, 2021
"""
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)
Copy link
Contributor

@mlok-nokia mlok-nokia Sep 9, 2021

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.

@liorghub
Copy link
Contributor Author

liorghub commented Sep 9, 2021

@mlok-nokia
Thanks Marty! I have submitted PR #114 to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants