S commands

service-policy

To attach a policy map to an interface, VLAN, or tunnel, use the service-policy command. To remove a service-policy from an interface, VLAN or tunnel, use the no form of this command.

service-policy [ type { qos | queuing } ] { input | output } policy-map-name [no-stats]

no service-policy [ type { qos | queuing } ] { input | output } policy-map-name [no-stats]

Syntax Description

type

(Optional) Specifies whether the policy map is of type qos or queuing.

qos

Specifies a policy map of type qos.

queuing

Specifies a policy map of type queuing.

input

Applies this policy map to packets coming into this interface.

output

Applies this policy map to packets going out of this interface.

policy-map-name

Name of the policy map to attach to this interface. Only one policy map can be attached to the input and one to the output of a given interface for each of the policy type qos and queuing.

no-stats

(Optional) Disables generation of statistics for this policy map.

Command Default

type default is qos.

No policies of type qos are active on an interface until the service-policy command is entered. The system-defined type queuing class maps are attached to each interface unless you specifically attach a different class map. For a list of the system-defined type queuing class maps, see Table 1.

Command Modes

Interface configuration

VLAN configuration

Command History

Release

Modification

5.x

changed the command output.

4.0

This command was introduced.

4.0(3)

Support for tunnel interfaces is added.

Usage Guidelines

No policies of type qos are active on an interface until you enter the service-policy command. The system-defined type queuing class maps are attached to each interface unless you specifically attach a different class map.

You can attach one ingress and one egress type qos policy map to a port, port channel, tunnel, or VLAN. You can attach one ingress and one egress type queuing policy map to an interface of type port, port channel, tunnel, or VLAN.

Only one policy map can be attached to the input and one to the output of a given interface for each of the policy type qos and queuing.


Note


For more information on using service policies, see the Cisco Nexus 7000 Series NX-OS Quality of Service Configuration Guide, Release 5.0.

This command does not require a license.

Examples

This example shows how to attach qos type policy maps to the ingress and egress packets of a VLAN:

switch(config)# vlan configuration 111
switch(config-vlan)# service-policy input my_input_policy
switch(config-vlan)# service-policy output my_output_policy
switch(config-vlan)# 

This example shows how to attach a queuing policy map to the ingress packets of a port interface:

switch(config)# interface ethernet 2/1
switch(config-if)# service-policy type queuing input my_input_q_policy
switch(config-if)# 

This example shows how to remove a policy map from a VLAN:

switch(config)# vlan 1
switch(config-vlan)# no service-policy input my_input_policy
switch(config-vlan)# 

Related Commands

Command

Description

show policy-map interface brief

Displays all interfaces and VLANs with attached service policies in a brief format.

set cos (policy map type qos)

To assign a class of service (CoS) value for a class of traffic in a type qos policy map, use the set command. To remove the assigned value from the class, use the no form of this command.

set cos cos-value

no set cos cos-value

Syntax Description

cos-value

CoS value to assign for this class of traffic. Valid values are from 0 to 7.

Command Default

None

Command Modes


Policy map type qos class configuration

Command History

Release

Modification

4.0

This command was introduced.

Usage Guidelines

You can use the set cos (policy map type qos) command only on type qos policies that are attached to egress ports.

This command does not require a license.

Examples

This example shows how to remove an assignment of CoS for a class of traffic in a type qos policy map:

switch(config)# policy-map my_policy1
switch(config-pmap-qos)# class traffic_class2
switch(config-pmap-c-qos)# no set cos 3
switch(config-pmap-c-qos)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

set cos (policy map type queuing)

To assign a class of service (CoS) value for untrusted ports in a type queuing policy map, use the set cos command. To remove the assigned value from the class, use the no form of this command.

set cos cos-value-queuing

no set cos cos-value-queuing

Syntax Description

cos cos-cos-value-queuing

Specifies the CoS value to assign for this class of traffic. Valid values are from 0 to 7.

Command Default

None

Command Modes


Policy map type queuing class configuration

Command History

Release

Modification

4.0

This command was introduced.

Usage Guidelines

You can only use this form of the set cos (policy map type queuing) command for ingress default type queuing classes. For a table of system-defined queuing class maps, see Table 1.


Note


The CoS values that you set by using the set cos command apply to all packets that ingress the specified interfaces (not just to the class-default packets that ingress the interfaces).

If you set the CoS value, the device modifies the value before ingress queuing and scheduling so that the CoS-modified packets are classified differently.

This command does not require a license.

Examples

This example shows how to assign a CoS value for a class of traffic in a queuing policy map:

switch(config)# policy-map type queuing match-first my_queuing_policy1
switch(config-pmap-que)# class type queuing 2q4t-in-q-default
switch(config-pmap-c-que)# set cos 3
switch(config-pmap-c-que)# 

This example shows how to remove a CoS assignment for a class of traffic in a queuing policy map:

switch(config)# policy-map type queuing match-first my_queuing_policy1
switch(config-pmap-que)# class type queuing 2q4t-in-q-default
switch(config-pmap-c-que)# no set cos 3
switch(config-pmap-c-que)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

set discard-class

To assign a discard-class value for a class of traffic in a type qos policy map, use the set discard-class command. To leave the discard-class values unchanged, use the no form of this command.

set discard-class discard-value

no set discard-class discard-value

Syntax Description

discard-value

Discard-class value to assign for this class of traffic. Valid values are from 0 to 63.

Command Default

None

Command Modes


Policy map type qos class configuration

Command History

Release

Modification

4.0

This command was introduced.

Usage Guidelines

You can set the discard-class value only in ingress policies.


Note


If you configure this value, you cannot configure a value by using the set dscp or the set precedence command.

This command does not require a license.

Examples

This example shows how to assign the discard-class value for a class of traffic in a type qos policy map:

switch(config)# policy-map my_policy1
switch(config-pmap-qos)# class traffic_class2
switch(config-pmap-c-qos)# set discard-class 40
switch(config-pmap-c-qos)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

set dscp (QoS)

To assign a Differentiated Services Code Point (DSCP) value for a class of traffic in a type qos policy map, use the set dscp command. To remove a previously set DSCP value, use the no form of this command.

set dscp [tunnel] dscp-value

no set dscp [tunnel] dscp-value

Syntax Description

tunnel

Sets the DSCP value in the tunnel encapsulation. This keyword is not supported in Release 4.0.1.

dscp-value

DSCP value or parameter to assign for this class of traffic. Valid values are from 0 to 63.

Command Default

None

Command Modes


Policy map type qos class configuration

Command History

Release

Modification

4.0

This command was introduced.

4.0.3

The tunnel keyword is supported.

Usage Guidelines


Note


If you configure this value, you cannot configure a value by the set discard-class or set precedence command. If QoS policy is applied on Vlan Configuration Level the DSCP value will Also derive the Cos value for Bridged and Routed Traffic from the three Most Significant DSCP bits

This command does not require a license.

Examples

This example shows how to assign DSCP for a class of traffic in a type qos policy map:

switch(config)# policy-map my_policy1
switch(config-pmap-qos)# class traffic_class2
switch(config-pmap-c-qos)# set cos 3
switch(config-pmap-c-qos)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

set precedence (QoS)

To set precedence value in an IP header for a class of traffic in a type qos policy map, use the set precedence command. To leave the precedence value unchanged for the class, use the no form of this command.

set precedence [tunnel] precedence-value

no set precedence [tunnel] precedence-value

Syntax Description

tunnel

(Optional) Sets the IP precedence value in the tunnel encapsulation. This keyword is not supported in Release 4.0.1.

precedence-value

IP precedence value to assign for this class of traffic. Valid values are from 0 to 7.

Command Default

None

Command Modes

Policy map type qos class configuration

Command History

Release

Modification

4.0

This command was introduced.

4.0.3

The tunnel keyword is supported.

Usage Guidelines

For a list of the IP precedence values, see Table 1.

The device rewrites the last 3 bits of the Type of Service (ToS) field in the IP header to 0 for packets that match this class.


Note


If you configure this value, you cannot configure a value by using the set discard-class or set dscp command.

This command does not require a license.

Examples

This example shows how to set the IP precedence value for a class of traffic in a type qos policy map:

switch(config)# policy-map policy1
switch(config-pmap-qos)# class class2
switch(config-pmap-c-qos)# set precedence 3
switch(config-pmap-c-qos)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

set qos-group

To assign the QoS group identifier for a class of traffic in a type qos policy map, use the set qos-group command. To remove the assigned value from the class, use the no form of this command.

set qos-group qos-group-value

no set qos-group qos-group-value

Syntax Description

qos-group-value

QoS group value to assign for this class of traffic. Valid values are from 1 to 126.

Command Default

None

Command Modes


Policy map type qos class configuration

Command History

Release

Modification

4.0

This command was introduced.

Usage Guidelines

You can set the QoS group identifier value only in ingress policies.

This command does not require a license.

Examples

This example shows how to assign a QoS group identifier for a class of traffic in a type qos policy map:

switch(config)# policy-map my_policy1
switch(config-pmap-qos)# class traffic_class2
switch(config-pmap-c-qos)# set qos-group 100
switch(config-pmap-c-qos)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

set table

To define a mapping between two fields for a class of traffic in a type qos policy map, use the set table command. To remove the assigned mapping from the class, use the no form of this command.

set header-parameter { same-header-parameter | output-header-parameter } table { table-map-name | mutation-map }

no set header-parameter { same-header-parameter | output-header-parameter } table { table-map-name | mutation-map }

Syntax Description

header-parameter

Header parameters. For example, cos, dscp, precedence, or discard-class.

same-header-parameter

Header parameter that is the same as the first header parameter in the command line.

output-header-parameter

Output header parameter that is different from the first header parameter in the command line. This parameter is used in mutation mapping.

table-map-name

User-defined table map name to use for mapping the specified header parameter.

mutation-map

System-defined table map name to use for mutation mapping of the input parameter to the output parameter.

Command Default

None

Command Modes


Policy map type qos class configuration

Command History

Release

Modification

4.0

This command was introduced.

4.1(2)

You can set only similar values when you create a mutation map. For example, you can set cos-cos or dscp-dscp; you cannot set cos-dscp or dscp-precedence.

Usage Guidelines

The system-defined table maps used in the set table command are shown in the following table:

Table 1 System-Defined Table Maps Used in the set table Command

Table Map Name

Description

cos-discard-class-map

Table map used to map the CoS value to the discard-class value.

cos-dscp-map

Table map used to map the CoS value to the DSCP value.

cos-precedence-map

Table map used to map the CoS value to the precedence value.

dscp-cos-map

Table map used to map the DSCP value to the CoS value.

dscp-precedence-map

Table map used to map the DSCP value to the precedence value.

dscp-discard-class-map

Table map used to map the DSCP value to the discard-class value.

precedence-dscp-map

Table map used to map the precedence value to the DSCP value.

precedence-cos-map

Table map used to map the precedence value to the CoS value.

precedence-discard-class-map

Table map used to map the precedence value to the discard-class value.

discard-class-cos-map

Table map used to map the discard-class value to the CoS value.

discard-class-prec-map

Table map used to map the discard-class value to the precedence value.

discard-class-dscp-map

Table map used to map the discard-class value to the DSCP value.


Note


You can set only similar values when you create a mutation map. For example, you can set cos-cos or dscp-dscp; you cannot set cos-dscp or dscp-precedence.

This command does not require a license.

Examples

This example shows how to perform mutation mapping for a class of traffic in a type qos policy map based on input DSCP, and output IP precedence using a system-defined table map:

switch(config)# policy-map my_policy1
switch(config-pmap-qos)# class traffic_class2
switch(config-pmap-c-qos)# set dscp precedence table dscp-precedence-map
switch(config-pmap-c-qos)# 

This example shows how to perform mutation mapping for a class of traffic in a type qos policy map based on input DSCP and output IP precedence by using a user-defined table map:

switch(config)# policy-map my_policy1
switch(config-pmap-qos)# class class_default
switch(config-pmap-c-qos)# set dscp dscp table my_table
switch(config-pmap-c-qos)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.

shape

To configure shaping on an egress queue to impose a maximum rate on it, use the shape command. To remove a shaping configuration, use the no form of this command.

shape [average] { average-rate [ bps | kbps | mbps | gbps ] | percent percent-rate }

no shape [average] { average-rate [ bps | kbps | mbps | gbps ] | percent percent-rate }

Syntax Description

average

(Optional) Specifies an optional keyword. Shaping is based on an average rate.

average-rate

Average rate for shaping. The range of values is from 1 to 80000000000; the range of policing values that are mathematically significant is from 8000 to 80 Gbps.

bps

(Optional) Specifies the units of bits per second.

kbps

(Optional) Specifies the units of 1000 bits per second.

mbps

(Optional) Specifies the units of megabits per second.

gbps

(Optional) Specifies the units of gigabits per second.

percent

Specifies the percentage of the underlying interface link rate.

Note    You can use the percent keyword only for interfaces that are set to autonegotiate.

percent-rate

Percentage from 1 to 100.

Command Default

bps is default data rate.

Command Modes


Global configuration

Command History

Release

Modification

4.0

This command was introduced.

Usage Guidelines

You can use the system-defined egress queue class for the type of module to which you want to apply the policy map. For a list of the system-defined type queuing class maps, see Table 1.

The device forces the shape rate to the closest value in the following percentage intervals: 100, 50,33, 25, 12.5, 6.25, 3.13, or 1.07.


Note


If you configure shaping, you cannot configure bandwidth or priority in the same policy map.

This command does not require a license.

Examples

This example shows how to apply shaping based on a percentage rate to a policy map type queuing class:

switch(config)# policy-map type queuing match-first my_queue
switch(config-pmap-que)# class type queuing 1p3q4t-out-pq1
switch(config-pmap-c-que)# shape percent 25
switch(config-pmap-c-que)# 

This example shows how to apply shaping based on an average rate to a policy map type queuing class:

switch(config)# policy-map type queuing match-first my_queue
switch(config-pmap-que)# class type queuing 1p3q4t-out-pq1
switch(config-pmap-c-que)# shape 500 mbps
switch(config-pmap-c-que)# 

This example shows how to remove a shaping configuration from a policy map type queuing class:

switch(config)# policy-map type queuing match-first my_queue
switch(config-pmap-que)# class type queuing 1p3q4t-out-pq1
switch(config-pmap-c-que)# no shape percent 25
switch(config-pmap-c-que)# 

Related Commands

Command

Description

show policy-map

Displays policy maps and statistics.