-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c0545e
commit 4a21ac1
Showing
8 changed files
with
391 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
tests/integration/targets/ios_vrf_interfaces/tests/common/deleted.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
- ansible.builtin.debug: | ||
msg: Start Deleted integration state for ios_vrf_interfaces ansible_connection={{ ansible_connection }} | ||
|
||
- ansible.builtin.include_tasks: _remove_config.yaml | ||
- ansible.builtin.include_tasks: _populate_config.yaml | ||
|
||
- block: | ||
- name: Delete provided VRF interfaces | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: &id001 | ||
config: | ||
- name: GigabitEthernet2 | ||
state: deleted | ||
|
||
- name: Assert that correct set of commands were generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ deleted['commands'] | symmetric_difference(result['commands']) | length == 0 }}" | ||
|
||
- name: Delete provided VRF interfaces (idempotent) | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: *id001 | ||
- name: Assert that the previous task was idempotent | ||
ansible.builtin.assert: | ||
that: | ||
- result.changed == false | ||
|
||
- ansible.builtin.include_tasks: _populate_config.yaml | ||
|
||
- name: Delete provided VRF interfaces without any configuration | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: &id002 | ||
state: deleted | ||
|
||
- name: Assert that correct set of commands were generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ deleted['commands'] | symmetric_difference(result['commands']) | length == 0 }}" | ||
|
||
- name: Delete provided VRF interfaces without any configuration (idempotent) | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: *id002 | ||
- name: Assert that the delete task was idempotent | ||
ansible.builtin.assert: | ||
that: | ||
- result.changed == false | ||
|
||
always: | ||
- ansible.builtin.include_tasks: _remove_config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 21 additions & 12 deletions
33
tests/integration/targets/ios_vrf_interfaces/tests/common/merged.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
--- | ||
- ansible.builtin.debug: | ||
msg: Start ios_vrf_interfaces merged integration tests connection={{ ansible_connection}} | ||
msg: START Merged ios_vrf_interfaces state for integration tests on connection={{ ansible_connection }} | ||
|
||
- ansible.builtin.include_tasks: _remove_config.yaml | ||
|
||
- block: | ||
- name: Simple merge selective | ||
cisco.ios.ios_vrf_interfaces: | ||
state: merged | ||
- name: Merge provided configuration with device configuration | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: &id001 | ||
config: | ||
- name: GigabitEthernet1 | ||
- name: GigabitEthernet2 | ||
vrf_name: vrf_D | ||
- name: GigabitEthernet3 | ||
- name: GigabitEthernet4 | ||
state: merged | ||
|
||
register: result | ||
- name: Assert that correct set of commands were generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ merged['commands'] | symmetric_difference(result['commands']) | length == 0 }}" | ||
|
||
- name: Run show running-config | section ^interface | ||
cisco.ios.ios_command: | ||
commands: show running-config | section ^interface | ||
- name: Assert that before dicts are correctly generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ merged['before'] | symmetric_difference(result['before']) | length == 0 }}" | ||
|
||
- name: Assert that correct set of commands were generated | ||
- name: Assert that after dict is correctly generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" | ||
- "{{ merged['after'] | symmetric_difference(result['after']) | length == 0 }}" | ||
|
||
- name: Merge provided configuration with device configuration (idempotent) | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: *id001 | ||
|
||
- name: Assert that after dicts were correctly generated | ||
- name: Assert that the previous task was idempotent | ||
ansible.builtin.assert: | ||
that: | ||
- merged['after'] == result['after'] | ||
- result['changed'] == false | ||
|
||
always: | ||
- ansible.builtin.include_tasks: _remove_config.yaml |
31 changes: 18 additions & 13 deletions
31
tests/integration/targets/ios_vrf_interfaces/tests/common/overridden.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,44 @@ | ||
--- | ||
- ansible.builtin.debug: | ||
msg: Start ios_vrf_interfaces overridden integration tests connection={{ ansible_connection}} | ||
msg: START Overridden ios_vrf_interfaces state for integration tests on connection={{ ansible_connection }} | ||
|
||
- ansible.builtin.include_tasks: _populate_config.yaml | ||
|
||
- block: | ||
- name: Override the route-policy configuration | ||
cisco.ios.ios_vrf_interfaces: | ||
state: overridden | ||
- name: Override provided configuration with device configuration | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: &id001 | ||
config: | ||
- name: GigabitEthernet1 | ||
- name: GigabitEthernet2 | ||
- name: GigabitEthernet3 | ||
- name: GigabitEthernet4 | ||
vrf_name: vrf_C | ||
|
||
register: result | ||
|
||
- name: Run show running-config | section ^interface | ||
cisco.ios.ios_command: | ||
commands: show running-config | section ^interface | ||
state: overridden | ||
|
||
- name: Assert that correct set of commands were generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" | ||
- "{{ overridden['commands'] | symmetric_difference(result['commands']) | length == 0 }}" | ||
|
||
- name: Assert that before dicts are correctly generated | ||
ansible.builtin.assert: | ||
that: | ||
- overridden['before'] == result['before'] | ||
|
||
- name: Assert that after dict is correctly generated | ||
ansible.builtin.assert: | ||
that: | ||
- overridden['after'] == result['after'] | ||
|
||
- name: Assert that before dicts are correctly generated | ||
- name: Override provided configuration with device configuration (idempotent) | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: *id001 | ||
|
||
- name: Assert that the previous task was idempotent | ||
ansible.builtin.assert: | ||
that: | ||
- overridden['before'] == result['before'] | ||
- result['changed'] == false | ||
|
||
always: | ||
- ansible.builtin.include_tasks: _remove_config.yaml |
42 changes: 42 additions & 0 deletions
42
tests/integration/targets/ios_vrf_interfaces/tests/common/replaced.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
- ansible.builtin.debug: | ||
msg: START Replaced ios_vrf_interfaces state for integration tests on connection={{ ansible_connection }} | ||
|
||
- ansible.builtin.include_tasks: _remove_config.yaml | ||
- ansible.builtin.include_tasks: _populate_config.yaml | ||
|
||
- block: | ||
- name: Replace provided VRF interfaces configuration | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: &id001 | ||
config: | ||
- name: GigabitEthernet2 | ||
vrf_name: vrf_D | ||
state: replaced | ||
|
||
- name: Assert that correct set of commands were generated | ||
ansible.builtin.assert: | ||
that: | ||
- "{{ replaced['commands'] | symmetric_difference(result['commands']) | length == 0 }}" | ||
|
||
- name: Assert that before dicts are correctly generated | ||
ansible.builtin.assert: | ||
that: | ||
- replaced['before'] == result['before'] | ||
|
||
- name: Assert that after dict is correctly generated | ||
ansible.builtin.assert: | ||
that: | ||
- replaced['after'] == result['after'] | ||
|
||
- name: Replace provided VRF interfaces configuration (idempotent) | ||
register: result | ||
cisco.ios.ios_vrf_interfaces: *id001 | ||
|
||
- name: Assert that task was idempotent | ||
ansible.builtin.assert: | ||
that: | ||
- result['changed'] == false | ||
|
||
always: | ||
- ansible.builtin.include_tasks: _remove_config.yaml |
Oops, something went wrong.