Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Azure/sonic-utilities int…
Browse files Browse the repository at this point in the history
…o shlomi_system_health_cli
  • Loading branch information
Shlomi Bitton committed Jul 8, 2020
2 parents 61d90ac + 60e5410 commit 0fc2d48
Show file tree
Hide file tree
Showing 25 changed files with 5,452 additions and 368 deletions.
29 changes: 19 additions & 10 deletions acl_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,21 +718,30 @@ def show_session(self, session_name):
:param session_name: Optional. Mirror session name. Filter sessions by specified name.
:return:
"""
header = ("Name", "Status", "SRC IP", "DST IP", "GRE", "DSCP", "TTL", "Queue", "Policer", "Monitor Port")
erspan_header = ("Name", "Status", "SRC IP", "DST IP", "GRE", "DSCP", "TTL", "Queue",
"Policer", "Monitor Port", "SRC Port", "Direction")
span_header = ("Name", "Status", "DST Port", "SRC Port", "Direction", "Queue", "Policer")

data = []
erspan_data = []
span_data = []
for key, val in self.get_sessions_db_info().iteritems():
if session_name and key != session_name:
continue
# For multi-mpu platform status and monitor port will be dict()
# of 'asic-x':value
data.append([key, val["status"], val["src_ip"], val["dst_ip"],
val.get("gre_type", ""), val.get("dscp", ""),
val.get("ttl", ""), val.get("queue", ""), val.get("policer", ""),
val.get("monitor_port", "")])

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

if val.get("type") == "SPAN":
span_data.append([key, val.get("status", ""), val.get("dst_port", ""),
val.get("src_port", ""), val.get("direction", "").lower(),
val.get("queue", ""), val.get("policer", "")])
else:
erspan_data.append([key, val.get("status", ""), val.get("src_ip", ""),
val.get("dst_ip", ""), val.get("gre_type", ""), val.get("dscp", ""),
val.get("ttl", ""), val.get("queue", ""), val.get("policer", ""),
val.get("monitor_port", ""), val.get("src_port", ""), val.get("direction", "").lower()])

print("ERSPAN Sessions")
print(tabulate.tabulate(erspan_data, headers=erspan_header, tablefmt="simple", missingval=""))
print("\nSPAN Sessions")
print(tabulate.tabulate(span_data, headers=span_header, tablefmt="simple", missingval=""))

def show_policer(self, policer_name):
"""
Expand Down
Loading

0 comments on commit 0fc2d48

Please sign in to comment.