Skip to content

Commit 249a78e

Browse files
raphaelt-nvidiaSuvarnaMeenakshi
authored andcommitted
Entries under .1.3.6.1.2.1.31.1.1.1.18 OID should return the "description" field of PORT_TABLE entries in APPL_DB or CONFIG_DB. (sonic-net#224)
- What I did This is a correction of sonic-net#218, which is contained in sonic-net/sonic-buildimage#7859, after community decided that entries under .1.3.6.1.2.1.31.1.1.1.18 OID should return the "description" field of PORT_TABLE entries in APPL_DB or CONFIG_DB. For vlan, management and LAG, these are empty strings. - How I did it Deleted the lines of code quoted by Suvarna in the above PRs. This necessitated modifying 4 unit tests that had been written under the assumption that these OIDs would return non-empty data. - How to verify it Run unit tests in build and snmp tests in sonic-mgmt. - Description for the changelog Entries under .1.3.6.1.2.1.31.1.1.1.18 OID should return the "description" field of PORT_TABLE entries in APPL_DB or CONFIG_DB. Signed-off-by: Raphael Tryster <[email protected]> (cherry picked from commit 0813b42)
1 parent 373a061 commit 249a78e

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

src/sonic_ax_impl/mibs/ietf/rfc2863.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,8 @@ def interface_alias(self, sub_id):
213213
if not entry:
214214
return
215215

216+
# This returns empty values for LAG, vlan & mgmt, which is the expected result
216217
result = entry.get("description", "")
217-
218-
if not result:
219-
#RFC2863 tables don't have descriptions for LAG, vlan & mgmt; take from RFC1213
220-
oid = self.get_oid(sub_id)
221-
if oid in self.oid_lag_name_map:
222-
result = self.oid_lag_name_map[oid]
223-
elif oid in self.mgmt_oid_name_map:
224-
result = self.mgmt_alias_map[self.mgmt_oid_name_map[oid]]
225-
elif oid in self.vlan_oid_name_map:
226-
result = self.vlan_oid_name_map[oid]
227-
228218
return result
229219

230220
def get_counter32(self, sub_id, table_name):

tests/namespace/test_interfaces.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,8 @@ def test_mgmt_iface_description_ifMIB(self):
911911

912912
def test_vlan_iface_ifMIB(self):
913913
"""
914-
Test that vlan interface is present in the ifMIB OID path of the MIB
914+
Test that vlan interface is present in the ifMIB OID path of the MIB.
915+
It is empty because there is no corresponding entry in config DB.
915916
"""
916917
oid = ObjectIdentifier(12, 0, 0, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 2999))
917918
get_pdu = GetNextPDU(
@@ -926,11 +927,12 @@ def test_vlan_iface_ifMIB(self):
926927
value0 = response.values[0]
927928
self.assertEqual(value0.type_, ValueType.OCTET_STRING)
928929
self.assertEqual(str(value0.name), str(ObjectIdentifier(12, 0, 1, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 3000))))
929-
self.assertEqual(str(value0.data), 'Vlan1000')
930+
self.assertEqual(str(value0.data), '')
930931

931932
def test_vlan_iface_description_ifMIB(self):
932933
"""
933-
Test vlan interface description (which is simply the name) in the ifMIB OID path of the MIB
934+
Test vlan interface description in the ifMIB OID path of the MIB.
935+
It is empty because there is no corresponding entry in config DB.
934936
"""
935937
oid = ObjectIdentifier(12, 0, 0, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 3000))
936938
get_pdu = GetPDU(
@@ -945,6 +947,6 @@ def test_vlan_iface_description_ifMIB(self):
945947
value0 = response.values[0]
946948
self.assertEqual(value0.type_, ValueType.OCTET_STRING)
947949
self.assertEqual(str(value0.name), str(ObjectIdentifier(12, 0, 1, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 3000))))
948-
self.assertEqual(str(value0.data), 'Vlan1000')
950+
self.assertEqual(str(value0.data), '')
949951

950952

tests/test_interfaces.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,8 @@ def test_mgmt_iface_description_ifMIB(self):
914914

915915
def test_vlan_iface_ifMIB(self):
916916
"""
917-
Test that vlan interface is present in the ifMIB OID path of the MIB
917+
Test that vlan interface is present in the ifMIB OID path of the MIB.
918+
It is empty because there is no corresponding entry in config DB.
918919
"""
919920
oid = ObjectIdentifier(12, 0, 0, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 2999))
920921
get_pdu = GetNextPDU(
@@ -929,11 +930,12 @@ def test_vlan_iface_ifMIB(self):
929930
value0 = response.values[0]
930931
self.assertEqual(value0.type_, ValueType.OCTET_STRING)
931932
self.assertEqual(str(value0.name), str(ObjectIdentifier(12, 0, 1, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 3000))))
932-
self.assertEqual(str(value0.data), 'Vlan1000')
933+
self.assertEqual(str(value0.data), '')
933934

934935
def test_vlan_iface_description_ifMIB(self):
935936
"""
936-
Test vlan interface description (which is simply the name) in the ifMIB OID path of the MIB
937+
Test vlan interface description in the ifMIB OID path of the MIB.
938+
It is empty because there is no corresponding entry in config DB.
937939
"""
938940
oid = ObjectIdentifier(12, 0, 0, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 3000))
939941
get_pdu = GetPDU(
@@ -948,7 +950,7 @@ def test_vlan_iface_description_ifMIB(self):
948950
value0 = response.values[0]
949951
self.assertEqual(value0.type_, ValueType.OCTET_STRING)
950952
self.assertEqual(str(value0.name), str(ObjectIdentifier(12, 0, 1, 0, (1, 3, 6, 1, 2, 1, 31, 1, 1, 1, 18, 3000))))
951-
self.assertEqual(str(value0.data), 'Vlan1000')
953+
self.assertEqual(str(value0.data), '')
952954

953955
def test_vlan_iface_1213_2863_consistent(self):
954956
"""

0 commit comments

Comments
 (0)