Skip to content

Remove prefix "oid:0x" from sai oid#18

Merged
qiluo-msft merged 1 commit intosonic-net:masterfrom
prsunny:master
Oct 25, 2017
Merged

Remove prefix "oid:0x" from sai oid#18
qiluo-msft merged 1 commit intosonic-net:masterfrom
prsunny:master

Conversation

@prsunny
Copy link
Copy Markdown
Contributor

@prsunny prsunny commented Oct 25, 2017

With a recent change in COUNTERS_DB, the SAI OIDs are prefixed with "oid:0x". However, the current scripts/utils are indexing this using key without this prefix.

Changing to reflect the mapping as before.

@prsunny prsunny requested review from lguohan and stcheng October 25, 2017 01:18
@prsunny
Copy link
Copy Markdown
Contributor Author

prsunny commented Oct 25, 2017

Changes to fix the side effects of sonic-net/sonic-sairedis#234

db.connect('COUNTERS_DB')
if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking=True)
oid_pfx = len("oid:0x")
if_name_map = {if_name: sai_oid[oid_pfx:] for if_name, sai_oid in if_name_map.items()}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sai_oid.split(':')[1]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We would want to split till 0x.

@prsunny prsunny requested a review from qiluo-msft October 25, 2017 01:31
@stcheng stcheng added the bug label Oct 25, 2017
db.connect('COUNTERS_DB')
if_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_PORT_NAME_MAP', blocking=True)
oid_pfx = len("oid:0x")
if_name_map = {if_name: sai_oid[oid_pfx:] for if_name, sai_oid in if_name_map.items()}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

sai_oid [](start = 28, length = 7)

This change will bring dependency on schema version. Suggest to make it backward compatible, so we can still update snmp docker in old switches.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there could be other changes in the counters_db or other new data in the database that is needed by new snmp. It will be very difficult to test all cases. Not sure we really need to have this as a goal.

@qiluo-msft qiluo-msft merged commit 3b07479 into sonic-net:master Oct 25, 2017
praveen-li pushed a commit to praveen-li/sonic-py-swsssdk that referenced this pull request May 4, 2021
* msft_github/master:
  Fix issue in get_table with zero-attribute table entries (sonic-net#20)
  Remove prefix "oid:0x" from sai oid (sonic-net#18)
  [port_util]: Return empty dictionary instead of a NoneType in get_bridge_port_map (sonic-net#17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants