[port_util] Allow system without ports in config db run without errors#109
[port_util] Allow system without ports in config db run without errors#109qiluo-msft merged 2 commits intosonic-net:masterfrom
Conversation
Signed-off-by: liora <liora@nvidia.com>
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) |
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 <liora@nvidia.com>
| 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.
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 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.