Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Missing UTs for IP Space and Address Block #61

Merged
merged 14 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions plugins/modules/ipam_address_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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"),
Expand Down
33 changes: 24 additions & 9 deletions plugins/modules/ipam_ip_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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"
),
Expand Down
18 changes: 12 additions & 6 deletions plugins/modules/ipam_ip_space_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
55 changes: 55 additions & 0 deletions tests/integration/targets/ipam_address_block/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Loading