From f5fa416199e96fc406a511cc2695afd15601eb68 Mon Sep 17 00:00:00 2001
From: Shivani-gslab <145646625+Shivani-gslab@users.noreply.github.com>
Date: Mon, 28 Oct 2024 19:06:21 +0530
Subject: [PATCH] Feat(eos_cli_config_gen): Add vrf support for
vmtracer_sessions (#4601)
---
.../documentation/devices/vmtracer-sessions.md | 9 +++++----
.../intended/configs/vmtracer-sessions.cfg | 1 +
.../inventory/host_vars/vmtracer-sessions.yml | 1 +
.../eos_cli_config_gen/docs/tables/vmtracer-sessions.md | 2 ++
.../j2templates/documentation/vmtracer-sessions.j2 | 8 +++++---
.../j2templates/eos/vmtracer-sessions.j2 | 3 +++
.../schema/eos_cli_config_gen.schema.yml | 2 ++
.../schema/schema_fragments/vmtracer_sessions.schema.yml | 2 ++
8 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/vmtracer-sessions.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/vmtracer-sessions.md
index 261d4ea2058..f0d294c0b46 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/vmtracer-sessions.md
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/vmtracer-sessions.md
@@ -41,10 +41,10 @@ interface Management1
#### VM Tracer Summary
-| Session | URL | Username | Autovlan | Source Interface |
-| ------- | --- | -------- | -------- | ---------------- |
-| session_1 | https://192.168.0.10 | user1 | disabled | Management1 |
-| session_2 | https://192.168.0.10 | user1 | enabled | - |
+| Session | URL | Username | Autovlan | VRF | Source Interface |
+| ------- | --- | -------- | -------- | --- | ---------------- |
+| session_1 | https://192.168.0.10 | user1 | disabled | MGMT | Management1 |
+| session_2 | https://192.168.0.10 | user1 | enabled | - | - |
#### VM Tracer Device Configuration
@@ -55,6 +55,7 @@ vmtracer session session_1
username user1
password 7 encrypted_password
autovlan disable
+ vrf MGMT
source-interface Management1
!
vmtracer session session_2
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/vmtracer-sessions.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/vmtracer-sessions.cfg
index 188b436c48a..5c4df7b10c0 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/vmtracer-sessions.cfg
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/vmtracer-sessions.cfg
@@ -9,6 +9,7 @@ vmtracer session session_1
username user1
password 7 encrypted_password
autovlan disable
+ vrf MGMT
source-interface Management1
!
vmtracer session session_2
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/vmtracer-sessions.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/vmtracer-sessions.yml
index f1112ed6e0b..bfeafee695c 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/vmtracer-sessions.yml
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/vmtracer-sessions.yml
@@ -6,6 +6,7 @@ vmtracer_sessions:
username: user1
password: "encrypted_password"
autovlan_disable: true
+ vrf: MGMT
source_interface: Management1
- name: session_2
url: "https://192.168.0.10"
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/vmtracer-sessions.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/vmtracer-sessions.md
index 79104a953c8..1af2bad46c0 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/vmtracer-sessions.md
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/vmtracer-sessions.md
@@ -13,6 +13,7 @@
| [ username](## "vmtracer_sessions.[].username") | String | | | | |
| [ password](## "vmtracer_sessions.[].password") | String | | | | Type 7 Password Hash. |
| [ autovlan_disable](## "vmtracer_sessions.[].autovlan_disable") | Boolean | | | | |
+ | [ vrf](## "vmtracer_sessions.[].vrf") | String | | | | |
| [ source_interface](## "vmtracer_sessions.[].source_interface") | String | | | | |
=== "YAML"
@@ -28,5 +29,6 @@
# Type 7 Password Hash.
password:
autovlan_disable:
+ vrf:
source_interface:
```
diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vmtracer-sessions.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vmtracer-sessions.j2
index 523c9f41905..254cdc81b99 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vmtracer-sessions.j2
+++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vmtracer-sessions.j2
@@ -10,15 +10,17 @@
#### VM Tracer Summary
-| Session | URL | Username | Autovlan | Source Interface |
-| ------- | --- | -------- | -------- | ---------------- |
+| Session | URL | Username | Autovlan | VRF | Source Interface |
+| ------- | --- | -------- | -------- | --- | ---------------- |
{% for session in vmtracer_sessions | arista.avd.natural_sort('name') %}
{% set url = session.url | arista.avd.default('-') %}
+{% set username = session.username | arista.avd.default('-') %}
{% if session.autovlan_disable is arista.avd.defined(true) %}
{% set autovlan = 'disabled' %}
{% endif %}
+{% set vrf = session.vrf | arista.avd.default('-') %}
{% set source_interface = session.source_interface | arista.avd.default('-') %}
-| {{ session.name }} | {{ url }} | {{ session.username | arista.avd.default('-') }} | {{ autovlan | arista.avd.default('enabled') }} | {{ source_interface }} |
+| {{ session.name }} | {{ url }} | {{ username }} | {{ autovlan | arista.avd.default('enabled') }} | {{ vrf }} | {{ source_interface }} |
{% endfor %}
#### VM Tracer Device Configuration
diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/vmtracer-sessions.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/vmtracer-sessions.j2
index 242e6bb7cbb..7e800d25712 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/vmtracer-sessions.j2
+++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/vmtracer-sessions.j2
@@ -19,6 +19,9 @@ vmtracer session {{ session.name }}
{% if session.autovlan_disable is arista.avd.defined(true) %}
autovlan disable
{% endif %}
+{% if session.vrf is arista.avd.defined %}
+ vrf {{ session.vrf }}
+{% endif %}
{% if session.source_interface is arista.avd.defined %}
source-interface {{ session.source_interface }}
{% endif %}
diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml
index cfdc879525f..39fef85733d 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml
+++ b/python-avd/pyavd/_eos_cli_config_gen/schema/eos_cli_config_gen.schema.yml
@@ -21550,6 +21550,8 @@ keys:
description: Type 7 Password Hash.
autovlan_disable:
type: bool
+ vrf:
+ type: str
source_interface:
type: str
vrfs:
diff --git a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/vmtracer_sessions.schema.yml b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/vmtracer_sessions.schema.yml
index 1bb740189f5..055a04822eb 100644
--- a/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/vmtracer_sessions.schema.yml
+++ b/python-avd/pyavd/_eos_cli_config_gen/schema/schema_fragments/vmtracer_sessions.schema.yml
@@ -24,5 +24,7 @@ keys:
description: Type 7 Password Hash.
autovlan_disable:
type: bool
+ vrf:
+ type: str
source_interface:
type: str