From 5df2f4493d56a1409247cb009f13a55063324893 Mon Sep 17 00:00:00 2001 From: chiourung_huang Date: Tue, 8 Aug 2023 06:26:23 +0000 Subject: [PATCH] EEPROM "application advertisement" cannot display customized information. Can't show all application advertisement for CISCO ZR. For CISCO ZR, it use Vendor specific ID for module_media_interface_id Solution: 1. Add mapping for Host Electrical and Media Interface IDs 2. return code information when can't get the definition Signed-off-by: chiourung_huang --- .../sonic_xcvr/api/public/cmis.py | 4 +- .../sonic_xcvr/codes/public/sff8024.py | 64 +++++++++++++++++-- .../sonic_xcvr/fields/xcvr_field.py | 2 +- 3 files changed, 61 insertions(+), 9 deletions(-) diff --git a/sonic_platform_base/sonic_xcvr/api/public/cmis.py b/sonic_platform_base/sonic_xcvr/api/public/cmis.py index a9c4c5b34..c73cea67d 100644 --- a/sonic_platform_base/sonic_xcvr/api/public/cmis.py +++ b/sonic_platform_base/sonic_xcvr/api/public/cmis.py @@ -2030,7 +2030,7 @@ def get_application_advertisement(self): key = "{}_{}".format(consts.HOST_ELECTRICAL_INTERFACE, app) val = dic.get(key) - if val in [None, 'Unknown', 'Undefined']: + if val in [None, 'End', 'Undefined']: break buf['host_electrical_interface_id'] = val @@ -2039,7 +2039,7 @@ def get_application_advertisement(self): break key = "{}_{}".format(prefix, app) val = dic.get(key) - if val in [None, 'Unknown']: + if val in [None]: break buf['module_media_interface_id'] = val diff --git a/sonic_platform_base/sonic_xcvr/codes/public/sff8024.py b/sonic_platform_base/sonic_xcvr/codes/public/sff8024.py index ac7e25d79..168a08646 100644 --- a/sonic_platform_base/sonic_xcvr/codes/public/sff8024.py +++ b/sonic_platform_base/sonic_xcvr/codes/public/sff8024.py @@ -250,14 +250,28 @@ class Sff8024(XcvrCodes): 64: 'FOIC4.8 (ITU-T G.709.1 G.Sup58)', 65: 'CAUI-4 C2M (Annex 83E) without FEC', 66: 'CAUI-4 C2M (Annex 83E) with RS(528,514) FEC', + 67: '50GBASE-CR2 (Ethernet Technology Consortium) with RS(528,514) (Clause 91) FEC', + 68: '50GBASE-CR2 (Ethernet Technology Consortium) with BASE-R (Clause 74), Fire code FEC', + 69: '50GBASE-CR2 (Ethernet Technology Consortium) with no FEC', + 70: '100GBASE-CR1 (Clause 162)', + 71: '200GBASE-CR2 (Clause 162)', + 72: '400GBASE-CR4 (Clause 162)', + 73: '800GBASE-CR8 (placeholder)', + 74: '128GFC (FC-PI-8)', 75: '100GAUI-1-S C2M (Annex 120G)', 76: '100GAUI-1-L C2M (Annex 120G)', + 77: '200GAUI-2-S C2M (Annex 120G)', + 78: '200GAUI-2-L C2M (Annex 120G)', 79: '400GAUI-4-S C2M (Annex 120G)', 80: '400GAUI-4-L C2M (Annex 120G)', 81: '800G S C2M (placeholder)', - 82: '800G L C2M (placeholder)' + 82: '800G L C2M (placeholder)', + 255: 'End' } + for i in range(192,255): + HOST_ELECTRICAL_INTERFACE[i] = 'Vendor specific: {}'.format(i) + NM_850_MEDIA_INTERFACE = { 0: 'Undefined', 1: '10GBASE-SW (Clause 52)', @@ -278,16 +292,24 @@ class Sff8024(XcvrCodes): 16: '400GBASE-SR8 (Clause 138)', 17: '400G-SR4 (Placeholder)', 18: '800G-SR8 (Placeholder)', - 26: '400GBASE-SR4.2 (Clause 150) (400GE BiDi)', 19: '8GFC-MM (FC-PI-4)', 20: '10GFC-MM (10GFC)', 21: '16GFC-MM (FC-PI-5)', 22: '32GFC-MM (FC-PI-6)', 23: '64GFC-MM (FC-PI 7)', 24: '128GFC-MM4 (FC-PI-6P)', - 25: '256GFC-MM4 (FC-PI-7P)' + 25: '256GFC-MM4 (FC-PI-7P)', + 26: '400GBASE-SR4.2 (Clause 150) (400GE BiDi)', + 27: '200GBASE-SR2 (Clause 167)', + 28: '128GFC-MM (FC-PI-8)', + 29: '100GBASE-VR (Clause 167)', + 30: '200GBASE-VR2 (Clause 167)', + 31: '400GBASE-VR4 (Clause 167)' } + for i in range(192,256): + NM_850_MEDIA_INTERFACE[i] = 'Vendor specific: {}'.format(i) + SM_MEDIA_INTERFACE = { 0: 'Undefined', 1: '10GBASE-LW (Cl 52)', @@ -337,6 +359,7 @@ class Sff8024(XcvrCodes): 49: '4I1-4D1F (G.959.1)', 50: '8R1-4D1F (G.959.1)', 51: '8I1-4D1F (G.959.1)', + 52: '100G CWDM4-OCP', 56: '10G-SR', 57: '10G-LR', 58: '25G-SR', @@ -345,18 +368,38 @@ class Sff8024(XcvrCodes): 61: '25G-LR-BiDi', 62: '400ZR, DWDM, amplified', 63: '400ZR, Single Wavelength, Unamplified', + 64: '50GBASE-ER (Clause 139)', + 65: '200GBASE-ER4 (Clause 122)', + 66: '400GBASE-ER8 (Clause 122)', + 67: '400GBASE-LR4-6 (Clause 151)', + 68: '100GBASE-ZR (Clause 154)', + 69: '128GFC-SM (FC-PI-8)', 70: 'ZR400-OFEC-16QAM', 71: 'ZR300-OFEC-8QAM', 72: 'ZR200-OFEC-QPSK', - 73: 'ZR100-OFEC-QPSK' + 73: 'ZR100-OFEC-QPSK', + 74: '100G-LR1-20 MSA Spec', + 75: '100G-ER1-30 MSA Spec', + 76: '100G-ER1-40 MSA Spec', + 77: '400GBASE-ZR (Clause 156)', + 78: '10GBASE-BR (Clause 158)', + 79: '25GBASE-BR (Clause 159)', + 80: '50GBASE-BR (Clause 160)' } + for i in range(192,256): + SM_MEDIA_INTERFACE[i] = 'Vendor specific: {}'.format(i) + PASSIVE_COPPER_MEDIA_INTERFACE = { 0: 'Undefined', 1: 'Copper cable', - 2: 'Passive Loopback module' + 2: 'Passive Loopback module', + 191: 'Passive Loopback module' } + for i in range(192,256): + PASSIVE_COPPER_MEDIA_INTERFACE[i] = 'Vendor specific: {}'.format(i) + ACTIVE_CABLE_MEDIA_INTERFACE = { 0: 'Undefined', 1: 'Active Cable assembly with BER < 10^-12', @@ -366,12 +409,21 @@ class Sff8024(XcvrCodes): 191: 'Active Loopback module' } + for i in range(192,256): + ACTIVE_CABLE_MEDIA_INTERFACE[i] = 'Vendor specific: {}'.format(i) + BASE_T_MEDIA_INTERFACE = { 0: 'Undefined', 1: '1000BASE-T (Clause 40)', 2: '2.5GBASE-T (Clause 126)', 3: '5GBASE-T (Clause 126)', - 4: '10GBASE-T (Clause 55)' + 4: '10GBASE-T (Clause 55)', + 5: '25GBASE-T (Clause 113)', + 6: '40GBASE-T (Clause 113)', + 7: '50GBASE-T (Placeholder)' } + for i in range(192,256): + BASE_T_MEDIA_INTERFACE[i] = 'Vendor specific: {}'.format(i) + # TODO: Add other codes diff --git a/sonic_platform_base/sonic_xcvr/fields/xcvr_field.py b/sonic_platform_base/sonic_xcvr/fields/xcvr_field.py index a9e0fd5ad..21d478026 100644 --- a/sonic_platform_base/sonic_xcvr/fields/xcvr_field.py +++ b/sonic_platform_base/sonic_xcvr/fields/xcvr_field.py @@ -238,7 +238,7 @@ def decode(self, raw_data, **decoded_deps): if mask is not None: code &= mask code >>= self.start_bitpos - return self.code_dict.get(code, "Unknown") + return self.code_dict.get(code, "Unknown: {}".format(code)) class HexRegField(RegField): """