Exemplo n.º 1
0
def test_ifconfig_4():
    """Verify that ifconfig command return exception when stats parameter without ports is given.

    """
    lh = GenericLinuxHost(LH_CFG, OPTS)
    with pytest.raises(Exception) as excepinfo:
        lh.ifconfig("stats")
    expect_result = "Ports table is empty"
    assert str(excepinfo.value) == expect_result
Exemplo n.º 2
0
def test_ifconfig_5():
    """Verify that ifconfig command return exception when improper mode is set.

    """
    lh = GenericLinuxHost(LH_CFG, OPTS)
    mode = "upfg"
    with pytest.raises(Exception) as excepinfo:
        lh.ifconfig(mode)
    expect_result = "Unknown mode parameter value - %s" % (mode, )
    assert excepinfo.value.parameter == expect_result
Exemplo n.º 3
0
def test_ifconfig_2():
    """Verify that ifconfig command return exception when lengths of ipaddr, ip6addr, mac parameters is not correct.

    """
    lh = GenericLinuxHost(LH_CFG, OPTS)
    commands = [('up', ['xe1'], ['1.1.1.1', "2.2.2.2"], None, None, "ipaddr"), ('up', ['xe1'], None, ['2002::', '3000::'], None, "ip6addr"),
                ('up', ['xe1'], None, None, ["00:12:12:12:23:56", "12:23:45:05:12:10", "10:11:02:12:12:13"], "mac")]
    for mode, port, ip, ip6, mac, name in commands:
        with pytest.raises(Exception) as excepinfo:
            lh.ifconfig(mode, port, ip, ip6, mac)
            result = "The lengths of the %s and ports lists are not equal." % name
            assert str(excepinfo.value) == result