Skip to content

Commit

Permalink
addressed PR review
Browse files Browse the repository at this point in the history
  • Loading branch information
AnilGadiyarHJ committed Dec 11, 2024
1 parent f239a20 commit aaff22d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion plugins/modules/ipam_address_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -2381,7 +2381,7 @@ def __init__(self, *args, **kwargs):
self.params["address"], netmask = self.params["address"].split("/")
self.params["cidr"] = int(netmask)

exclude = ["state", "csp_url", "api_key", "id","abandoned_reclaim_time","abandoned_reclaim_time_v6",
exclude = ["state", "csp_url", "api_key", "id", "abandoned_reclaim_time", "abandoned_reclaim_time_v6",
"echo_client_id"]
self._payload_params = {k: v for k, v in self.params.items() if v is not None and k not in exclude}
self._payload = AddressBlock.from_dict(self._payload_params)
Expand Down
9 changes: 2 additions & 7 deletions plugins/modules/ipam_subnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2433,7 +2433,8 @@ def __init__(self, *args, **kwargs):
self.params["address"], netmask = self.params["address"].split("/")
self.params["cidr"] = int(netmask)

exclude = ["state", "csp_url", "api_key", "id"]
exclude = ["state", "csp_url", "api_key", "id", "abandoned_reclaim_time", "abandoned_reclaim_time_v6",
"echo_client_id"]
self._payload_params = {k: v for k, v in self.params.items() if v is not None and k not in exclude}
self._payload = Subnet.from_dict(self._payload_params)
# Safely remove unwanted attributes
Expand All @@ -2442,12 +2443,6 @@ def __init__(self, *args, **kwargs):
self._payload.dhcp_config.abandoned_reclaim_time_v6 = None
self._payload.dhcp_config.echo_client_id = None

# Handle inheritance sources safely
if self._payload.inheritance_sources and self._payload.inheritance_sources.dhcp_config:
inherited_dhcp_config = self._payload.inheritance_sources.dhcp_config
setattr(inherited_dhcp_config, "abandoned_reclaim_time", None)
setattr(inherited_dhcp_config, "abandoned_reclaim_time_v6", None)
setattr(inherited_dhcp_config, "echo_client_id", None)
self._existing = None

@property
Expand Down
27 changes: 24 additions & 3 deletions tests/integration/targets/ipam_subnet/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,12 @@
- subnet_info.objects | length == 1
- subnet_info.objects[0].ddns_generate_name == true

- name: "Create a Subnet with ddns_send_updates set to true"
- name: "Create a Subnet with ddns_send_updates set to false"
infoblox.bloxone.ipam_subnet:
address: "10.0.0.0/24"
space: "{{ ip_space.id }}"
state: "present"
ddns_send_updates: "true"
ddns_send_updates: "false"
register: subnet
- name: Get information about the Subnet
infoblox.bloxone.ipam_subnet_info:
Expand All @@ -284,7 +284,7 @@
that:
- subnet is not failed
- subnet_info.objects | length == 1
- subnet_info.objects[0].ddns_send_updates == true
- subnet_info.objects[0].ddns_send_updates == false

- name: "Create a Subnet with ddns_update_on_renew set to true"
infoblox.bloxone.ipam_subnet:
Expand All @@ -306,6 +306,27 @@
- subnet_info.objects | length == 1
- subnet_info.objects[0].ddns_update_on_renew == true

# Skip this due to backend bug NORTHSTAR-12587
# - name: "Create a Subnet with ddns_ttl_percent set to 25"
# infoblox.bloxone.ipam_subnet:
# address: "10.0.0.0/24"
# space: "{{ ip_space.id }}"
# state: "present"
# ddns_ttl_percent: 25.0
# register: subnet
# - name: Get information about the Subnet
# infoblox.bloxone.ipam_subnet_info:
# filters:
# address: "10.0.0.0"
# space: "{{ ip_space.id }}"
# cidr: 24
# register: subnet_info
# - assert:
# that:
# - subnet is not failed
# - subnet_info.objects | length == 1
# - subnet_info.objects[0].ddns_ttl_percent == 25.0

- name: "Create a Subnet with ddns_use_conflict_resolution set to false"
infoblox.bloxone.ipam_subnet:
address: "10.0.0.0/24"
Expand Down

0 comments on commit aaff22d

Please sign in to comment.