Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
VishrutiBuddhadev committed Jan 13, 2025
1 parent 1def603 commit 8d46439
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 41 deletions.
40 changes: 14 additions & 26 deletions plugins/modules/ipam_address_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
- "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
cidr:
description:
Expand Down Expand Up @@ -737,7 +737,7 @@
""" # noqa: E501

EXAMPLES = r"""
- name: "Create an ip space (required as parent)"
- name: "Create an IP space (required as parent)"
infoblox.bloxone.ipam_ip_space:
name: "my-ip-space"
state: "present"
Expand All @@ -755,24 +755,12 @@
next_available_id: "{{ address_block.id }}"
state: "present"
- name: "Delete an Address Block"
infoblox.bloxone.ipam_address_block:
address: "10.0.0.0/16"
space: "{{ ip_space.id }}"
state: "absent"
- name: "Create an Address Block with separate cidr"
- name: "Create an Address Block with Additional Fields"
infoblox.bloxone.ipam_address_block:
address: "10.0.0.0"
cidr: 16
space: "{{ ip_space.id }}"
state: "present"
- name: "Create an Address Block with DHCP config overridden"
infoblox.bloxone.ipam_address_block:
address: "10.0.0.0/16"
space: "{{ ip_space.id }}"
state: "present"
dhcp_config:
lease_time: 3600
inheritance_sources:
Expand All @@ -799,14 +787,14 @@
action: inherit
lease_time_v6:
action: inherit
tags:
location: "site-1"
- name: "Create an Address Block with tags"
- name: "Delete an Address Block"
infoblox.bloxone.ipam_address_block:
address: "10.0.0.0/16"
space: "{{ ip_space.id }}"
state: "present"
tags:
location: "site-1"
state: "absent"
"""

RETURN = r"""
Expand Down Expand Up @@ -878,7 +866,7 @@
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 @@ -2326,23 +2314,23 @@
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 _static_ = _used_ - _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
""" # noqa: E501
Expand Down Expand Up @@ -2412,7 +2400,7 @@ def find(self):
return None
raise e
else:
# If address is None, return None, indicating next_available_address block should be created and not updated
# If address is None, return None, indicating next_available_address block should be created
if self.params["address"] is None:
return None
filter = f"address=='{self.params['address']}' and space=='{self.params['space']}' and cidr=={self.params['cidr']}"
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/ipam_address_block_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
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 @@ -1618,23 +1618,23 @@
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 _static_ = _used_ - _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
""" # noqa: E501
Expand Down
16 changes: 8 additions & 8 deletions plugins/modules/ipam_next_available_address_block_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
description:
- The CIDR value of the object
type: int
required: false
required: true
count:
description:
- Number of objects to generate. Default 1 if not set
Expand Down Expand Up @@ -124,7 +124,7 @@
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 @@ -1587,23 +1587,23 @@
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 _static_ = _used_ - _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
""" # noqa: E501
Expand Down Expand Up @@ -1662,7 +1662,7 @@ def main():
# define available arguments/parameters a user can pass to the module
module_args = dict(
id=dict(type="str", required=True),
cidr=dict(type="int", required=False),
cidr=dict(type="int", required=True),
count=dict(type="int", required=False),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@
- assert:
that:
- address_block_info.objects | length == 1
- address_block_info.objects[0].id == address_block.id
- address_block_info.objects[0].id == address_block.id
always:
# Cleanup if the test fails
- ansible.builtin.include_role:
name: setup_ip_space
tasks_from: cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@
that:
- next_available_address_block_info is not failed
- next_available_address_block_info.objects | length == 5

always:
# Cleanup if the test fails
- ansible.builtin.include_role:
name: setup_ip_space
tasks_from: cleanup.yml

0 comments on commit 8d46439

Please sign in to comment.