Skip to content

Commit

Permalink
Enabling Robottelo for IPv6 Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jyejare committed Mar 14, 2024
1 parent 285315d commit 0c14d52
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
4 changes: 4 additions & 0 deletions conf/server.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ SERVER:
SOURCE: "internal"
# The RHEL Base OS Version(x.y) where the Satellite is installed
RHEL_VERSION: '7'
# If the the satellite server is IPv6 server
# IS_IPV6:
# HTTP Proxy in <hostname:port> format for IPv6 satellite to connect for outer world access
# HTTP_PROXY_IPV6:
# run-on-one - All xdist runners default to the first satellite
# balance - xdist runners will be split between available satellites
# on-demand - any xdist runner without a satellite will have a new one provisioned.
Expand Down
4 changes: 3 additions & 1 deletion pytest_fixtures/component/maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def module_stash(request):
@pytest.fixture(scope='module')
def sat_maintain(request, module_target_sat, module_capsule_configured):
if settings.remotedb.server:
yield Satellite(settings.remotedb.server)
sat = Satellite(settings.remotedb.server)
sat.enable_ipv6_http_proxy()
yield sat
else:
module_target_sat.register_to_cdn(pool_ids=settings.subscription.fm_rhn_poolid.split())
hosts = {'satellite': module_target_sat, 'capsule': module_capsule_configured}
Expand Down
4 changes: 3 additions & 1 deletion pytest_fixtures/core/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ def _default_sat(align_to_satellite):
"""Returns a Satellite object for settings.server.hostname"""
if settings.server.hostname:
try:
return Satellite.get_host_by_hostname(settings.server.hostname)
sat = Satellite.get_host_by_hostname(settings.server.hostname)
sat.enable_ipv6_http_proxy()
return sat
except ContentHostError:
return Satellite()

Expand Down
9 changes: 8 additions & 1 deletion pytest_fixtures/core/sat_cap_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ def factory(retry_limit=3, delay=300, workflow=None, **broker_args):
)
timeout = (1200 + delay) * retry_limit
sat = wait_for(vmb.checkout, timeout=timeout, delay=delay, fail_condition=[])
return sat.out
sat = sat.out
sat.enable_ipv6_http_proxy()
return sat

return factory

Expand All @@ -77,6 +79,7 @@ def factory(retry_limit=3, delay=300, workflow=None, **broker_args):
def large_capsule_host(capsule_factory):
"""A fixture that provides a Capsule based on config settings"""
new_cap = capsule_factory(deploy_flavor=settings.flavors.custom_db)
# TO_DO - a question to resolve - How does the dynamic capsule talks to the CDN for contents ?
yield new_cap
new_cap.teardown()
Broker(hosts=[new_cap]).checkin()
Expand All @@ -100,6 +103,7 @@ def factory(retry_limit=3, delay=300, workflow=None, **broker_args):
)
timeout = (1200 + delay) * retry_limit
cap = wait_for(vmb.checkout, timeout=timeout, delay=delay, fail_condition=[])
## TO-DO: Need to add http proxy here for this capsule to talk outside/CDN
return cap.out

return factory
Expand Down Expand Up @@ -222,6 +226,7 @@ def module_lb_capsule(retry_limit=3, delay=300, **broker_args):
)
cap_hosts = wait_for(hosts.checkout, timeout=timeout, delay=delay)

## TO_DO : Need to add Proxy here for these capsules
yield cap_hosts.out

[cap.teardown() for cap in cap_hosts.out]
Expand Down Expand Up @@ -299,6 +304,7 @@ def cap_ready_rhel():
'workflow': settings.capsule.deploy_workflows.os,
}
with Broker(**deploy_args, host_class=Capsule) as host:
## TO_DO: Need to add Proxy here for this capsule
yield host


Expand All @@ -317,6 +323,7 @@ def installer_satellite(request):
else:
sat = lru_sat_ready_rhel(getattr(request, 'param', None))
sat.setup_firewall()
sat.enable_ipv6_http_proxy()
# # Register for RHEL8 repos, get Ohsnap repofile, and enable and download satellite
sat.register_to_cdn()
sat.download_repofile(
Expand Down
23 changes: 23 additions & 0 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,7 @@ def capsule_setup(self, sat_host=None, capsule_cert_opts=None, **installer_kwarg
self.satellite.session.remote_copy(certs_tar, self)
installer.update(**installer_kwargs)
result = self.install(installer)
## TO_DO : Add a http proxy for this to communicate outside
if result.status:
# before exit download the capsule log file
self.session.sftp_read(
Expand Down Expand Up @@ -1757,6 +1758,28 @@ def _swap_nailgun(self, new_version):
to_clear = [k for k in sys.modules.keys() if 'nailgun' in k]
[sys.modules.pop(k) for k in to_clear]

def enable_ipv6_http_proxy(self):
# Execute procedures for enabling IPv6 HTTP Proxy
if settings.server.is_ipv6 and settings.server.http_proxy_ipv6:
# TO_DO: Enable only if its not already enabled
robottelo_proxy = self.cli.HttpProxy.create(
{
'name': 'Robottelo IPv6 Automation Proxy',
'url': settings.server.http_proxy_ipv6
# Proxy port if it proxy has it
}
)
self.cli.Settings.set(
{
'name': 'content_default_http_proxy',
'value': robottelo_proxy,
}
)
else:
logger.warning(
'The IPv6 HTTP Proxy setting is not enabled!! Skipping the IPv6 HTTP Proxy setup.'
)

@property
def api(self):
"""Import all nailgun entities and wrap them under self.api"""
Expand Down
8 changes: 6 additions & 2 deletions tests/foreman/installer/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,9 @@ def sat_default_install(module_sat_ready_rhels):
f'foreman-initial-admin-password {settings.server.admin_password}',
]
install_satellite(module_sat_ready_rhels[0], installer_args)
yield module_sat_ready_rhels[0]
sat = module_sat_ready_rhels[0]
sat.enable_ipv6_http_proxy()
yield
common_sat_install_assertions(module_sat_ready_rhels[0])


Expand All @@ -1395,7 +1397,9 @@ def sat_non_default_install(module_sat_ready_rhels):
'foreman-proxy-content-pulpcore-hide-guarded-distributions false',
]
install_satellite(module_sat_ready_rhels[1], installer_args, enable_fapolicyd=True)
yield module_sat_ready_rhels[1]
sat = module_sat_ready_rhels[1]
sat.enable_ipv6_http_proxy()
yield sat
common_sat_install_assertions(module_sat_ready_rhels[1])


Expand Down

0 comments on commit 0c14d52

Please sign in to comment.