Skip to content

Commit

Permalink
Fix(eos_cli_config_gen): Various fixes for router path-selection & ap…
Browse files Browse the repository at this point in the history
…plication-traffic-recognition (aristanetworks#3504)
  • Loading branch information
gmuloc authored Jan 17, 2024
1 parent 8495b94 commit cd7a5e1
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ interface Management1

| Name | Source Prefix | Destination Prefix | Protocols | Protocol Ranges | TCP Source Port Set | TCP Destination Port Set | UDP Source Port Set | UDP Destination Port Set |
| ---- | ------------- | ------------------ | --------- | --------------- | ------------------- | ------------------------ | ------------------- | ------------------------ |
| empty-application | - | - | - | - | - | - | - | - |
| empty-protocols | - | - | - | 21 | - | - | - | - |
| user_defined_app1 | src_prefix_set1 | dest_prefix_set1 | udp, tcp | 25 | src_port_set1 | dest_port_set1 | src_port_set2 | dest_port_set2 |
| user_defined_app2 | src_prefix_set2 | dest_prefix_set2 | pim, icmp, tcp | 21, 7-11 | - | - | - | - |

Expand Down Expand Up @@ -90,6 +92,8 @@ interface Management1
| ---- | ----- |
| dest_port_set1 | 2300-2350 |
| dest_port_set2 | 3300-3350 |
| empty-l4-ports | - |
| ordering-test | 101-103, 650, 666 |
| src_port_set1 | 2400-2500, 2900-3000 |
| src_port_set2 | 5700-5800, 6500-6600 |

Expand All @@ -99,6 +103,8 @@ interface Management1
| ---- | -------- |
| dest_prefix_set1 | 2.3.4.0/24 |
| dest_prefix_set2 | 4.4.4.0/24 |
| empty-ipv4-prefixes | - |
| order-test | 192.168.42.0/24<br>192.168.43.0/24<br>6.6.6.6/32 |
| src_prefix_set1 | 1.2.3.0/24<br>1.2.5.0/24 |
| src_prefix_set2 | 2.2.2.0/24<br>3.3.3.0/24 |

Expand All @@ -108,6 +114,11 @@ interface Management1
!
application traffic recognition
!
application ipv4 empty-application
!
application ipv4 empty-protocols
protocol 21
!
application ipv4 user_defined_app1
source prefix field-set src_prefix_set1
destination prefix field-set dest_prefix_set1
Expand Down Expand Up @@ -156,6 +167,11 @@ application traffic recognition
field-set ipv4 prefix dest_prefix_set2
4.4.4.0/24
!
field-set ipv4 prefix empty-ipv4-prefixes
!
field-set ipv4 prefix order-test
192.168.42.0/24 192.168.43.0/24 6.6.6.6/32
!
field-set ipv4 prefix src_prefix_set1
1.2.3.0/24 1.2.5.0/24
!
Expand All @@ -168,6 +184,11 @@ application traffic recognition
field-set l4-port dest_port_set2
3300-3350
!
field-set l4-port empty-l4-ports
!
field-set l4-port ordering-test
101-103, 650, 666
!
field-set l4-port src_port_set1
2400-2500, 2900-3000
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ interface Management1

| Policy Name | Jitter (ms) | Latency (ms) | Loss Rate (%) | Path Groups (priority) | Lowest Hop Count |
| ----------- | ----------- | ------------ | ------------- | ---------------------- | ---------------- |
| LB-EMPTY | - | - | - | | False |
| LB-P-1 | - | - | 17 | PG-5 (1)<br>PG-2 (42)<br>PG-4 (42)<br>PG-3 (666) | True |
| LB-P-2 | 666 | 42 | 42.42 | PG-1 (1)<br>PG-3 (1) | False |

Expand Down Expand Up @@ -201,6 +202,8 @@ router path-selection
!
path-group PG-4
!
load-balance policy LB-EMPTY
!
load-balance policy LB-P-1
hop count lowest
loss-rate 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ interface Management1
!
application traffic recognition
!
application ipv4 empty-application
!
application ipv4 empty-protocols
protocol 21
!
application ipv4 user_defined_app1
source prefix field-set src_prefix_set1
destination prefix field-set dest_prefix_set1
Expand Down Expand Up @@ -62,6 +67,11 @@ application traffic recognition
field-set ipv4 prefix dest_prefix_set2
4.4.4.0/24
!
field-set ipv4 prefix empty-ipv4-prefixes
!
field-set ipv4 prefix order-test
192.168.42.0/24 192.168.43.0/24 6.6.6.6/32
!
field-set ipv4 prefix src_prefix_set1
1.2.3.0/24 1.2.5.0/24
!
Expand All @@ -74,6 +84,11 @@ application traffic recognition
field-set l4-port dest_port_set2
3300-3350
!
field-set l4-port empty-l4-ports
!
field-set l4-port ordering-test
101-103, 650, 666
!
field-set l4-port src_port_set1
2400-2500, 2900-3000
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ router path-selection
!
path-group PG-4
!
load-balance policy LB-EMPTY
!
load-balance policy LB-P-1
hop count lowest
loss-rate 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ application_traffic_recognition:
- name: dest_port_set2
port_values:
- 3300-3350
- name: ordering-test
port_values:
- 666
- 101-103
- 650
- name: empty-l4-ports
ipv4_prefixes:
- name: src_prefix_set1
prefix_values:
Expand All @@ -49,8 +55,18 @@ application_traffic_recognition:
- name: dest_prefix_set2
prefix_values:
- 4.4.4.0/24
- name: order-test
prefix_values:
- 192.168.42.0/24
- 6.6.6.6/32
- 192.168.43.0/24
- name: empty-ipv4-prefixes
applications:
ipv4_applications:
- name: empty-application
- name: empty-protocols
protocol_ranges:
- "21"
- name: user_defined_app2
protocols:
- pim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ router_path_selection:
priority: 42
- name: PG-2
priority: 42
- name: LB-EMPTY
policies:
# Out of order to test sorting
- name: DPS-P-2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
{% set tcp_dest_port = application.tcp_dest_port_set_name | arista.avd.default("-") %}
{% set udp_src_port = application.udp_src_port_set_name | arista.avd.default("-") %}
{% set udp_dest_port = application.udp_dest_port_set_name | arista.avd.default("-") %}
{% set protocol_ranges = ", ".join(application.protocol_ranges) | arista.avd.default("-") %}
{% set protocol = ", ".join(application.protocols) | arista.avd.default("-") %}
{% set protocol_ranges = ", ".join(application.protocol_ranges | arista.avd.default(["-"])) %}
{% set protocol = ", ".join(application.protocols | arista.avd.default(["-"])) %}
| {{ application.name }} | {{ src_prefix }} | {{ dest_prefix }} | {{ protocol }} | {{ protocol_ranges }} | {{ tcp_src_port }} | {{ tcp_dest_port }} | {{ udp_src_port }} | {{ udp_dest_port }} |
{% endfor %}
{% endif %}
Expand Down Expand Up @@ -79,8 +79,7 @@
| Name | Ports |
| ---- | ----- |
{% for port_set in application_traffic_recognition.field_sets.l4_ports | arista.avd.natural_sort('name') %}
{% do port_set.port_values.sort() %}
| {{ port_set.name }} | {{ port_set.port_values | arista.avd.default([]) | join(', ') }} |
| {{ port_set.name }} | {{ port_set.port_values | arista.avd.default(["-"]) | arista.avd.natural_sort | join(', ') }} |
{% endfor %}
{% endif %}
{% if application_traffic_recognition.field_sets.ipv4_prefixes is arista.avd.defined %}
Expand All @@ -90,8 +89,7 @@
| Name | Prefixes |
| ---- | -------- |
{% for prefix_set in application_traffic_recognition.field_sets.ipv4_prefixes | arista.avd.natural_sort('name') %}
{% do prefix_set.prefix_values.sort() %}
| {{ prefix_set.name }} | {{ prefix_set.prefix_values | arista.avd.default([]) | join('<br>') }} |
| {{ prefix_set.name }} | {{ prefix_set.prefix_values | arista.avd.default(["-"]) | sort | join('<br>') }} |
{% endfor %}
{% endif %}
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,7 @@
{% set latency = load_balance_policy.latency | arista.avd.default("-") %}
{% set loss_rate = load_balance_policy.loss_rate | arista.avd.default("-") %}
{% set path_groups_list = [] %}
{# TODO remove inplace update once Ansible 2.13 is dropped and use groupby default instead #}
{% for path_group in load_balance_policy.path_groups | arista.avd.default([]) %}
{% do path_group.update({"_priority": path_group.priority | arista.avd.default(1)}) %}
{% endfor %}
{% for priority, entries in load_balance_policy.path_groups | groupby("_priority") %}
{% for priority, entries in load_balance_policy.path_groups | arista.avd.default([]) | groupby("priority", default=1) %}
{% for entry in entries | arista.avd.natural_sort("name") %}
{% do path_groups_list.append(entry.name ~ " (" ~ priority ~ ")") %}
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,20 @@ application traffic recognition
{% if application_traffic_recognition.field_sets is arista.avd.defined %}
{% for prefix_set in application_traffic_recognition.field_sets.ipv4_prefixes | arista.avd.natural_sort('name') %}
{% if prefix_set.name is arista.avd.defined %}
{% do prefix_set.prefix_values.sort() %}
!
field-set ipv4 prefix {{ prefix_set.name }}
{{ prefix_set.prefix_values | join(" ") }}
{% if prefix_set.prefix_values is arista.avd.defined %}
{{ prefix_set.prefix_values | arista.avd.default([]) | sort | join(" ") }}
{% endif %}
{% endif %}
{% endfor %}
{% for port_set in application_traffic_recognition.field_sets.l4_ports | arista.avd.natural_sort('name') %}
{% if port_set.name is arista.avd.defined %}
{% do port_set.port_values.sort() %}
!
field-set l4-port {{ port_set.name }}
{{ port_set.port_values | join(", ") }}
{% if port_set.port_values is arista.avd.defined %}
{{ port_set.port_values | arista.avd.natural_sort | join(", ") }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
Expand Down

0 comments on commit cd7a5e1

Please sign in to comment.