Skip to content

Commit 80171a3

Browse files
authored
[SNMP] Update description of entPhysicalDescr mib in case interface is not configured. (#205)
The ideas of this MIB is to reflect the physical entities and should not be affected by the config_db.json interface configuration. In the case where the interface does not exist (not configured at all or as a result of user removing the interface from the config_db.json due to port breakout limitation on some platforms), entPhysicalDescr OID should return the transceiver type only and without the interface alias and the extra 'for ' text. Signed-off-by: liora [email protected] - What I did In the case interface not configured but transceiver exist, the transceiver description is only the transceiver type without the extra 'for xxx' text. - How I did it Verify if interface is configured. If yes, add to the transceiver type the interface alias. Else, only the transceiver type. - How to verify it snmpwalk -v 2c -c public 10.210.24.85 1.3.6.1.2.1.47.1.1.1.1.2 | grep SFP Signed-off-by: liora <[email protected]>
1 parent c20bf60 commit 80171a3

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

src/sonic_ax_impl/mibs/ietf/rfc2737.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ def get_transceiver_description(sfp_type, if_alias):
157157
:param if_alias: Port alias name
158158
:return: Transceiver decsription
159159
"""
160+
if not if_alias:
161+
description = "{}".format(sfp_type)
162+
else:
163+
description = "{} for {}".format(sfp_type, if_alias)
160164

161-
return "{} for {}".format(sfp_type, if_alias)
162-
165+
return description
163166

164167
def get_transceiver_sensor_description(name, lane_number, if_alias):
165168
"""

tests/mock_tables/state_db.json

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@
4040
"model": "MODEL_NAME",
4141
"is_replaceable": "True"
4242
},
43+
"TRANSCEIVER_INFO|Ethernet1": {
44+
"type": "QSFP-DD",
45+
"hardware_rev": "A1",
46+
"serial": "SERIAL_NUM",
47+
"manufacturer": "VENDOR_NAME",
48+
"model": "MODEL_NAME",
49+
"is_replaceable": "True"
50+
},
4351
"TRANSCEIVER_DOM_SENSOR|Ethernet0": {
4452
"temperature": 25.39,
4553
"voltage": 3.37,

tests/test_sn.py

+20
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,26 @@ def test_getpdu_xcvr_info(self):
204204

205205
self._check_getpdu(sub_id, expected_mib)
206206

207+
def test_getpdu_xcvr_info_port_disable(self):
208+
sub_id = get_transceiver_sub_id(2)[0]
209+
210+
expected_mib = {
211+
2: (ValueType.OCTET_STRING, "QSFP-DD"),
212+
4: (ValueType.INTEGER, CHASSIS_SUB_ID),
213+
5: (ValueType.INTEGER, PhysicalClass.PORT),
214+
6: (ValueType.INTEGER, -1),
215+
7: (ValueType.OCTET_STRING, "Ethernet1"),
216+
8: (ValueType.OCTET_STRING, "A1"),
217+
9: (ValueType.OCTET_STRING, ""), # skip
218+
10: (ValueType.OCTET_STRING, ""), # skip
219+
11: (ValueType.OCTET_STRING, "SERIAL_NUM"),
220+
12: (ValueType.OCTET_STRING, "VENDOR_NAME"),
221+
13: (ValueType.OCTET_STRING, "MODEL_NAME"),
222+
16: (ValueType.INTEGER, 1)
223+
}
224+
225+
self._check_getpdu(sub_id, expected_mib)
226+
207227
def test_getpdu_xcvr_dom(self):
208228
expected_mib = {
209229
get_transceiver_sensor_sub_id(1, SENSOR_TYPE_TEMP)[0]: "DOM Temperature Sensor for etp1",

0 commit comments

Comments
 (0)