sonic-net / sonic-platform-daemons

Platform module daemons for SONiC
Other
25 stars 159 forks source link

[ycabled] [active-standby] add changes for correcting telemetry values for 'active-standby' when the cable is present but vendor name and part number is not recognized #478

Closed vdahiya12 closed 6 months ago

vdahiya12 commented 7 months ago

Description

This change creates unknown, N/A values for active-standby cable type Since streaming telemetry today looks for active-standby for posting values to State DB, this change introduces a one time posting of fields with 'pseudo-cable' type when cable port instances are attempted to be created by ycabled.

For almost all cases this was covered except when vendor name and part number does not match to our mapping logic today

mapping = {
    "credo": {
        "cacl05321p2pa1ms": "credo.y_cable_credo",
        "cacl1x321p2pa1ms": "credo.y_cable_credo",
        "cacl15321p2pa1ms": "credo.y_cable_credo",
        "cacl2x321p2pa1ms": "credo.y_cable_credo",

        "cac105321p2pa2ms": "credo.y_cable_credo",
        "cac11x321p2pa2ms": "credo.y_cable_credo",
        "cac115321p2pa2ms": "credo.y_cable_credo",
        "cac12x321p2pa2ms": "credo.y_cable_credo"
    },
    "molex": {
        "2164351001": "broadcom.y_cable_broadcom",
        "2164351002": "broadcom.y_cable_broadcom",
        "2164351003": "broadcom.y_cable_broadcom",
        "2164351004": "broadcom.y_cable_broadcom",
        "2164352001": "broadcom.y_cable_broadcom",
        "2164352002": "broadcom.y_cable_broadcom",
        "2164352003": "broadcom.y_cable_broadcom",
        "2164352004": "broadcom.y_cable_broadcom",
        "2164352501": "broadcom.y_cable_broadcom",
        "2164352502": "broadcom.y_cable_broadcom",
        "2164352503": "broadcom.y_cable_broadcom",
        "2164352504": "broadcom.y_cable_broadcom"
    },
    "microsoft": {
        "simulated": "microsoft.y_cable_simulated"
    }
}

This change should cover such an issue

as their will be a one-time post of such values

vdahiya@sonic:~$ redis-cli -n 6 hgetall "MUX_CABLE_INFO|Ethernet48"
 1) "tor_active"
 2) "unknown"
 3) "time_post"
 4) "2024-Apr-29 22:45:07.495362"
 5) "mux_direction"
 6) "unknown"
 7) "manual_switch_count"
 8) "N/A"
 9) "auto_switch_count"
10) "N/A"
11) "link_status_self"
12) "unknown"
13) "link_status_peer"
14) "unknown"
15) "link_status_nic"
16) "unknown"
17) "self_eye_height_lane1"
18) "N/A"

Motivation and Context

How Has This Been Tested?

UT and posting the changes on test device.

MSFT ADO

27242275

Additional Information (Optional)

vdahiya12 commented 6 months ago

@StormLiangMS @yxieca please cherry-pick into the branches tagged

mssonicbld commented 6 months ago

Cherry-pick PR to 202305: https://github.com/sonic-net/sonic-platform-daemons/pull/486

mssonicbld commented 2 months ago

Cherry-pick PR to 202311: https://github.com/sonic-net/sonic-platform-daemons/pull/536