Skip to content

Commit

Permalink
fix undefined var in rates lua scripts (sonic-net#1365)
Browse files Browse the repository at this point in the history
* fix undefined var in lua scripts
* fix typo in rif_rates.lua

Signed-off-by: Mykola Faryma <[email protected]>
  • Loading branch information
mykolaf authored Jul 30, 2020
1 parent 26e1723 commit 69761b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions orchagent/port_rates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local initialized = redis.call('HGET', rates_table_name, 'INIT_DONE')

logit(initialized)

local n = table.getn(KEYS)
for i = 1, n do
-- Get new COUNTERS values
local in_ucast_pkts = redis.call('HGET', counters_table_name .. ':' .. KEYS[i], 'SAI_PORT_STAT_IF_IN_UCAST_PKTS')
Expand Down
3 changes: 2 additions & 1 deletion orchagent/rif_rates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ local delta = tonumber(ARGV[3])
local initialized = redis.call('HGET', rates_table_name, 'INIT_DONE')
logit(initialized)

local n = table.getn(KEYS)
for i = 1, n do
-- Get new COUNTERS values
local in_octets = redis.call('HGET', counters_table_name .. ':' .. KEYS[i], 'SAI_ROUTER_INTERFACE_STAT_IN_OCTETS')
Expand All @@ -33,7 +34,7 @@ for i = 1, n do

if initialized == "DONE" or initialized == "COUNTERS_LAST" then
-- Get old COUNTERS values
local in_octets_pkts_last = redis.call('HGET', rates_table_name .. ':' .. KEYS[i], 'SAI_ROUTER_INTERFACE_STAT_IN_OCTETS_last')
local in_octets_last = redis.call('HGET', rates_table_name .. ':' .. KEYS[i], 'SAI_ROUTER_INTERFACE_STAT_IN_OCTETS_last')
local in_pkts_last = redis.call('HGET', rates_table_name .. ':' .. KEYS[i], 'SAI_ROUTER_INTERFACE_STAT_IN_PACKETS_last')
local out_octets_last = redis.call('HGET', rates_table_name .. ':' .. KEYS[i], 'SAI_ROUTER_INTERFACE_STAT_OUT_OCTETS_last')
local out_pkts_last = redis.call('HGET', rates_table_name .. ':' .. KEYS[i], 'SAI_ROUTER_INTERFACE_STAT_OUT_PACKETS_last')
Expand Down

0 comments on commit 69761b2

Please sign in to comment.