summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java131
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java242
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java110
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java483
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java174
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java23
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java111
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json40
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy62
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy61
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java134
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java134
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java615
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java86
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java123
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java (renamed from bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java)48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java115
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java123
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json50
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java30
-rw-r--r--pom.xml10
-rw-r--r--so-monitoring/so-monitoring-handler/pom.xml4
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock6
40 files changed, 3425 insertions, 388 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index 98793601d0..da81da91ea 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -2,14 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
+ * Copyright (C) 2018 Intel Corp. All rights reserved.
* Copyright (C) 2017 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.
@@ -22,6 +23,9 @@ package org.onap.so.openstack.utils;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
import org.onap.so.config.beans.PoConfig;
import org.onap.so.logger.MessageEnum;
@@ -35,10 +39,13 @@ import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.base.client.OpenStackBaseException;
import com.woorea.openstack.base.client.OpenStackConnectException;
import com.woorea.openstack.base.client.OpenStackRequest;
import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.heat.model.CreateStackParam;
import com.woorea.openstack.heat.model.Explanation;
import com.woorea.openstack.keystone.model.Error;
import com.woorea.openstack.quantum.model.NeutronError;
@@ -57,11 +64,11 @@ public class MsoCommonUtils {
* sub-category that identifies the specific call (using the real
* openstack-java-sdk classname of the OpenStackRequest<T> parameter).
*/
-
+
protected <T> T executeAndRecordOpenstackRequest (OpenStackRequest <T> request) {
-
+
int limit;
-
+
long start = System.currentTimeMillis ();
String requestType;
if (request.getClass ().getEnclosingClass () != null) {
@@ -70,17 +77,17 @@ public class MsoCommonUtils {
} else {
requestType = request.getClass ().getSimpleName ();
}
-
+
int retryDelay = poConfig.getRetryDelay();
int retryCount = poConfig.getRetryCount();
String retryCodes = poConfig.getRetryCodes();
-
+
// Run the actual command. All exceptions will be propagated
while (true)
{
try {
return request.execute ();
- }
+ }
catch (OpenStackResponseException e) {
boolean retry = false;
if (retryCodes != null ) {
@@ -128,11 +135,11 @@ public class MsoCommonUtils {
}
else
throw e;
-
+
}
}
}
-
+
/*
* Convert an Openstack Exception on a Keystone call to an MsoException.
* This method supports both OpenstackResponseException and OpenStackConnectException.
@@ -281,7 +288,7 @@ public class MsoCommonUtils {
return me;
}
-
+
protected MsoException ioExceptionToMsoException(IOException e, String context) {
MsoAdapterException me = new MsoAdapterException (e.getMessage (), e);
me.addContext (context);
@@ -297,7 +304,105 @@ public class MsoCommonUtils {
public boolean isNullOrEmpty (String s) {
return s == null || s.isEmpty();
}
-
-
+
+
+ protected CreateStackParam createStackParam(String stackName,
+ String heatTemplate,
+ Map <String, ?> stackInputs,
+ int timeoutMinutes,
+ String environment,
+ Map <String, Object> files,
+ Map <String, Object> heatFiles) {
+
+ // Create local variables checking to see if we have an environment, nested, get_files
+ // Could later add some checks to see if it's valid.
+ boolean haveEnvtVariable = true;
+ if (environment == null || "".equalsIgnoreCase (environment.trim ())) {
+ haveEnvtVariable = false;
+ logger.debug ("createStackParam called with no environment variable");
+ } else {
+ logger.debug ("createStackParam called with an environment variable: " + environment);
+ }
+
+ boolean haveFiles = true;
+ if (files == null || files.isEmpty ()) {
+ haveFiles = false;
+ logger.debug ("createStackParam called with no files / child template ids");
+ } else {
+ logger.debug ("createStackParam called with " + files.size () + " files / child template ids");
+ }
+
+ boolean haveHeatFiles = true;
+ if (heatFiles == null || heatFiles.isEmpty ()) {
+ haveHeatFiles = false;
+ logger.debug ("createStackParam called with no heatFiles");
+ } else {
+ logger.debug ("createStackParam called with " + heatFiles.size () + " heatFiles");
+ }
+
+ //force entire stackInput object to generic Map<String, Object> for openstack compatibility
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, Object> normalized = new HashMap<>();
+ try {
+ normalized = mapper.readValue(mapper.writeValueAsString(stackInputs), new TypeReference<HashMap<String,Object>>() {});
+ } catch (IOException e1) {
+ logger.debug("could not map json", e1);
+ }
+
+ // Build up the stack to create
+ // Disable auto-rollback, because error reason is lost. Always rollback in the code.
+ CreateStackParam stack = new CreateStackParam ();
+ stack.setStackName (stackName);
+ stack.setTimeoutMinutes (timeoutMinutes);
+ stack.setParameters (normalized);
+ stack.setTemplate (heatTemplate);
+ stack.setDisableRollback (true);
+ // TJM New for PO Adapter - add envt variable
+ if (haveEnvtVariable) {
+ logger.debug ("Found an environment variable - value: " + environment);
+ stack.setEnvironment (environment);
+ }
+ // Now handle nested templates or get_files - have to combine if we have both
+ // as they're both treated as "files:" on the stack.
+ if (haveFiles && haveHeatFiles) {
+ // Let's do this here - not in the bean
+ logger.debug ("Found files AND heatFiles - combine and add!");
+ Map <String, Object> combinedFiles = new HashMap <> ();
+ for (Entry<String, Object> entry : files.entrySet()) {
+ combinedFiles.put(entry.getKey(), entry.getValue());
+ }
+ for (Entry<String, Object> entry : heatFiles.entrySet()) {
+ combinedFiles.put(entry.getKey(), entry.getValue());
+ }
+ stack.setFiles (combinedFiles);
+ } else {
+ // Handle if we only have one or neither:
+ if (haveFiles) {
+ logger.debug ("Found files - adding to stack");
+ stack.setFiles (files);
+ }
+ if (haveHeatFiles) {
+ logger.debug ("Found heatFiles - adding to stack");
+ // the setFiles was modified to handle adding the entries
+ stack.setFiles (heatFiles);
+ }
+ }
+
+ // 1802 - attempt to add better formatted printout of request to openstack
+ try {
+ Map<String, Object> inputs = new HashMap<>();
+ for (Entry<String, ?> entry : stackInputs.entrySet()) {
+ if (entry.getValue() != null) {
+ inputs.put(entry.getKey(), entry.getValue());
+ }
+ }
+ logger.debug("stack request:" + stack.toString());
+ } catch (Exception e) {
+ // that's okay - this is a nice-to-have
+ logger.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage());
+ }
+
+ return stack;
+ }
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 6b66970ea0..15f84890b7 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -8,9 +8,9 @@
* 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.
@@ -106,18 +106,18 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
protected CloudConfig cloudConfig;
-
+
@Autowired
private Environment environment;
@Autowired
private AuthenticationMethodFactory authenticationMethodFactory;
-
+
@Autowired
private MsoTenantUtilsFactory tenantUtilsFactory;
-
+
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatUtils.class);
-
+
// Properties names and variables (with default values)
protected String createPollIntervalProp = "ecomp.mso.adapters.po.pollInterval";
private String deletePollIntervalProp = "ecomp.mso.adapters.po.pollInterval";
@@ -125,7 +125,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
protected static final String createPollIntervalDefault = "15";
private static final String deletePollIntervalDefault = "15";
-
+
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
/**
@@ -275,31 +275,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Map <String, Object> files,
Map <String, Object> heatFiles,
boolean backout) throws MsoException {
- // Create local variables checking to see if we have an environment, nested, get_files
- // Could later add some checks to see if it's valid.
- boolean haveEnvtVariable = true;
- if (environment == null || "".equalsIgnoreCase (environment.trim ())) {
- haveEnvtVariable = false;
- LOGGER.debug ("createStack called with no environment variable");
- } else {
- LOGGER.debug ("createStack called with an environment variable: " + environment);
- }
- boolean haveFiles = true;
- if (files == null || files.isEmpty ()) {
- haveFiles = false;
- LOGGER.debug ("createStack called with no files / child template ids");
- } else {
- LOGGER.debug ("createStack called with " + files.size () + " files / child template ids");
+ // Take out the multicloud inputs, if present.
+ String[] directives = { "oof_directives", "sdnc_directives", "generic_vnf_id", "vf_module_id" };
+ for (String key : directives) {
+ if (stackInputs.containsKey(key)) {
+ stackInputs.remove(key);
+ if (stackInputs.isEmpty()) {
+ break;
+ }
+ }
}
- boolean haveHeatFiles = true;
- if (heatFiles == null || heatFiles.isEmpty ()) {
- haveHeatFiles = false;
- LOGGER.debug ("createStack called with no heatFiles");
- } else {
- LOGGER.debug ("createStack called with " + heatFiles.size () + " heatFiles");
- }
+ CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
// Obtain the cloud site information where we will create the stack
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
@@ -309,73 +297,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This could throw MsoTenantNotFound or MsoOpenstackException (both propagated)
Heat heatClient = getHeatClient (cloudSite, tenantId);
if (heatClient != null) {
- LOGGER.debug("Found: " + heatClient.toString());
+ LOGGER.debug("Found: " + heatClient.toString());
}
LOGGER.debug ("Ready to Create Stack (" + heatTemplate + ") with input params: " + stackInputs);
- //force entire stackInput object to generic Map<String, Object> for openstack compatibility
- ObjectMapper mapper = new ObjectMapper();
- Map<String, Object> normalized = new HashMap<>();
- try {
- normalized = mapper.readValue(mapper.writeValueAsString(stackInputs), new TypeReference<HashMap<String,Object>>() {});
- } catch (IOException e1) {
- LOGGER.debug("could not map json", e1);
- }
-
- // Build up the stack to create
- // Disable auto-rollback, because error reason is lost. Always rollback in the code.
- CreateStackParam stack = new CreateStackParam ();
- stack.setStackName (stackName);
- stack.setTimeoutMinutes (timeoutMinutes);
- stack.setParameters (normalized);
- stack.setTemplate (heatTemplate);
- stack.setDisableRollback (true);
- // TJM New for PO Adapter - add envt variable
- if (haveEnvtVariable) {
- LOGGER.debug ("Found an environment variable - value: " + environment);
- stack.setEnvironment (environment);
- }
- // Now handle nested templates or get_files - have to combine if we have both
- // as they're both treated as "files:" on the stack.
- if (haveFiles && haveHeatFiles) {
- // Let's do this here - not in the bean
- LOGGER.debug ("Found files AND heatFiles - combine and add!");
- Map <String, Object> combinedFiles = new HashMap <> ();
- for (Entry<String, Object> entry : files.entrySet()) {
- combinedFiles.put(entry.getKey(), entry.getValue());
- }
- for (Entry<String, Object> entry : heatFiles.entrySet()) {
- combinedFiles.put(entry.getKey(), entry.getValue());
- }
- stack.setFiles (combinedFiles);
- } else {
- // Handle if we only have one or neither:
- if (haveFiles) {
- LOGGER.debug ("Found files - adding to stack");
- stack.setFiles (files);
- }
- if (haveHeatFiles) {
- LOGGER.debug ("Found heatFiles - adding to stack");
- // the setFiles was modified to handle adding the entries
- stack.setFiles (heatFiles);
- }
- }
-
- // 1802 - attempt to add better formatted printout of request to openstack
- try {
- Map<String, Object> inputs = new HashMap<>();
- for (Entry<String, ?> entry : stackInputs.entrySet()) {
- if (entry.getValue() != null) {
- inputs.put(entry.getKey(), entry.getValue());
- }
- }
- LOGGER.debug(this.printStackRequest(tenantId, heatFiles, files, environment, inputs, stackName, heatTemplate, timeoutMinutes, backout, cloudSiteId));
- } catch (Exception e) {
- // that's okay - this is a nice-to-have
- LOGGER.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage());
- }
-
Stack heatStack = null;
try {
// Execute the actual Openstack command to create the Heat stack
@@ -401,7 +327,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throw me;
} else {
// Convert the OpenStackResponseException to an MsoOpenstackException
- LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage());
+ LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage());
throw heatExceptionToMsoException (e, CREATE_STACK);
}
} catch (OpenStackConnectException e) {
@@ -422,8 +348,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Set a time limit on overall polling.
// Use the resource (template) timeout for Openstack (expressed in minutes)
// and add one poll interval to give Openstack a chance to fail on its own.s
-
- int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
+
+ int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault));
int pollTimeout = (timeoutMinutes * 60) + createPollInterval;
// New 1610 - poll on delete if we rollback - use same values for now
int deletePollInterval = createPollInterval;
@@ -741,7 +667,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
else {
LOGGER.debug ("Heat Client is NULL" );
}
-
+
executeAndRecordOpenstackRequest (request);
} catch (OpenStackResponseException e) {
if (e.getStatus () == 404) {
@@ -765,7 +691,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (pollForCompletion) {
// Set a timeout on polling
-
+
int pollInterval = Integer.parseInt(this.environment.getProperty(deletePollIntervalProp, "" + deletePollIntervalDefault));
int pollTimeout = Integer.parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + deletePollIntervalDefault));
@@ -914,7 +840,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Remove any extraneous parameters (don't throw an error)
Map <String, Object> updatedParams = new HashMap <> ();
List <String> extraParams = new ArrayList <> ();
-
+
for (Entry<String, Object> entry : inputParams.entrySet()) {
if (!paramList.contains(entry.getKey())) {
// This is not a valid parameter for this template
@@ -1079,7 +1005,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
*/
protected Stack queryHeatStack (Heat heatClient, String stackName) throws MsoException {
if (stackName == null) {
- return null;
+ return null;
}
try {
OpenStackRequest <Stack> request = heatClient.getStacks ().byName (stackName);
@@ -1204,7 +1130,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
- private StringBuilder getOutputsAsStringBuilder(Stack heatStack) {
+ protected StringBuilder getOutputsAsStringBuilder(Stack heatStack) {
// This should only be used as a utility to print out the stack outputs
// to the log
StringBuilder sb = new StringBuilder("");
@@ -1237,7 +1163,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (Exception e) {
LOGGER.debug("Exception :",e);
sb.append("(a LinkedHashMap value that would not convert nicely)");
- }
+ }
} else if (obj instanceof Integer) {
String str = "";
try {
@@ -1281,8 +1207,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
sb.append("[END]");
return sb;
}
-
-
+
+
public void copyBaseOutputsToInputs(Map<String, Object> inputs,
Map<String, Object> otherStackOutputs, List<String> paramNames, Map<String, String> aliases) {
if (inputs == null || otherStackOutputs == null)
@@ -1331,7 +1257,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
return;
}
-
+
public List<String> convertCdlToArrayList(String cdl) {
String cdl2 = cdl.trim();
String cdl3;
@@ -1342,7 +1268,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
return new ArrayList<>(Arrays.asList(cdl3.split(",")));
}
-
+
/**
* New with 1707 - this method will convert all the String *values* of the inputs
* to their "actual" object type (based on the param type: in the db - which comes from the template):
@@ -1364,12 +1290,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
HashMap<String, Object> newInputs = new HashMap<>();
HashMap<String, HeatTemplateParam> params = new HashMap<>();
HashMap<String, HeatTemplateParam> paramAliases = new HashMap<>();
-
+
if (inputs == null) {
LOGGER.debug("convertInputMap - inputs is null - nothing to do here");
return new HashMap<>();
}
-
+
LOGGER.debug("convertInputMap in MsoHeatUtils called, with " + inputs.size() + " inputs, and template " + template.getArtifactUuid());
try {
LOGGER.debug(template.toString());
@@ -1378,7 +1304,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} catch (Exception e) {
LOGGER.debug("Exception occurred in convertInputMap:" + e.getMessage(), e);
}
-
+
for (HeatTemplateParam htp : template.getParameters()) {
LOGGER.debug("Adding " + htp.getParamName());
params.put(htp.getParamName(), htp);
@@ -1413,9 +1339,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if ("string".equalsIgnoreCase(type)) {
// Easiest!
String str = inputs.get(key);
- if (alias)
+ if (alias)
newInputs.put(realName, str);
- else
+ else
newInputs.put(key, str);
} else if ("number".equalsIgnoreCase(type)) {
String integerString = inputs.get(key);
@@ -1480,9 +1406,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
return newInputs;
}
-
- /*
- * This helpful method added for Valet
+
+ /*
+ * This helpful method added for Valet
*/
public String getCloudSiteKeystoneUrl(String cloudSiteId) throws MsoCloudSiteNotFound {
String keystone_url = null;
@@ -1498,17 +1424,17 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
return keystone_url;
}
-
+
/*
- * Create a string suitable for being dumped to a debug log that creates a
+ * Create a string suitable for being dumped to a debug log that creates a
* pseudo-JSON request dumping what's being sent to Openstack API in the create or update request
*/
-
- private String printStackRequest(String tenantId,
+
+ private String printStackRequest(String tenantId,
Map<String, Object> heatFiles,
Map<String, Object> nestedTemplates,
String environment,
- Map<String, Object> inputs,
+ Map<String, Object> inputs,
String vfModuleName,
String template,
int timeoutMinutes,
@@ -1520,14 +1446,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
sb.append("{\n");
sb.append(" \"stack_name\": \"" + vfModuleName + "\",\n");
sb.append(" \"disable_rollback\": " + backout + ",\n");
- sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n");
+ sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n");
sb.append(" \"template\": {\n");
sb.append(template);
sb.append(" },\n");
sb.append(" \"environment\": {\n");
- if (environment == null)
+ if (environment == null)
sb.append("<none>");
- else
+ else
sb.append(environment);
sb.append(" },\n");
sb.append(" \"files\": {\n");
@@ -1574,19 +1500,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
}
sb.append("\n }\n}\n");
-
+
return sb.toString();
}
-
+
/*******************************************************************************
- *
+ *
* Methods (and associated utilities) to implement the VduPlugin interface
- *
+ *
*******************************************************************************/
-
+
/**
* VduPlugin interface for instantiate function.
- *
+ *
* Translate the VduPlugin parameters to the corresponding 'createStack' parameters,
* and then invoke the existing function.
*/
@@ -1601,7 +1527,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
{
String cloudSiteId = cloudInfo.getCloudSiteId();
String tenantId = cloudInfo.getTenantId();
-
+
// Translate the VDU ModelInformation structure to that which is needed for
// creating the Heat stack. Loop through the artifacts, looking specifically
// for MAIN_TEMPLATE and ENVIRONMENT. Any other artifact will
@@ -1610,7 +1536,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Map<String,Object> nestedTemplates = new HashMap<>();
Map<String,Object> files = new HashMap<>();
String heatEnvironment = null;
-
+
for (VduArtifact vduArtifact: vduModel.getArtifacts()) {
if (vduArtifact.getType() == ArtifactType.MAIN_TEMPLATE) {
heatTemplate = new String(vduArtifact.getContent());
@@ -1622,7 +1548,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
heatEnvironment = new String(vduArtifact.getContent());
}
}
-
+
try {
StackInfo stackInfo = createStack (cloudSiteId,
tenantId,
@@ -1635,7 +1561,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
nestedTemplates,
files,
rollbackOnFailure);
-
+
// Populate a vduInstance from the StackInfo
return stackInfoToVduInstance(stackInfo);
}
@@ -1643,8 +1569,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throw new VduException ("MsoHeatUtils (instantiateVDU): createStack Exception", e);
}
}
-
-
+
+
/**
* VduPlugin interface for query function.
*/
@@ -1654,19 +1580,19 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
{
String cloudSiteId = cloudInfo.getCloudSiteId();
String tenantId = cloudInfo.getTenantId();
-
+
try {
// Query the Cloudify Deployment object and populate a VduInstance
StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId);
-
+
return stackInfoToVduInstance(stackInfo);
}
catch (Exception e) {
throw new VduException ("MsoHeatUtile (queryVdu): queryStack Exception ", e);
}
}
-
-
+
+
/**
* VduPlugin interface for delete function.
*/
@@ -1676,31 +1602,31 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
{
String cloudSiteId = cloudInfo.getCloudSiteId();
String tenantId = cloudInfo.getTenantId();
-
+
try {
// Delete the Heat stack
StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true);
-
+
// Populate a VduInstance based on the deleted Cloudify Deployment object
VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
-
+
// Override return state to DELETED (HeatUtils sets to NOTFOUND)
vduInstance.getStatus().setState(VduStateType.DELETED);
-
+
return vduInstance;
}
catch (Exception e) {
throw new VduException ("Delete VDU Exception", e);
}
}
-
-
+
+
/**
* VduPlugin interface for update function.
- *
+ *
* Update is currently not supported in the MsoHeatUtils implementation of VduPlugin.
* Just return a VduException.
- *
+ *
*/
@Override
public VduInstance updateVdu (
@@ -1713,38 +1639,38 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
{
throw new VduException ("MsoHeatUtils: updateVdu interface not supported");
}
-
-
+
+
/*
* Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object
*/
- private VduInstance stackInfoToVduInstance (StackInfo stackInfo)
+ protected VduInstance stackInfoToVduInstance (StackInfo stackInfo)
{
VduInstance vduInstance = new VduInstance();
-
+
// The full canonical name as the instance UUID
vduInstance.setVduInstanceId(stackInfo.getCanonicalName());
vduInstance.setVduInstanceName(stackInfo.getName());
-
+
// Copy inputs and outputs
vduInstance.setInputs(stackInfo.getParameters());
vduInstance.setOutputs(stackInfo.getOutputs());
-
+
// Translate the status elements
vduInstance.setStatus(stackStatusToVduStatus (stackInfo));
-
+
return vduInstance;
}
-
+
private VduStatus stackStatusToVduStatus (StackInfo stackInfo)
{
VduStatus vduStatus = new VduStatus();
-
+
// Map the status fields to more generic VduStatus.
// There are lots of HeatStatus values, so this is a bit long...
HeatStatus heatStatus = stackInfo.getStatus();
String statusMessage = stackInfo.getStatusMessage();
-
+
if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) {
vduStatus.setState(VduStateType.INSTANTIATING);
vduStatus.setLastAction((new PluginAction ("create", "in_progress", statusMessage)));
@@ -1774,10 +1700,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
} else {
vduStatus.setState(VduStateType.UNKNOWN);
}
-
+
return vduStatus;
}
-
+
private void sleep(long time) {
try {
Thread.sleep(time);
@@ -1786,5 +1712,5 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Thread.currentThread().interrupt();
}
}
-
+
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java
new file mode 100644
index 0000000000..9b2475a1c4
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudParam.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.openstack.utils;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class MsoMulticloudParam {
+
+ @JsonProperty("generic-vnf-id")
+ private String genericVnfId;
+
+ @JsonProperty("vf-module-id")
+ private String vfModuleId;
+
+ @JsonProperty("oof_directives")
+ private String oofDirectives;
+
+ @JsonProperty("sdnc_directives")
+ private String sdncDirectives;
+
+ @JsonProperty("template_type")
+ private String templateType;
+
+ @JsonProperty("template_data")
+ private String templateData;
+
+ public void setGenericVnfId(String genericVnfId){
+ this.genericVnfId = genericVnfId;
+ }
+
+ public String getGenericVnfId(){
+ return this.genericVnfId;
+ }
+
+ public void setVfModuleId(String vfModuleId){
+ this.vfModuleId = vfModuleId;
+ }
+
+ public String getVfModuleId(){
+ return this.vfModuleId;
+ }
+
+ public void setOofDirectives(String oofDirectives){
+ this.oofDirectives = oofDirectives;
+ }
+
+ public String getOofDirectives(){
+ return this.oofDirectives;
+ }
+
+ public void setSdncDirectives(String sdncDirectives){
+ this.sdncDirectives = sdncDirectives;
+ }
+
+ public String getSdncDirectives(){
+ return this.sdncDirectives;
+ }
+
+ public void setTemplateType(String templateType){
+ this.templateType = templateType;
+ }
+
+ public String TemplateType(){
+ return this.templateType;
+ }
+
+ public void setTemplateData(String templateData){
+ this.templateData = templateData;
+ }
+
+ public String getTemplateData(){
+ return this.templateData;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("MulticloudParam{"
+ + "genericVnfId='%s',"
+ + " vfModuleId='%s',"
+ + " oofDirectives='%s',"
+ + " sdncDirectives='%s',"
+ + " templateType='%s',"
+ + " templateData='%s'"
+ + "}",
+ genericVnfId,
+ vfModuleId,
+ oofDirectives,
+ sdncDirectives,
+ templateType,
+ templateData);
+ }
+}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
new file mode 100644
index 0000000000..4ed35a4d28
--- /dev/null
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -0,0 +1,483 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.openstack.utils;
+
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
+import javax.ws.rs.core.Response;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.onap.so.adapters.vdu.CloudInfo;
+import org.onap.so.adapters.vdu.PluginAction;
+import org.onap.so.adapters.vdu.VduArtifact;
+import org.onap.so.adapters.vdu.VduArtifact.ArtifactType;
+import org.onap.so.adapters.vdu.VduException;
+import org.onap.so.adapters.vdu.VduInstance;
+import org.onap.so.adapters.vdu.VduModelInfo;
+import org.onap.so.adapters.vdu.VduPlugin;
+import org.onap.so.adapters.vdu.VduStateType;
+import org.onap.so.adapters.vdu.VduStatus;
+import org.onap.so.openstack.beans.HeatStatus;
+import org.onap.so.openstack.beans.StackInfo;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.exceptions.MsoOpenstackException;
+import org.onap.so.openstack.mappers.StackInfoMapper;
+import org.onap.so.client.HttpClient;
+import org.onap.so.client.RestClient;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.utils.TargetEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+import com.woorea.openstack.heat.model.CreateStackParam;
+import com.woorea.openstack.heat.model.Stack;
+
+@Component
+public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
+
+ @Autowired
+ protected CloudConfig cloudConfig;
+
+ @Autowired
+ private Environment env;
+
+ private static final String ONAP_IP = "ONAP_IP";
+
+ private static final String DEFAULT_MSB_IP = "127.0.0.1";
+
+ private static final Integer DEFAULT_MSB_PORT = 80;
+
+ private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
+
+ /******************************************************************************
+ *
+ * Methods (and associated utilities) to implement the VduPlugin interface
+ *
+ *******************************************************************************/
+
+ /**
+ * Create a new Stack in the specified cloud location and tenant. The Heat template
+ * and parameter map are passed in as arguments, along with the cloud access credentials.
+ * It is expected that parameters have been validated and contain at minimum the required
+ * parameters for the given template with no extra (undefined) parameters..
+ *
+ * The Stack name supplied by the caller must be unique in the scope of this tenant.
+ * However, it should also be globally unique, as it will be the identifier for the
+ * resource going forward in Inventory. This latter is managed by the higher levels
+ * invoking this function.
+ *
+ * The caller may choose to let this function poll Openstack for completion of the
+ * stack creation, or may handle polling itself via separate calls to query the status.
+ * In either case, a StackInfo object will be returned containing the current status.
+ * When polling is enabled, a status of CREATED is expected. When not polling, a
+ * status of BUILDING is expected.
+ *
+ * An error will be thrown if the requested Stack already exists in the specified
+ * Tenant and Cloud.
+ *
+ * For 1510 - add "environment", "files" (nested templates), and "heatFiles" (get_files) as
+ * parameters for createStack. If environment is non-null, it will be added to the stack.
+ * The nested templates and get_file entries both end up being added to the "files" on the
+ * stack. We must combine them before we add them to the stack if they're both non-null.
+ *
+ * @param cloudSiteId The cloud (may be a region) in which to create the stack.
+ * @param tenantId The Openstack ID of the tenant in which to create the Stack
+ * @param stackName The name of the stack to create
+ * @param heatTemplate The Heat template
+ * @param stackInputs A map of key/value inputs
+ * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
+ * @param environment An optional yaml-format string to specify environmental parameters
+ * @param files a Map<String, Object> that lists the child template IDs (file is the string, object is an int of
+ * Template id)
+ * @param heatFiles a Map<String, Object> that lists the get_file entries (fileName, fileBody)
+ * @param backout Donot delete stack on create Failure - defaulted to True
+ * @return A StackInfo object
+ * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
+ */
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public StackInfo createStack (String cloudSiteId,
+ String tenantId,
+ String stackName,
+ String heatTemplate,
+ Map <String, ?> stackInputs,
+ boolean pollForCompletion,
+ int timeoutMinutes,
+ String environment,
+ Map <String, Object> files,
+ Map <String, Object> heatFiles,
+ boolean backout) throws MsoException {
+
+ // Get the directives, if present.
+ String oofDirectives = null;
+ String sdncDirectives = null;
+ String genericVnfId = null;
+ String vfModuleId = null;
+
+ String key = "oof_directives";
+ if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) {
+ oofDirectives = (String) stackInputs.get(key);
+ stackInputs.remove(key);
+ }
+ key = "sdnc_directives";
+ if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) {
+ sdncDirectives = (String) stackInputs.get(key);
+ stackInputs.remove(key);
+ }
+ key = "generic_vnf_id";
+ if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) {
+ genericVnfId = (String) stackInputs.get(key);
+ stackInputs.remove(key);
+ }
+ key = "vf_module_id";
+ if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) {
+ vfModuleId = (String) stackInputs.get(key);
+ stackInputs.remove(key);
+ }
+
+ // create the multicloud payload
+ CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
+
+ MsoMulticloudParam multicloudParam = new MsoMulticloudParam();
+ multicloudParam.setGenericVnfId(genericVnfId);
+ multicloudParam.setVfModuleId(vfModuleId);
+ multicloudParam.setOofDirectives(oofDirectives);
+ multicloudParam.setSdncDirectives(sdncDirectives);
+ multicloudParam.setTemplateType("heat");
+ multicloudParam.setTemplateData(stack.toString());
+
+
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, null);
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+
+ if (multicloudClient != null) {
+ Response res = multicloudClient.post(multicloudParam);
+ logger.debug("Multicloud Post response is: " + res);
+ }
+
+ Stack responseStack = new Stack();
+ responseStack.setStackStatus(HeatStatus.CREATED.toString());
+
+ return new StackInfoMapper(responseStack).map();
+ }
+
+ public Map<String, Object> queryStackForOutputs(String cloudSiteId,
+ String tenantId, String stackName) throws MsoException {
+ logger.debug("MsoHeatUtils.queryStackForOutputs)");
+ StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName);
+ if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
+ return null;
+ }
+ return heatStack.getOutputs();
+ }
+
+ /**
+ * Query for a single stack (by Name) in a tenant. This call will always return a
+ * StackInfo object. If the stack does not exist, an "empty" StackInfo will be
+ * returned - containing only the stack name and a status of NOTFOUND.
+ *
+ * @param tenantId The Openstack ID of the tenant in which to query
+ * @param cloudSiteId The cloud identifier (may be a region) in which to query
+ * @param stackName The name of the stack to query (may be simple or canonical)
+ * @return A StackInfo object
+ * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
+ */
+ @Override
+ public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ logger.debug ("Query multicloud HEAT stack: " + stackName + " in tenant " + tenantId);
+
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackName);
+
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+
+ if (multicloudClient != null) {
+ Response response = multicloudClient.get();
+ logger.debug("Multicloud Get response is: " + response);
+
+ return new StackInfo (stackName, HeatStatus.CREATED);
+ }
+
+ return new StackInfo (stackName, HeatStatus.NOTFOUND);
+ }
+
+ public StackInfo deleteStack (String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ logger.debug ("Delete multicloud HEAT stack: " + stackName + " in tenant " + tenantId);
+
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackName);
+
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+
+ if (multicloudClient != null) {
+ Response response = multicloudClient.delete();
+ logger.debug("Multicloud Get response is: " + response);
+
+ return new StackInfo (stackName, HeatStatus.DELETING);
+ }
+
+ return new StackInfo (stackName, HeatStatus.FAILED);
+ }
+
+ // ---------------------------------------------------------------
+ // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS
+
+
+ private String getMsbHost() {
+ // MSB_IP will be set as ONAP_IP environment parameter in install flow.
+ String msbIp = System.getenv().get(ONAP_IP);
+
+ // if ONAP IP is not set. get it from config file.
+ if (null == msbIp || msbIp.isEmpty()) {
+ msbIp = env.getProperty("mso.msb-ip", DEFAULT_MSB_IP);
+ }
+ Integer msbPort = env.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
+
+ return UriBuilder.fromPath("").host(msbIp).port(msbPort).scheme("http").build().toString();
+ }
+
+ private String getMulticloudEndpoint(String cloudSiteId, String workloadId) throws MsoCloudSiteNotFound {
+
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
+ String endpoint = getMsbHost() + cloudSite.getIdentityService().getIdentityUrl();
+
+ if (workloadId != null) {
+ return endpoint + workloadId;
+ } else {
+ return endpoint;
+ }
+ }
+
+ private RestClient getMulticloudClient(String endpoint) {
+ RestClient client = null;
+ try {
+ client= new HttpClient(UriBuilder.fromUri(endpoint).build().toURL(),
+ "application/json", TargetEntity.OPENSTACK_ADAPTER);
+ } catch (MalformedURLException e) {
+ logger.debug("Encountered malformed URL error getting multicloud rest client " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ logger.debug("Encountered illegal argument getting multicloud rest client " + e.getMessage());
+ } catch (UriBuilderException e) {
+ logger.debug("Encountered URI builder error getting multicloud rest client " + e.getMessage());
+ }
+ return client;
+ }
+
+ /**
+ * VduPlugin interface for instantiate function.
+ *
+ * Translate the VduPlugin parameters to the corresponding 'createStack' parameters,
+ * and then invoke the existing function.
+ */
+ @Override
+ public VduInstance instantiateVdu (
+ CloudInfo cloudInfo,
+ String instanceName,
+ Map<String,Object> inputs,
+ VduModelInfo vduModel,
+ boolean rollbackOnFailure)
+ throws VduException
+ {
+ String cloudSiteId = cloudInfo.getCloudSiteId();
+ String tenantId = cloudInfo.getTenantId();
+
+ // Translate the VDU ModelInformation structure to that which is needed for
+ // creating the Heat stack. Loop through the artifacts, looking specifically
+ // for MAIN_TEMPLATE and ENVIRONMENT. Any other artifact will
+ // be attached as a FILE.
+ String heatTemplate = null;
+ Map<String,Object> nestedTemplates = new HashMap<>();
+ Map<String,Object> files = new HashMap<>();
+ String heatEnvironment = null;
+
+ for (VduArtifact vduArtifact: vduModel.getArtifacts()) {
+ if (vduArtifact.getType() == ArtifactType.MAIN_TEMPLATE) {
+ heatTemplate = new String(vduArtifact.getContent());
+ }
+ else if (vduArtifact.getType() == ArtifactType.NESTED_TEMPLATE) {
+ nestedTemplates.put(vduArtifact.getName(), new String(vduArtifact.getContent()));
+ }
+ else if (vduArtifact.getType() == ArtifactType.ENVIRONMENT) {
+ heatEnvironment = new String(vduArtifact.getContent());
+ }
+ }
+
+ try {
+ StackInfo stackInfo = createStack (cloudSiteId,
+ tenantId,
+ instanceName,
+ heatTemplate,
+ inputs,
+ true, // poll for completion
+ vduModel.getTimeoutMinutes(),
+ heatEnvironment,
+ nestedTemplates,
+ files,
+ rollbackOnFailure);
+ // Populate a vduInstance from the StackInfo
+ return stackInfoToVduInstance(stackInfo);
+ }
+ catch (Exception e) {
+ throw new VduException ("MsoMulticloudUtils (instantiateVDU): createStack Exception", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for query function.
+ */
+ @Override
+ public VduInstance queryVdu (CloudInfo cloudInfo, String instanceId)
+ throws VduException
+ {
+ String cloudSiteId = cloudInfo.getCloudSiteId();
+ String tenantId = cloudInfo.getTenantId();
+
+ try {
+ // Query the Cloudify Deployment object and populate a VduInstance
+ StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId);
+
+ return stackInfoToVduInstance(stackInfo);
+ }
+ catch (Exception e) {
+ throw new VduException ("MsoMulticloudUtils (queryVdu): queryStack Exception ", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for delete function.
+ */
+ @Override
+ public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes)
+ throws VduException
+ {
+ String cloudSiteId = cloudInfo.getCloudSiteId();
+ String tenantId = cloudInfo.getTenantId();
+
+ try {
+ // Delete the Multicloud stack
+ StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true);
+
+ // Populate a VduInstance based on the deleted Cloudify Deployment object
+ VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
+
+ // Override return state to DELETED (MulticloudUtils sets to NOTFOUND)
+ vduInstance.getStatus().setState(VduStateType.DELETED);
+
+ return vduInstance;
+ }
+ catch (Exception e) {
+ throw new VduException ("Delete VDU Exception", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for update function.
+ *
+ * Update is currently not supported in the MsoMulticloudUtils implementation of VduPlugin.
+ * Just return a VduException.
+ *
+ */
+ @Override
+ public VduInstance updateVdu (
+ CloudInfo cloudInfo,
+ String instanceId,
+ Map<String,Object> inputs,
+ VduModelInfo vduModel,
+ boolean rollbackOnFailure)
+ throws VduException
+ {
+ throw new VduException ("MsoMulticloudUtils: updateVdu interface not supported");
+ }
+
+
+ /*
+ * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object
+ */
+ protected VduInstance stackInfoToVduInstance (StackInfo stackInfo)
+ {
+ VduInstance vduInstance = new VduInstance();
+
+ // The full canonical name as the instance UUID
+ vduInstance.setVduInstanceId(stackInfo.getCanonicalName());
+ vduInstance.setVduInstanceName(stackInfo.getName());
+
+ // Copy inputs and outputs
+ vduInstance.setInputs(stackInfo.getParameters());
+ vduInstance.setOutputs(stackInfo.getOutputs());
+
+ // Translate the status elements
+ vduInstance.setStatus(stackStatusToVduStatus (stackInfo));
+
+ return vduInstance;
+ }
+
+ private VduStatus stackStatusToVduStatus (StackInfo stackInfo)
+ {
+ VduStatus vduStatus = new VduStatus();
+
+ // Map the status fields to more generic VduStatus.
+ // There are lots of HeatStatus values, so this is a bit long...
+ HeatStatus heatStatus = stackInfo.getStatus();
+ String statusMessage = stackInfo.getStatusMessage();
+
+ if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) {
+ vduStatus.setState(VduStateType.INSTANTIATING);
+ vduStatus.setLastAction((new PluginAction ("create", "in_progress", statusMessage)));
+ }
+ else if (heatStatus == HeatStatus.NOTFOUND) {
+ vduStatus.setState(VduStateType.NOTFOUND);
+ }
+ else if (heatStatus == HeatStatus.CREATED) {
+ vduStatus.setState(VduStateType.INSTANTIATED);
+ vduStatus.setLastAction((new PluginAction ("create", "complete", statusMessage)));
+ }
+ else if (heatStatus == HeatStatus.UPDATED) {
+ vduStatus.setState(VduStateType.INSTANTIATED);
+ vduStatus.setLastAction((new PluginAction ("update", "complete", statusMessage)));
+ }
+ else if (heatStatus == HeatStatus.UPDATING) {
+ vduStatus.setState(VduStateType.UPDATING);
+ vduStatus.setLastAction((new PluginAction ("update", "in_progress", statusMessage)));
+ }
+ else if (heatStatus == HeatStatus.DELETING) {
+ vduStatus.setState(VduStateType.DELETING);
+ vduStatus.setLastAction((new PluginAction ("delete", "in_progress", statusMessage)));
+ }
+ else if (heatStatus == HeatStatus.FAILED) {
+ vduStatus.setState(VduStateType.FAILED);
+ vduStatus.setErrorMessage(stackInfo.getStatusMessage());
+ } else {
+ vduStatus.setState(VduStateType.UNKNOWN);
+ }
+
+ return vduStatus;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index b440f7d521..e9567170dd 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -29,7 +29,7 @@
* - base and volume module queries
* - rollback logic
* - logging and error handling
- *
+ *
* Then based on the orchestration mode of the VNF, it will invoke different VDU plug-ins
* to perform the low level instantiations, deletions, and queries. At this time, the
* set of available plug-ins is hard-coded, though in the future a dynamic selection
@@ -81,6 +81,7 @@ import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoKeystoneUtils;
+import org.onap.so.openstack.utils.MsoMulticloudUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -100,28 +101,31 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
-
+
@Autowired
protected CloudConfig cloudConfig;
-
+
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
-
+
@Autowired
private Environment environment;
@Autowired
protected MsoKeystoneUtils keystoneUtils;
-
+
@Autowired
protected MsoCloudifyUtils cloudifyUtils;
-
+
@Autowired
protected MsoHeatUtils heatUtils;
-
+
+ @Autowired
+ protected MsoMulticloudUtils multicloudUtils;
+
@Autowired
protected VfModuleCustomizationToVduMapper vduMapper;
-
+
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
@@ -192,9 +196,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
/**
* This is the "Query VNF" web service implementation.
- *
+ *
* This really should be QueryVfModule, but nobody ever changed it.
- *
+ *
* The method returns an indicator that the VNF exists, along with its status and outputs.
* The input "vnfName" will also be reflected back as its ID.
*
@@ -244,7 +248,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new VnfException (e);
}
-
+
if (vduInstance != null && vduInstance.getStatus().getState() != VduStateType.NOTFOUND) {
vnfExists.value = Boolean.TRUE;
status.value = vduStatusToVnfStatus(vduInstance);
@@ -265,7 +269,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
return;
}
-
+
/**
* This is the "Delete VNF" web service implementation.
* This function is now unsupported and will return an error.
@@ -278,7 +282,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
MsoRequest msoRequest) throws VnfException {
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("DeleteVnf");
-
+
// This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
LOGGER.debug ("DeleteVNF command attempted but not supported");
throw new VnfException ("DeleteVNF: Unsupported command", MsoExceptionCategory.USERDATA);
@@ -289,7 +293,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
* A rollback object is returned to the client in a successful creation
* response. The client can pass that object as-is back to the rollbackVnf
* operation to undo the creation.
- *
+ *
* TODO: This should be rollbackVfModule and/or rollbackVolumeGroup,
* but APIs were apparently never updated.
*/
@@ -309,7 +313,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Rollback VF Module - nothing to roll back");
return;
}
-
+
// Get the elements of the VnfRollback object for easier access
String cloudSiteId = rollback.getCloudSiteId ();
String tenantId = rollback.getTenantId ();
@@ -330,7 +334,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
try {
// TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object and use that.
vduInstance = vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
-
+
LOGGER.debug("Rolled back VDU instantiation: " + vduInstance.getVduInstanceId());
LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VDU Plugin", "VDU", "DeleteVdu", null);
}
@@ -354,7 +358,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// DeploymentInfo object should be enhanced to report a better status internally.
VduStatus vduStatus = vdu.getStatus();
VduStateType status = vduStatus.getState();
-
+
if (status == null) {
return VnfStatus.UNKNOWN;
}
@@ -379,7 +383,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
{
String type = templateParam.getParamType();
LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type);
-
+
if (type.equalsIgnoreCase("number")) {
try {
return Integer.valueOf(inputValue);
@@ -400,7 +404,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} else if (type.equalsIgnoreCase("boolean")) {
return new Boolean(inputValue);
}
-
+
// Nothing else matched. Return the original string
return inputValue;
}
@@ -464,9 +468,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
}
LOGGER.debug(sb.toString());
- return;
+ return;
}
-
+
private void sendMapToDebug(Map<String, String> inputs) {
int i = 0;
StringBuilder sb = new StringBuilder("inputs:");
@@ -612,7 +616,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
{
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
-
+
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("CreateVfModule");
@@ -625,14 +629,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
-
+
// Clean up some inputs to make comparisons easier
if (requestType == null)
requestType = "";
-
+
if ("".equals(volumeGroupId) || "null".equals(volumeGroupId))
- volumeGroupId = null;
-
+ volumeGroupId = null;
+
if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId))
baseVfModuleId = null;
@@ -643,7 +647,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} else {
this.sendMapToDebug(inputs);
}
-
+
// Check if this is for a "Volume" module
boolean isVolumeRequest = false;
if (requestType.startsWith("VOLUME")) {
@@ -663,7 +667,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vfRollback.setBaseGroupHeatStackId(baseVfModuleId);
vfRollback.setModelCustomizationUuid(modelCustomizationUuid);
vfRollback.setMode("CFY");
-
+
rollback.value = vfRollback; // Default rollback - no updates performed
// Get the VNF/VF Module definition from the Catalog DB first.
@@ -675,7 +679,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
try {
vfModuleCust = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid);
-
+
if (vfModuleCust == null) {
String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid;
LOGGER.debug(error);
@@ -692,7 +696,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vnfResource = vfModuleCust.getVfModule().getVnfResources();
}
catch (Exception e) {
-
+
LOGGER.debug("unhandled exception in create VF - [Query]" + e.getMessage());
throw new VnfException("Exception during create VF " + e.getMessage());
}
@@ -706,10 +710,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
CloudSite cloudSite = cloudSiteOp.get();
MavenLikeVersioning aicV = new MavenLikeVersioning();
aicV.setVersion(cloudSite.getCloudVersion());
-
+
String vnfMin = vnfResource.getAicVersionMin();
String vnfMax = vnfResource.getAicVersionMax();
-
+
if ( (vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) ||
(vnfMax != null && aicV.isMoreRecentThan(vnfMax)))
{
@@ -720,11 +724,11 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
// End Version check
-
-
+
+
VduInstance vduInstance = null;
CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null);
-
+
// Use the VduPlugin.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
@@ -746,12 +750,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
me.addContext ("CreateVFModule");
throw new VnfException (me);
}
-
+
// More precise handling/messaging if the Module already exists
if (vduInstance != null && !(vduInstance.getStatus().getState() == VduStateType.NOTFOUND)) {
VduStateType status = vduInstance.getStatus().getState();
LOGGER.debug ("Found Existing VDU, status=" + status);
-
+
if (status == VduStateType.INSTANTIATED) {
if (failIfExists != null && failIfExists) {
// fail - it exists
@@ -799,8 +803,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
}
}
-
-
+
+
// Collect outputs from Base Modules and Volume Modules
Map<String, Object> baseModuleOutputs = null;
Map<String, Object> volumeGroupOutputs = null;
@@ -824,7 +828,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
me.addContext ("CreateVFModule(QueryVolume)");
throw new VnfException (me);
}
-
+
if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST");
@@ -837,7 +841,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs");
}
}
-
+
// If this is an Add-On Module, query the Base Module outputs
// Note: This will be performed whether or not the current request is for an
// Add-On Volume Group or Add-On VF Module
@@ -847,7 +851,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vfRollback.setIsBase(true);
} else {
LOGGER.debug("This is an Add-On Module request");
-
+
// Add-On Modules should always have a Base, but just treat as a warning if not provided.
// Add-on Volume requests may or may not specify a base.
if (!isVolumeRequest && baseVfModuleId == null) {
@@ -867,12 +871,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryVdu(Base)", me);
LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu(Base)", baseVfModuleId);
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
+
// Convert to a generic VnfException
me.addContext ("CreateVFModule(QueryBase)");
throw new VnfException (me);
}
-
+
if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST");
@@ -886,14 +890,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
}
}
-
+
// NOTE: For this section, heatTemplate is used for all template artifacts.
// In final implementation (post-POC), the template object would either be generic or there would
// be a separate DB Table/Object for different sub-orchestrators.
// NOTE: The template is fixed for the VF Module. The environment is part of the customization.
-
+
HeatTemplate heatTemplate = null;
HeatEnvironment heatEnvironment = null;
if (isVolumeRequest) {
@@ -903,7 +907,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
heatTemplate = vfModule.getModuleHeatTemplate();
heatEnvironment = vfModuleCust.getHeatEnvironment();
}
-
+
if (heatTemplate == null) {
String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error);
@@ -914,7 +918,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} else {
LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
}
-
+
if (heatEnvironment == null) {
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
@@ -927,15 +931,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
}
-
+
// Create the combined set of parameters from the incoming request, base-module outputs,
// volume-module outputs. Also, convert all variables to their native object types.
-
+
HashMap<String, Object> goldenInputs = new HashMap<String,Object>();
List<String> extraInputs = new ArrayList<String>();
Boolean skipInputChecks = false;
-
+
if (skipInputChecks) {
goldenInputs = new HashMap<String,Object>();
for (String key : inputs.keySet()) {
@@ -945,10 +949,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
else {
// Build maps for the parameters (including aliases) to simplify checks
HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
-
+
Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
LOGGER.debug("paramSet has " + paramSet.size() + " entries");
-
+
for (HeatTemplateParam htp : paramSet) {
params.put(htp.getParamName(), htp);
@@ -958,7 +962,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
params.put(alias, htp);
}
}
-
+
// First, convert all inputs to their "template" type
for (String key : inputs.keySet()) {
if (params.containsKey(key)) {
@@ -973,11 +977,22 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
extraInputs.add(key);
}
}
-
+
if (!extraInputs.isEmpty()) {
+ // Add directive inputs
+ String[] directives = { "oof_directives", "sdnc_directives" };
+ for (String key : directives) {
+ if (extraInputs.contains(key)) {
+ goldenInputs.put(key, inputs.get(key));
+ extraInputs.remove(key);
+ if (extraInputs.isEmpty()) {
+ break;
+ }
+ }
+ }
LOGGER.debug("Ignoring extra inputs: " + extraInputs);
}
-
+
// Next add in Volume Group Outputs if there are any. Copy directly without conversions.
if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) {
for (String key : volumeGroupOutputs.keySet()) {
@@ -986,7 +1001,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
}
}
-
+
// Next add in Base Module Outputs if there are any. Copy directly without conversions.
if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
for (String key : baseModuleOutputs.keySet()) {
@@ -995,14 +1010,13 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
}
}
-
+
// TODO: The model should support a mechanism to pre-assign default parameter values
// per "customization" (i.e. usage) of a given module. In HEAT, this is specified by
// an Environment file. There is not a general mechanism in the model to handle this.
// For the general case, any such parameter/values can be added dynamically to the
// inputs (only if not already specified).
-
-
+
// Check that required parameters have been supplied from any of the sources
String missingParams = null;
boolean checkRequiredParameters = true;
@@ -1017,7 +1031,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// No problem - default is true
LOGGER.debug ("An exception occured trying to get property " + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS, e);
}
-
+
// Do the actual parameter checking.
// Include looking at the ENV file as a valid definition of a parameter value.
// TODO: This handling of ENV applies only to Heat. A general mechanism to
@@ -1040,7 +1054,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
}
}
-
+
if (missingParams != null) {
if (checkRequiredParameters) {
// Problem - missing one or more required parameters
@@ -1056,12 +1070,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
} // NOTE: END PARAMETER CHECKING
-
-
+
+
// Here we go... ready to deploy the VF Module.
long instantiateVduStartTime = System.currentTimeMillis ();
if (backout == null) backout = true;
-
+
try {
// Construct the VDU Model structure to pass to the targeted VduPlugin
VduModelInfo vduModel = null;
@@ -1070,10 +1084,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
} else {
vduModel = vduMapper.mapVfModuleCustVolumeToVdu(vfModuleCust);
}
-
+
// Invoke the VduPlugin to instantiate the VF Module
vduInstance = vduPlugin.instantiateVdu(cloudInfo, vfModuleName, goldenInputs, vduModel, backout);
-
+
LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "instantiateVdu", vfModuleName);
}
catch (VduException me) {
@@ -1100,7 +1114,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, error);
LOGGER.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
- }
+ }
// Reach this point if create is successful.
@@ -1108,7 +1122,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
vfRollback.setVnfCreated (true);
vfRollback.setVnfId (vduInstance.getVduInstanceId());
vnfId.value = vduInstance.getVduInstanceId();
- outputs.value = copyStringOutputs (vduInstance.getOutputs ());
+ outputs.value = copyStringOutputs (vduInstance.getOutputs ());
rollback.value = vfRollback;
@@ -1117,7 +1131,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
return;
}
-
+
public void deleteVfModule (String cloudSiteId,
String tenantId,
String vfModuleId,
@@ -1126,15 +1140,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
{
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("DeleteVfModule");
-
+
LOGGER.debug ("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
long startTime = System.currentTimeMillis ();
-
+
// Capture the output parameters on a delete, so need to query first
VduInstance vduInstance = null;
CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null);
-
+
// Use the VduPlugin.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
@@ -1152,7 +1166,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
throw new VnfException (e);
}
-
+
// call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types
outputs.value = convertMapStringObjectToStringString(vduInstance.getOutputs());
@@ -1214,16 +1228,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
if (cloudSiteOp.isPresent()) {
CloudSite cloudSite = cloudSiteOp.get();
String orchestrator = cloudSite.getOrchestrator();
-
+
if (orchestrator.equalsIgnoreCase("CLOUDIFY")) {
- return cloudifyUtils;
+ return cloudifyUtils;
}
else if (orchestrator.equalsIgnoreCase("HEAT")) {
return heatUtils;
}
+ if (orchestrator.equalsIgnoreCase("MULTICLOUD")) {
+ LOGGER.debug ("Got MulticloudUtils for vduPlugin");
+ return multicloudUtils; }
}
-
- // Default - return HEAT plugin, though will fail later
+ // Default - return HEAT plugin, though will fail later
return heatUtils;
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
index 4da026f454..88f102c2a5 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
@@ -7,9 +7,9 @@
* 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.
@@ -32,16 +32,19 @@ import org.springframework.stereotype.Component;
public class VnfAdapterRestUtils
{
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRestUtils.class);
-
+
@Autowired
private CloudConfig cloudConfig;
-
+
@Autowired
private MsoVnfCloudifyAdapterImpl cloudifyImpl;
-
+
@Autowired
private MsoVnfAdapterImpl vnfImpl;
-
+
+ @Autowired
+ private MsoVnfPluginAdapterImpl vnfPluginImpl;
+
/*
* Choose which implementation of VNF Adapter to use, based on the orchestration mode.
* Currently, the two supported orchestrators are HEAT and CLOUDIFY.
@@ -72,7 +75,7 @@ public class VnfAdapterRestUtils
LOGGER.debug ("GetVnfAdapterImpl: mode=" + mode);
MsoVnfAdapter vnfAdapter = null;
-
+
// TODO: Make this more dynamic (e.g. Service Loader)
if ("CLOUDIFY".equalsIgnoreCase(mode)) {
LOGGER.debug ("GetVnfAdapterImpl: Return Cloudify Adapter");
@@ -82,12 +85,16 @@ public class VnfAdapterRestUtils
LOGGER.debug ("GetVnfAdapterImpl: Return Heat Adapter");
vnfAdapter = vnfImpl;
}
+ else if ("MULTICLOUD".equalsIgnoreCase(mode)) {
+ LOGGER.debug ("GetVnfAdapterImpl: Return Plugin (multicloud) Adapter");
+ vnfAdapter = vnfPluginImpl;
+ }
else {
// Don't expect this, but default is the HEAT adapter
LOGGER.debug ("GetVnfAdapterImpl: Return Default (Heat) Adapter");
vnfAdapter = vnfImpl;
}
-
+
return vnfAdapter;
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
index b21f1f3db2..77ef8d4776 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java
@@ -7,9 +7,9 @@
* 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.
@@ -20,15 +20,31 @@
package org.onap.so.adapters.vnf;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.client.WireMock;
import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.vdu.CloudInfo;
+import org.onap.so.adapters.vdu.VduInstance;
+import org.onap.so.adapters.vdu.VduStateType;
+import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.entity.MsoRequest;
+import org.onap.so.openstack.beans.HeatStatus;
+import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.utils.MsoMulticloudUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.ws.rs.core.MediaType;
import javax.xml.ws.Holder;
import java.util.HashMap;
import java.util.Map;
@@ -36,11 +52,15 @@ import java.util.Map;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.reset;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.mockito.Mockito.when;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404;
import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessMulticloud;
+import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse;
public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
@@ -52,6 +72,53 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
+ /***
+ * Before each test execution, updating IdentityUrl port value to the ramdom wireMockPort
+ * Since URL will be used as a rest call and required to be mocked in unit tests
+ */
+ @Before
+ public void setUp() throws Exception {
+ reset();
+ mapper = new ObjectMapper();
+
+ CloudIdentity identity = new CloudIdentity();
+ identity.setId("MTN13");
+ identity.setMsoId("m93945");
+ identity.setMsoPass("93937EA01B94A10A49279D4572B48369");
+ identity.setAdminTenant("admin");
+ identity.setMemberRole("admin");
+ identity.setTenantMetadata(new Boolean(true));
+ identity.setIdentityUrl("http://localhost:"+wireMockPort+"/v2.0");
+ identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD);
+
+ CloudSite cloudSite = new CloudSite();
+ cloudSite.setId("MTN13");
+ cloudSite.setCloudVersion("3.0");
+ cloudSite.setClli("MDT13");
+ cloudSite.setRegionId("MTN13");
+ cloudSite.setOrchestrator("multicloud" +
+ "");
+ identity.setIdentityServerType(ServerType.KEYSTONE);
+ cloudSite.setIdentityService(identity);
+
+
+
+ stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
+ .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
+ .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse()
+ .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, ""))
+ .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ cloudConfig.getCloudSite("MTN13").get().getIdentityService().setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
+ }
+
@Test
public void createVfModule_ModelCustUuidIsNull() throws Exception {
expectedException.expect(VnfException.class);
@@ -88,18 +155,52 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils {
new Holder<VnfRollback>());
}
- @Test
+ /* @Test
public void createVfModule_INSTANTIATED() throws Exception {
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackVfModule_200();
+
MsoRequest msoRequest = getMsoRequest();
Map<String, String> map = new HashMap<>();
map.put("key1", "value1");
- msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
- "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }*/
+
+ @Test
+ public void createVfModule_INSTANTIATED_Multicloud() throws Exception {
+ mockOpenStackResponseAccessMulticloud(wireMockPort);
+ mockOpenStackGetStackVfModule_200();
+
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
+ Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
+ }
+
+ /*
+ @Test
+ public void createVfModule_Multicloud() throws Exception {
+ expectedException.expect(VnfException.class);
+ mockOpenStackResponseAccessMulticloud(wireMockPort);
+ mockOpenStackGetStackVfModule_404();
+
+ MsoRequest msoRequest = getMsoRequest();
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ map.put("oof_directives", "{ abc: 123 }");
+ map.put("sdnc_directives", "{ def: 456 }");
+ msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD",
+ null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map,
Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
}
+ */
@Test
public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
index 98d5f7eb5f..569a845caa 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
@@ -49,6 +49,12 @@ public class StubOpenStack {
.withStatus(HttpStatus.SC_OK)));
}
+ public static void mockOpenStackResponseAccessMulticloud(int port) throws IOException {
+ stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody(getBodyFromFile("OpenstackResponse_AccessMulticloud.json", port, "/mockPublicUrl"))
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
public static void mockOpenStackResponseAccessQueryNetwork(int port) throws IOException {
stubFor(post(urlPathEqualTo("/v2.0/tokens"))
.withRequestBody(containing("tenantId"))
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json
new file mode 100644
index 0000000000..23fbe840e4
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_AccessMulticloud.json
@@ -0,0 +1,40 @@
+{
+ "access": {
+ "token": {
+ "id": "tokenId1234",
+ "issued_at": null,
+ "expires": "1517418429142",
+ "tenant": null
+ },
+ "serviceCatalog": [
+ {
+ "type": "orchestration",
+ "name": null,
+ "endpoints": [
+ {
+ "region": "MTN13",
+ "publicURL": "port",
+ "internalURL": null,
+ "adminURL": null
+ }
+ ],
+ "endpointsLinks": null
+ },
+ {
+ "type": "network",
+ "name": null,
+ "endpoints": [
+ {
+ "region": "MTN13",
+ "publicURL": "port",
+ "internalURL": null,
+ "adminURL": null
+ }
+ ],
+ "endpointsLinks": null
+ }
+ ],
+ "user": null,
+ "metadata": null
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index 35e68bb79f..70f91671a8 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -24,8 +24,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.core.domain.CloudFlavor
+
import org.onap.so.bpmn.core.domain.InventoryType
import org.onap.so.bpmn.core.domain.Resource
import org.onap.so.bpmn.core.domain.ResourceType
@@ -33,7 +32,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.Subscriber
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.onap.so.db.catalog.beans.CloudIdentity
+import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.rest.APIResponse
import org.onap.so.rest.RESTClient
import org.onap.so.rest.RESTConfig
@@ -52,7 +52,6 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.*
*/
class OofHoming extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofHoming.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
OofUtils oofUtils = new OofUtils(this)
@@ -114,10 +113,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
def authHeader = ""
String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-
-
-
String basicAuthValue = utils.encrypt(basicAuth, msokey)
if (basicAuthValue != null) {
utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue,
@@ -156,8 +152,8 @@ class OofHoming extends AbstractServiceTaskProcessor {
execution.setVariable("oofRequest", oofRequest)
utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled)
- String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution);
- String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution);
+ String endpoint = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.endpoint", execution)
+ String host = UrnPropertiesReader.getVariable("mso.oof.service.agnostic.host", execution)
String url = host + endpoint
utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled)
@@ -240,30 +236,12 @@ class OofHoming extends AbstractServiceTaskProcessor {
}
resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
- // TODO Deal with Placement Solutions & Assignment Info here
JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
- Integer arrayIndex = 0
- Integer flavorsIndex = null
- Boolean foundFlavors = false
- String flavors = null
- Map<String, String> flavorsMap = null
- ArrayList<CloudFlavor> flavorsArrayList = new ArrayList<CloudFlavor>()
+ String oofDirectives = null
assignmentArr.each { element ->
JSONObject jsonObject = new JSONObject(element.toString())
- if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") {
- flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value")
- foundFlavors = true
- flavorsIndex = arrayIndex
- } else {
- arrayIndex += 1
- }
- }
- if (foundFlavors) {
- assignmentArr.remove(flavorsIndex)
- flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString())
- flavorsMap.each { label, flavor ->
- CloudFlavor cloudFlavor = new CloudFlavor(label, flavor)
- flavorsArrayList.add(cloudFlavor)
+ if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "oof_directives") {
+ oofDirectives = jsonUtil.getJsonRawValue(jsonObject.toString(), "value")
}
}
Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution,
@@ -272,10 +250,26 @@ class OofHoming extends AbstractServiceTaskProcessor {
String cloudRegionId = assignmentMap.get("locationId")
resource.getHomingSolution().setCloudOwner(cloudOwner)
resource.getHomingSolution().setCloudRegionId(cloudRegionId)
- if (flavorsArrayList != null && flavorsArrayList.size != 0) {
- resource.getHomingSolution().setFlavors(flavorsArrayList)
- execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList)
- utils.log("DEBUG", "***** _flavorList is: " + flavorsArrayList.toString() +
+
+ CloudSite cloudSite = new CloudSite();
+ cloudSite.setId(cloudRegionId)
+ cloudSite.setRegionId(cloudRegionId)
+ String orchestrator = execution.getVariable("orchestrator")
+ if ((orchestrator != null) || (orchestrator != "")) {
+ cloudSite.setOrchestrator(orchestrator)
+ }
+
+ CloudIdentity cloudIdentity = new CloudIdentity();
+ cloudIdentity.setId(cloudRegionId);
+ cloudIdentity.setIdentityUrl("/api/multicloud /v1/" + cloudOwner + "/" + cloudRegionId + "/infra_workload")
+ cloudSite.setIdentityService(cloudIdentity);
+
+ // Set cloudsite in catalog DB here
+ oofUtils.createCloudSiteCatalogDb(cloudSite)
+
+ if (oofDirectives != null && oofDirectives != "") {
+ resource.getHomingSolution().setOofDirectives(oofDirectives)
+ utils.log("DEBUG", "***** OofDirectives is: " + oofDirectives +
" *****", "true")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 8ce633845b..d95795906f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.domain.HomingSolution
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.Resource
@@ -33,22 +33,32 @@ import org.onap.so.bpmn.core.domain.ServiceInstance
import org.onap.so.bpmn.core.domain.Subscriber
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
-
-import java.lang.reflect.Array
+import org.onap.so.db.catalog.beans.CloudSite
+import org.onap.so.rest.APIResponse
+import org.onap.so.rest.RESTClient
+import org.onap.so.rest.RESTConfig
+import org.springframework.http.HttpEntity
+import org.springframework.http.HttpHeaders
+import org.springframework.http.HttpMethod
+import org.springframework.http.ResponseEntity
+import org.springframework.http.client.BufferingClientHttpRequestFactory
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
+import org.springframework.web.client.RestTemplate
+import org.springframework.web.util.UriComponentsBuilder
+
+import javax.ws.rs.core.MediaType
+import javax.ws.rs.core.Response
+import javax.xml.ws.http.HTTPException
import static org.onap.so.bpmn.common.scripts.GenericUtils.*
class OofUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, OofUtils.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
private AbstractServiceTaskProcessor utils
- public MsoUtils msoUtils = new MsoUtils()
-
- public OofUtils(AbstractServiceTaskProcessor taskProcessor) {
+ OofUtils(AbstractServiceTaskProcessor taskProcessor) {
this.utils = taskProcessor
}
@@ -466,4 +476,39 @@ class OofUtils {
if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)}
return candidatesJson
}
+ /**
+ * This method creates a cloudsite in catalog database.
+ *
+ * @param CloudSite cloudSite
+ *
+ * @return void
+ */
+ Void createCloudSiteCatalogDb(CloudSite cloudSite, DelegateExecution execution) {
+
+ String endpoint = UrnPropertiesReader.getVariable("mso.catalog.db.spring.endpoint", execution)
+ String auth = UrnPropertiesReader.getVariable("mso.db.auth", execution)
+ String uri = "/cloudSite"
+
+ HttpHeaders headers = new HttpHeaders()
+
+ headers.set(HttpHeaders.AUTHORIZATION, auth)
+ headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON)
+ headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(endpoint + uri)
+ HttpEntity<CloudSite> request = new HttpEntity<CloudSite>(cloudSite, headers)
+ RESTConfig config = new RESTConfig(endpoint + uri)
+ RESTClient client = new RESTClient(config).addAuthorizationHeader(auth).
+ addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON).addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ APIResponse response = client.httpPost(request.getBody().toString())
+
+ int responseCode = response.getStatusCode()
+ logDebug("CatalogDB response code is: " + responseCode, isDebugEnabled)
+ String syncResponse = response.getResponseBodyAsString()
+ logDebug("CatalogDB response is: " + syncResponse, isDebugEnabled)
+
+ if(responseCode != 202){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.")
+ }
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
index 57e6864943..e4eb01e7fb 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
@@ -45,7 +45,7 @@ public class HomingSolution extends JsonWrapper implements Serializable {
private String aicVersion;
private String tenant;
private VnfResource vnf;
- private List<CloudFlavor> flavors;
+ private String oofDirectives;
private License license = new License();
@@ -130,12 +130,12 @@ public class HomingSolution extends JsonWrapper implements Serializable {
/**
* @return a map<string, string> key is label name, value is any flavor
*/
- public List<CloudFlavor> getFlavors() {
- return flavors;
+ public String getOofDirectives() {
+ return oofDirectives;
}
- public void setFlavors(List<CloudFlavor> flavors) {
- this.flavors = flavors;
+ public void setOofDirectives(String oofDirectives) {
+ this.oofDirectives = oofDirectives;
}
public License getLicense() {
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
index 9bcc5593e2..d2dbde4843 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
@@ -38,7 +38,6 @@ import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.core.domain.AllottedResource;
-import org.onap.so.bpmn.core.domain.CloudFlavor;
import org.onap.so.bpmn.core.domain.HomingSolution;
import org.onap.so.bpmn.core.domain.ModelInfo;
import org.onap.so.bpmn.core.domain.NetworkResource;
@@ -122,12 +121,133 @@ public class OofHomingIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setNfFunction("testVnfFunctionName");
- ArrayList<CloudFlavor> flavors = new ArrayList<>();
- CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
- CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
- flavors.add(flavor1);
- flavors.add(flavor2);
- vnf.getHomingSolution().setFlavors(flavors);
+ vnf.getHomingSolution().setOofDirectives(
+ "{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " \"sdnc_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
index 33e444310f..748552623e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.core.domain.AllottedResource;
-import org.onap.so.bpmn.core.domain.CloudFlavor;
import org.onap.so.bpmn.core.domain.HomingSolution;
import org.onap.so.bpmn.core.domain.ModelInfo;
import org.onap.so.bpmn.core.domain.NetworkResource;
@@ -126,12 +125,133 @@ public class OofHomingTestIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setResourceInstanceName("testVnfInstanceName");
- ArrayList<CloudFlavor> flavors = new ArrayList<>();
- CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
- CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
- flavors.add(flavor1);
- flavors.add(flavor2);
- vnf.getHomingSolution().setFlavors(flavors);
+ vnf.getHomingSolution().setOofDirectives(
+ "{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " \"sdnc_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index ad51b3f69e..3523703ee8 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -197,11 +197,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
-
- </dependency>
- <dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
</dependency>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 59d38bfe86..0f50ae6c27 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.scripts
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONArray
@@ -38,7 +37,7 @@ import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.bpmn.core.domain.CloudFlavor
+
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
@@ -174,8 +173,8 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId)
rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId)
msoLogger.debug("serviceInstanceId: " + serviceInstanceId)
- //flavorList
- ArrayList<CloudFlavor> flavorList = execution.getVariable(cloudSiteId + "_flavorList")
+ //OofDirectives
+ String oofDirectives = execution.getVariable(cloudSiteId + "_oofDirectives")
if (flavorList != null) {
execution.setVariable("DCVFM_flavorList", flavorList)
logDebug("flavorList is: " + flavorList, isDebugLogEnabled)
@@ -921,8 +920,8 @@ public class DoCreateVfModule extends VfModuleBase {
def serviceId = execution.getVariable("DCVFM_serviceId")
//serviceInstanceId
def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId")
- //flavorList
- ArrayList<CloudFlavor> flavorList = execution.getVariable("DCVFM_flavorList")
+ //OofDirectives
+ String oofDirectives = execution.getVariable("DCVFM_oofDirectives")
//backoutOnFailure
def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure")
//volumeGroupId
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index 86c5f65e8c..dd135f3af5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -232,6 +232,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
}
if ("Homing_Solution".equals(userParam?.name)) {
execution.setVariable("homingService", userParam.value)
+ execution.setVariable("callHoming", true)
inputMap.put("Homing_Solution", userParam.value)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index 4db7b3ff66..63b66cafe5 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -168,11 +168,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
-
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
new file mode 100644
index 0000000000..f65dde1af5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/OofHomingV2.java
@@ -0,0 +1,615 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.so.bpmn.buildingblock;
+
+import org.apache.commons.lang.SerializationUtils;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import java.util.ArrayList;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionCandidates;
+import org.onap.so.bpmn.servicedecomposition.homingobjects.SolutionInfo;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoMetadata;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.oof.OofClient;
+import org.onap.so.client.oof.OofValidator;
+import org.onap.so.client.oof.beans.ModelInfo;
+import org.onap.so.client.oof.beans.OofRequest;
+import org.onap.so.client.oof.beans.OofRequestParameters;
+import org.onap.so.client.oof.beans.PlacementDemand;
+import org.onap.so.client.oof.beans.PlacementInfo;
+import org.onap.so.client.oof.beans.RequestInfo;
+import org.onap.so.client.oof.beans.ResourceModelInfo;
+import org.onap.so.client.oof.beans.ServiceInfo;
+import org.onap.so.client.oof.beans.SubscriberInfo;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.springframework.web.util.UriUtils;
+
+import java.time.Duration;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.apache.commons.lang3.StringUtils.isBlank;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
+
+/**
+ * The oof homing building block obtains licensing and homing solutions for a given
+ * resource or set of resources.
+ *
+ */
+@Component("OofHoming")
+public class OofHomingV2 {
+
+ private static final Logger logger = LoggerFactory.getLogger(OofHomingV2.class);
+ private JsonUtils jsonUtils = new JsonUtils();
+ @Autowired
+ private Environment env;
+ @Autowired
+ private OofClient client;
+ @Autowired
+ private OofValidator oofValidator;
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ private static final String MODEL_NAME = "modelName";
+ private static final String MODEL_INVARIANT_ID = "modelInvariantId";
+ private static final String MODEL_VERSION_ID = "modelVersionId";
+ private static final String MODEL_VERSION = "modelVersion";
+ private static final String SERVICE_RESOURCE_ID = "serviceResourceId";
+ private static final String RESOURCE_MODULE_NAME = "resourceModuleName";
+ private static final String RESOURCE_MODEL_INFO = "resourceModelInfo";
+ private static final String IDENTIFIER_TYPE = "identifierType";
+ private static final String INVENTORY_TYPE = "inventoryType";
+ private static final String SOLUTIONS = "solutions";
+ private static final String RESOURCE_MISSING_DATA = "Resource does not contain: ";
+ private static final String SERVICE_MISSING_DATA = "Service Instance does not contain: ";
+ private static final String UNPROCESSABLE = "422";
+ private static final int INTERNAL = 500;
+
+ /**
+ * Generates the request payload then sends to Oof to perform homing and
+ * licensing for the provided demands
+ *
+ * @param execution
+ */
+ public void callOof(BuildingBlockExecution execution){
+ logger.trace("Started Sniro Homing Call Sniro");
+ try{
+ GeneralBuildingBlock bb = execution.getGeneralBuildingBlock();
+
+ RequestContext requestContext = bb.getRequestContext();
+ RequestParameters requestParams = requestContext.getRequestParameters();
+ String requestId = requestContext.getMsoRequestId();
+
+ ServiceInstance serviceInstance = bb.getCustomer().getServiceSubscription().getServiceInstances().get(0);
+ Customer customer = bb.getCustomer();
+
+ String timeout = execution.getVariable("timeout");
+ if(isBlank(timeout)){
+ timeout = env.getProperty("oof.timeout", "PT30M");
+ }
+
+ OofRequest request = new OofRequest();
+
+ RequestInfo requestInfo = (RequestInfo)buildRequestInfo(requestId, timeout);
+ request.setRequestInformation(requestInfo);
+
+ ServiceInfo serviceInfo = buildServiceInfo(serviceInstance);
+ request.setServiceInformation(serviceInfo);
+
+ PlacementInfo placementInfo = buildPlacementInfo(customer, requestParams);
+
+ ArrayList<PlacementDemand> placementDemands = buildPlacementDemands(serviceInstance);
+ placementInfo.setPlacementDemands(placementDemands);
+ request.setPlacementInformation(placementInfo);
+
+ JSONObject licenseInfo = new JSONObject();
+
+ JSONArray licenseDemands = buildLicenseDemands(serviceInstance);
+ licenseInfo.put("licenseDemands", licenseDemands);
+ request.setLicenseInformation(licenseInfo.toString());
+
+ if(placementDemands.size() > 0 || licenseDemands.length() > 0){
+ client.postDemands(request);
+ }else{
+ logger.debug(SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + " resources eligible for homing or licensing");
+ }
+
+ //Variables for ReceiveWorkflowMessage subflow
+ execution.setVariable("asyncCorrelator", requestId);
+ execution.setVariable("asyncMessageType", "OofResponse");
+ execution.setVariable("asyncTimeout", timeout);
+
+ logger.trace("Completed Oof Homing Call Oof");
+ }catch(BpmnError e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ }catch(BadResponseException e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while preparing oof request: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Validates, processes, and sets the homing and licensing solutions that are returned by
+ * Oof
+ *
+ * @param execution
+ * @param asyncResponse
+ */
+ public void processSolution(BuildingBlockExecution execution, String asyncResponse){
+ logger.trace("Started Oof Homing Process Solution");
+ try{
+ oofValidator.validateSolution(asyncResponse);
+ ServiceInstance serviceInstance = execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+
+ logger.debug("Processing Oof asyncronous response");
+ JSONObject response = new JSONObject(asyncResponse);
+ if(response.has(SOLUTIONS)){
+ JSONObject allSolutions = response.getJSONObject(SOLUTIONS);
+ if(allSolutions.has("placementSolutions")){
+ JSONArray placementSolutions = allSolutions.getJSONArray("placementSolutions");
+ for(int i = 0; i < placementSolutions.length(); i++){
+ JSONArray placements = placementSolutions.getJSONArray(i);
+ processPlacementSolution(serviceInstance, placements, i);
+ }
+ }
+ if(allSolutions.has("licenseSolutions")){
+ JSONArray licenseSolutions = allSolutions.getJSONArray("licenseSolutions");
+ if(licenseSolutions.length() > 0){
+ processLicenseSolution(serviceInstance, licenseSolutions);
+ }
+ }
+ }else{
+ throw new BpmnError(UNPROCESSABLE, "Oof response does not contain: " + SOLUTIONS);
+ }
+
+ execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
+
+ logger.trace("Completed Oof Homing Process Solution");
+ }catch(BpmnError e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage());
+ }catch(BadResponseException e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage());
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing Oof asynchronous response: " + e.getMessage());
+ }
+ }
+
+ /**
+ * Builds the request information section for the homing/licensing request
+ *
+ * @throws Exception
+ */
+ private RequestInfo buildRequestInfo(String requestId, String timeout) throws Exception{
+ logger.trace("Building request information");
+ RequestInfo requestInfo = new RequestInfo();
+ if(requestId != null){
+ String host = env.getProperty("mso.workflow.message.endpoint");
+ String callbackUrl = host + "/" + UriUtils.encodePathSegment("OofResponse", "UTF-8") + "/" + UriUtils.encodePathSegment(requestId, "UTF-8");
+
+ Duration d = Duration.parse(timeout);
+ long timeoutSeconds = d.getSeconds();
+
+ requestInfo.setTransactionId(requestId);
+ requestInfo.setRequestId(requestId);
+ requestInfo.setCallbackUrl(callbackUrl);
+ requestInfo.setSourceId("mso");
+ requestInfo.setRequestType("create");
+ requestInfo.setTimeout(timeoutSeconds);
+ } else{
+ throw new BpmnError(UNPROCESSABLE, "Request Context does not contain: requestId");
+ }
+ return requestInfo;
+ }
+
+ /**
+ * Builds the request information section for the homing/licensing request
+ *
+ */
+ private ServiceInfo buildServiceInfo(ServiceInstance serviceInstance){
+ logger.trace("Building service information");
+ ServiceInfo info = new ServiceInfo();
+ ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
+ if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
+ info.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
+ info.setServiceName(modelInfo.getServiceType());
+ }
+ info.setModelInfo(buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
+ }else{
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID);
+ }
+ return info;
+ }
+
+ /**
+ * Builds initial section of placement info for the homing/licensing request
+ *
+ */
+ private PlacementInfo buildPlacementInfo(Customer customer, RequestParameters requestParams){
+ PlacementInfo placementInfo = new PlacementInfo();
+ if(customer != null){
+ logger.debug("Adding subscriber to placement information");
+ SubscriberInfo subscriberInfo = new SubscriberInfo();
+ subscriberInfo.setGlobalSubscriberId(customer.getGlobalCustomerId());
+ subscriberInfo.setSubscriberName(customer.getSubscriberName());
+ subscriberInfo.setSubscriberCommonSiteId(customer.getSubscriberCommonSiteId());
+ placementInfo.setSubscriberInfo(subscriberInfo);
+ if(requestParams != null){
+ logger.debug("Adding request parameters to placement information");
+ OofRequestParameters oofRequestParams = new OofRequestParameters();
+ for (Map requestParam : requestParams.getUserParams()){
+ if (requestParam.containsKey("customerLatitude")){
+ oofRequestParams.setCustomerLatitude(requestParam.get("customerLatitude").toString());
+ }
+ if (requestParam.containsKey("customerLongitude")){
+ oofRequestParams.setCustomerLongitude(requestParam.get("customerLongitude").toString());
+ }
+ if (requestParam.containsKey("customerName")){
+ oofRequestParams.setCustomerName(requestParam.get("customerName").toString());
+ }
+ }
+ placementInfo.setRequestParameters(oofRequestParams);
+ }
+ }else{
+ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + "customer");
+ }
+ return placementInfo;
+
+ }
+
+ /**
+ * Builds the placement demand list for the homing/licensing request
+ *
+ */
+ private ArrayList<PlacementDemand> buildPlacementDemands(ServiceInstance serviceInstance){
+ logger.trace("Building placement information demands");
+ ArrayList<PlacementDemand> placementDemands = new ArrayList();
+
+ List<AllottedResource> allottedResourceList = serviceInstance.getAllottedResources();
+ if(!allottedResourceList.isEmpty()){
+ logger.debug("Adding allotted resources to placement demands list");
+ for(AllottedResource ar : allottedResourceList){
+ if(isBlank(ar.getId())){
+ ar.setId(UUID.randomUUID().toString());
+ }
+ PlacementDemand demand = buildDemand(ar.getId(), ar.getModelInfoAllottedResource());
+ //addCandidates(ar, demand);
+ placementDemands.add(demand);
+ }
+ }
+ List<VpnBondingLink> vpnBondingLinkList = serviceInstance.getVpnBondingLinks();
+ if(!vpnBondingLinkList.isEmpty()){
+ logger.debug("Adding vpn bonding links to placement demands list");
+ for(VpnBondingLink vbl:vpnBondingLinkList){
+ List<ServiceProxy> serviceProxyList = vbl.getServiceProxies();
+ for(ServiceProxy sp : serviceProxyList){
+ if(isBlank(sp.getId())){
+ sp.setId(UUID.randomUUID().toString());
+ }
+ PlacementDemand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ //addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
+ }
+ return placementDemands;
+ }
+
+ /**
+ * Builds the license demand list for the homing/licensing request
+ *
+ */
+ private JSONArray buildLicenseDemands(ServiceInstance serviceInstance){
+ logger.trace("Building license information");
+ JSONArray licenseDemands = new JSONArray();
+ List<GenericVnf> vnfList = serviceInstance.getVnfs();
+ if(!vnfList.isEmpty()){
+ logger.debug("Adding vnfs to license demands list");
+ for(GenericVnf vnf : vnfList){
+ JSONObject demand = buildLicenseDemand(vnf.getVnfId(), vnf.getModelInfoGenericVnf());
+ licenseDemands.put(demand);
+ }
+ }
+ return licenseDemands;
+ }
+
+ /**
+ * Builds a single license demand object
+ *
+ */
+ private JSONObject buildLicenseDemand(String id, ModelInfoMetadata metadata){
+ logger.debug("Building demand for service or resource: " + id);
+ JSONObject demand = new JSONObject();
+ if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ demand.put(SERVICE_RESOURCE_ID, id);
+ demand.put(RESOURCE_MODULE_NAME, metadata.getModelInstanceName());
+ demand.put(RESOURCE_MODEL_INFO, buildModelInfo(metadata));
+ }else{
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
+ }
+ return demand;
+ }
+
+ /**
+ * Builds a single demand object
+ *
+ */
+ private PlacementDemand buildDemand(String id, ModelInfoMetadata metadata){
+ logger.debug("Building demand for service or resource: " + id);
+ PlacementDemand placementDemand = new PlacementDemand();
+ if(isNotBlank(id) && isNotBlank(metadata.getModelInstanceName())){
+ placementDemand.setServiceResourceId(id);
+ placementDemand.setResourceModuleName(metadata.getModelInstanceName());
+ placementDemand.setResourceModelInfo((ResourceModelInfo) buildModelInfo(metadata));
+ }else{
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + "modelInstanceName");
+ }
+ return placementDemand;
+ }
+
+ /**
+ * Builds the resource model info section
+ *
+ */
+ private ModelInfo buildModelInfo(ModelInfoMetadata metadata){
+ ModelInfo modelInfo = new ModelInfo();
+ String invariantUuid = metadata.getModelInvariantUuid();
+ String modelUuid = metadata.getModelUuid();
+ if(isNotBlank(invariantUuid) && isNotBlank(modelUuid)){
+ modelInfo.setModelInvariantId(invariantUuid);
+ modelInfo.setModelVersionId(modelUuid);
+ modelInfo.setModelName(metadata.getModelName());
+ modelInfo.setModelVersion(metadata.getModelVersion());
+ }else if(isNotBlank(invariantUuid)){
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_VERSION_ID);
+ }else{
+ throw new BpmnError(UNPROCESSABLE, RESOURCE_MISSING_DATA + MODEL_INVARIANT_ID);
+ }
+ return modelInfo;
+ }
+
+ /**
+ * Adds required, excluded, and existing candidates to a demand
+ *
+ */
+ private void addCandidates(SolutionCandidates candidates, JSONObject demand){
+ List<Candidate> required = candidates.getRequiredCandidates();
+ List<Candidate> excluded = candidates.getExcludedCandidates();
+ if(!required.isEmpty()){
+ demand.put("requiredCandidates", required);
+ }
+ if(!excluded.isEmpty()){
+ demand.put("excludedCandidates", excluded);
+ }
+ //TODO support existing candidates
+ }
+
+ /**
+ * Processes the license solutions and sets to the corresponding generic vnf
+ *
+ */
+ private void processLicenseSolution(ServiceInstance serviceInstance, JSONArray licenseSolutions){
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+
+ logger.debug("Processing the license solution");
+ for(int i = 0; i < licenseSolutions.length(); i++){
+ JSONObject licenseSolution = licenseSolutions.getJSONObject(i);
+ for(GenericVnf vnf:vnfs){
+ if(licenseSolution.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){
+ License license = new License();
+ JSONArray entitlementPools = licenseSolution.getJSONArray("entitlementPoolUUID");
+ List<String> entitlementPoolsList = jsonUtils.StringArrayToList(entitlementPools);
+ license.setEntitlementPoolUuids(entitlementPoolsList);
+ JSONArray licenseKeys = licenseSolution.getJSONArray("licenseKeyGroupUUID");
+ List<String> licenseKeysList = jsonUtils.StringArrayToList(licenseKeys);
+ license.setLicenseKeyGroupUuids(licenseKeysList);
+
+ vnf.setLicense(license);
+ }
+ }
+ }
+ }
+
+ /**
+ * Processes a placement solution list then correlates and sets each placement solution
+ * to its corresponding resource
+ *
+ */
+ private void processPlacementSolution(ServiceInstance serviceInstance, JSONArray placements, int i){
+ List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
+ List<AllottedResource> allottes = serviceInstance.getAllottedResources();
+ List<GenericVnf> vnfs = serviceInstance.getVnfs();
+
+ logger.debug("Processing placement solution " + i+1);
+ for(int p = 0; p < placements.length(); p++){
+ JSONObject placement = placements.getJSONObject(p);
+ SolutionInfo solutionInfo = new SolutionInfo();
+ solutionInfo.setSolutionId(i + 1);
+ search: {
+ for(VpnBondingLink vbl:links){
+ List<ServiceProxy> proxies = vbl.getServiceProxies();
+ for(ServiceProxy sp:proxies){
+ if(placement.getString(SERVICE_RESOURCE_ID).equals(sp.getId())){
+ if(i > 0){
+ if(p % 2 == 0){
+ VpnBondingLink vblNew = (VpnBondingLink) SerializationUtils.clone(vbl);
+ vblNew.setVpnBondingLinkId(UUID.randomUUID().toString());
+ links.add(vblNew);
+ }
+ links.get(links.size() - 1).getServiceProxy(sp.getId()).setServiceInstance(setSolution(solutionInfo, placement));
+ }else{
+ sp.setServiceInstance(setSolution(solutionInfo, placement));
+ }
+ break search;
+ }
+ }
+ }
+ for(AllottedResource ar:allottes){
+ if(placement.getString(SERVICE_RESOURCE_ID).equals(ar.getId())){
+ ar.setParentServiceInstance(setSolution(solutionInfo, placement));
+ break search;
+ }
+ }
+ for(GenericVnf vnf:vnfs){
+ if(placement.getString(SERVICE_RESOURCE_ID).equals(vnf.getVnfId())){
+ ServiceInstance si = setSolution(solutionInfo, placement);
+ serviceInstance.setSolutionInfo(si.getSolutionInfo());
+ serviceInstance.getVnfs().add(si.getVnfs().get(0));
+ break search;
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Creates and sets necessary pojos with placement solution data for a given demand
+ *
+ */
+ private ServiceInstance setSolution(SolutionInfo solutionInfo, JSONObject placement){
+ logger.debug("Mapping placement solution");
+ String invalidMessage = "Oof Response contains invalid: ";
+
+ JSONObject solution = placement.getJSONObject("solution");
+ String identifierType = solution.getString(IDENTIFIER_TYPE);
+ List<String> identifiersList = jsonUtils.StringArrayToList(solution.getJSONArray("identifiers").toString());
+ String identifierValue = identifiersList.get(0);
+
+ JSONArray assignments = placement.getJSONArray("assignmentInfo");
+ Map<String, String> assignmentsMap = jsonUtils.entryArrayToMap(assignments.toString(), "key", "value");
+ solutionInfo.setRehome(Boolean.parseBoolean(assignmentsMap.get("isRehome")));
+ String type = placement.getString(INVENTORY_TYPE);
+
+ ServiceInstance si = new ServiceInstance();
+ CloudRegion cloud = setCloud(assignmentsMap);
+ if(type.equals("service")){
+ if(identifierType.equals(CandidateType.SERVICE_INSTANCE_ID.toString())){
+ solutionInfo.setHomed(true);
+ si.setServiceInstanceId(identifierValue);
+ si.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ cloud.setLcpCloudRegionId(assignmentsMap.get("cloudRegionId"));
+ if(assignmentsMap.containsKey("vnfHostName")){
+ logger.debug("Resources has been homed to a vnf");
+ GenericVnf vnf = setVnf(assignmentsMap);
+ vnf.setCloudRegion(cloud);
+ si.getVnfs().add(vnf);
+
+ }else if(assignmentsMap.containsKey("primaryPnfName")){
+ logger.debug("Resources has been homed to a pnf");
+ Pnf priPnf = setPnf(assignmentsMap, "primary");
+ priPnf.setCloudRegion(cloud);
+ si.getPnfs().add(priPnf);
+ if(assignmentsMap.containsKey("secondaryPnfName")){
+ Pnf secPnf = setPnf(assignmentsMap, "secondary");
+ secPnf.setCloudRegion(cloud);
+ si.getPnfs().add(secPnf);
+ }
+ }
+ }else{
+ logger.debug(invalidMessage + IDENTIFIER_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
+ }
+ }else if(type.equals("cloud")){
+ if(identifierType.equals(CandidateType.CLOUD_REGION_ID.toString())){
+ logger.debug("Resources has been homed to a cloud region");
+ cloud.setLcpCloudRegionId(identifierValue);
+ solutionInfo.setHomed(false);
+ solutionInfo.setTargetedCloudRegion(cloud);
+ si.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ }else{
+ logger.debug(invalidMessage + IDENTIFIER_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + IDENTIFIER_TYPE);
+ }
+ }else{
+ logger.debug(invalidMessage + INVENTORY_TYPE);
+ throw new BpmnError(UNPROCESSABLE, invalidMessage + INVENTORY_TYPE);
+ }
+ si.setSolutionInfo(solutionInfo);
+ return si;
+ }
+
+ /**
+ * Sets the cloud data to a cloud region object
+ *
+ */
+ private CloudRegion setCloud(Map<String, String> assignmentsMap){
+ CloudRegion cloud = new CloudRegion();
+ cloud.setCloudOwner(assignmentsMap.get("cloudOwner"));
+ cloud.setCloudRegionVersion(assignmentsMap.get("aicVersion"));
+ cloud.setComplex(assignmentsMap.get("aicClli"));
+ return cloud;
+ }
+
+ /**
+ * Sets the vnf data to a generic vnf object
+ *
+ */
+ private GenericVnf setVnf(Map<String, String> assignmentsMap){
+ GenericVnf vnf = new GenericVnf();
+ vnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ vnf.setVnfName(assignmentsMap.get("vnfHostName"));
+ vnf.setVnfId(assignmentsMap.get("vnfId"));
+ return vnf;
+ }
+
+ /**
+ * Sets the pnf data to a pnf object
+ *
+ */
+ private Pnf setPnf(Map<String, String> assignmentsMap, String role){
+ Pnf pnf = new Pnf();
+ pnf.setRole(role);
+ pnf.setOrchestrationStatus(OrchestrationStatus.CREATED);
+ pnf.setPnfName(assignmentsMap.get(role + "PnfName"));
+ return pnf;
+ }
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 02459d789d..2d5638c2b7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -103,6 +103,7 @@ public class WorkflowAction {
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances";
+ private static final String HOMINGSOLUTION = "Homing_Solution";
private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
@Autowired
@@ -160,6 +161,18 @@ public class WorkflowAction {
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);
+ if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters()
+ .getUserParams();
+ for (Map<String, Object> params : userParams) {
+ if (params.containsKey(HOMINGSOLUTION)) {
+ execution.setVariable("homing", true);
+ execution.setVariable("callHoming", true);
+ execution.setVariable("homingSolution", params.get(HOMINGSOLUTION));
+ }
+ }
+ }
+
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
new file mode 100644
index 0000000000..fa039c235c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof;
+
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.common.baseclient.BaseClient;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.oof.beans.OofProperties;
+import org.onap.so.client.oof.beans.OofRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import java.util.LinkedHashMap;
+
+@Component
+public class OofClient {
+
+ private static final Logger logger = LoggerFactory.getLogger(OofClient.class);
+ public static final String X_MINOR_VERSION = "X-MinorVersion";
+ public static final String X_PATCH_VERSION = "X-PatchVersion";
+ public static final String X_LATEST_VERSION = "X-LatestVersion";
+
+ @Autowired
+ private OofProperties oofProperties;
+
+ @Autowired
+ private OofValidator validator;
+
+
+ /**
+ * Makes a rest call to oof to perform homing and licensing for a
+ * list of demands
+ *
+ * @param homingRequest
+ * @return
+ * @throws JsonProcessingException
+ * @throws BpmnError
+ */
+ public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException{
+ logger.trace("Started oof Client Post Demands");
+ String url = oofProperties.getHost() + oofProperties.getUri();
+ logger.debug("Post demands url: " + url);
+ logger.debug("Post demands payload: " + homingRequest.toJsonString());
+
+ HttpHeaders header = new HttpHeaders();
+ header.setContentType(MediaType.APPLICATION_JSON);
+ header.set(HttpHeaders.AUTHORIZATION, oofProperties.getHeaders().get("auth"));
+ header.set(X_PATCH_VERSION, oofProperties.getHeaders().get("patchVersion"));
+ header.set(X_MINOR_VERSION, oofProperties.getHeaders().get("minorVersion"));
+ header.set(X_LATEST_VERSION, oofProperties.getHeaders().get("latestVersion"));
+ BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>();
+
+ baseClient.setTargetUrl(url);
+ baseClient.setHttpHeader(header);
+
+ LinkedHashMap<?, ?> response = baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ validator.validateDemandsResponse(response);
+ logger.trace("Completed OOF Client Post Demands");
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
new file mode 100644
index 0000000000..252ff0d6a6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof;
+
+
+import org.json.JSONObject;
+import org.onap.so.client.exception.BadResponseException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import java.util.LinkedHashMap;
+
+import static org.apache.commons.lang.StringUtils.isNotBlank;
+
+
+@Component
+public class OofValidator {
+
+ private static final Logger logger = LoggerFactory.getLogger(OofValidator.class);
+
+ /**
+ * Validates the synchronous homing response from oof
+ *
+ * @throws BadResponseException
+ */
+ public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
+ logger.debug("Validating oofs synchronous response");
+ if(!response.isEmpty()){
+ JSONObject jsonResponse = new JSONObject(response);
+ if(jsonResponse.has("requestStatus")){
+ String status = jsonResponse.getString("requestStatus");
+ if(status.equals("accepted")){
+ logger.debug("oofs synchronous response indicates accepted");
+ }else{
+ String message = jsonResponse.getString("statusMessage");
+ if(isNotBlank(message)){
+ logger.debug("oofs response indicates failed: " + message);
+ }else{
+ logger.debug("oofs response indicates failed: no status message provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException("oofs synchronous response indicates failed: " + message);
+ }
+ }else{
+ logger.debug("oofs synchronous response does not contain: request status");
+ throw new BadResponseException("oofs synchronous response does not contain: request status");
+ }
+ }else{
+ logger.debug("oofs synchronous response is empty");
+ throw new BadResponseException("oofs synchronous response i is empty");
+ }
+ }
+
+ /**
+ * Validates the asynchronous/callback response from oof which
+ * contains the homing and licensing solutions
+ *
+ * @throws BadResponseException
+ */
+ public void validateSolution(String response) throws BadResponseException{
+ logger.debug("Validating oofs asynchronous callback response");
+ if(isNotBlank(response)) {
+ JSONObject jsonResponse = new JSONObject(response);
+ if(!jsonResponse.has("serviceException")){
+ logger.debug("oofs asynchronous response is valid");
+ }else{
+ String message = jsonResponse.getJSONObject("serviceException").getString("text");
+ if(isNotBlank(message)){
+ logger.debug("oofs response contains a service exception: " + message);
+ }else{
+ logger.debug("oofs response contains a service exception: no service exception text provided");
+ message = "error message not provided";
+ }
+ throw new BadResponseException("oofs asynchronous response contains a service exception: " + message);
+ }
+ }else{
+ logger.debug("oofs asynchronous response is empty");
+ throw new BadResponseException("oofs asynchronous response is empty");
+ }
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
new file mode 100644
index 0000000000..8e136e9f18
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "modelType",
+ "modelInvariantId",
+ "modelVersionId",
+ "modelName",
+ "modelVersion",
+ "modelCustomizationName"
+})
+@JsonRootName("modelInfo")
+public class ModelInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("modelType")
+ private String modelType;
+ @JsonProperty("modelInvariantId")
+ private String modelInvariantId;
+ @JsonProperty("modelVersionId")
+ private String modelVersionId;
+ @JsonProperty("modelName")
+ private String modelName;
+ @JsonProperty("modelVersion")
+ private String modelVersion;
+ @JsonProperty("modelCustomizationName")
+ private String modelCustomizationName;
+
+ @JsonProperty("modelType")
+ public String getModelType() {
+ return modelType;
+ }
+
+ @JsonProperty("modelType")
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ @JsonProperty("modelInvariantId")
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ @JsonProperty("modelInvariantId")
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ @JsonProperty("modelVersionId")
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ @JsonProperty("modelVersionId")
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ @JsonProperty("modelName")
+ public String getModelName() {
+ return modelName;
+ }
+
+ @JsonProperty("modelName")
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ @JsonProperty("modelVersion")
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ @JsonProperty("modelVersion")
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ @JsonProperty("modelCustomizationName")
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ @JsonProperty("modelCustomizationName")
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelType", modelType).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelName", modelName).append("modelVersion", modelVersion).append("modelCustomizationName", modelCustomizationName).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
new file mode 100644
index 0000000000..507eaeaf5e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Map;
+
+@Configuration
+@ConfigurationProperties(prefix = "oof")
+public class OofProperties {
+
+ private String host;
+ private String uri;
+
+ private Map<String, String> headers;
+
+
+ public String getHost() {
+ return host;
+ }
+ public void setHost(String host) {
+ this.host = host;
+ }
+ public String getUri() {
+ return uri;
+ }
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+ public Map<String, String> getHeaders() {
+ return headers;
+ }
+ public void setHeaders(Map<String, String> headers) {
+ this.headers = headers;
+ }
+
+
+
+
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
new file mode 100644
index 0000000000..7dfd6849a6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRawValue;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Serializable;
+
+
+public class OofRequest implements Serializable{
+
+ private static final long serialVersionUID = -1541132882892163132L;
+ private static final Logger logger = LoggerFactory.getLogger(OofRequest.class);
+
+ @JsonRawValue
+ @JsonProperty("requestInfo")
+ private RequestInfo requestInformation;
+ @JsonRawValue
+ @JsonProperty("serviceInfo")
+ private ServiceInfo serviceInformation;
+ @JsonRawValue
+ @JsonProperty("placementInfo")
+ private PlacementInfo placementInformation;
+ @JsonRawValue
+ @JsonProperty("licenseInfo")
+ private String licenseInformation;
+
+
+ public RequestInfo getRequestInformation() {
+ return requestInformation;
+ }
+ public void setRequestInformation(RequestInfo requestInformation) {
+ this.requestInformation = requestInformation;
+ }
+ public ServiceInfo getServiceInformation() {
+ return serviceInformation;
+ }
+ public void setServiceInformation(ServiceInfo serviceInformation) {
+ this.serviceInformation = serviceInformation;
+ }
+ public PlacementInfo getPlacementInformation() {
+ return placementInformation;
+ }
+ public void setPlacementInformation(PlacementInfo placementInformation) {
+ this.placementInformation = placementInformation;
+ }
+ public String getLicenseInformation() {
+ return licenseInformation;
+ }
+ public void setLicenseInformation(String licenseInformation) {
+ this.licenseInformation = licenseInformation;
+ }
+
+
+ @JsonInclude(Include.NON_NULL)
+ public String toJsonString(){
+ String json = "";
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
+ try{
+ json = ow.writeValueAsString(this);
+ }catch (Exception e){
+ logger.error("Unable to convert oofRequest to string", e);
+ }
+ return json.replaceAll("\\\\", "");
+ }
+
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
new file mode 100644
index 0000000000..34b05e2f0f
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "customerLatitude",
+ "customerLongitude",
+ "customerName"
+})
+@JsonRootName("requestParameters")
+public class OofRequestParameters implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+
+ @JsonProperty("customerLatitude")
+ private String customerLatitude;
+ @JsonProperty("customerLongitude")
+ private String customerLongitude;
+ @JsonProperty("customerName")
+ private String customerName;
+
+ @JsonProperty("customerLatitude")
+ public String getCustomerLatitude() {
+ return customerLatitude;
+ }
+
+ @JsonProperty("customerLatitude")
+ public void setCustomerLatitude(String customerLatitude) {
+ this.customerLatitude = customerLatitude;
+ }
+
+ @JsonProperty("customerLongitude")
+ public String getCustomerLongitude() {
+ return customerLongitude;
+ }
+
+ @JsonProperty("customerLongitude")
+ public void setCustomerLongitude(String customerLongitude) {
+ this.customerLongitude = customerLongitude;
+ }
+
+ @JsonProperty("customerName")
+ public String getCustomerName() {
+ return customerName;
+ }
+
+ @JsonProperty("customerName")
+ public void setCustomerName(String customerName) {
+ this.customerName = customerName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("customerLatitude", customerLatitude).append("customerLongitude", customerLongitude).append("customerName", customerName).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
new file mode 100644
index 0000000000..a213723f76
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
@@ -0,0 +1,97 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "resourceModuleName",
+ "serviceResourceId",
+ "tenantId",
+ "resourceModelInfo"
+})
+@JsonRootName("placementDemand")
+public class PlacementDemand implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("resourceModuleName")
+ private String resourceModuleName;
+ @JsonProperty("serviceResourceId")
+ private String serviceResourceId;
+ @JsonProperty("tenantId")
+ private String tenantId;
+ @JsonProperty("resourceModelInfo")
+ private ResourceModelInfo resourceModelInfo;
+
+ @JsonProperty("resourceModuleName")
+ public String getResourceModuleName() {
+ return resourceModuleName;
+ }
+
+ @JsonProperty("resourceModuleName")
+ public void setResourceModuleName(String resourceModuleName) {
+ this.resourceModuleName = resourceModuleName;
+ }
+
+ @JsonProperty("serviceResourceId")
+ public String getServiceResourceId() {
+ return serviceResourceId;
+ }
+
+ @JsonProperty("serviceResourceId")
+ public void setServiceResourceId(String serviceResourceId) {
+ this.serviceResourceId = serviceResourceId;
+ }
+
+ @JsonProperty("tenantId")
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ @JsonProperty("tenantId")
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ @JsonProperty("resourceModelInfo")
+ public ResourceModelInfo getResourceModelInfo() {
+ return resourceModelInfo;
+ }
+
+ @JsonProperty("resourceModelInfo")
+ public void setResourceModelInfo(ResourceModelInfo resourceModelInfo) {
+ this.resourceModelInfo = resourceModelInfo;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("resourceModuleName", resourceModuleName).append("serviceResourceId", serviceResourceId).append("tenantId", tenantId).append("resourceModelInfo", resourceModelInfo).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
new file mode 100644
index 0000000000..5bda42fefe
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "requestParameters",
+ "subscriberInfo",
+ "placementDemands"
+})
+@JsonRootName("placementInfo")
+public class PlacementInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("requestParameters")
+ private OofRequestParameters requestParameters;
+ @JsonProperty("subscriberInfo")
+ private SubscriberInfo subscriberInfo;
+ @JsonProperty("placementDemands")
+ private ArrayList<PlacementDemand> placementDemands = null;
+
+ @JsonProperty("requestParameters")
+ public OofRequestParameters getRequestParameters() {
+ return requestParameters;
+ }
+
+ @JsonProperty("requestParameters")
+ public void setRequestParameters(OofRequestParameters requestParameters) {
+ this.requestParameters = requestParameters;
+ }
+
+ @JsonProperty("subscriberInfo")
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ @JsonProperty("subscriberInfo")
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
+
+ @JsonProperty("placementDemands")
+ public ArrayList<PlacementDemand> getPlacementDemands() {
+ return placementDemands;
+ }
+
+ @JsonProperty("placementDemands")
+ public void setPlacementDemands(ArrayList<PlacementDemand> placementDemands) {
+ this.placementDemands = placementDemands;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("requestParameters", requestParameters).append("subscriberInfo", subscriberInfo).append("placementDemands", placementDemands).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
new file mode 100644
index 0000000000..ea33a26672
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import java.io.Serializable;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "transactionId",
+ "requestId",
+ "callbackUrl",
+ "sourceId",
+ "requestType",
+ "numSolutions",
+ "optimizers",
+ "timeout"
+})
+@JsonRootName("requestInfo")
+public class RequestInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("transactionId")
+ private String transactionId;
+ @JsonProperty("requestId")
+ private String requestId;
+ @JsonProperty("callbackUrl")
+ private String callbackUrl;
+ @JsonProperty("sourceId")
+ private String sourceId;
+ @JsonProperty("requestType")
+ private String requestType;
+ @JsonProperty("numSolutions")
+ private Integer numSolutions;
+ @JsonProperty("optimizers")
+ private List<String> optimizers = null;
+ @JsonProperty("timeout")
+ private Long timeout;
+
+ @JsonProperty("transactionId")
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ @JsonProperty("transactionId")
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ @JsonProperty("requestId")
+ public String getRequestId() {
+ return requestId;
+ }
+
+ @JsonProperty("requestId")
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ @JsonProperty("callbackUrl")
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ @JsonProperty("callbackUrl")
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ @JsonProperty("sourceId")
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ @JsonProperty("sourceId")
+ public void setSourceId(String sourceId) {
+ this.sourceId = sourceId;
+ }
+
+ @JsonProperty("requestType")
+ public String getRequestType() {
+ return requestType;
+ }
+
+ @JsonProperty("requestType")
+ public void setRequestType(String requestType) {
+ this.requestType = requestType;
+ }
+
+ @JsonProperty("numSolutions")
+ public Integer getNumSolutions() {
+ return numSolutions;
+ }
+
+ @JsonProperty("numSolutions")
+ public void setNumSolutions(Integer numSolutions) {
+ this.numSolutions = numSolutions;
+ }
+
+ @JsonProperty("optimizers")
+ public List<String> getOptimizers() {
+ return optimizers;
+ }
+
+ @JsonProperty("optimizers")
+ public void setOptimizers(List<String> optimizers) {
+ this.optimizers = optimizers;
+ }
+
+ @JsonProperty("timeout")
+ public Long getTimeout() {
+ return timeout;
+ }
+
+ @JsonProperty("timeout")
+ public void setTimeout(Long timeout) {
+ this.timeout = timeout;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("transactionId", transactionId).append("requestId", requestId).append("callbackUrl", callbackUrl).append("sourceId", sourceId).append("requestType", requestType).append("numSolutions", numSolutions).append("optimizers", optimizers).append("timeout", timeout).toString();
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
index 7160a2f333..fea7437a93 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/CloudFlavor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2018 Intel Corp. Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Intel Corp. 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.
@@ -18,40 +18,38 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.core.domain;
+package org.onap.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
-/**
- * Stores Cloud Flavor information and is an attribute
- * of a <class>HomingSolution</class>
- *
- */
-public class CloudFlavor extends JsonWrapper implements Serializable {
+public class Resource implements Serializable{
- private static final long serialVersionUID = 8423934332773299577L;
- private String flavorLabel;
- private String flavor;
+ private static final long serialVersionUID = 5949861520571440421L;
- public CloudFlavor (String flavorLabel, String flavor){
- this.flavorLabel = flavorLabel;
- this.flavor = flavor;
- }
+ @JsonProperty("service-resource-id")
+ private String serviceResourceId;
+ @JsonProperty("status")
+ private String status;
- public String getFlavorLabel() {
- return flavorLabel;
+
+ public String getServiceResourceId(){
+ return serviceResourceId;
}
- public void setFlavorLabel(String flavorLabel) {
- this.flavorLabel = flavorLabel;
+ public void setServiceResourceId(String serviceResourceId){
+ this.serviceResourceId = serviceResourceId;
}
- public String getFlavor() {
- return flavor;
+ public String getStatus(){
+ return status;
}
- public void setFlavor(String flavor) {
- this.flavor = flavor;
+ public void setStatus(String status){
+ this.status = status;
}
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
new file mode 100644
index 0000000000..63aec130ba
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonRootName("resourceModelInfo")
+public class ResourceModelInfo extends ModelInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("modelInvariantId")
+ private String modelInvariantId;
+ @JsonProperty("modelVersionId")
+ private String modelVersionId;
+ @JsonProperty("modelName")
+ private String modelName;
+ @JsonProperty("modelType")
+ private String modelType;
+ @JsonProperty("modelVersion")
+ private String modelVersion;
+ @JsonProperty("modelCustomizationName")
+ private String modelCustomizationName;
+
+ @JsonProperty("modelInvariantId")
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ @JsonProperty("modelInvariantId")
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ @JsonProperty("modelVersionId")
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ @JsonProperty("modelVersionId")
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ @JsonProperty("modelName")
+ public String getModelName() {
+ return modelName;
+ }
+
+ @JsonProperty("modelName")
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ @JsonProperty("modelType")
+ public String getModelType() {
+ return modelType;
+ }
+
+ @JsonProperty("modelType")
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ @JsonProperty("modelVersion")
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ @JsonProperty("modelVersion")
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ @JsonProperty("modelCustomizationName")
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ @JsonProperty("modelCustomizationName")
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelInvariantId", modelInvariantId).append("modelVersionId", modelVersionId).append("modelName", modelName).append("modelType", modelType).append("modelVersion", modelVersion).append("modelCustomizationName", modelCustomizationName).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
new file mode 100644
index 0000000000..90443ce379
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "serviceInstanceId",
+ "serviceName",
+ "modelInfo"
+})
+@JsonRootName("serviceInfo")
+public class ServiceInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("serviceInstanceId")
+ private String serviceInstanceId;
+ @JsonProperty("serviceName")
+ private String serviceName;
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
+
+ @JsonProperty("serviceInstanceId")
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ @JsonProperty("serviceInstanceId")
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ @JsonProperty("serviceName")
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ @JsonProperty("serviceName")
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ @JsonProperty("modelInfo")
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ @JsonProperty("modelInfo")
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("serviceName", serviceName).append("modelInfo", modelInfo).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
new file mode 100644
index 0000000000..bc283c803c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "globalSubscriberId",
+ "subscriberName",
+ "subscriberCommonSiteId"
+})
+@JsonRootName("subscriberInfo")
+public class SubscriberInfo implements Serializable {
+
+ private static final long serialVersionUID = -759180997599143791L;
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+ @JsonProperty("subscriberName")
+ private String subscriberName;
+ @JsonProperty("subscriberCommonSiteId")
+ private String subscriberCommonSiteId;
+
+ @JsonProperty("globalSubscriberId")
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ @JsonProperty("globalSubscriberId")
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ @JsonProperty("subscriberName")
+ public String getSubscriberName() {
+ return subscriberName;
+ }
+
+ @JsonProperty("subscriberName")
+ public void setSubscriberName(String subscriberName) {
+ this.subscriberName = subscriberName;
+ }
+
+ @JsonProperty("subscriberCommonSiteId")
+ public String getSubscriberCommonSiteId() {
+ return subscriberCommonSiteId;
+ }
+
+ @JsonProperty("subscriberCommonSiteId")
+ public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
+ this.subscriberCommonSiteId = subscriberCommonSiteId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("globalSubscriberId", globalSubscriberId).append("subscriberName", subscriberName).append("subscriberCommonSiteId", subscriberCommonSiteId).toString();
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
new file mode 100644
index 0000000000..149417d89b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. 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.so.client.oof;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.junit.Test;
+import org.onap.so.client.exception.BadResponseException;
+import org.onap.so.client.oof.OofClient;
+import org.onap.so.client.oof.beans.OofRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+
+public class OofClientTestIT {
+
+ @Autowired
+ private OofClient client;
+
+
+ @Test(expected = Test.None.class)
+ public void testPostDemands_success() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
+
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postDemands(new OofRequest());
+ }
+
+ @Test(expected = Test.None.class)
+ public void testAsyncResponse_success() throws BadResponseException, JsonProcessingException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
+
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+ client.postDemands(new OofRequest());
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
+
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new OofRequest());
+
+ //TODO assertEquals("missing data", );
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}";
+
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new OofRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
+
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new OofRequest());
+
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException {
+ String mockResponse = "{ }";
+
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse().withStatus(200)
+ .withHeader("Content-Type", "application/json")
+ .withBody(mockResponse)));
+
+
+ client.postDemands(new OofRequest());
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json
new file mode 100644
index 0000000000..15e601bae8
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/OofHoming/oofCallbackInfraVnf.json
@@ -0,0 +1,50 @@
+{
+ "transactionId": "xxx-xxx-xxxx",
+ "requestId": "yyy-yyy-yyyy",
+ "requestStatus": "completed",
+ "statusMessage": "success",
+ "solutions": {
+ "placementSolutions": [
+ [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "some_resource_id",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "amazon" },
+ { "key": "vnfHostName", "value": "ahr344gh" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }
+ ]
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "some_resource_id",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "amazon",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "amazon" },
+ { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
+ ]
+ }
+ ]
+ ],
+ "licenseSolutions": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "some_resource_id",
+ "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
index 8a3ce7f099..4562ebdaea 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
+++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
@@ -190,6 +190,12 @@ sniro:
headers.patchVersion: 1
headers.minorVersion: 1
headers.latestVersion: 2
+oof:
+ timeout: PT30M
+ host: http://localhost:${wiremock.server.port}
+ uri.v1: /api/oof/v1/placement
+ uri.v2: /api/oof/v2/placement
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
spring:
datasource:
url: jdbc:mariadb://localhost:3307/camundabpmn
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
index 117c8a2c27..0d4778b5b6 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/ResponseHandlerTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -17,7 +19,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
+
package org.onap.so.apihandler.common;
@@ -27,8 +29,6 @@ import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolVersion;
@@ -38,13 +38,7 @@ import org.apache.http.message.BasicStatusLine;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.so.apihandler.common.ErrorNumbers;
-import org.onap.so.apihandler.common.ResponseHandler;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
-import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
/**
@@ -68,13 +62,27 @@ public class ResponseHandlerTest{
HttpResponse response = createResponse (200, body, "application/json");
ResponseHandler respHandler = new ResponseHandler (response, 1);
-
+
int status = respHandler.getStatus ();
assertEquals (status, HttpStatus.SC_ACCEPTED);
assertEquals (respHandler.getResponse ().getMessage (), "Successfully started the process");
}
+
+ @Test
+ public void tesParseCamundaResponseForCamundaTaskType () throws ApiException {
+ String body = "{ \"response\": \"<xml>xml</xml>\"," + "\"messageCode\": 200,"
+ + "\"message\": \"Successfully started the process\"}";
+ HttpResponse response = createResponse (200, body, "application/json");
+
+ ResponseHandler respHandler = new ResponseHandler (response, 2);
+
+ int status = respHandler.getStatus ();
+ assertEquals (status, HttpStatus.SC_ACCEPTED);
+ assertEquals (respHandler.getResponseBody(), body);
+
+ }
@Test
public void tesParseBpelResponse () throws ApiException{
String body = "<test:service-response xmlns:test=\"http://org.onap/so/test\">"
@@ -99,7 +107,7 @@ public class ResponseHandlerTest{
thrown.expectMessage(startsWith("Cannot parse Camunda Response"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_BAD_REQUEST)));
thrown.expect(hasProperty("messageID", is(ErrorNumbers.SVC_BAD_PARAMETER)));
-
+
HttpResponse response = createResponse (HttpStatus.SC_NOT_FOUND, "<html>error</html>", "text/html");
ResponseHandler respHandler = new ResponseHandler (response, 1);
diff --git a/pom.xml b/pom.xml
index fb8c3884ee..0960eb9dbe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
- <version>1.2.0</version>
+ <version>1.2.1</version>
<relativePath/>
</parent>
<groupId>org.onap.so</groupId>
@@ -511,7 +511,6 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
- <version>2.8.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
@@ -681,12 +680,6 @@
WildFly 10 version -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- <version>4.5.5</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.4</version>
<scope>compile</scope>
@@ -807,7 +800,6 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
- <version>9.4.12.v20180830</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/so-monitoring/so-monitoring-handler/pom.xml b/so-monitoring/so-monitoring-handler/pom.xml
index a535d408f7..ae900ba422 100644
--- a/so-monitoring/so-monitoring-handler/pom.xml
+++ b/so-monitoring/so-monitoring-handler/pom.xml
@@ -33,7 +33,6 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
- <guava.version>22.0</guava.version>
<openpojo.version>0.8.6</openpojo.version>
</properties>
@@ -42,7 +41,6 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>${guava.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
@@ -92,4 +90,4 @@
<version>${project.version}</version>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock b/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock
index f6fade9614..7ecbb03ae7 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/yarn.lock
@@ -4098,6 +4098,12 @@ next-tick@1:
version "1.0.0"
resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c"
+ngx-spinner@^6.1.2:
+ version "6.1.2"
+ resolved "https://registry.yarnpkg.com/ngx-spinner/-/ngx-spinner-6.1.2.tgz#9778dbffbd17b27a7a90c4f0d9d8a7817e6ffb76"
+ dependencies:
+ tslib "^1.9.0"
+
no-case@^2.2.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"