Skip to content

Commit

Permalink
fixing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Vibhu-gslab committed Nov 7, 2024
1 parent 932b032 commit 7a47340
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,37 @@ interface Management1

| Protocol | VRF | Access-list | Ingress-default |
| -------- | --- | ------------| --------------- |
| IPv4 | default | acl4_1 | - |
| IPv4 | red | acl4_2 | - |
| IPv4 | red_1 | acl4_2 | - |
| IPv4 | default | acl4_3 | - |
| IPv4 | red_2 | acl4_4 | True |
| IPv4 | default | acl4_1 | False |
| IPv4 | - | acl4_2 | True |
| IPv4 | default | acl4_3 | False |
| IPv4 | red_2 | acl4_4 | False |
| IPv4 | red_5 | acl4_4 | False |
| IPv4 | red_3 | acl4_5 | False |
| IPv4 | red_4 | ingress | - |
| IPv6 | default | acl6_1 | - |
| IPv6 | blue | acl6_2 | - |
| IPv6 | blue_1 | acl6_2 | - |
| IPv6 | default | acl6_3 | - |
| IPv6 | default | acl6_4 | True |
| IPv6 | blue_2 | ingress | - |
| IPv4 | red_4 | ingress | False |
| IPv6 | default | acl6_1 | False |
| IPv6 | blue | acl6_2 | False |
| IPv6 | blue_1 | acl6_2 | False |
| IPv6 | default | acl6_3 | False |
| IPv6 | - | acl6_4 | True |
| IPv6 | blue_2 | ingress | False |

#### System Control-Plane Device Configuration

```eos
!
system control-plane
tcp mss ceiling ipv4 1344 ipv6 1366
ip access-group acl4_1 in
ip access-group acl4_2 vrf red in
ip access-group acl4_2 vrf red_1 in
ip access-group acl4_3 vrf default in
ip access-group ingress default acl4_4
ip access-group ingress default acl4_2
ip access-group acl4_3 in
ip access-group acl4_4 vrf red_2 in
ip access-group acl4_5 vrf red_3 in
ip access-group ingress vrf red_4 in
ipv6 access-group acl6_1 in
ipv6 access-group acl6_2 vrf blue in
ipv6 access-group acl6_2 vrf blue_1 in
ipv6 access-group acl6_3 vrf default in
ipv6 access-group ingress default acl6_4
ipv6 access-group ingress vrf blue_2 in
ip access-group acl4_4 vrf red_5 in
ip access-group ingress default acl6_4
ip access-group acl6_3 in
ip access-group acl6_2 vrf blue in
ip access-group acl6_2 vrf blue_1 in
ip access-group ingress vrf blue_2 in
```

## System L1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ interface Management1
!
system control-plane
tcp mss ceiling ipv4 1344 ipv6 1366
ip access-group acl4_1 in
ip access-group acl4_2 vrf red in
ip access-group acl4_2 vrf red_1 in
ip access-group acl4_3 vrf default in
ip access-group ingress default acl4_4
ip access-group ingress default acl4_2
ip access-group acl4_3 in
ip access-group acl4_4 vrf red_2 in
ip access-group acl4_5 vrf red_3 in
ip access-group ingress vrf red_4 in
ipv6 access-group acl6_1 in
ipv6 access-group acl6_2 vrf blue in
ipv6 access-group acl6_2 vrf blue_1 in
ipv6 access-group acl6_3 vrf default in
ipv6 access-group ingress default acl6_4
ipv6 access-group ingress vrf blue_2 in
ip access-group acl4_4 vrf red_5 in
ip access-group ingress default acl6_4
ip access-group acl6_3 in
ip access-group acl6_2 vrf blue in
ip access-group acl6_2 vrf blue_1 in
ip access-group ingress vrf blue_2 in
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ system:
ipv6: 1366
ipv4_access_groups:
- acl_name: "acl4_1"
- acl_name: "acl4_2"
vrf: red
- acl_name: "acl4_2"
vrf: red_1
- acl_name: "acl4_3"
vrf: default
- acl_name: "acl4_4"
vrf: red_2
- acl_name: "acl4_3"
vrf: default
- acl_name: "acl4_2"
ingress_default: true
- acl_name: "acl4_5"
vrf: red_3
ingress_default: false
- acl_name: "ingress"
vrf: red_4
- acl_name: "acl4_4"
vrf: red_5
ipv6_access_groups:
- acl_name: "acl6_1"
- acl_name: "acl6_2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
| -------- | --- | ------------| --------------- |
{# IPv4 Access-groups #}
{% for acl_set in system.control_plane.ipv4_access_groups | arista.avd.natural_sort %}
| IPv4 | {{ acl_set.vrf | arista.avd.default('default') }} | {{ acl_set.acl_name }} | {{ acl_set.ingress_default | arista.avd.default('-') }} |
{% set vrf = '-' if acl_set.ingress_default is arista.avd.defined(true) else acl_set.vrf | arista.avd.default('default') %}
| IPv4 | {{ vrf }} | {{ acl_set.acl_name }} | {{ acl_set.ingress_default | arista.avd.default('False') }} |
{% endfor %}
{# IPv6 Access-groups #}
{% for acl_set in system.control_plane.ipv6_access_groups | arista.avd.natural_sort %}
| IPv6 | {{ acl_set.vrf | arista.avd.default('default') }} | {{ acl_set.acl_name }} | {{ acl_set.ingress_default | arista.avd.default('-') }} |
{% set vrf = '-' if acl_set.ingress_default is arista.avd.defined(true) else acl_set.vrf | arista.avd.default('default') %}
| IPv6 | {{ vrf }} | {{ acl_set.acl_name }} | {{ acl_set.ingress_default | arista.avd.default('False') }} |
{% endfor %}
{% endif %}

Expand Down
94 changes: 64 additions & 30 deletions python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/system.j2
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,74 @@ system control-plane
{% endif %}
{# control_plane access_groups ipv4 #}
{% if system.control_plane.ipv4_access_groups is arista.avd.defined %}
{% set with_vrf_non_default = system.control_plane.ipv4_access_groups | selectattr('vrf', 'arista.avd.defined') | rejectattr('vrf', 'equalto', 'default') | arista.avd.natural_sort | arista.avd.natural_sort('vrf') %}
{% set without_vrf = system.control_plane.ipv4_access_groups | rejectattr('vrf', 'arista.avd.defined') | arista.avd.natural_sort %}
{% set with_vrf_default = system.control_plane.ipv4_access_groups | selectattr('vrf', 'arista.avd.defined') | selectattr('vrf', 'equalto', 'default') | arista.avd.natural_sort %}
{% set sorted_ipv4_access_groups = without_vrf | list + with_vrf_default | list + with_vrf_non_default | list %}
{% endif %}
{% for acl_set in system.control_plane.ipv4_access_groups | arista.avd.natural_sort %}
{% if acl_set.ingress_default is arista.avd.defined(true) %}
{% set cp_ipv4_access_grp = "ip access-group ingress default " ~ acl_set.acl_name %}
{% else %}
{% set cp_ipv4_access_grp = "ip access-group " ~ acl_set.acl_name %}
{% if acl_set.vrf is arista.avd.defined %}
{% set cp_ipv4_access_grp = cp_ipv4_access_grp ~ " vrf " ~ acl_set.vrf %}
{% set cp_ipv4_access_dict = {} %}
{% for acl_set in system.control_plane.ipv4_access_groups | arista.avd.natural_sort %}
{% if acl_set.ingress_default is arista.avd.defined(true) %}
{% set cp_ipv4_access_grp = "ip access-group ingress default " ~ acl_set.acl_name %}
{% else %}
{% set cp_ipv4_access_grp = "ip access-group " ~ acl_set.acl_name %}
{% if acl_set.vrf is arista.avd.defined and acl_set.vrf != 'default' %}
{% set cp_ipv4_access_grp = cp_ipv4_access_grp ~ " vrf " ~ acl_set.vrf %}
{% endif %}
{% set cp_ipv4_access_grp = cp_ipv4_access_grp ~ " in" %}
{% endif %}
{% if acl_set.ingress_default is arista.avd.defined(true) %}
{% set vrf_key = 'ingress_default' %}
{% else %}
{% if acl_set.vrf is arista.avd.defined and acl_set.vrf != 'default' %}
{% set vrf_key = acl_set.vrf %}
{% else %}
{% set vrf_key = 'default' %}
{% endif %}
{% endif %}
{% set cp_ipv4_access_grp = cp_ipv4_access_grp ~ " in" %}
{% set _ = cp_ipv4_access_dict.update({ vrf_key: cp_ipv4_access_grp }) %}
{% endfor %}
{% if "ingress_default" in cp_ipv4_access_dict %}
{{ cp_ipv4_access_dict["ingress_default"] }}
{% set _ = cp_ipv4_access_dict.pop('ingress_default') %}
{% endif %}
{{ cp_ipv4_access_grp }}
{% endfor %}
{% if "default" in cp_ipv4_access_dict %}
{{ cp_ipv4_access_dict["default"] }}
{% set _ = cp_ipv4_access_dict.pop('default') %}
{% endif %}
{% for vrf, access_grp in cp_ipv4_access_dict.items() | arista.avd.natural_sort %}
{{ access_grp }}
{% endfor %}
{% endif %}
{# control_plane access_groups ipv6 #}
{% if system.control_plane.ipv6_access_groups is arista.avd.defined %}
{% set with_vrf_non_default = system.control_plane.ipv6_access_groups | selectattr('vrf', 'arista.avd.defined') | rejectattr('vrf', 'equalto', 'default') | arista.avd.natural_sort | arista.avd.natural_sort('vrf') %}
{% set without_vrf = system.control_plane.ipv6_access_groups | rejectattr('vrf', 'arista.avd.defined') | arista.avd.natural_sort %}
{% set with_vrf_default = system.control_plane.ipv6_access_groups | selectattr('vrf', 'arista.avd.defined') | selectattr('vrf', 'equalto', 'default') | arista.avd.natural_sort %}
{% set sorted_ipv6_access_groups = without_vrf | list + with_vrf_default | list + with_vrf_non_default | list %}
{% endif %}
{% for acl_set in system.control_plane.ipv6_access_groups | arista.avd.natural_sort %}
{% if acl_set.ingress_default is arista.avd.defined(true) %}
{% set cp_ipv6_access_grp = "ipv6 access-group ingress default " ~ acl_set.acl_name %}
{% else %}
{% set cp_ipv6_access_grp = "ipv6 access-group " ~ acl_set.acl_name %}
{% if acl_set.vrf is arista.avd.defined %}
{% set cp_ipv6_access_grp = cp_ipv6_access_grp ~ " vrf " ~ acl_set.vrf %}
{% set cp_ipv6_access_dict = {} %}
{% for acl_set in system.control_plane.ipv6_access_groups | arista.avd.natural_sort %}
{% if acl_set.ingress_default is arista.avd.defined(true) %}
{% set cp_ipv4_access_grp = "ip access-group ingress default " ~ acl_set.acl_name %}
{% else %}
{% set cp_ipv4_access_grp = "ip access-group " ~ acl_set.acl_name %}
{% if acl_set.vrf is arista.avd.defined and acl_set.vrf != 'default' %}
{% set cp_ipv4_access_grp = cp_ipv4_access_grp ~ " vrf " ~ acl_set.vrf %}
{% endif %}
{% set cp_ipv4_access_grp = cp_ipv4_access_grp ~ " in" %}
{% endif %}
{% if acl_set.ingress_default is arista.avd.defined(true) %}
{% set vrf_key = 'ingress_default' %}
{% else %}
{% if acl_set.vrf is arista.avd.defined and acl_set.vrf != 'default' %}
{% set vrf_key = acl_set.vrf %}
{% else %}
{% set vrf_key = 'default' %}
{% endif %}
{% endif %}
{% set cp_ipv6_access_grp = cp_ipv6_access_grp ~ " in" %}
{% set _ = cp_ipv6_access_dict.update({ vrf_key: cp_ipv4_access_grp }) %}
{% endfor %}
{% if "ingress_default" in cp_ipv6_access_dict %}
{{ cp_ipv6_access_dict["ingress_default"] }}
{% set _ = cp_ipv6_access_dict.pop('ingress_default') %}
{% endif %}
{{ cp_ipv6_access_grp }}
{% endfor %}
{% if "default" in cp_ipv6_access_dict %}
{{ cp_ipv6_access_dict["default"] }}
{% set _ = cp_ipv6_access_dict.pop('default') %}
{% endif %}
{% for vrf, access_grp in cp_ipv6_access_dict.items() | arista.avd.natural_sort %}
{{ access_grp }}
{% endfor %}
{% endif %}
{% endif %}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ keys:
type: list
unique_keys:
- vrf
- ingress_default
items:
type: dict
keys:
Expand All @@ -47,6 +48,7 @@ keys:
type: list
unique_keys:
- vrf
- ingress_default
items:
type: dict
keys:
Expand Down

0 comments on commit 7a47340

Please sign in to comment.