diff --git a/plugins/modules/ndo_dhcp_option_policy.py b/plugins/modules/ndo_dhcp_option_policy.py index 4e87f6871..8f8a1a83e 100644 --- a/plugins/modules/ndo_dhcp_option_policy.py +++ b/plugins/modules/ndo_dhcp_option_policy.py @@ -87,8 +87,9 @@ id: 1 data: data_1 state: present + register: create -- name: Query a dhcp option policy with template_name +- name: Query a dhcp option policy with name cisco.mso.ndo_dhcp_option_policy: host: mso_host username: admin @@ -98,6 +99,16 @@ state: query register: query_one +- name: Query a dhcp option policy with UUID + cisco.mso.ndo_dhcp_option_policy: + host: mso_host + username: admin + password: SomeSecretPassword + template: ansible_tenant_template + option_policy_uuid: '{{ create.current.uuid }}' + state: query + register: query_uuid + - name: Query all dhcp option policy in the template cisco.mso.ndo_dhcp_option_policy: host: mso_host @@ -173,7 +184,7 @@ def main(): path = "/tenantPolicyTemplate/template/dhcpOptionPolicies" existing_dhcp_option_policies = mso_template.template.get("tenantPolicyTemplate", {}).get("template", {}).get("dhcpOptionPolicies", []) - if option_policy: + if option_policy or option_policy_uuid: object_description = "DHCP Option Policy" if option_policy_uuid: match = mso_template.get_object_by_uuid(object_description, existing_dhcp_option_policies, option_policy_uuid) diff --git a/plugins/modules/ndo_dhcp_relay_policy.py b/plugins/modules/ndo_dhcp_relay_policy.py index 0d358cd94..919b8d101 100644 --- a/plugins/modules/ndo_dhcp_relay_policy.py +++ b/plugins/modules/ndo_dhcp_relay_policy.py @@ -113,8 +113,9 @@ epg: ansible_test_epg_1 ip: 1.1.1.1 state: present + register: create -- name: Query a dhcp relay policy with template_name +- name: Query a dhcp relay policy with name cisco.mso.ndo_dhcp_relay_policy: host: mso_host username: admin @@ -124,6 +125,16 @@ state: query register: query_one +- name: Query a dhcp relay policy with UUID + cisco.mso.ndo_dhcp_relay_policy: + host: mso_host + username: admin + password: SomeSecretPassword + template: ansible_tenant_template + relay_policy_uuid: '{{ create.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all dhcp relay policy in the template cisco.mso.ndo_dhcp_relay_policy: host: mso_host @@ -204,7 +215,7 @@ def main(): path = "/tenantPolicyTemplate/template/dhcpRelayPolicies" existing_dhcp_relay_policies = mso_template.template.get("tenantPolicyTemplate", {}).get("template", {}).get("dhcpRelayPolicies", []) - if relay_policy: + if relay_policy or relay_policy_uuid: object_description = "DHCP Relay Policy" if relay_policy_uuid: match = mso_template.get_object_by_uuid(object_description, existing_dhcp_relay_policies, relay_policy_uuid) diff --git a/plugins/modules/ndo_l3_domain.py b/plugins/modules/ndo_l3_domain.py index 9017f5e51..3a6566c4c 100644 --- a/plugins/modules/ndo_l3_domain.py +++ b/plugins/modules/ndo_l3_domain.py @@ -69,8 +69,9 @@ l3_domain: ansible_test_l3_domain pool: ansible_test_vlan_pool state: present + register: create -- name: Query a L3 domain with template_name +- name: Query a L3 domain with name cisco.mso.ndo_l3_domain: host: mso_host username: admin @@ -80,6 +81,16 @@ state: query register: query_one +- name: Query a L3 domain with UUID + cisco.mso.ndo_l3_domain: + host: mso_host + username: admin + password: SomeSecretPassword + template: ansible_tenant_template + l3_domain_uuid: '{{ create.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all L3 domains in the template cisco.mso.ndo_l3_domain: host: mso_host @@ -156,7 +167,7 @@ def main(): path = "/fabricPolicyTemplate/template/l3Domains" existing_l3_domains = mso_template.template.get("fabricPolicyTemplate", {}).get("template", {}).get("l3Domains", []) - if l3_domain: + if l3_domain or l3_domain_uuid: object_description = "L3 Domain" if l3_domain_uuid: match = mso_template.get_object_by_uuid(object_description, existing_l3_domains, l3_domain_uuid) diff --git a/plugins/modules/ndo_physical_domain.py b/plugins/modules/ndo_physical_domain.py index 2d49b6312..61ab38471 100644 --- a/plugins/modules/ndo_physical_domain.py +++ b/plugins/modules/ndo_physical_domain.py @@ -69,8 +69,9 @@ physical_domain: ansible_test_physical_domain pool: ansible_test_vlan_pool state: present + register: create -- name: Query a physical domain with template_name +- name: Query a physical domain with name cisco.mso.ndo_physical_domain: host: mso_host username: admin @@ -80,6 +81,16 @@ state: query register: query_one +- name: Query a physical domain with UUID + cisco.mso.ndo_physical_domain: + host: mso_host + username: admin + password: SomeSecretPassword + template: ansible_tenant_template + physical_domain_uuid: '{{ create.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all physical domains in the template cisco.mso.ndo_physical_domain: host: mso_host @@ -156,7 +167,7 @@ def main(): path = "/fabricPolicyTemplate/template/domains" existing_physical_domains = mso_template.template.get("fabricPolicyTemplate", {}).get("template", {}).get("domains", []) - if physical_domain: + if physical_domain or physical_domain_uuid: object_description = "Physical Domain" if physical_domain_uuid: match = mso_template.get_object_by_uuid(object_description, existing_physical_domains, physical_domain_uuid) diff --git a/plugins/modules/ndo_route_map_policy_multicast.py b/plugins/modules/ndo_route_map_policy_multicast.py index ec8362a0b..8df68db59 100644 --- a/plugins/modules/ndo_route_map_policy_multicast.py +++ b/plugins/modules/ndo_route_map_policy_multicast.py @@ -87,7 +87,7 @@ """ EXAMPLES = r""" -- name: Create a new multicast route map policy policy +- name: Create a new multicast route map policy cisco.mso.ndo_route_map_policy_multicast: host: mso_host username: admin @@ -101,8 +101,9 @@ rp: 1.1.1.2 action: permit state: present + register: create -- name: Query a multicast route map policy policy with template_name +- name: Query a multicast route map policy with name cisco.mso.ndo_route_map_policy_multicast: host: mso_host username: admin @@ -112,7 +113,17 @@ state: query register: query_one -- name: Query all multicast route map policy policy in the template +- name: Query a multicast route map policy with UUID + cisco.mso.ndo_route_map_policy_multicast: + host: mso_host + username: admin + password: SomeSecretPassword + template: ansible_tenant_template + route_map_policy_uuid: '{{ create.current.uuid }}' + state: query + register: query_with_uuid + +- name: Query all multicast route map policy in the template cisco.mso.ndo_route_map_policy_multicast: host: mso_host username: admin @@ -121,7 +132,7 @@ state: query register: query_all -- name: Delete a multicast route map policy policy +- name: Delete a multicast route map policy cisco.mso.ndo_route_map_policy_multicast: host: mso_host username: admin diff --git a/plugins/modules/ndo_synce_interface_policy.py b/plugins/modules/ndo_synce_interface_policy.py index ef99148ab..3ec6355f5 100644 --- a/plugins/modules/ndo_synce_interface_policy.py +++ b/plugins/modules/ndo_synce_interface_policy.py @@ -97,6 +97,7 @@ src_priority: 100 wait_to_restore: 5 state: present + register: create - name: Query a syncE interface policy with interface_policy name cisco.mso.ndo_synce_interface_policy: @@ -117,13 +118,13 @@ state: query register: query_all -- name: Query a syncE interface policy with interface_policy uuid +- name: Query a syncE interface policy with interface_policy UUID cisco.mso.ndo_synce_interface_policy: host: mso_host username: admin password: SomeSecretPassword template: ansible_fabric_policy_template - interface_policy_uuid: uuid + interface_policy_uuid: '{{ create.current.uuid }}' state: query register: query_one_by_uuid @@ -197,7 +198,7 @@ def main(): existing_interface_policies = mso_template.template.get("fabricPolicyTemplate", {}).get("template", {}).get("syncEthIntfPolicies", []) - if interface_policy: + if interface_policy or interface_policy_uuid: object_description = "SyncE Interface Policy" if interface_policy_uuid: match = mso_template.get_object_by_uuid(object_description, existing_interface_policies, interface_policy_uuid) diff --git a/plugins/modules/ndo_vlan_pool.py b/plugins/modules/ndo_vlan_pool.py index 20baa8866..324a8934a 100644 --- a/plugins/modules/ndo_vlan_pool.py +++ b/plugins/modules/ndo_vlan_pool.py @@ -87,8 +87,9 @@ - from_vlan: 300 to_vlan: 400 state: present + register: create -- name: Query a vlan pool with template_name +- name: Query a vlan pool with name cisco.mso.ndo_vlan_pool: host: mso_host username: admin @@ -98,6 +99,16 @@ state: query register: query_one +- name: Query a vlan pool with UUID + cisco.mso.ndo_vlan_pool: + host: mso_host + username: admin + password: SomeSecretPassword + template: ansible_tenant_template + vlan_pool_uuid: '{{ create.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all vlan pools in the template cisco.mso.ndo_vlan_pool: host: mso_host @@ -171,7 +182,7 @@ def main(): path = "/fabricPolicyTemplate/template/vlanPools" existing_vlan_pools = mso_template.template.get("fabricPolicyTemplate", {}).get("template", {}).get("vlanPools", []) - if vlan_pool: + if vlan_pool or vlan_pool_uuid: object_description = "VLAN Pool" if vlan_pool_uuid: match = mso_template.get_object_by_uuid(object_description, existing_vlan_pools, vlan_pool_uuid) diff --git a/tests/integration/targets/ndo_dhcp_option_policy/tasks/main.yml b/tests/integration/targets/ndo_dhcp_option_policy/tasks/main.yml index f472d0d04..13695a650 100644 --- a/tests/integration/targets/ndo_dhcp_option_policy/tasks/main.yml +++ b/tests/integration/targets/ndo_dhcp_option_policy/tasks/main.yml @@ -261,6 +261,14 @@ state: query register: query_one + - name: Query a dhcp option policy with uuid + cisco.mso.ndo_dhcp_option_policy: + <<: *mso_info + template: ansible_tenant_template + option_policy_uuid: '{{ query_one.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all dhcp option policy in the template cisco.mso.ndo_dhcp_option_policy: <<: *mso_info @@ -272,7 +280,9 @@ assert: that: - query_one is not changed - - query_one.current.name == "ansible_test_option_policy_2" + - query_with_uuid is not changed + - query_one.current.name == query_with_uuid.current.name == "ansible_test_option_policy_2" + - query_one.current.uuid == query_with_uuid.current.uuid - query_all is not changed - query_all.current | length == 2 diff --git a/tests/integration/targets/ndo_dhcp_relay_policy/tasks/main.yml b/tests/integration/targets/ndo_dhcp_relay_policy/tasks/main.yml index 3e7088c5e..0acb37b8f 100644 --- a/tests/integration/targets/ndo_dhcp_relay_policy/tasks/main.yml +++ b/tests/integration/targets/ndo_dhcp_relay_policy/tasks/main.yml @@ -351,6 +351,14 @@ state: query register: query_one + - name: Query a dhcp relay policy with uuid + cisco.mso.ndo_dhcp_relay_policy: + <<: *mso_info + template: ansible_tenant_template + relay_policy_uuid: "{{ query_one.current.uuid }}" + state: query + register: query_with_uuid + - name: Query all dhcp relay policy in the template cisco.mso.ndo_dhcp_relay_policy: <<: *mso_info @@ -362,7 +370,9 @@ assert: that: - query_one is not changed - - query_one.current.name == "ansible_test_relay_policy_2" + - query_with_uuid is not changed + - query_one.current.name == query_with_uuid.current.name =="ansible_test_relay_policy_2" + - query_one.current.uuid == query_with_uuid.current.uuid - query_all is not changed - query_all.current | length == 2 diff --git a/tests/integration/targets/ndo_l3_domain/tasks/main.yml b/tests/integration/targets/ndo_l3_domain/tasks/main.yml index 3ce01ed14..c110752ca 100644 --- a/tests/integration/targets/ndo_l3_domain/tasks/main.yml +++ b/tests/integration/targets/ndo_l3_domain/tasks/main.yml @@ -179,6 +179,14 @@ state: query register: query_one + - name: Query a l3 domain with UUID + cisco.mso.ndo_l3_domain: + <<: *mso_info + template: ansible_fabric_policy_template + l3_domain_uuid: '{{ query_one.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all l3 domain in the template cisco.mso.ndo_l3_domain: <<: *mso_info @@ -190,7 +198,9 @@ assert: that: - query_one is not changed - - query_one.current.name == "ansible_test_l3_domain_2" + - query_with_uuid is not changed + - query_one.current.name == query_with_uuid.current.name == "ansible_test_l3_domain_2" + - query_one.current.uuid == query_with_uuid.current.uuid - query_all is not changed - query_all.current | length == 2 diff --git a/tests/integration/targets/ndo_physical_domain/tasks/main.yml b/tests/integration/targets/ndo_physical_domain/tasks/main.yml index 3fb643afd..61041445f 100644 --- a/tests/integration/targets/ndo_physical_domain/tasks/main.yml +++ b/tests/integration/targets/ndo_physical_domain/tasks/main.yml @@ -179,6 +179,14 @@ state: query register: query_one + - name: Query a physical domain with uuid + cisco.mso.ndo_physical_domain: + <<: *mso_info + template: ansible_fabric_policy_template + physical_domain_uuid: '{{ query_one.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all physical domain in the template cisco.mso.ndo_physical_domain: <<: *mso_info @@ -190,7 +198,9 @@ assert: that: - query_one is not changed - - query_one.current.name == "ansible_test_physical_domain_2" + - query_with_uuid is not changed + - query_one.current.name == query_with_uuid.current.name == "ansible_test_physical_domain_2" + - query_one.current.uuid == query_with_uuid.current.uuid - query_all is not changed - query_all.current | length == 2 diff --git a/tests/integration/targets/ndo_route_map_policy_multicast/tasks/main.yml b/tests/integration/targets/ndo_route_map_policy_multicast/tasks/main.yml index f36f1e3d7..b1c32b203 100644 --- a/tests/integration/targets/ndo_route_map_policy_multicast/tasks/main.yml +++ b/tests/integration/targets/ndo_route_map_policy_multicast/tasks/main.yml @@ -300,6 +300,14 @@ state: query register: query_one + - name: Query a route map policy multicast with uuid + cisco.mso.ndo_route_map_policy_multicast: + <<: *mso_info + template: ansible_tenant_template + route_map_policy_uuid: '{{ query_one.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all route map policy multicast in the template cisco.mso.ndo_route_map_policy_multicast: <<: *mso_info @@ -311,7 +319,9 @@ assert: that: - query_one is not changed - - query_one.current.name == "ansible_test_route_map_policy_2" + - query_with_uuid is not changed + - query_one.current.name == query_with_uuid.current.name == "ansible_test_route_map_policy_2" + - query_one.current.uuid == query_with_uuid.current.uuid - query_all is not changed - query_all.current | length == 2 diff --git a/tests/integration/targets/ndo_synce_interface_policy/tasks/main.yml b/tests/integration/targets/ndo_synce_interface_policy/tasks/main.yml index e0e3a1db0..9863bf453 100644 --- a/tests/integration/targets/ndo_synce_interface_policy/tasks/main.yml +++ b/tests/integration/targets/ndo_synce_interface_policy/tasks/main.yml @@ -199,7 +199,6 @@ <<: *mso_info template: ansible_fabric_policy_template interface_policy_uuid: '{{ nm_update_synce_interface_policy.current.uuid }}' - interface_policy: ansible_test_synce_interface_policy_changed state: query register: query_one_uuid diff --git a/tests/integration/targets/ndo_vlan_pool/tasks/main.yml b/tests/integration/targets/ndo_vlan_pool/tasks/main.yml index 184f3ff50..15023bc59 100644 --- a/tests/integration/targets/ndo_vlan_pool/tasks/main.yml +++ b/tests/integration/targets/ndo_vlan_pool/tasks/main.yml @@ -225,6 +225,14 @@ state: query register: query_one + - name: Query a vlan pool with uuid + cisco.mso.ndo_vlan_pool: + <<: *mso_info + template: ansible_fabric_policy_template + vlan_pool_uuid: '{{ query_one.current.uuid }}' + state: query + register: query_with_uuid + - name: Query all vlan pool in the template cisco.mso.ndo_vlan_pool: <<: *mso_info @@ -236,7 +244,9 @@ assert: that: - query_one is not changed - - query_one.current.name == "ansible_test_vlan_pool_2" + - query_with_uuid is not changed + - query_one.current.name == query_with_uuid.current.name == "ansible_test_vlan_pool_2" + - query_one.current.uuid == query_with_uuid.current.uuid - query_all is not changed - query_all.current | length == 2