Classification and Scheduling
Class Map View
Section titled “Class Map View”Table 1 Class Map View
| Command | Purpose |
|---|---|
| **show class-map ** [class_map_name] | Display class map configuration. |
show class-map [
Section titled “show class-map [”[Command] **show class-map ** [class_map_name]
[Purpose] Display class map configuration.
[Parameters]
| Parameter | Description |
|---|---|
| class_map_name | Class map name. |
[View] Privileged User View
[Use Cases]
sonic# show class-mapClass Map Config
Section titled “Class Map Config”Table 2 Class Map Config
| Command | Purpose |
|---|---|
| class-map class_map_name | Create a class map, and enter Class Map Configuration View. |
| match cos cos_value | Specify the COS value. |
class-map
Section titled “class-map”[Command] class-map class_map_name
[Purpose] Create a class map, and enter Class Map Configuration View
[Parameters]
| Parameter | Description |
|---|---|
| class_map_name | Class map name. |
[View] Global Configuration View
[Notes] Run command no class-map class_map_name to delete the class map.
[Use Cases]
sonic# configure terminalleaf-138(config)# class-map cmap_4leaf-138(config-cmap-cmap_4)# match cos 4leaf-138(config-cmap-cmap_4)# show this!class-map cmap_4 match cos 4leaf-138(config-cmap-cmap_4)#leaf-138(config-cmap-cmap_4)# match cos 3 4leaf-138(config-cmap-cmap_4)# show this!class-map cmap_4 match cos 3 4match cos
Section titled “match cos”[Command] match cos cos_value
[Purpose] Specify the COS value.
[Parameters]
| Parameter | Description |
|---|---|
| cos_value | The range is from 0 to7. When specifying more than one, use spaces to separate them. |
[View] Class Map Configuration View
[Notes] COS 0~7 corresponds to queues 0~7 one-to-one. Modifying the map of COS to queues is not supported yet.
[Use Cases]
sonic# configure terminalsonic(config)# class-map test_1000sonic(config-cmap-test_1000)# match cos 2 3 4 5Diffserv Map
Section titled “Diffserv Map”Diffserv Map View
Section titled “Diffserv Map View”Table 3 Diffserv Map View
| Command | Purpose |
|---|---|
| **show diffserv-map ** [type {ip-dscp default|diffserv_map_name |8021p diffserv_map_name}] | Display diffserv map configuration. |
show diffserv-map [type {ip-dscp default|
Section titled “show diffserv-map [type {ip-dscp default|”[Command] **show diffserv-map ** [type {ip-dscp default|diffserv_map_name |8021p diffserv_map_name}]
[Purpose] Display diffserv map configuration.
[Parameters]
| Parameter | Description |
|---|---|
| diffserv_map_name | Diffserv map name. |
[View] Privileged User View
[Notes] default is the default diffserv map (ip-dscp type).
[Use Cases]
sonic# show diffserv-mapDiffserv Map default:Type ip-dscp from 30 to 3 from 42 to 5 from 43 to 5 from 60 to 7 from 61 to 7 from 62 to 7 from 63 to 7 from 53 to 6 from 52 to 6 from 23 to 2 from 24 to 3 from 25 to 3 from 26 to 3 from 27 to 3 from 20 to 2 from 21 to 2 from 22 to 2 from 49 to 6 from 46 to 5 from 47 to 5 from 44 to 5 from 45 to 5 from 28 to 3 from 29 to 3 from 40 to 5 from 41 to 5 from 1 to 0 from 0 to 0 from 3 to 0 from 2 to 0 from 5 to 0 from 4 to 0 from 7 to 0 from 6 to 0 from 9 to 1 from 8 to 1 from 18 to 2 from 39 to 4 from 38 to 4 from 59 to 7 from 32 to 4 from 14 to 1 from 11 to 1 from 10 to 1 from 13 to 1 from 12 to 1 from 15 to 1 from 58 to 7 from 17 to 2 from 16 to 2 from 19 to 2 from 54 to 6 from 31 to 3 from 56 to 7 from 51 to 6 from 36 to 4 from 35 to 4 from 34 to 4 from 33 to 4 from 55 to 6 from 37 to 4 from 48 to 6 from 57 to 7 from 50 to 6Diffserv Map Config
Section titled “Diffserv Map Config”Table 4 Diffserv Map Config
| Command | Purpose |
|---|---|
| diffserv-map type {ip-dscp|8021p} diffserv_map_name | Create a diffserv map, and enter Diffserv Map Configuration View. |
| default {cos_value|copy} | Configure COS mapping in bulk. |
| ip-dscp dscp_value cos cos_value | Set DSCP to COS mapping. |
| 8021p dot1p_value cos cos_value | Set DOT1P to COS mapping. |
diffserv-map type {ip-dscp|8021p}
Section titled “diffserv-map type {ip-dscp|8021p}”[Command] diffserv-maptype {ip-dscp|8021p} diffserv_map_name
[Purpose] Create a diffserv map, and enter Diffserv Map Configuration View
[Parameters]
| Parameter | Description |
|---|---|
| diffserv_map_name | Diffserv map name. |
[View] Global Configuration View
[Notes] There are DSCP mappings and DOT1P mappings.
[Use Cases]
sonic# configure terminalsonic(config)# diffserv-map type ip-dscp testdiff1sonic(config-diffservmap-testdiff1)# exitsonic(config)#diffserv-map type 8021p testdiff2sonic(config-diffservmap-testdiff2)#default {
Section titled “default {”[Command] default {cos_value|copy}
[Purpose] Configure COS mapping in bulk.
[Parameters]
| Parameter | Description |
|---|---|
| cos_value | The range is from 0 to7. |
[View] Diffserv Map Configuration View
[Notes] COS 0~7 corresponds to queues 0~7 one-to-one. Modifying the map of COS to queues is not supported yet.; default cos_value indicates that all traffic will be mapped to the specified COS value. default copy indicates to use the default DSCP mapping(only for DSCP to COS mapping). Run command no default to delete this mapping configuration.
[Use Cases]
sonic(config)# diffserv-map type 8021p test1sonic(config-diffservmap-test1)# default 0sonic(config-diffservmap-test1)# do show diffserv-mapDiffserv Map test1:Type 8021p from 0 to 0 from 1 to 0 from 2 to 0 from 3 to 0 from 4 to 0 from 5 to 0 from 6 to 0 from 7 to 0ip-dscp
Section titled “ip-dscp”[Command] ip-dscp dscp_value cos cos_value
[Purpose] Set DSCP to COS mapping.
[Parameters]
| Parameter | Description |
|---|---|
| dscp_value | The range is from 0 to 63. |
| cos_value | The range is from 0 to 7. |
[View] DSCP Diffserv Map Configuration View
[Notes] COS 0~7 corresponds to queues 0~7 one-to-one. Modifying the map of COS to queues is not supported yet.; Run command no ip-dscp dscp_value cos cos_value to delete DSCP to COS mapping.
[Use Cases]
sonic(config)# diffserv-map type ip-dscp testdiff1sonic(config-diffservmap-testdiff1)# ip-dscp 0 cos 2sonic(config-diffservmap-testdiff1)# ip-dscp 1 cos 4[Command] 8021p dot1p_value cos cos_value
[Purpose] Set DOT1P to COS mapping.
[Parameters]
| Parameter | Description |
|---|---|
| dot1p_value | The range is from 0 to 7. |
| cos_value | The range is from 0 to 7. |
[View] DOT1P Diffserv Map Configuration View
[Notes] COS 0~7 corresponds to queues 0~7 one-to-one. Modifying the map of COS to queues is not supported yet.; Run command no 8021p dot1p_value cos cos_value to delete DOT1P to COS mapping.
[Use Cases]
sonic(config)# diffserv-map type 8021p testdiff2sonic(config-diffservmap-testdiff2)# 8021p 0 cos 2sonic(config-diffservmap-testdiff2)# 8021p 1 cos 4Policy Map
Section titled “Policy Map”Policy Map View
Section titled “Policy Map View”Table 5 Policy Map View
| Command | Purpose |
|---|---|
| **show policy-map ** [policy_map_name] | Display policy map configuration. |
| show interface policy-map | Display the relationship between interfaces and policy-maps. |
show policy-map [
Section titled “show policy-map [”[Command] **show policy-map ** [policy_map_name]
[Purpose] Display policy map configuration.
[Parameters]
| Parameter | Description |
|---|---|
| policy_map_name | Policy map name. |
[View] Privileged User View
[Use Cases]
sonic# show policy-map!policy-map test!policy-map test11!policy-map test_pfc class cmap_4 priority-group-buffer pg_lossless_1!show interface policy-map
Section titled “show interface policy-map”[Command] show interface policy-map
[Purpose] Display the relationship between interfaces and policy-maps.
[View] Privileged User View
[Use Cases]
sonic# show interface policy-mapPort service policy------ ----------------0/0 roce_lossless0/4 test0/8 roce_lossless0/12 roce_lossless0/16 roce_lossless0/20 roce_lossless0/24 roce_lossless0/28 roce_lossless0/32 roce_lossless0/36 roce_lossless0/40 roce_lossless0/44 roce_lossless0/48 roce_lossless……Policy Map Config
Section titled “Policy Map Config”Table 6 Policy Map Config
| Command | Purpose |
|---|---|
| policy-map policy_map_name | Create a policy map, and enter Traffic Policy Configuration View. |
| set cos {dscp|8021p} diffserv diffserv_map_name | Set DSCP or DOT1P to COS mapping. |
| port-shape target-bit-rate burst-size | Add a speed limit policy for ports. |
| queue-sheduler priority queue queue-id | Add strict queue scheduling policies. |
| queue-scheduler queue-limit percent queue-wight queue queue-id | Add DWRR queue scheduling policies. |
| class {class_map_name|class-default} | Specify the COS value of the policy, and enter Policy Map-Class Map Configuration View. |
| queue-shape target-bit-rate burst-size | Add a speed limit policy for queues. |
| wred {wred_profile_name|default_drop|default_ecn} | Bind WRED profile to the class map. |
| priority-group-buffer buffer_profile_name | Bind a custom PG buffer profile (Ingress). |
| queue-buffer buffer_profile_name | Bind a custom Queue Buffer Profile (Egress). |
| bandwidth rate-bps [burst-size] | Set minimum guaranteed bandwidth. |
| service-policy policy_map_name | Apply the policy to the interface. |
policy-map
Section titled “policy-map”[Command] policy-map policy_map_name
[Purpose] Create a policy map, and enter Traffic Policy Configuration View.
[Parameters]
| Parameter | Description |
|---|---|
| policy_map_name | Policy map name. |
[View] Global Configuration View
[Notes] Run command no policy-map policy_map_name to delete the policy map.
[Use Cases]
sonic# configure terminalsonic(config)# policy-map test1sonic(config-pmap-test1)#set cos {dscp|8021p} diffserv
Section titled “set cos {dscp|8021p} diffserv”[Command] set cos {dscp|8021p} diffserv diffserv_map_name
[Purpose] Set DSCP or DOT1P to COS mapping.
[Parameters]
| Parameter | Description |
|---|---|
| diffserv_map_name | Diffserv map name. |
[View] Traffic Policy Configuration View
[Notes] COS 0~7 corresponds to queues 0~7 one-to-one. Modifying the map of COS to queues is not supported yet. Run command no set cos {dscp|8021p} diffserv diffserv_map_name to delete the mapping.
[Use Cases]
sonic(config-pmap-test1)# set cos dscp diffserv testdiff1port-shape
Section titled “port-shape”[Command] port-shape target-bit-rate burst-size
[Purpose] Add a speed limit policy for ports.
[Parameters]
| Parameter | Description |
|---|---|
| target-bit-rate | Specify the target rate in Bps, the value range of CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 model equipment is from 320000 to line rate, and the value range of other equipment is from 64000 to line rate. |
| burst-size | Specify the burst size in bytes, and the range is from 1000 to 3145728. |
[View] Traffic Policy Configuration View
[Notes] The port shaping policy should be configured on the egress interface of the traffic. Run command no port-shape to delete the speed limit policy.
[Use Cases]
Limit the speed of the interface to 2Gbps.sonic(config)# policy-map pmap1sonic(config-pmap-pmap1)# port-shape 250000000 128000sonic(config-pmap-pmap1)# interface ethernet 0/76sonic(config-if-0/76)# service-policy pmap1queue-scheduler priority queue
Section titled “queue-scheduler priority queue”[Command] queue-scheduler priority queue queue-id
[Purpose] Add strict queue scheduling policies.
[Parameters]
| Parameter | Description |
|---|---|
| queue-id | Queue ID, the range is [0,7] |
[View] Traffic Policy Configuration View
[Notes] Run command no queue-scheduler priority queue queue-id to delete strict queue scheduling policies.
[Use Cases]
sonic(config-pmap-test1)# queue-scheduler priority queue 2sonic(config-pmap-test1)# queue-scheduler priority queue 3queue-scheduler queue-limit percent
Section titled “queue-scheduler queue-limit percent”[Command] queue-scheduler queue-limit percent queue-wight queue queue-id
[Purpose] Add DWRR queue scheduling policies.
[Parameters]
| Parameter | Description |
|---|---|
| queue-wight | Queue weight, the range is [1,100] |
| queue-id | Queue ID, the range is [0,7] |
[View] Traffic Policy Configuration View
[Notes] Run command no queue-scheduler queue-limit percent queue-wight queue queue-id to delete DWRR queue scheduling policies.
[Use Cases]
sonic(config-pmap-test1)# queue-scheduler priority queue 2sonic(config-pmap-test1)# queue-scheduler priority queue 3sonic(config-pmap-test1)# queue-scheduler queue-limit percent 20 queue 4sonic(config-pmap-test1)# queue-scheduler queue-limit percent 20 queue 5class {
Section titled “class {”[Command] class {class_map_name|class-default}
[Purpose] Specify the COS value of the policy, and enter Policy Map-Class Map Configuration View.
[Parameters]
| Parameter | Description |
|---|---|
| class_map_name | Class map name. |
[View] Traffic Policy Configuration View
[Notes] When configuring queue limit/WRED/Queue Buffer/PG Buffer policy, you need to specify the matching COS value first. COS 0~7 corresponds to queues 0~7 one-to-one. Modifying the map of COS to queues is not supported yet.; class-default is the default class map of the system, which will match any other unclassified packets. Run command no class {class_map_name|class-default} to unbind the class map from the policy.
[Use Cases]
sonic(config)# policy-map roce_losslesssonic(config-pmap-roce_lossless)# class roce_lossless_class_mapsonic(config-pmap-c)#queue-shape
Section titled “queue-shape”[Command] queue-shape target-bit-rate burst-size
[Purpose] Add a speed limit policy for queues.
[Parameters]
| Parameter | Description |
|---|---|
| target-bit-rate | Specify the target rate in Bps, and the value range of CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 model equipment is from 320000 to line rate, and the value range of other equipment is from 64000 to line rate. |
| burst-size | Specify the burst size in bytes, and the range is from 1000 to 3145728. |
[View] Policy Map-Class Map Configuration View
[Notes] Before running this command, please bind an existing class map to specify the queue to be matched for the policy. Run command no queue-shape to delete the speed limit policy.
[Use Cases]
sonic(config)# class-map classtestsonic(conifg-cmap-classtest)# exitsonic(config)# polic-map test1sonic(config-pmap-test1)# class classtestsonic(config-pmap-c)# queue-shape 1200000 128000wred {
Section titled “wred {”[Command] wred {wred_profile_name|default_drop|default_ecn}
[Purpose] Bind WRED profile to the class map.
[Parameters]
| Parameter | Description |
|---|---|
| wred_profile_name | Profile name. |
[View] Policy Map-Class Map Configuration View
[Notes] Before running this command, please bind an existing class map to specify the queue to be matched for the policy. Two default WRED templates, default_drop and default_ecn, are built in ‘-N’ model switches, which users can bind directly, and not in ‘-N-V2’. Run command no wred wred_profile_name to unbind the WRED profile.
[Use Cases]
sonic(config)# class-map classtestsonic(conifg-cmap-classtest)# exitsonic(config)# polic-map test1sonic(config-pmap-test1)# class classtestsonic(config-pmap-c)# wred wred_profilepriority-group-buffer
Section titled “priority-group-buffer”[Command] priority-group-buffer buffer_profile_name
[Purpose] Bind a custom PG buffer profile (Ingress).
[Parameters]
| Parameter | Description |
|---|---|
| buffer_profile_name | Profile name. |
[View] Policy Map-Class Map Configuration View
[Notes] Use this command to bind a PG buffer profile when configuring a custom PFC. Before running this command, please bind an existing class map to specify the queue to be matched for the policy. Run command no priority-group-buffer buffer_profile_name to unbind the PG buffer profile.
[Use Cases]
sonic(config)# buffer-profile pg_lossless_100000_100m_profilesonic(config-buffer-profile-pg_lossless_100000_100m_profile)# mode lossless dynamic 1 size 1518 xoff 46496 xon-offset 13440sonic(config-buffer-profile-pg_lossless_100000_100m_profile)# exitsonic(config)# polic-map test1sonic(config-pmap-test1)# class cmap_4sonic(config-pmap-c)# priority-group-buffer pg_lossless_100000_100m_profilequeue-buffer
Section titled “queue-buffer”[Command] queue-buffer buffer_profile_name
[Purpose] Bind a custom Queue Buffer Profile (Egress).
[Parameters]
| Parameter | Description |
|---|---|
| buffer_profile_name | Profile name. |
[View] Policy Map-Class Map Configuration View
[Notes] Before running this command, please bind an existing class map to specify the queue to be matched for the policy. It is generally not recommended to modify the interface egress queue buffer manually, so please be careful. Setting unreasonable parameters may cause loss of packets while forwarding traffic on the interface. Run command no queue-buffer buffer_profile_name to unbind the queue buffer profile.
[Use Cases]
sonic(config)# class-map classtestsonic(conifg-cmap-classtest)# exitsonic(config)# polic-map test1sonic(config-pmap-test1)# class classtestsonic(config-pmap-c)# queue-buffer buffer_profilebandwidth
Section titled “bandwidth”[Command] bandwidth rate-Bps [burst-size]
[Purpose] Set minimum guaranteed bandwidth.
[Parameters]
| Parameter | Description |
|---|---|
| rate-Bps | Bandwidth value, unit bytes/s, the value range of CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2 model equipment is from 320000 to line rate, and the value range of other equipment is from 64000 to line rate. |
| burst-size | Burst value, unit byte, range [64000,3145728] |
[View] Policy Map-Class Map Configuration View
[Notes] Before running this command, please bind an existing class map to specify the queue to be matched for the policy. Run command no bandwidth to delete Bandwidth Configuration.
[Use Cases]
sonic(config)# class-map classtestsonic(conifg-cmap-classtest)# exitsonic(config)# polic-map test1sonic(config-pmap-test1)# class classtestsonic(config-pmap-c)# bandwidth 64000service-policy
Section titled “service-policy”[Command] service-policy policy_map_name
[Purpose] Apply the policy to the interface.
[Parameters]
| Parameter | Description |
|---|---|
| policy_map_name | Policy map name. |
[View]
Physical Interface Configuration View
[Notes] When the policy has been applied to an interface, please unbind the interface from the policy before modifying the policy configuration. Run command no service-policy policy_map_name to unbind the policy.
[Use Cases]
sonic(config)# interface ethernet 0/0sonic(config-if-0/0)# service-policy test1Queue View
Section titled “Queue View”Table 7 Queue View
| Command | Purpose |
|---|---|
| **show counters queue ** [interface_name] | Display queue counters. |
| clear counters queue | Clear queue counters. |
show counters queue [
Section titled “show counters queue [”[Command] **show counters queue ** [interface_name]
[Purpose] Display queue counters.
[Parameters]
| Parameter | Description |
|---|---|
| interface_name | Interface name (eg.0/1) |
[View] Privileged User View
[Use Cases]
sonic# show counters queue 0/0The poll time of QUEUES COUNTERS is 2000.0 ms, update time of queue rates is 4000.0 ms Port TxQ Counter/pkts Counter/bytes Drop/pkts Drop/bytes CounterRate/pkts CounterRate/bytes DropRate/pkts DropRate/bytes Occupancy/bytes SharedOccupancy/bytes--------- ----- -------------- --------------- ----------- ------------ ------------------ ------------------- --------------- ---------------- ----------------- ----------------------- 0/0 UC0 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC1 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC2 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC3 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC4 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC5 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC6 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0 0/0 UC7 0 0 0 0 0.00/s 0.00 B/s 0.00/s 0.00 B/s 0 0clear counters queue
Section titled “clear counters queue”[Command] clear counters queue
[Purpose] Clear queue counters.
[View] Privileged User View
[Use Cases]
sonic# clear counters queue