@@ -2413,6 +2413,31 @@ bool AclOrch::addAclTable(AclTable &newTable, string table_id)
2413
2413
return false ;
2414
2414
}
2415
2415
}
2416
+ else
2417
+ {
2418
+ // If ACL table is new, check for the existence of current mirror tables
2419
+ // Note: only one table per mirror type can be created
2420
+ auto table_type = newTable.type ;
2421
+ if (table_type == ACL_TABLE_MIRROR || table_type == ACL_TABLE_MIRRORV6)
2422
+ {
2423
+ string mirror_type;
2424
+ if ((table_type == ACL_TABLE_MIRROR && !m_mirrorTableId.empty ()))
2425
+ {
2426
+ mirror_type = TABLE_TYPE_MIRROR;
2427
+ }
2428
+
2429
+ if (table_type == ACL_TABLE_MIRRORV6 && !m_mirrorV6TableId.empty ())
2430
+ {
2431
+ mirror_type = TABLE_TYPE_MIRRORV6;
2432
+ }
2433
+
2434
+ if (!mirror_type.empty ())
2435
+ {
2436
+ SWSS_LOG_ERROR (" Mirror table %s has already been created" , mirror_type.c_str ());
2437
+ return false ;
2438
+ }
2439
+ }
2440
+ }
2416
2441
2417
2442
// Check if a separate mirror table is needed or not based on the platform
2418
2443
if (newTable.type == ACL_TABLE_MIRROR || newTable.type == ACL_TABLE_MIRRORV6)
@@ -2845,15 +2870,6 @@ bool AclOrch::processAclTableType(string type, acl_table_type_t &table_type)
2845
2870
SWSS_LOG_ERROR (" Mirror table type %s is not supported" , type.c_str ());
2846
2871
return false ;
2847
2872
}
2848
-
2849
- // Check the existence of current mirror tables
2850
- // Note: only one table per type could be created
2851
- if ((table_type == ACL_TABLE_MIRROR && !m_mirrorTableId.empty ()) ||
2852
- (table_type == ACL_TABLE_MIRRORV6 && !m_mirrorV6TableId.empty ()))
2853
- {
2854
- SWSS_LOG_ERROR (" Mirror table table_type %s has already been created" , type.c_str ());
2855
- return false ;
2856
- }
2857
2873
}
2858
2874
2859
2875
return true ;
0 commit comments