Skip to content

Policy

Policy configuration provides comprehensive traffic classification and action enforcement through class-maps and policy-maps that define how network traffic should be identified, prioritized, and processed based on various criteria including DSCP markings, protocols, and authentication states. It supports both Quality of Service (QoS) policies for bandwidth management, prioritization, and queuing, as well as control policies for network access control that define actions to take based on authentication events and user authorization status. Policy framework enables fine-grained traffic engineering, security enforcement, and service differentiation by combining flexible matching criteria with configurable actions such as rate limiting, priority queuing, and service template activation.

Diagram
NameTypeConstraintMandatoryDefault Value
policyClass[policy]No

NameTypeConstraintMandatoryDefault Value
class_mapsList[class_maps]No
policy_mapsList[policy_maps]No

class_maps (iosxe.devices.configuration.policy)

Section titled “class_maps (iosxe.devices.configuration.policy)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
typeChoicecontrol, inspect, subscriberNo
subscriberBooleantrue, falseNo
prematchChoicematch-all, match-any, match-noneNo
matchClass[match]No
descriptionStringNo

policy_maps (iosxe.devices.configuration.policy)

Section titled “policy_maps (iosxe.devices.configuration.policy)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
typeChoiceaccess-control, appnav, control, epbr, inspect, ngsw-qos, packet-service, performance-monitor, queueing, service, service-chain, umbrellaNo
subscriberBooleantrue, falseNo
descriptionStringNo
classesList[classes]No
eventsList[events]No

match (iosxe.devices.configuration.policy.class_maps)

Section titled “match (iosxe.devices.configuration.policy.class_maps)”
NameTypeConstraintMandatoryDefault Value
authorization_status_authorizedBooleantrue, falseNo
authorization_status_unauthorizedBooleantrue, falseNo
result_type_aaa_timeoutBooleantrue, falseNo
result_type_successBooleantrue, falseNo
activated_service_templatesListStringNo
authorizing_method_priority_greater_thanListIntegerNo
method_dot1xBooleantrue, falseNo
result_type_method_dot1x_authoritativeBooleantrue, falseNo
result_type_method_dot1x_agent_not_foundBooleantrue, falseNo
result_type_method_dot1x_method_timeoutBooleantrue, falseNo
method_mabBooleantrue, falseNo
result_type_method_mab_authoritativeBooleantrue, falseNo
dscpAnyList[Choice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, ef]] or List[Integer[min: 0, max: 63]] or String[Regex: ^.*[\$\%]\{.*$]No
access_groupsListAny[String or Integer]No
access_groups_legacyListAny[String or Integer]No
ip_dscpListAny[Choice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, dscp, ef, precedence] or Integer[min: 0, max: 63]]No
ip_precedenceListAny[Choice[critical, flash, flash-override, immediate, internet, network, priority, routine] or Integer[min: 0, max: 7]]No
protocolsListStringNo
class_mapsListStringNo

classes (iosxe.devices.configuration.policy.policy_maps)

Section titled “classes (iosxe.devices.configuration.policy.policy_maps)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
typeChoiceinspectNo
actionChoicedrop, inspect, passNo
logBooleantrue, falseNo
parameter_mapStringNo
actionsList[actions]No

events (iosxe.devices.configuration.policy.policy_maps)

Section titled “events (iosxe.devices.configuration.policy.policy_maps)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
event_typeChoiceaaa-available, absolute-timeout, agent-found, authentication-failure, authentication-success, authorization-failure, authorization-success, identity-update, inactivity-timeout, remote-authentication-failure, remote-authentication-success, remote-update, session-disconnected, session-started, tag-added, tag-removed, template-activated, template-activation-failed, template-deactivated, template-deactivation-failed, timer-expiry, violationNo
match_typeChoicematch-all, match-firstNo
classesList[classes]No

actions (iosxe.devices.configuration.policy.policy_maps.classes)

Section titled “actions (iosxe.devices.configuration.policy.policy_maps.classes)”
NameTypeConstraintMandatoryDefault Value
typeChoicebandwidth, compression, dbl, drop, estimate, fair-queue, forward, netflow-sampler, police, priority, queue-buffers, queue-limit, random-detect, service-policy, set, shape, trustNo
bandwidth_bitsIntegermin: 1, max: 100000000No
bandwidth_percentIntegermin: 1, max: 100No
bandwidth_remaining_optionChoicepercent, ratioNo
bandwidth_remaining_percentIntegermin: 1, max: 100No
bandwidth_remaining_ratioIntegermin: 1, max: 65536No
priority_levelIntegermin: 1, max: 2No
priority_burstIntegermin: 32, max: 2000000No
queue_limitIntegermin: 1, max: 64000000No
queue_limit_typeAnybytes, ms, packets, usNo
shape_average_bit_rateIntegermin: 1000, max: 100000000000No
shape_average_bits_per_interval_sustainedIntegermin: 32, max: 800000000No
shape_average_bits_per_interval_excessIntegermin: 0, max: 154400000No
shape_average_percentIntegermin: 0, max: 100No
shape_average_burst_size_sustainedIntegermin: 10, max: 2000No
shape_average_msBooleantrue, falseNo
police_target_bitrate_conform_transmitBooleantrue, falseNo
police_target_bitrate_exceed_transmitBooleantrue, falseNo
police_target_bitrateIntegermin: 1, max: 100000000000No
police_target_bitrate_conform_burst_byteIntegermin: 1, max: 512000000No
police_target_bitrate_excess_burst_byteIntegermin: 1, max: 512000000No
police_target_bitrate_exceed_dropBooleantrue, falseNo
police_cirIntegermin: 8000, max: 100000000000No
police_bcIntegermin: 1000, max: 512000000No
police_beIntegermin: 1000, max: 512000000No
police_pirIntegermin: 8000, max: 64000000000No
police_pir_beIntegermin: 1000, max: 512000000No
police_cir_conform_transmitBooleantrue, falseNo
police_cir_exceed_dropBooleantrue, falseNo
police_rate_percentIntegermin: 0, max: 100No
queue_buffers_ratioIntegermin: 0, max: 100No
set_dscpAnyChoice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, ef] or Integer[min: 0, max: 63] or String[Regex: ^.*[\$\%]\{.*$]No
service_policyStringNo

classes (iosxe.devices.configuration.policy.policy_maps.events)

Section titled “classes (iosxe.devices.configuration.policy.policy_maps.events)”
NameTypeConstraintMandatoryDefault Value
numberIntegermin: 1, max: 254Yes
classStringYes
execution_typeChoicedo-all, do-until-failure, do-until-successNo
actionsList[actions]No

actions (iosxe.devices.configuration.policy.policy_maps.events.classes)

Section titled “actions (iosxe.devices.configuration.policy.policy_maps.events.classes)”
NameTypeConstraintMandatoryDefault Value
numberIntegermin: 1, max: 254Yes
pause_reauthenticationBooleantrue, falseNo
authorizeBooleantrue, falseNo
terminate_configAnyChoice[dot1x, mab, webauth] or String[Regex: ^.*[\$\%]\{.*$] or String[Regex: ^.*[\$\%]\{.*$]No
activate_service_template_config_service_templateStringNo
activate_service_template_config_aaa_listStringNo
activate_service_template_config_precedenceIntegermin: 1, max: 254No
activate_service_template_config_replace_allBooleantrue, falseNo
activate_interface_templateStringNo
activate_policy_type_control_subscriberStringNo
deactivate_interface_templateStringNo
deactivate_service_templateStringNo
deactivate_policy_type_control_subscriberStringNo
authenticate_using_methodChoicedot1x, mab, webauthNo
authenticate_using_retriesIntegermin: 1, max: 5No
authenticate_using_retry_timeIntegermin: 0, max: 65535No
authenticate_using_priorityIntegermin: 1, max: 254No
authenticate_using_aaa_configBooleantrue, falseNo
authenticate_using_authc_listStringNo
authenticate_using_authz_listStringNo
authenticate_using_aaa_authc_list_legacyStringNo
authenticate_using_aaa_authz_list_legacyStringNo
authenticate_using_bothBooleantrue, falseNo
authenticate_using_parameter_mapStringNo
replaceBooleantrue, falseNo
restrictBooleantrue, falseNo
clear_sessionBooleantrue, falseNo
clear_authenticated_data_hosts_on_portBooleantrue, falseNo
protectBooleantrue, falseNo
err_disableBooleantrue, falseNo
resume_reauthenticationBooleantrue, falseNo
authentication_restartIntegermin: 1, max: 65535No
set_domainChoicedata, switch, voiceNo
unauthorizeBooleantrue, falseNo
notifyBooleantrue, falseNo
set_timer_nameStringNo
set_timer_valueIntegermin: 0, max: 65535No
map_attribute_to_service_tableStringNo

By defining class-maps and policy-maps, policy configuration enables granular traffic classification, prioritization, and enforcement for QoS and access control.

Key Components:

  • Class-Map Name (class_maps.name): The identifier for the class-map.

  • Class-Map Type (class_maps.type): Specifies the class-map type (QoS, control, inspect).

  • Class-Map Match Criteria (class_maps.match): Defines match conditions (DSCP, protocol, access-groups, authorization status, authentication methods including dot1x and mab). Match criteria that accept multiple values use list format (e.g., dscp, access_groups, ip_dscp, ip_precedence, authorizing_method_priority_greater_than).

  • Access Groups (class_maps.match.access_groups, class_maps.match.access_groups_legacy): Both attributes accept named ACLs (strings) and numbered ACLs (integers, 1-199 or 1300-2699) in a single list. If your list contains only named ACLs, use access_groups regardless of IOS-XE version — the _legacy distinction only applies when numbered ACLs are included. When numbered ACLs are present:

    • IOS-XE 17.18 and later: Use access_groups. Supports multiple numbered ACLs per class-map.
    • IOS-XE 17.15.x and earlier: Use access_groups_legacy. Supports only one numbered ACL per class-map (additional numbered ACLs require separate class-maps).
  • Policy-Map Name (policy_maps.name): The identifier for the policy-map.

  • Policy-Map Type (policy_maps.type): Specifies the policy-map type (QoS, control, inspect, ngsw-qos).

  • Policy-Map Classes (policy_maps.classes): Associates classes with the policy-map.

  • Policy-Map Actions (policy_maps.classes.actions): Specifies actions for matched traffic. The type field determines which action attributes apply:

    • bandwidth: Bandwidth allocation (bandwidth_percent, bandwidth_remaining_option, bandwidth_remaining_ratio, bandwidth_remaining_percent).
    • priority: Priority queuing (priority_level, priority_burst).
    • shape: Traffic shaping (shape_average_percent).
    • police: CIR/PIR dual-rate policing (police_cir, police_bc, police_be, police_pir, police_pir_be, police_cir_conform_transmit, police_cir_exceed_drop).
    • police-target-bitrate: Target bitrate policing (police_target_bitrate, police_target_bitrate_conform_burst_byte, police_target_bitrate_excess_burst_byte, police_target_bitrate_conform_transmit, police_target_bitrate_exceed_drop).
    • police-rate-percent: Rate-based policing as a percentage (police_rate_percent).
    • queue-limit: Queue depth (queue_limit, queue_limit_type).
    • queue-buffers: Queue buffer ratio (queue_buffers_ratio). Platform-specific (Cat9K).
    • set: DSCP marking (set_dscp). Accepts named values (e.g., ef, af11) or numeric 0-63.
    • service-policy: Attach a child service-policy for hierarchical QoS (service_policy).
  • Events (policy_maps.events): Defines events for control policies (authentication-success, authentication-failure, violation, session-disconnected, etc.).

  • Description (description): Descriptive text for class-maps and policy-maps.

The following configuration describes how to set up QoS and control policies on a Cisco IOS-XE device, including class-maps for DSCP values and authentication status, and policy-maps for QoS actions and access control.

class-map match-all VOICE-CLASS
description Voice traffic classification
match dscp 46
!
class-map match-all VIDEO-CLASS
description Video traffic classification
match dscp 34 36 38
!
class-map match-all DATA-CLASS
description Data traffic classification for policing
match dscp af31
!
class-map match-any PRIORITY-TRAFFIC
description Multiple match criteria example
match access-group 100
match access-group name ACL_VOICE ACL_VIDEO
match ip precedence 5 critical
match ip dscp ef cs5
!
class-map type control subscriber CONTROL-CLASS
match authorization-status authorized
match method dot1x
match result-type method dot1x authoritative
match authorizing-method-priority greater-than 10 20
match method mab
match result-type method mab authoritative
!
class-map type control subscriber match-all AUTHC_SUCCESS-AUTHZ_FAIL
match result-type success
match authorization-status unauthorized
!
class-map type control subscriber match-any AAA-SVR-DOWN-UNAUTHD-HOST
description Class-map for pause reauthentication example
!
policy-map WAN-QOS-POLICY
description WAN QoS policy with voice and video prioritization
class VOICE-CLASS
priority level 1
priority-burst 8000
class VIDEO-CLASS
bandwidth percent 30
queue-limit 64 packets
class DATA-CLASS
class class-default
bandwidth remaining ratio 10
police 10000000 50000
!
policy-map type control subscriber ACCESS-CONTROL-POLICY
description Network access control policy with pause reauthentication
event authentication-failure match-all
10 class AAA-SVR-DOWN-UNAUTHD-HOST do-until-failure
10 pause reauthentication
!
policy-map type control subscriber VIOLATION-POLICY
description Policy-map for handling violations with port restriction
event violation match-all
10 class always do-until-failure
10 restrict
!
class-map type control subscriber match-any TIMER-CLASS
description Class-map for timer example
!
policy-map type control subscriber TIMER-POLICY
description Policy-map with timer actions
event authentication-success match-all
10 class TIMER-CLASS do-until-failure
10 set-timer TIMER1 value 3600
!
policy-map type control subscriber SESSION-CLEANUP-POLICY
description Policy-map for session cleanup on disconnect
event session-disconnected match-first
1 class always do-all
1 deactivate policy type control subscriber ACCESS-CONTROL-POLICY

The following YAML code defines QoS and control policies on an IOS-XE device, specifying class-maps with match criteria and policy-maps with actions and events.

iosxe:
devices:
- name: Device1
configuration:
policy:
class_maps:
- name: VOICE-CLASS
prematch: match-all
description: Voice traffic classification
match:
dscp: [46]
- name: VIDEO-CLASS
prematch: match-all
description: Video traffic classification
match:
dscp: [34, 36, 38]
- name: DATA-CLASS
prematch: match-all
description: Data traffic classification for policing
match:
dscp: [af31]
- name: PRIORITY-TRAFFIC
prematch: match-any
description: Multiple match criteria example (pre-17.18)
match:
access_groups_legacy: [100, ACL_VOICE, ACL_VIDEO]
ip_precedence: [5, critical]
ip_dscp: [ef, cs5]
- name: PRIORITY-TRAFFIC-V2
prematch: match-any
description: Multiple match criteria example (17.18+)
match:
access_groups: [100, 150, ACL_VOICE, ACL_VIDEO]
ip_precedence: [5, critical]
ip_dscp: [ef, cs5]
- name: IP-DSCP-CLASS
prematch: match-any
description: Match traffic based on IP DSCP values
match:
ip_dscp: [af41, af42, ef]
- name: IP-PRECEDENCE-CLASS
prematch: match-any
description: Match traffic based on IP precedence
match:
ip_precedence: [critical, network]
- name: CONTROL-CLASS
type: control
subscriber: true
match:
authorization_status_authorized: true
method_dot1x: true
result_type_method_dot1x_authoritative: true
authorizing_method_priority_greater_than: [10, 20]
method_mab: true
result_type_method_mab_authoritative: true
- name: AUTHC_SUCCESS-AUTHZ_FAIL
type: control
subscriber: true
prematch: match-all
match:
result_type_success: true
authorization_status_unauthorized: true
- name: AAA-SVR-DOWN-UNAUTHD-HOST
type: control
subscriber: true
prematch: match-any
description: Class-map for pause reauthentication example
- name: TIMER-CLASS
type: control
subscriber: true
prematch: match-any
description: Class-map for timer example
policy_maps:
- name: WAN-QOS-POLICY
description: WAN QoS policy with voice and video prioritization
classes:
- name: VOICE-CLASS
actions:
- type: priority
priority_level: 1
priority_burst: 8000
- name: VIDEO-CLASS
actions:
- type: bandwidth
bandwidth_percent: 30
- name: class-default
actions:
- type: bandwidth
bandwidth_remaining_option: ratio
bandwidth_remaining_ratio: 10
- type: queue-limit
queue_limit: 64
queue_limit_type: packets
- name: DATA-CLASS
actions:
- type: police-target-bitrate
police_target_bitrate: 10000000
police_target_bitrate_conform_burst_byte: 50000
- name: ACCESS-CONTROL-POLICY
type: control
subscriber: true
description: Network access control policy with pause reauthentication
events:
- name: authentication-failure
event_type: authentication-failure
match_type: match-all
classes:
- number: 10
class: AAA-SVR-DOWN-UNAUTHD-HOST
execution_type: do-until-failure
actions:
- number: 10
pause_reauthentication: true
- name: VIOLATION-POLICY
type: control
subscriber: true
description: Policy-map for handling violations with port restriction
events:
- name: violation
event_type: violation
match_type: match-all
classes:
- number: 10
class: always
execution_type: do-until-failure
actions:
- number: 10
restrict: true
- name: TIMER-POLICY
type: control
subscriber: true
description: Policy-map with timer actions
events:
- name: authentication-success
event_type: authentication-success
match_type: match-all
classes:
- number: 10
class: TIMER-CLASS
execution_type: do-until-failure
actions:
- number: 10
set_timer_name: TIMER1
set_timer_value: 3600
- name: SESSION-CLEANUP-POLICY
type: control
subscriber: true
description: Policy-map for session cleanup on disconnect
events:
- name: session-disconnected
event_type: session-disconnected
match_type: match-first
classes:
- number: 1
class: always
execution_type: do-all
actions:
- number: 1
deactivate_policy_type_control_subscriber: ACCESS-CONTROL-POLICY

CIR/PIR Dual-Rate Policing with Conform/Exceed Actions

Section titled “CIR/PIR Dual-Rate Policing with Conform/Exceed Actions”
policy-map WAN-INGRESS-POLICE
class CM_VIDEO
police cir 10000000 bc 312500
conform-action transmit
exceed-action drop
police pir 15000000 be 312500
iosxe:
devices:
- name: WAN-Router
configuration:
policy:
policy_maps:
- name: WAN-INGRESS-POLICE
classes:
- name: CM_VIDEO
actions:
- type: police
police_cir: 10000000
police_bc: 312500
police_pir: 15000000
police_pir_be: 312500
police_cir_conform_transmit: true
police_cir_exceed_drop: true
policy-map RATE-LIMIT-POLICY
class class-default
police rate percent 50
iosxe:
devices:
- name: WAN-Router
configuration:
policy:
policy_maps:
- name: RATE-LIMIT-POLICY
classes:
- name: class-default
actions:
- type: police
police_rate_percent: 50
policy-map QUEUING-POLICY
class CM_VIDEO
bandwidth remaining percent 30
queue-buffers ratio 25
iosxe:
devices:
- name: Cat9K-Switch
configuration:
policy:
policy_maps:
- name: QUEUING-POLICY
classes:
- name: CM_VIDEO
actions:
- type: bandwidth
bandwidth_remaining_option: percent
bandwidth_remaining_percent: 30
- type: queue-buffers
queue_buffers_ratio: 25
policy-map MARK-POLICY
class CM_BULK
set dscp af11
iosxe:
devices:
- name: WAN-Router
configuration:
policy:
policy_maps:
- name: MARK-POLICY
classes:
- name: CM_BULK
actions:
- type: set
set_dscp: af11

Hierarchical QoS with Child Service-Policy

Section titled “Hierarchical QoS with Child Service-Policy”
policy-map CHILD-QOS
class VOICE-CLASS
priority level 1
class VIDEO-CLASS
bandwidth percent 30
!
policy-map PARENT-SHAPE
class class-default
shape average 20000000
service-policy CHILD-QOS
iosxe:
devices:
- name: WAN-Router
configuration:
policy:
policy_maps:
- name: CHILD-QOS
classes:
- name: VOICE-CLASS
actions:
- type: priority
priority_level: 1
- name: VIDEO-CLASS
actions:
- type: bandwidth
bandwidth_percent: 30
- name: PARENT-SHAPE
classes:
- name: class-default
actions:
- type: shape
shape_average_bit_rate: 20000000
- type: service-policy
service_policy: CHILD-QOS

Traffic Shaping with Shape Average Percent

Section titled “Traffic Shaping with Shape Average Percent”
policy-map SHAPE-POLICY
class class-default
shape average percent 80
iosxe:
devices:
- name: WAN-Router
configuration:
policy:
policy_maps:
- name: SHAPE-POLICY
classes:
- name: class-default
actions:
- type: shape
shape_average_percent: 80
policy-map WAN-EGRESS-QOS
description WAN egress shaping and queuing policy
class CM_VOICE
priority level 1
priority-burst 8000
class CM_VIDEO
bandwidth remaining percent 30
queue-buffers ratio 25
class CM_CRITICAL
bandwidth remaining percent 20
class class-default
bandwidth remaining percent 25
shape average percent 80
iosxe:
devices:
- name: WAN-Router
configuration:
policy:
class_maps:
- name: CM_VOICE
prematch: match-any
match:
ip_dscp: [ef]
- name: CM_VIDEO
prematch: match-any
match:
ip_dscp: [af41, af42, af43]
- name: CM_CRITICAL
prematch: match-any
match:
ip_dscp: [cs6, cs7]
- name: CM_BULK
prematch: match-any
match:
ip_dscp: [af11, af12, af13]
policy_maps:
- name: WAN-EGRESS-QOS
description: WAN egress shaping and queuing policy
classes:
- name: CM_VOICE
actions:
- type: priority
priority_level: 1
priority_burst: 8000
- name: CM_VIDEO
actions:
- type: bandwidth
bandwidth_remaining_option: percent
bandwidth_remaining_percent: 30
- type: queue-buffers
queue_buffers_ratio: 25
- name: CM_CRITICAL
actions:
- type: bandwidth
bandwidth_remaining_option: percent
bandwidth_remaining_percent: 20
- name: class-default
actions:
- type: bandwidth
bandwidth_remaining_option: percent
bandwidth_remaining_percent: 25
- type: shape
shape_average_percent: 80

Zone-Based Firewall (ZBF) Inspect Class-Map Examples

Section titled “Zone-Based Firewall (ZBF) Inspect Class-Map Examples”

Basic Inspect Class-Map with Protocol and ACL Matching

Section titled “Basic Inspect Class-Map with Protocol and ACL Matching”
class-map type inspect match-any CM_INSPECT_TRAFFIC
description Inspect allowed traffic
match access-group name ACL_ALLOWED
match protocol tcp
match protocol udp
!
class-map type inspect match-all CM_INSPECT_STRICT
match access-group name ACL_STRICT
match protocol https
iosxe:
devices:
- name: Router1
configuration:
policy:
class_maps:
- name: CM_INSPECT_TRAFFIC
type: inspect
prematch: match-any
description: Inspect allowed traffic
match:
access_groups:
- ACL_ALLOWED
protocols:
- tcp
- udp
- name: CM_INSPECT_STRICT
type: inspect
prematch: match-all
match:
access_groups:
- ACL_STRICT
protocols:
- https
class-map type inspect match-any CM_ALLOWED_PROTOCOLS
match protocol tcp
match protocol udp
!
class-map type inspect match-all CM_FILTERED_TRAFFIC
match class-map CM_ALLOWED_PROTOCOLS
match access-group name ACL_INTERNAL
iosxe:
devices:
- name: Router1
configuration:
policy:
class_maps:
- name: CM_ALLOWED_PROTOCOLS
type: inspect
prematch: match-any
match:
protocols:
- tcp
- udp
- name: CM_FILTERED_TRAFFIC
type: inspect
prematch: match-all
match:
class_maps:
- CM_ALLOWED_PROTOCOLS
access_groups:
- ACL_INTERNAL

Zone-Based Firewall (ZBF) Inspect Policy-Maps

Section titled “Zone-Based Firewall (ZBF) Inspect Policy-Maps”

Policy-maps of type: inspect are used with Zone-Based Firewall (ZBF) to define what actions to take on traffic matched by class-maps. Each class within an inspect policy-map specifies one of three actions: pass, drop, or inspect.

ActionDescription
passAllow the traffic without stateful inspection
pass + log: trueAllow the traffic and generate a syslog message
dropSilently drop the traffic
drop + log: trueDrop the traffic and generate a syslog message
inspectEnable stateful deep packet inspection
inspect + parameter_mapInspect with a custom parameter-map for tuning
YAML AttributeCLI Command
type: inspect (policy-map)policy-map type inspect <name>
type: inspect (class)class type inspect <name>
name: class-defaultclass class-default
action: passpass
action: pass + log: truepass log
action: dropdrop
action: drop + log: truedrop log
action: inspectinspect
action: inspect + parameter_map: <name>inspect <name>
iosxe:
devices:
- name: router1
url: https://10.0.0.1
configuration:
policy:
class_maps:
- name: CM_WEB_TRAFFIC
type: inspect
prematch: match-any
match:
access_groups:
- ACL_WEB
- name: CM_BLOCKED
type: inspect
prematch: match-any
match:
access_groups:
- ACL_DENY
policy_maps:
- name: PM_INSIDE_TO_OUTSIDE
type: inspect
classes:
- name: CM_WEB_TRAFFIC
type: inspect
action: inspect
- name: CM_BLOCKED
type: inspect
action: drop
log: true
- name: class-default
action: drop

The above YAML produces the following CLI configuration:

policy-map type inspect PM_INSIDE_TO_OUTSIDE
class type inspect CM_WEB_TRAFFIC
inspect
class type inspect CM_BLOCKED
drop log
class class-default
drop

The following police action commands are not currently supported due to missing table-map resource support in the Terraform provider:

CLI CommandDescription
exceed-action set-dscp-transmit dscp table <TABLE>Set DSCP using table-map when exceeding CIR
violate-action set-dscp-transmit dscp table <TABLE>Set DSCP using table-map when violating PIR

These commands require a table-map configuration that maps input DSCP values to output DSCP values. The YANG models support these features, but the Terraform provider does not currently implement the table-map resource or the corresponding police action attributes (exceed-set-dscp-transmit-table, violate-set-dscp-transmit).

AAA Method List Attributes (Policy-Map Event Actions)

Section titled “AAA Method List Attributes (Policy-Map Event Actions)”

The AAA authentication/authorization method list attributes for policy-map event actions have version-specific variants:

IOS-XE VersionAttributesYANG Path
17.18+authenticate_using_aaa_config, authenticate_using_authc_list, authenticate_using_authz_listauthenticate/using/aaa-config, authenticate/using/authc-list, authenticate/using/authz-list
Before 17.18authenticate_using_aaa_authc_list_legacy, authenticate_using_aaa_authz_list_legacyauthenticate/using/aaa/authc-list, authenticate/using/aaa/authz-list

When using the 17.18+ attributes, authenticate_using_aaa_config: true is required — it satisfies a YANG when constraint that gates the authc-list and authz-list leaves.

Both variants produce the same CLI output:

policy-map type control subscriber DOT1X_POLICY
event session-started match-all
10 class always do-until-failure
10 authenticate using dot1x aaa authc-list MY_AUTHC_LIST authz-list MY_AUTHZ_LIST

17.18+ data model:

actions:
- number: 10
authenticate_using_method: dot1x
authenticate_using_aaa_config: true
authenticate_using_authc_list: MY_AUTHC_LIST
authenticate_using_authz_list: MY_AUTHZ_LIST

Pre-17.18 data model:

actions:
- number: 10
authenticate_using_method: dot1x
authenticate_using_aaa_authc_list_legacy: MY_AUTHC_LIST
authenticate_using_aaa_authz_list_legacy: MY_AUTHZ_LIST
FeatureIOS-XE 17.12.xIOS-XE 17.15.xIOS-XE 17.18.x
ngsw-qos policy-map typeNot AvailableAvailableAvailable
queueing policy-map typeAvailableAvailableAvailable
queue-buffers ratioAvailable (Cat9K)Available (Cat9K)Available (Cat9K)
authenticate_using_authc_list / authenticate_using_authz_listNot AvailableNot AvailableAvailable
authenticate_using_aaa_authc_list_legacy / authenticate_using_aaa_authz_list_legacyAvailableAvailableAvailable (deprecated)

The ngsw-qos (Next-Gen Switch QoS) policy-map type is only available on Catalyst 9000 switches running IOS-XE 17.15.x or later. The queue-buffers ratio action is platform-specific and primarily available on Catalyst 9000 series switches.

Policy configuration provides comprehensive traffic classification and action enforcement through class-maps and policy-maps that define how network traffic should be identified, prioritized, and processed based on various criteria including DSCP markings, protocols, and authentication states. It supports both Quality of Service (QoS) policies for bandwidth management, prioritization, and queuing, as well as control policies for network access control that define actions to take based on authentication events and user authorization status. Policy framework enables fine-grained traffic engineering, security enforcement, and service differentiation by combining flexible matching criteria with configurable actions such as rate limiting, priority queuing, and service template activation.

Diagram
NameTypeConstraintMandatoryDefault Value
policyClass[policy]No

NameTypeConstraintMandatoryDefault Value
class_mapsList[class_maps]No
policy_mapsList[policy_maps]No

class_maps (iosxe.devices.configuration.policy)

Section titled “class_maps (iosxe.devices.configuration.policy)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
typeChoicecontrol, subscriberNo
subscriberBooleantrue, falseNo
prematchChoicematch-all, match-any, match-noneNo
matchClass[match]No
descriptionStringNo

policy_maps (iosxe.devices.configuration.policy)

Section titled “policy_maps (iosxe.devices.configuration.policy)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
typeChoiceaccess-control, appnav, control, epbr, inspect, packet-service, performance-monitor, queueing, service, service-chain, umbrellaNo
subscriberBooleantrue, falseNo
descriptionStringNo
classesList[classes]No
eventsList[events]No

match (iosxe.devices.configuration.policy.class_maps)

Section titled “match (iosxe.devices.configuration.policy.class_maps)”
NameTypeConstraintMandatoryDefault Value
authorization_status_authorizedBooleantrue, falseNo
authorization_status_unauthorizedBooleantrue, falseNo
result_type_aaa_timeoutBooleantrue, falseNo
activated_service_templatesListStringNo
authorizing_method_priority_greater_thanListIntegerNo
method_dot1xBooleantrue, falseNo
result_type_method_dot1x_authoritativeBooleantrue, falseNo
result_type_method_dot1x_agent_not_foundBooleantrue, falseNo
result_type_method_dot1x_method_timeoutBooleantrue, falseNo
method_mabBooleantrue, falseNo
result_type_method_mab_authoritativeBooleantrue, falseNo
dscpAnyList[Choice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, ef]] or List[Integer[min: 0, max: 63]] or String[Regex: ^.*[\$\%]\{.*$]No
access_groupsListStringNo
ip_dscpListAny[Choice[af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs1, cs2, cs3, cs4, cs5, cs6, cs7, default, dscp, ef, precedence] or Integer[min: 0, max: 63]]No
ip_precedenceListAny[Choice[critical, flash, flash-override, immediate, internet, network, priority, routine] or Integer[min: 0, max: 7]]No

classes (iosxe.devices.configuration.policy.policy_maps)

Section titled “classes (iosxe.devices.configuration.policy.policy_maps)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
actionsList[actions]No

events (iosxe.devices.configuration.policy.policy_maps)

Section titled “events (iosxe.devices.configuration.policy.policy_maps)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
event_typeChoiceaaa-available, absolute-timeout, agent-found, authentication-failure, authentication-success, authorization-failure, authorization-success, identity-update, inactivity-timeout, remote-authentication-failure, remote-authentication-success, remote-update, session-disconnected, session-started, tag-added, tag-removed, template-activated, template-activation-failed, template-deactivated, template-deactivation-failed, timer-expiry, violationNo
match_typeChoicematch-all, match-firstNo
classesList[classes]No

actions (iosxe.devices.configuration.policy.policy_maps.classes)

Section titled “actions (iosxe.devices.configuration.policy.policy_maps.classes)”
NameTypeConstraintMandatoryDefault Value
typeChoicebandwidth, compression, dbl, drop, estimate, fair-queue, forward, netflow-sampler, police, priority, queue-buffers, queue-limit, random-detect, service-policy, set, shape, trustNo
bandwidth_bitsIntegermin: 1, max: 100000000No
bandwidth_percentIntegermin: 1, max: 100No
bandwidth_remaining_optionChoicepercent, ratioNo
bandwidth_remaining_percentIntegermin: 1, max: 100No
bandwidth_remaining_ratioIntegermin: 1, max: 65536No
priority_levelIntegermin: 1, max: 2No
priority_burstIntegermin: 32, max: 2000000No
queue_limitIntegermin: 1, max: 64000000No
queue_limit_typeAnybytes, ms, packets, usNo
shape_average_bit_rateIntegermin: 1000, max: 100000000000No
shape_average_bits_per_interval_sustainedIntegermin: 32, max: 800000000No
shape_average_bits_per_interval_excessIntegermin: 0, max: 154400000No
shape_average_percentIntegermin: 0, max: 100No
shape_average_burst_size_sustainedIntegermin: 10, max: 2000No
shape_average_msBooleantrue, falseNo
police_target_bitrate_conform_transmitBooleantrue, falseNo
police_target_bitrate_exceed_transmitBooleantrue, falseNo
police_target_bitrateIntegermin: 1, max: 100000000000No
police_target_bitrate_conform_burst_byteIntegermin: 1, max: 512000000No
police_target_bitrate_excess_burst_byteIntegermin: 1, max: 512000000No

classes (iosxe.devices.configuration.policy.policy_maps.events)

Section titled “classes (iosxe.devices.configuration.policy.policy_maps.events)”
NameTypeConstraintMandatoryDefault Value
numberIntegermin: 1, max: 254Yes
classStringYes
execution_typeChoicedo-all, do-until-failure, do-until-successNo
actionsList[actions]No

actions (iosxe.devices.configuration.policy.policy_maps.events.classes)

Section titled “actions (iosxe.devices.configuration.policy.policy_maps.events.classes)”
NameTypeConstraintMandatoryDefault Value
numberIntegermin: 1, max: 254Yes
pause_reauthenticationBooleantrue, falseNo
authorizeBooleantrue, falseNo
terminate_configAnyChoice[dot1x, mab, webauth] or String[Regex: ^.*[\$\%]\{.*$] or String[Regex: ^.*[\$\%]\{.*$]No
activate_service_template_config_service_templateStringNo
activate_service_template_config_aaa_listStringNo
activate_service_template_config_precedenceIntegermin: 1, max: 254No
activate_service_template_config_replace_allBooleantrue, falseNo
activate_interface_templateStringNo
activate_policy_type_control_subscriberStringNo
deactivate_interface_templateStringNo
deactivate_service_templateStringNo
deactivate_policy_type_control_subscriberStringNo
authenticate_using_methodChoicedot1x, mab, webauthNo
authenticate_using_retriesIntegermin: 1, max: 5No
authenticate_using_retry_timeIntegermin: 0, max: 65535No
authenticate_using_priorityIntegermin: 1, max: 254No
authenticate_using_aaa_authc_listStringNo
authenticate_using_aaa_authz_listStringNo
authenticate_using_bothBooleantrue, falseNo
authenticate_using_parameter_mapStringNo
replaceBooleantrue, falseNo
restrictBooleantrue, falseNo
clear_sessionBooleantrue, falseNo
clear_authenticated_data_hosts_on_portBooleantrue, falseNo
protectBooleantrue, falseNo
err_disableBooleantrue, falseNo
resume_reauthenticationBooleantrue, falseNo
authentication_restartIntegermin: 1, max: 65535No
set_domainChoicedata, switch, voiceNo
unauthorizeBooleantrue, falseNo
notifyBooleantrue, falseNo
set_timer_nameStringNo
set_timer_valueIntegermin: 0, max: 65535No
map_attribute_to_service_tableStringNo

By defining class-maps and policy-maps, policy configuration enables granular traffic classification, prioritization, and enforcement for QoS and access control.

Key Components:

  • Class-Map Name (class_maps.name): The identifier for the class-map.

  • Class-Map Type (class_maps.type): Specifies the class-map type (QoS, control, inspect).

  • Class-Map Match Criteria (class_maps.match): Defines match conditions (DSCP, protocol, access-groups, authorization status, method). Match criteria that accept multiple values use list format (e.g., dscp, access_groups, ip_dscp, ip_precedence, authorizing_method_priority_greater_than).

  • Policy-Map Name (policy_maps.name): The identifier for the policy-map.

  • Policy-Map Type (policy_maps.type): Specifies the policy-map type (QoS, control, inspect).

  • Policy-Map Classes (policy_maps.classes): Associates classes with the policy-map.

  • Policy-Map Actions (policy_maps.classes.actions): Specifies actions (bandwidth, priority, queue-limit, authorize, activate service template, redirect).

  • Events (policy_maps.events): Defines events for control policies.

  • Description (description): Descriptive text for class-maps and policy-maps.

Key Parameters Briefly Explained:

  • class_maps.name: Class-map identifier.
  • class_maps.type: Class-map type.
  • class_maps.match: Match conditions.
  • policy_maps.name: Policy-map identifier.
  • policy_maps.type: Policy-map type.
  • policy_maps.classes: Classes in the policy-map.
  • policy_maps.classes.actions: Actions for matched traffic.
  • policy_maps.events: Control policy events.
  • description: Description for class-map or policy-map.

You can use these Policy parameters to define granular traffic classification and enforcement rules. Customize class-map match conditions and policy-map actions to fit your network’s QoS requirements, access control policies, and traffic engineering needs. Adjusting these parameters lets you tailor how traffic is identified, prioritized, and processed across your network infrastructure.

The following configuration describes how to set up QoS and control policies on a Cisco IOS-XE device, including class-maps for DSCP values and authentication status, and policy-maps for QoS actions and access control.

class-map match-all VOICE-CLASS
description Voice traffic classification
match dscp 46
!
class-map match-all VIDEO-CLASS
description Video traffic classification
match dscp 34 36 38
!
class-map match-any PRIORITY-TRAFFIC
description Multiple match criteria example
match access-group name ACL_VOICE ACL_VIDEO
match ip precedence 5 critical
match ip dscp ef cs5
!
class-map type control subscriber CONTROL-CLASS
match authorization-status authorized
match method dot1x
match result-type method dot1x authoritative
match authorizing-method-priority greater-than 10 20
!
policy-map WAN-QOS-POLICY
description WAN QoS policy with voice and video prioritization
class VOICE-CLASS
priority level 1
priority-burst 8000
class VIDEO-CLASS
bandwidth percent 30
queue-limit 64 packets
!
policy-map type control subscriber ACCESS-CONTROL-POLICY
description Network access control policy
event authentication-success match-first
class CONTROL-CLASS
do-all
1 authorize
2 activate service-template USER-TEMPLATE

The following YAML code defines QoS and control policies on an IOS-XE device, specifying class-maps with match criteria and policy-maps with actions and events.

iosxe:
devices:
- name: Device1
configuration:
policy:
class_maps:
- name: VOICE-CLASS
prematch: match-all
description: Voice traffic classification
match:
dscp: [46]
- name: VIDEO-CLASS
prematch: match-all
description: Video traffic classification
match:
dscp: [34, 36, 38]
- name: PRIORITY-TRAFFIC
prematch: match-any
description: Multiple match criteria example
match:
access_groups: [ACL_VOICE, ACL_VIDEO]
ip_precedence: [5, critical]
ip_dscp: [ef, cs5]
- name: IP-DSCP-CLASS
prematch: match-any
description: Match traffic based on IP DSCP values
match:
ip_dscp: [af41, af42, ef]
- name: IP-PRECEDENCE-CLASS
prematch: match-any
description: Match traffic based on IP precedence
match:
ip_precedence: [critical, network]
- name: CONTROL-CLASS
type: control
subscriber: true
match:
authorization_status_authorized: true
method_dot1x: true
result_type_method_dot1x_authoritative: true
authorizing_method_priority_greater_than: [10, 20]
policy_maps:
- name: WAN-QOS-POLICY
description: WAN QoS policy with voice and video prioritization
classes:
- name: VOICE-CLASS
actions:
- type: priority
priority_level: 1
priority_burst: 8000
- name: VIDEO-CLASS
actions:
- type: bandwidth
bandwidth_percent: 30
- type: queue-limit
queue_limit: 64
queue_limit_type: packets
- name: ACCESS-CONTROL-POLICY
type: control
subscriber: true
description: Network access control policy
events:
- name: authentication-success
event_type: authentication-success
match_type: match-first
classes:
- number: 1
class: CONTROL-CLASS
execution_type: do-all
actions:
- number: 1
authorize: true
- number: 2
activate_service_template_config_service_template: USER-TEMPLATE