def _inner(hostname, rack, rank, appliance, interface, ip, network, address, pxe):
    add_host_with_interface(hostname=hostname, rack=rack, rank=rank, appliance=appliance, interface=interface)
    add_network(name=network, address=address, pxe=pxe)
    result = host.run(f'stack set host interface network {hostname} network={network} interface={interface}')
    assert (result.rc == 0)
    result = host.run(f'stack set host interface ip {hostname} ip={ip} network={network}')
    assert (result.rc == 0)
    result = host.run('stack list host interface a:frontend output-format=json')
    assert (result.rc == 0)
    interface_on_network = False
    for frontend_interface in json.loads(result.stdout):
        if (frontend_interface['network'] == network):
            interface_on_network = True
            break
    if interface_on_network:
        return
    latest_interface = max((frontend_interface['interface'] for frontend_interface in json.loads(result.stdout)))
    new_interface = list(latest_interface)
    new_interface[(- 1)] = str((int(new_interface[(- 1)]) + 1))
    new_interface = ''.join(new_interface)
    result = host.run(f'stack add host interface a:frontend interface={new_interface} network={network} ip={(ipaddress.ip_address(ip) + 1)}')
    assert (result.rc == 0)
def _inner(hostname, rack, rank, appliance, interface, ip, network, address, pxe):
    add_host_with_interface(hostname=hostname, rack=rack, rank=rank, appliance=appliance, interface=interface)
    add_network(name=network, address=address, pxe=pxe)
    result = host.run(f'stack set host interface network {hostname} network={network} interface={interface}')
    assert (result.rc == 0)
    result = host.run(f'stack set host interface ip {hostname} ip={ip} network={network}')
    assert (result.rc == 0)
    result = host.run('stack list host interface a:frontend output-format=json')
    assert (result.rc == 0)
    interface_on_network = False
    for frontend_interface in json.loads(result.stdout):
        if (frontend_interface['network'] == network):
            interface_on_network = True
            break
    if interface_on_network:
        return
    latest_interface = max((frontend_interface['interface'] for frontend_interface in json.loads(result.stdout)))
    new_interface = list(latest_interface)
    new_interface[(- 1)] = str((int(new_interface[(- 1)]) + 1))
    new_interface = .join(new_interface)
    result = host.run(f'stack add host interface a:frontend interface={new_interface} network={network} ip={(ipaddress.ip_address(ip) + 1)}')
    assert (result.rc == 0)