Skip to content

Commit

Permalink
Cut(eos_cli_config_gen): Remove automatic conversion of dict-of-dicts…
Browse files Browse the repository at this point in the history
… to lists (#4320)
  • Loading branch information
ClausHolbechArista authored Aug 6, 2024
1 parent 2fdd730 commit 2f5e228
Show file tree
Hide file tree
Showing 126 changed files with 115 additions and 4,191 deletions.
99 changes: 98 additions & 1 deletion ansible_collections/arista/avd/docs/porting-guides/5.x.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,34 @@ built into `eos_designs`.

### Data model changes from "dict-of-dicts" to "list-of-dicts"

TODO: Removed type conversion
In AVD 4.0.0 and across both `eos_designs` and `eos_cli_config_gen`, *all* "dict-of-dicts" data models with user-defined keys were changed to "list-of-dicts".
In AVD 4.x inputs were auto-converted to the new data models.

As of AVD 5.0.0 the automatic conversion from dict-of-dicts has been removed, so it is required to update the input data to the new data models.

Errors will be raised for each data model not conforming to the list type when running AVD:

```sh
$ ansible-playbook playbook.yml
<...>
ERROR! [host1]: 'Validation Error: access_lists': {'ACL-01': {'sequence_numbers': {10: {'actio<...abbreviated...>4 any'}}}} is not of type 'list'
```

As an example, `ethernet_interfaces` was changed from:

```yaml
ethernet_intefaces:
Ethernet1: # <-- User defined key
<...>
```
to:
```yaml
ethernet_interfaces:
- name: Ethernet1 # <-- "name" here is called the "primary_key" which must have a unique value across all list elements
<...>
```
## Removal of Ansible plugins
Expand Down Expand Up @@ -66,6 +93,76 @@ The following data model keys have been removed from `eos_designs` in v5.0.0.

TODO: Level 3 sections for each change with details on how to migrate

### No auto-conversion of old data model for `router_bgp.redistribute_routes` and `router_bgp.vrfs[].redistribute_routes`

The change has been incorporated into `eos_designs`, so action is only required when defining new interfaces
with `structured_config`, `custom_structured_configuration_`, or when using `eos_cli_config_gen` directly.

The data models for `router_bgp.redistribute_routes` and `router_bgp.vrfs[].redistribute_routes` previously supported either a list of strings or a dict-of-dicts.
In AVD 4.0.0 this was changed to a list-of-dicts with automatic conversion from any of the previous models into the new model.

As of AVD 5.0.0 the automatic conversion from both of the previous models has been removed, so it is required to update the input data to the new data models.

=== "Old data models"

```yaml
# Old list data model
router_bgp:
redistribute_routes:
- connected
- static
vrfs:
- name: test
redistribute_routes:
- connected
- static
# Old dict-of-dicts data model
router_bgp:
redistribute_routes:
connected:
route_map: connected-to-bgp
static:
route_map: static-to-bgp
vrfs:
- name: test
redistribute_routes:
connected:
route_map: connected-to-bgp
static:
route_map: static-to-bgp
```

=== "New data model"

```yaml
# New data model
router_bgp:
redistribute_routes:
- source_procol: connected
- source_protocol: static
vrfs:
- name: test
redistribute_routes:
- source_procol: connected
- source_protocol: static
# New data model
router_bgp:
redistribute_routes:
- source_protocol: connected
route_map: connected-to-bgp
- source_protocol: static
route_map: static-to-bgp
vrfs:
- name: test
redistribute_routes:
- source_protocol: connected
route_map: connected-to-bgp
- source_protocol: static
route_map: static-to-bgp
```

### Removal of deprecated data models

The following data model keys have been removed from `eos_cli_config_gen` in v5.0.0.
Expand Down
16 changes: 15 additions & 1 deletion ansible_collections/arista/avd/docs/release-notes/5.x.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ See the [porting guide](../porting-guides/5.x.x.md#removal-of-ansible-plugins) f

### Data model changes from "dict-of-dicts" to "list-of-dicts"

TODO: Removed type conversion
In AVD 4.0.0 and across both `eos_designs` and `eos_cli_config_gen`, *all* "dict-of-dicts" data models with user-defined keys were changed to "list-of-dicts".
In AVD 4.x inputs were auto-converted to the new data models.

As of AVD 5.0.0 the automatic conversion from dict-of-dicts has been removed, so it is required to update the input data to the new data models.

See the [porting guide](../porting-guides/5.x.x.md#data-model-changes-from-dict-of-dicts-to-list-of-dicts) for details.

### All eos_designs and eos_cli_config_gen variables are always validated by schemas

Expand All @@ -55,6 +60,15 @@ for details.

TODO: add level4 sections for breaking changes outlining the change and referring to porting guide for migration.

#### No auto-conversion of old data model for `router_bgp.redistribute_routes` and `router_bgp.vrfs[].redistribute_routes`

The data models for `router_bgp.redistribute_routes` and `router_bgp.vrfs[].redistribute_routes` previously supported either a list of strings or a dict-of-dicts.
In 4.0.0 this was changed to a list-of-dicts with automatic conversion from any of the previous models into the new model.

As of AVD 5.0.0 the automatic conversion from both of the previous models has been removed, so it is required to update the input data to the new data models.

See the [porting guide](../porting-guides/5.x.x.md#no-auto-conversion-of-old-data-model-for-router_bgpredistribute_routes-and-router_bgpvrfsredistribute_routes) for details.

#### Removal of schema in JSON format

The `eos_cli_config_gen.jsonschema.json` is no longer generated. This schema was not being used and had never been complete.
Expand Down
Loading

0 comments on commit 2f5e228

Please sign in to comment.