Skip to content

Commit

Permalink
Fix ipv6 Infoblox test
Browse files Browse the repository at this point in the history
Signed-off-by: Shubham Ganar <sganar@redhat.com>
  • Loading branch information
shubhamsg199 committed Feb 25, 2025
1 parent 4bd56d0 commit f71341d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
13 changes: 8 additions & 5 deletions conf/infoblox.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ INFOBLOX:
#Domain
DOMAIN:
#Network Address
NETWORK:
NETWORK_IPV4:
NETWORK_IPV6:
#Network Prefix
NETWORK_PREFIX:
NETWORK_PREFIX_IPV4:
NETWORK_PREFIX_IPV6:
#Network Netmask
NETMASK:
#Starting range of IP
NETMASK_IPV4:
NETMASK_IPV6:
#Starting range of IP for IPv4
START_RANGE:
#Ending range of IP
#Ending range of IP for IPv4
END_RANGE:
27 changes: 14 additions & 13 deletions tests/foreman/destructive/test_infoblox.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,11 @@

pytestmark = pytest.mark.destructive

dhcp_isc_package = 'rubygem-smart_proxy_dhcp_remote_isc'
infoblox_package = 'rubygem-infoblox'
infoblox_dhcp_package = 'rubygem-smart_proxy_dhcp_infoblox'
infoblox_dns_package = 'rubygem-smart_proxy_dns_infoblox'

params = [
(
'enable-foreman-proxy-plugin-dhcp-remote-isc',
{'foreman-proxy-dhcp': 'true'},
f'rpm -q {dhcp_isc_package}',
),
(
'enable-foreman-proxy-plugin-dhcp-infoblox',
{
Expand Down Expand Up @@ -89,7 +83,7 @@
@pytest.mark.parametrize(
('command_args', 'command_opts', 'rpm_command'),
params,
ids=['isc_dhcp', 'infoblox_dhcp', 'infoblox_dns'],
ids=['infoblox_dhcp', 'infoblox_dns'],
)
def test_plugin_installation(target_sat, command_args, command_opts, rpm_command):
"""Check that external DNS and DHCP plugins install correctly
Expand Down Expand Up @@ -182,6 +176,7 @@ def test_infoblox_end_to_end(
assert f'current: "{settings.infoblox.hostname}"' in installer.stdout

macaddress = gen_mac(multicast=False)
is_ipv6 = settings.server.is_ipv6
# using the domain name as defined in Infoblox DNS
domain = module_target_sat.api.Domain(
name=settings.infoblox.domain,
Expand All @@ -193,12 +188,13 @@ def test_infoblox_end_to_end(
location=[module_location],
organization=[module_sca_manifest_org],
network=settings.infoblox.network,
network_type='IPv6' if is_ipv6 else 'IPv4',
cidr=settings.infoblox.network_prefix,
mask=settings.infoblox.netmask,
from_=settings.infoblox.start_range,
to=settings.infoblox.end_range,
from_=None if is_ipv6 else settings.infoblox.start_range,
to=None if is_ipv6 else settings.infoblox.end_range,
boot_mode='DHCP',
ipam='DHCP',
ipam='EUI-64' if is_ipv6 else 'DHCP',
dhcp=module_provisioning_capsule.id,
tftp=module_provisioning_capsule.id,
dns=module_provisioning_capsule.id,
Expand All @@ -214,7 +210,8 @@ def test_infoblox_end_to_end(
operatingsystem=module_sync_kickstart_content.os,
architecture=default_architecture,
domain=domain,
subnet=subnet,
subnet=subnet if not is_ipv6 else None,
subnet6=subnet if is_ipv6 else None,
root_pass=settings.provisioning.host_root_password,
ptable=default_partitiontable,
content_facet_attributes={
Expand All @@ -224,13 +221,17 @@ def test_infoblox_end_to_end(
},
).create()
# check if A Record is created for the host IP on Infoblox
url = f'https://{settings.infoblox.hostname}/wapi/v2.0/ipv4address?ip_address={host.ip}'
url = (
f'https://{settings.infoblox.hostname}/wapi/v2.0/ipv6address?ip_address={host.ip6}'
if is_ipv6
else f'https://{settings.infoblox.hostname}/wapi/v2.0/ipv4address?ip_address={host.ip}'
)
auth = (settings.infoblox.username, settings.infoblox.password)
result = requests.get(url, auth=auth, verify=False)
assert result.status_code == 200
# check hostname and ip is present in A record
assert host.name in result.text
assert host.ip in result.text
assert (host.ip6 if is_ipv6 else host.ip) in result.text
# delete host
module_target_sat.api.Subnet(id=subnet.id, domain=[]).update()
module_target_sat.api.Host(id=host.id).delete()
Expand Down

0 comments on commit f71341d

Please sign in to comment.