Exemple #1
0
def test_annotate_if_direct_ko():
    input_dict = {"timestamp": 1445817600.0,
                  "collector": "rrc01",
                  "peer_as": 13030,
                  "peer_ip": "195.66.224.175",
                  "type": "F",
                  "announce": {"prefix": "60.145.0.0/28",
                               "asn": 37554,
                               "as_path": "13030 3491 4651 9737 23969"},
                  "conflict_with": {"prefix": "1.0.128.0/17",
                                    "asn": 12322},
                  "asn": 12322}
    annotate_if_direct(input_dict)
    expected = {"timestamp": 1445817600.0,
                "collector": "rrc01",
                "peer_as": 13030,
                "peer_ip": "195.66.224.175",
                "type": "F",
                "announce": {"prefix": "60.145.0.0/28",
                             "asn": 37554,
                             "as_path": "13030 3491 4651 9737 23969"},
                "conflict_with": {"prefix": "1.0.128.0/17",
                                  "asn": 12322},
                "asn": 12322}
    assert input_dict == expected
Exemple #2
0
def test_annotate_if_nodirect():
    #pytest.skip()   # not implemented yet - tests to develop
    input_dict = {"timestamp": 1445817600.0,
                  "collector": "rrc01",
                  "peer_as": 13030,
                  "peer_ip": "195.66.224.175",
                  "type": "F",
                  "announce": {"prefix": "60.145.0.0/28",
                               "asn": 37554,
                               "as_path": "13030 3491 12322 9737 23969"},
                  "conflict_with": {"prefix": "1.0.128.0/17",
                                    "asn": 12322},
                  "asn": 12322}
    annotate_if_direct(input_dict)
    expected = {"timestamp": 1445817600.0,
                "collector": "rrc01",
                "peer_as": 13030,
                "peer_ip": "195.66.224.175",
                "type": "F",
                "announce": {"prefix": "60.145.0.0/28",
                             "asn": 37554,
                             "as_path": "13030 3491 12322 9737 23969"},
                "conflict_with": {"prefix": "1.0.128.0/17",
                                  "asn": 12322},
                "asn": 12322,
                "direct": False}
    assert input_dict == expected
Exemple #3
0
def test_annotate_if_nodirect():
    #pytest.skip()   # not implemented yet - tests to develop
    input_dict = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "announce": {
            "prefix": "60.145.0.0/28",
            "asn": 37554,
            "as_path": "13030 3491 12322 9737 23969"
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 12322
        },
        "asn": 12322
    }
    annotate_if_direct(input_dict)
    expected = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "announce": {
            "prefix": "60.145.0.0/28",
            "asn": 37554,
            "as_path": "13030 3491 12322 9737 23969"
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 12322
        },
        "asn": 12322,
        "direct": False
    }
    assert input_dict == expected
Exemple #4
0
def test_annotate_if_direct_ok():
    input_dict = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "announce": {
            "prefix": "60.145.0.0/28",
            "asn": 37554,
            "as_path": "13030 3491 9737 12322 37554"
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 12322
        },
        "asn": 12322
    }
    annotate_if_direct(input_dict)
    expected = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "announce": {
            "prefix": "60.145.0.0/28",
            "asn": 37554,
            "as_path": "13030 3491 9737 12322 37554"
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 12322
        },
        "asn": 12322,
        "direct": True
    }
    assert input_dict == expected