OcNOS-SP : Ansible Guide : Ansible User Guide : QoS Configuration
QoS Configuration
Template File for QOS
ocnos_qos.j2
{%if QOS is defined %}
qos enable
qos statistics
!
{% for classmap in QOS.classmap -%}
{% if classmap.protocol == "dscp" %}
class-map {{ classmap.matchtype }} {{ classmap.name }}
match {{ classmap.protocol }} {{ classmap.dscptype }}
{% endif %}
{% if classmap.protocol == "queuing" %}
class-map {{ classmap.matchtype }} {{ classmap.protocol }} {{ classmap.que_name }}
match {{ classmap.classification }} {{ classmap.name }}
{% endif %}
{% if classmap.protocol == "vlan" %}
class-map {{ classmap.matchtype }} {{ classmap.name }}
match {{ classmap.protocol }} {{ classmap.dscptype }}
{% endif %}
!
{% endfor %}
{% for policymap in QOS.policymap -%}
{% if policymap.qos_name is defined %}
{% for param in policymap.params %}
{% if param.matchtype is defined %}
{%if param.val is defined %}
{% if param.val==1%}
policy-map {{ param.matchtype }} {{ param.protocol }} {{ policymap.qos_name }}
{% endif %}
{% endif %}
{% endif %}
class {{ param.name }}
{% if param.cosvalue is defined %}
set queue {{param.cosvalue}}
{% endif %}
exit
{% endfor %}
!
{% endif %}
{% if policymap.que_name is defined %}
{% for param in policymap.params %}
{%if param.val is defined %}
{%if param.val ==1 %}
policy-map {{ param.matchtype }} {{ param.protocol }} {{ policymap.que_name }}
{% endif %}
{% endif %}
class type {{ param.protocol }} {{param.classmap_name}}
shape {{param.shape_rate}}
exit
{% endfor %}
{% endif %}
{% endfor %}
!
{% for interface in QOS.interfaces -%}
interface {{interface.name}}
{% for policy in interface.policy_type -%}
{% if policy.type == "qos" %}
service-policy type {{policy.type}} input {{policy.policy_name}}
{% endif %}
{% if policy.type == "queuing" %}
service-policy type {{policy.type}} output {{policy.policy_name}}
{% endif %}
{% endfor %}
{% endfor %}
{%endif%}
 
Parameter File for QOS
sw2.yml
 
QOS:
QOS configuration
classmap:
Class-map configuration
- matchtype: match-all
Configures the Logical-AND of all match statements under this class-map
name: DSCP-AF11
Specify a class-map name (Max Size 32)
protocol: dscp
Configures the protocol type dscp under class-mapp DSCP-AF11
dscptype: af11
Configures Match type of dscp as af11 under DSCP-AF1
- matchtype: match-all
Configures the Logical-AND of all match statements under this class-map
name: VLAN100
Specify a class-map name (Max Size 32)
protocol: vlan
Configure te protocol type vlan under class-map VLAN100
dscptype: 500
Configures the vlan id under the class-map VLAN100
- matchtype: type
Configures the type of match statements under this class-map
protocol: queuing
Configure the protocol as queuing
que_name: defaultq
Configure the class-map defaultq name for protocol queuing
classification: service-template
Configures the classification type as service-template under defaultq
name: vpws
Configures the name of the service-template
- matchtype: type
Configures the type of match statements under this class-map
protocol: queuing
Configure the protocol as queuing under class-map
que_name: matchall
Configure the class-map matchall name for protocol queuing
classification: vlan
Configures the classification type as vlan
name: 1001
Configures the if of the vlan as 1001
policymap:
Policymap configuration
- qos_name: ALL-VLANs
Configure the name of the policy-map as ALL-VLANs
params:
Configure the parameter for policy-map
- matchtype: type
Configures the type command for policy-map
protocol: qos
Configure the type of protocol as qos for policy-map
name: VLAN100
Configure the class name as VLAN100 under policy-map ALL-VLANs
val: 1
Define the occurrence of under the policy-map
- qos_name: DSCP-ALL
Configure the name of the policy-map as DSCP-ALL
params:
Configure the parameter for policy-map
- matchtype: type
Configures the type command for policy-map
protocol: qos
Configure the type of protocol as qos for policy-map
name: DSCP-AF11
Configure the class name as DSCP-AF11 under policy-map DSCP-ALL
cosvalue: 1
Configures the queue value to be taken for matched traffic
Under class DSCP-AF11
 
val:1
Define the occurrence of under the policy-map
- matchtype: type
Configures the type command for policy-map
protocol: qos
Configure the type of protocol as qos for policy-map
name: DSCP-AF12
Configure the class name as DSCP-AF12 under policy-map DSCP-ALL
cosvalue: 1
Configures the queue value to be taken for matched traffic
Under class DSCP-AF12
 
val:2
Define the occurrence of under the policy-map
- que_name: shaper
Configure the name of the queue as shaper
params:
Configure the parameter for policy-map
- matchtype: type
Configures the type command for policy-map
protocol: queuing
Configure the type of protocol as queuing for policy-map
name: DSCP-EF
Configure the class name as DSCP-EF under policy-map shaper
val: 1
Define the occurrence of under the policy-map
classmap_name: defaultq
Configures the class-map name defaultq
shape_rate: 10 gbps
Configures the shape rate as 10 gbps under under class DSCP-EF
interfaces:
Interface configuration
- name: eth3
Configure the interface eth3 command
policy_type:
Policy configuration under interface
- type: qos
Configures the service policy type as qos
policy_name: ALL-VLANs
Configures the input policy name as ALL-VLANs for policy-type qos
- type: queuing
Configures the service policy type as queuing
policy_name: shaper
Configures the output policy name as shaper for policy-type queuing
Last modified date: 06/08/2023