[port_util] add get_rif_port_map, get_vlan_interface_oid_map#78
[port_util] add get_rif_port_map, get_vlan_interface_oid_map#78qiluo-msft merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
|
This pull request introduces 2 alerts when merging cabfb62 into 132f8d5 - view on LGTM.com new alerts:
|
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
|
|
||
| class BaseIdx: | ||
| ethernet_base_idx = 1 | ||
| vlan_interface_base_idx = 2000 |
There was a problem hiding this comment.
@prsunny @judyjoseph do you think it leaves enough indexes to portchannels in multiple-ASIC case?
There was a problem hiding this comment.
I feel 1000 port channel interfaces should be good enough even for Chassis. But I am looking to see why the vlan_interface_base_idx is defined .. is it for this API get_vlan_interface_oid_map() ?
There was a problem hiding this comment.
I think this just simply leaves a gap from 6000-9000 after 2000+4094, why not start from 4000?
There was a problem hiding this comment.
2K BaseIdx is what our Arch and Guohan agreed on. If there is any concern about the size of pool, should discuss with them.
There was a problem hiding this comment.
But I am looking to see why the vlan_interface_base_idx is defined .. is it for this API get_vlan_interface_oid_map() ?
Theoretically index can be used anywhere where a numeric identification for interface is needed.
In my case I am using it for interface ID in the SNMP Interface MIB (RFC1213).
There was a problem hiding this comment.
lgtm .. I see that the index range discussion already happened.
| """ | ||
| 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) |
There was a problem hiding this comment.
also check None? #Closed
src/swsssdk/port_util.py
Outdated
| return {} | ||
|
|
||
| oid_pfx = len("oid:0x") | ||
| vlan_if_name_map = {sai_oid[oid_pfx:]: if_name for if_name, sai_oid in rif_name_map.items() |
There was a problem hiding this comment.
This statement is too long to understand. Could you refactor to a loop with if-block? And add some comment to explain? #Closed
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
Add 2 new utility functions, to be used by snmpagent.
Related to #133