Skip to content

Commit

Permalink
Refactor: Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc committed Nov 13, 2023
1 parent 4fea66b commit 4ce6c34
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ router path-selection
jitter 666
latency 42
loss-rate 42.42
path-group PG-1
path-group PG-1 priority 1
path-group PG-3
!
policy DPS-P-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ router path-selection
jitter 666
latency 42
loss-rate 42.42
path-group PG-1
path-group PG-1 priority 1
path-group PG-3
!
policy DPS-P-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hop_count_lower</samp>](## "router_path_selection.load_balance_policies.[].hop_count_lower") | Boolean | | | | Prefer paths with lowest hop-count. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;jitter</samp>](## "router_path_selection.load_balance_policies.[].jitter") | Integer | | | Min: 0<br>Max: 10000 | Jitter requirement for this load balance policy in milliseconds. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latency</samp>](## "router_path_selection.load_balance_policies.[].latency") | Integer | | | Min: 0<br>Max: 10000 | One way delay requirement for this load balance policy in milliseconds. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loss_rate</samp>](## "router_path_selection.load_balance_policies.[].loss_rate") | String | | | Pattern: ^\d+(\.\d{1,2})?$ | Loss Rate requirement for this load balance policy in milliseconds. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loss_rate</samp>](## "router_path_selection.load_balance_policies.[].loss_rate") | String | | | Pattern: ^\d+(\.\d{1,2})?$ | Loss Rate requirement in percentage for this load balance policy.<br>Value between 0.00 and 100.00 % |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;path_groups</samp>](## "router_path_selection.load_balance_policies.[].path_groups") | List, items: Dictionary | | | | List of path-groups to use for this load balance policy. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;name</samp>](## "router_path_selection.load_balance_policies.[].path_groups.[].name") | String | Required, Unique | | | Path-group name |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;priority</samp>](## "router_path_selection.load_balance_policies.[].path_groups.[].priority") | Integer | | `1` | Min: 1<br>Max: 65535 | Priority for this path-group.<br>Default is 1 and not rendred in EOS cli. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;priority</samp>](## "router_path_selection.load_balance_policies.[].path_groups.[].priority") | Integer | | | Min: 1<br>Max: 65535 | Priority for this path-group.<br>The EOS default value is 1. |
| [<samp>&nbsp;&nbsp;policies</samp>](## "router_path_selection.policies") | List, items: Dictionary | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;name</samp>](## "router_path_selection.policies.[].name") | String | Required, Unique | | | DPS policy name. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default_match</samp>](## "router_path_selection.policies.[].default_match") | Dictionary | | | | |
Expand Down Expand Up @@ -136,7 +136,8 @@
# One way delay requirement for this load balance policy in milliseconds.
latency: <int; 0-10000>

# Loss Rate requirement for this load balance policy in milliseconds.
# Loss Rate requirement in percentage for this load balance policy.
# Value between 0.00 and 100.00 %
loss_rate: <str>

# List of path-groups to use for this load balance policy.
Expand All @@ -146,8 +147,8 @@
- name: <str; required; unique>

# Priority for this path-group.
# Default is 1 and not rendred in EOS cli.
priority: <int; 1-65535; default=1>
# The EOS default value is 1.
priority: <int; 1-65535>
policies:

# DPS policy name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20662,7 +20662,7 @@
},
"loss_rate": {
"type": "string",
"description": "Loss Rate requirement for this load balance policy in milliseconds.",
"description": "Loss Rate requirement in percentage for this load balance policy.\nValue between 0.00 and 100.00 %",
"pattern": "^\\d+(\\.\\d{1,2})?$",
"title": "Loss Rate"
},
Expand All @@ -20679,10 +20679,9 @@
},
"priority": {
"type": "integer",
"description": "Priority for this path-group.\nDefault is 1 and not rendred in EOS cli.",
"description": "Priority for this path-group.\nThe EOS default value is 1.",
"minimum": 1,
"maximum": 65535,
"default": 1,
"title": "Priority"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11844,7 +11844,10 @@ keys:
max: 10000
loss_rate:
type: str
description: Loss Rate requirement for this load balance policy in milliseconds.
description: 'Loss Rate requirement in percentage for this load balance
policy.
Value between 0.00 and 100.00 %'
convert_types:
- int
- float
Expand All @@ -11863,12 +11866,11 @@ keys:
type: int
description: 'Priority for this path-group.
Default is 1 and not rendred in EOS cli.'
The EOS default value is 1.'
convert_types:
- str
min: 1
max: 65535
default: 1
policies:
type: list
primary_key: name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ keys:
max: 10000
loss_rate:
type: str
description: Loss Rate requirement for this load balance policy in milliseconds.
description: |-
Loss Rate requirement in percentage for this load balance policy.
Value between 0.00 and 100.00 %
convert_types:
- int
- float
Expand All @@ -162,12 +164,11 @@ keys:
type: int
description: |-
Priority for this path-group.
Default is 1 and not rendred in EOS cli.
The EOS default value is 1.
convert_types:
- str
min: 1
max: 65535
default: 1
policies:
type: list
primary_key: name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,13 @@ router path-selection
{% 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 %}
{% 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 | 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 %}
{% if entry.priority is arista.avd.defined %}
{% set path_group_cli = path_group_cli ~ " priority " ~ entry.priority %}
{% endif %}
{{ path_group_cli }}
{% endfor %}
Expand Down

0 comments on commit 4ce6c34

Please sign in to comment.