예제 #1
0
def test_ethtool_i_doc_examples():
    env = {
        'coalesce': [
            ethtool.CoalescingInfo(
                context_wrap(TEST_ETHTOOL_C_DOCS, path='ethtool_-c_eth0'))
        ],
        'interfaces': [
            ethtool.Driver(
                context_wrap(TEST_ETHTOOL_I_DOCS, path='ethtool_-i_bond0'))
        ],
        'ethers': [
            ethtool.Ethtool(
                context_wrap(TEST_ETHTOOL_DOCS, path='ethtool_eth0'))
        ],
        'features': [
            ethtool.Features(
                context_wrap(ETHTOOL_K_STANDARD, path='ethtool_-k_bond0'))
        ],
        'pause': [
            ethtool.Pause(
                context_wrap(TEST_ETHTOOL_A_DOCS, path='ethtool_-a_eth0'))
        ],
        'ring': [
            ethtool.Ring(
                context_wrap(TEST_ETHTOOL_G_DOCS, path='ethtool_-g_eth0'))
        ],
        'stats': [
            ethtool.Statistics(
                context_wrap(TEST_ETHTOOL_S_DOCS, path='ethtool_-S_eth0'))
        ],
    }
    failed, total = doctest.testmod(ethtool, globs=env)
    assert failed == 0
예제 #2
0
def test_ethtool_g():
    context = context_wrap(TEST_ETHTOOL_G)
    context.path = TEST_ETHTOOL_G_PATH
    result = ethtool.Ring(context)
    assert keys_in(["max", "current"], result.data)

    assert result.ifname == "eth2"
    assert result.data['max'].rx == 2047
    assert result.data['max'].rx_mini == 0
    assert result.data['max'].rx_jumbo == 0
    assert result.data['max'].tx == 511
    assert result.max.rx == 2047
    assert result.max.rx_mini == 0
    assert result.max.rx_jumbo == 0
    assert result.max.tx == 511
    assert result.current.rx == 200
    assert result.current.rx_mini == 0
    assert result.current.rx_jumbo == 0
    assert result.current.tx == 511
예제 #3
0
def test_ethtool_g_2():
    context = context_wrap(TEST_ETHTOOL_G_2, path=TEST_ETHTOOL_G_PATH_2)
    result = ethtool.Ring(context)
    assert result.ifname == "eth2"
예제 #4
0
def test_ethtool_g_1():
    context = context_wrap(TEST_ETHTOOL_G_1)
    context.path = TEST_ETHTOOL_G_PATH_1
    result = ethtool.Ring(context)
    assert result.ifname == "bond0.102@bond0"