Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized caclmgrd ACL Rule Table Notification handling. #5560

Merged
merged 1 commit into from
Oct 8, 2020
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
27 changes: 23 additions & 4 deletions files/image_config/caclmgrd/caclmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,13 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
config_db_subscriber_table_map[namespace] = []
config_db_subscriber_table_map[namespace].append(subscribe_acl_table)
config_db_subscriber_table_map[namespace].append(subscribe_acl_rule_table)


# Get the ACL rule table seprator
acl_rule_table_seprator = subscribe_acl_rule_table.getTableNameSeparator()

# Loop on select to see if any event happen on config db of any namespace
while True:
ctrl_plane_acl_notification = False
(state, selectableObj) = sel.select(SELECT_TIMEOUT_MS)
# Continue if select is timeout or selectable object is not return
if state != swsscommon.Select.OBJECT:
Expand All @@ -546,9 +550,24 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
namespace = redisSelectObj.getDbConnector().getNamespace()
# Pop data of both Subscriber Table object of namespace that got config db acl table event
for table in config_db_subscriber_table_map[namespace]:
table.pop()
# Update the Control Plane ACL of the namespace that got config db acl table event
self.update_control_plane_acls(namespace)
(key, op, fvp) = table.pop()
# Pop of table that does not have data
if key == '':
continue
# ACL Table notification. We will take Control Plane ACTION for any ACL Table Event
# This can be optimize further but we should not have many acl table set/del events in normal
# scenario
elif acl_rule_table_seprator not in key:
ctrl_plane_acl_notification = True
# Check ACL Rule notification and make sure Rule point to ACL Table which is Controlplane
else:
acl_table = key.split(acl_rule_table_seprator)[0]
if self.config_db_map[namespace].get_table(self.ACL_TABLE)[acl_table]["type"] == self.ACL_TABLE_TYPE_CTRLPLANE:
ctrl_plane_acl_notification = True

# Update the Control Plane ACL of the namespace that got config db acl table/rule event
if ctrl_plane_acl_notification:
self.update_control_plane_acls(namespace)

# ============================= Functions =============================

Expand Down