@@ -14,7 +14,7 @@ using namespace swss;
14
14
15
15
extern sai_object_id_t gSwitchId ;
16
16
extern sai_switch_api_t *sai_switch_api;
17
- extern sai_acl_api_t * sai_acl_api;
17
+ extern sai_acl_api_t * sai_acl_api;
18
18
extern MacAddress gVxlanMacAddress ;
19
19
extern CrmOrch *gCrmOrch ;
20
20
@@ -64,36 +64,32 @@ SwitchOrch::SwitchOrch(DBConnector *db, vector<TableConnector>& connectors, Tabl
64
64
void SwitchOrch::initAclGroupsBindToSwitch ()
65
65
{
66
66
// Create an ACL group per stage, INGRESS, EGRESS and PRE_INGRESS
67
- for (auto stage_it : aclStageLookup) {
67
+ for (auto stage_it : aclStageLookup)
68
+ {
68
69
sai_object_id_t group_oid;
69
70
auto status = createAclGroup (fvValue (stage_it), &group_oid);
70
71
if (!status.ok ())
71
72
{
72
- status.prepend (" Failed to create ACL group for stage " +
73
- fvField (stage_it) + " : " );
73
+ status.prepend (" Failed to create ACL group for stage " + fvField (stage_it) + " : " );
74
74
SWSS_LOG_THROW (" %s" , status.message ().c_str ());
75
75
}
76
- SWSS_LOG_NOTICE (" Created ACL group for stage %s" ,
77
- fvField (stage_it).c_str ());
76
+ SWSS_LOG_NOTICE (" Created ACL group for stage %s" , fvField (stage_it).c_str ());
78
77
m_aclGroups[fvValue (stage_it)] = group_oid;
79
78
status = bindAclGroupToSwitch (fvValue (stage_it), group_oid);
80
79
if (!status.ok ())
81
80
{
82
- status.prepend (" Failed to bind ACL group to stage " +
83
- fvField (stage_it) + " : " );
81
+ status.prepend (" Failed to bind ACL group to stage " + fvField (stage_it) + " : " );
84
82
SWSS_LOG_THROW (" %s" , status.message ().c_str ());
85
83
}
86
84
}
87
85
}
88
86
89
- const std::map<sai_acl_stage_t , sai_object_id_t >&
90
- SwitchOrch::getAclGroupOidsBindingToSwitch ()
87
+ const std::map<sai_acl_stage_t , sai_object_id_t > &SwitchOrch::getAclGroupOidsBindingToSwitch ()
91
88
{
92
89
return m_aclGroups;
93
90
}
94
91
95
- ReturnCode SwitchOrch::createAclGroup (const sai_acl_stage_t & group_stage,
96
- sai_object_id_t * acl_grp_oid)
92
+ ReturnCode SwitchOrch::createAclGroup (const sai_acl_stage_t &group_stage, sai_object_id_t *acl_grp_oid)
97
93
{
98
94
SWSS_LOG_ENTER ();
99
95
@@ -114,47 +110,39 @@ ReturnCode SwitchOrch::createAclGroup(const sai_acl_stage_t& group_stage,
114
110
acl_grp_attr.value .s32list .list = bpoint_list.data ();
115
111
acl_grp_attrs.push_back (acl_grp_attr);
116
112
117
- CHECK_ERROR_AND_LOG_AND_RETURN (
118
- sai_acl_api->create_acl_table_group (acl_grp_oid, gSwitchId ,
119
- (uint32_t )acl_grp_attrs.size (),
120
- acl_grp_attrs.data ()),
121
- " Failed to create ACL group for stage " << group_stage);
122
- if (group_stage == SAI_ACL_STAGE_INGRESS ||
123
- group_stage == SAI_ACL_STAGE_PRE_INGRESS ||
113
+ CHECK_ERROR_AND_LOG_AND_RETURN (sai_acl_api->create_acl_table_group (
114
+ acl_grp_oid, gSwitchId , (uint32_t )acl_grp_attrs.size (), acl_grp_attrs.data ()),
115
+ " Failed to create ACL group for stage " << group_stage);
116
+ if (group_stage == SAI_ACL_STAGE_INGRESS || group_stage == SAI_ACL_STAGE_PRE_INGRESS ||
124
117
group_stage == SAI_ACL_STAGE_EGRESS)
125
118
{
126
- gCrmOrch ->incCrmAclUsedCounter (CrmResourceType::CRM_ACL_GROUP,
127
- (sai_acl_stage_t )group_stage,
128
- SAI_ACL_BIND_POINT_TYPE_SWITCH);
119
+ gCrmOrch ->incCrmAclUsedCounter (CrmResourceType::CRM_ACL_GROUP, (sai_acl_stage_t )group_stage,
120
+ SAI_ACL_BIND_POINT_TYPE_SWITCH);
129
121
}
130
- SWSS_LOG_INFO (" Suceeded to create ACL group %s in stage %d " ,
131
- sai_serialize_object_id (*acl_grp_oid). c_str (), group_stage);
122
+ SWSS_LOG_INFO (" Suceeded to create ACL group %s in stage %d " , sai_serialize_object_id (*acl_grp_oid). c_str (),
123
+ group_stage);
132
124
return ReturnCode ();
133
125
}
134
126
135
- ReturnCode SwitchOrch::bindAclGroupToSwitch (
136
- const sai_acl_stage_t & group_stage, const sai_object_id_t & acl_grp_oid)
127
+ ReturnCode SwitchOrch::bindAclGroupToSwitch (const sai_acl_stage_t &group_stage, const sai_object_id_t &acl_grp_oid)
137
128
{
138
129
SWSS_LOG_ENTER ();
139
130
140
131
auto switch_attr_it = aclStageToSwitchAttrLookup.find (group_stage);
141
132
if (switch_attr_it == aclStageToSwitchAttrLookup.end ())
142
133
{
143
134
LOG_ERROR_AND_RETURN (ReturnCode (StatusCode::SWSS_RC_INVALID_PARAM)
144
- << " Failed to set ACL group(" << acl_grp_oid
145
- << " ) to the SWITCH bind point at stage "
146
- << group_stage);
135
+ << " Failed to set ACL group(" << acl_grp_oid << " ) to the SWITCH bind point at stage "
136
+ << group_stage);
147
137
}
148
138
sai_attribute_t attr;
149
139
attr.id = switch_attr_it->second ;
150
140
attr.value .oid = acl_grp_oid;
151
141
auto sai_status = sai_switch_api->set_switch_attribute (gSwitchId , &attr);
152
142
if (sai_status != SAI_STATUS_SUCCESS)
153
143
{
154
- LOG_ERROR_AND_RETURN (
155
- ReturnCode (sai_status)
156
- << " [SAI] Failed to set_switch_attribute with attribute.id=" << attr.id
157
- << " and acl group oid=" << acl_grp_oid);
144
+ LOG_ERROR_AND_RETURN (ReturnCode (sai_status) << " [SAI] Failed to set_switch_attribute with attribute.id="
145
+ << attr.id << " and acl group oid=" << acl_grp_oid);
158
146
}
159
147
return ReturnCode ();
160
148
}
0 commit comments