Skip to content

Commit

Permalink
[uss_qualifier] have f3548/v21/dss.py rely on standard constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Shastick committed Dec 13, 2023
1 parent 5dadffb commit 9a7acd5
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions monitoring/uss_qualifier/resources/astm/f3548/v21/dss.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
SetUssAvailabilityStatusParameters,
UssAvailabilityState,
UssAvailabilityStatusResponse,
GetOperationalIntentReferenceResponse,
GetOperationalIntentReferenceResponse, OPERATIONS, OperationID,
)

# A base URL for a USS that is not expected to be ever called
Expand Down Expand Up @@ -77,12 +77,12 @@ def __init__(
def find_op_intent(
self, extent: Volume4D
) -> Tuple[List[OperationalIntentReference], fetch.Query]:
url = "/dss/v1/operational_intent_references/query"
op = OPERATIONS[OperationID.QueryOperationalIntentReferences]
req = QueryOperationalIntentReferenceParameters(area_of_interest=extent)
query = fetch.query_and_describe(
self.client,
"POST",
url,
op.verb,
op.path,
QueryType.F3548v21DSSQueryOperationalIntentReferences,
self.participant_id,
scope=SCOPE_SC,
Expand All @@ -103,11 +103,11 @@ def get_op_intent_reference(
"""
Retrieve an OP Intent from the DSS, using only its ID
"""
url = f"/dss/v1/operational_intent_references/{op_intent_id}"
op = OPERATIONS[OperationID.GetOperationalIntentReference]
query = fetch.query_and_describe(
self.client,
"GET",
url,
op.verb,
op.path.format(entityid=op_intent_id),
QueryType.F3548v21DSSGetOperationalIntentReference,
self.participant_id,
scope=SCOPE_SC,
Expand All @@ -125,11 +125,11 @@ def get_full_op_intent(
op_intent_ref: OperationalIntentReference,
uss_participant_id: Optional[str] = None,
) -> Tuple[OperationalIntent, fetch.Query]:
url = f"{op_intent_ref.uss_base_url}/uss/v1/operational_intents/{op_intent_ref.id}"
op = OPERATIONS[OperationID.GetOperationalIntentDetails]
query = fetch.query_and_describe(
self.client,
"GET",
url,
op.verb,
f"{op_intent_ref.uss_base_url}{op.path.format(entityid=op_intent_ref.id)}",
QueryType.F3548v21USSGetOperationalIntentDetails,
uss_participant_id,
scope=SCOPE_SC,
Expand Down Expand Up @@ -157,10 +157,12 @@ def put_op_intent(
]:
oi_uuid = str(uuid.uuid4()) if id is None else id
if ovn is None:
url = f"/dss/v1/operational_intent_references/{oi_uuid}"
op = OPERATIONS[OperationID.CreateOperationalIntentReference]
url = op.path.format(entityid=oi_uuid)
query_type = QueryType.F3548v21DSSCreateOperationalIntentReference
else:
url = f"/dss/v1/operational_intent_references/{oi_uuid}/{ovn}"
op = OPERATIONS[OperationID.UpdateOperationalIntentReference]
url = op.path.format(entityid=oi_uuid, ovn=ovn)
query_type = QueryType.F3548v21DSSUpdateOperationalIntentReference

req = PutOperationalIntentReferenceParameters(
Expand All @@ -172,7 +174,7 @@ def put_op_intent(
)
query = fetch.query_and_describe(
self.client,
"PUT",
op.verb,
url,
query_type,
self.participant_id,
Expand All @@ -198,10 +200,11 @@ def delete_op_intent(
Optional[List[SubscriberToNotify]],
fetch.Query,
]:
op = OPERATIONS[OperationID.DeleteOperationalIntentReference]
query = fetch.query_and_describe(
self.client,
"DELETE",
f"/dss/v1/operational_intent_references/{id}/{ovn}",
op.verb,
op.path.format(entityid=id, ovn=ovn),
QueryType.F3548v21DSSDeleteOperationalIntentReference,
self.participant_id,
scope=SCOPE_SC,
Expand Down Expand Up @@ -237,10 +240,11 @@ def set_uss_availability(
old_version=version,
availability=availability,
)
op = OPERATIONS[OperationID.SetUssAvailability]
query = fetch.query_and_describe(
self.client,
"PUT",
f"/dss/v1/uss_availability/{uss_id}",
op.verb,
op.path.format(uss_id=uss_id),
QueryType.F3548v21DSSSetUssAvailability,
self.participant_id,
scope=SCOPE_AA,
Expand Down

0 comments on commit 9a7acd5

Please sign in to comment.