From 7a9df570f4e87a32d58555ebc9aa771398095ca7 Mon Sep 17 00:00:00 2001 From: JchhatbarInfoblox Date: Fri, 13 Dec 2024 18:37:19 +0530 Subject: [PATCH] addressed review comments. --- changelogs/fragments/38-range.yml | 2 - changelogs/fragments/48-range.yml | 2 + meta/runtime.yml | 2 +- plugins/modules/b1_ipam_range.py | 2 +- .../targets/ipam_range/tasks/main.yml | 46 ++++++++++++------- 5 files changed, 34 insertions(+), 20 deletions(-) delete mode 100644 changelogs/fragments/38-range.yml create mode 100644 changelogs/fragments/48-range.yml diff --git a/changelogs/fragments/38-range.yml b/changelogs/fragments/38-range.yml deleted file mode 100644 index 77f4166..0000000 --- a/changelogs/fragments/38-range.yml +++ /dev/null @@ -1,2 +0,0 @@ -deprecated_features: - - b1_ipam_range - is deprecated in favor of `ipam_range`. \ No newline at end of file diff --git a/changelogs/fragments/48-range.yml b/changelogs/fragments/48-range.yml new file mode 100644 index 0000000..ede6c8d --- /dev/null +++ b/changelogs/fragments/48-range.yml @@ -0,0 +1,2 @@ +deprecated_features: + - b1_ipam_range - is deprecated in favor of `ipam_range`. diff --git a/meta/runtime.yml b/meta/runtime.yml index a022bd8..c67e1d7 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -71,4 +71,4 @@ plugin_routing: b1_ipam_range: deprecation: removal_version: 3.0.0 - warning_text: Use infoblox.bloxone.ipam_range instead. \ No newline at end of file + warning_text: Use infoblox.bloxone.ipam_range instead. diff --git a/plugins/modules/b1_ipam_range.py b/plugins/modules/b1_ipam_range.py index ea0e23a..75c9e3d 100644 --- a/plugins/modules/b1_ipam_range.py +++ b/plugins/modules/b1_ipam_range.py @@ -16,7 +16,7 @@ version_added: "1.0.1" deprecated: removed_in: "3.0.0" - why: "This module is being deprecated and will be removed in version 3.0.0." + why: "This module is being deprecated and will be removed in version 3.0.0. Use M(ipam_range) instead." alternative: "Use the M(ipam_range) module instead." description: - Create, Update and Delete the IPAM range on Infoblox BloxOne DDI. This module manages the IPAM IPAM range object using BloxOne REST APIs. diff --git a/tests/integration/targets/ipam_range/tasks/main.yml b/tests/integration/targets/ipam_range/tasks/main.yml index 989630c..d8c00e8 100644 --- a/tests/integration/targets/ipam_range/tasks/main.yml +++ b/tests/integration/targets/ipam_range/tasks/main.yml @@ -6,7 +6,6 @@ api_key: "{{ api_key }}" block: - # Create a random IP space name to avoid conflicts - ansible.builtin.set_fact: tag_value: "site-{{ 999999 | random | string }}" range_start: "10.0.0.1" @@ -184,7 +183,6 @@ - range_info.objects | length == 1 - range_info.objects[0].tags.location == tag_value - # Test case for creating a range with a name - name: "Create a Range with name" infoblox.bloxone.ipam_range: start: "{{ range_start }}" @@ -206,7 +204,6 @@ - range_info.objects | length == 1 - range_info.objects[0].name == "Test Range" - # Test case for creating a range with exclusion ranges - name: "Create a Range with exclusion ranges" infoblox.bloxone.ipam_range: start: "{{ range_start }}" @@ -233,7 +230,6 @@ - range_info.objects[0].exclusion_ranges[0].end == "10.0.0.20" - range_info.objects[0].exclusion_ranges[0].comment == "Exclude this range" - # Test case for creating a range with a threshold - name: "Create a Range with threshold" infoblox.bloxone.ipam_range: start: "{{ range_start }}" @@ -260,8 +256,31 @@ - range_info.objects[0].threshold.high == 90 - range_info.objects[0].threshold.low == 10 + - name: "Create a Range with inheritance sources" + infoblox.bloxone.ipam_range: + start: "{{ range_start }}" + end: "{{ range_end }}" + space: "{{ _ip_space.id }}" + inheritance_sources: + dhcp_options: + action: "block" + state: "present" + register: range + - name: Get information about the Range + infoblox.bloxone.ipam_range_info: + filters: + start: "{{ range_start }}" + end: "{{ range_end }}" + space: "{{ _ip_space.id }}" + register: range_info + - assert: + that: + - range is not failed + - range_info.objects | length == 1 + - range_info.objects[0].inheritance_sources.dhcp_options.action == "block" + + always: - # Cleanup if the test fails - name: "Delete a Range" infoblox.bloxone.ipam_range: start: "{{ range_start }}" @@ -269,15 +288,10 @@ space: "{{ _ip_space.id }}" state: "absent" - - name: "Delete Subnet" - infoblox.bloxone.ipam_subnet: - address: "10.0.0.0/24" - space: "{{ _ip_space.id }}" - state: "absent" - ignore_errors: true + - ansible.builtin.include_role: + name: "setup_subnet" + tasks_from: "cleanup.yml" - - name: "Delete IP Space" - infoblox.bloxone.ipam_ip_space: - name: "{{ name }}" - state: "absent" - ignore_errors: true + - ansible.builtin.include_role: + name: "setup_ip_space" + tasks_from: "cleanup.yml"