@@ -90,47 +90,38 @@ def validate_request(op_intent: f3548_v21.OperationalIntent) -> None:
9090 )
9191
9292
93- def check_for_local_conflits (
94- op_intent : f3548_v21 .OperationalIntent , flights : list [FlightRecord ]
93+ def conflicts_with_flightrecords (
94+ op_intent : f3548_v21 .OperationalIntent , flights : list [FlightRecord | None ]
9595) -> bool :
9696 """
97- Return true if an OperationalIntent conflict with any of existing flights
97+ Return true if the OperationalIntent conflicts with (intersects) any of the specified FlightRecords that do not
98+ correspond with op_intent.
9899 """
99100
100- if op_intent .reference .state not in (
101- scd_api .OperationalIntentState .Accepted ,
102- scd_api .OperationalIntentState .Activated ,
103- ):
104- # No conflicts are disallowed if the flight is not nominal
105- return False
106-
107- v1 = Volume4DCollection .from_f3548v21 (
101+ vc1 = Volume4DCollection .from_f3548v21 (
108102 (op_intent .details .volumes or [])
109103 + (op_intent .details .off_nominal_volumes or [])
110104 )
111105
112106 for other_flight in flights :
113- if other_flight .op_intent .reference .state not in (
114- scd_api .OperationalIntentState .Accepted ,
115- scd_api .OperationalIntentState .Activated ,
116- ):
107+ if not other_flight :
117108 continue
118109
119110 if other_flight .op_intent .reference .id == op_intent .reference .id : # Same flight
120111 continue
121112
122- v2 = Volume4DCollection .from_f3548v21 (
113+ vc2 = Volume4DCollection .from_f3548v21 (
123114 (other_flight .op_intent .details .volumes or [])
124115 + (other_flight .op_intent .details .off_nominal_volumes or [])
125116 )
126117
127- if v1 .intersects_vol4s (v2 ):
118+ if vc1 .intersects_vol4s (vc2 ):
128119 return True
129120
130121 return False
131122
132123
133- def check_for_disallowed_conflicts (
124+ def check_for_conflicts (
134125 new_op_intent : f3548_v21 .OperationalIntent ,
135126 existing_flight : FlightRecord | None ,
136127 op_intents : list [f3548_v21 .OperationalIntent ],
@@ -162,7 +153,7 @@ def log(msg):
162153
163154 v1 = Volume4DCollection .from_interuss_scd_api (new_op_intent .details .volumes )
164155
165- found_conflict = False
156+ allowed_conflict = False
166157
167158 for op_intent in op_intents :
168159 if (
@@ -182,18 +173,18 @@ def log(msg):
182173 old_priority = priority_of (op_intent .details )
183174 if new_priority > old_priority :
184175 log (
185- f"intersection with { op_intent .reference .id } not considered : intersection with lower-priority operational intents"
176+ f"intersection with { op_intent .reference .id } allowed : intersection with lower-priority operational intents"
186177 )
187178
188- found_conflict |= v1 .intersects_vol4s (v2 )
179+ allowed_conflict |= v1 .intersects_vol4s (v2 )
189180 continue
190181 if new_priority == old_priority and locality .allows_same_priority_intersections (
191182 old_priority
192183 ):
193184 log (
194- f"intersection with { op_intent .reference .id } not considered : intersection with same-priority operational intents (if allowed)"
185+ f"intersection with { op_intent .reference .id } allowed : intersection with same-priority operational intents (if allowed)"
195186 )
196- found_conflict |= v1 .intersects_vol4s (v2 )
187+ allowed_conflict |= v1 .intersects_vol4s (v2 )
197188 continue
198189
199190 modifying_activated = (
@@ -208,7 +199,7 @@ def log(msg):
208199 ).intersects_vol4s (v2 )
209200 if preexisting_conflict :
210201 log (
211- f"intersection with { op_intent .reference .id } not considered : modification of Activated operational intent with a pre-existing conflict"
202+ f"intersection with { op_intent .reference .id } allowed : modification of Activated operational intent with a pre-existing conflict"
212203 )
213204 continue
214205
@@ -217,7 +208,7 @@ def log(msg):
217208 f"Requested flight (priority { new_priority } ) intersected { op_intent .reference .manager } 's operational intent { op_intent .reference .id } (priority { old_priority } )"
218209 )
219210
220- return found_conflict
211+ return allowed_conflict
221212
222213
223214def op_intent_transition_valid (
@@ -490,7 +481,7 @@ def get_down_uss_op_intent(
490481
491482 Note: This function will populate volumes (for accepted or activated states) and off_nominal_volumes (for contingent
492483 and non-conforming states) with the area of interest that was requested. The reason is that later on the function
493- `check_for_disallowed_conflicts ` will need to evaluate again those conflicts to determine pre-existing conflicts.
484+ `check_for_conflicts ` will need to evaluate again those conflicts to determine pre-existing conflicts.
494485 TODO: A better approach to this issue would be to store the area in conflict when a flight is planned with a
495486 conflict, that way we can just retrieve the conflicting area instead of having to compute again the intersection
496487 between the flight to be planned and the conflicting operational intent.
@@ -586,7 +577,7 @@ def check_op_intent(
586577 log (
587578 f"Checking for intersections with { ', ' .join (op_intent .reference .id for op_intent in op_intents )} "
588579 )
589- has_conflicts = check_for_disallowed_conflicts (
580+ has_conflicts = check_for_conflicts (
590581 new_flight .op_intent , existing_flight , op_intents , locality , log
591582 )
592583
@@ -707,11 +698,7 @@ def notify_subscribers(
707698 :return: Notification errors if any, by subscriber.
708699 """
709700 notif_errors : dict [f3548_v21 .SubscriptionUssBaseURL , Exception ] = {}
710- base_url = f"{ webapp .config [KEY_BASE_URL ]} /mock/scd"
711701 for subscriber in subscribers :
712- if subscriber .uss_base_url == base_url :
713- # Do not notify ourselves
714- continue
715702 update = f3548_v21 .PutOperationalIntentDetailsParameters (
716703 operational_intent_id = op_intent_id ,
717704 operational_intent = op_intent ,
0 commit comments