Skip to content

Commit

Permalink
[SFlowMgr] Sflow Crash on 200G ports handled (sonic-net#1683)
Browse files Browse the repository at this point in the history
- What I did
Added 200G entry into the speed-rate map. Also handled the case which programs empty string into APP-DB and thus leading to a failure of Orchagent.
Default Sampling rate for 200G is set to 20000

- Why I did it
Fix for Issue: sonic-net/sonic-buildimage#6793

- How I verified it
run sflow community test under sonic-mgmt

Co-authored-by: Vivek Reddy Karri <[email protected]>
  • Loading branch information
2 people authored and raphaelt-nvidia committed Oct 5, 2021
1 parent aa7fe65 commit e9f35d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cfgmgr/sflowmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ using namespace swss;
map<string,string> sflowSpeedRateInitMap =
{
{SFLOW_SAMPLE_RATE_KEY_400G, SFLOW_SAMPLE_RATE_VALUE_400G},
{SFLOW_SAMPLE_RATE_KEY_200G, SFLOW_SAMPLE_RATE_VALUE_200G},
{SFLOW_SAMPLE_RATE_KEY_100G, SFLOW_SAMPLE_RATE_VALUE_100G},
{SFLOW_SAMPLE_RATE_KEY_50G, SFLOW_SAMPLE_RATE_VALUE_50G},
{SFLOW_SAMPLE_RATE_KEY_40G, SFLOW_SAMPLE_RATE_VALUE_40G},
Expand Down Expand Up @@ -229,7 +230,7 @@ void SflowMgr::sflowCheckAndFillValues(string alias, vector<FieldValueTuple> &va
{
string speed = m_sflowPortConfMap[alias].speed;

if (speed != SFLOW_ERROR_SPEED_STR)
if (speed != SFLOW_ERROR_SPEED_STR && sflowSpeedRateInitMap.find(speed) != sflowSpeedRateInitMap.end())
{
rate = sflowSpeedRateInitMap[speed];
}
Expand Down
2 changes: 2 additions & 0 deletions cfgmgr/sflowmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace swss {

#define SFLOW_SAMPLE_RATE_KEY_400G "400000"
#define SFLOW_SAMPLE_RATE_KEY_200G "200000"
#define SFLOW_SAMPLE_RATE_KEY_100G "100000"
#define SFLOW_SAMPLE_RATE_KEY_50G "50000"
#define SFLOW_SAMPLE_RATE_KEY_40G "40000"
Expand All @@ -19,6 +20,7 @@ namespace swss {
#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"
Expand Down

0 comments on commit e9f35d8

Please sign in to comment.