[portsorch,intfsorch] add port, rif rates FC groups#1201
[portsorch,intfsorch] add port, rif rates FC groups#1201qiluo-msft merged 7 commits intosonic-net:masterfrom
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.
What does speed of 40000 means for RIF Interface ? How we concluded on this value ?
There was a problem hiding this comment.
@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.
should it not be SAI_PORT_ATTR_OPER_SPEED ?
There was a problem hiding this comment.
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.
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.
do we need smooth_interval here ?
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
| 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.
getRifRateFlexCounterTableKey [](start = 11, length = 29)
above line uses RouterIntfs, here uses Rif. Are they different? #Closed
There was a problem hiding this comment.
The latter refers to RIF_RATE Flex Counter group instead of Router Interface.
orchagent/portsorch.cpp
Outdated
| #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.
"10000" [](start = 50, length = 7)
Why change original blanks and break the code alignment? #Closed
| 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.
duplicated code #Closed
There was a problem hiding this comment.
Combined into one try block
There was a problem hiding this comment.
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.
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
| 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.
vector [](start = 9, length = 6)
#include <vector>
``` #Closed
There was a problem hiding this comment.
Included in port.h and already used on #L22
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
qiluo-msft
left a comment
There was a problem hiding this comment.
Please also check other reviewers' comments
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
|
|
||
| -- 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.
: [](start = 64, length = 1)
The table separator are from database_config.json. Do not hardcode.
There was a problem hiding this comment.
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.
Lua parameter is good enough.
Could you please add a TODO comment or Github issue?
This comment has been minimized.
This comment has been minimized.
|
retest LGTM analysis: C/C++ please |
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
qiluo-msft
left a comment
There was a problem hiding this comment.
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 |
| -- 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.
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.
* [portsorch,intfsorch] add port, rif rates FC groups * fix comments * remove speed calc from lua scripts * trigger lgtm
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