@@ -153,12 +153,18 @@ class SaiAttr
153
153
{
154
154
SWSS_LOG_ENTER ();
155
155
156
- if (m_meta->attrvaluetype ! = SAI_ATTR_VALUE_TYPE_OBJECT_ID)
156
+ if (m_meta->attrvaluetype = = SAI_ATTR_VALUE_TYPE_OBJECT_ID)
157
157
{
158
- SWSS_LOG_THROW ( " attribute %s is not OID attribute " , m_meta-> attridname ) ;
158
+ return m_attr. value . oid ;
159
159
}
160
160
161
- return m_attr.value .oid ;
161
+ if (m_meta->attrvaluetype == SAI_ATTR_VALUE_TYPE_ACL_ACTION_DATA_OBJECT_ID &&
162
+ m_attr.value .aclaction .enable )
163
+ {
164
+ return m_attr.value .aclaction .parameter .oid ;
165
+ }
166
+
167
+ SWSS_LOG_THROW (" attribute %s is not OID attribute" , m_meta->attridname );
162
168
}
163
169
164
170
/* *
@@ -2726,6 +2732,8 @@ std::shared_ptr<SaiObj> findCurrentBestMatchForAclCounter(
2726
2732
* counter since if set, then table id will be matched previously.
2727
2733
*/
2728
2734
2735
+ std::vector<std::shared_ptr<SaiObj>> objs;
2736
+
2729
2737
const auto tmpAclTables = temporaryView.getObjectsByObjectType (SAI_OBJECT_TYPE_ACL_TABLE);
2730
2738
2731
2739
for (auto & tmpAclTable: tmpAclTables)
@@ -2758,10 +2766,85 @@ std::shared_ptr<SaiObj> findCurrentBestMatchForAclCounter(
2758
2766
if (curAclCounterTableIdAttr->getOid () != curAclTableVid)
2759
2767
continue ;
2760
2768
2761
- SWSS_LOG_INFO (" found best ACL counter match based on ACL table: %s" , c.obj ->str_object_id .c_str ());
2769
+ objs.push_back (c.obj );
2770
+ continue ;
2771
+ }
2772
+ }
2762
2773
2763
- return c.obj ;
2774
+ if (objs.size () > 1 )
2775
+ {
2776
+ // in this case more than 1 acl counters has the same acl table associated,
2777
+ // try to find best acl counter matching same acl entry field
2778
+
2779
+ SWSS_LOG_INFO (" more than 1 (%zu) best match on acl counter using acl table" , objs.size ());
2780
+
2781
+ const auto tmpAclEntries = temporaryView.getObjectsByObjectType (SAI_OBJECT_TYPE_ACL_ENTRY);
2782
+
2783
+ for (auto & tmpAclEntry: tmpAclEntries)
2784
+ {
2785
+ auto tmpAclEntryActionCounterAttr = tmpAclEntry->tryGetSaiAttr (SAI_ACL_ENTRY_ATTR_ACTION_COUNTER);
2786
+
2787
+ if (tmpAclEntryActionCounterAttr == nullptr )
2788
+ continue ; // skip acl entries with no counter
2789
+
2790
+ if (tmpAclEntryActionCounterAttr->getOid () != temporaryObj->getVid ())
2791
+ continue ; // not the counter we are looking for
2792
+
2793
+ for (auto &attr: tmpAclEntry->getAllAttributes ())
2794
+ {
2795
+ auto *meta = attr.second ->getAttrMetadata ();
2796
+
2797
+ if (!meta->isaclfield )
2798
+ continue ; // looking only for acl fields
2799
+
2800
+ if (meta->isoidattribute )
2801
+ continue ; // only non oid fields
2802
+
2803
+ auto tmpValue = attr.second ->getStrAttrValue ();
2804
+
2805
+ const auto curAclEntries = currentView.getObjectsByObjectType (SAI_OBJECT_TYPE_ACL_ENTRY);
2806
+
2807
+ for (auto & curAclEntry: curAclEntries)
2808
+ {
2809
+ auto curAclEntryAclFieldAttr = curAclEntry->tryGetSaiAttr (meta->attrid );
2810
+
2811
+ if (curAclEntryAclFieldAttr == nullptr )
2812
+ continue ; // this field is missing from current view
2813
+
2814
+ if (curAclEntryAclFieldAttr->getStrAttrValue () != tmpValue)
2815
+ continue ; // values are different, keep looking
2816
+
2817
+ auto curAclEntryActionCounterAttr = curAclEntry->tryGetSaiAttr (SAI_ACL_ENTRY_ATTR_ACTION_COUNTER);
2818
+
2819
+ if (curAclEntryActionCounterAttr == nullptr )
2820
+ continue ; // no counter
2821
+
2822
+ auto curAclCounter = currentView.oOids .at (curAclEntryActionCounterAttr->getOid ());
2823
+
2824
+ if (curAclCounter->getObjectStatus () != SAI_OBJECT_STATUS_NOT_PROCESSED)
2825
+ continue ;
2826
+
2827
+ for (auto c: candidateObjects)
2828
+ {
2829
+ if (c.obj ->getVid () == curAclCounter->getVid ())
2830
+ {
2831
+ SWSS_LOG_NOTICE (" found best ACL counter match based on ACL entry field: %s, %s" ,
2832
+ c.obj ->str_object_id .c_str (),
2833
+ meta->attridname );
2834
+ return c.obj ;
2835
+ }
2836
+ }
2837
+ }
2838
+ }
2764
2839
}
2840
+
2841
+ }
2842
+
2843
+ if (objs.size ())
2844
+ {
2845
+ SWSS_LOG_NOTICE (" found best ACL counter match based on ACL table: %s" , objs.at (0 )->str_object_id .c_str ());
2846
+
2847
+ return objs.at (0 );
2765
2848
}
2766
2849
2767
2850
SWSS_LOG_NOTICE (" failed to find best candidate for ACL_COUNTER using ACL table" );
@@ -4101,15 +4184,15 @@ std::shared_ptr<SaiObj> findCurrentBestMatchForGenericObject(
4101
4184
{
4102
4185
soci.equal_attributes ++;
4103
4186
4104
- SWSS_LOG_DEBUG (" ob equal %s %s, %s: %s" ,
4187
+ SWSS_LOG_INFO (" ob equal %s %s, %s: %s" ,
4105
4188
temporaryObj->str_object_id .c_str (),
4106
4189
currentObj->str_object_id .c_str (),
4107
4190
attr.second ->getStrAttrId ().c_str (),
4108
4191
attr.second ->getStrAttrValue ().c_str ());
4109
4192
}
4110
4193
else
4111
4194
{
4112
- SWSS_LOG_DEBUG (" ob not equal %s %s, %s: %s" ,
4195
+ SWSS_LOG_INFO (" ob not equal %s %s, %s: %s" ,
4113
4196
temporaryObj->str_object_id .c_str (),
4114
4197
currentObj->str_object_id .c_str (),
4115
4198
attr.second ->getStrAttrId ().c_str (),
@@ -4311,6 +4394,10 @@ std::shared_ptr<SaiObj> findCurrentBestMatchForGenericObject(
4311
4394
* lets choose that object as our best match.
4312
4395
*/
4313
4396
4397
+ SWSS_LOG_INFO (" eq attributes: %ld vs %ld" ,
4398
+ candidateObjects.at (0 ).equal_attributes ,
4399
+ candidateObjects.at (1 ).equal_attributes );
4400
+
4314
4401
return candidateObjects.begin ()->obj ;
4315
4402
}
4316
4403
@@ -5845,6 +5932,12 @@ bool performObjectSetTransition(
5845
5932
5846
5933
auto currentAttr = currentBestMatch->getSaiAttr (attr.id );
5847
5934
5935
+ SWSS_LOG_INFO (" compare attr value curr %s vs temp %s" ,
5936
+ currentBestMatch->getSaiAttr (attr.id )->getStrAttrValue ().c_str (),
5937
+ temporaryObj->getSaiAttr (attr.id )->getStrAttrValue ().c_str ());
5938
+
5939
+
5940
+
5848
5941
if (hasEqualAttribute (currentView, temporaryView, currentBestMatch, temporaryObj, attr.id ))
5849
5942
{
5850
5943
/*
0 commit comments