From 6d5512f38a39e76df12cf8d84dd70cd009fde0c6 Mon Sep 17 00:00:00 2001 From: shivani-chourasiya Date: Fri, 29 Apr 2022 12:33:17 +0530 Subject: [PATCH 1/2] Refactor(eos_cli_config_gen): Wildcard dict to list for tcam-profile --- .../inventory/host_vars/tcam-profile.yml | 3 ++- .../arista/avd/roles/eos_cli_config_gen/README_v4.0.md | 3 ++- .../templates/documentation/tcam-profile.j2 | 4 ++-- .../roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 | 6 +++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml index 943a8297a55..e58bce7d15e 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml @@ -1,4 +1,5 @@ tcam_profile: system: traffic_policy profiles: - traffic_policy: "{{lookup('file', '{{ root_dir }}/inventory/TCAM_TRAFFIC_POLICY.conf')}}" + - name: traffic_policy + file: "{{lookup('file', '{{ root_dir }}/inventory/TCAM_TRAFFIC_POLICY.conf')}}" diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md index bf1112a14c6..74799f46cd8 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md @@ -786,7 +786,8 @@ hardware_counters: tcam_profile: system: < tcam profile name to activate > profiles: - < tcam_profile 01 >: "{{ lookup('file', '< path to TCAM profile using EOS syntax >') }}" + - name: < tcam_profile 01 > + file: "{{ lookup('file', '< path to TCAM profile using EOS syntax >') }}" ``` #### Platform diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 index 10489c62f61..ca046ac0636 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 @@ -9,8 +9,8 @@ TCAM profile __`{{ tcam_profile.system | arista.avd.default('default') }}`__ is Following TCAM profiles are configured on device: -{% for profile in tcam_profile.profiles %} -- Profile Name: `{{ profile }}` +{% for profile in tcam_profile.profiles | arista.avd.convert_dicts('name','file') %} +- Profile Name: `{{ profile.name }}` {% endfor %} {% endif %} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 index 38df8066099..9672fbb366a 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 @@ -3,9 +3,9 @@ ! hardware tcam {% if tcam_profile.profiles is arista.avd.defined %} -{% for profile in tcam_profile.profiles | arista.avd.natural_sort %} - profile {{ profile }} -{{ tcam_profile.profiles[profile] }} +{% for profile in tcam_profile.profiles | arista.avd.convert_dicts('name','file') | arista.avd.natural_sort('name') %} + profile {{ profile.name }} +{{ profile.file }} ! {% endfor %} {% endif %} From 46559608da188476c454a73f0cdb5b339465a52e Mon Sep 17 00:00:00 2001 From: shivani-chourasiya Date: Thu, 5 May 2022 10:01:34 +0530 Subject: [PATCH 2/2] Updated file keyword to config --- .../inventory/host_vars/tcam-profile.yml | 2 +- .../arista/avd/roles/eos_cli_config_gen/README_v4.0.md | 2 +- .../templates/documentation/tcam-profile.j2 | 2 +- .../roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml index e58bce7d15e..2b803474620 100644 --- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml +++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen_v4.0/inventory/host_vars/tcam-profile.yml @@ -2,4 +2,4 @@ tcam_profile: system: traffic_policy profiles: - name: traffic_policy - file: "{{lookup('file', '{{ root_dir }}/inventory/TCAM_TRAFFIC_POLICY.conf')}}" + config: "{{lookup('file', '{{ root_dir }}/inventory/TCAM_TRAFFIC_POLICY.conf')}}" diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md index 74799f46cd8..d5aa622b532 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/README_v4.0.md @@ -787,7 +787,7 @@ tcam_profile: system: < tcam profile name to activate > profiles: - name: < tcam_profile 01 > - file: "{{ lookup('file', '< path to TCAM profile using EOS syntax >') }}" + config: "{{ lookup('file', '< path to TCAM profile using EOS syntax >') }}" ``` #### Platform diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 index ca046ac0636..7e397eacbd0 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/tcam-profile.j2 @@ -9,7 +9,7 @@ TCAM profile __`{{ tcam_profile.system | arista.avd.default('default') }}`__ is Following TCAM profiles are configured on device: -{% for profile in tcam_profile.profiles | arista.avd.convert_dicts('name','file') %} +{% for profile in tcam_profile.profiles | arista.avd.convert_dicts('name','config') %} - Profile Name: `{{ profile.name }}` {% endfor %} {% endif %} diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 index 9672fbb366a..63cef1d9eae 100644 --- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 +++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/tcam-profile.j2 @@ -3,9 +3,9 @@ ! hardware tcam {% if tcam_profile.profiles is arista.avd.defined %} -{% for profile in tcam_profile.profiles | arista.avd.convert_dicts('name','file') | arista.avd.natural_sort('name') %} +{% for profile in tcam_profile.profiles | arista.avd.convert_dicts('name','config') | arista.avd.natural_sort('name') %} profile {{ profile.name }} -{{ profile.file }} +{{ profile.config }} ! {% endfor %} {% endif %}