Skip to content
Snippets Groups Projects

Feature/nat 212 213

Merged JORGE SASIAIN requested to merge feature/nat-212-213 into develop
2 files
+ 113
18
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 7
6
@@ -270,7 +270,7 @@ def find_next_available_ip(infoblox_params, network_ref: str = ""):
Otherwise returns the next available IP address in the network.
"""
r = requests.post(
f"{wapi(infoblox_params)}/{network_ref}?_function=next_available_ip&num=1", # noqa: E501
f"{wapi(infoblox_params)}/{network_ref}?_function=next_available_ip&num=1",
auth=HTTPBasicAuth(infoblox_params.username, infoblox_params.password),
verify=False,
timeout=REQUESTS_TIMEOUT
@@ -517,7 +517,7 @@ def allocate_host(
def delete_network(
network: Union[V4ServiceNetwork, V6ServiceNetwork] = None,
network: ipaddress.ip_network = None,
service_type: str = ""
) -> Union[V4ServiceNetwork, V6ServiceNetwork]:
"""Delete IPv4 or IPv6 network by CIDR."""
@@ -666,8 +666,7 @@ def delete_host(
def validate_network(
gso_subscription_id: str = "",
network: Union[V4ServiceNetwork, V6ServiceNetwork] = None,
service_type: str = ""
network: ipaddress.ip_network = None
) -> Union[V4ServiceNetwork, V6ServiceNetwork]:
"""Validate IPv4 or IPv6 network.
Check if the specified network exist, and, if it does,
@@ -682,7 +681,9 @@ def validate_network(
assert "comment" in network_info[0], "Network to validate does not have comment in IPAM."
assert gso_subscription_id in network_info[0]["comment"], "GSO subscription ID does not match the one in the comment field of the IPAM network."
return network
if ip_version == 4:
return V4ServiceNetwork(v4=network)
return V6ServiceNetwork(v6=network)
def validate_host(
@@ -743,4 +744,4 @@ def validate_host(
found_cnames = [item["name"] for item in cname_data if "name" in item]
assert provided_cnames == found_cnames, "Provided CNAME alias names don't match the ones poiting to hostname."
return HostAddresses
return host_addresses
Loading