@@ -283,17 +283,34 @@ std::shared_ptr<SaiObj> BestCandidateFinder::findCurrentBestMatchForAclCounter(
283
283
if (tmpAclEntryActionCounterAttr->getOid () != temporaryObj->getVid ())
284
284
continue ; // not the counter we are looking for
285
285
286
+ // try use priority attribute first since it should be unique
287
+ // TODO we should use HASH from all non OID attribute here to have
288
+ // better chance for finding best candidate, this could be also
289
+ // used in pre match logic
290
+
291
+ std::vector<std::shared_ptr<const SaiAttr>> values;
292
+
293
+ if (tmpAclEntry->hasAttr (SAI_ACL_ENTRY_ATTR_PRIORITY))
294
+ {
295
+ values.push_back (tmpAclEntry->getSaiAttr (SAI_ACL_ENTRY_ATTR_PRIORITY));
296
+ }
297
+
286
298
for (auto &attr: tmpAclEntry->getAllAttributes ())
287
299
{
288
- auto *meta = attr.second ->getAttrMetadata ();
300
+ values.push_back (attr.second );
301
+ }
289
302
290
- if (!meta->isaclfield )
303
+ for (auto &attr: values)
304
+ {
305
+ auto *meta = attr->getAttrMetadata ();
306
+
307
+ if (!meta->isaclfield && meta->attrid != SAI_ACL_ENTRY_ATTR_PRIORITY)
291
308
continue ; // looking only for acl fields
292
309
293
310
if (meta->isoidattribute )
294
311
continue ; // only non oid fields
295
312
296
- auto tmpValue = attr. second ->getStrAttrValue ();
313
+ auto tmpValue = attr->getStrAttrValue ();
297
314
298
315
const auto curAclEntries = m_currentView.getObjectsByObjectType (SAI_OBJECT_TYPE_ACL_ENTRY);
299
316
@@ -1694,6 +1711,8 @@ std::shared_ptr<SaiObj> BestCandidateFinder::findCurrentBestMatchForGenericObjec
1694
1711
1695
1712
for (const auto ¤tObj: notProcessedObjects)
1696
1713
{
1714
+ SWSS_LOG_INFO (" * examing current obj: %s" , currentObj->m_str_object_id .c_str ());
1715
+
1697
1716
sai_object_compare_info_t soci = { 0 , currentObj };
1698
1717
1699
1718
bool has_different_create_only_attr = false ;
@@ -1862,6 +1881,10 @@ std::shared_ptr<SaiObj> BestCandidateFinder::findCurrentBestMatchForGenericObjec
1862
1881
continue ;
1863
1882
}
1864
1883
1884
+ SWSS_LOG_INFO (" * current obj: %s has equal %lu attributes" ,
1885
+ currentObj->m_str_object_id .c_str (),
1886
+ soci.equal_attributes );
1887
+
1865
1888
candidateObjects.push_back (soci);
1866
1889
}
1867
1890
0 commit comments