From cba65760393d2380785c407158609f4782777718 Mon Sep 17 00:00:00 2001 From: fredyu190011 <48435122+fredyu190011@users.noreply.github.com> Date: Fri, 2 Apr 2021 04:42:44 +0800 Subject: [PATCH] Correct the sflow default sample rate (#1623) According the PR: SONiC#746, the sample rate should be "ifSpeed / 1e6". Signed-off-by: Fred Yu fred_yu@edge-core.com --- cfgmgr/sflowmgr.h | 16 ++++++++-------- tests/test_sflow.py | 15 ++++++++------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cfgmgr/sflowmgr.h b/cfgmgr/sflowmgr.h index 8e454efa7a61..f83d9a103ac1 100644 --- a/cfgmgr/sflowmgr.h +++ b/cfgmgr/sflowmgr.h @@ -19,14 +19,14 @@ namespace swss { #define SFLOW_SAMPLE_RATE_KEY_10G "10000" #define SFLOW_SAMPLE_RATE_KEY_1G "1000" -#define SFLOW_SAMPLE_RATE_VALUE_400G "40000" -#define SFLOW_SAMPLE_RATE_VALUE_200G "20000" -#define SFLOW_SAMPLE_RATE_VALUE_100G "10000" -#define SFLOW_SAMPLE_RATE_VALUE_50G "5000" -#define SFLOW_SAMPLE_RATE_VALUE_40G "4000" -#define SFLOW_SAMPLE_RATE_VALUE_25G "2500" -#define SFLOW_SAMPLE_RATE_VALUE_10G "1000" -#define SFLOW_SAMPLE_RATE_VALUE_1G "100" +#define SFLOW_SAMPLE_RATE_VALUE_400G "400000" +#define SFLOW_SAMPLE_RATE_VALUE_200G "200000" +#define SFLOW_SAMPLE_RATE_VALUE_100G "100000" +#define SFLOW_SAMPLE_RATE_VALUE_50G "50000" +#define SFLOW_SAMPLE_RATE_VALUE_40G "40000" +#define SFLOW_SAMPLE_RATE_VALUE_25G "25000" +#define SFLOW_SAMPLE_RATE_VALUE_10G "10000" +#define SFLOW_SAMPLE_RATE_VALUE_1G "1000" #define SFLOW_ERROR_SPEED_STR "error" diff --git a/tests/test_sflow.py b/tests/test_sflow.py index 05929af11e61..761655717761 100644 --- a/tests/test_sflow.py +++ b/tests/test_sflow.py @@ -1,12 +1,13 @@ class TestSflow: speed_rate_table = { - "400000": "40000", - "100000": "10000", - "50000": "5000", - "40000": "4000", - "25000": "2500", - "10000": "1000", - "1000": "100" + "400000": "400000", + "200000": "200000", + "100000": "100000", + "50000": "50000", + "40000": "40000", + "25000": "25000", + "10000": "10000", + "1000": "1000" } def setup_sflow(self, dvs):