Skip to content

Commit

Permalink
Correct the sflow default sample rate (sonic-net#1623)
Browse files Browse the repository at this point in the history
According the PR: SONiC#746, the sample rate should be "ifSpeed / 1e6".

Signed-off-by: Fred Yu [email protected]
  • Loading branch information
fredyu190011 authored Apr 1, 2021
1 parent aac71e6 commit cba6576
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
16 changes: 8 additions & 8 deletions cfgmgr/sflowmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
15 changes: 8 additions & 7 deletions tests/test_sflow.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down

0 comments on commit cba6576

Please sign in to comment.