Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.12.z] Add closed loop for BZ#1841048 #13316

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions tests/foreman/api/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"""
import uuid

from fauxfactory import gen_ipaddr, gen_mac
import pytest

from robottelo.constants import CLIENT_PORT, ENVIRONMENT
Expand Down Expand Up @@ -120,3 +121,50 @@ def test_positive_allow_reregistration_when_dmi_uuid_changed(
target_sat.execute(f'echo \'{{"dmi.system.uuid": "{uuid_2}"}}\' > /etc/rhsm/facts/uuid.facts')
result = rhel_contenthost.register_contenthost(module_org.label, lce=ENVIRONMENT)
assert result.status == 0


@pytest.mark.no_containers
def test_positive_rex_interface_for_global_registration(
module_target_sat,
module_org,
module_location,
rhel8_contenthost,
module_ak_with_synced_repo,
):
"""Test remote execution interface is set for global registration

:id: 982de593-dd1a-4c6c-81fe-728f40a7ad4d

:steps:
1. Register host with global registration template to Satellite specifying remote execution interface parameter.

:expectedresults: remote execution interface passed in the registration command is properly set for the host.

:BZ: 1841048

:customerscenario: true
"""
mac_address = gen_mac(multicast=False)
ip = gen_ipaddr()
# Create eth1 interface on the host
add_interface_command = f'ip link add eth1 type dummy;ifconfig eth1 hw ether {mac_address};ip addr add {ip}/24 brd + dev eth1 label eth1:1;ip link set dev eth1 up'
result = rhel8_contenthost.execute(add_interface_command)
assert result.status == 0
command = module_target_sat.api.RegistrationCommand(
organization=module_org,
location=module_location,
activation_keys=[module_ak_with_synced_repo.name],
update_packages=True,
remote_execution_interface='eth1',
).create()
result = rhel8_contenthost.execute(command)
assert result.status == 0, f'Failed to register host: {result.stderr}'
host = module_target_sat.api.Host().search(
query={'search': f'name={rhel8_contenthost.hostname}'}
)[0]
# Check if eth1 interface is set for remote execution
for interface in host.read_json()['interfaces']:
if 'eth1' in str(interface):
assert interface['execution'] is True
assert interface['ip'] == ip
assert interface['mac'] == mac_address