コード例 #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_Features_bad_args():
    # Even if content is bad, interface should be available from path
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_BAD_ARGS, path="sbin/ethtool_-k_bond0"))
    assert features.ifname == 'bond0'
    assert features.iface == 'bond0'
    assert features.data == {}
コード例 #3
0
def test_Features_cannot_get():
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_CANNOT_GET, path="sbin/ethtool_-k_eth1"))
    assert features.ifname == 'eth1'
    assert features.iface == 'eth1'

    assert features.data == {}
コード例 #4
0
def test_Features_good():
    # Test picking up interface from header line rather than path
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_STANDARD, path='sos_commands/networking/ethtool_-k_bond0'))
    assert features.ifname == 'bond0'
    assert features.iface == 'bond0'

    assert not features.is_on('rx-checksumming')
    assert features.is_on('tx-checksumming')

    assert features.is_fixed('rx-checksumming')
    assert not features.is_fixed('tx-checksumming')
コード例 #5
0
def test_Features_missing_colon():
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_MISSING_COLON, path="sbin/ethtool_-k_bond0"))
    assert features.ifname == 'bond0'
    assert features.data == {}