summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Closset <christophe.closset@intl.att.com>2020-04-23 08:49:12 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-23 08:49:12 +0000
commite57ccc972e080ce039d7a1325332fcae3b75bbf1 (patch)
tree5867a503fd98a4bb67ecdd1badc9d4eb6e52efbf
parentb954df81bb47b3ff115207a2436f1b61eaeafad2 (diff)
parentd187e9e689fe39cbabe9cb82ea6959e49ff64354 (diff)
Merge "Fix refresh action"
-rw-r--r--src/main/java/org/onap/clamp/clds/client/CdsServices.java9
-rw-r--r--src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java12
-rw-r--r--src/main/java/org/onap/clamp/loop/CsarInstaller.java9
-rw-r--r--src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java167
-rw-r--r--src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java54
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java2
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml8
-rw-r--r--src/main/resources/clds/camel/routes/cds-flows.xml18
-rw-r--r--src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java8
-rw-r--r--src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java9
11 files changed, 221 insertions, 77 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/CdsServices.java b/src/main/java/org/onap/clamp/clds/client/CdsServices.java
index b8eb41946..fa15e2778 100644
--- a/src/main/java/org/onap/clamp/clds/client/CdsServices.java
+++ b/src/main/java/org/onap/clamp/clds/client/CdsServices.java
@@ -84,8 +84,11 @@ public class CdsServices {
Date startTime = new Date();
LoggingUtils.setTimeContext(startTime, new Date());
return JsonUtils.GSON_JPA_MODEL.fromJson(cdsResponse, CdsBpWorkFlowListResponse.class);
+ } else {
+ logger.error("CDS getBlueprintWorkflowList FAILED");
+ return null;
}
- return null;
+
}
/**
@@ -114,8 +117,10 @@ public class CdsServices {
Date startTime = new Date();
LoggingUtils.setTimeContext(startTime, new Date());
return parseCdsResponse(cdsResponse);
+ } else {
+ logger.error("CDS getWorkflowInputProperties FAILED");
+ return null;
}
- return null;
}
protected JsonObject parseCdsResponse(String response) {
diff --git a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
index c92cad1f5..94a477fe5 100644
--- a/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
+++ b/src/main/java/org/onap/clamp/clds/tosca/update/execution/cds/ToscaMetadataCdsProcess.java
@@ -28,23 +28,16 @@ import static org.onap.clamp.clds.tosca.ToscaSchemaConstants.TYPE;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-
import java.util.Map;
import java.util.Set;
-
import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataProcess;
import org.onap.clamp.loop.service.Service;
-import org.onap.clamp.tosca.DictionaryService;
-import org.springframework.beans.factory.annotation.Autowired;
/**
* This class is there to add the JsonObject for CDS in the json Schema according to what is found in the Tosca model.
*/
public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
- @Autowired
- private DictionaryService dictionaryService;
-
@Override
public void executeProcess(String parameters, JsonObject childObject, Service serviceModel) {
switch (parameters) {
@@ -59,6 +52,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
case "operation":
generateOperation(childObject, serviceModel);
break;
+ default:
}
}
@@ -83,7 +77,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
.entrySet()) {
JsonObject controllerProperties = entry.getValue().getAsJsonObject()
.getAsJsonObject("controllerProperties");
- if (controllerProperties != null) {
+ if (controllerProperties != null && controllerProperties.getAsJsonObject("workflows") != null) {
for (String workflowsEntry : controllerProperties.getAsJsonObject("workflows").keySet()) {
schemaEnum.add(workflowsEntry);
schemaTitle.add(workflowsEntry + " (CDS operation)");
@@ -107,7 +101,7 @@ public class ToscaMetadataCdsProcess extends ToscaMetadataProcess {
.entrySet()) {
JsonObject controllerProperties = entry.getValue().getAsJsonObject()
.getAsJsonObject("controllerProperties");
- if (controllerProperties != null) {
+ if (controllerProperties != null && controllerProperties.getAsJsonObject("workflows") != null) {
for (Map.Entry<String, JsonElement> workflowsEntry : controllerProperties.getAsJsonObject("workflows")
.entrySet()) {
JsonObject obj = new JsonObject();
diff --git a/src/main/java/org/onap/clamp/loop/CsarInstaller.java b/src/main/java/org/onap/clamp/loop/CsarInstaller.java
index b5ebdb949..67c7ce5cf 100644
--- a/src/main/java/org/onap/clamp/loop/CsarInstaller.java
+++ b/src/main/java/org/onap/clamp/loop/CsarInstaller.java
@@ -40,6 +40,7 @@ import org.onap.clamp.clds.sdc.controller.installer.BlueprintMicroService;
import org.onap.clamp.clds.sdc.controller.installer.BlueprintParser;
import org.onap.clamp.clds.sdc.controller.installer.ChainGenerator;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
+import org.onap.clamp.loop.cds.CdsDataInstaller;
import org.onap.clamp.loop.service.CsarServiceInstaller;
import org.onap.clamp.loop.service.Service;
import org.onap.clamp.loop.template.LoopElementModel;
@@ -79,6 +80,9 @@ public class CsarInstaller {
private CsarServiceInstaller csarServiceInstaller;
@Autowired
+ private CdsDataInstaller cdsDataInstaller;
+
+ @Autowired
private PolicyEngineServices policyEngineServices;
/**
@@ -113,7 +117,10 @@ public class CsarInstaller {
public void installTheCsar(CsarHandler csar)
throws SdcArtifactInstallerException, InterruptedException, BlueprintParserException {
logger.info("Installing the CSAR " + csar.getFilePath());
- installTheLoopTemplates(csar, csarServiceInstaller.installTheService(csar));
+ Service associatedService = csarServiceInstaller.installTheService(csar);
+ cdsDataInstaller.installCdsServiceProperties(csar, associatedService);
+
+ installTheLoopTemplates(csar, associatedService);
logger.info("Successfully installed the CSAR " + csar.getFilePath());
}
diff --git a/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java b/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java
new file mode 100644
index 000000000..9c1cd3bc2
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/cds/CdsDataInstaller.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
+ * ================================================================================
+ * 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.clamp.loop.cds;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.gson.JsonObject;
+import org.onap.clamp.clds.client.CdsServices;
+import org.onap.clamp.clds.model.cds.CdsBpWorkFlowListResponse;
+import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
+import org.onap.clamp.loop.service.Service;
+import org.onap.clamp.loop.service.ServicesRepository;
+import org.onap.sdc.tosca.parser.enums.SdcTypes;
+import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * This class installs the cds data in the service model properties.
+ * This can be refreshed later on by clicking on the button refresh, when recomputing the json schema.
+ */
+@Component
+public class CdsDataInstaller {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(CdsDataInstaller.class);
+
+ @Autowired
+ CdsServices cdsServices;
+
+ @Autowired
+ ServicesRepository serviceRepository;
+
+ public static final String CONTROLLER_PROPERTIES = "controllerProperties";
+ public static final String SDNC_MODEL_NAME = "sdnc_model_name";
+ public static final String SDNC_MODEL_VERSION = "sdnc_model_version";
+
+ /**
+ * This method installs the service model properties for CDS in the service object given in input.
+ *
+ * @param csar The csar from sdc
+ * @param service the service object already provisioned with csar data
+ */
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public Service installCdsServiceProperties(CsarHandler csar, Service service) {
+ // Iterate on all types defined in the tosca lib
+ for (SdcTypes type : SdcTypes.values()) {
+ JsonObject resourcesPropByType = service.getResourceByType(type.getValue());
+ // For each type, get the metadata of each nodetemplate
+ for (NodeTemplate nodeTemplate : csar.getSdcCsarHelper().getServiceNodeTemplateBySdcType(type)) {
+ // get cds artifact information and save in resources Prop
+ if (SdcTypes.PNF == type || SdcTypes.VF == type) {
+ JsonObject controllerProperties = createCdsArtifactProperties(nodeTemplate.getPropertyValue(
+ SDNC_MODEL_NAME).toString(),
+ nodeTemplate.getPropertyValue(SDNC_MODEL_VERSION).toString());
+ if (controllerProperties != null) {
+ resourcesPropByType.getAsJsonObject(nodeTemplate.getName())
+ .add(CONTROLLER_PROPERTIES, controllerProperties);
+ }
+ }
+ }
+ }
+ serviceRepository.save(service);
+ logger.info("Successfully installed the CDS data in Service");
+ return service;
+ }
+
+ /**
+ * This method updates the service model properties for CDS in the service object given in input.
+ *
+ * @param service the service object already provisioned with csar data
+ */
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
+ public Service updateCdsServiceProperties(Service service) {
+ // Iterate on all types defined in the tosca lib
+ for (SdcTypes type : SdcTypes.values()) {
+ JsonObject resourcesPropByType = service.getResourceByType(type.getValue());
+ for (String resourceName : resourcesPropByType.keySet()) {
+ // get cds artifact information and save in resources Prop
+ if ((SdcTypes.PNF == type || SdcTypes.VF == type) && resourcesPropByType.getAsJsonObject(resourceName)
+ .getAsJsonObject(CONTROLLER_PROPERTIES) != null) {
+ JsonObject controllerProperties =
+ createCdsArtifactProperties(resourcesPropByType.getAsJsonObject(resourceName)
+ .getAsJsonObject(CONTROLLER_PROPERTIES).get(SDNC_MODEL_NAME)
+ .getAsString(),
+ resourcesPropByType.getAsJsonObject(resourceName)
+ .getAsJsonObject(CONTROLLER_PROPERTIES).get(SDNC_MODEL_VERSION)
+ .getAsString());
+ if (controllerProperties != null) {
+ resourcesPropByType.getAsJsonObject(resourceName)
+ .add(CONTROLLER_PROPERTIES, controllerProperties);
+ }
+ }
+ }
+ }
+ serviceRepository.save(service);
+ logger.info("Successfully updated the CDS data in Service");
+ return service;
+ }
+
+ /**
+ * Retrieve CDS artifacts information from node template and save in resource object.
+ *
+ * @param sdncModelName sdnc model name
+ * @param sdncModelVersion sdnc model version
+ * @return Returns CDS artifacts information
+ */
+ private JsonObject createCdsArtifactProperties(String sdncModelName, String sdncModelVersion) {
+ if (sdncModelName != null && sdncModelVersion != null) {
+ JsonObject controllerProperties = new JsonObject();
+ controllerProperties.addProperty(SDNC_MODEL_NAME, sdncModelName);
+ controllerProperties.addProperty(SDNC_MODEL_VERSION, sdncModelVersion);
+
+ CdsBpWorkFlowListResponse response =
+ queryCdsToGetWorkFlowList(sdncModelName, sdncModelVersion);
+ if (response == null) {
+ return controllerProperties;
+ }
+
+ JsonObject workFlowProps = new JsonObject();
+ for (String workFlow : response.getWorkflows()) {
+ logger.info("Found CDS workflow " + workFlow + " for model name " + sdncModelName + " and version "
+ + sdncModelVersion);
+ JsonObject inputs = queryCdsToGetWorkFlowInputProperties(response.getBlueprintName(),
+ response.getVersion(), workFlow);
+ workFlowProps.add(workFlow, inputs);
+ }
+
+ controllerProperties.add("workflows", workFlowProps);
+ return controllerProperties;
+ }
+ return null;
+ }
+
+
+ private CdsBpWorkFlowListResponse queryCdsToGetWorkFlowList(String artifactName, String artifactVersion) {
+ return cdsServices.getBlueprintWorkflowList(artifactName, artifactVersion);
+ }
+
+ private JsonObject queryCdsToGetWorkFlowInputProperties(String artifactName, String artifactVersion,
+ String workFlow) {
+ return cdsServices.getWorkflowInputProperties(artifactName, artifactVersion, workFlow);
+ }
+}
diff --git a/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java b/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java
index 6db6d920f..c43f2cb6d 100644
--- a/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java
+++ b/src/main/java/org/onap/clamp/loop/service/CsarServiceInstaller.java
@@ -28,9 +28,7 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import com.google.gson.JsonObject;
import java.util.Map.Entry;
-import org.onap.clamp.clds.client.CdsServices;
import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
-import org.onap.clamp.clds.model.cds.CdsBpWorkFlowListResponse;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.sdc.tosca.parser.api.IEntityDetails;
@@ -54,9 +52,6 @@ public class CsarServiceInstaller {
@Autowired
ServicesRepository serviceRepository;
- @Autowired
- CdsServices cdsServices;
-
/**
* Install the Service from the csar.
*
@@ -90,14 +85,6 @@ public class CsarServiceInstaller {
for (NodeTemplate nodeTemplate : csar.getSdcCsarHelper().getServiceNodeTemplateBySdcType(type)) {
resourcesPropByType.add(nodeTemplate.getName(),
JsonUtils.GSON.toJsonTree(nodeTemplate.getMetaData().getAllProperties()));
- // get cds artifact information and save in resources Prop
- if (SdcTypes.PNF == type || SdcTypes.VF == type) {
- JsonObject controllerProperties = createCdsArtifactProperties(nodeTemplate);
- if (controllerProperties != null) {
- resourcesPropByType.getAsJsonObject(nodeTemplate.getName())
- .add("controllerProperties", controllerProperties);
- }
- }
}
resourcesProp.add(type.getValue(), resourcesPropByType);
}
@@ -139,45 +126,4 @@ public class CsarServiceInstaller {
return alreadyInstalled;
}
-
- /**
- * Retrive CDS artifacts information from node template and save in resource object.
- *
- * @param nodeTemplate node template
- * @return Returns CDS artifacts information
- */
- private JsonObject createCdsArtifactProperties(NodeTemplate nodeTemplate) {
- Object artifactName = nodeTemplate.getPropertyValue("sdnc_model_name");
- Object artifactVersion = nodeTemplate.getPropertyValue("sdnc_model_version");
- if (artifactName != null && artifactVersion != null) {
- CdsBpWorkFlowListResponse response =
- queryCdsToGetWorkFlowList(artifactName.toString(), artifactVersion.toString());
- if (response == null) {
- return null;
- }
-
- JsonObject workFlowProps = new JsonObject();
- for (String workFlow : response.getWorkflows()) {
- JsonObject inputs = queryCdsToGetWorkFlowInputProperties(response.getBlueprintName(),
- response.getVersion(), workFlow);
- workFlowProps.add(workFlow, inputs);
- }
-
- JsonObject controllerProperties = new JsonObject();
- controllerProperties.addProperty("sdnc_model_name", artifactName.toString());
- controllerProperties.addProperty("sdnc_model_version", artifactVersion.toString());
- controllerProperties.add("workflows", workFlowProps);
- return controllerProperties;
- }
- return null;
- }
-
- private CdsBpWorkFlowListResponse queryCdsToGetWorkFlowList(String artifactName, String artifactVersion) {
- return cdsServices.getBlueprintWorkflowList(artifactName, artifactVersion);
- }
-
- private JsonObject queryCdsToGetWorkFlowInputProperties(String artifactName, String artifactVersion,
- String workFlow) {
- return cdsServices.getWorkflowInputProperties(artifactName, artifactVersion, workFlow);
- }
}
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
index 674db2295..690b7ae12 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
@@ -208,7 +208,7 @@ public class OperationalPolicyRepresentationBuilder {
JsonObject controllerProperties = entry.getValue().getAsJsonObject()
.getAsJsonObject("controllerProperties");
- if (controllerProperties != null) {
+ if (controllerProperties != null && controllerProperties.getAsJsonObject("workflows") != null) {
JsonObject workflows = controllerProperties.getAsJsonObject("workflows");
for (Entry<String, JsonElement> workflowsEntry : workflows.entrySet()) {
JsonObject obj = new JsonObject();
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 88d582605..86a64f665 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -283,7 +283,9 @@
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to uri="direct:load-loop" />
<to
- uri="bean:org.onap.clamp.loop.LoopController?method=refreshMicroServicePolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.microServicePolicyName}})" />
+ uri="bean:org.onap.clamp.loop.cds.CdsDataInstaller?method=updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=refreshMicroServicePolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.microServicePolicyName})" />
<log loggingLevel="INFO"
message="REFRESH Micro Service policy request successfully executed for loop: ${header.loopName}" />
<to
@@ -324,7 +326,9 @@
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to uri="direct:load-loop" />
<to
- uri="bean:org.onap.clamp.loop.LoopController?method=refreshOperationalPolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.operationalPolicyName}})" />
+ uri="bean:org.onap.clamp.loop.cds.CdsDataInstaller?method=updateCdsServiceProperties(${exchangeProperty[loopObject].getModelService()})" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=refreshOperationalPolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.operationalPolicyName})" />
<log loggingLevel="INFO"
message="REFRESH operational policy request successfully executed for loop: ${header.loopName}" />
<to
diff --git a/src/main/resources/clds/camel/routes/cds-flows.xml b/src/main/resources/clds/camel/routes/cds-flows.xml
index 5c10a0cd2..9946c990b 100644
--- a/src/main/resources/clds/camel/routes/cds-flows.xml
+++ b/src/main/resources/clds/camel/routes/cds-flows.xml
@@ -15,6 +15,15 @@
message="Endpoint to query workflows from CDS : {{clamp.config.cds.url}}/api/v1/blueprint-model/workflows/blueprint-name/${exchangeProperty[blueprintName]}/version/${exchangeProperty[blueprintVersion]}"></log>
<toD uri="{{clamp.config.cds.url}}/api/v1/blueprint-model/workflows/blueprint-name/${exchangeProperty[blueprintName]}/version/${exchangeProperty[blueprintVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.cds.userName}}&amp;authPassword={{clamp.config.cds.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>true</constant>
+ </handled>
+
+ <log loggingLevel="ERROR"
+ message="GET CDS request FAILED: ${exception.stacktrace}" />
+ </doCatch>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
@@ -37,6 +46,15 @@
message="Endpoint to query input properties for workflow from CDS : {{clamp.config.cds.url}}/api/v1/blueprint-model/workflow-spec"></log>
<toD uri="{{clamp.config.cds.url}}/api/v1/blueprint-model/workflow-spec?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.cds.userName}}&amp;authPassword={{clamp.config.cds.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>true</constant>
+ </handled>
+
+ <log loggingLevel="ERROR"
+ message="GET CDS workflow input request FAILED: ${exception.stacktrace}" />
+ </doCatch>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
diff --git a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
index ec39fc3db..9fdc727bc 100644
--- a/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
+++ b/src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
@@ -23,9 +23,7 @@
package org.onap.clamp.clds.client;
import com.google.gson.JsonObject;
-
import java.io.IOException;
-
import org.junit.Test;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index ac7b236e8..d14975238 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -50,6 +50,7 @@ import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.cds.CdsDataInstaller;
import org.onap.clamp.loop.service.ServicesRepository;
import org.onap.clamp.loop.template.LoopTemplate;
import org.onap.clamp.loop.template.LoopTemplateLoopElementModel;
@@ -180,8 +181,7 @@ public class CsarInstallerItCase {
CsarHandler csarHandler = new CsarHandler(notificationData, "", "");
csarHandler
.setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME).getFile());
- Optional<String> testyaml = csarHandler.getPolicyModelYaml();
- Assert.assertEquals(testyaml, Optional
+ Assert.assertEquals(csarHandler.getPolicyModelYaml(), Optional
.ofNullable(ResourceFileUtil.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
}
@@ -205,6 +205,10 @@ public class CsarInstallerItCase {
CsarHandler csar = buildFakeCsarHandler(generatedName);
csarInstaller.installTheCsar(csar);
assertThat(serviceRepository.existsById("63cac700-ab9a-4115-a74f-7eac85e3fce0")).isTrue();
+ // We should have CDS info
+ assertThat(serviceRepository.findById("63cac700-ab9a-4115-a74f-7eac85e3fce0").get().getResourceByType("VF")
+ .getAsJsonObject("vLoadBalancerMS 0").getAsJsonObject(
+ CdsDataInstaller.CONTROLLER_PROPERTIES)).isNotNull();
assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0",
RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml"))).isTrue();
assertThat(loopTemplatesRepo.existsById(LoopTemplate.generateLoopTemplateName(generatedName, "1.0",
diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
index a6a496821..b90a28616 100644
--- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
+++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
@@ -55,12 +55,13 @@ public class OperationalPolicyRepresentationBuilderTest {
JsonObject jsonModel = new GsonBuilder().create()
.fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class);
Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
- jsonModel.get("resourceDetails").getAsJsonObject(),
- "1.0");
+ jsonModel.get("resourceDetails").getAsJsonObject(),
+ "1.0");
JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service);
assertThat(jsonSchema).isNotNull();
- JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
- new GsonBuilder().create().toJson(jsonSchema), false);
+ JSONAssert.assertEquals(
+ ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
+ new GsonBuilder().create().toJson(jsonSchema), false);
}
}