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/netrid/dss/isa_simple] Implement update and delete cases #202

Merged
merged 15 commits into from
Sep 23, 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
16 changes: 10 additions & 6 deletions monitoring/monitorlib/fetch/rid.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,19 +851,23 @@ def has_different_content_than(self, other: Any) -> bool:

def isas(
area: List[s2sphere.LatLng],
start_time: datetime.datetime,
end_time: datetime.datetime,
start_time: Optional[datetime.datetime],
end_time: Optional[datetime.datetime],
rid_version: RIDVersion,
session: UTMClientSession,
dss_base_url: str = "",
server_id: Optional[str] = None,
) -> FetchedISAs:
t0 = rid_version.format_time(start_time)
t1 = rid_version.format_time(end_time)
url_time_params = ""
if start_time is not None:
url_time_params += f"&earliest_time={rid_version.format_time(start_time)}"
if end_time is not None:
url_time_params += f"&latest_time={rid_version.format_time(end_time)}"

if rid_version == RIDVersion.f3411_19:
op = v19.api.OPERATIONS[v19.api.OperationID.SearchIdentificationServiceAreas]
area = rid_v1.geo_polygon_string_from_s2(area)
url = f"{dss_base_url}{op.path}?area={area}&earliest_time={t0}&latest_time={t1}"
url = f"{dss_base_url}{op.path}?area={area}{url_time_params}"
return FetchedISAs(
v19_query=fetch.query_and_describe(
session,
Expand All @@ -876,7 +880,7 @@ def isas(
elif rid_version == RIDVersion.f3411_22a:
op = v22a.api.OPERATIONS[v22a.api.OperationID.SearchIdentificationServiceAreas]
area = rid_v2.geo_polygon_string_from_s2(area)
url = f"{dss_base_url}{op.path}?area={area}&earliest_time={t0}&latest_time={t1}"
url = f"{dss_base_url}{op.path}?area={area}{url_time_params}"
return FetchedISAs(
v22a_query=fetch.query_and_describe(
session,
Expand Down
18 changes: 18 additions & 0 deletions monitoring/monitorlib/rid.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ def openapi_flight_details_response_path(self) -> str:
else:
raise ValueError(f"Unsupported RID version '{self}'")

@property
def openapi_search_isas_response_path(self) -> str:
if self == RIDVersion.f3411_19:
return schema_validation.F3411_19.SearchIdentificationServiceAreasResponse
elif self == RIDVersion.f3411_22a:
return schema_validation.F3411_22a.SearchIdentificationServiceAreasResponse
else:
raise ValueError(f"Unsupported RID version '{self}'")

@property
def openapi_put_isa_response_path(self) -> str:
if self == RIDVersion.f3411_19:
Expand All @@ -57,6 +66,15 @@ def openapi_put_isa_response_path(self) -> str:
else:
raise ValueError(f"Unsupported RID version '{self}'")

@property
def openapi_delete_isa_response_path(self) -> str:
if self == RIDVersion.f3411_19:
return schema_validation.F3411_19.DeleteIdentificationServiceAreaResponse
elif self == RIDVersion.f3411_22a:
return schema_validation.F3411_22a.DeleteIdentificationServiceAreaResponse
else:
raise ValueError(f"Unsupported RID version '{self}'")

@property
def realtime_period(self) -> timedelta:
if self == RIDVersion.f3411_19:
Expand Down
12 changes: 12 additions & 0 deletions monitoring/monitorlib/schema_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,30 @@ class F3411_19(str, Enum):
OpenAPIPath = "interfaces/rid/v1/remoteid/augmented.yaml"
GetFlightsResponse = "components.schemas.GetFlightsResponse"
GetFlightDetailsResponse = "components.schemas.GetFlightDetailsResponse"
SearchIdentificationServiceAreasResponse = (
"components.schemas.SearchIdentificationServiceAreasResponse"
)
PutIdentificationServiceAreaResponse = (
"components.schemas.PutIdentificationServiceAreaResponse"
)
DeleteIdentificationServiceAreaResponse = (
"components.schemas.DeleteIdentificationServiceAreaResponse"
)


class F3411_22a(str, Enum):
OpenAPIPath = "interfaces/rid/v2/remoteid/updated.yaml"
GetFlightsResponse = "components.schemas.GetFlightsResponse"
GetFlightDetailsResponse = "components.schemas.GetFlightDetailsResponse"
SearchIdentificationServiceAreasResponse = (
"components.schemas.SearchIdentificationServiceAreasResponse"
)
PutIdentificationServiceAreaResponse = (
"components.schemas.PutIdentificationServiceAreaResponse"
)
DeleteIdentificationServiceAreaResponse = (
"components.schemas.DeleteIdentificationServiceAreaResponse"
)


class F3548_21(str, Enum):
Expand Down
Loading