diff --git a/plugins/modules/ndo_l3_domain.py b/plugins/modules/ndo_l3_domain.py index 3fbd5a8d..dbe66777 100644 --- a/plugins/modules/ndo_l3_domain.py +++ b/plugins/modules/ndo_l3_domain.py @@ -158,6 +158,9 @@ def main(): match = get_l3_domain(mso_template, l3_domain_uuid, l3_domain) if l3_domain_uuid or l3_domain: if match: + if match.details.get("pool"): + match.details["pool_uuid"] = match.details.get("pool") + match.details["pool"] = mso_template.get_vlan_pool_name(match.details.get("pool")) mso.existing = mso.previous = copy.deepcopy(match.details) # Query a specific object elif match: mso.existing = match # Query all objects @@ -197,6 +200,10 @@ def main(): mso.sanitize(payload) + if module.check_mode: + mso.proposed["pool_uuid"] = payload["pool"] + mso.proposed["pool"] = pool + mso.existing = mso.proposed elif state == "absent": @@ -208,6 +215,9 @@ def main(): mso_template.template = mso.request(mso_template.template_path, method="PATCH", data=ops) match = get_l3_domain(mso_template, l3_domain_uuid, l3_domain) if match: + if match.details.get("pool"): + match.details["pool_uuid"] = match.details.get("pool") + match.details["pool"] = mso_template.get_vlan_pool_name(match.details.get("pool")) mso.existing = match.details # When the state is present else: mso.existing = {} # When the state is absent diff --git a/tests/integration/targets/ndo_l3_domain/tasks/main.yml b/tests/integration/targets/ndo_l3_domain/tasks/main.yml index d923d8b1..5cbabe41 100644 --- a/tests/integration/targets/ndo_l3_domain/tasks/main.yml +++ b/tests/integration/targets/ndo_l3_domain/tasks/main.yml @@ -83,20 +83,24 @@ - cm_create_new_l3_domain is changed - cm_create_new_l3_domain.previous == {} - cm_create_new_l3_domain.current.name == "ansible_test_l3_domain" - - cm_create_new_l3_domain.current.pool != "" + - cm_create_new_l3_domain.current.pool_uuid + - cm_create_new_l3_domain.current.pool == "ansible_test_vlan_pool_1" - nm_create_new_l3_domain is changed - nm_create_new_l3_domain.previous == {} - nm_create_new_l3_domain.current.name == "ansible_test_l3_domain" - - nm_create_new_l3_domain.current.pool != "" + - nm_create_new_l3_domain.current.pool_uuid != "" + - nm_create_new_l3_domain.current.pool == "ansible_test_vlan_pool_1" - nm_create_new_l3_domain_again is not changed - nm_create_new_l3_domain_again.previous.name == "ansible_test_l3_domain" - nm_create_new_l3_domain_again.previous.description == "" - nm_create_new_l3_domain_again.previous.uuid is defined - - nm_create_new_l3_domain_again.previous.pool != "" + - nm_create_new_l3_domain_again.previous.pool_uuid != "" + - nm_create_new_l3_domain_again.previous.pool == "ansible_test_vlan_pool_1" - nm_create_new_l3_domain_again.current.name == "ansible_test_l3_domain" - nm_create_new_l3_domain_again.current.description == "" - nm_create_new_l3_domain_again.current.uuid is defined - - nm_create_new_l3_domain_again.current.pool != "" + - nm_create_new_l3_domain_again.current.pool == "ansible_test_vlan_pool_1" + - nm_create_new_l3_domain_again.current.pool_uuid != "" # UPDATE @@ -147,6 +151,7 @@ cisco.mso.ndo_l3_domain: <<: *update_l3_domain_name pool: "" + output_level: debug register: nm_update_l3_domain_pool_remove - name: Assert l3 domain was updated @@ -156,11 +161,15 @@ - nm_update_l3_domain_name.previous.name == "ansible_test_l3_domain" - nm_update_l3_domain_name.current.name == "ansible_test_l3_domain_changed" - nm_update_l3_domain_pool is changed - - nm_update_l3_domain_pool.previous.pool != "" - - nm_update_l3_domain_pool.current.pool != "" + - nm_update_l3_domain_pool.previous.pool_uuid != "" + - nm_update_l3_domain_pool.previous.pool == "ansible_test_vlan_pool_1" + - nm_update_l3_domain_pool.current.pool_uuid != "" + - nm_update_l3_domain_pool.current.pool == "ansible_test_vlan_pool_2" - nm_update_l3_domain_pool_remove is changed - - nm_update_l3_domain_pool_remove.previous.pool != "" + - nm_update_l3_domain_pool_remove.previous.pool == "ansible_test_vlan_pool_2" + - nm_update_l3_domain_pool_remove.previous.pool_uuid != "" - nm_update_l3_domain_pool_remove.current.pool is not defined + - nm_update_l3_domain_pool_remove.current.pool_uuid is not defined # QUERY @@ -217,10 +226,12 @@ - cm_delete_l3_domain is changed - cm_delete_l3_domain.previous.name == 'ansible_test_l3_domain_changed' - cm_delete_l3_domain.previous.pool is not defined + - cm_delete_l3_domain.previous.pool_uuid is not defined - cm_delete_l3_domain.current == {} - nm_delete_l3_domain is changed - nm_delete_l3_domain.previous.name == 'ansible_test_l3_domain_changed' - nm_delete_l3_domain.previous.pool is not defined + - nm_delete_l3_domain.previous.pool_uuid is not defined - nm_delete_l3_domain.current == {} - nm_delete_l3_domain_again is not changed - nm_delete_l3_domain_again.previous == {}