Skip to content

[202211] [sflowmgrd] Infer sampling rate dynamically based on oper speed#2805

Merged
prsunny merged 3 commits intosonic-net:202211from
vivekrnv:sflow_oper_speed_2211
Jun 12, 2023
Merged

[202211] [sflowmgrd] Infer sampling rate dynamically based on oper speed#2805
prsunny merged 3 commits intosonic-net:202211from
vivekrnv:sflow_oper_speed_2211

Conversation

@vivekrnv
Copy link
Copy Markdown
Contributor

@vivekrnv vivekrnv commented May 30, 2023

What I did

Backport #2799 to 2211

  1. Remove sflowSpeedRateInitMap and infer the default sampling rate based on speed on the interface.
  2. Make the rate inference based on oper_speed.

Why I did it

  1. With Static Map, adding a new speed would require updating the code.
  2. auotneg might change the operational speed on the port but the default sampling rate is not updated

How I verified it

  1. UT's:
vkarri@3e8d51f2fa45:/sonic/src/sonic-swss/tests/mock_tests$ ./tests --gtest_filter="*SflowMgrTest*"
Running main() from /build/googletest-YnT0O3/googletest-1.10.0.20201025/googletest/src/gtest_main.cc
Note: Google Test filter = *SflowMgrTest*
[==========] Running 8 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 8 tests from SflowMgrTest
[ RUN      ] SflowMgrTest.test_RateConfiguration
[       OK ] SflowMgrTest.test_RateConfiguration (0 ms)
[ RUN      ] SflowMgrTest.test_RateConfigurationCfgSpeed
[       OK ] SflowMgrTest.test_RateConfigurationCfgSpeed (1 ms)
[ RUN      ] SflowMgrTest.test_OnlyStateDbNotif
[       OK ] SflowMgrTest.test_OnlyStateDbNotif (0 ms)
[ RUN      ] SflowMgrTest.test_LocalRateConfiguration
[       OK ] SflowMgrTest.test_LocalRateConfiguration (0 ms)
[ RUN      ] SflowMgrTest.test_LocalRateConfWithOperSpeed
[       OK ] SflowMgrTest.test_LocalRateConfWithOperSpeed (0 ms)
[ RUN      ] SflowMgrTest.test_newSpeed
[       OK ] SflowMgrTest.test_newSpeed (0 ms)
[ RUN      ] SflowMgrTest.test_CfgSpeedAdminCfg
[       OK ] SflowMgrTest.test_CfgSpeedAdminCfg (0 ms)
[ RUN      ] SflowMgrTest.test_OperSpeedAdminCfg
[       OK ] SflowMgrTest.test_OperSpeedAdminCfg (1 ms)
[----------] 8 tests from SflowMgrTest (2 ms total)

[----------] Global test environment tear-down
[==========] 8 tests from 1 test suite ran. (2 ms total)
[  PASSED  ] 8 tests.

  1. Run manual tests on a DUT

Test normal speed change without autoneg

root@dut:/home/admin# show sflow interface | grep Ethernet220
| Ethernet220 | up            |          100000 |

root@dut:/home/admin# config interface speed Ethernet220 50000
root@dut:/home/admin# show sflow interface | grep Ethernet220
| Ethernet220 | up            |           50000 |

root@dut:/home/admin# config interface speed Ethernet220 25000
root@dut:/home/admin# show sflow interface | grep Ethernet220
| Ethernet220 | up            |           25000 |

Test rate change with autoneg

Ethernet205 <-> Ethernet209 Back to back connected

root@dut:/# show interfaces status 
Ethernet205              205      25G   9100    N/A   etp52b  routed      up       up    QSFP28 or later         N/A
Ethernet209              209      25G   9100    N/A   etp53b  routed      up       up    QSFP28 or later         N/A

<Check sampling rate before >
root@dut:/# show sflow interface
| Ethernet205 | up            |           25000 |
| Ethernet209 | up            |           25000 |

<Enable autoneg on 209>
root@dut:/# config interface autoneg Ethernet209 enabled
<Change speed on the peer port>
root@dut:/# config interface speed Ethernet205 10000

<Speed on 209 is updated because of autoneg>
root@dut:/# show interfaces status 
Ethernet205              205      10G   9100    N/A   etp52b  routed      up       up   QSFP28 or later         N/A
Ethernet209              209      10G   9100    N/A   etp53b  routed      up       up   QSFP28 or later         N/A

<sampling rate updated on both the ports>    
root@dut:/# show sflow interface
| Ethernet205 | up            |           10000 |
| Ethernet209 | up            |           10000 |

<disable autoneg> 
root@dut:/# config interface autoneg Ethernet209 disabled

root@dut:/# show sflow interface
| Ethernet205 | up            |           10000 |
| Ethernet209 | up            |           10000 |

@vivekrnv vivekrnv requested a review from prsunny as a code owner May 30, 2023 23:35
@vivekrnv vivekrnv closed this May 30, 2023
Signed-off-by: Vivek Reddy <vkarri@nvidia.com>
@vivekrnv vivekrnv reopened this May 31, 2023
@vivekrnv
Copy link
Copy Markdown
Contributor Author

/azpw run Azure.sonic-swss

@mssonicbld
Copy link
Copy Markdown
Collaborator

/AzurePipelines run Azure.sonic-swss

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@dgsudharsan
Copy link
Copy Markdown
Collaborator

@Gokulnath-Raja Can you please review and signoff this backport?

@prsunny prsunny merged commit bccb1cc into sonic-net:202211 Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants