コード例 #1
0
def test_ipv4_neigh():
    result = ip.Ipv4Neigh(context_wrap(IPV4_NEIGH_CONTEXT))
    assert '172.17.0.18' in result
    assert len(result.data) == 8

    # Test all unreachability detection states
    assert result["172.17.42.10"] == {
        "dev": "lo",
        "lladdr": "00:00:00:00:00:00",
        "nud": "PERMANENT",
        'addr': ipaddress.ip_address(u'172.17.42.10')
    }
    assert result["172.17.42.11"] == {
        "dev": "lo",
        "lladdr": "00:00:00:00:00:01",
        "nud": "NOARP",
        'addr': ipaddress.ip_address(u'172.17.42.11')
    }
    assert result["172.17.42.12"] == {
        "dev": "lo",
        "lladdr": "00:00:00:00:00:02",
        "nud": "REACHABLE",
        'addr': ipaddress.ip_address(u'172.17.42.12')
    }
    assert result["172.17.42.13"] == {
        "dev": "lo",
        "lladdr": "00:00:00:00:00:03",
        "nud": "STALE",
        'addr': ipaddress.ip_address(u'172.17.42.13')
    }
    assert result["172.17.42.14"] == {
        "dev": "lo",
        "lladdr": "00:00:00:00:00:04",
        "nud": "DELAY",
        'addr': ipaddress.ip_address(u'172.17.42.14')
    }
    assert result["172.17.42.15"] == {
        "dev": "lo",
        "lladdr": "00:00:00:00:00:05",
        "nud": "FAILED",
        'addr': ipaddress.ip_address(u'172.17.42.15')
    }
    assert result["172.17.0.18"] == {
        "nud": "FAILED",
        'addr': ipaddress.ip_address(u'172.17.0.18')
    }
    assert result["172.17.0.19"] == {
        "dev": "docker0",
        "nud": "FAILED",
        'addr': ipaddress.ip_address(u'172.17.0.19')
    }
コード例 #2
0
ファイル: test_ip.py プロジェクト: xiangce/insights-core
def test_bad_neigh():
    result = ip.Ipv4Neigh(context_wrap(BAD_NEIGH_CONTEXT))
    assert len(result.data) == 0
    # Check unparsed_lines?
    assert len(result.unparsed_lines) == 6