Update tech_docs/networking/iac_github_project.md
This commit is contained in:
@@ -1,3 +1,90 @@
|
||||
You've hit on a critical and often overlooked point. QoS is one of the most complex, and therefore most brittle, parts of a network configuration. Turning QoS policies into code is exactly the kind of skill that separates basic automation from a robust, scalable, and self-documenting solution.
|
||||
|
||||
The system you've laid out is perfectly designed to tackle this challenge. Let's look at how it directly addresses the difficulties of managing QoS.
|
||||
|
||||
### The Problem with Traditional QoS Configuration
|
||||
|
||||
Manually configuring QoS is notoriously difficult for several reasons:
|
||||
|
||||
1. **Complexity:** QoS policies involve multiple layers of configuration (`class-map`, `policy-map`, `service-policy`), often with a variety of match criteria and actions.
|
||||
2. **Repetition:** A single policy-map might be applied to dozens of interfaces, or similar policies might be needed across multiple devices. Copy-pasting leads to errors and inconsistencies.
|
||||
3. **Lack of Standardization:** Without a defined structure, every engineer might write their QoS configuration slightly differently, making it hard to audit or update.
|
||||
4. **Fragility:** A small change to a class-map could have unintended consequences on multiple policy-maps and interfaces.
|
||||
|
||||
### How the Proposed System Solves This with Code
|
||||
|
||||
Your system's structure provides a clean, declarative way to manage this complexity. It separates the **policy logic** from the **device-specific data**.
|
||||
|
||||
#### 1\. The Declarative Data Model (The YAML)
|
||||
|
||||
Instead of a dozen `class-map` and `policy-map` commands, you define the desired QoS state in a structured YAML object. This data model is the "Single Source of Truth" for your QoS policies.
|
||||
|
||||
```yaml
|
||||
# A snippet from your site-01.yml
|
||||
qos:
|
||||
class_maps:
|
||||
- match_type: "match-any"
|
||||
name: "CM-TRUSTED-TRAFFIC"
|
||||
rules:
|
||||
- type: "dscp"
|
||||
value: "ef"
|
||||
- type: "dscp"
|
||||
value: "cs4"
|
||||
- match_type: "match-all"
|
||||
name: "CM-VOICE-SIGNALING"
|
||||
rules:
|
||||
- type: "protocol"
|
||||
value: "sip"
|
||||
policy_maps:
|
||||
- name: "PM-HUB-OUT"
|
||||
classes:
|
||||
- name: "CM-TRUSTED-TRAFFIC"
|
||||
actions:
|
||||
- { cmd: "priority percent", value: 20 }
|
||||
- name: "CM-VOICE-SIGNALING"
|
||||
actions:
|
||||
- { cmd: "bandwidth remaining percent", value: 10 }
|
||||
```
|
||||
|
||||
This YAML is much easier to read and audit than the raw CLI. It's immediately clear what classes exist, what they match, and how they are handled in a specific policy.
|
||||
|
||||
#### 2\. The Reusable Logic (The Jinja2 Template)
|
||||
|
||||
The `policies/70_qos.j2` template acts as the "compiler" for this data. It's a generic piece of code that knows how to turn a YAML-defined QoS object into the correct Cisco IOS-XE syntax.
|
||||
|
||||
```jinja
|
||||
{% for cmap in qos.class_maps %}
|
||||
class-map {{ cmap.match_type }} {{ cmap.name }}
|
||||
{% for rule in cmap.rules %}
|
||||
match {{ rule.type }} {{ rule.value }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
!
|
||||
{% for pmap in qos.policy_maps %}
|
||||
policy-map {{ pmap.name }}
|
||||
{% for cls in pmap.classes %}
|
||||
class {{ cls.name }}
|
||||
{% for action in cls.actions %}
|
||||
{{ action.cmd }} {{ action.value | default('') }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
```
|
||||
|
||||
This template is a powerful abstraction. You write this logic once, and it can generate the correct QoS CLI for every device, regardless of how many classes or policies it has.
|
||||
|
||||
#### 3\. The Automation and Guardrails
|
||||
|
||||
The system also provides guardrails that are essential for QoS:
|
||||
|
||||
* **Standardization:** The `schema.yml` file can enforce that all `policy-maps` must have a specific structure, guaranteeing that every device's QoS configuration follows the same best practices.
|
||||
* **Modularity:** You can define a core set of class-maps and policy-maps in your `data/defaults.yml` and only override or add to them in the per-device YAML files. This is perfect for defining a corporate standard QoS policy.
|
||||
* **Safe Changes:** If you need to change a QoS policy, you modify the YAML and let the CI/CD pipeline render the new config. The `diff` is a clear, human-readable summary of the exact changes that will be applied to the device, greatly reducing the risk of a misconfiguration.
|
||||
|
||||
By treating QoS as code, you're not just automating a task; you're building a system that makes complex, repetitive configurations predictable, auditable, and safe to modify. This is exactly what gives an organization the confidence to implement and maintain advanced features like QoS at scale.
|
||||
|
||||
---
|
||||
|
||||
Looking at your comprehensive documentation, I can see you're building something quite sophisticated - a **production-grade network automation framework** that goes far beyond typical "Infrastructure as Code" approaches. Let me break down what I'm observing:
|
||||
|
||||
## What You're Actually Building
|
||||
|
||||
Reference in New Issue
Block a user