Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 25 additions & 9 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,31 @@ bool AclOrch::addAclTable(AclTable &newTable, string table_id)
return false;
}
}
else
{
// If ACL table is new, check for the existence of current mirror tables
// Note: only one table per mirror type can be created
auto table_type = newTable.type;
if (table_type == ACL_TABLE_MIRROR || table_type == ACL_TABLE_MIRRORV6)
{
string mirror_type;
if ((table_type == ACL_TABLE_MIRROR && !m_mirrorTableId.empty()))
{
mirror_type = TABLE_TYPE_MIRROR;
}

if (table_type == ACL_TABLE_MIRRORV6 && !m_mirrorV6TableId.empty())
{
mirror_type = TABLE_TYPE_MIRRORV6;
}

if (!mirror_type.empty())
{
SWSS_LOG_ERROR("Mirror table %s has already been created", mirror_type.c_str());
return false;
}
}
}

// Check if a separate mirror table is needed or not based on the platform
if (newTable.type == ACL_TABLE_MIRROR || newTable.type == ACL_TABLE_MIRRORV6)
Expand Down Expand Up @@ -2878,15 +2903,6 @@ bool AclOrch::processAclTableType(string type, acl_table_type_t &table_type)
SWSS_LOG_ERROR("Mirror table type %s is not supported", type.c_str());
return false;
}

// Check the existence of current mirror tables
// Note: only one table per type could be created
if ((table_type == ACL_TABLE_MIRROR && !m_mirrorTableId.empty()) ||
(table_type == ACL_TABLE_MIRRORV6 && !m_mirrorV6TableId.empty()))
{
SWSS_LOG_ERROR("Mirror table table_type %s has already been created", type.c_str());
return false;
}
}

return true;
Expand Down