From ce9aacb628c5de7632e533deb008c012e0b9c40d Mon Sep 17 00:00:00 2001 From: ChiouRung Haung Date: Wed, 23 Nov 2022 11:03:44 +0800 Subject: [PATCH] EEPROM/DOM Info: The Compliance Code will show "unknown" by using FINISAR 10G LR XCVR (#319) * JIRA-SONIC-5341: [eBay_ec202111_214] EEPROM/DOM Info: The Compliance Code will show "unknown" by using FINISAR 10G LR XCVR correct the code mapping * Fix others error code mapping and add unit test --- .../sonic_xcvr/codes/public/sff8436.py | 34 ++++++++--------- .../sonic_xcvr/codes/public/sff8472.py | 38 +++++++++---------- .../sonic_xcvr/codes/public/sff8636.py | 14 +++---- .../sonic_xcvr/mem_maps/public/sff8436.py | 6 +-- .../sonic_xcvr/mem_maps/public/sff8636.py | 4 +- tests/sonic_xcvr/test_sff8436.py | 31 +++++++++++++++ tests/sonic_xcvr/test_sff8472.py | 16 ++++++++ tests/sonic_xcvr/test_sff8636.py | 34 +++++++++++++++++ 8 files changed, 129 insertions(+), 48 deletions(-) diff --git a/sonic_platform_base/sonic_xcvr/codes/public/sff8436.py b/sonic_platform_base/sonic_xcvr/codes/public/sff8436.py index 9cde7095eca2..3d3e041d2c9e 100644 --- a/sonic_platform_base/sonic_xcvr/codes/public/sff8436.py +++ b/sonic_platform_base/sonic_xcvr/codes/public/sff8436.py @@ -15,24 +15,24 @@ class Sff8436Codes(Sff8024): POWER_CLASSES = { 0: "Power Class 1 Module (1.5W max. Power consumption)", - 64: "Power Class 2 Module (2.0W max. Power consumption)", - 128: "Power Class 3 Module (2.5W max. Power consumption)", - 192: "Power Class 4 Module (3.5W max. Power consumption)", + 1: "Power Class 2 Module (2.0W max. Power consumption)", + 2: "Power Class 3 Module (2.5W max. Power consumption)", + 3: "Power Class 4 Module (3.5W max. Power consumption)", } CLEI_CODE = { 0: "No CLEI code present in Page 02h", - 16: "CLEI code present in Page 02h" + 1: "CLEI code present in Page 02h" } CDR_TX = { 0: "No CDR in TX", - 8: "CDR present in TX" + 1: "CDR present in TX" } CDR_RX = { 0: "No CDR in RX", - 4: "CDR present in RX" + 1: "CDR present in RX" } ETHERNET_10_40G_COMPLIANCE = { @@ -65,20 +65,20 @@ class Sff8436Codes(Sff8024): } FIBRE_CHANNEL_LINK_LENGTH = { - 8: "Medium (M)", - 16: "Long distance (L)", - 32: "Intermediate distance (I)", - 64: "Short distance (S)", - 128: "Very long distance (V)" + 1: "Medium (M)", + 2: "Long distance (L)", + 4: "Intermediate distance (I)", + 8: "Short distance (S)", + 16: "Very long distance (V)" } FIBRE_CHANNEL_TRANSMITTER_TECH = { - 16: "Longwave Laser (LL)", - 32: "Shortwave laser w OFC (SL)", - 64: "Shortwave laser w/o OFC (SN)", - 128: "Electrical intra-enclosure", - 256: "Electrical inter-enclosure (EN)", - 512: "Longwave laser (LC)" + 1: "Longwave Laser (LL)", + 2: "Shortwave laser w OFC (SL)", + 4: "Shortwave laser w/o OFC (SN)", + 8: "Electrical intra-enclosure", + 16: "Electrical inter-enclosure (EN)", + 32: "Longwave laser (LC)" } FIBRE_CHANNEL_TRANSMISSION_MEDIA = { diff --git a/sonic_platform_base/sonic_xcvr/codes/public/sff8472.py b/sonic_platform_base/sonic_xcvr/codes/public/sff8472.py index 596f20377fd2..832ae75e232e 100644 --- a/sonic_platform_base/sonic_xcvr/codes/public/sff8472.py +++ b/sonic_platform_base/sonic_xcvr/codes/public/sff8472.py @@ -37,15 +37,15 @@ class Sff8472Codes(Sff8024): 192: "Power Class 4 Module (3.5W max.)", 193: "Power Class 5 Module (4.0W max.)", 194: "Power Class 6 Module (4.5W max.)", - 197: "Power Class 7 Module (5.0W max.)", + 195: "Power Class 7 Module (5.0W max.)", 32: "Power Class 8 Module", } ETHERNET_10G_COMPLIANCE = { - 16: "10GBASE-SR", - 32: "10GBASE-LR", - 64: "10GBASE-LRM", - 128: "10GBASE-ER", + 1: "10GBASE-SR", + 2: "10GBASE-LR", + 4: "10GBASE-LRM", + 8: "10GBASE-ER", } INFINIBAND_COMPLIANCE = { @@ -56,8 +56,8 @@ class Sff8472Codes(Sff8024): } ESCON_COMPLIANCE = { - 128: "ESCON MMF, 1310nm LED", - 64: "ESCON SMF, 1310nm Laser" + 2: "ESCON MMF, 1310nm LED", + 1: "ESCON SMF, 1310nm Laser" } SONET_COMPLIANCE = { @@ -87,21 +87,21 @@ class Sff8472Codes(Sff8024): } FIBRE_CHANNEL_LINK_LENGTH = { - 8: "Medium (M)", - 16: "Long distance (L)", - 32: "Intermediate distance (I)", - 64: "Short distance (S)", - 128: "Very long distance (V)" + 1: "Medium (M)", + 2: "Long distance (L)", + 4: "Intermediate distance (I)", + 8: "Short distance (S)", + 16: "Very long distance (V)" } FIBRE_CHANNEL_TRANSMITTER_TECH = { - 16: "Longwave Laser (LL)", - 32: "Shortwave laser w OFC (SL)", - 64: "Shortwave laser w/o OFC (SN)", - 128: "Electrical intra-enclosure (EL)", - 256: "Electrical inter-enclosure (EL)", - 512: "Longwave laser (LC)", - 1024: "Shortwave laser, linear RX (SA)" + 1: "Longwave Laser (LL)", + 2: "Shortwave laser w OFC (SL)", + 4: "Shortwave laser w/o OFC (SN)", + 8: "Electrical intra-enclosure (EL)", + 16: "Electrical inter-enclosure (EL)", + 32: "Longwave laser (LC)", + 64: "Shortwave laser, linear RX (SA)" } SFP_CABLE_TECH = { diff --git a/sonic_platform_base/sonic_xcvr/codes/public/sff8636.py b/sonic_platform_base/sonic_xcvr/codes/public/sff8636.py index 02bed149d952..3347bda9237e 100644 --- a/sonic_platform_base/sonic_xcvr/codes/public/sff8636.py +++ b/sonic_platform_base/sonic_xcvr/codes/public/sff8636.py @@ -32,7 +32,7 @@ class Sff8636Codes(Sff8024): 192: "Power Class 4 Module (3.5W max.)", 193: "Power Class 5 Module (4.0W max.)", 194: "Power Class 6 Module (4.5W max.)", - 197: "Power Class 7 Module (5.0W max.)", + 195: "Power Class 7 Module (5.0W max.)", 32: "Power Class 8 Module", } @@ -91,12 +91,12 @@ class Sff8636Codes(Sff8024): } FIBRE_CHANNEL_TRANSMITTER_TECH = { - 16: "Longwave Laser (LL)", - 32: "Shortwave laser w OFC (SL)", - 64: "Shortwave laser w/o OFC (SN)", - 128: "Electrical intra-enclosure", - 256: "Electrical inter-enclosure (EN)", - 512: "Longwave laser (LC)" + 1: "Longwave Laser (LL)", + 2: "Shortwave laser w OFC (SL)", + 4: "Shortwave laser w/o OFC (SN)", + 8: "Electrical intra-enclosure", + 16: "Electrical inter-enclosure (EN)", + 32: "Longwave laser (LC)" } FIBRE_CHANNEL_TRANSMISSION_MEDIA = { diff --git a/sonic_platform_base/sonic_xcvr/mem_maps/public/sff8436.py b/sonic_platform_base/sonic_xcvr/mem_maps/public/sff8436.py index 0e01b1b2bc3a..37a304d5d418 100644 --- a/sonic_platform_base/sonic_xcvr/mem_maps/public/sff8436.py +++ b/sonic_platform_base/sonic_xcvr/mem_maps/public/sff8436.py @@ -48,8 +48,8 @@ def __init__(self, codes): *(RegBitField("%s_%d" % (consts.FIBRE_CHANNEL_LINK_LENGTH_FIELD, bit), bit) for bit in range(3, 8)) ), CodeRegField(consts.FIBRE_CHANNEL_TRANSMITTER_TECH_FIELD, self.get_addr(0, 135), self.codes.FIBRE_CHANNEL_TRANSMITTER_TECH, - *(RegBitField("%s_%d" % (consts.FIBRE_CHANNEL_TRANSMITTER_TECH_FIELD, bit), bit) for bit in list(range(0,3)) + list(range(8, 16))), - size=2, format="