diff --git a/plugins/modules/ipam_address_block.py b/plugins/modules/ipam_address_block.py index 1972d07e..674bf180 100644 --- a/plugins/modules/ipam_address_block.py +++ b/plugins/modules/ipam_address_block.py @@ -86,6 +86,10 @@ description: - "The description for the address block. May contain 0 to 1024 characters. Can include UTF-8." type: str + compartment_id: + description: + - "The compartment associated with the object. If no compartment is associated with the object, the value defaults to empty." + type: str ddns_client_update: description: - "Controls who does the DDNS updates." @@ -2505,6 +2509,7 @@ def main(): ), cidr=dict(type="int"), comment=dict(type="str"), + compartment_id=dict(type="str"), ddns_client_update=dict(type="str"), ddns_conflict_resolution_mode=dict(type="str"), ddns_domain=dict(type="str"), diff --git a/plugins/modules/ipam_ip_space.py b/plugins/modules/ipam_ip_space.py index 5e380e5b..c80c1c3e 100644 --- a/plugins/modules/ipam_ip_space.py +++ b/plugins/modules/ipam_ip_space.py @@ -73,12 +73,17 @@ - "The minimum percentage of addresses that must be available outside of the DHCP ranges and fixed addresses when making a suggested change.." type: int reenable_date: - description: "" + description: + - "The date at which notifications will be re-enabled automatically." type: str comment: description: - "The description for the IP space. May contain 0 to 1024 characters. Can include UTF-8." type: str + compartment_id: + description: + - "The compartment associated with the object. If no compartment is associated with the object, the value defaults to empty." + type: str ddns_client_update: description: - "Controls who does the DDNS updates." @@ -813,9 +818,9 @@ infoblox.bloxone.ipam_ip_space: name: "my-ip-space" tags: - location: "my-location" + location: "site-1" - - name: "Create an IP space with DHCP configuration value overridden" + - name: "Create an IP space with Additional Fields" infoblox.bloxone.ipam_ip_space: name: "my-ip-space" dhcp_config: @@ -847,6 +852,9 @@ action: inherit lease_time_v6: action: inherit + tags: + location: "my-location" + comment: "IP Space" - name: "Delete an IP space" infoblox.bloxone.ipam_ip_space: @@ -918,7 +926,8 @@ type: int returned: Always reenable_date: - description: "" + description: + - "The date at which notifications will be re-enabled automatically." type: str returned: Always asm_scope_flag: @@ -2456,23 +2465,28 @@ returned: Always contains: abandoned: - description: "" + description: + - "The number of IP addresses in the scope of the object which are in the abandoned state (issued by a DHCP server and then declined by the client)." type: str returned: Always dynamic: - description: "" + description: + - "The number of IP addresses handed out by DHCP in the scope of the object. This includes all leased addresses, fixed addresses that are defined but not currently leased and abandoned leases." type: str returned: Always static: - description: "" + description: + - "The number of defined IP addresses such as reservations or DNS records. It can be computed as I(static) = I(used) - I(dynamic)." type: str returned: Always total: - description: "" + description: + - "The total number of IP addresses available in the scope of the object." type: str returned: Always used: - description: "" + description: + - "The number of IP addresses used in the scope of the object." type: str returned: Always vendor_specific_option_option_space: @@ -2622,6 +2636,7 @@ def main(): ), ), comment=dict(type="str"), + compartment_id=dict(type="str"), ddns_client_update=dict( type="str", choices=["client", "server", "ignore", "over_client_update", "over_no_update"], default="client" ), diff --git a/plugins/modules/ipam_ip_space_info.py b/plugins/modules/ipam_ip_space_info.py index 5b6f2b26..fa25df38 100644 --- a/plugins/modules/ipam_ip_space_info.py +++ b/plugins/modules/ipam_ip_space_info.py @@ -142,7 +142,8 @@ type: int returned: Always reenable_date: - description: "" + description: + - "The date at which notifications will be re-enabled automatically." type: str returned: Always asm_scope_flag: @@ -1680,23 +1681,28 @@ returned: Always contains: abandoned: - description: "" + description: + - "The number of IP addresses in the scope of the object which are in the abandoned state (issued by a DHCP server and then declined by the client)." type: str returned: Always dynamic: - description: "" + description: + - "The number of IP addresses handed out by DHCP in the scope of the object. This includes all leased addresses, fixed addresses that are defined but not currently leased and abandoned leases." type: str returned: Always static: - description: "" + description: + - "The number of defined IP addresses such as reservations or DNS records. It can be computed as I(static) = I(used) - I(dynamic)." type: str returned: Always total: - description: "" + description: + - "The total number of IP addresses available in the scope of the object." type: str returned: Always used: - description: "" + description: + - "The number of IP addresses used in the scope of the object." type: str returned: Always vendor_specific_option_option_space: diff --git a/tests/integration/targets/ipam_address_block/tasks/main.yml b/tests/integration/targets/ipam_address_block/tasks/main.yml index 11ecf98e..9ec03177 100644 --- a/tests/integration/targets/ipam_address_block/tasks/main.yml +++ b/tests/integration/targets/ipam_address_block/tasks/main.yml @@ -191,8 +191,13 @@ - address_block_info.objects | length == 1 - address_block_info.objects[0].asm_config.asm_threshold == 70 - address_block_info.objects[0].asm_config.forecast_period == 12 + - address_block_info.objects[0].inheritance_sources.asm_config.asm_enable_block.action == "inherit" + - address_block_info.objects[0].inheritance_sources.asm_config.asm_growth_block.action == "inherit" - address_block_info.objects[0].inheritance_sources.asm_config.asm_threshold.action == "override" - address_block_info.objects[0].inheritance_sources.asm_config.forecast_period.action == "override" + - address_block_info.objects[0].inheritance_sources.asm_config.history.action == "override" + - address_block_info.objects[0].inheritance_sources.asm_config.min_total.action == "override" + - address_block_info.objects[0].inheritance_sources.asm_config.min_unused.action == "override" - name: "Create an Address Block with comment" infoblox.bloxone.ipam_address_block: @@ -299,6 +304,16 @@ - address_block_info.objects | length == 1 - address_block_info.objects[0].dhcp_config.lease_time == 3600 - address_block_info.objects[0].inheritance_sources.dhcp_config.lease_time.action == "override" + - address_block_info.objects[0].inheritance_sources.dhcp_config.abandoned_reclaim_time.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.abandoned_reclaim_time_v6.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.allow_unknown.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.allow_unknown_v6.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.echo_client_id.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.filters.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.filters_v6.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.ignore_client_uid.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.ignore_list.action == "inherit" + - address_block_info.objects[0].inheritance_sources.dhcp_config.lease_time_v6.action == "inherit" - name: "Create an Address Block with hostname_rewrite_enabled set to true" infoblox.bloxone.ipam_address_block: @@ -341,6 +356,46 @@ - address_block_info.objects | length == 1 - address_block_info.objects[0].tags.location == tag_value + - name: "Create an Address Block with empty Compartment Id" + infoblox.bloxone.ipam_address_block: + address: "10.0.0.0/16" + space: "{{ _ip_space.id }}" + compartment_id: "" + state: "present" + register: address_block + - name: Get information about the Address Block + infoblox.bloxone.ipam_address_block_info: + filters: + address: "10.0.0.0" + space: "{{ _ip_space.id }}" + cidr: 16 + register: address_block_info + - assert: + that: + - address_block is not failed + - address_block_info.objects | length == 1 + - address_block_info.objects[0].compartment_id == "" + + - name: "Create an Address Block with Compartment Id as null" + infoblox.bloxone.ipam_address_block: + address: "10.0.0.0/16" + space: "{{ _ip_space.id }}" + compartment_id: null + state: "present" + register: address_block + - name: Get information about the Address Block + infoblox.bloxone.ipam_address_block_info: + filters: + address: "10.0.0.0" + space: "{{ _ip_space.id }}" + cidr: 16 + register: address_block_info + - assert: + that: + - address_block is not failed + - address_block_info.objects | length == 1 + - address_block_info.objects[0].compartment_id == "" + always: # Cleanup if the test fails - ansible.builtin.include_role: diff --git a/tests/integration/targets/ipam_ip_space/tasks/main.yml b/tests/integration/targets/ipam_ip_space/tasks/main.yml index 5c4bc78d..f8250415 100644 --- a/tests/integration/targets/ipam_ip_space/tasks/main.yml +++ b/tests/integration/targets/ipam_ip_space/tasks/main.yml @@ -160,6 +160,346 @@ - ip_space_info.objects[0].dhcp_config.lease_time == 3600 - ip_space_info.objects[0].inheritance_sources.dhcp_config.lease_time.action == "override" + - name: "Create an IP Space with ASM config overridden" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + asm_config: + asm_threshold: 70 + enable: true + enable_notification: true + forecast_period: 12 + growth_factor: 40 + growth_type: "count" + history: 40 + min_total: 30 + min_unused: 30 + inheritance_sources: + asm_config: + asm_enable_block: + action: inherit + asm_growth_block: + action: inherit + asm_threshold: + action: override + forecast_period: + action: override + history: + action: override + min_total: + action: override + min_unused: + action: override + state: "present" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is changed + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].asm_config.asm_threshold == 70 + - ip_space_info.objects[0].asm_config.forecast_period == 12 + - ip_space_info.objects[0].inheritance_sources.asm_config.asm_enable_block.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.asm_growth_block.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.asm_threshold.action == "override" + - ip_space_info.objects[0].inheritance_sources.asm_config.forecast_period.action == "override" + - ip_space_info.objects[0].inheritance_sources.asm_config.history.action == "override" + - ip_space_info.objects[0].inheritance_sources.asm_config.min_total.action == "override" + - ip_space_info.objects[0].inheritance_sources.asm_config.min_unused.action == "override" + + - name: "Create an IP Space with comment" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + comment: "Comment" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].comment == "Comment" + + - name: "Create an IP Space with ddns_client_update set to server" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + ddns_client_update: "server" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].ddns_client_update == "server" + + - name: "Create an IP Space with ddns_conflict_resolution_mode set to check_exists_with_dhcid" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + ddns_use_conflict_resolution: "false" + ddns_conflict_resolution_mode: "check_exists_with_dhcid" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].ddns_use_conflict_resolution == false + + - name: "Create an IP Space with ddns_domain not empty" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + ddns_domain: "abc" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].ddns_domain == "abc" + + - name: "Create an IP Space with ddns_generate_name set to true" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + ddns_generate_name: true + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].ddns_generate_name == true + + - name: "Create an IP Space with ddns_generated_prefix" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + ddns_generated_prefix: "host-prefix" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].ddns_generated_prefix == "host-prefix" + + - name: "Create an IP Space with header_option_file_name" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + header_option_filename: "HEADER_OPTION_FILEip_space_name" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].header_option_filename == "HEADER_OPTION_FILEip_space_name" + + - name: "Create an IP Space with header_option_server_address" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + header_option_server_address: "10.0.0.0" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].header_option_server_address == "10.0.0.0" + + - name: "Create an IP Space with host_name_rewrite_char" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + hostname_rewrite_char: "+" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].hostname_rewrite_char == "+" + + - name: "Create an IP Space with host_name_rewrite_enable set to true" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + hostname_rewrite_enabled: true + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].hostname_rewrite_enabled == true + + - name: "Create an IP Space with host_name_rewrite_regex" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + state: "present" + hostname_rewrite_regex: "[^a-z]" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].hostname_rewrite_regex == "[^a-z]" + + - name: "Create an IP Space with empty Compartment Id" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + compartment_id: "" + state: "present" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].compartment_id == "" + + - name: "Create an IP Space with Compartment Id as null" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + compartment_id: null + state: "present" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].compartment_id == "" + + - name: "Create an IP Space with inheritance sources" + infoblox.bloxone.ipam_ip_space: + name: "{{ name }}" + inheritance_sources: + asm_config: + asm_enable_block: + action: inherit + asm_growth_block: + action: inherit + asm_threshold: + action: inherit + forecast_period: + action: inherit + history: + action: inherit + min_total: + action: inherit + min_unused: + action: inherit + ddns_client_update: + action: inherit + ddns_conflict_resolution_mode: + action: inherit + ddns_ttl_percent: + action: inherit + ddns_update_on_renew: + action: inherit + ddns_use_conflict_resolution: + action: inherit + header_option_filename: + action: inherit + header_option_server_address: + action: inherit + header_option_server_name: + action: inherit + hostname_rewrite_block: + action: inherit + vendor_specific_option_option_space: + action: inherit + state: "present" + register: ip_space + - name: Get information about the IP Space + infoblox.bloxone.ipam_ip_space_info: + filters: + name: "{{ name }}" + register: ip_space_info + - assert: + that: + - ip_space is not failed + - ip_space_info.objects | length == 1 + - ip_space_info.objects[0].inheritance_sources.asm_config.asm_enable_block.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.asm_growth_block.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.asm_threshold.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.forecast_period.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.history.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.min_total.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.asm_config.min_unused.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.ddns_client_update.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.ddns_conflict_resolution_mode.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.ddns_ttl_percent.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.ddns_update_on_renew.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.ddns_use_conflict_resolution.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.header_option_filename.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.header_option_server_address.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.header_option_server_name.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.hostname_rewrite_block.action == "inherit" + - ip_space_info.objects[0].inheritance_sources.vendor_specific_option_option_space.action == "inherit" + always: # Cleanup if the test fails - name: "Delete IP Space"