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

Provide QoS Scheduler CLI command and user guide #1354

Open
wants to merge 1 commit 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
37 changes: 37 additions & 0 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1830,6 +1830,43 @@ def is_dynamic_buffer_enabled(config_db):
device_metadata = config_db.get_entry('DEVICE_METADATA', 'localhost')
return 'dynamic' == device_metadata.get('buffer_model')

#
# 'qos scheduler' group ('config qos scheduler ...')
#
@qos.group()
def scheduler():
"""QoS-Scheduler-related configuration tasks"""
pass

@scheduler.command(name='add')
@click.argument('profile_name', metavar='<profile_name>', required=True)
@click.option('--meter_type', help='Meter type', type=click.Choice(['bytes', 'packets']), default='bytes')
@click.option('--pir', help='Maximum bandwidth rate', type=click.IntRange(1, 50000000000), required=True)
@click.option('--pbs', help='Maximum bandwidth burst', type=click.IntRange(1, 256000000), required=True)
def add(profile_name, meter_type, pir, pbs):
"""Add QoS-Scheduler profile."""

config_db = ConfigDBConnector()
config_db.connect()

data = {
'meter_type': meter_type,
'pir': pir,
'pbs': pbs
}

config_db.set_entry("SCHEDULER", profile_name, data)

@scheduler.command(name='del')
@click.argument('profile_name', metavar='<profile_name>', required=True)
def delete(profile_name):
"""Delete QoS-Scheduler profile."""

config_db = ConfigDBConnector()
config_db.connect()

config_db.set_entry("SCHEDULER", profile_name, None)

#
# 'warm_restart' group ('config warm_restart ...')
#
Expand Down
58 changes: 58 additions & 0 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6107,6 +6107,64 @@ Some of the example QOS configurations that users can modify are given below.
When there are no changes in the platform specific configutation files, they internally use the file "/usr/share/sonic/templates/buffers_config.j2" and "/usr/share/sonic/templates/qos_config.j2" to generate the configuration.
```

**config qos scheduler add**

This command is used for creating QoS scheduler profile.

- Usage:
```
config qos scheduler add <profile_name> [--meter_type (bytes | packets)] --pir=<pir> --pbs=<pbs>
```

Parameters

* profile_name: QoS scheduler profile name.

* meter_type: scheduler meter type. One of:

* "bytes": metering is done based on bytes.

* "packets": metering is done based on packets.

Default: "bytes".

* pir: shaper maximum bandwidth rate.

* When meter type is "bytes":

Unit: Bps(bytes per second). Minimum: "1000" (AS8000 and AS9716-32D: "4000"). Maximum: "50000000000".

* When meter type is "packets":

Unit: pps(packets per second). Minimum: "1". Maximum: "50000000000".

* pbs: shaper maximum bandwidth burst. Unit: bytes if meter type is "bytes", otherwise packets. Minimum: "1". Maximum: "256000000".

The following example shows how to create a QoS scheduler profile named profile-1. meter_type: bytes. pir: 100000. pbs: 8000.
- Example:
```
admin@sonic:~$ sudo config qos scheduler add profile-1 --meter_type=bytes --pbs=100000 --pir=8000
```

**config qos scheduler del**

This command is used for removing QoS scheduler profile.

- Usage:
```
config qos scheduler del <profile_name>
```

Parameters

* profile_name: QoS scheduler profile name.

The following example shows how to remove a QoS scheduler profile named profile-1.
- Example:
```
admin@sonic:~$ sudo config qos scheduler del profile-1
```

Go Back To [Beginning of the document](#) or [Beginning of this section](#qos)

## sFlow
Expand Down