diff --git a/monitoring/uss_qualifier/configurations/dev/library/resources.yaml b/monitoring/uss_qualifier/configurations/dev/library/resources.yaml index ff155301c1..5837c2da8f 100644 --- a/monitoring/uss_qualifier/configurations/dev/library/resources.yaml +++ b/monitoring/uss_qualifier/configurations/dev/library/resources.yaml @@ -365,11 +365,3 @@ locality_che: resource_type: resources.interuss.mock_uss.locality.LocalityResource specification: locality_code: CHE - -# ===== System versioning ===== - -uspace_system_identity: - $content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json - resource_type: resources.versioning.SystemIdentityResource - specification: - system_identity: uspace.ussp diff --git a/monitoring/uss_qualifier/configurations/dev/uspace.yaml b/monitoring/uss_qualifier/configurations/dev/uspace.yaml index eac7881a40..aa8c389757 100644 --- a/monitoring/uss_qualifier/configurations/dev/uspace.yaml +++ b/monitoring/uss_qualifier/configurations/dev/uspace.yaml @@ -4,7 +4,6 @@ v1: resources: resource_declarations: locality_che: {$ref: 'library/resources.yaml#/locality_che'} - uspace_system_identity: {$ref: 'library/resources.yaml#/uspace_system_identity'} che_conflicting_flights: {$ref: 'library/resources.yaml#/che_conflicting_flights'} che_invalid_flight_intents: {$ref: 'library/resources.yaml#/che_invalid_flight_intents'} che_invalid_flight_auth_flights: {$ref: 'library/resources.yaml#/che_invalid_flight_auth_flights'} @@ -41,7 +40,6 @@ v1: locality: locality_che version_providers: scd_version_providers - system_identity: uspace_system_identity conflicting_flights: che_conflicting_flights priority_preemption_flights: che_conflicting_flights @@ -67,7 +65,6 @@ v1: suite_type: suites.uspace.required_services resources: version_providers: version_providers - system_identity: system_identity conflicting_flights: conflicting_flights priority_preemption_flights: priority_preemption_flights diff --git a/monitoring/uss_qualifier/suites/definitions.py b/monitoring/uss_qualifier/suites/definitions.py index a7d73b67fd..21f0b8e8ce 100644 --- a/monitoring/uss_qualifier/suites/definitions.py +++ b/monitoring/uss_qualifier/suites/definitions.py @@ -11,7 +11,12 @@ from monitoring.uss_qualifier.reports.capability_definitions import ( ParticipantCapabilityDefinition, ) -from monitoring.uss_qualifier.resources.definitions import ResourceID, ResourceTypeName +from monitoring.uss_qualifier.resources.definitions import ( + ResourceID, + ResourceTypeName, + ResourceCollection, + ResourceDeclaration, +) from monitoring.uss_qualifier.scenarios.definitions import ( TestScenarioDeclaration, ) @@ -24,7 +29,7 @@ class TestSuiteDeclaration(ImplicitDict): suite_definition: Optional[TestSuiteDefinition] """Definition of test suite internal to the configuration -- specified instead of `suite_type`.""" - resources: Dict[ResourceID, ResourceID] + resources: Optional[Dict[ResourceID, ResourceID]] """Mapping of the ID a resource will be known by in the child test suite -> the ID a resource is known by in the parent test suite. The child suite resource is supplied by the parent suite resource . @@ -136,6 +141,9 @@ class TestSuiteDefinition(ImplicitDict): resources: Dict[ResourceID, ResourceTypeNameSpecifyingOptional] """Enumeration of the resources used by this test suite""" + local_resources: Optional[Dict[ResourceID, ResourceDeclaration]] + """Declarations of resources originating in this test suite.""" + actions: List[TestSuiteActionDeclaration] """The actions to take when running the test suite. Components will be executed in order.""" @@ -145,6 +153,17 @@ class TestSuiteDefinition(ImplicitDict): participant_verifiable_capabilities: Optional[List[ParticipantCapabilityDefinition]] """Definitions of capabilities verified by this test suite for individual participants.""" + def __init__(self, *args, **kwargs): + super(TestSuiteDefinition, self).__init__(*args, **kwargs) + inherits_resources = "resources" in self and self.resources + local_resources = "local_resources" in self and self.local_resources + if inherits_resources and local_resources: + for k in self.resources: + if k in self.local_resources: + raise ValueError( + f"Resource '{k}' found in both `resources` and `local_resources`; resource IDs must be unique" + ) + @staticmethod def load_from_declaration( declaration: TestSuiteDeclaration, diff --git a/monitoring/uss_qualifier/suites/suite.py b/monitoring/uss_qualifier/suites/suite.py index 79cedd14d9..3769a4b2d1 100644 --- a/monitoring/uss_qualifier/suites/suite.py +++ b/monitoring/uss_qualifier/suites/suite.py @@ -38,6 +38,7 @@ ResourceType, make_child_resources, MissingResourceError, + create_resources, ) from monitoring.uss_qualifier.scenarios.scenario import ( TestScenario, @@ -185,10 +186,18 @@ def __init__( self.declaration = declaration self.definition = TestSuiteDefinition.load_from_declaration(declaration) - self.local_resources = { - local_resource_id: resources[parent_resource_id] - for local_resource_id, parent_resource_id in declaration.resources.items() - } + if "resources" in declaration and declaration.resources: + self.local_resources = { + local_resource_id: resources[parent_resource_id] + for local_resource_id, parent_resource_id in declaration.resources.items() + } + else: + self.local_resources = {} + if "local_resources" in self.definition and self.definition.local_resources: + local_resources = create_resources(self.definition.local_resources) + for local_resource_id, resource in local_resources.items(): + self.local_resources[local_resource_id] = resource + for resource_id, resource_type in self.definition.resources.items(): is_optional = resource_type.endswith("?") if is_optional: diff --git a/monitoring/uss_qualifier/suites/uspace/required_services.yaml b/monitoring/uss_qualifier/suites/uspace/required_services.yaml index 3e22acf037..b03100497a 100644 --- a/monitoring/uss_qualifier/suites/uspace/required_services.yaml +++ b/monitoring/uss_qualifier/suites/uspace/required_services.yaml @@ -1,7 +1,6 @@ name: U-space required services resources: version_providers: resources.versioning.VersionProvidersResource - system_identity: resources.versioning.SystemIdentityResource conflicting_flights: resources.flight_planning.FlightIntentsResource priority_preemption_flights: resources.flight_planning.FlightIntentsResource @@ -19,6 +18,11 @@ resources: id_generator: resources.interuss.IDGeneratorResource service_area: resources.netrid.ServiceAreaResource problematically_big_area: resources.VerticesResource +local_resources: + system_identity: + resource_type: resources.versioning.SystemIdentityResource + specification: + system_identity: uspace.ussp actions: - test_scenario: scenario_type: scenarios.versioning.GetSystemVersions diff --git a/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDeclaration.json b/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDeclaration.json index aca1fbc705..b9f7ec300c 100644 --- a/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDeclaration.json +++ b/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDeclaration.json @@ -1,12 +1,30 @@ { + "$id": "https://github.com/interuss/monitoring/blob/main/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDeclaration.json", "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", + "description": "monitoring.uss_qualifier.suites.definitions.TestSuiteDeclaration, as defined in monitoring/uss_qualifier/suites/definitions.py", "properties": { "$ref": { - "type": "string", - "description": "Path to content that replaces the $ref" + "description": "Path to content that replaces the $ref", + "type": "string" + }, + "resources": { + "additionalProperties": { + "type": "string" + }, + "description": "Mapping of the ID a resource will be known by in the child test suite -> the ID a resource is known by in the parent test suite.\n\nThe child suite resource is supplied by the parent suite resource .", + "properties": { + "$ref": { + "description": "Path to content that replaces the $ref", + "type": "string" + } + }, + "type": [ + "object", + "null" + ] }, "suite_definition": { + "description": "Definition of test suite internal to the configuration -- specified instead of `suite_type`.", "oneOf": [ { "type": "null" @@ -14,33 +32,15 @@ { "$ref": "TestSuiteDefinition.json" } - ], - "description": "Definition of test suite internal to the configuration -- specified instead of `suite_type`." - }, - "resources": { - "type": "object", - "properties": { - "$ref": { - "type": "string", - "description": "Path to content that replaces the $ref" - } - }, - "additionalProperties": { - "type": "string" - }, - "description": "Mapping of the ID a resource will be known by in the child test suite -> the ID a resource is known by in the parent test suite.\n\nThe child suite resource is supplied by the parent suite resource ." + ] }, "suite_type": { + "description": "Type/location of test suite. Usually expressed as the file name of the suite definition (without extension) qualified relative to the `uss_qualifier` folder", "type": [ "string", "null" - ], - "description": "Type/location of test suite. Usually expressed as the file name of the suite definition (without extension) qualified relative to the `uss_qualifier` folder" + ] } }, - "$id": "https://github.com/interuss/monitoring/blob/main/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDeclaration.json", - "description": "monitoring.uss_qualifier.suites.definitions.TestSuiteDeclaration, as defined in monitoring/uss_qualifier/suites/definitions.py", - "required": [ - "resources" - ] + "type": "object" } \ No newline at end of file diff --git a/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDefinition.json b/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDefinition.json index dc091f2848..070c94d92e 100644 --- a/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDefinition.json +++ b/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDefinition.json @@ -1,16 +1,51 @@ { + "$id": "https://github.com/interuss/monitoring/blob/main/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDefinition.json", "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", + "description": "Schema for the definition of a test suite, analogous to the Python TestScenario subclass for scenarios\n\nmonitoring.uss_qualifier.suites.definitions.TestSuiteDefinition, as defined in monitoring/uss_qualifier/suites/definitions.py", "properties": { "$ref": { - "type": "string", - "description": "Path to content that replaces the $ref" + "description": "Path to content that replaces the $ref", + "type": "string" + }, + "actions": { + "description": "The actions to take when running the test suite. Components will be executed in order.", + "items": { + "$ref": "TestSuiteActionDeclaration.json" + }, + "type": "array" + }, + "local_resources": { + "additionalProperties": { + "$ref": "../../resources/definitions/ResourceDeclaration.json" + }, + "description": "Declarations of resources originating in this test suite.", + "properties": { + "$ref": { + "description": "Path to content that replaces the $ref", + "type": "string" + } + }, + "type": [ + "object", + "null" + ] }, "name": { - "type": "string", - "description": "Name of the test suite" + "description": "Name of the test suite", + "type": "string" + }, + "participant_verifiable_capabilities": { + "description": "Definitions of capabilities verified by this test suite for individual participants.", + "items": { + "$ref": "../../reports/capability_definitions/ParticipantCapabilityDefinition.json" + }, + "type": [ + "array", + "null" + ] }, "report_evaluation_scenario": { + "description": "The scenario executed after all the actions that evaluates the test suite report. Must be a ReportEvaluationScenario.", "oneOf": [ { "type": "null" @@ -18,45 +53,26 @@ { "$ref": "../../scenarios/definitions/TestScenarioDeclaration.json" } - ], - "description": "The scenario executed after all the actions that evaluates the test suite report. Must be a ReportEvaluationScenario." - }, - "participant_verifiable_capabilities": { - "type": [ - "array", - "null" - ], - "items": { - "$ref": "../../reports/capability_definitions/ParticipantCapabilityDefinition.json" - }, - "description": "Definitions of capabilities verified by this test suite for individual participants." + ] }, "resources": { - "type": "object", - "properties": { - "$ref": { - "type": "string", - "description": "Path to content that replaces the $ref" - } - }, "additionalProperties": { "type": "string" }, - "description": "Enumeration of the resources used by this test suite" - }, - "actions": { - "type": "array", - "items": { - "$ref": "TestSuiteActionDeclaration.json" + "description": "Enumeration of the resources used by this test suite", + "properties": { + "$ref": { + "description": "Path to content that replaces the $ref", + "type": "string" + } }, - "description": "The actions to take when running the test suite. Components will be executed in order." + "type": "object" } }, - "$id": "https://github.com/interuss/monitoring/blob/main/schemas/monitoring/uss_qualifier/suites/definitions/TestSuiteDefinition.json", - "description": "Schema for the definition of a test suite, analogous to the Python TestScenario subclass for scenarios\n\nmonitoring.uss_qualifier.suites.definitions.TestSuiteDefinition, as defined in monitoring/uss_qualifier/suites/definitions.py", "required": [ "actions", "name", "resources" - ] + ], + "type": "object" } \ No newline at end of file