From 91f907a81667f52635b415879d27f4494ef6d336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Misbach?= Date: Tue, 13 May 2025 15:50:55 +0200 Subject: [PATCH] [uss_qualifier/resources/query_behavior] Add parameter fake_netlocs --- .../uss_qualifier/resources/interuss/query_behavior.py | 9 +++++++++ .../query_behavior/QueryBehaviorSpecification.json | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/monitoring/uss_qualifier/resources/interuss/query_behavior.py b/monitoring/uss_qualifier/resources/interuss/query_behavior.py index f236dfa246..1ed1271f3f 100644 --- a/monitoring/uss_qualifier/resources/interuss/query_behavior.py +++ b/monitoring/uss_qualifier/resources/interuss/query_behavior.py @@ -20,6 +20,9 @@ class QueryBehaviorSpecification(ImplicitDict): add_request_id: Optional[bool] """Whether to automatically add a `request_id` field to any request with a JSON body and no pre-existing `request_id` field""" + fake_netlocs: Optional[list[str]] + """Network locations well-known to be fake and for which a request should fail immediately without being attempted.""" + class QueryBehaviorResource(Resource[QueryBehaviorSpecification]): """When declared, this resource adjusts the settings for all queries made by uss_qualifier. @@ -81,3 +84,9 @@ def __init__( logger.info( f"QueryBehaviorResource: Fetch query set to {'' if settings.add_request_id else 'not '} add `request_id`" ) + + if "fake_netlocs" in specification and specification.fake_netlocs is not None: + settings.fake_netlocs = tuple(specification.fake_netlocs) + logger.info( + f"QueryBehaviorResource: Fake network locations set to {settings.fake_netlocs}" + ) diff --git a/schemas/monitoring/uss_qualifier/resources/interuss/query_behavior/QueryBehaviorSpecification.json b/schemas/monitoring/uss_qualifier/resources/interuss/query_behavior/QueryBehaviorSpecification.json index 07eadb979f..9e0e970ee6 100644 --- a/schemas/monitoring/uss_qualifier/resources/interuss/query_behavior/QueryBehaviorSpecification.json +++ b/schemas/monitoring/uss_qualifier/resources/interuss/query_behavior/QueryBehaviorSpecification.json @@ -28,6 +28,16 @@ "null" ] }, + "fake_netlocs": { + "description": "Network locations well-known to be fake and for which a request should fail immediately without being attempted.", + "items": { + "type": "string" + }, + "type": [ + "array", + "null" + ] + }, "read_timeout_seconds": { "description": "Number of seconds to allow for a request to complete after establishing a connection. Use 0 for no timeout.", "type": [