Skip to content

Commit

Permalink
basic: test 003 ovirtlib - refactor 1
Browse files Browse the repository at this point in the history
Change-Id: I9a2a921fd5b7e8987f599f8cedb5fca19af43e1a
Signed-off-by: Eitan Raviv <eraviv@redhat.com>
  • Loading branch information
erav committed Feb 15, 2022
1 parent cbf8c5e commit 79da3a1
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def _host_is_attached_to_network(engine, host, network_name, nic_name=None):


def _attach_vm_network_to_host_static_config(host, network):

attach_data = netattachlib.NetworkAttachmentData(
network,
ETH0,
Expand All @@ -79,9 +78,10 @@ def _attach_vm_network_to_host_static_config(host, network):

host.setup_networks((attach_data,))


def _assert_expected_ips(host):
host_nic = hostlib.HostNic(host)
host_nic.import_by_name(f'{ETH0}.{VM_NETWORK_VLAN_ID}')

assert ipaddress.ip_address(host_nic.ip4_address) == ipaddress.ip_address(
VM_NETWORK_IPv4_ADDR.format(int(host.name[-1]) + 1)
)
Expand All @@ -93,6 +93,7 @@ def _attach_vm_network_to_host_static_config(host, network):

def test_attach_vm_network_to_host_0_static_config(host0, vm_network):
_attach_vm_network_to_host_static_config(host0, vm_network)
_assert_expected_ips(host0)


def test_modify_host_0_ip_to_dhcp(host0, vm_network):
Expand Down Expand Up @@ -176,6 +177,7 @@ def test_attach_vm_network_to_both_hosts_static_config(host0, host1, vm_network)
# preparation for 004 and 006
for host in (host0, host1):
_attach_vm_network_to_host_static_config(host, vm_network)
_assert_expected_ips(host)


@pytest.fixture(scope='module')
Expand Down

0 comments on commit 79da3a1

Please sign in to comment.