-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[portsorch,intfsorch] add port, rif rates FC groups #1201
Conversation
orchagent/interface_rates.lua
Outdated
redis.call('SELECT', asic_db) | ||
local n = table.getn(KEYS) | ||
for i = 1, n do | ||
speeds[i] = 40000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does speed of 40000 means for RIF Interface ? How we concluded on this value ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abdosi I moved speed calculation to the CLI utility script. Getting speed for interface in lua plugin is tedious and requires connection to multiple DBs. On CLI level we can divide smoothed byterate by speed and get the utilization.
orchagent/port_rates.lua
Outdated
redis.call('SELECT', asic_db) | ||
local n = table.getn(KEYS) | ||
for i = 1, n do | ||
speeds[i] = redis.call('HGET', counters_table_name .. ':' .. KEYS[i], 'SAI_PORT_ATTR_SPEED') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it not be SAI_PORT_ATTR_OPER_SPEED ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, asic db only contains SAI_PORT_ATTR_SPEED
orchagent/port_rates.lua
Outdated
|
||
local asic_db = 1 | ||
local counters_db = ARGV[1] | ||
local config_db = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above. Can we pass as ARGV the DB Id's
orchagent/interface_rates.lua
Outdated
|
||
-- Get configuration | ||
redis.call('SELECT', config_db) | ||
local smooth_interval = redis.call('GET', rates_table_name .. ':' .. 'RIF_SMOOTH_INTERVAL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need smooth_interval here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
Signed-off-by: Mykola Faryma <[email protected]>
Signed-off-by: Mykola Faryma <[email protected]>
Signed-off-by: Mykola Faryma <[email protected]>
Signed-off-by: Mykola Faryma <[email protected]>
@@ -35,7 +36,7 @@ class IntfsOrch : public Orch | |||
sai_object_id_t getRouterIntfsId(const string&); | |||
bool isPrefixSubnet(const IpPrefix&, const string&); | |||
string getRouterIntfsAlias(const IpAddress &ip, const string &vrf_name = ""); | |||
|
|||
string getRifRateFlexCounterTableKey(string key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getRifRateFlexCounterTableKey [](start = 11, length = 29)
above line uses RouterIntfs, here uses Rif. Are they different? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latter refers to RIF_RATE Flex Counter group instead of Router Interface.
orchagent/portsorch.cpp
Outdated
@@ -47,8 +47,8 @@ extern BufferOrch *gBufferOrch; | |||
#define PORT_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS 1000 | |||
#define QUEUE_STAT_FLEX_COUNTER_POLLING_INTERVAL_MS 10000 | |||
#define QUEUE_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS "10000" | |||
#define PG_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS "10000" | |||
|
|||
#define PG_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS "10000" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"10000" [](start = 50, length = 7)
Why change original blanks and break the code alignment? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
catch (const runtime_error &e) | ||
{ | ||
SWSS_LOG_WARN("Port rate flex counter group plugins was not set successfully: %s", e.what()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicated code #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined into one try block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for misleading. I mean the code change is almost the same as in IntfsOrch::IntfsOrch()
. Is it possible to reuse code?
In reply to: 412570352 [](ancestors = 412570352)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest that I revert this particular change,
So we can go forward with the review.
The flex counter plugin registering procedure can be refactored in later PR. There is the FlexCounterManager class, we can extend to manage plugins also, but as separate effort.
orchagent/portsorch.h
Outdated
@@ -93,6 +94,8 @@ class PortsOrch : public Orch, public Subject | |||
bool addSubPort(Port &port, const string &alias, const bool &adminUp = true, const uint32_t &mtu = 0); | |||
bool removeSubPort(const string &alias); | |||
private: | |||
std::vector<Port> m_portsToAdd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vector [](start = 9, length = 6)
#include <vector>
``` #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Included in port.h
and already used on #L22
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
Signed-off-by: Mykola Faryma <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also check other reviewers' comments
Signed-off-by: Mykola Faryma <[email protected]>
|
||
-- Get configuration | ||
redis.call('SELECT', counters_db) | ||
local smooth_interval = redis.call('HGET', rates_table_name .. ':' .. 'PORT', 'PORT_SMOOTH_INTERVAL') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: [](start = 64, length = 1)
The table separator are from database_config.json. Do not hardcode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not trivial to access the database config from the lua script. Should we pass the separator as one of the parameters?
I see the separator hardcoded in a lot of other places, like this. If there is a need to avoid such things in future, I suggest separate PR and refactor it in all the lua scripts.
Some scripts have other dbs/table names hardcoded, and ATM receive the same ARGV. Need to suggest broad solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lua parameter is good enough.
Could you please add a TODO comment or Github issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft Created issue #1319
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found new issue
This comment has been minimized.
This comment has been minimized.
retest LGTM analysis: C/C++ please |
Signed-off-by: Mykola Faryma <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please also check other reviewers' comments
@abdosi any additional feedback or comments were addressed and we can merge it? |
@liat-grozovik Reviewing this. Should be done by EOD |
LGTM |
@daall Can you review this back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
-- Get configuration | ||
redis.call('SELECT', counters_db) | ||
local smooth_interval = redis.call('HGET', rates_table_name .. ':' .. 'PORT', 'PORT_SMOOTH_INTERVAL') | ||
local alpha = redis.call('HGET', rates_table_name .. ':' .. 'PORT', 'PORT_ALPHA') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this changes causes the following issue on latest SONiC master
Jul 22 11:17:22.139228 dut ERR syncd[25]: :- runRedisScript: Caught exception while running Redis lua script: ERR Error running script (call to f_fd0ea76fc13f9fcc7910e4b1fd8c9018ea197cf4): @user_script:21: user_script:21: attempt to perform arithmetic on local 'alpha' (a boolean value) : Input/output error
Jul 22 11:17:22.786235 dut ERR syncd[25]: :- guard: RedisReply catches system_error: command: *39#015#012$7#015#012EVALSHA#015#012$40#015#01231fc701ca9b1b9f968f501c92b639f50f6346a9c#015#012$2#015#01232#015#012$19#015#012oid:0x100000000004f#015#012$19#015#012oid:0x1000000000067#015#012$19#015#012oid:0x100000000007f#015#012$19#015#012oid:0x1000000000097#015#012$19#015#012oid:0x10000000000af#015#012$19#015#012oid:0x10000000000c7#015#012$19#015#012oid:0x10000000000df#015#012$19#015#012oid:0x10000000000f7#015#012$19#015#012oid:0x100000000010f#015#012$19#015#012oid:0x1000000000127#015#012$19#015#012oid:0x100000000013f#015#012$19#015#012oid:0x1000000000157#015#012$19#015#012oid:0x100000000016f#015#012$19#015#012oid:0x1000000000187#015#012$19#015#012oid:0x100000000019f#015#012$19#015#012oid:0x10000000001b7#015#012$19#015#012oid:0x10000000001cf#015#012$19#015#012oid:0x10000000001e7#015#012$19#015#012oid:0x10000000001ff#015#012$19#015#012oid:0x1000000000217#015#012$19#015#012oid:0x100000000022f#015#012$19#015#012oid:0x1000000000247#015#012$19#015#012oid:0x100000000025f#015#012$19#015#012oid:0x1000000000277#015#012$19#015#012oid:0x100000000028f#015#012$19#015#012oid:0x10000000002a7#015#012$19#015#012oid:0x10000000002bf#015#012$19#015#012oid:0x10000000002d7#015#012$19#015#012oid:0x10000000002ef#015#012$19#015#012oid:0x1000000000307#015#012$19#015#012oid:0x100000000031f#015#012$19#015#012oid:0x1000000000337#015#012$1#015#0122#015#012$8#015#012COUNTERS#015#012$7#015#0121000000#015#012$2#015#012''#015#012, reason: ERR Error running script (call to f_31fc701ca9b1b9f968f501c92b639f50f6346a9c): @user_script:21: user_script:21: attempt to perform arithmetic on local 'alpha' (a boolean value) : Input/output error
Jul 22 11:17:22.786235 dut ERR syncd[25]: :- runRedisScript: Caught exception while running Redis lua script: ERR Error running script (call to f_31fc701ca9b1b9f968f501c92b639f50f6346a9c): @user_script:21: user_script:21: attempt to perform arithmetic on local 'alpha' (a boolean value) : Input/output error
Jul 22 11:17:23.141016 dut ERR syncd[25]: :- guard: RedisReply catches system_error: command: *12#015#012$7#015#012EVALSHA#015#012$40#015#012fd0ea76fc13f9fcc7910e4b1fd8c9018ea197cf4#015#012$1#015#0125#015#012$19#015#012oid:0x6000000000392#015#012$19#015#012oid:0x6000000000393#015#012$19#015#012oid:0x6000000000394#015#012$19#015#012oid:0x6000000000395#015#012$19#015#012oid:0x6000000000396#015#012$1#015#0122#015#012$8#015#012COUNTERS#015#012$7#015#0121000000#015#012$2#015#012''#015#012, reason: ERR Error running script (call to f_fd0ea76fc13f9fcc7910e4b1fd8c9018ea197cf4): @user_script:21: user_script:21: attempt to perform arithmetic on local 'alpha' (a boolean value) : Input/output error
Jul 22 11:17:23.141016 dut ERR syncd[25]: :- runRedisScript: Caught exception while running Redis lua script: ERR Error running script (call to f_fd0ea76fc13f9fcc7910e4b1fd8c9018ea197cf4): @user_script:21: user_script:21: attempt to perform arithmetic on local 'alpha' (a boolean value) : Input/output error
Jul 22 11:17:23.337583 dut NOTICE syncd[25]: :- processBulkQuadEvent: bulk SAI_OBJECT_TYPE_NEXT_HOP_GROUP_MEMBER execute with 2 items
Jul 22 11:17:23.735421 dut ERR syncd[25]: :- guard: RedisReply catches system_error: command: *39#015#012$7#015#012EVALSHA#015#012$40#015#01231fc701ca9b1b9f968f501c92b639f50f6346a9c#015#012$2#015#01232#015#012$19#015#012oid:0x100000000004f#015#012$19#015#012oid:0x1000000000067#015#012$19#015#012oid:0x100000000007f#015#012$19#015#012oid:0x1000000000097#015#012$19#015#012oid:0x10000000000af#015#012$19#015#012oid:0x10000000000c7#015#012$19#015#012oid:0x10000000000df#015#012$19#015#012oid:0x10000000000f7#015#012$19#015#012oid:0x100000000010f#015#012$19#015#012oid:0x1000000000127#015#012$19#015#012oid:0x100000000013f#015#012$19#015#012oid:0x1000000000157#015#012$19#015#012oid:0x100000000016f#015#012$19#015#012oid:0x1000000000187#015#012$19#015#012oid:0x100000000019f#015#012$19#015#012oid:0x10000000001b7#015#012$19#015#012oid:0x10000000001cf#015#012$19#015#012oid:0x10000000001e7#015#012$19#015#012oid:0x10000000001ff#015#012$19#015#012oid:0x1000000000217#015#012$19#015#012oid:0x100000000022f#015#012$19#015#012oid:0x1000000000247#015#012$19#015#012oid:0x100000000025f#015#012$19#015#012oid:0x1000000000277#015#012$19#015#012oid:0x100000000028f#015#012$19#015#012oid:0x10000000002a7#015#012$19#015#012oid:0x10000000002bf#015#012$19#015#012oid:0x10000000002d7#015#012$19#015#012oid:0x10000000002ef#015#012$19#015#012oid:0x1000000000307#015#012$19#015#012oid:0x100000000031f#015#012$19#015#012oid:0x1000000000337#015#012$1#015#0122#015#012$8#015#012COUNTERS#015#012$7#015#0121000000#015#012$2#015#012''#015#012, reason: ERR Error running script (call to f_31fc701ca9b1b9f968f501c92b639f50f6346a9c): @user_script:21: user_script:21: attempt to perform arithmetic on local 'alpha' (a boolean value) : Input/output error
Please double check.
) Added checks to ignore files/directories that are not present while generating the dump. Signed-off-by: Sabareesh Kumar Anandan <[email protected]>
According to HLD
Depends on sonic-swws-common #330
What I did
Add 2 new FC groups, with plugins to calculate port and interface rates and utilization
Why I did it
How I verified it
Details if related