Skip to content

Commit

Permalink
Fix for test_transceiver_info (#4963)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
In test_transceiver_info the key of hardware_rev has been changed to vendor_rev.
According to these PRs(sonic-net/sonic-platform-daemons#231, sonic-net/sonic-utilities#1950), now only master branch support the key of vendor_rev. So, for other branches it still keeps the key of hardware_rev.

How did you do it?
For latest master release, use "vendor_rev" as transceiver info key.
For release in ["201911", "202012", "202106", "202111"], use "hardware_rev" as transceiver info key.

How did you verify/test it?
Run test_transceiver_info on different branches, for example: master, 202012.
  • Loading branch information
JibinBao authored Jan 20, 2022
1 parent d5e7677 commit dd42f31
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/snmp/test_snmp_phy_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,12 @@ def test_transceiver_info(duthosts, enum_rand_one_per_hwsku_hostname, snmp_physi
for oid, values in snmp_physical_entity_info.items():
values['oid'] = oid
name_to_snmp_facts[values['entPhysName']] = values

transceiver_rev_key = "vendor_rev"
release_list = ["201911", "202012", "202106", "202111"]
if any(release in duthost.os_version for release in release_list):
transceiver_rev_key = "hardware_rev"

for key in keys:
name = key.split(TABLE_NAME_SEPARATOR_VBAR)[-1]
assert name in name_to_snmp_facts, 'Cannot find port {} in physical entity mib'.format(name)
Expand All @@ -511,7 +517,7 @@ def test_transceiver_info(duthosts, enum_rand_one_per_hwsku_hostname, snmp_physi
assert transceiver_snmp_fact['entPhysClass'] == PHYSICAL_CLASS_PORT
assert transceiver_snmp_fact['entPhyParentRelPos'] == -1
assert transceiver_snmp_fact['entPhysName'] == name
assert transceiver_snmp_fact['entPhysHwVer'] == transceiver_info['vendor_rev']
assert transceiver_snmp_fact['entPhysHwVer'] == transceiver_info[transceiver_rev_key]
assert transceiver_snmp_fact['entPhysFwVer'] == ''
assert transceiver_snmp_fact['entPhysSwVer'] == ''
assert transceiver_snmp_fact['entPhysSerialNum'] == transceiver_info['serial']
Expand Down

0 comments on commit dd42f31

Please sign in to comment.