Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(eos_cli_config_gen)!: update logic in monitor_sessions to not require both source and destination #3823

Merged
merged 13 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ interface Management1
| Access Group Name | ipv4ACL |
| Sample | 50 |

##### myMonitoringSession3

####### myMonitoringSession3 Sources

| Sources | Direction | Access Group Type | Access Group Name | Access Group Priority |
| ------- | --------- | ----------------- | ----------------- | --------------------- |
| Ethernet20 | both | ip | ipv4ACL | 10 |

####### myMonitoringSession3 Destinations and Session Settings

| Settings | Values |
| -------- | ------ |
| Destinations | - |

#### Monitor Sessions Device Configuration

```eos
Expand All @@ -99,4 +113,5 @@ monitor session myMonitoringSession2 destination Ethernet50
monitor session myMonitoringSession2 encapsulation gre metadata tx
monitor session myMonitoringSession2 ip access-group ipv4ACL
monitor session myMonitoringSession2 sample 50
monitor session myMonitoringSession3 source Ethernet20 both ip access-group ipv4ACL priority 10
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ monitor session myMonitoringSession2 destination Ethernet50
monitor session myMonitoringSession2 encapsulation gre metadata tx
monitor session myMonitoringSession2 ip access-group ipv4ACL
monitor session myMonitoringSession2 sample 50
monitor session myMonitoringSession3 source Ethernet20 both ip access-group ipv4ACL priority 10
!
end
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ monitor_sessions:
type: ip
name: ipv4ACL
sample: 50
- name: myMonitoringSession3
sources:
- name: Ethernet20
direction: both
access_group:
type: ip
name: ipv4ACL
priority: 10
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ monitor session MonitoringSessionServer18WithDest rate-limit per-ingress-chip 30
monitor session MonitoringSessionServer18WithDest rate-limit per-egress-chip 30 bps
monitor session MonitoringSessionServer18WithDest sample 10
monitor session MonitoringSessionServer18WithDest truncate size 20
monitor session MonitoringSessionServer18WithoutDest source Ethernet25 tx
!
ip prefix-list PL-LOOPBACKS-EVPN-OVERLAY
seq 10 permit 192.168.255.0/24 eq 32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ monitor session MonitoringSessionServer18WithDest rate-limit per-ingress-chip 30
monitor session MonitoringSessionServer18WithDest rate-limit per-egress-chip 30 bps
monitor session MonitoringSessionServer18WithDest sample 10
monitor session MonitoringSessionServer18WithDest truncate size 20
monitor session MonitoringSessionServer18WithoutDest source Ethernet25 tx
!
ip prefix-list PL-LOOPBACKS-EVPN-OVERLAY
seq 10 permit 192.168.255.0/24 eq 32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,48 +9,46 @@
### Monitor Sessions

#### Monitor Sessions Summary
{% for monitor_session in monitor_sessions | arista.avd.natural_sort('name') if monitor_session.name is arista.avd.defined %}
{% if monitor_session.sources is arista.avd.defined and monitor_session.destinations is arista.avd.defined %}
{% for monitor_session in monitor_sessions | arista.avd.natural_sort('name') %}

##### {{ monitor_session.name }}

####### {{ monitor_session.name }} Sources

| Sources | Direction | Access Group Type | Access Group Name | Access Group Priority |
| ------- | --------- | ----------------- | ----------------- | --------------------- |
{% for source in monitor_session.sources | arista.avd.natural_sort('name') if source.name is arista.avd.defined %}
{% for source in monitor_session.sources | arista.avd.natural_sort('name') %}
| {{ source.name }} | {{ source.direction | arista.avd.default('both') }} | {{ source.access_group.type | arista.avd.default('-') }} | {{ source.access_group.name | arista.avd.default('-') }} | {{ source.access_group.priority | arista.avd.default('-') }} |
{% endfor %}
{% endfor %}

####### {{ monitor_session.name }} Destinations and Session Settings

| Settings | Values |
| -------- | ------ |
| Destinations | {{ monitor_session.destinations | join(', ') }} |
{% if monitor_session.encapsulation_gre_metadata_tx is arista.avd.defined(true) %}
| Destinations | {{ monitor_session.destinations | arista.avd.default(["-"]) | join(', ') }} |
{% if monitor_session.encapsulation_gre_metadata_tx is arista.avd.defined(true) %}
| Encapsulation Gre Metadata Tx | {{ monitor_session.encapsulation_gre_metadata_tx }} |
{% endif %}
{% if monitor_session.header_remove_size is arista.avd.defined %}
{% endif %}
{% if monitor_session.header_remove_size is arista.avd.defined %}
| Header Remove Size | {{ monitor_session.header_remove_size }} |
{% endif %}
{% if monitor_session.access_group.type is arista.avd.defined and monitor_session.access_group.name is arista.avd.defined %}
{% endif %}
{% if monitor_session.access_group.type is arista.avd.defined and monitor_session.access_group.name is arista.avd.defined %}
| Access Group Type | {{ monitor_session.access_group.type }} |
| Access Group Name | {{ monitor_session.access_group.name }} |
{% endif %}
{% if monitor_session.rate_limit_per_ingress_chip is arista.avd.defined %}
{% endif %}
{% if monitor_session.rate_limit_per_ingress_chip is arista.avd.defined %}
| Rate Limit per Ingress Chip | {{ monitor_session.rate_limit_per_ingress_chip }} |
{% endif %}
{% if monitor_session.rate_limit_per_ingress_chip is arista.avd.defined %}
{% endif %}
{% if monitor_session.rate_limit_per_ingress_chip is arista.avd.defined %}
| Rate Limit per Egress Chip | {{ monitor_session.rate_limit_per_egress_chip }} |
{% endif %}
{% if monitor_session.sample is arista.avd.defined %}
{% endif %}
{% if monitor_session.sample is arista.avd.defined %}
| Sample | {{ monitor_session.sample }} |
{% endif %}
{% if monitor_session.truncate.enabled is arista.avd.defined(true) %}
{% endif %}
{% if monitor_session.truncate.enabled is arista.avd.defined(true) %}
| Truncate Enabled | {{ monitor_session.truncate.enabled }} |
{% if monitor_session.truncate.size is arista.avd.defined %}
{% if monitor_session.truncate.size is arista.avd.defined %}
| Truncate Size | {{ monitor_session.truncate.size }} |
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,47 @@
{# eos - monitor sessions #}
{% if monitor_sessions is arista.avd.defined %}
!
{% for monitor_session in monitor_sessions | arista.avd.natural_sort('name') if monitor_session.name is arista.avd.defined %}
{% if monitor_session.sources is arista.avd.defined and monitor_session.destinations is arista.avd.defined %}
{% for source in monitor_session.sources | arista.avd.natural_sort('name') if source.name is arista.avd.defined %}
{% set source_cli = "monitor session " ~ monitor_session.name ~ " source " ~ source.name %}
{% if source.direction is arista.avd.defined %}
{% set source_cli = source_cli ~ " " ~ source.direction %}
{% endif %}
{% if source.access_group.type is arista.avd.defined and source.access_group.name is arista.avd.defined %}
{% set source_cli = source_cli ~ " " ~ source.access_group.type ~ " access-group " ~ source.access_group.name %}
{% if source.access_group.priority is arista.avd.defined %}
{% set source_cli = source_cli ~ " priority " ~ source.access_group.priority %}
{% endif %}
{% for monitor_session in monitor_sessions | arista.avd.natural_sort('name') %}
{% for source in monitor_session.sources | arista.avd.natural_sort('name') %}
{% set source_cli = "monitor session " ~ monitor_session.name ~ " source " ~ source.name %}
{% if source.direction is arista.avd.defined %}
{% set source_cli = source_cli ~ " " ~ source.direction %}
{% endif %}
{% if source.access_group.type is arista.avd.defined and source.access_group.name is arista.avd.defined %}
{% set source_cli = source_cli ~ " " ~ source.access_group.type ~ " access-group " ~ source.access_group.name %}
{% if source.access_group.priority is arista.avd.defined %}
{% set source_cli = source_cli ~ " priority " ~ source.access_group.priority %}
{% endif %}
{% endif %}
{{ source_cli }}
{% endfor %}
{% for destination in monitor_session.destinations | arista.avd.natural_sort %}
{% endfor %}
{% for destination in monitor_session.destinations | arista.avd.natural_sort %}
monitor session {{ monitor_session.name }} destination {{ destination }}
{% endfor %}
{% if monitor_session.encapsulation_gre_metadata_tx is arista.avd.defined(true) %}
{% endfor %}
{% if monitor_session.encapsulation_gre_metadata_tx is arista.avd.defined(true) %}
monitor session {{ monitor_session.name }} encapsulation gre metadata tx
{% endif %}
{% if monitor_session.header_remove_size is arista.avd.defined %}
{% endif %}
{% if monitor_session.header_remove_size is arista.avd.defined %}
monitor session {{ monitor_session.name }} header remove size {{ monitor_session.header_remove_size }}
{% endif %}
{% if monitor_session.access_group.type is arista.avd.defined and monitor_session.access_group.name is arista.avd.defined %}
{% endif %}
{% if monitor_session.access_group.type is arista.avd.defined and monitor_session.access_group.name is arista.avd.defined %}
monitor session {{ monitor_session.name }} {{ monitor_session.access_group.type }} access-group {{ monitor_session.access_group.name }}
{% endif %}
{% if monitor_session.rate_limit_per_ingress_chip is arista.avd.defined %}
{% endif %}
{% if monitor_session.rate_limit_per_ingress_chip is arista.avd.defined %}
monitor session {{ monitor_session.name }} rate-limit per-ingress-chip {{ monitor_session.rate_limit_per_ingress_chip }}
{% endif %}
{% if monitor_session.rate_limit_per_egress_chip is arista.avd.defined %}
{% endif %}
{% if monitor_session.rate_limit_per_egress_chip is arista.avd.defined %}
monitor session {{ monitor_session.name }} rate-limit per-egress-chip {{ monitor_session.rate_limit_per_egress_chip }}
{% endif %}
{% if monitor_session.sample is arista.avd.defined %}
{% endif %}
{% if monitor_session.sample is arista.avd.defined %}
monitor session {{ monitor_session.name }} sample {{ monitor_session.sample }}
{% endif %}
{% if monitor_session.truncate.enabled is arista.avd.defined(true) %}
{% set truncate_cli = "monitor session " ~ monitor_session.name ~ " truncate" %}
{% if monitor_session.truncate.size is arista.avd.defined %}
{% set truncate_cli = truncate_cli ~ " size " ~ monitor_session.truncate.size %}
{% endif %}
{% if monitor_session.truncate.enabled is arista.avd.defined(true) %}
{% set truncate_cli = "monitor session " ~ monitor_session.name ~ " truncate" %}
{% if monitor_session.truncate.size is arista.avd.defined %}
{% set truncate_cli = truncate_cli ~ " size " ~ monitor_session.truncate.size %}
{% endif %}
{{ truncate_cli }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Loading