From 4d3e2fd59967640b6bb51f1002e697c0cd825422 Mon Sep 17 00:00:00 2001 From: Shivani-gslab Date: Fri, 19 Jul 2024 19:56:00 +0530 Subject: [PATCH] fixing pyavd test coverage --- .../documentation/devices/mpls-2.md | 62 ++++++++++++++++++ .../documentation/devices/mpls-3.md | 63 +++++++++++++++++++ .../intended/configs/mpls-2.cfg | 20 ++++++ .../intended/configs/mpls-3.cfg | 21 +++++++ .../inventory/host_vars/mpls-2.yml | 9 +++ .../inventory/host_vars/mpls-3.yml | 6 ++ .../eos_cli_config_gen/inventory/hosts.ini | 2 + .../j2templates/eos/mpls.j2 | 2 +- python-avd/tox.ini | 1 + 9 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-2.md create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-3.md create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-2.cfg create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-3.cfg create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-2.yml create mode 100644 ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-3.yml diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-2.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-2.md new file mode 100644 index 00000000000..3d4e6c903f5 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-2.md @@ -0,0 +1,62 @@ +# mpls-2 + +## Table of Contents + +- [Management](#management) + - [Management Interfaces](#management-interfaces) +- [MPLS](#mpls) + - [MPLS and LDP](#mpls-and-ldp) + +## Management + +### Management Interfaces + +#### Management Interfaces Summary + +##### IPv4 + +| Management Interface | Description | Type | VRF | IP Address | Gateway | +| -------------------- | ----------- | ---- | --- | ---------- | ------- | +| Management1 | oob_management | oob | MGMT | 10.73.255.122/24 | 10.73.255.2 | + +##### IPv6 + +| Management Interface | Description | Type | VRF | IPv6 Address | IPv6 Gateway | +| -------------------- | ----------- | ---- | --- | ------------ | ------------ | +| Management1 | oob_management | oob | MGMT | - | - | + +#### Management Interfaces Device Configuration + +```eos +! +interface Management1 + description oob_management + vrf MGMT + ip address 10.73.255.122/24 +``` + +## MPLS + +### MPLS and LDP + +#### MPLS and LDP Summary + +| Setting | Value | +| -------- | ---- | +| MPLS IP Enabled | True | +| LDP Enabled | False | +| LDP Router ID | - | +| LDP Interface Disabled Default | False | +| LDP Transport-Address Interface | - | +| ICMP Fragmentation-Needed Tunneling Enabled | False | +| ICMP TTL-Exceeded Tunneling Enabled | False | + +#### MPLS and LDP Device Configuration + +```eos +! +mpls ip +! +mpls ldp + shutdown +``` diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-3.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-3.md new file mode 100644 index 00000000000..f01b67e362e --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/mpls-3.md @@ -0,0 +1,63 @@ +# mpls-3 + +## Table of Contents + +- [Management](#management) + - [Management Interfaces](#management-interfaces) +- [MPLS](#mpls) + - [MPLS and LDP](#mpls-and-ldp) + +## Management + +### Management Interfaces + +#### Management Interfaces Summary + +##### IPv4 + +| Management Interface | Description | Type | VRF | IP Address | Gateway | +| -------------------- | ----------- | ---- | --- | ---------- | ------- | +| Management1 | oob_management | oob | MGMT | 10.73.255.122/24 | 10.73.255.2 | + +##### IPv6 + +| Management Interface | Description | Type | VRF | IPv6 Address | IPv6 Gateway | +| -------------------- | ----------- | ---- | --- | ------------ | ------------ | +| Management1 | oob_management | oob | MGMT | - | - | + +#### Management Interfaces Device Configuration + +```eos +! +interface Management1 + description oob_management + vrf MGMT + ip address 10.73.255.122/24 +``` + +## MPLS + +### MPLS and LDP + +#### MPLS and LDP Summary + +| Setting | Value | +| -------- | ---- | +| MPLS IP Enabled | True | +| LDP Enabled | False | +| LDP Router ID | 192.168.1.2 | +| LDP Interface Disabled Default | True | +| LDP Transport-Address Interface | - | +| ICMP Fragmentation-Needed Tunneling Enabled | - | +| ICMP TTL-Exceeded Tunneling Enabled | - | + +#### MPLS and LDP Device Configuration + +```eos +! +mpls ip +! +mpls ldp + interface disabled default + router-id 192.168.1.2 +``` diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-2.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-2.cfg new file mode 100644 index 00000000000..b7154ea14fc --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-2.cfg @@ -0,0 +1,20 @@ +!RANCID-CONTENT-TYPE: arista +! +transceiver qsfp default-mode 4x10G +! +hostname mpls-2 +! +no enable password +no aaa root +! +interface Management1 + description oob_management + vrf MGMT + ip address 10.73.255.122/24 +! +mpls ip +! +mpls ldp + shutdown +! +end diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-3.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-3.cfg new file mode 100644 index 00000000000..20fc1078004 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/mpls-3.cfg @@ -0,0 +1,21 @@ +!RANCID-CONTENT-TYPE: arista +! +transceiver qsfp default-mode 4x10G +! +hostname mpls-3 +! +no enable password +no aaa root +! +interface Management1 + description oob_management + vrf MGMT + ip address 10.73.255.122/24 +! +mpls ip +! +mpls ldp + interface disabled default + router-id 192.168.1.2 +! +end diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-2.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-2.yml new file mode 100644 index 00000000000..0ddfef7e6f4 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-2.yml @@ -0,0 +1,9 @@ +# test for mpls.ldp.shutdown: true +mpls: + ip: true + ldp: + interface_disabled_default: false + shutdown: true + icmp: + fragmentation_needed_tunneling: false + ttl_exceeded_tunneling: false diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-3.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-3.yml new file mode 100644 index 00000000000..bd7b425f5a8 --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/mpls-3.yml @@ -0,0 +1,6 @@ +# test for mpls.ldp.shutdown: true +mpls: + ip: true + ldp: + interface_disabled_default: true + router_id: 192.168.1.2 diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini index d0475ea5236..a10c9d847bb 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/hosts.ini @@ -97,6 +97,8 @@ monitor-sessions monitor-telemetry-influx monitor-telemetry-postcard-policy mpls +mpls-2 +mpls-3 none_configuration ntp object-tracking diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 index 2e5f3d25555..6fce879299b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/mpls.j2 @@ -26,7 +26,7 @@ mpls ldp transport-address interface {{ mpls.ldp.transport_address_interface }} {% endif %} {% endif %} -{% if mpls.icmp is arista.avd.defined %} +{% if mpls.icmp.fragmentation_needed_tunneling is arista.avd.defined(true) or mpls.icmp.ttl_exceeded_tunneling is arista.avd.defined(true) %} ! {% if mpls.icmp.fragmentation_needed_tunneling is arista.avd.defined(true) %} mpls icmp fragmentation-needed tunneling diff --git a/python-avd/tox.ini b/python-avd/tox.ini index ca22a4f4f89..510b825d41b 100644 --- a/python-avd/tox.ini +++ b/python-avd/tox.ini @@ -55,3 +55,4 @@ deps = coverage[toml] commands = coverage report --rcfile=pyproject.toml + coverage html --rcfile=pyproject.toml