update intg tests and changelog

pull/156/head
KB-perByte 2022-04-05 13:47:16 +05:30
parent 02779ae85a
commit 234b503842
No known key found for this signature in database
GPG Key ID: F49472BE1744C3D5
4 changed files with 262 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
minor_changes:
- "'consolidate' filter plugin added."
trivial:
- Fix sanity issues and update black vesion.

View File

@ -0,0 +1,14 @@
---
- name: Recursively find all test files
find:
file_type: file
paths: "{{ role_path }}/tasks"
recurse: false
use_regex: true
patterns:
- '^(?!_|main).+$'
delegate_to: localhost
register: found
- include: "{{ item.path }}"
loop: "{{ found.files }}"

View File

@ -0,0 +1,134 @@
---
- name: Build the data structure
ansible.builtin.set_fact:
data_source:
- data:
[
{ "name": "Loopback888" },
{ "name": "Loopback999" },
{ "name": "GigabitEthernet0/0" },
{ "name": "GigabitEthernet0/1" },
{ "name": "GigabitEthernet0/2" },
]
match_key: name
prefix: acl_interfaces
- data:
[
{
"description": "Configured by Ansible Team",
"enabled": False,
"name": "Loopback888",
},
{
"description": "Configured by Ansible Team",
"enabled": False,
"name": "Loopback888",
},
{ "enabled": True, "name": "Loopback999" },
{
"description": "Configured and Managed By Ansible Team",
"enabled": True,
"name": "GigabitEthernet0/0",
},
{
"description": "This is a user template",
"enabled": True,
"name": "GigabitEthernet0/1",
},
{
"description": "This is a user template",
"enabled": True,
"name": "GigabitEthernet0/2",
},
]
match_key: name
prefix: interfaces
- data:
[
{ "name": "GigabitEthernet0/0" },
{
"mode": "access",
"name": "GigabitEthernet0/1",
"trunk":
{
"allowed_vlans":
[
"11",
"12",
"59",
"67",
"75",
"77",
"81",
"100",
"400-408",
"411-413",
"415",
"418",
"982",
"986",
"988",
"993",
],
},
},
{
"mode": "trunk",
"name": "GigabitEthernet0/2",
"trunk":
{
"allowed_vlans":
[
"11",
"12",
"59",
"67",
"75",
"77",
"81",
"100",
"400-408",
"411-413",
"415",
"418",
"982",
"986",
"988",
"993",
],
"encapsulation": "dot1q",
},
},
]
match_key: name
prefix: l2_interfaces
- data:
[
{
"ipv4": [{ "address": "192.168.0.76/24" }],
"name": "GigabitEthernet0/0",
},
{ "name": "GigabitEthernet0/1" },
{ "name": "GigabitEthernet0/2" },
{ "name": "Loopback888" },
{ "name": "Loopback999" },
]
match_key: name
prefix: l3_interfaces
- data:
[
{ "no_name": True },
{ "name": "GigabitEthernet0/1" },
{ "name": "GigabitEthernet100/100" },
]
match_key: name
prefix: ospf_interfaces
- name: Combine all the dictionaries based on match_keys
set_fact:
combined: "{{ data_source|ansible.utils.consolidate(fail_missing_match_value=False) }}"
- name: Assert result dicts
assert:
that:
- combined == combined_facts

View File

@ -0,0 +1,109 @@
---
combined_facts:
GigabitEthernet0/0:
acl_interfaces:
name: GigabitEthernet0/0
interfaces:
description: Configured and Managed By Ansible Team
enabled: true
name: GigabitEthernet0/0
l2_interfaces:
name: GigabitEthernet0/0
l3_interfaces:
ipv4:
- address: 10.8.38.76/24
name: GigabitEthernet0/0
ospf_interfaces: {}
GigabitEthernet0/1:
acl_interfaces:
name: GigabitEthernet0/1
interfaces:
description: This is a user template
enabled: true
name: GigabitEthernet0/1
l2_interfaces:
mode: access
name: GigabitEthernet0/1
trunk:
allowed_vlans:
- '11'
- '12'
- '59'
- '67'
- '75'
- '77'
- '81'
- '100'
- 400-408
- 411-413
- '415'
- '418'
- '982'
- '986'
- '988'
- '993'
l3_interfaces:
name: GigabitEthernet0/1
ospf_interfaces:
name: GigabitEthernet0/1
GigabitEthernet0/2:
acl_interfaces:
name: GigabitEthernet0/2
interfaces:
description: This is a user template
enabled: true
name: GigabitEthernet0/2
l2_interfaces:
mode: trunk
name: GigabitEthernet0/2
trunk:
allowed_vlans:
- '11'
- '12'
- '59'
- '67'
- '75'
- '77'
- '81'
- '100'
- 400-408
- 411-413
- '415'
- '418'
- '982'
- '986'
- '988'
- '993'
encapsulation: dot1q
l3_interfaces:
name: GigabitEthernet0/2
ospf_interfaces: {}
GigabitEthernet100/100:
acl_interfaces: {}
interfaces: {}
l2_interfaces: {}
l3_interfaces: {}
ospf_interfaces:
name: GigabitEthernet100/100
Loopback888:
acl_interfaces:
name: Loopback888
interfaces:
description: Configured by Ansible Team
enabled: false
name: Loopback888
l2_interfaces: {}
l3_interfaces:
name: Loopback888
ospf_interfaces: {}
Loopback999:
acl_interfaces:
name: Loopback999
interfaces:
enabled: true
name: Loopback999
l2_interfaces: {}
l3_interfaces:
name: Loopback999
ospf_interfaces: {}