Skip to content

Commit

Permalink
Feat(eos_cli_config_gen): Add jitter, loss_rate, update path-groups
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc committed Nov 13, 2023
1 parent e76400a commit 7113420
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ interface Management1

#### Load-balance policies

| Policy name | Latency | Path group(s) |
| ----------- | ------- | ------------- |
| LB-P-1 | - | PG-2<br>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)<br>PG-2 (42)<br>PG-4 (42)<br>PG-3 (666) | False |
| LB-P-2 | 666 | 42 | 42.42 | PG-1 (1)<br>PG-3 (1) | False |

#### DPS policies

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&lt;str&gt;</samp>](## "router_path_selection.path_groups.[].static_peers.[].ipv4_addresses.[]") | String | | | | |
| [<samp>&nbsp;&nbsp;load_balance_policies</samp>](## "router_path_selection.load_balance_policies") | List, items: Dictionary | | | | |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;name</samp>](## "router_path_selection.load_balance_policies.[].name") | String | Required, Unique | | | Load-balance policy name. |
| [<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;path_groups</samp>](## "router_path_selection.load_balance_policies.[].path_groups") | List, items: String | | | | List of path-groups to use for this load balance policy. |
| [<samp>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&lt;str&gt;</samp>](## "router_path_selection.load_balance_policies.[].path_groups.[]") | String | | | | |
| [<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;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;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 @@ -123,12 +127,27 @@
# Load-balance policy name.
- name: <str; required; unique>

# Prefer paths with lowest hop-count.
hop_count_lower: <bool>

# Jitter requirement for this load balance policy in milliseconds.
jitter: <int; 0-10000>

# 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: <str>

# List of path-groups to use for this load balance policy.
path_groups:
- <str>

# Path-group name
- name: <str; required; unique>

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

# DPS policy name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20619,18 +20619,58 @@
"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.",
"minimum": 0,
"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"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,50 @@ 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.
convert_types:
- 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("<br>") }} |
{% 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("<br>") }} | {{ hop_count_lowest }} |
{% endfor %}
{% endif %}
{% if router_path_selection.policies is arista.avd.defined %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 #}
Expand Down

0 comments on commit 7113420

Please sign in to comment.