diff options
Diffstat (limited to 'controlloop/templates/template.demo.clc/src/main')
3 files changed, 19 insertions, 21 deletions
diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java index aaa2a0a83..7abf38620 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/CallGuardTaskEmbedded.java @@ -20,6 +20,8 @@ package org.onap.policy.guard; +import com.att.research.xacml.api.DataTypeException; +import com.att.research.xacml.std.annotations.RequestParser; import java.util.HashSet; import java.util.Set; import java.util.UUID; @@ -27,8 +29,6 @@ import java.util.function.Supplier; import org.drools.core.WorkingMemory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.att.research.xacml.api.DataTypeException; -import com.att.research.xacml.std.annotations.RequestParser; public class CallGuardTaskEmbedded implements Runnable { @@ -36,14 +36,14 @@ public class CallGuardTaskEmbedded implements Runnable { /** * Actor/recipe pairs whose guard requests need a VF Module count. Each element is of - * the form "<actor>:<recipe>". + * the form "<actor>:<recipe>". */ private static final Set<String> NEEDS_VF_COUNT = new HashSet<>(); /** * Actor/recipe pairs whose guard requests need the VF Module count to be incremented * (i.e., because a module is being added). Each element is of the form - * "<actor>:<recipe>". + * "<actor>:<recipe>". */ private static final Set<String> INCR_VF_COUNT = new HashSet<>(); @@ -69,7 +69,8 @@ public class CallGuardTaskEmbedded implements Runnable { /** * Guard url is grabbed from PolicyEngine.manager properties */ - public CallGuardTaskEmbedded(WorkingMemory wm, String cl, String act, String rec, String tar, String reqId, Supplier<Integer> vfcnt) { + public CallGuardTaskEmbedded(WorkingMemory wm, String cl, String act, String rec, + String tar, String reqId, Supplier<Integer> vfcnt) { workingMemory = wm; clname = cl; actor = act; diff --git a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java index 947b187e4..e14946274 100644 --- a/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java +++ b/controlloop/templates/template.demo.clc/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelperEmbedded.java @@ -25,12 +25,8 @@ import com.att.research.xacml.api.AttributeCategory; import com.att.research.xacml.api.AttributeValue; import com.att.research.xacml.api.Result; import com.att.research.xacml.api.pdp.PDPEngine; -import com.att.research.xacml.api.pdp.PDPException; -import com.att.research.xacml.api.pdp.PDPEngineFactory; -import com.att.research.xacmlatt.pdp.ATTPDPEngineFactory; import com.att.research.xacml.std.annotations.RequestParser; - -import com.google.gson.Gson; +import com.att.research.xacmlatt.pdp.ATTPDPEngineFactory; import java.io.BufferedReader; import java.io.ByteArrayInputStream; @@ -52,8 +48,8 @@ import org.apache.commons.io.IOUtils; import org.apache.http.entity.ContentType; import org.json.JSONObject; import org.onap.policy.drools.system.PolicyEngine; -import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes; import org.onap.policy.guard.PolicyGuardResponse; +import org.onap.policy.guard.PolicyGuardXacmlRequestAttributes; import org.onap.policy.guard.Util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -152,7 +148,7 @@ public class PolicyGuardXacmlHelperEmbedded { * @param environment the Environment * @return response from guard which contains "Permit" or "Deny" */ - private String callRestfulPdp(InputStream is, URL restURL, String authorization, String clientauth, + private String callRestfulPdp(InputStream is, URL restUrl, String authorization, String clientauth, String environment) { HttpURLConnection connection = null; @@ -160,7 +156,7 @@ public class PolicyGuardXacmlHelperEmbedded { // // Open up the connection // - connection = (HttpURLConnection) restURL.openConnection(); + connection = (HttpURLConnection) restUrl.openConnection(); connection.setRequestProperty("Content-Type", "application/json"); // // Setup our method and headers @@ -202,7 +198,7 @@ public class PolicyGuardXacmlHelperEmbedded { connection.connect(); if (connection.getResponseCode() != 200) { - logger.error(connection.getResponseCode() + " " + connection.getResponseMessage()); + logger.error("{} {}", connection.getResponseCode(), connection.getResponseMessage()); return Util.INDETERMINATE; } } catch (Exception e) { @@ -266,7 +262,7 @@ public class PolicyGuardXacmlHelperEmbedded { // // Embedded call to PDP // - long lTimeStart = System.currentTimeMillis(); + long timeStart = System.currentTimeMillis(); if (xacmlReq.getVfCount() == null ) { xacmlReq.setVfCount(1); } @@ -275,8 +271,8 @@ public class PolicyGuardXacmlHelperEmbedded { } catch (Exception e) { logger.error(e.getMessage(), e); } - long lTimeEnd = System.currentTimeMillis(); - logger.debug("Elapsed Time: {} ms", (lTimeEnd - lTimeStart)); + long timeEnd = System.currentTimeMillis(); + logger.debug("Elapsed Time: {} ms", (timeEnd - timeStart)); // // Convert response to string // diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl index 3981f0def..15de89850 100644 --- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl +++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl @@ -32,7 +32,7 @@ import org.onap.policy.controlloop.policy.Policy; import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager; import org.onap.policy.controlloop.eventmanager.ControlLoopEventManager.NEW_EVENT_STATUS; import org.onap.policy.controlloop.eventmanager.ControlLoopOperationManager; -import org.onap.policy.controlloop.actor.so.SOActorServiceProvider; +import org.onap.policy.controlloop.actor.so.SoActorServiceProvider; import org.onap.policy.aai.AaiNqResponseWrapper; import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; @@ -577,12 +577,13 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED" } break; case "SO": - // at this point the AAI named query request should have already been made, the response recieved and used - // in the construction of the SO Request which is stored in operationRequest + // at this point the AAI named query request should have already been made, the response received + // and used in the construction of the SO Request which is stored in operationRequest if(request instanceof SORequest) { // Call SO. The response will be inserted into memory once it's received - SOActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), request); + SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(), + request); } break; case "VFC": |