Update documentation for clarity and consistency
All checks were successful
Build and Deploy Hugo / Deploy Hugo Website (pull_request) Successful in 24s
All checks were successful
Build and Deploy Hugo / Deploy Hugo Website (pull_request) Successful in 24s
Remove emojis and em dash separators Simplify introductory sentences Standardize section headings
This commit is contained in:
@@ -6,11 +6,11 @@ cascade:
|
||||
type: docs
|
||||
---
|
||||
|
||||
## Introduction 📚
|
||||
## Introduction
|
||||
|
||||
In this article, we're going to explore how to automate the deployment of a VXLAN infrastructure by relying on **Netbox** as our single source of truth (*Source of Truth*) and its **"Render Config"** feature.
|
||||
|
||||
The main idea behind this project is to simplify network configuration management by limiting the use of external orchestration tools, which can sometimes make inventory management more complex. We're going to show how Netbox can automatically generate the configurations for our network devices from Jinja2 templates, provided we respect one fundamental principle: **standardizing our infrastructure.** 💡
|
||||
The main idea behind this project is to simplify network configuration management by limiting the use of external orchestration tools, which can sometimes make inventory management more complex. We're going to show how Netbox can automatically generate the configurations for our network devices from Jinja2 templates, provided we respect one fundamental principle: **standardizing our infrastructure.**
|
||||
|
||||
To illustrate this approach, we'll use the example of a fictional site, **"Paris"**, designed according to clear and precise standardization rules. This standardization will allow us to:
|
||||
|
||||
@@ -18,17 +18,17 @@ To illustrate this approach, we'll use the example of a fictional site, **"Paris
|
||||
2. **Generate** the network device configurations based on the information centralized in Netbox.
|
||||
3. **Validate** the proper operation of this automated infrastructure using a **NetLab** lab environment running on ContainerLab.
|
||||
|
||||
Through this concrete example, we'll highlight the fact that standardization isn't a constraint, but rather the **essential foundation** for successful automation and simplified, efficient network management.
|
||||
Through this concrete example, we'll show that standardization isn't a constraint, but the foundation for successful automation and simpler, more efficient network management.
|
||||
|
||||
> [!NOTE] **CookBook**
|
||||
> All of the actions explained in this article are described [here](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-apply-templates).
|
||||
> This article will **not** provide a step-by-step guide, but will provide links to the Cookbook, which does.
|
||||
|
||||
## The Concept of the Standardized Site ⚙️
|
||||
## The concept of the standardized site
|
||||
|
||||
Effective automation of a network infrastructure relies on a solid foundation of standardization. To illustrate this principle, we've defined a **standard site** model, characterized by a precise structure and precise connectivity rules. Our "Paris" site will be a concrete instance of this standardized model.
|
||||
|
||||
### Typical Structure of a Standard Site 🏢
|
||||
### Typical structure of a standard site
|
||||
|
||||
A standard site is defined by the following elements:
|
||||
|
||||
@@ -36,7 +36,7 @@ A standard site is defined by the following elements:
|
||||
* **One to Five Single-Story Buildings:** Each building is dedicated to hosting a single customer (although the same customers can be spread across multiple buildings).
|
||||
Each standard building is equipped with an access switch for local connectivity and a single leaf for connecting to the fabric.
|
||||
|
||||
### Standard Leaf Connectivity 🔗
|
||||
### Standard leaf connectivity
|
||||
|
||||
In a standard site, the connection of leaf devices to the spines follows these rules:
|
||||
|
||||
@@ -50,7 +50,7 @@ In a standard site, the connection of leaf devices to the spines follows these r
|
||||
> For the purposes of this **Proof of Concept**, we opted for a simplified architecture without advanced redundancy at the leaf-spine connection level.
|
||||
> The main goal is to demonstrate automation based on this standardized structure.
|
||||
|
||||
### IP Addressing Plan for the "Paris" Site 🌐
|
||||
### IP addressing plan for the "Paris" site
|
||||
|
||||
For our "Paris" site, we'll use the following Netbox prefix containers, which fit into our overall addressing strategy:
|
||||
|
||||
@@ -70,13 +70,13 @@ For our "Paris" site, we'll use the following Netbox prefix containers, which fi
|
||||
|
||||
These "Container" type prefixes are specific to the "Paris" site and will be used by our automation scripts to assign IP addresses to the various devices and customers at this site, in accordance with the standard structure we've defined.
|
||||
|
||||
## The "Paris" Site: An Instance of Our Standardized Model 📍
|
||||
## The "Paris" site: an instance of our standardized model
|
||||
|
||||
Our "Paris" site strictly follows the structure and rules defined in our standard site model. It will therefore include a server room with the two spines and can host up to five single-story buildings, each equipped with a leaf and an access switch, connected according to the established conventions. The IP addressing for "Paris" will come from the standard prefix containers we've defined.
|
||||
|
||||
This standardization is the key that will allow us to automate the creation and configuration of our "Paris" site infrastructure using the scripts we're about to present.
|
||||
|
||||
## Test Environment
|
||||
## Test environment
|
||||
|
||||
The POC will run on ContainerLab, so it's necessary to refer to [this article](../../documentation/devpod) to easily reproduce the installation and the tools.
|
||||
|
||||
@@ -89,11 +89,11 @@ We'll be using:
|
||||
|
||||
For more details, [here's the installation documentation](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/INSTALLATION.md)
|
||||
|
||||
## Scripting: Automation in Action! ⚙️
|
||||
## Scripting: automation in action
|
||||
|
||||
Now we get to the heart of the matter: how we use scripts to automate the creation of our VXLAN fabric by relying on Netbox. We'll look at two main scripts that do most of the heavy lifting!
|
||||
|
||||
### Step 1: Preparing Netbox with `import.py` 🛠️
|
||||
### Step 1: preparing Netbox with `import.py`
|
||||
|
||||
Before we build our network, we need to prepare our "Source of Truth," Netbox. The [`import.py`](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-populate-netbox) script is here for that! It will inject into Netbox the basic information for our "Paris" site and the models for our devices.
|
||||
|
||||
@@ -122,19 +122,19 @@ Make sure to replace `http://localhost:8080` with your Netbox address and `YOUR_
|
||||
> [!TIP]
|
||||
> Link to the Cookbook [here](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-populate-netbox)
|
||||
|
||||
### Step 2: Building the VXLAN Fabric with `Create_Fabric/main.py` 🚀
|
||||
### Step 2: building the VXLAN fabric with `Create_Fabric/main.py`
|
||||
|
||||
Now that Netbox is ready, we move on to building our network with the `Create_Fabric/main.py` script. This script will create all the devices, connect them, and assign them IP addresses, all while following our standardized model for the "Paris" site.
|
||||
|
||||
**The Script's Steps:**
|
||||
|
||||
1. **Ready Check? ✅** The script starts by checking whether everything it needs already exists in Netbox (device roles, IP roles, device types). We don't want to start building on unstable foundations!
|
||||
2. **Choosing the Site: "Paris" Of Course! 🇫🇷** The script asks us which site we're working on. We select "Paris," our standard site. Its short name "PA" will be used as the base for naming our devices.
|
||||
3. **Bringing Out the Spines (x2) 💪** The script creates our two spines in Netbox, using the correct model and the "spine" role. They're named `padc_sp1_00` and `padc_sp2_00`.
|
||||
4. **Leaf/Access Pairs per Building 🏢➡️** For each building in "Paris" (up to 5), the script creates a Netbox "location" and installs a leaf there (e.g. `pa01_lf1_00`) and an access switch (e.g. `pa01_sw1_00`).
|
||||
5. **Automatic Cabling 🧶** The script virtually connects the devices in Netbox following our rules: `Eth1` of the leaf to `Eth*n*` of Spine 1, `Eth2` of the leaf to `Eth*n*` of Spine 2, and `Eth3` of the leaf to `Eth1` of the access switch. No more getting tangled up with cables!
|
||||
6. **IP Distribution 🗺️** The script draws from the "Paris" IP address blocks and automatically assigns IPs to interfaces (/31s for the links between devices and /32s for loopbacks).
|
||||
7. **ASN Assignment 🏷️** Finally, the script assigns an AS number to each spine and each leaf for BGP routing. These numbers are stored in a special "ASN" field in Netbox.
|
||||
1. **Ready check.** The script starts by checking whether everything it needs already exists in Netbox (device roles, IP roles, device types). We don't want to start building on unstable foundations.
|
||||
2. **Choosing the site: "Paris" of course.** The script asks us which site we're working on. We select "Paris," our standard site. Its short name "PA" will be used as the base for naming our devices.
|
||||
3. **Bringing out the spines (x2).** The script creates our two spines in Netbox, using the correct model and the "spine" role. They're named `padc_sp1_00` and `padc_sp2_00`.
|
||||
4. **Leaf/access pairs per building.** For each building in "Paris" (up to 5), the script creates a Netbox "location" and installs a leaf there (e.g. `pa01_lf1_00`) and an access switch (e.g. `pa01_sw1_00`).
|
||||
5. **Automatic cabling.** The script virtually connects the devices in Netbox following our rules: `Eth1` of the leaf to `Eth*n*` of Spine 1, `Eth2` of the leaf to `Eth*n*` of Spine 2, and `Eth3` of the leaf to `Eth1` of the access switch. No more getting tangled up with cables.
|
||||
6. **IP distribution.** The script draws from the "Paris" IP address blocks and automatically assigns IPs to interfaces (/31s for the links between devices and /32s for loopbacks).
|
||||
7. **ASN assignment.** Finally, the script assigns an AS number to each spine and each leaf for BGP routing. These numbers are stored in a special "ASN" field in Netbox.
|
||||
|
||||
```bash
|
||||
uv run Create_Fabric/main.py
|
||||
@@ -150,7 +150,7 @@ Existing Sites:
|
||||
Choose site number or 'new': 1
|
||||
```
|
||||
|
||||
**The Result? 🎉** By running this script, we end up with our entire "Paris" VXLAN infrastructure created and connected in Netbox, ready to be configured!
|
||||
**The result?** By running this script, we end up with our entire "Paris" VXLAN infrastructure created and connected in Netbox, ready to be configured.
|
||||
|
||||
> [!NOTE] Netbox Plugin
|
||||
> The configuration can easily be visualized with the help of the plugin: [netbox_topology_views](https://github.com/netbox-community/netbox-topology-views)
|
||||
@@ -160,13 +160,13 @@ Choose site number or 'new': 1
|
||||
> [!TIP]
|
||||
> Link to the Cookbook [here](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#%EF%B8%8F-create-fabric)
|
||||
|
||||
### Step 3: Configuring Our Customers with `Create_Fabric/add_customers.py` 🧑💻
|
||||
### Step 3: configuring our customers with `Create_Fabric/add_customers.py`
|
||||
|
||||
At this point, the fabric is functional, but no customer is configured yet. What does that mean? 🤔 It means that the *underlay* – the foundation of our network – is configured in Netbox, and it's possible to generate a configuration to deploy BGP and configure the ASes. However, the access switches and leafs aren't ready yet to host users or customer services. There's no information in Netbox that allows for that yet.
|
||||
At this point, the fabric is functional, but no customer is configured yet. What does that mean? It means that the *underlay* – the foundation of our network – is configured in Netbox, and it's possible to generate a configuration to deploy BGP and configure the ASes. However, the access switches and leafs aren't ready yet to host users or customer services. There's no information in Netbox that allows for that yet.
|
||||
|
||||
In our standardized approach, each building is designed to host **one** "customer." A customer could be, for example, a specific team within the company or an external contractor. Each customer will be assigned a VLAN (and, in our VXLAN fabric, a corresponding VNI). 🏢➡️🧑💻
|
||||
In our standardized approach, each building is designed to host **one** "customer." A customer could be, for example, a specific team within the company or an external contractor. Each customer will be assigned a VLAN (and, in our VXLAN fabric, a corresponding VNI).
|
||||
|
||||
To perform this customer configuration, we use a dedicated script: **Create_Fabric/add_customers.py**. It will guide us step by step, asking for the VLAN and VNI to assign, as well as the building or buildings where our customers are based. 📋 Here's an example of it running:
|
||||
To perform this customer configuration, we use a dedicated script: **Create_Fabric/add_customers.py**. It will guide us step by step, asking for the VLAN and VNI to assign, as well as the building or buildings where our customers are based. Here's an example of it running:
|
||||
|
||||
```bash
|
||||
❯ uv run Create_Fabric/add_customers.py
|
||||
@@ -198,7 +198,7 @@ Available Locations:
|
||||
Select locations (comma-separated indices): 1,3
|
||||
```
|
||||
|
||||
Once this information is provided, the script takes care of automating several actions in Netbox ✨:
|
||||
Once this information is provided, the script takes care of automating several actions in Netbox:
|
||||
|
||||
* Creation of the tenant (representing the customer).
|
||||
* Assignment of buildings (locations) to the tenant.
|
||||
@@ -206,22 +206,22 @@ Once this information is provided, the script takes care of automating several a
|
||||
* Logical configuration of the associated VXLAN/VLAN elements.
|
||||
* Assignment of specific interfaces on the access devices for this customer.
|
||||
|
||||
Once Netbox is properly populated with all this customer data 📊, it then becomes possible to extract the final, ready-to-use network configuration from it. ⚙️
|
||||
Once Netbox is properly populated with all this customer data, it then becomes possible to extract the final, ready-to-use network configuration from it.
|
||||
|
||||
## The Magic of Templates: Netbox and Jinja2 Take the Stage ✨
|
||||
## Generating configs with Netbox and Jinja2 templates
|
||||
|
||||
Now that we have our network inventory all set up in Netbox, how do we tell our devices how to configure themselves? That's where **Render Config** and **Jinja2 templates** come in!
|
||||
|
||||
> [!TIP] Templates
|
||||
> The templates used are available [here](https://github.com/darnodo/projet-vxlan-automation/tree/dev/templates).
|
||||
|
||||
### Jinja Templates: Our Configuration Recipes 📝
|
||||
### Jinja templates: our configuration recipes
|
||||
|
||||
1. **What Are Render Configs, Anyway? 🤔** Imagine Netbox as a chef who has all the ingredients (our devices, their interfaces, their IPs, etc.). Render Configs are its way of turning these ingredients into prepared dishes, meaning configuration files for our network devices.
|
||||
1. **What are Render Configs, anyway?** Imagine Netbox as a chef who has all the ingredients (our devices, their interfaces, their IPs, etc.). Render Configs are its way of turning these ingredients into prepared dishes, meaning configuration files for our network devices.
|
||||
|
||||
2. **Jinja2: Our Recipe Language 🗣️** To write these configuration "recipes," Netbox uses a super powerful engine called Jinja2. It's a bit like a simple programming language that lets us create dynamic configuration templates. We can put "holes" (variables) in them that get filled in with the information from our devices in Netbox.
|
||||
2. **Jinja2: our recipe language.** To write these configuration "recipes," Netbox uses a powerful engine called Jinja2, a bit like a simple programming language that lets us create dynamic configuration templates. We can put "holes" (variables) in them that get filled in with the information from our devices in Netbox.
|
||||
|
||||
3. **A Quick Look at a Recipe 📜** Let's take an example of a Jinja2 template for one of our leafs:
|
||||
3. **A quick look at a recipe.** Let's take an example of a Jinja2 template for one of our leafs:
|
||||
|
||||
```jinja
|
||||
hostname {{ device.name }}
|
||||
@@ -242,7 +242,7 @@ Now that we have our network inventory all set up in Netbox, how do we tell our
|
||||
|
||||
See those things between double curly braces `{{ ... }}`? Those are our variables! For example, `{{ device.name }}` will be replaced with the name of our leaf, and `{{ interface.name }}` with the name of each interface. We can even add conditions (`{% if ... %}`) and loops (`{% for ... %}`) to adapt the configuration.
|
||||
|
||||
4. **How Netbox Prepares the Dish 🍳** When we ask Netbox to generate the configuration for a device (say, our `pa01_lf1_00`), here's what happens:
|
||||
4. **How Netbox prepares the dish.** When we ask Netbox to generate the configuration for a device (say, our `pa01_lf1_00`), here's what happens:
|
||||
|
||||
* It looks up all the information about this leaf: its name, its interfaces, its IPs, its connections, its ASN, etc.
|
||||
* It takes the Jinja2 template that we've associated with the "leaf" role.
|
||||
@@ -252,11 +252,11 @@ Now that we have our network inventory all set up in Netbox, how do we tell our
|
||||
> [!TIP]
|
||||
> Link to the Cookbook [here](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-apply-templates)
|
||||
|
||||
### From Netbox to the Lab: Looking and Doing It by Hand for Now 🖥️➡️💻
|
||||
### From Netbox to the lab: doing it by hand for now
|
||||
|
||||
Now that we know how Netbox generates the configurations, let's see how we use them in our Containerlab lab.
|
||||
|
||||
1. **Taking a Look at the Configuration in Netbox 👀** To view the configuration generated by Netbox for a device, it's simple:
|
||||
1. **Taking a look at the configuration in Netbox.** To view the configuration generated by Netbox for a device, it's simple:
|
||||
|
||||
* In the Netbox interface, go to **Devices**.
|
||||
* Click on the device you're interested in (for example, one of our leafs).
|
||||
@@ -264,27 +264,27 @@ Now that we know how Netbox generates the configurations, let's see how we use t
|
||||
|
||||

|
||||
|
||||
2. **The Human Touch in Containerlab 🖐️** For now, we don't have a script that automatically pushes these configurations to our devices in Containerlab. So we're going to do it the old-fashioned way (but that's fine for a demo!):
|
||||
2. **The human touch in Containerlab.** For now, we don't have a script that automatically pushes these configurations to our devices in Containerlab. So we're going to do it the old-fashioned way (fine for a demo):
|
||||
|
||||
* We connect to each cEOS device in our lab via SSH (for example, using the Containerlab VSCode extension as we saw in the [cookbook](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#%EF%B8%8F-deploy-configuration)).
|
||||
* We copy the configuration we viewed in Netbox (the **Render Config** tab).
|
||||
* And we paste it into the cEOS device's command-line interface (in configuration mode, of course!).
|
||||
|
||||
3. **What's Next? Future Perspectives 🚀** Of course, this copy-paste step isn't the pinnacle of automation! But it's a first step toward seeing how Netbox can be our central brain. In the future, we could imagine tools like Ansible or NAPALM connecting to Netbox, retrieving these generated configurations, and automatically applying them to our devices. That's a path for future adventures in automation! 😉
|
||||
3. **What's next?** This copy-paste step isn't the pinnacle of automation, but it's a first step toward seeing how Netbox can be our central brain. Down the line, tools like Ansible or NAPALM could connect to Netbox, retrieve these generated configurations, and apply them to our devices automatically.
|
||||
|
||||
## Validating Communication ✅
|
||||
## Validating communication
|
||||
|
||||
### Ping ⚽
|
||||
### Ping
|
||||
|
||||
In the cookbook, we chose to configure 2 customers each in 2 different buildings, which lets us run a **ping**. As a reminder:
|
||||
|
||||
1. 🟠 Orange:
|
||||
1. Orange:
|
||||
* Subnet: 10.0.0.0/24
|
||||
* Hosts:
|
||||
* PA1: 10.0.0.10
|
||||
* PA3: 10.0.0.20
|
||||
|
||||
2. 🟣 Purple
|
||||
2. Purple
|
||||
* Subnet: 10.0.1.0/24
|
||||
* Hosts:
|
||||
* PA2: 10.0.1.10
|
||||
@@ -305,7 +305,7 @@ PING 10.0.0.20 (10.0.0.20): 56 data bytes
|
||||
...
|
||||
```
|
||||
|
||||
### Packet Capture
|
||||
### Packet capture
|
||||
|
||||
To go further, it's also possible to use Wireshark, which is available by default in the devcontainer, with the help of Edgeshark.
|
||||
For more information, I'll point you to the article on [My First Lab](../../netlab/first_lab/#utiliser-edgeshark-)
|
||||
@@ -316,11 +316,9 @@ And then, via VSCode, it's possible to launch Wireshark directly:
|
||||
|
||||

|
||||
|
||||
## Conclusion ✨
|
||||
## Conclusion
|
||||
|
||||
To sum up our journey, we've seen how Netbox becomes our best ally 🥇 for automating the VXLAN network.
|
||||
The key is to start from **a standardized foundation** 📐 — that's what allows Netbox to generate our configurations almost entirely on its own, thanks to Jinja2 templates.
|
||||
Netbox turns out to be a solid ally for automating the VXLAN network.
|
||||
The key is starting from a standardized foundation: that's what lets Netbox generate our configurations almost entirely on its own, using Jinja2 templates.
|
||||
|
||||
Even though, for now, we're still doing a bit of copy-pasting 🖐️, the potential is huge! Having all our information centralized in Netbox is the first step toward truly simplifying our network management and opening the door to full automation. Standardization isn't a constraint, but a springboard toward greater efficiency. ✅
|
||||
|
||||
This is only the beginning! Think about what comes next: automatically deploying these configs, managing more complex networks... Automation is here, accessible, ready to save you precious time. 🚀💪
|
||||
We're still copying and pasting the last step by hand, but centralizing all our information in Netbox is the first move toward simplifying network management and opening the door to full automation. Next up: deploying these configs automatically and handling more complex networks.
|
||||
|
||||
@@ -6,7 +6,7 @@ cascade:
|
||||
type: docs
|
||||
---
|
||||
|
||||
## Introduction 📚
|
||||
## Introduction
|
||||
|
||||
Dans cet article, nous allons explorer comment automatiser le déploiement d'une infrastructure VXLAN en nous appuyant sur **Netbox** comme source unique de vérité (*Source of Truth*) et sa fonctionnalité de **"Render Config"**.
|
||||
|
||||
@@ -18,17 +18,17 @@ Pour illustrer cette approche, nous allons prendre l'exemple d'un site fictif, *
|
||||
2. **Générer** les configurations des équipements réseau en se basant sur les informations centralisées dans Netbox.
|
||||
3. **Valider** le bon fonctionnement de cette infrastructure automatisée à l'aide d'un environnement de laboratoire **NetLab** sous ContainerLab.
|
||||
|
||||
À travers cet exemple concret, nous mettrons en lumière que la standardisation n'est pas une contrainte, mais plutôt le **socle indispensable** pour une automatisation réussie et une gestion réseau simplifiée et efficace.
|
||||
À travers cet exemple concret, nous montrerons que la standardisation n'est pas une contrainte, mais le socle d'une automatisation réussie et d'une gestion réseau simplifiée et efficace.
|
||||
|
||||
> [!NOTE] **CookBook**
|
||||
> L'ensemble des actions expliquées dans cet article sont décrites [ici](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-apply-templates).
|
||||
> Cette article **ne** nous fournira **pas** un guide étape par étape, mais fournira les liens vers le Cookbook qui lui, le fourni.
|
||||
|
||||
## Le Concept du Site Standardisé ⚙️
|
||||
## Le concept du site standardisé
|
||||
|
||||
L'automatisation efficace d'une infrastructure réseau repose sur une base solide de standardisation. Pour illustrer ce principe, nous avons défini un modèle de **site standard**, caractérisé par une structure et des règles de connectivité précises. Notre site "Paris" sera une instance concrète de ce modèle standardisé.
|
||||
|
||||
### Structure Type d'un Site Standard 🏢
|
||||
### Structure type d'un site standard
|
||||
|
||||
Un site standard est défini par les éléments suivants :
|
||||
|
||||
@@ -36,7 +36,7 @@ Un site standard est défini par les éléments suivants :
|
||||
* **Un à Cinq Bâtiments Plain-Pied :** Chaque bâtiment est dédié à l'hébergement d'un seul client (bien que les mêmes clients puissent être répartis sur plusieurs bâtiments).
|
||||
Chaque bâtiment standard est équipé d'un switch d'accès pour la connectivité locale et d'un unique leaf pour la connexion à la fabric.
|
||||
|
||||
### Connectivité Standard des Leafs 🔗
|
||||
### Connectivité standard des leafs
|
||||
|
||||
Dans un site standard, la connexion des équipements leaf aux spines suit les règles suivantes :
|
||||
|
||||
@@ -50,7 +50,7 @@ Dans un site standard, la connexion des équipements leaf aux spines suit les r
|
||||
> Pour les besoins de ce **Proof of Concept**, nous avons opté pour une architecture simplifiée sans redondance avancée au niveau des connexions leaf-spine.
|
||||
> L'objectif principal est de démontrer l'automatisation basée sur cette structure standardisée.
|
||||
|
||||
### Plan d'Adressage IP pour le Site "Paris" 🌐
|
||||
### Plan d'adressage IP pour le site "Paris"
|
||||
|
||||
Pour notre site "Paris", nous allons utiliser les conteneurs de préfixes Netbox suivants, qui s'inscrivent dans notre stratégie d'adressage globale :
|
||||
|
||||
@@ -70,15 +70,15 @@ Pour notre site "Paris", nous allons utiliser les conteneurs de préfixes Netbox
|
||||
|
||||
Ces préfixes de type "Conteneur" sont spécifiques au site de "Paris" et seront utilisés par nos scripts d'automatisation pour attribuer les adresses IP aux différents équipements et clients de ce site, en respectant la structure standard que nous avons définie.
|
||||
|
||||
## Le Site "Paris" : Une Instance de Notre Modèle Standardisé 📍
|
||||
## Le site "Paris" : une instance de notre modèle standardisé
|
||||
|
||||
Notre site "Paris" suit scrupuleusement la structure et les règles définies dans notre modèle de site standard. Il comprendra donc une salle serveur avec les deux spines et pourra accueillir jusqu'à cinq bâtiments plain-pied, chacun équipé d'un leaf et d'un switch d'accès, connectés selon les conventions établies. L'adressage IP de "Paris" sera issu des conteneurs de préfixes standard que nous avons définis.
|
||||
|
||||
Cette standardisation est la clé qui nous permettra d'automatiser la création et la configuration de l'infrastructure de notre site "Paris" à l'aide des scripts que nous allons présenter ensuite.
|
||||
|
||||
## Environment de test
|
||||
## Environnement de test
|
||||
|
||||
Le POC se jouera sur ContainerLab, il est donc nécessaire de se reférencer à [cette article](../../documentation/devpod) afin de facilement reproduire l'installation et les outils.
|
||||
Le POC se joue sur ContainerLab, il est donc nécessaire de se référer à [cet article](../../documentation/devpod) pour reproduire facilement l'installation et les outils.
|
||||
|
||||
Nous utiliserons :
|
||||
|
||||
@@ -87,29 +87,29 @@ Nous utiliserons :
|
||||
* Netbox
|
||||
* Plugin : netbox_topology_views
|
||||
|
||||
Pour plus de détails, [voici la documentationation d'installation](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/INSTALLATION.md)
|
||||
Pour plus de détails, [voici la documentation d'installation](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/INSTALLATION.md)
|
||||
|
||||
## Scripting : L'Automatisation en Action ! ⚙️
|
||||
## Scripting : l'automatisation en action
|
||||
|
||||
Maintenant, on entre dans le vif du sujet : comment on utilise des scripts pour automatiser la création de notre fabric VXLAN en s'appuyant sur Netbox. On va voir deux scripts principaux qui font le gros du boulot !
|
||||
|
||||
### Étape 1 : On Prépare Netbox avec `import.py` 🛠️
|
||||
### Étape 1 : on prépare Netbox avec `import.py`
|
||||
|
||||
Avant de construire notre réseau, il faut préparer notre "Source of Truth", Netbox. Le script [`import.py`](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-populate-netbox) est là pour ça ! Il va injecter dans Netbox les infos de base de notre site "Paris" et les modèles de nos équipements.
|
||||
|
||||
**Les Ingrédients du Script :**
|
||||
**Les ingrédients du script :**
|
||||
|
||||
* **[`Devices/devices_model.yml`](https://github.com/darnodo/projet-vxlan-automation/blob/dev/utilities/Devices/devices_model.yml) :** La carte d'identité de nos équipements (spines, leafs, access cEOS) avec leurs caractéristiques (nombre d'interfaces, types, etc.).
|
||||
* **[`IPAM/subnet.yml`](https://github.com/darnodo/projet-vxlan-automation/blob/dev/utilities/IPAM/subnets.yml) :** Les infos de notre site "Paris" (région Europe, ville Paris) et les plans de nos blocs d'adresses IP (pour l'underlay, les loopbacks et nos clients).
|
||||
|
||||
**Ce Que Fait le Script :**
|
||||
**Ce que fait le script :**
|
||||
|
||||
* Il lit le fichier `devices_model.yml` et crée les modèles d'équipements correspondants dans Netbox. C'est comme enregistrer les types de matériel qu'on va utiliser.
|
||||
* Il lit le fichier `IPAM/subnet.yml` et crée :
|
||||
* La région "Europe" et le site "Paris".
|
||||
* Les blocs d'adresses IP qu'on va utiliser pour notre réseau à Paris (nos "préfixes conteneurs").
|
||||
|
||||
**Comment on Lance la Machine :**
|
||||
**Comment on lance la machine :**
|
||||
|
||||
On ouvre notre terminal et on tape la commande :
|
||||
|
||||
@@ -122,19 +122,19 @@ Remplace bien `http://localhost:8080` par l'adresse de ton Netbox et `YOUR_TOKEN
|
||||
> [!TIP]
|
||||
> Lien vers le Cookbook [ici](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-populate-netbox)
|
||||
|
||||
### Étape 2 : On Monte la Fabric VXLAN avec `Create_Fabric/main.py` 🚀
|
||||
### Étape 2 : on monte la fabric VXLAN avec `Create_Fabric/main.py`
|
||||
|
||||
Maintenant que Netbox est prêt, on passe à la construction de notre réseau avec le script `Create_Fabric/main.py`. Ce script va créer tous les équipements, les connecter et leur attribuer des adresses IP, le tout en suivant notre modèle standardisé pour le site "Paris".
|
||||
|
||||
**Les Étapes du Script :**
|
||||
**Les étapes du script :**
|
||||
|
||||
1. **Vérification des Prêts ? ✅** Le script commence par vérifier si tout ce dont il a besoin existe dans Netbox (les rôles des équipements, les rôles IP, les types d'équipements). On ne veut pas commencer à construire sur des bases instables !
|
||||
2. **Choix du Terrain : "Paris" Évidemment ! 🇫🇷** Le script nous demande sur quel site on travaille. On sélectionne "Paris", notre site standard. Son petit nom "PA" va servir de base pour nommer nos équipements.
|
||||
3. **On Sort les Spines (x2) 💪** Le script crée nos deux spines dans Netbox, en utilisant le bon modèle et le rôle "spine". Ils sont baptisés `padc_sp1_00` et `padc_sp2_00`.
|
||||
4. **Les Paires Leaf/Access par Bâtiment 🏢➡️** Pour chaque bâtiment de "Paris" (jusqu'à 5), le script crée une "location" Netbox et y installe un leaf (par exemple `pa01_lf1_00`) et un switch d'accès (par exemple `pa01_sw1_00`).
|
||||
5. **Câblage Automatique 🧶** Le script connecte virtuellement les équipements dans Netbox en suivant nos règles : `Eth1` du leaf vers `Eth*n*` du Spine 1, `Eth2` du leaf vers `Eth*n*` du Spine 2, et `Eth3` du leaf vers `Eth1` de l'access switch. Plus besoin de s'embrouiller avec les câbles !
|
||||
6. **Distribution des IPs 🗺️** Le script pioche dans les blocs d'adresses IP de "Paris" et attribue automatiquement les IPs aux interfaces (des /31 pour les liens entre les équipements et des /32 pour les loopbacks).
|
||||
7. **Attribution des ASNs 🏷️** Pour finir, le script donne un numéro d'AS à chaque spine et à chaque leaf pour le routage BGP. Ces numéros sont enregistrés dans un champ spécial "ASN" dans Netbox.
|
||||
1. **Vérification préalable.** Le script commence par vérifier si tout ce dont il a besoin existe dans Netbox (les rôles des équipements, les rôles IP, les types d'équipements). On ne veut pas commencer à construire sur des bases instables.
|
||||
2. **Choix du site : "Paris" évidemment.** Le script nous demande sur quel site on travaille. On sélectionne "Paris", notre site standard. Son petit nom "PA" va servir de base pour nommer nos équipements.
|
||||
3. **On sort les spines (x2).** Le script crée nos deux spines dans Netbox, en utilisant le bon modèle et le rôle "spine". Ils sont baptisés `padc_sp1_00` et `padc_sp2_00`.
|
||||
4. **Les paires leaf/access par bâtiment.** Pour chaque bâtiment de "Paris" (jusqu'à 5), le script crée une "location" Netbox et y installe un leaf (par exemple `pa01_lf1_00`) et un switch d'accès (par exemple `pa01_sw1_00`).
|
||||
5. **Câblage automatique.** Le script connecte virtuellement les équipements dans Netbox en suivant nos règles : `Eth1` du leaf vers `Eth*n*` du Spine 1, `Eth2` du leaf vers `Eth*n*` du Spine 2, et `Eth3` du leaf vers `Eth1` de l'access switch. Plus besoin de s'embrouiller avec les câbles.
|
||||
6. **Distribution des IPs.** Le script pioche dans les blocs d'adresses IP de "Paris" et attribue automatiquement les IPs aux interfaces (des /31 pour les liens entre les équipements et des /32 pour les loopbacks).
|
||||
7. **Attribution des ASNs.** Pour finir, le script donne un numéro d'AS à chaque spine et à chaque leaf pour le routage BGP. Ces numéros sont enregistrés dans un champ spécial "ASN" dans Netbox.
|
||||
|
||||
```bash
|
||||
uv run Create_Fabric/main.py
|
||||
@@ -150,7 +150,7 @@ Existing Sites:
|
||||
Choose site number or 'new': 1
|
||||
```
|
||||
|
||||
**Le Résultat ? 🎉** En lançant ce script, on se retrouve avec toute notre infrastructure VXLAN de "Paris" créée et connectée dans Netbox, prête à être configurée !
|
||||
**Le résultat ?** En lançant ce script, on se retrouve avec toute notre infrastructure VXLAN de "Paris" créée et connectée dans Netbox, prête à être configurée.
|
||||
|
||||
> [!NOTE] Netbox Plugin
|
||||
> La configuration est facilement visualisable avec l'aide du plugin : [netbox_topology_views](https://github.com/netbox-community/netbox-topology-views)
|
||||
@@ -160,13 +160,13 @@ Choose site number or 'new': 1
|
||||
> [!TIP]
|
||||
> Lien vers le Cookbook [ici](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#%EF%B8%8F-create-fabric)
|
||||
|
||||
### Étape 3 : On configure nos clients avec `Create_Fabric/add_customers.py` 🧑💻
|
||||
### Étape 3 : on configure nos clients avec `Create_Fabric/add_customers.py`
|
||||
|
||||
À ce niveau, la fabric est fonctionnelle, mais aucun client n'est configuré. Qu'est-ce que cela signifie ? 🤔 Cela veut dire que l'*underlay* – la base de notre réseau – est configuré sur Netbox, et qu'il est possible de générer une configuration pour déployer le BGP et configurer les AS. Cependant, les switches d'accès et les leafs ne sont pas encore prêts à accueillir des utilisateurs ou des services clients. Aucune information dans Netbox ne nous le permet encore.
|
||||
À ce niveau, la fabric est fonctionnelle, mais aucun client n'est configuré. Qu'est-ce que cela signifie ? Cela veut dire que l'*underlay* – la base de notre réseau – est configuré sur Netbox, et qu'il est possible de générer une configuration pour déployer le BGP et configurer les AS. Cependant, les switches d'accès et les leafs ne sont pas encore prêts à accueillir des utilisateurs ou des services clients. Aucune information dans Netbox ne nous le permet encore.
|
||||
|
||||
Dans notre approche standardisée, chaque bâtiment est conçu pour accueillir **un** "client". Un client peut être, par exemple, une équipe spécifique au sein de l'entreprise ou un prestataire externe. À chaque client, nous attribuerons un VLAN (et dans notre fabric VXLAN, un VNI correspondant). 🏢➡️🧑💻
|
||||
Dans notre approche standardisée, chaque bâtiment est conçu pour accueillir **un** "client". Un client peut être, par exemple, une équipe spécifique au sein de l'entreprise ou un prestataire externe. À chaque client, nous attribuerons un VLAN (et dans notre fabric VXLAN, un VNI correspondant).
|
||||
|
||||
Pour réaliser cette configuration client, nous utilisons un script dédié : **Create_Fabric/add_customers.py**. Celui-ci va nous guider pas à pas en nous demandant le VLAN et le VNI à attribuer, ainsi que le ou les bâtiments où sont basés nos clients. 📋 Voici un exemple de son exécution :
|
||||
Pour réaliser cette configuration client, nous utilisons un script dédié : **Create_Fabric/add_customers.py**. Celui-ci va nous guider pas à pas en nous demandant le VLAN et le VNI à attribuer, ainsi que le ou les bâtiments où sont basés nos clients. Voici un exemple de son exécution :
|
||||
|
||||
```bash
|
||||
❯ uv run Create_Fabric/add_customers.py
|
||||
@@ -198,7 +198,7 @@ Available Locations:
|
||||
Select locations (comma-separated indices): 1,3
|
||||
```
|
||||
|
||||
Une fois ces informations fournies, le script se charge d'automatiser plusieurs actions dans Netbox ✨ :
|
||||
Une fois ces informations fournies, le script se charge d'automatiser plusieurs actions dans Netbox :
|
||||
|
||||
* La création du tenant (représentant le client).
|
||||
* L'attribution des bâtiments (locations) au tenant.
|
||||
@@ -206,22 +206,22 @@ Une fois ces informations fournies, le script se charge d'automatiser plusieurs
|
||||
* La configuration logique des éléments VXLAN/VLAN associés.
|
||||
* L'attribution des interfaces spécifiques sur les équipements d'accès pour ce client.
|
||||
|
||||
Une fois Netbox correctement renseigné avec toutes ces données clients 📊, il devient alors possible d'en extraire la configuration réseau finale prête à l'emploi. ⚙️
|
||||
Une fois Netbox correctement renseigné avec toutes ces données clients, il devient alors possible d'en extraire la configuration réseau finale prête à l'emploi.
|
||||
|
||||
## La Magie des Templates : Netbox et Jinja2 Entrent en Scène ✨
|
||||
## Générer les configurations avec Netbox et Jinja2
|
||||
|
||||
Maintenant qu'on a notre inventaire réseau au top dans Netbox, comment on dit à nos équipements comment se configurer ? C'est là qu'interviennent les **Render Config** et les **templates Jinja2** !
|
||||
|
||||
> [!TIP] Templates
|
||||
> Les templates utilisés sont présents [ici](https://github.com/darnodo/projet-vxlan-automation/tree/dev/templates).
|
||||
|
||||
### Les Templates Jinja : Nos Recettes de Configuration 📝
|
||||
### Les templates Jinja : nos recettes de configuration
|
||||
|
||||
1. **Les Render Config, Késako ? 🤔** Imagine Netbox comme un chef cuisinier qui a tous les ingrédients (nos équipements, leurs interfaces, leurs IPs, etc.). Les Render Config, c'est sa manière de transformer ces ingrédients en plats préparés, c'est-à-dire des fichiers de configuration pour nos équipements réseau.
|
||||
1. **Les Render Config, késako ?** Imagine Netbox comme un chef cuisinier qui a tous les ingrédients (nos équipements, leurs interfaces, leurs IPs, etc.). Les Render Config, c'est sa manière de transformer ces ingrédients en plats préparés, c'est-à-dire des fichiers de configuration pour nos équipements réseau.
|
||||
|
||||
2. **Jinja2 : Notre Langage de Recettes 🗣️** Pour écrire ces "recettes" de configuration, Netbox utilise un moteur super puissant appelé Jinja2. C'est un peu comme un langage de programmation simple qui nous permet de créer des modèles de configuration dynamiques. On peut y mettre des "trous" (des variables) qui seront remplis par les informations de nos équipements dans Netbox.
|
||||
2. **Jinja2 : notre langage de recettes.** Pour écrire ces "recettes" de configuration, Netbox utilise un moteur puissant appelé Jinja2, un peu comme un langage de programmation simple qui nous permet de créer des modèles de configuration dynamiques. On peut y mettre des "trous" (des variables) qui seront remplis par les informations de nos équipements dans Netbox.
|
||||
|
||||
3. **Un Petit Coup d'Œil à une Recette 📜** Prenons un exemple de template Jinja2 pour un de nos leafs :
|
||||
3. **Un petit coup d'œil à une recette.** Prenons un exemple de template Jinja2 pour un de nos leafs :
|
||||
|
||||
```jinja
|
||||
hostname {{ device.name }}
|
||||
@@ -242,7 +242,7 @@ Maintenant qu'on a notre inventaire réseau au top dans Netbox, comment on dit
|
||||
|
||||
Vous voyez les trucs entre doubles accolades `{{ ... }}` ? Ce sont nos variables ! Par exemple, `{{ device.name }}` sera remplacé par le nom de notre leaf, et `{{ interface.name }}` par le nom de chaque interface. On peut même faire des conditions (`{% if ... %}`) et des boucles (`{% for ... %}`) pour adapter la configuration.
|
||||
|
||||
4. **Comment Netbox Prépare le Plat 🍳** Quand on demande à Netbox de générer la configuration pour un équipement (disons, notre `pa01_lf1_00`), voici ce qu'il se passe :
|
||||
4. **Comment Netbox prépare le plat.** Quand on demande à Netbox de générer la configuration pour un équipement (disons, notre `pa01_lf1_00`), voici ce qu'il se passe :
|
||||
|
||||
* Il va chercher toutes les infos sur ce leaf : son nom, ses interfaces, ses IPs, ses connexions, son ASN, etc.
|
||||
* Il prend le template Jinja2 qu'on a associé au rôle "leaf".
|
||||
@@ -252,11 +252,11 @@ Maintenant qu'on a notre inventaire réseau au top dans Netbox, comment on dit
|
||||
> [!TIP]
|
||||
> Lien vers le Cookbook [ici](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#-apply-templates)
|
||||
|
||||
### De Netbox au Lab : On Regarde et On Fait à la Main pour l'Instant 🖥️➡️💻
|
||||
### De Netbox au lab : on fait à la main pour l'instant
|
||||
|
||||
Maintenant qu'on sait comment Netbox génère les configurations, voyons comment on les utilise dans notre lab Containerlab.
|
||||
|
||||
1. **On Jette un Œil à la Configuration dans Netbox 👀** Pour voir la configuration générée par Netbox pour un équipement, c'est simple :
|
||||
1. **On jette un œil à la configuration dans Netbox.** Pour voir la configuration générée par Netbox pour un équipement, c'est simple :
|
||||
|
||||
* Dans l'interface de Netbox, on va dans **Devices**.
|
||||
* On clique sur l'équipement qui nous intéresse (par exemple, un de nos leafs).
|
||||
@@ -264,27 +264,27 @@ Maintenant qu'on sait comment Netbox génère les configurations, voyons comment
|
||||
|
||||

|
||||
|
||||
2. **La Touche Humaine dans Containerlab 🖐️** Pour l'instant, on n'a pas de script qui envoie automatiquement ces configurations à nos équipements dans Containerlab. Donc, on va faire à l'ancienne (mais c'est pour la démo !) :
|
||||
2. **La touche humaine dans Containerlab.** Pour l'instant, on n'a pas de script qui envoie automatiquement ces configurations à nos équipements dans Containerlab. Donc, on va faire à l'ancienne (mais c'est bien suffisant pour la démo) :
|
||||
|
||||
* On se connecte à chaque équipement cEOS de notre lab via SSH (par exemple, en utilisant l'extension VSCode Containerlab comme on l'a vu dans le [cookbook](https://github.com/darnodo/projet-vxlan-automation/blob/dev/documentation/CookBook.md#%EF%B8%8F-deploy-configuration)).
|
||||
* On copie la configuration qu'on a visualisée dans Netbox (l'onglet **Render Config**).
|
||||
* Et on la colle dans l'interface de ligne de commande de l'équipement cEOS (en mode configuration, bien sûr !).
|
||||
|
||||
3. **Et Après ? Les Perspectives d'Évolution 🚀** Bien sûr, cette étape de copier-coller, c'est pas le top de l'automatisation ! Mais c'est une première étape pour voir comment Netbox peut être notre cerveau central. Dans le futur, on pourrait imaginer des outils comme Ansible ou NAPALM qui se connecteraient à Netbox, récupéreraient ces configurations générées et les appliqueraient automatiquement à nos équipements. C'est une piste pour de prochaines aventures dans l'automatisation ! 😉
|
||||
3. **Et après ?** Cette étape de copier-coller n'est pas le sommet de l'automatisation, mais c'est une première étape pour voir comment Netbox peut devenir notre cerveau central. Plus tard, des outils comme Ansible ou NAPALM pourraient se connecter à Netbox, récupérer ces configurations générées et les appliquer automatiquement à nos équipements.
|
||||
|
||||
## Validation de la communication ✅
|
||||
## Validation de la communication
|
||||
|
||||
### Ping ⚽
|
||||
### Ping
|
||||
|
||||
Dans le cookbook, nous avons fait le choix de configurer 2 clients chacun dans 2 batiments différent, ce qui nous permet de réalisé un **ping**, pour rappel :
|
||||
Dans le cookbook, nous avons fait le choix de configurer 2 clients chacun dans 2 bâtiments différents, ce qui nous permet de réaliser un **ping**, pour rappel :
|
||||
|
||||
1. 🟠 Orange:
|
||||
* Sous Réseau: 10.0.0.0/24
|
||||
* Hosts:
|
||||
* PA1: 10.0.0.10
|
||||
* PA3: 10.0.0.20
|
||||
1. Orange :
|
||||
* Sous-réseau : 10.0.0.0/24
|
||||
* Hosts :
|
||||
* PA1 : 10.0.0.10
|
||||
* PA3 : 10.0.0.20
|
||||
|
||||
2. 🟣 Purple
|
||||
2. Purple
|
||||
* Sous Réseau: 10.0.1.0/24
|
||||
* Hosts:
|
||||
* PA2: 10.0.1.10
|
||||
@@ -316,11 +316,9 @@ Et ensuite, via VSCode, il est possible de lancer wireshark directement :
|
||||
|
||||

|
||||
|
||||
## Conclusion ✨
|
||||
## Conclusion
|
||||
|
||||
Pour résumer notre parcours, on a vu comment Netbox devient notre super allié 🥇 pour automatiser le réseau VXLAN.
|
||||
La clé, c'est de partir d'**une base standardisée** 📐, c'est ce qui permet à Netbox de générer nos configurations presque tout seul grâce aux templates Jinja2.
|
||||
Netbox devient un allié solide pour automatiser le réseau VXLAN.
|
||||
La clé, c'est de partir d'une base standardisée : c'est ce qui permet à Netbox de générer nos configurations presque tout seul grâce aux templates Jinja2.
|
||||
|
||||
Même si, pour l'instant, on fait encore un peu de copier-coller 🖐️, le potentiel est immense ! Avoir toutes nos infos centralisées dans Netbox, c'est la première étape pour vraiment simplifier la gestion de notre réseau et ouvrir la porte à une automatisation complète. La standardisation n'est pas une contrainte, mais le tremplin vers plus d'efficacité. ✅
|
||||
|
||||
Ce n'est que le début ! Pensez à la suite : déployer ces configs automatiquement, gérer des réseaux plus complexes... L'automatisation est là, accessible, prête à vous faire gagner un temps précieux. 🚀💪
|
||||
On fait encore un peu de copier-coller sur la dernière étape, mais centraliser toutes nos infos dans Netbox est la première étape pour simplifier la gestion de notre réseau et ouvrir la porte à une automatisation complète. La suite : déployer ces configurations automatiquement et gérer des réseaux plus complexes.
|
||||
|
||||
Reference in New Issue
Block a user