diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-path-selection.md b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-path-selection.md
index 4e414e7ddf9..a1f23268780 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-path-selection.md
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/documentation/devices/router-path-selection.md
@@ -112,10 +112,10 @@ interface Management1
#### Load-balance policies
-| Policy name | Latency | Path group(s) |
-| ----------- | ------- | ------------- |
-| LB-P-1 | - | PG-2
PG-3 |
-| LB-P-2 | 42 | PG-1 |
+| Policy name | Jitter (ms) | Latency (ms) | Loss Rate (%) | Path groups (priority) | Hop count lowest |
+| ----------- | ----------- | ------------ | ------------- | ---------------------- | ---------------- |
+| LB-P-1 | - | - | 17 | PG-5 (1)
PG-2 (42)
PG-4 (42)
PG-3 (666) | False |
+| LB-P-2 | 666 | 42 | 42.42 | PG-1 (1)
PG-3 (1) | False |
#### DPS policies
@@ -202,12 +202,19 @@ router path-selection
path-group PG-4
!
load-balance policy LB-P-1
- path-group PG-3
- path-group PG-2
+ hop count lower
+ loss-rate 17
+ path-group PG-5
+ path-group PG-2 priority 42
+ path-group PG-4 priority 42
+ path-group PG-3 priority 666
!
load-balance policy LB-P-2
+ jitter 666
latency 42
+ loss-rate 42.42
path-group PG-1
+ path-group PG-3
!
policy DPS-P-1
default-match
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-path-selection.cfg b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-path-selection.cfg
index c820bf37983..e79215f81c1 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-path-selection.cfg
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/router-path-selection.cfg
@@ -55,12 +55,19 @@ router path-selection
path-group PG-4
!
load-balance policy LB-P-1
- path-group PG-3
- path-group PG-2
+ hop count lower
+ loss-rate 17
+ path-group PG-5
+ path-group PG-2 priority 42
+ path-group PG-4 priority 42
+ path-group PG-3 priority 666
!
load-balance policy LB-P-2
+ jitter 666
latency 42
+ loss-rate 42.42
path-group PG-1
+ path-group PG-3
!
policy DPS-P-1
default-match
diff --git a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-path-selection.yml b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-path-selection.yml
index 5830b1ef27f..06ce3533361 100644
--- a/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-path-selection.yml
+++ b/ansible_collections/arista/avd/molecule/eos_cli_config_gen/inventory/host_vars/router-path-selection.yml
@@ -71,12 +71,26 @@ router_path_selection:
# Out of order to test sorting
- name: LB-P-2
latency: 42
+ jitter: 666
+ loss_rate: "42.42"
path_groups:
- - PG-1
+ # checking priority 1 comes first
+ - name: PG-3
+ - name: PG-1
+ priority: 1
- name: LB-P-1
+ hop_count_lower: true
+ loss_rate: 17
path_groups:
- - PG-3
- - PG-2
+ # checking priority 1 comes first
+ - name: PG-5
+ - name: PG-3
+ priority: 666
+ # Checking ordering for same priority
+ - name: PG-4
+ priority: 42
+ - name: PG-2
+ priority: 42
policies:
# Out of order to test sorting
- name: DPS-P-2
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md
index 1b3ffe99061..e11e2d5da3d 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/docs/tables/router-path-selection.md
@@ -37,9 +37,13 @@
| [ - <str>](## "router_path_selection.path_groups.[].static_peers.[].ipv4_addresses.[]") | String | | | | |
| [ load_balance_policies](## "router_path_selection.load_balance_policies") | List, items: Dictionary | | | | |
| [ - name](## "router_path_selection.load_balance_policies.[].name") | String | Required, Unique | | | Load-balance policy name. |
+ | [ hop_count_lower](## "router_path_selection.load_balance_policies.[].hop_count_lower") | Boolean | | | | Prefer paths with lowest hop-count. |
+ | [ jitter](## "router_path_selection.load_balance_policies.[].jitter") | Integer | | | Min: 0
Max: 10000 | Jitter requirement for this load balance policy in milliseconds. |
| [ latency](## "router_path_selection.load_balance_policies.[].latency") | Integer | | | Min: 0
Max: 10000 | One way delay requirement for this load balance policy in milliseconds. |
- | [ path_groups](## "router_path_selection.load_balance_policies.[].path_groups") | List, items: String | | | | List of path-groups to use for this load balance policy. |
- | [ - <str>](## "router_path_selection.load_balance_policies.[].path_groups.[]") | String | | | | |
+ | [ loss_rate](## "router_path_selection.load_balance_policies.[].loss_rate") | String | | | Pattern: ^\d+(\.\d{1,2})?$ | Loss Rate requirement for this load balance policy in milliseconds. |
+ | [ path_groups](## "router_path_selection.load_balance_policies.[].path_groups") | List, items: Dictionary | | | | List of path-groups to use for this load balance policy. |
+ | [ - name](## "router_path_selection.load_balance_policies.[].path_groups.[].name") | String | Required, Unique | | | Path-group name |
+ | [ priority](## "router_path_selection.load_balance_policies.[].path_groups.[].priority") | Integer | | `1` | Min: 1
Max: 65535 | Priority for this path-group.
Default is 1 and not rendred in EOS cli. |
| [ policies](## "router_path_selection.policies") | List, items: Dictionary | | | | |
| [ - name](## "router_path_selection.policies.[].name") | String | Required, Unique | | | DPS policy name. |
| [ default_match](## "router_path_selection.policies.[].default_match") | Dictionary | | | | |
@@ -123,12 +127,27 @@
# Load-balance policy name.
- name:
+ # Prefer paths with lowest hop-count.
+ hop_count_lower:
+
+ # Jitter requirement for this load balance policy in milliseconds.
+ jitter:
+
# One way delay requirement for this load balance policy in milliseconds.
latency:
+ # Loss Rate requirement for this load balance policy in milliseconds.
+ loss_rate:
+
# List of path-groups to use for this load balance policy.
path_groups:
- -
+
+ # Path-group name
+ - name:
+
+ # Priority for this path-group.
+ # Default is 1 and not rendred in EOS cli.
+ priority:
policies:
# DPS policy name.
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json
index 14adf95d805..5c4568bb0a1 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.jsonschema.json
@@ -20619,6 +20619,18 @@
"description": "Load-balance policy name.",
"title": "Name"
},
+ "hop_count_lower": {
+ "type": "boolean",
+ "description": "Prefer paths with lowest hop-count.",
+ "title": "Hop Count Lower"
+ },
+ "jitter": {
+ "type": "integer",
+ "description": "Jitter requirement for this load balance policy in milliseconds.",
+ "minimum": 0,
+ "maximum": 10000,
+ "title": "Jitter"
+ },
"latency": {
"type": "integer",
"description": "One way delay requirement for this load balance policy in milliseconds.",
@@ -20626,11 +20638,39 @@
"maximum": 10000,
"title": "Latency"
},
+ "loss_rate": {
+ "type": "string",
+ "description": "Loss Rate requirement for this load balance policy in milliseconds.",
+ "pattern": "^\\d+(\\.\\d{1,2})?$",
+ "title": "Loss Rate"
+ },
"path_groups": {
"type": "array",
"description": "List of path-groups to use for this load balance policy.",
"items": {
- "type": "string"
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "Path-group name",
+ "title": "Name"
+ },
+ "priority": {
+ "type": "integer",
+ "description": "Priority for this path-group.\nDefault is 1 and not rendred in EOS cli.",
+ "minimum": 1,
+ "maximum": 65535,
+ "default": 1,
+ "title": "Priority"
+ }
+ },
+ "additionalProperties": false,
+ "patternProperties": {
+ "^_.+$": {}
+ },
+ "required": [
+ "name"
+ ]
},
"title": "Path Groups"
}
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml
index 8a88ab77f08..244b556a075 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/eos_cli_config_gen.schema.yml
@@ -11796,6 +11796,16 @@ keys:
name:
type: str
description: Load-balance policy name.
+ hop_count_lower:
+ type: bool
+ description: Prefer paths with lowest hop-count.
+ jitter:
+ type: int
+ description: Jitter requirement for this load balance policy in milliseconds.
+ convert_types:
+ - str
+ min: 0
+ max: 10000
latency:
type: int
description: One way delay requirement for this load balance policy
@@ -11804,11 +11814,33 @@ keys:
- str
min: 0
max: 10000
+ loss_rate:
+ type: str
+ description: Loss Rate requirement for this load balance policy in milliseconds.
+ convert_types:
+ - int
+ - float
+ pattern: ^\d+(\.\d{1,2})?$
path_groups:
type: list
+ primary_key: name
description: List of path-groups to use for this load balance policy.
items:
- type: str
+ type: dict
+ keys:
+ name:
+ type: str
+ description: Path-group name
+ priority:
+ type: int
+ description: 'Priority for this path-group.
+
+ Default is 1 and not rendred in EOS cli.'
+ convert_types:
+ - str
+ min: 1
+ max: 65535
+ default: 1
policies:
type: list
primary_key: name
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_path_selection.schema.yml b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_path_selection.schema.yml
index 42d4e8807c4..69caefa677b 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_path_selection.schema.yml
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/schemas/schema_fragments/router_path_selection.schema.yml
@@ -124,6 +124,16 @@ keys:
name:
type: str
description: Load-balance policy name.
+ hop_count_lower:
+ type: bool
+ description: Prefer paths with lowest hop-count.
+ jitter:
+ type: int
+ description: Jitter requirement for this load balance policy in milliseconds.
+ convert_types:
+ - str
+ min: 0
+ max: 10000
latency:
type: int
description: One way delay requirement for this load balance policy in milliseconds.
@@ -131,11 +141,33 @@ keys:
- str
min: 0
max: 10000
+ loss_rate:
+ type: str
+ description: Loss Rate requirement for this load balance policy in milliseconds.
+ convert_types:
+ - int
+ - float
+ pattern: "^\\d+(\\.\\d{1,2})?$"
path_groups:
type: list
+ primary_key: name
description: List of path-groups to use for this load balance policy.
items:
- type: str
+ type: dict
+ keys:
+ name:
+ type: str
+ description: Path-group name
+ priority:
+ type: int
+ description: |-
+ Priority for this path-group.
+ Default is 1 and not rendred in EOS cli.
+ convert_types:
+ - str
+ min: 1
+ max: 65535
+ default: 1
policies:
type: list
primary_key: name
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/router-path-selection.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/router-path-selection.j2
index c0fd0f02003..f6d00236bea 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/router-path-selection.j2
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/documentation/router-path-selection.j2
@@ -77,10 +77,26 @@
#### Load-balance policies
-| Policy name | Latency | Path group(s) |
-| ----------- | ------- | ------------- |
+| Policy name | Jitter (ms) | Latency (ms) | Loss Rate (%) | Path groups (priority) | Hop count lowest |
+| ----------- | ----------- | ------------ | ------------- | ---------------------- | ---------------- |
{% for load_balance_policy in router_path_selection.load_balance_policies | arista.avd.natural_sort('name') %}
-| {{ load_balance_policy.name }} | {{ load_balance_policy.latency | arista.avd.default("-") }} | {{ load_balance_policy.path_groups | arista.avd.natural_sort() | join("
") }} |
+{% set hop_count_lowest = load_balance_policy.hop_count_lowest | arista.avd.default(false) %}
+{% set jitter = load_balance_policy.jitter | arista.avd.default("-") %}
+{% 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([]) %}
+{% if path_group.priority is not arista.avd.defined %}
+{% do path_group.update({"priority": 1}) %}
+{% endif %}
+{% endfor %}
+{% for priority, entries in load_balance_policy.path_groups | groupby("priority") %}
+{% for entry in entries | arista.avd.natural_sort("name") %}
+{% do path_groups_list.append(entry.name ~ " (" ~ priority ~ ")") %}
+{% endfor %}
+{% endfor %}
+| {{ load_balance_policy.name }} | {{ jitter }} | {{ latency }} | {{ loss_rate }} | {{ path_groups_list | join("
") }} | {{ hop_count_lowest }} |
{% endfor %}
{% endif %}
{% if router_path_selection.policies is arista.avd.defined %}
diff --git a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-path-selection.j2 b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-path-selection.j2
index 48547b0f5b3..793acbee4dc 100644
--- a/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-path-selection.j2
+++ b/ansible_collections/arista/avd/roles/eos_cli_config_gen/templates/eos/router-path-selection.j2
@@ -78,11 +78,32 @@ router path-selection
{% for load_balance_policy in router_path_selection.load_balance_policies | arista.avd.natural_sort('name') %}
!
load-balance policy {{ load_balance_policy.name }}
+{% if load_balance_policy.hop_count_lower is arista.avd.defined(true) %}
+ hop count lower
+{% endif %}
+{% if load_balance_policy.jitter is arista.avd.defined %}
+ jitter {{ load_balance_policy.jitter }}
+{% endif %}
{% if load_balance_policy.latency is arista.avd.defined %}
latency {{ load_balance_policy.latency }}
{% endif %}
-{% for path_group_name in load_balance_policy.path_groups | arista.avd.default([]) %}
- path-group {{ path_group_name }}
+{% if load_balance_policy.loss_rate is arista.avd.defined %}
+ loss-rate {{ load_balance_policy.loss_rate }}
+{% endif %}
+{# 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([]) %}
+{% if path_group.priority is not arista.avd.defined %}
+{% do path_group.update({"priority": 1}) %}
+{% endif %}
+{% endfor %}
+{% for priority, entries in load_balance_policy.path_groups | groupby("priority") %}
+{% for entry in entries | arista.avd.natural_sort("name") %}
+{% set path_group_cli = "path-group " ~ entry.name %}
+{% if priority != 1 %}
+{% set path_group_cli = path_group_cli ~ " priority " ~ priority %}
+{% endif %}
+ {{ path_group_cli }}
+{% endfor %}
{% endfor %}
{% endfor %}
{# DPS policies #}