Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[uss_qualifier] Migrate test_isa_validation prober to the new qualifier #238

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monitoring/prober/infrastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def wrapper_default_scope(*args, **kwargs):
resource_type_code_descriptions: Dict[ResourceType, str] = {}


# Next code: 368
# Next code: 369
def register_resource_type(code: int, description: str) -> ResourceType:
"""Register that the specified code refers to the described resource.
Expand Down
15 changes: 15 additions & 0 deletions monitoring/uss_qualifier/configurations/dev/library/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ net_rid:
reference_time: '2023-01-10T00:00:00.123456+00:00'
time_start: '2023-01-10T00:00:01.123456+00:00'
time_end: '2023-01-10T01:00:01.123456+00:00'
problematically_big_area: # A huge (as in "too big") area for checks around area sizes
$content_schema: monitoring/uss_qualifier/resources/definitions/ResourceDeclaration.json
resource_type: resources.VerticesResource
specification:
vertices:
- lat: -23
lng: 130
- lat: -24
lng: 130
- lat: -24
lng: 132
- lat: -23
lng: 132



net_rid_sims:
adjacent_circular_flights_data:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ v1:
dss_instances: netrid_dss_instances_v19
id_generator: id_generator
service_area: service_area
problematically_big_area: problematically_big_area
artifacts:
report:
report_path: output/report_netrid_v19.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ v1:
dss_instances: netrid_dss_instances_v22a
id_generator: id_generator
service_area: service_area
problematically_big_area: problematically_big_area
artifacts:
report:
report_path: output/report_netrid_v22a.json
Expand Down
1 change: 1 addition & 0 deletions monitoring/uss_qualifier/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .vertices import VerticesResource
21 changes: 21 additions & 0 deletions monitoring/uss_qualifier/resources/vertices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import List

from implicitdict import ImplicitDict

from monitoring.monitorlib.geo import LatLngPoint
from monitoring.uss_qualifier.resources.resource import Resource


class VerticesSpecification(ImplicitDict):
"""Specifies a list of vertices representing a 2D area.
Useful for passing arbitrary areas to test scenarios."""

vertices: List[LatLngPoint]
"""Represents a 2D area"""


class VerticesResource(Resource[VerticesSpecification]):
specification: VerticesSpecification

def __init__(self, specification: VerticesSpecification):
self.specification = specification
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@
from monitoring.uss_qualifier.resources.astm.f3411.dss import DSSInstanceResource
from monitoring.uss_qualifier.resources.interuss.id_generator import IDGeneratorResource
from monitoring.uss_qualifier.resources.netrid.service_area import ServiceAreaResource
from monitoring.uss_qualifier.resources import VerticesResource
from monitoring.uss_qualifier.scenarios.astm.netrid.dss_wrapper import DSSWrapper
from monitoring.uss_qualifier.scenarios.scenario import GenericTestScenario

HUGE_VERTICES: List[s2sphere.LatLng] = [
s2sphere.LatLng.from_degrees(lng=130, lat=-23),
s2sphere.LatLng.from_degrees(lng=130, lat=-24),
s2sphere.LatLng.from_degrees(lng=132, lat=-24),
s2sphere.LatLng.from_degrees(lng=132, lat=-23),
]


class ISASimple(GenericTestScenario):
"""Based on prober/rid/v2/test_isa_simple.py from the legacy prober tool."""

ISA_TYPE = register_resource_type(348, "ISA")

_huge_are: List[s2sphere.LatLng]

def __init__(
self,
dss: DSSInstanceResource,
id_generator: IDGeneratorResource,
isa: ServiceAreaResource,
problematically_big_area: VerticesResource,
):
super().__init__()
self._dss = (
Expand All @@ -46,6 +43,9 @@ def __init__(
self._isa_start_time = self._isa.shifted_time_start(now)
self._isa_end_time = self._isa.shifted_time_end(now)
self._isa_area = [vertex.as_s2sphere() for vertex in self._isa.footprint]
self._huge_area = [
v.as_s2sphere() for v in problematically_big_area.specification.vertices
]

def run(self):
self.begin_test_scenario()
Expand Down Expand Up @@ -362,7 +362,7 @@ def _search_huge_area_step():
_ = self._dss_wrapper.search_isas_expect_response_code(
check,
expected_error_codes={413},
area=HUGE_VERTICES,
area=self._huge_area,
)

self.end_test_step()
Expand Down
Loading
Loading