- /**
- * Ensures that A&AI custom query has been performed, and then runs the guard.
- */
- @Override
- @SuppressWarnings("unchecked")
- protected CompletableFuture<OperationOutcome> startPreprocessorAsync() {
- if (params.isPreprocessed()) {
- return null;
- }
-
- // need the VF count
- ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME)
- .operation(AaiCqResponse.OPERATION).payload(null).retry(null).timeoutSec(null).build();
-
- // run Custom Query, extract the VF count, and then run the Guard
-
- // @formatter:off
- return sequence(() -> params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams),
- this::obtainVfCount, this::startGuardAsync);
- // @formatter:on
- }
-
- @Override
- protected Map<String, Object> makeGuardPayload() {
- Map<String, Object> payload = super.makeGuardPayload();
-
- // run guard with the proposed vf count
- payload.put(PAYLOAD_KEY_VF_COUNT, getVfCount() + 1);
-
- return payload;
- }
-