- /**
- * Starts the GUARD.
- */
- @Override
- protected CompletableFuture<OperationOutcome> startPreprocessorAsync() {
- return startGuardAsync();
- }
-
- /**
- * Gets the VF Count.
- *
- * @return a future to cancel or await the VF Count
- */
- @SuppressWarnings("unchecked")
- protected CompletableFuture<OperationOutcome> obtainVfCount() {
- if (params.getContext().contains(vfCountKey)) {
- // already have the VF count
- return null;
- }
-
- // need custom query from which to extract the VF count
- ControlLoopOperationParams cqParams = params.toBuilder().actor(AaiConstants.ACTOR_NAME)
- .operation(AaiCqResponse.OPERATION).payload(null).retry(null).timeoutSec(null).build();
-
- // run Custom Query and then extract the VF count
- return sequence(() -> params.getContext().obtain(AaiCqResponse.CONTEXT_KEY, cqParams), this::storeVfCount);
- }
-
- /**
- * Stores the VF count.
- *
- * @return {@code null}
- */
- private CompletableFuture<OperationOutcome> storeVfCount() {
- if (!params.getContext().contains(vfCountKey)) {
- AaiCqResponse cq = params.getContext().getProperty(AaiCqResponse.CONTEXT_KEY);
- int vfcount = cq.getVfModuleCount(modelCustomizationId, modelInvariantId, modelVersionId);
-
- params.getContext().setProperty(vfCountKey, vfcount);
- }
-
- return null;
- }
-