Before you configure H-QoS, you must enable the H-QoS profile on the router. After enabling H-QoS profile, reload the router,
                           as shown in the following configuration.
                        
                        
                           
admin
hw-module location all reload
Router# configure
Router(config)# hw-module profile qos hqos-enable
Router(config)# commit
Router# admin
sysadmin-vm:0_RP0# hw-module location all reload 
                           
                        The steps that are involved in configuring hierarchical queuing are as follows:
                        
                           - 
                              
                              Configure a class-map. 
- 
                              
                              Configure a child traffic policy using the class-map that was configured in the previous step. 
- 
                              
                              Configure a parent traffic policy and add the child traffic policy in it. 
The parent traffic policy is the H-QoS traffic policy and it can be applied on physical or bundle main interfaces and sub-interfaces.
                        
                           Configuration Example
                           
                           
                           Configuration of a class-map is as follows:
                           
Router# configure
Router(config)# class-map match-any tc2
Router(config-cmap)# match traffic-class 1
Router(config-cmap)# end-class-map
Router(config)# commit
                           
                           Configuration of a child traffic policy is as follows:
                           
Router# configure
Router(config)# policy-map child
Router(config-pmap)# class tc2
Router(config-pmap-c)# shape average percent 20
Router(config-pmap-c)# exit
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average percent 1
Router(config-pmap)# end-policy-map
Router(config)# commit
                           
                           Configuration of a parent traffic policy is as follows:
                           
Router# configure
Router(config)# policy-map parent
Router(config-pmap)# class class-default
Router(config-pmap-c)# service-policy child
Router(config-pmap-c)# shape average percent 50
Router(config-pmap)# end-policy-map
Router(config)# commit
                           
                        
                           Running Configuration
                           
                           
                           
                              
/* Configuration of a Class-map */
class-map match-any tc2
 match traffic-class 1
 end-class-map
!
/* Configuration of a Child Traffic Policy */
policy-map child
 class tc2
  shape average percent 20
 !
 class class-default
  shape average percent 1
 !
 end-policy-map
!
/* Configuration of a Parent Traffic Policy */
policy-map parent
 class class-default
  service-policy child
  shape average percent 50
 !
 end-policy-map
!
                              
                           
                        
                        
                           Applying the Parent Traffic Policy on a Main Interface
                           
                           
                           
                              
Router# configure
Router(config)# Interface TenGigE 0/0/0/10
Router(config-int)# service-policy output parent
Router(config-int)# commit
                              
                           
                        
                        
                           Applying the Parent Traffic Policy on a Sub-interface
                           
                           
                           
                              
Router# configure
Router(config)# Interface TenGigE 0/0/0/10.1
Router(config-int)# service-policy output parent
Router(config-int)# commit
                              
                           
                        
                        
                           Verification
                           
                           
                           Verify if the H-QoS traffic policy is applied correctly on the interface using the commands show qos interface
                                 interface-name
                                 output . In the following example, the Level1 Class gives information about the class-map that is associated with the parent traffic policy and the Level2 Class gives information about the class-maps that are associated with the child traffic policy.
                           
                           
                           
                              RP/0/RP0/CPU0:ios#show qos interface ten0/0/0/10 output
NOTE:- Configured values are displayed within parentheses
Interface TenGigE0/0/0/10 ifh 0x1e0  -- output policy
NPU Id:                        0
Total number of classes:       3
Interface Bandwidth:           10000000 kbps
VOQ Base:                      1136
Accounting Type:               Layer1 (Include Layer 1 encapsulation and above)
------------------------------------------------------------------------------
Level1 Class                             =   class-default
Queue Max. BW.                           =   no max (50 %)
Queue Min. BW.                           =   0 kbps (default)
Inverse Weight / Weight                  =   0 / (BWR not configured)
   Level2 Class                             =   tc2
   Egressq Queue ID                         =   1138 (LP queue)
   Queue Max. BW.                           =   1020015 kbps (20 %)
   Queue Min. BW.                           =   0 kbps (default)
   Inverse Weight / Weight                  =   1 / (BWR not configured)
   Guaranteed service rate                  =   1000000 kbps
   TailDrop Threshold                       =   1253376 bytes / 10 ms (default)
   WRED not configured for this class
   Level2 Class                             =   class-default
   Egressq Queue ID                         =   1136 (Default LP queue)
   Queue Max. BW.                           =   50625 kbps (1 %)
   Queue Min. BW.                           =   0 kbps (default)
   Inverse Weight / Weight                  =   1 / (BWR not configured)
   Guaranteed service rate                  =   50000 kbps
   TailDrop Threshold                       =   62720 bytes / 10 ms (default)
   WRED not configured for this class
                              
                           
                           The statistics for the packets that have matched the different traffic classes of the parent and child traffic policies can
                              be viewed using the command show policy-map interface
                                 interface-name
                                 output . Also, this command also shows the number of packets that are transmitted or dropped when the specified action is applied
                              on the packets that have matched the respective traffic class.
                           
                           
                           
                              Router# show policy-map interface ten0/0/0/10 output
TenGigE0/0/0/10 output: parent
Class class-default
  Classification statistics          (packets/bytes)     (rate - kbps)
    Matched             :          2313578823/296138089344         8494665
    Transmitted         :           232805738/29799134464          854465
    Total Dropped       :          2080773085/266338954880         7640200
  Policy child Class tc2
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :          2313578823/296138089344         8494665
      Transmitted         :           232805738/29799134464          854465
      Total Dropped       :          2080773085/266338954880         7640200
    Queueing statistics
      Queue ID                             : 1138
      Taildropped(packets/bytes)           : 2080773085/266338954880
  Policy child Class class-default
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :                   0/0                    0
      Transmitted         :                   0/0                    0
      Total Dropped       :                   0/0                    0
    Queueing statistics
      Queue ID                             : 1136
      Taildropped(packets/bytes)           : 0/0
                              
                           
                           When using hierarchical policers, there is no independent set of hardware counters to store the parent policer statistics.
                              Instead, parent policer statistics are manipulated in the software to be the sum of all child policers under the same policy-map.
                           
                           
                           This is shown in the following example where two streams of traffic, with CoS value of 1 and 2 are sent at a speed of 3.5
                              Gbps each.
                           
                           
                           
                              /*Hierarchical Policy Map Configuration*/
====================================================
Router# show running-config policy-map Hingress 
policy-map Hingress
 class class-default
  service-policy ingress
  police rate 5 gbps peak-rate 9 gbps 
  ! 
 ! 
 end-policy-map
! 
 /*Ingress Policy Map Configuration*/
=====================================
Router#show running-config policy-map ingress  
policy-map ingress
 class cos1
  set traffic-class 1
  police rate 5 gbps 
  ! 
 ! 
 class cos2
  set traffic-class 2
  police rate 5 gbps 
  ! 
 ! 
 class class-default
 ! 
 end-policy-map
! 
 /*Policy Map applied at TenGigE0/0/0/6.100 Interface*/
=======================================================
Router#show policy-map interface tenGigE 0/0/0/6.100 input 
 
TenGigE0/0/0/6.100 input: Hingress
 
Class class-default
  Classification statistics          (packets/bytes)     (rate - kbps)
    Matched             :           856717937/109659895936         6683676
    Transmitted         :           856717937/109659895936         6683676
    Total Dropped       :                   0/0                    0
  Policing statistics                (packets/bytes)     (rate - kbps) 
    Policed(conform)    :           856717937/109659895936         6683674
    Policed(exceed)     :                   0/0                    0
    Policed(violate)    :                   0/0                    0
    Policed and dropped :                   0/0                  
 
  Policy ingress Class cos1
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :           437826303/56041766784          3341838
      Transmitted         :           437826303/56041766784          3341838
      Total Dropped       :                   0/0                    0
    Policing statistics                (packets/bytes)     (rate - kbps) 
      Policed(conform)    :           437826303/56041766784          3341838
      Policed(exceed)     :                   0/0                    0
      Policed(violate)    :                   0/0                    0
      Policed and dropped :                   0/0                  
      Policed and dropped(parent policer)  : 0/0
 
  Policy ingress Class cos2
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :           418891634/53618129152          3341838
      Transmitted         :           418891634/53618129152          3341838
      Total Dropped       :                   0/0                    0
    Policing statistics                (packets/bytes)     (rate - kbps) 
      Policed(conform)    :           418891634/53618129152          3341838
      Policed(exceed)     :                   0/0                    0
      Policed(violate)    :                   0/0                    0
      Policed and dropped :                   0/0                  
      Policed and dropped(parent policer)  : 0/0
 
  Policy ingress Class class-default
    Classification statistics          (packets/bytes)     (rate - kbps)
      Matched             :                   0/0                    0
      Transmitted         :                   0/0                    0
      Total Dropped       :                   0/0                    0
Policy Bag Stats time: 0 
Policy Bag Stats time: 0 
 
                              
                           
                        
                        
                           Configuration Example for Three-Level H-QoS
                           
                           
                           To configure three-level H-QoS:
                           
                           
                              - 
                                 
                                 Configure the port shaper or EFP group shaper. 
- 
                                 
                                 Configure the two-level H-QoS policy with an EFP parent shaper and class or service level actions 
- 
                                 
                                 Enable the port or EFP group shaper on the main interface to become the root policy. 
- 
                                 
                                 Enable the two-level H-QoS policy on each EFP instance, thus providing a three-level hierarchy of service, EFP and EFP group
                                    or port SLAs.
                                  
A sample configuration for three-level H-QoS is as follows.policy-map port_shaper
 class class-default
  shape average 6 gbps 
 ! 
 end-policy-map
! 
policy-map efp_policy
 class class-default
  service-policy efp_policy_child
  shape average 4 gbps 
 ! 
 end-policy-map
! 
policy-map efp_policy_child
 class tc1
  shape average 50 mbps 
  priority level 1 
 ! 
 class tc2
  bandwidth percent 50 
 ! 
 class tc3
  bandwidth percent 30 
 ! 
 class class-default
 ! 
 end-policy-map
! 
interface TenGigE0/5/0/4
 service-policy output port_shaper
!
interface TenGigE0/5/0/4.1
 service-policy output efp_policy
 encapsulation dot1q 11
!
interface TenGigE0/5/0/4.2
 service-policy output efp_policy
 encapsulation dot1q 12
!
                           
                        
                        
                           Verification
                           
                           
                           Run the show policy-map interface command in XR EXEC mode to display the packet/byte count and rate post port shaper enforcement on each of the sub-interface/EFP
                              policies.