From ac51bd0878c2bf1fb63feee772ce952a9e304ad7 Mon Sep 17 00:00:00 2001 From: Vasileios Kotronis Date: Thu, 15 Apr 2021 10:33:14 +0300 Subject: [PATCH 1/2] reactivated prefixtree warnings and added rfc2622 tests for v6 prefixes --- .../prefixtree/core/prefixtree.py | 4 +- docs/changelog.md | 1 + testing/detection/configs/config3.yaml | 6 ++ testing/detection/testfiles/rfc2622.json | 74 +++++++++++++++++++ 4 files changed, 83 insertions(+), 2 deletions(-) diff --git a/backend-services/prefixtree/core/prefixtree.py b/backend-services/prefixtree/core/prefixtree.py index 968e6e5b1..da6ad507f 100644 --- a/backend-services/prefixtree/core/prefixtree.py +++ b/backend-services/prefixtree/core/prefixtree.py @@ -718,8 +718,8 @@ def annotate_bgp_update(self, message: Dict) -> NoReturn: routing_key="update-with-prefix-node", serializer="ujson", ) - # else: - # log.warning("unconfigured BGP update received '{}'".format(bgp_update)) + else: + log.warning("unconfigured BGP update received '{}'".format(bgp_update)) except Exception: log.exception("exception") diff --git a/docs/changelog.md b/docs/changelog.md index fb00bdd0d..4a26f4ca5 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - autoconfiguration subprefix bug in prefixtree plus new autoconf tests - vagrant docker-compose.yaml file fix (sync with master) - session timeout behavior +- rfc2622 fix and tests ### Removed - TBD (removed a feature) diff --git a/testing/detection/configs/config3.yaml b/testing/detection/configs/config3.yaml index a42032c9e..8585b9f5d 100644 --- a/testing/detection/configs/config3.yaml +++ b/testing/detection/configs/config3.yaml @@ -23,6 +23,10 @@ prefixes: - 10.12.0.0/16^24 test_n_m_op_16: &test_n_m_op_16 - 10.13.0.0/16^20-24 + test_n_op_32: &test_n_op_32 + - 2001:db8::/32^48 + test_n_m_op_32: &test_n_m_op_32 + - 2001:db9::/32^32-48 test_comms_24: &test_comms_24 - 10.0.20.0/24 test_as_set_24: &test_as_set_24 @@ -112,6 +116,8 @@ rules: - *test_inc_op_23 - *test_n_op_16 - *test_n_m_op_16 + - *test_n_op_32 + - *test_n_m_op_32 origin_asns: - *op_test_origin neighbors: diff --git a/testing/detection/testfiles/rfc2622.json b/testing/detection/testfiles/rfc2622.json index 5f362cc17..0102040b5 100644 --- a/testing/detection/testfiles/rfc2622.json +++ b/testing/detection/testfiles/rfc2622.json @@ -146,5 +146,79 @@ "num_peers_seen": 1, "configured_prefix": "10.13.1.0/24" } + }, + { + "send": { + "key": "30", + "timestamp": 30, + "orig_path": [], + "communities": [], + "service": "a", + "type": "A", + "path": [6, 3, 2, 202], + "prefix": "2001:db8:859::/48", + "peer_asn": 6 + }, + "detection_update_response": { + "key": "30", + "handled": true, + "matched_prefix": "2001:db8::/48", + "origin_as": 202 + }, + "detection_hijack_response": { + "prefix": "2001:db8:859::/48", + "hijack_as": 202, + "type": "E|0|-|-", + "time_started": 30.0, + "configured_prefix": "2001:db8::/48" + }, + "database_hijack_response": { + "type": "E|0|-|-", + "active": true, + "prefix": "2001:db8:859::/48", + "asns_inf": [2, 3, 6], + "hijack_as": 202, + "peers_seen": [6], + "num_asns_inf": 3, + "num_peers_seen": 1, + "configured_prefix": "2001:db8::/48" + } + }, + { + "send": { + "key": "31", + "timestamp": 31, + "orig_path": [], + "communities": [], + "service": "b", + "type": "A", + "path": [7, 3, 2, 203], + "prefix": "2001:db9:859::/48", + "peer_asn": 7 + }, + "detection_update_response": { + "key": "31", + "handled": true, + "matched_prefix": "2001:db9::/48", + "origin_as": 203 + }, + "detection_hijack_response": { + "prefix": "2001:db9:859::/48", + "hijack_as": 203, + "type": "E|0|-|-", + "time_started": 31.0, + "configured_prefix": "2001:db9::/48" + }, + "database_hijack_response": { + "type": "E|0|-|-", + "active": true, + "prefix": "2001:db9:859::/48", + "asns_inf": [2, 3, 7], + "hijack_as": 203, + "peers_seen": [7], + "num_asns_inf": 3, + "num_peers_seen": 1, + "configured_prefix": "2001:db9::/48" + } } ] From e88c948369257754035dfa04e041ed4fa1f49935 Mon Sep 17 00:00:00 2001 From: Vasileios Kotronis Date: Thu, 15 Apr 2021 11:44:08 +0300 Subject: [PATCH 2/2] test config changes --- testing/detection/configs/config.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testing/detection/configs/config.yaml b/testing/detection/configs/config.yaml index e6bd8f7fa..021f5fd7b 100644 --- a/testing/detection/configs/config.yaml +++ b/testing/detection/configs/config.yaml @@ -28,6 +28,10 @@ prefixes: - 10.12.0.0/16^24 test_n_m_op_16: &test_n_m_op_16 - 10.13.0.0/16^20-24 + test_n_op_32: &test_n_op_32 + - 2001:db8::/32^48 + test_n_m_op_32: &test_n_m_op_32 + - 2001:db9::/32^32-48 test_comms_24: &test_comms_24 - 10.0.20.0/24 test_as_set_24: &test_as_set_24 @@ -131,6 +135,8 @@ rules: - *test_inc_op_23 - *test_n_op_16 - *test_n_m_op_16 + - *test_n_op_32 + - *test_n_m_op_32 origin_asns: - *op_test_origin neighbors: