Skip to content

show copp config - command #1342

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 31 additions & 0 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
* [PortChannel Config commands](#portchannel-config-commands)
* [QoS](#qos)
* [QoS Show commands](#qos-show-commands)
* [CoPP](#copp)
* [PFC](#pfc)
* [Queue And Priority-Group](#queue-and-priority-group)
* [QoS config commands](#qos-config-commands)
Expand Down Expand Up @@ -359,6 +360,7 @@ This command displays the full list of show commands available in the software;
ndp Show IPv6 Neighbour table
ntp Show NTP information
pfc Show details of the priority-flow-control...
copp Show CoPP config details
platform Show platform-specific hardware info
priority-group Show details of the PGs
processes Display process information
Expand Down Expand Up @@ -5749,6 +5751,35 @@ Go Back To [Beginning of the document](#) or [Beginning of this section](#portch

### QoS Show commands

#### CoPP

**show copp status**

This command displays the active copp entries in the system

- Usage:
```
show copp status
```

- Example:
```
admin@sonic:~$ show copp status
{
"COPP_TABLE:default": {
"value": {
"cbs": "600",
"cir": "600",
"meter_type": "packets",
"mode": "sr_tcm",
"queue": "0",
"red_action": "drop"
}
}
}
...
```

#### PFC

**show pfc counters**
Expand Down
14 changes: 14 additions & 0 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,20 @@ def status(subinterfacename, verbose):
cmd += " -i subport"
run_command(cmd, display_cmd=verbose)

@cli.group('copp')
def copp():
""" Show COPP"""
pass

@copp.command('status')
def copp_status():
""" Shows active COPP entries in the system"""

cmd = "sonic-db-dump -n 'APPL_DB' -k \"COPP_TABLE:*\" -y | grep -v hash | grep -v expireat | grep -v ttl"
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
click.echo(proc.stdout.read())
return

#
# 'pfc' group ("show pfc ...")
#
Expand Down