Skip to content

Commit

Permalink
[acl_loader] Support Service ACL binding to multiple services (sonic-…
Browse files Browse the repository at this point in the history
  • Loading branch information
jleveque authored Apr 10, 2018
1 parent 924a76d commit 5e476d6
Showing 1 changed file with 17 additions and 8 deletions.
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", "Binding", "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

0 comments on commit 5e476d6

Please sign in to comment.