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

[acl_loader] Support Service ACL binding to multiple services #236

Merged
merged 2 commits into from
Apr 10, 2018
Merged
Changes from 1 commit
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
25 changes: 17 additions & 8 deletions acl_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,25 +422,34 @@ def show_table(self, table_name):
:param table_name: Optional. ACL table name. Filter tables by specified name.
:return:
"""
header = ("Name", "Type", "Ports", "Description")
header = ("Name", "Type", "Bound To", "Description")

data = []
for key, val in self.get_tables_db_info().iteritems():
if table_name and key != table_name:
continue

if not val["ports"]:
data.append([key, val["type"], "", val["policy_desc"]])
if val["type"] == AclLoader.ACL_TABLE_TYPE_CTRLPLANE:
services = natsorted(val["services"])
data.append([key, val["type"], services[0], val["policy_desc"]])

if len(services) > 1:
for service in services[1:]:
data.append(["", "", service, ""])
else:
ports = natsorted(val["ports"])
data.append([key, val["type"], ports[0], val["policy_desc"]])
if not val["ports"]:
data.append([key, val["type"], "", val["policy_desc"]])
else:
ports = natsorted(val["ports"])
data.append([key, val["type"], ports[0], val["policy_desc"]])

if len(ports) > 1:
for port in ports[1:]:
data.append(["", "", port, ""])
if len(ports) > 1:
for port in ports[1:]:
data.append(["", "", port, ""])

print(tabulate.tabulate(data, headers=header, tablefmt="simple", missingval=""))


def show_session(self, session_name):
"""
Show mirror session configuration.
Expand Down