summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java13
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java4
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml4
-rw-r--r--src/test/resources/http-cache/example/policy/api/v1/policytypes?connectionTimeToLive=5000/.file12
4 files changed, 14 insertions, 19 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java
index 44abc9dde..23586712a 100644
--- a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java
@@ -27,12 +27,10 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.ExchangeBuilder;
@@ -118,15 +116,12 @@ public class PolicyEngineServices {
return;
}
- List<LinkedHashMap<String, Object>> policyTypesList = (List<LinkedHashMap<String, Object>>) loadedYaml
+ LinkedHashMap<String, Object> policyTypesMap = (LinkedHashMap<String, Object>) loadedYaml
.get("policy_types");
- policyTypesList.parallelStream().forEach(policyType -> {
- Map.Entry<String, Object> policyTypeEntry =
- (Map.Entry<String, Object>) new ArrayList(policyType.entrySet()).get(0);
-
+ policyTypesMap.entrySet().parallelStream().forEach(entryPolicyType -> {
policyModelsService.createPolicyInDbIfNeeded(
- createPolicyModelFromPolicyEngine(policyTypeEntry.getKey(),
- ((String) ((LinkedHashMap<String, Object>) policyTypeEntry.getValue()).get("version"))));
+ createPolicyModelFromPolicyEngine(entryPolicyType.getKey(),
+ ((String) ((LinkedHashMap<String, Object>) entryPolicyType.getValue()).get("version"))));
});
}
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
index 47b3a4ff2..b3bd7e88a 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroServicePolicy.java
@@ -152,8 +152,8 @@ public class MicroServicePolicy extends Policy implements Serializable {
@Override
public void updateJsonRepresentation(ToscaConverterWithDictionarySupport toscaConverter) {
- toscaConverter.convertToscaToJsonSchemaObject(this.getPolicyModel().getPolicyModelTosca(),
- this.getPolicyModel().getPolicyModelType());
+ this.setJsonRepresentation(toscaConverter.convertToscaToJsonSchemaObject(this.getPolicyModel().getPolicyModelTosca(),
+ this.getPolicyModel().getPolicyModelType()));
}
public Boolean getShared() {
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
index 48e518da9..7b52f220d 100644
--- a/src/main/resources/clds/camel/routes/policy-flows.xml
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -138,7 +138,7 @@
</simple>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to get all policy models: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes"></log>
+ message="Endpoint to get all policy models: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes"></log>
<toD
uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
@@ -172,7 +172,7 @@
</simple>
</setHeader>
<log loggingLevel="INFO"
- message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log>
+ message="Endpoint to get policy model: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log>
<toD
uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
diff --git a/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file b/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file
index 0cce9c3d9..6f24f3ca6 100644
--- a/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file
+++ b/src/test/resources/http-cache/example/policy/api/v1/policytypes&#63;connectionTimeToLive=5000/.file
@@ -1,34 +1,34 @@
-tosca_definitions_version: tosca_simple_yaml_1_0_0
+tosca_definitions_version: tosca_simple_yaml_1_1_0
policy_types:
- - onap.policies.controlloop.operational.common.Drools:
+ onap.policies.controlloop.operational.common.Drools:
version: 1.0.0
description: Operational Policy for Control Loops using the Drools PDP
derived_from: onapy.policies.controlloop.Operational
properties:
# Omitted for brevity, see Section 1
- - onap.policies.controlloop.operational.common.Apex:
+ onap.policies.controlloop.operational.common.Apex:
version: 1.0.0
description: Operational Policy for Control Loops using the APEX PDP
derived_from: onap.policies.controlloop.Operational
properties:
# Omitted for brevity, see Section 1
- - onap.policies.controlloop.guard.common.FrequencyLimiter:
+ onap.policies.controlloop.guard.common.FrequencyLimiter:
version: 1.0.0
description: Supports limiting the frequency of actions being taken by a Actor.
derived_from: onap.policies.controlloop.Guard
properties:
# Omitted for brevity, see Section 1
- - onap.policies.controlloop.guard.common.Blacklist:
+ onap.policies.controlloop.guard.common.Blacklist:
version: 1.0.0
description: Supports blacklist of VNF's from performing control loop actions on.
derived_from: onap.policies.controlloop.Guard
properties:
# Omitted for brevity, see Section 1
- - onap.policies.controlloop.guard.common.MinMax:
+ onap.policies.controlloop.guard.common.MinMax:
version: 2.0.0
description: Supports Min/Max number of VF Modules
derived_from: onap.policies.controlloop.Guard