Example #1
0
def test_annotate_with_type_relation():
    inp_dict = {"timestamp": 1445817600.0, "collector": "rrc01", "peer_as": 13030, "peer_ip": "195.66.224.175",
                "type": "F", "relation": ["ripe"],
                "announce": {"prefix": "1.0.128.0/24", "asn": 23969, "as_path": "13030 3491 4651 9737 23969"},
                "conflict_with": {"prefix": "1.0.128.0/17", "asn": 9737}, "asn": 9737, "direct": True, "valid": ["ro"]}
    annotate_with_type(inp_dict)
    assert inp_dict["type"] == "RELATION"
Example #2
0
def test_annotate_with_type_nodirect():
    inp_dict = {"timestamp": 1445817600.0, "collector": "rrc01", "peer_as": 13030, "peer_ip": "195.66.224.175",
                "type": "F",
                "announce": {"prefix": "1.0.128.0/24", "asn": 23969, "as_path": "13030 3491 4651 9737 23969"},
                "conflict_with": {"prefix": "1.0.128.0/17", "asn": 9737}, "asn": 9737, "direct": False}
    annotate_with_type(inp_dict)
    assert inp_dict["type"] == "NODIRECT"
Example #3
0
def test_annotate_with_type_nodirect():
    inp_dict = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "announce": {
            "prefix": "1.0.128.0/24",
            "asn": 23969,
            "as_path": "13030 3491 4651 9737 23969"
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 9737
        },
        "asn": 9737,
        "direct": False
    }
    annotate_with_type(inp_dict)
    assert inp_dict["type"] == "NODIRECT"
Example #4
0
def test_annotate_with_type_abnormal():
    inp_dict = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "announce": {
            "prefix": "1.0.128.0/24",
            "asn": 23969,
            "as_path": "13030 3491 4651 9737 23969"
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 9737
        },
        "asn": 9737,
        "valid": ["ro"]
    }
    annotate_with_type(inp_dict)
    assert inp_dict["type"] == "ABNORMAL"
Example #5
0
def test_annotate_with_type_valid():
    inp_dict = {
        "timestamp": 1445817600.0,
        "collector": "rrc01",
        "peer_as": 13030,
        "peer_ip": "195.66.224.175",
        "type": "F",
        "relation": ["ripe"],
        "announce": {
            "prefix": "1.0.128.0/24",
            "asn": 23969,
            "as_path": "13030 3491 4651 9737 23969",
            "valid": ["ro"]
        },
        "conflict_with": {
            "prefix": "1.0.128.0/17",
            "asn": 9737
        },
        "asn": 9737,
        "direct": True
    }
    annotate_with_type(inp_dict)
    assert inp_dict["type"] == "VALID"