Skip to content
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

Layer 2 Forwarding Enhancements - add FDB table in CONFIG_DB and COUNTERS_LAG_NAME_MAP table in COUNTERS_DB. Add lua script for FDB flush #303

Merged
merged 4 commits into from Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion common/Makefile.am
Expand Up @@ -6,7 +6,8 @@ EXTRA_DIST = \
consumer_state_table_pops.lua \
consumer_table_pops.lua \
producer_state_table_apply_view.lua \
table_dump.lua
table_dump.lua \
fdb_flush.lua

swssdir = $(datadir)/swss

Expand Down
25 changes: 25 additions & 0 deletions common/fdb_flush.lua
@@ -0,0 +1,25 @@
local keys = redis.call('KEYS', KEYS[1])
local n = table.getn(keys)

for i = 1, n do
if KEYS[2] == "" and KEYS[3] == "1" then
redis.call('DEL', keys[i])
elseif KEYS[2] == "" and KEYS[3] == "0" then
local type = redis.call('HGET', keys[i], "SAI_FDB_ENTRY_ATTR_TYPE");
if type == "SAI_FDB_ENTRY_TYPE_DYNAMIC" then
redis.call('DEL', keys[i])
end
elseif KEYS[2] ~= "" then
local bridge_port = redis.call('HGET', keys[i], "SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID");
if bridge_port == KEYS[2] then
if KEYS[3] == "1" then
redis.call('DEL', keys[i])
else
local type = redis.call('HGET', keys[i], "SAI_FDB_ENTRY_ATTR_TYPE");
if type == "SAI_FDB_ENTRY_TYPE_DYNAMIC" then
redis.call('DEL', keys[i])
end
end
end
end
end
2 changes: 2 additions & 0 deletions common/schema.h
Expand Up @@ -67,6 +67,7 @@ namespace swss {
/***** COUNTER DATABASE *****/

#define COUNTERS_PORT_NAME_MAP "COUNTERS_PORT_NAME_MAP"
#define COUNTERS_LAG_NAME_MAP "COUNTERS_LAG_NAME_MAP"
#define COUNTERS_TABLE "COUNTERS"
#define COUNTERS_QUEUE_NAME_MAP "COUNTERS_QUEUE_NAME_MAP"
#define COUNTERS_QUEUE_PORT_MAP "COUNTERS_QUEUE_PORT_MAP"
Expand Down Expand Up @@ -141,6 +142,7 @@ namespace swss {
#define CFG_LAG_MEMBER_TABLE_NAME "PORTCHANNEL_MEMBER"
#define CFG_VLAN_TABLE_NAME "VLAN"
#define CFG_VLAN_MEMBER_TABLE_NAME "VLAN_MEMBER"
#define CFG_FDB_TABLE_NAME "FDB"
#define CFG_SWITCH_TABLE_NAME "SWITCH"
#define CFG_VRF_TABLE_NAME "VRF"
#define CFG_CRM_TABLE_NAME "CRM"
Expand Down