summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2021-01-20 23:02:17 +0100
committerS�bastien Determe <sebastien.determe@intl.att.com>2021-01-22 08:44:46 +0000
commit078c34d0c2e439d8a148a2cd4d7545c6b7f56acb (patch)
tree3d411614b9af6b738e4289d686dd050bd61f7b1e /src/main
parentdabd6db614abf78508add7cdbef2120120ce3d9b (diff)
First integration of Policy model PdpGroups
Replacement of the PdpGroups clamp code by the one from policy model dependency. Issue-ID: POLICY-2924 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I12c77704bba1c769dc2f307d91b759a3b645013f Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/docker/frontend/nginx/default.conf2
-rw-r--r--src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java20
-rw-r--r--src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java58
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java92
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java94
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java56
-rw-r--r--src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java125
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml38
8 files changed, 161 insertions, 324 deletions
diff --git a/src/main/docker/frontend/nginx/default.conf b/src/main/docker/frontend/nginx/default.conf
index b15429c74..570806034 100644
--- a/src/main/docker/frontend/nginx/default.conf
+++ b/src/main/docker/frontend/nginx/default.conf
@@ -6,7 +6,7 @@ server {
ssl_certificate_key /etc/ssl/clamp.key;
ssl_verify_client optional_no_ca;
location /restservices/clds/ {
- proxy_pass https://clamp-backend:8443;
+ proxy_pass https://policy-clamp-backend:8443;
proxy_set_header X-SSL-Cert $ssl_client_escaped_cert;
}
diff --git a/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java b/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java
index bc6a68286..46c55ea45 100644
--- a/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java
+++ b/src/main/java/org/onap/policy/clamp/clds/client/PolicyEngineServices.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -39,7 +39,8 @@ import org.onap.policy.clamp.clds.sdc.controller.installer.BlueprintMicroService
import org.onap.policy.clamp.clds.util.JsonUtils;
import org.onap.policy.clamp.loop.template.PolicyModel;
import org.onap.policy.clamp.loop.template.PolicyModelsService;
-import org.onap.policy.clamp.policy.pdpgroup.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.DumperOptions;
@@ -50,6 +51,8 @@ import org.yaml.snakeyaml.Yaml;
* The class implements the communication with the Policy Engine to retrieve
* policy models (tosca). It mainly delegates the physical calls to Camel
* engine.
+ * It supports a retry mechanism for these calls, configurations can be specified in the
+ * application.properties "policy.retry.interval"(default 0) and "policy.retry.limit"(default 1).
*/
@Component
public class PolicyEngineServices {
@@ -192,18 +195,7 @@ public class PolicyEngineServices {
return;
}
- JsonObject jsonObj = JsonUtils.GSON.fromJson(responseBody, JsonObject.class);
-
- List<PdpGroup> pdpGroupList = new LinkedList<>();
- JsonArray itemsArray = (JsonArray) jsonObj.get("groups");
-
- for (com.google.gson.JsonElement jsonElement : itemsArray) {
- JsonObject item = (JsonObject) jsonElement;
- PdpGroup pdpGroup = JsonUtils.GSON.fromJson(item.toString(), PdpGroup.class);
- pdpGroupList.add(pdpGroup);
- }
-
- policyModelsService.updatePdpGroupInfo(pdpGroupList);
+ policyModelsService.updatePdpGroupInfo(JsonUtils.GSON.fromJson(responseBody, PdpGroups.class));
}
private String callCamelRoute(Exchange exchange, String camelFlow, String logMsg) {
diff --git a/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java b/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java
index 8670ab73e..f0830360e 100644
--- a/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java
+++ b/src/main/java/org/onap/policy/clamp/loop/template/PolicyModelsService.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
+ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,13 +30,18 @@ import java.util.Collections;
import java.util.List;
import org.onap.policy.clamp.clds.tosca.ToscaSchemaConstants;
import org.onap.policy.clamp.clds.tosca.ToscaYamlToJsonConvertor;
-import org.onap.policy.clamp.policy.pdpgroup.PdpGroup;
+import org.onap.policy.clamp.policy.pdpgroup.PdpGroupsAnalyzer;
import org.onap.policy.clamp.util.SemanticVersioning;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
+/**
+ * This class contains the methods to access the policyModel object in db.
+ */
@Service
public class PolicyModelsService {
private final PolicyModelsRepository policyModelsRepository;
@@ -44,7 +49,7 @@ public class PolicyModelsService {
@Autowired
public PolicyModelsService(PolicyModelsRepository policyModelrepo,
- ToscaYamlToJsonConvertor convertor) {
+ ToscaYamlToJsonConvertor convertor) {
policyModelsRepository = policyModelrepo;
toscaYamlToJsonConvertor = convertor;
}
@@ -78,31 +83,31 @@ public class PolicyModelsService {
public PolicyModel createNewPolicyModelFromTosca(String policyModelTosca) {
JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(policyModelTosca);
String policyModelTypeFromTosca = toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
- ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE);
+ ToscaSchemaConstants.METADATA_POLICY_MODEL_TYPE);
Iterable<PolicyModel> models = getAllPolicyModelsByType(policyModelTypeFromTosca);
Collections.sort((List<PolicyModel>) models);
PolicyModel newPolicyModel = new PolicyModel(policyModelTypeFromTosca, policyModelTosca,
- SemanticVersioning.incrementMajorVersion(((ArrayList) models).isEmpty() ? null
- : ((ArrayList<PolicyModel>) models).get(0).getVersion()),
- toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
- ToscaSchemaConstants.METADATA_ACRONYM));
+ SemanticVersioning.incrementMajorVersion(((ArrayList) models).isEmpty() ? null
+ : ((ArrayList<PolicyModel>) models).get(0).getVersion()),
+ toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
+ ToscaSchemaConstants.METADATA_ACRONYM));
return saveOrUpdatePolicyModel(newPolicyModel);
}
/**
* Update an existing Tosca Policy Model.
*
- * @param policyModelType The policy Model type in Tosca yaml
+ * @param policyModelType The policy Model type in Tosca yaml
* @param policyModelVersion The policy Version to update
- * @param policyModelTosca The Policy Model tosca
+ * @param policyModelTosca The Policy Model tosca
* @return The Policy Model updated
*/
public PolicyModel updatePolicyModelTosca(String policyModelType, String policyModelVersion,
- String policyModelTosca) {
+ String policyModelTosca) {
JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(policyModelTosca);
PolicyModel thePolicyModel = getPolicyModel(policyModelType, policyModelVersion);
thePolicyModel.setPolicyAcronym(toscaYamlToJsonConvertor.getValueFromMetadata(jsonObject,
- ToscaSchemaConstants.METADATA_ACRONYM));
+ ToscaSchemaConstants.METADATA_ACRONYM));
thePolicyModel.setPolicyModelTosca(policyModelTosca);
return saveOrUpdatePolicyModel(thePolicyModel);
}
@@ -126,13 +131,13 @@ public class PolicyModelsService {
/**
* Retrieves the Tosca model Yaml string.
*
- * @param type The Policy Model Type
+ * @param type The Policy Model Type
* @param version The policy model version
* @return The Tosca model Yaml string
*/
public String getPolicyModelTosca(String type, String version) {
return policyModelsRepository.findById(new PolicyModelId(type, version))
- .orElse(new PolicyModel()).getPolicyModelTosca();
+ .orElse(new PolicyModel()).getPolicyModelTosca();
}
/**
@@ -148,26 +153,11 @@ public class PolicyModelsService {
/**
* Update the Pdp Group info in Policy Model DB.
*
- * @param pdpGroupList The list of Pdp Group info received from Policy Engine
+ * @param pdpGroups The list of Pdp Group info received from Policy Engine
*/
- public void updatePdpGroupInfo(List<PdpGroup> pdpGroupList) {
- List<PolicyModel> policyModelList = policyModelsRepository.findAll();
- for (PolicyModel policyModel : policyModelList) {
- JsonArray supportedPdpGroups = new JsonArray();
- for (PdpGroup pdpGroup : pdpGroupList) {
- JsonObject supportedPdpGroup = pdpGroup.getSupportedSubgroups(
- policyModel.getPolicyModelType(), policyModel.getVersion());
- if (supportedPdpGroup != null) {
- supportedPdpGroups.add(supportedPdpGroup);
- }
- }
-
- if (supportedPdpGroups.size() > 0) {
- JsonObject supportedPdpJson = new JsonObject();
- supportedPdpJson.add("supportedPdpGroups", supportedPdpGroups);
- policyModel.setPolicyPdpGroup(supportedPdpJson);
- policyModelsRepository.saveAndFlush(policyModel);
- }
- }
+ public void updatePdpGroupInfo(PdpGroups pdpGroups) {
+ List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
+ PdpGroupsAnalyzer.updatePdpGroup(policyModelsList, pdpGroups);
+ this.policyModelsRepository.saveAll(policyModelsList);
}
}
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java
deleted file mode 100644
index 9cbeec109..000000000
--- a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroup.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.policy.clamp.policy.pdpgroup;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.gson.annotations.Expose;
-import java.util.List;
-
-/**
- * This class maps the get Pdp Group response to a nice pojo.
- */
-public class PdpGroup {
-
- @Expose
- private String name;
-
- @Expose
- private String pdpGroupState;
-
- @Expose
- private List<PdpSubgroup> pdpSubgroups;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getPdpGroupState() {
- return pdpGroupState;
- }
-
- public void setPdpGroupState(String pdpGroupState) {
- this.pdpGroupState = pdpGroupState;
- }
-
- public List<PdpSubgroup> getPdpSubgroups() {
- return pdpSubgroups;
- }
-
- public void setPdpSubgroups(List<PdpSubgroup> pdpSubgroups) {
- this.pdpSubgroups = pdpSubgroups;
- }
-
- /**
- * Get supported subGroups based on the defined policy type and version.
- * @param policyType The policy type
- * @param version The version
- * @return The supported subGroup list in Json format
- */
- public JsonObject getSupportedSubgroups(String policyType, String version) {
- if (!pdpGroupState.equalsIgnoreCase("ACTIVE")) {
- return null;
- }
- JsonArray supportedSubgroups = new JsonArray();
- for (PdpSubgroup subGroup : pdpSubgroups) {
- if (subGroup.getSupportedPolicyTypes().contains(new PolicyModelKey(policyType, version))) {
- supportedSubgroups.add(subGroup.getPdpType());
- }
- }
- if (supportedSubgroups.size() > 0) {
- JsonObject supportedPdpGroup = new JsonObject();
- supportedPdpGroup.add(this.name, supportedSubgroups);
- return supportedPdpGroup;
- }
- return null;
- }
-}
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java
new file mode 100644
index 000000000..51cdb149e
--- /dev/null
+++ b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpGroupsAnalyzer.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2021 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.policy.clamp.policy.pdpgroup;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.onap.policy.clamp.loop.template.PolicyModel;
+import org.onap.policy.models.pdp.concepts.PdpGroup;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
+import org.onap.policy.models.pdp.concepts.PdpSubGroup;
+import org.onap.policy.models.pdp.enums.PdpState;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.sdc.toscaparser.api.elements.PolicyType;
+
+/**
+ * This is an utility class to do searching in pdp groups.
+ */
+public class PdpGroupsAnalyzer {
+ /**
+ * Get supported subGroups based on the defined policy type and version for s specific PDPgroup.
+ * It returns null if the Group is not ACTIVE or if the policytype/version has not been found in the PDPSubgroups.
+ *
+ * @param pdpGroup The pdpGroup that must be analyzed
+ * @param policyType The policy type
+ * @param version The version
+ * @return The supported subGroups list in Json format
+ * @see org.onap.policy.models.pdp.concepts.PdpGroup
+ * @see org.onap.policy.models.pdp.enums.PdpState
+ */
+ private static JsonObject getSupportedSubgroups(PdpGroup pdpGroup, String policyType, String version) {
+ if (!PdpState.ACTIVE.equals(pdpGroup.getPdpGroupState())) {
+ return null;
+ }
+ JsonObject supportedPdpGroup = new JsonObject();
+ JsonArray supportedSubgroups = new JsonArray();
+ supportedPdpGroup.add(pdpGroup.getName(), supportedSubgroups);
+ pdpGroup.getPdpSubgroups().stream().forEach(pdpSubGroup -> {
+ if (pdpSubGroup.getSupportedPolicyTypes().stream().anyMatch(policyTypeIdentifier ->
+ policyType.matches(policyTypeIdentifier.getName().replace(".", "\\.").replace("*", ".*"))
+ && version.equals(policyTypeIdentifier.getVersion()))) {
+ supportedSubgroups.add(pdpSubGroup.getPdpType());
+ }
+ });
+ if (supportedSubgroups.size() == 0) {
+ return null;
+ }
+ return supportedPdpGroup;
+ }
+
+ /**
+ * This method updates each element in the policyModelsList given in argument based on the pdpGroups given.
+ *
+ * @param policyModelsList The list of Policy Models where each PolicyModel will be updated
+ * @param pdpGroups The PdpGroups containing all PDP group definition
+ */
+ public static void updatePdpGroup(List<PolicyModel> policyModelsList, PdpGroups pdpGroups) {
+ policyModelsList.parallelStream().forEach(policyModel -> {
+ JsonObject jsonResult = new JsonObject();
+ JsonArray supportedPdpGroups = new JsonArray();
+ jsonResult.add("supportedPdpGroups", supportedPdpGroups);
+ policyModel.setPolicyPdpGroup(jsonResult);
+ pdpGroups.getGroups().stream().map(pdpGroup -> PdpGroupsAnalyzer.getSupportedSubgroups(pdpGroup,
+ policyModel.getPolicyModelType(), policyModel.getVersion())).filter(Objects::nonNull)
+ .forEach(jsonPdpGroup -> supportedPdpGroups.add(jsonPdpGroup));
+ if (supportedPdpGroups.size() == 0) {
+ policyModel.setPolicyPdpGroup(null);
+ }
+ });
+ }
+} \ No newline at end of file
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java
deleted file mode 100644
index 890f90775..000000000
--- a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PdpSubgroup.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.policy.clamp.policy.pdpgroup;
-
-import com.google.gson.annotations.Expose;
-import java.util.List;
-
-/**
- * This class maps the Policy get PDP Group response to a nice pojo.
- */
-public class PdpSubgroup {
-
- @Expose
- private String pdpType;
-
- @Expose
- private List<PolicyModelKey> supportedPolicyTypes;
-
- public String getPdpType() {
- return pdpType;
- }
-
- public void setPdpType(String pdpType) {
- this.pdpType = pdpType;
- }
-
- public List<PolicyModelKey> getSupportedPolicyTypes() {
- return supportedPolicyTypes;
- }
-
- public void setSupportedPolicyTypes(List<PolicyModelKey> supportedPolicyTypes) {
- this.supportedPolicyTypes = supportedPolicyTypes;
- }
-
-}
diff --git a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java b/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java
deleted file mode 100644
index df92bfdf9..000000000
--- a/src/main/java/org/onap/policy/clamp/policy/pdpgroup/PolicyModelKey.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2020 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.policy.clamp.policy.pdpgroup;
-
-import com.google.gson.annotations.Expose;
-import java.io.Serializable;
-
-public class PolicyModelKey implements Serializable {
-
- /**
- * The serial version ID.
- */
- private static final long serialVersionUID = 3307410842013230886L;
-
- @Expose
- private String name;
-
- @Expose
- private String version;
-
- /**
- * Constructor.
- */
- public PolicyModelKey(String name, String version) {
- this.name = name;
- this.version = version;
- }
-
- /**
- * name getter.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * name setter.
- *
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * version getter.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * version setter.
- *
- * @param version the version to set
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((version == null) ? 0 : version.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- PolicyModelKey other = (PolicyModelKey) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- if (!name.matches(other.name)) {
- return false;
- }
- }
- if (version == null) {
- if (other.version != null) {
- return false;
- }
- } else if (!version.equals(other.version)) {
- return false;
- }
- return true;
- }
-}
diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml
index 0ee386eb4..4d1eba614 100644
--- a/src/main/resources/clds/camel/routes/policy-flows.xml
+++ b/src/main/resources/clds/camel/routes/policy-flows.xml
@@ -109,7 +109,7 @@
<log loggingLevel="INFO"
message="Endpoint to get policy deployment status: {{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0"></log>
<toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?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;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<doCatch>
<exception>java.lang.Exception</exception>
<handled>
@@ -427,7 +427,41 @@
<log loggingLevel="INFO"
message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps"></log>
<toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps?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;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <convertBodyTo type="java.lang.String"/>
+ <doFinally>
+ <to uri="direct:reset-raise-http-exception-flag"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
+ </doFinally>
+ </doTry>
+ </route>
+ <route id="get-all-policies">
+ <from uri="direct:get-all-policies"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting the policies list"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policies list')"/>
+ <setHeader headerName="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${exchangeProperty[X-ONAP-RequestID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${exchangeProperty[X-ONAP-InvocationID]}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${exchangeProperty[X-ONAP-PartnerName]}
+ </simple>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to get policies list: {{clamp.config.policy.api.url}}/policy/api/v1/policies"></log>
+ <toD
+ uri="{{clamp.config.policy.api.url}}/policy/api/v1/policies?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;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>