diff --git a/plugins/modules/ndo_dhcp_option_policy.py b/plugins/modules/ndo_dhcp_option_policy.py index 4e87f6871..ea9140b65 100644 --- a/plugins/modules/ndo_dhcp_option_policy.py +++ b/plugins/modules/ndo_dhcp_option_policy.py @@ -88,7 +88,7 @@ data: data_1 state: present -- 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 +98,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: '{{ query_one.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 +183,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..5f027dffb 100644 --- a/plugins/modules/ndo_dhcp_relay_policy.py +++ b/plugins/modules/ndo_dhcp_relay_policy.py @@ -114,7 +114,7 @@ ip: 1.1.1.1 state: present -- 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 +124,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: '{{ 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: host: mso_host @@ -204,7 +214,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..a274a4263 100644 --- a/plugins/modules/ndo_l3_domain.py +++ b/plugins/modules/ndo_l3_domain.py @@ -70,7 +70,7 @@ pool: ansible_test_vlan_pool state: present -- 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 +80,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: '{{ query_one.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 +166,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..789a512c0 100644 --- a/plugins/modules/ndo_physical_domain.py +++ b/plugins/modules/ndo_physical_domain.py @@ -70,7 +70,7 @@ pool: ansible_test_vlan_pool state: present -- 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 +80,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: '{{ query_one.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 +166,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 7e812e4ca..1c7ec0c81 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 @@ -102,7 +102,7 @@ action: permit state: present -- 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 +112,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: '{{ query_one.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 +131,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 @@ -189,7 +199,7 @@ def main(): path = "/tenantPolicyTemplate/template/mcastRouteMapPolicies" existing_route_map_policies = mso_template.template.get("tenantPolicyTemplate", {}).get("template", {}).get("mcastRouteMapPolicies", []) - if route_map_policy: + if route_map_policy or route_map_policy_uuid: object_description = "Multicast Route Map Policy" if route_map_policy_uuid: match = mso_template.get_object_by_uuid(object_description, existing_route_map_policies, route_map_policy_uuid) diff --git a/plugins/modules/ndo_synce_interface_policy.py b/plugins/modules/ndo_synce_interface_policy.py index ef99148ab..9ebaef0f0 100644 --- a/plugins/modules/ndo_synce_interface_policy.py +++ b/plugins/modules/ndo_synce_interface_policy.py @@ -123,7 +123,7 @@ username: admin password: SomeSecretPassword template: ansible_fabric_policy_template - interface_policy_uuid: uuid + interface_policy_uuid: '{{ query_one.current.uuid }}' state: query register: query_one_by_uuid @@ -197,7 +197,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..b59be1aed 100644 --- a/plugins/modules/ndo_vlan_pool.py +++ b/plugins/modules/ndo_vlan_pool.py @@ -88,7 +88,7 @@ to_vlan: 400 state: present -- 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 +98,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: '{{ query_one.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 +181,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 1199fb3c4..6808413a7 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 @@ -297,6 +297,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 @@ -308,7 +316,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