Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds test for Router Interface idempotence
This patch adds a test to ensure router interface idempotence and updates the router interface resource class to handle the case when a router interface already exists when attempting to create an identical one. This patch also fixes a small bug in the router interface where it was using the "subnet_name" key where it should have been using a "subnet_id" key. This was causing the unintended behavior of never finding a matching port when checking for ports that may have already been created, so it always tried to create the port leading to conflicts.
- Loading branch information
Ryan Brady
committed
May 13, 2020
1 parent
af2bc6e
commit bd0c25c
Showing
3 changed files
with
64 additions
and
2 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
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
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,55 @@ | ||
### EXPORT IDEMPOTENCE ### | ||
|
||
- include_role: | ||
name: os_migrate.os_migrate.export_router_interfaces | ||
vars: | ||
export_routers_name_filter: | ||
- regex: '^osm_' | ||
|
||
- name: re-load resources for idempotency test | ||
set_fact: | ||
router_interface_resources_idem: "{{ (lookup('file', | ||
os_migrate_data_dir + | ||
'/router_interfaces.yml') | from_yaml) | ||
['resources'] }}" | ||
|
||
- name: verify that export file did not change | ||
assert: | ||
that: | ||
- router_interface_resources_idem == router_interface_resources | ||
fail_msg: | | ||
router_interface_resources_idem: | ||
{{ router_interface_resources_idem | to_nice_yaml }} | ||
router_interface_resources: | ||
{{ router_interface_resources | to_nice_yaml }} | ||
### IMPORT IDEMPOTENCE ### | ||
|
||
- name: look up osm_router dst cloud | ||
os_migrate.os_migrate.os_routers_info: | ||
auth: "{{ os_migrate_dst_auth }}" | ||
auth_type: "{{ os_migrate_dst_auth_type|default(omit) }}" | ||
region_name: "{{ os_migrate_dst_region_name|default(omit) }}" | ||
register: ri_import_idem_before | ||
|
||
- include_role: | ||
name: os_migrate.os_migrate.import_router_interfaces | ||
|
||
- name: look up osm_router in dst cloud again | ||
os_migrate.os_migrate.os_routers_info: | ||
auth: "{{ os_migrate_dst_auth }}" | ||
auth_type: "{{ os_migrate_dst_auth_type|default(omit) }}" | ||
region_name: "{{ os_migrate_dst_region_name|default(omit) }}" | ||
register: ri_import_idem_after | ||
|
||
- name: ensure updated_at for osm_router did not change | ||
assert: | ||
that: | ||
- ri_import_idem_before['openstack_routers'][0].updated_at != None | ||
- "ri_import_idem_before['openstack_routers'][0]['updated_at'] \ | ||
== ri_import_idem_after['openstack_routers'][0]['updated_at']" | ||
fail_msg: | | ||
ri_import_idem_before updated_at: | ||
{{ ri_import_idem_before['openstack_routers'][0].updated_at }} | ||
ri_import_idem_after updated_at: | ||
{{ ri_import_idem_after['openstack_routers'][0].updated_at }} |