Пример #1
0
def test_ifcfg_badly_named_bond_mode():
    context = context_wrap(IFCFG_TEST_BADLY_NAMED_BOND_MODE)
    context.path = IFCFG_PATH_BADLY_NAMED_BOND_MODE

    r = IfCFG(context)

    assert r.bonding_mode is None
Пример #2
0
def test_ifcfg_5():
    context = context_wrap(IFCFG_TEST_5)
    context.path = IFCFG_PATH_5

    r = IfCFG(context)

    assert r["TEAM_PORT_CONFIG"]["prio"] == -10
Пример #3
0
def test_ifcfg_master():
    context = context_wrap(IFCFG_TEST_MASTER)
    context.path = CONTEXT_PATH_DEVICE

    r = IfCFG(context)
    assert keys_in(["DEVICE", "iface", "ONBOOT", "BOOTPROTO", "MASTER"], r)
    assert r["MASTER"] == 'bond0'
Пример #4
0
def test_ifcfg_raw_bonding_master_value():
    context = context_wrap(IFCFG_TEST_RAW_MASTER_VALUE)
    context.path = IFCFG_PATH_ETH2

    r = IfCFG(context)
    assert r["raw_device_value"] == '"eth2"'
    assert r["raw_master_value"] == '"bond0"'
Пример #5
0
def test_ifcfg_space_v2():
    context = context_wrap(IFCFG_TEST_SPACE_V2)
    context.path = CONTEXT_PATH_DEVICE

    r = IfCFG(context)
    assert keys_in(["DEVICE", "iface", "ONBOOT", "BOOTPROTO",
                    "IPV4_FAILURE_FATAL"], r)
    assert r["DEVICE"] == '\"\"badName2\"  \"'
Пример #6
0
def test_ifcfg_raw_team_master_value():
    context = context_wrap(IFCFG_TEST_RAW_TEAM_MASTER_VALUE)
    context.path = IFCFG_PATH_ETH1

    r = IfCFG(context)

    assert r["raw_device_value"] == '"eth1"'
    assert r["raw_team_value"] == '"team0"'
Пример #7
0
def test_ifcfg_6():
    context = context_wrap(IFCFG_TEST_6)
    context.path = IFCFG_PATH_6

    r = IfCFG(context)

    assert r["BONDING_OPTS"]["mode"] == "1"
    assert r["BONDING_OPTS"]["arp_ip_target"] == "+10.11.96.1"
    assert r.bonding_mode == 1
Пример #8
0
def test_ifcfg_4():
    context = context_wrap(IFCFG_TEST_4)
    context.path = IFCFG_PATH_4

    r = IfCFG(context)

    assert r["TEAM_PORT_CONFIG"]["prio"] == 100
    assert r["iface"] == "=eno2"
    assert r["DEVICE"] == "=eno2"
Пример #9
0
def test_ifcfg_raw_bonding_value():
    context = context_wrap(IFCFG_TEST_RAW_BONDING_VALUE)
    context.path = IFCFG_PATH_NAMED_BOND_MODE

    r = IfCFG(context)

    assert r["raw_device_value"] == '"bond0"'
    assert r[
        "raw_bonding_value"] == '"mode=balance-xor primary=eth1 arp_interval=1000 arp_ip_target=+10.11.96.1 downdelay =0"'
Пример #10
0
def test_ifcfg_bonding_opts():
    context = context_wrap(IFCFG_TEST_NAMED_BOND_MODE)
    context.path = IFCFG_PATH_NAMED_BOND_MODE

    r = IfCFG(context)

    assert r["BONDING_OPTS"]["mode"] == "balance-xor"
    assert r["BONDING_OPTS"]["arp_ip_target"] == "+10.11.96.1"
    assert r["BONDING_OPTS"]["downdelay"] == "0"
    assert r.bonding_mode == 2
Пример #11
0
def test_ifcfg_space_v1():
    context = context_wrap(IFCFG_TEST_SPACE_V1)
    context.path = CONTEXT_PATH_DEVICE

    r = IfCFG(context)
    assert keys_in([
        "DEVICE", "iface", "ONBOOT", "BOOTPROTO", "IPV4_FAILURE_FATAL",
        "raw_device_value"
    ], r)
    assert r["DEVICE"] != '\'"badName1"  \''
    assert r["raw_device_value"] == '\'"badName1"  \''
    assert r["DEVICE"] == 'badName1'
Пример #12
0
def test_ifcfg_2():
    context = context_wrap(IFCFG_TEST_2)
    context.path = IFCFG_PATH_2

    r = IfCFG(context)
    assert len(r.data) == 7
    assert r["iface"] == "=eno1"
    assert r["TYPE"] == "Ethernet"
    assert r["BOOTPROTO"] == "dhcp"
    assert r["DEFROUTE"] == "yes"
    assert r["UUID"] == "284549c8-0e07-41d3-a1e8-91ac9a9fca75"
    assert r["HWADDR"] == "00:50:56:89:0B:B0"
    assert r["PEERDNS"] == "yes"
Пример #13
0
def test_ifcfg():
    context = context_wrap(IFCFG_TEST)
    context.path = CONTEXT_PATH

    r = IfCFG(context)
    assert keys_in(["iface", "TYPE", "BOOTPROTO",
                    "IPV4_FAILURE_FATAL", "NAME"], r)
    assert not keys_in(["ONBOOT"], r)
    assert r["TYPE"] == "Ethernet"
    assert r["BOOTPROTO"] == "dhcp"
    assert r["IPV4_FAILURE_FATAL"] == "no"
    assert r["NAME"] == "enp0s25"
    assert r["iface"] == "enp0s25"
    assert r.ifname == r['iface']
    assert r.bonding_mode is None
Пример #14
0
def test_ifcfg_3():
    context = context_wrap(IFCFG_TEST_3)
    context.path = IFCFG_PATH_3

    r = IfCFG(context)

    assert len(r.data) == 7
    assert r["DEVICE"] == "team1"
    assert r["DEVICETYPE"] == "Team"
    assert r["ONBOOT"] == "yes"
    assert r["NETMASK"] == "255.255.252.0"
    assert r["IPADDR"] == "192.168.0.1"
    assert r["TEAM_CONFIG"]["runner"]["name"] == "lacp"
    assert r["TEAM_CONFIG"]["runner"]["active"] == "true"
    assert r["TEAM_CONFIG"]["tx_balancer"]["name"] == "basic"
    assert r["TEAM_CONFIG"]["link_watch"]["name"] == "ethtool"
Пример #15
0
def test_ifcfg_blankline():
    context = context_wrap(IFCFG_BLANK_LINE)
    context.path = IFCFG_PATH_BLANK_LINE
    r = IfCFG(context)
    assert r.has_empty_line is True