Commit 42a9a16
committed
[cmis] Separate VDM basic and statistic observables
<!-- Provide a general summary of your changes in the Title above -->
This PR must be merged along with sonic-net/sonic-platform-daemons#750
#### Description
<!--
Describe your changes in detail
-->
Currently, the CMIS API treats all VDM observables uniformly, requiring freeze operations for all reads. However,
CMIS specification distinguishes between:
- Basic observables (instantaneous values like current BER, temperature)
- Statistic observables (min/max/avg values that require freeze to capture
consistently)
This prevents optimization in xcvrd, which currently requires freeze operation even for modules that
only support basic observables (where freeze may not be supported or necessary).
Additionally, the API performs repeated EEPROM reads to check VDM support
status, even though this capability bit is static for a given module.
#### Motivation and Context
<!--
Why is this change required? What problem does it solve?
If this pull request closes/resolves an open Issue, make sure you
include the text "fixes #xxxx", "closes #xxxx" or "resolves #xxxx" here
-->
1. VDM_TYPE Enhancement (codes/public/cmis.py)
----------------------------------------------
- Added 4th element to VDM_TYPE tuples: 'B' (basic) or 'S' (statistic)
- Serves as single source of truth for observable classification
2. Observable Type Constants (api/public/cmisVDM.py)
--------------------------------------------------
- VDM_OBSERVABLE_BASIC = 0x1
- VDM_OBSERVABLE_STATISTIC = 0x2
- VDM_OBSERVABLE_ALL = 0x3
3. New CmisApi Methods (api/public/cmis.py)
-----------------------------------------
a) get_transceiver_vdm_real_value_basic()
- Reads only basic (instantaneous) VDM observables
- No freeze required
b) get_transceiver_vdm_real_value_statistic()
- Reads only statistic (min/max/avg) VDM observables
- Requires freeze operation (caller responsible)
c) is_vdm_statistic_supported()
- Checks if module supports VDM statistic observables
- Uses @read_only_cached_api_return for performance
4. Enhanced get_vdm_page() (api/public/cmisVDM.py)
------------------------------------------------
- Added optional observable_type parameter
- Filters VDM observables based on type (basic/statistic/all)
5. Performance Optimization
-------------------------
- Added @read_only_cached_api_return to is_transceiver_vdm_supported()
- Prevents repeated EEPROM access for static capability bits
#### How Has This Been Tested?
<!--
Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc.
-->
Please refer to the test details in sonic-net/sonic-platform-daemons#750
#### Additional Information (Optional)
MSFT ADO - 367986301 parent e4ad2cd commit 42a9a16
File tree
8 files changed
+481
-79
lines changed- sonic_platform_base/sonic_xcvr
- api
- public
- codes/public
- tests/sonic_xcvr
8 files changed
+481
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
170 | 191 | | |
171 | 192 | | |
172 | 193 | | |
| |||
1678 | 1699 | | |
1679 | 1700 | | |
1680 | 1701 | | |
| 1702 | + | |
1681 | 1703 | | |
1682 | 1704 | | |
1683 | 1705 | | |
1684 | 1706 | | |
1685 | 1707 | | |
1686 | 1708 | | |
1687 | | - | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
1688 | 1717 | | |
1689 | | - | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
1690 | 1723 | | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1691 | 1736 | | |
1692 | 1737 | | |
1693 | | - | |
1694 | | - | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1695 | 1741 | | |
1696 | 1742 | | |
1697 | 1743 | | |
| |||
2382 | 2428 | | |
2383 | 2429 | | |
2384 | 2430 | | |
2385 | | - | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
2386 | 2445 | | |
2387 | 2446 | | |
2388 | 2447 | | |
| |||
2394 | 2453 | | |
2395 | 2454 | | |
2396 | 2455 | | |
2397 | | - | |
2398 | | - | |
2399 | | - | |
2400 | 2456 | | |
2401 | | - | |
2402 | | - | |
2403 | | - | |
2404 | 2457 | | |
2405 | | - | |
2406 | | - | |
2407 | | - | |
2408 | 2458 | | |
2409 | | - | |
2410 | | - | |
2411 | | - | |
2412 | 2459 | | |
2413 | 2460 | | |
2414 | 2461 | | |
| |||
2433 | 2480 | | |
2434 | 2481 | | |
2435 | 2482 | | |
2436 | | - | |
2437 | | - | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
2438 | 2517 | | |
2439 | 2518 | | |
2440 | 2519 | | |
| |||
2495 | 2574 | | |
2496 | 2575 | | |
2497 | 2576 | | |
2498 | | - | |
| 2577 | + | |
2499 | 2578 | | |
2500 | 2579 | | |
2501 | 2580 | | |
| |||
2562 | 2641 | | |
2563 | 2642 | | |
2564 | 2643 | | |
2565 | | - | |
| 2644 | + | |
2566 | 2645 | | |
2567 | 2646 | | |
2568 | 2647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | 33 | | |
29 | 34 | | |
| |||
36 | 41 | | |
37 | 42 | | |
38 | 43 | | |
39 | | - | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
55 | 69 | | |
56 | 70 | | |
57 | 71 | | |
| |||
75 | 89 | | |
76 | 90 | | |
77 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
78 | 100 | | |
79 | 101 | | |
80 | 102 | | |
| |||
178 | 200 | | |
179 | 201 | | |
180 | 202 | | |
181 | | - | |
| 203 | + | |
182 | 204 | | |
183 | 205 | | |
184 | 206 | | |
| |||
194 | 216 | | |
195 | 217 | | |
196 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
197 | 226 | | |
198 | 227 | | |
199 | 228 | | |
| |||
210 | 239 | | |
211 | 240 | | |
212 | 241 | | |
213 | | - | |
| 242 | + | |
214 | 243 | | |
215 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
225 | 231 | | |
226 | 232 | | |
227 | | - | |
| 233 | + | |
228 | 234 | | |
229 | 235 | | |
230 | 236 | | |
231 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
232 | 250 | | |
233 | 251 | | |
234 | 252 | | |
| |||
0 commit comments