File: //lib/python3.9/site-packages/ansible_collections/dellemc/os6/roles/os6_qos/templates/os6_qos.j2
#jinja2: trim_blocks: True,lstrip_blocks: True
{#####################################################
Purpose:
Configure qos commands for os6 Devices.
os6_qos:
class_map:
- name: CONTROL
type: match-all
match_condition:
- ip dscp 40
state: present
- name: testclass
type: match-all
match_condition:
- vlan 4
state: present
- name: test
type: match-any
match_condition:
- vlan 5
state: present
policy_map:
- name: testpolicy
type: in
class_instances:
- name: testclass
policy:
- assign-queue 4
- mirror Po1
state: present
- name: test
policy:
- assign-queue 4
state: present
state: present
#####################################################}
{% if os6_qos is defined and os6_qos %}
{% for key in os6_qos.keys() %}
{% if key =="class_map" %}
{% for vars in os6_qos[key] %}
{% if vars.name is defined and vars.name %}
{% if vars.state is defined and vars.state == "absent" %}
no class-map {{ vars.name }}
{% else %}
{% if vars.type is defined and vars.type %}
class-map {{ vars.type }} {{ vars.name }}
{% else %}
class-map {{ vars.name }}
{% endif %}
{% if vars.match_condition is defined and vars.match_condition %}
{% for match in vars.match_condition %}
match {{ match }}
{% endfor %}
{% endif %}
exit
{% endif %}
{% endif %}
{% endfor %}
{% elif key =="policy_map" %}
{% for vars in os6_qos[key] %}
{% if vars.name is defined and vars.name %}
{% if vars.state is defined and vars.state == "absent" %}
no policy-map {{ vars.name }}
{% else %}
{% if vars.type is defined and vars.type %}
policy-map {{ vars.name }} {{ vars.type }}
{% else %}
policy-map {{ vars.name }}
{% endif %}
{% if vars.class_instances is defined and vars.class_instances %}
{% for instance in vars.class_instances %}
{% if instance.name is defined and instance.name %}
{% if instance.state is defined and instance.state == "absent"%}
no class {{ instance.name }}
{% else %}
class {{ instance.name }}
{% endif %}
{% if instance.policy is defined and instance.policy %}
{% for policy in instance.policy %}
{{ policy }}
{% endfor %}
{% endif %}
exit
{% endif %}
{% endfor %}
{% endif %}
exit
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}