* limitations under the License.\r
* ============LICENSE_END============================================\r
* ===================================================================\r
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * \r
*/\r
\r
package org.onap.clamp.clds.client;\r
\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
+import com.fasterxml.jackson.databind.JsonNode;\r
import com.fasterxml.jackson.databind.node.ObjectNode;\r
\r
import java.util.Date;\r
\r
import org.json.simple.JSONObject;\r
import org.json.simple.parser.JSONParser;\r
-import org.onap.clamp.clds.config.CldsReferenceProperties;\r
-import org.onap.clamp.clds.exception.DcaeDeploymentException;\r
+import org.onap.clamp.clds.config.ClampProperties;\r
+import org.onap.clamp.clds.exception.dcae.DcaeDeploymentException;\r
import org.onap.clamp.clds.util.LoggingUtils;\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.stereotype.Component;\r
protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeDispatcherServices.class);\r
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();\r
@Autowired\r
- private CldsReferenceProperties refProp;\r
+ private ClampProperties refProp;\r
private static final String STATUS_URL_LOG = "Status URL extracted: ";\r
private static final String DCAE_URL_PREFIX = "/dcae-deployments/";\r
- private static final String DCAE_URL_PROPERTY_NAME = "DCAE_DISPATCHER_URL";\r
+ private static final String DCAE_URL_PROPERTY_NAME = "dcae.dispatcher.url";\r
private static final String DCAE_REQUEST_FAILED_LOG = "RequestFailed - responseStr=";\r
public static final String DCAE_REQUESTID_PROPERTY_NAME = "dcae.header.requestId";\r
private static final String DCAE_LINK_FIELD = "links";\r
}\r
}\r
\r
+ public String getOperationStatusWithRetry(String operationStatusUrl) throws InterruptedException {\r
+ String operationStatus = "";\r
+ for (int i = 0; i < Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.limit")); i++) {\r
+ logger.info("Trying to get Operation status on DCAE for url:" + operationStatusUrl);\r
+ operationStatus = getOperationStatus(operationStatusUrl);\r
+ logger.info("Current Status is:" + operationStatus);\r
+ if (!"processing".equalsIgnoreCase(operationStatus)) {\r
+ return operationStatus;\r
+ } else {\r
+ Thread.sleep(Integer.valueOf(refProp.getStringValue("dcae.dispatcher.retry.interval")));\r
+ }\r
+ }\r
+ logger.warn("Number of attempts on DCAE is over, stopping the getOperationStatus method");\r
+ return operationStatus;\r
+ }\r
+\r
/**\r
* Get the Operation Status from a specified URL.\r
* \r
* The deployment ID\r
* @param serviceTypeId\r
* Service type ID\r
+ * @param blueprintInputJson\r
+ * The value for each blueprint parameters in a flat JSON\r
* @return The status URL\r
*/\r
- public String createNewDeployment(String deploymentId, String serviceTypeId) {\r
+ public String createNewDeployment(String deploymentId, String serviceTypeId, JsonNode blueprintInputJson) {\r
Date startTime = new Date();\r
LoggingUtils.setTargetContext("DCAE", "createNewDeployment");\r
try {\r
ObjectNode rootNode = (ObjectNode) refProp.getJsonTemplate("dcae.deployment.template");\r
rootNode.put("serviceTypeId", serviceTypeId);\r
+ if (blueprintInputJson != null) {\r
+ rootNode.put("inputs", blueprintInputJson);\r
+ }\r
String apiBodyString = rootNode.toString();\r
logger.info("Dcae api Body String - " + apiBodyString);\r
String url = refProp.getStringValue(DCAE_URL_PROPERTY_NAME) + DCAE_URL_PREFIX + deploymentId;\r