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 2 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
7 changes: 5 additions & 2 deletions plugins/modules/ipam_ip_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,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 +847,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
233 changes: 233 additions & 0 deletions tests/integration/targets/ipam_ip_space/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,239 @@
- 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_threshold.action == "override"
- ip_space_info.objects[0].inheritance_sources.asm_config.forecast_period.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 == ip_space.object.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]"

always:
# Cleanup if the test fails
- name: "Delete IP Space"
Expand Down
Loading