Skip to content

ECN WRED configuration utility

Andriy Moroz edited this page Oct 30, 2017 · 6 revisions

[DRAFT - under development]

Requirements

(Enable-ECN-on-lossless-queues)
...
1.1. Design a cli (console) command that supports showing and setting ECN configuration.
1.2. Any dynamic set value should go to conf_DB directly.
...

Scope

Design document of the ECN WRED parameters configuration utility in SONiC

Purpose

Configure ECN WRED parameters.

General utility design

  • Implemented in Python
  • Set parameters as a value of an appropriate command line option.
  • WRED parameters will be set per profile
  • Return code: 0 if succeeded, not 0 otherwise.

Usage syntax

	ecnconfig [-l] [-p profile] [-gmax <value>] [-gmin <value>]
	Options:  
	  -l         - list available profiles and WRED values
	  -p         - specify profile to set values for
	  -gmax      - specify max threshold for packets marked 'green'
	  -gmin      - specify min threshold for packets marked 'green'

If needed, parameters for configuring red and yellow thresholds can be added (-rmax/-rmin, -ymax/-ymin).

Usage and output examples

	root@arc-switch1028:/home/admin# ecnconfig -l
	Profile: AZURE_LOSSY
	--------------------
	green_max_threshold: 184320
	green_min_threshold: 184320
	red_max_threshold: 512000
	red_min_threshold: 512000
	yellow_max_threshold: 512000
	yellow_min_threshold: 512000

	Profile: AZURE_LOSSLESS
	--------------------
	green_max_threshold: 184320
	green_min_threshold: 184320
	red_max_threshold: 512000
	red_min_threshold: 512000
	yellow_max_threshold: 512000
	yellow_min_threshold: 512000

	root@arc-switch1028:/home/admin#
	root@arc-switch1028:/home/admin# ecnconfig -p AZURE_LOSSLESS -gmax 184416
	root@arc-switch1028:/home/admin#

Implementation details

Utility operates in two modes: list and set. In "list" mode utility shows WRED profiles available in the CONFIG_DB and the threshold values in these tables. In "set" mode the value(s) for specified threshold and profile is set to CONFIG_DB database. At start utility parses and validates input arguments. Invalid parameter or combination of parameters is reported to user and return code is non-zero. For example, -l for list and -gmax to set green max threshold specified together will cause error.

Arguments parsing

argparse module can be used to parse utility input arguments. It is easy to utilize and provides auto generated program help(usage) message.
Initialization example:

	import argparse
	...
	parser = argparse.ArgumentParser(description='Set ECN WRED parameters',
                                 version='1.0.0',
                                 formatter_class=argparse.RawTextHelpFormatter)
	parser.add_argument('-l', '--list', type='store_true', help='List available profiles and values')

Connect to SONiC Redis DB

swsssdk is the SONiC python module which unifies access to the SONiC Redis DB.
An example how to set green max threshold to 500000 for profile AZURE_LOSSLESS:

	import swsssdk
	db = swsssdk.SonicV2Connector(host="127.0.0.1")
	db.connect(db.CONFIG_DB)
	db.set(db.CONFIG_DB, "WRED_PROFILE_TABLE:AZURE_LOSSLESS", "green_max_threshold", "500000")

Connection with 'show' and 'config' utilities

Utilities show (sonic-buildimage/src/sonic-utilities/show/main.py) and config (sonic-buildimage/src/sonic-utilities/config/main.py) needs to be updated in order to provide unified system configuration.
New command is added under the new group "ecn".

Show command syntax to list ecn wred profiles:

	show ecn

Config command syntax to set ecn wred value:

	config ecn wred_green_max_threshold <profile> <value>
	E.g.
	config ecn wred_green_max_threshold AZURE_LOSSLESS 500000

Open questions

  • create wred profiles?
  • assign to ports/queues?
  • configure red and yellow thresholds?
Clone this wiki locally