<artifactId>snakeyaml</artifactId>
<version>1.15</version>
</dependency>
-
+ <dependency>
+ <groupId>com.shazam</groupId>
+ <artifactId>shazamcrest</artifactId>
+ <version>0.11</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
</project>
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+/**\r
+ * Cloud information structure for deploying/managing a VDU. Includes the cloud site\r
+ * as well as tenant information within the site. Currently this is defined as a \r
+ * cloud site ID. which would map to a CloudConfig entry.\r
+ * Perhaps the CloudConfig entry itself should be provided, instead of requiring each\r
+ * plug-in to query it.\r
+ * \r
+ * The meaning of 'tenant' may differ by cloud provider, but every cloud supports some\r
+ * sort of tenant partitioning.\r
+ * \r
+ */\r
+public class CloudInfo {\r
+ \r
+ private String cloudSiteId;\r
+ private String tenantId; \r
+ private String tenantName;//bpmn query and pass\r
+ \r
+ public CloudInfo() {\r
+ }\r
+ \r
+ public CloudInfo (String cloudSiteId, String tenantId, String tenantName) {\r
+ this.cloudSiteId = cloudSiteId;\r
+ this.tenantId = tenantId;\r
+ this.tenantName = tenantName;\r
+ }\r
+ \r
+ public String getCloudSiteId() {\r
+ return cloudSiteId;\r
+ }\r
+ public void setCloudSiteId(String cloudSiteId) {\r
+ this.cloudSiteId = cloudSiteId;\r
+ }\r
+ public String getTenantId() {\r
+ return tenantId;\r
+ }\r
+ public void setTenantId(String tenantId) {\r
+ this.tenantId = tenantId;\r
+ }\r
+ public String getTenantName() {\r
+ return tenantName;\r
+ }\r
+ public void setTenantName(String tenantName) {\r
+ this.tenantName = tenantName;\r
+ }\r
+ \r
+ \r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+/**\r
+ * Java beam representing a detailed action performed within a plugin during VDU\r
+ * orchestration. This allows the plugin to convey more detailed information about\r
+ * recent activities it has performed. It is primarily intended for logging and\r
+ * troubleshooting, so plugins are free to populate this as desired.\r
+ */\r
+public class PluginAction {\r
+ \r
+ private String action; \r
+ private String status;\r
+ private String rawMessage; \r
+ \r
+ public PluginAction () {\r
+ }\r
+ \r
+ public PluginAction (String action, String status, String rawMessage) {\r
+ this.action = action;\r
+ this.status = status;\r
+ this.rawMessage = rawMessage;\r
+ }\r
+ \r
+ public String getAction() {\r
+ return action;\r
+ }\r
+ public void setAction(String action) {\r
+ this.action = action;\r
+ }\r
+ public String getStatus() {\r
+ return status;\r
+ }\r
+ public void setStatus(String status) {\r
+ this.status = status;\r
+ }\r
+ public String getRawMessage() {\r
+ return rawMessage;\r
+ }\r
+ public void setRawMessage(String rawMessage) {\r
+ this.rawMessage = rawMessage;\r
+ }\r
+ \r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+public class VduArtifact {\r
+ \r
+ // Enumerate the types of artifacts permitted. This may need to be a variable string\r
+ // value if arbitrary (cloud-specific) artifacts may be attached to VDUs in ASDC.\r
+ public enum ArtifactType {\r
+ MAIN_TEMPLATE, NESTED_TEMPLATE, CONFIG_FILE, SCRIPT_FILE, TEXT_FILE, ENVIRONMENT\r
+ }\r
+ \r
+ private String name;\r
+ private byte[] content;\r
+ private ArtifactType type;\r
+ \r
+ // Default constructor\r
+ public VduArtifact() {}\r
+ \r
+ // Fully specified constructor\r
+ public VduArtifact (String name, byte[] content, ArtifactType type) {\r
+ this.name = name;\r
+ this.content = content;\r
+ this.type = type;\r
+ }\r
+ \r
+ public String getName() {\r
+ return name;\r
+ }\r
+ public void setName (String name) {\r
+ this.name = name;\r
+ }\r
+ public byte[] getContent() {\r
+ return content;\r
+ }\r
+ public void setContent(byte[] content) {\r
+ this.content = content;\r
+ }\r
+ public ArtifactType getType() {\r
+ return type;\r
+ }\r
+ public void setType(ArtifactType type) {\r
+ this.type = type;\r
+ } \r
+ \r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * OPENECOMP - MSO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+import org.openecomp.mso.openstack.exceptions.MsoException;\r
+import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;\r
+\r
+/**\r
+ * OpenStack exception.\r
+ */\r
+public class VduException extends MsoException\r
+{\r
+ \r
+ /**\r
+ * Serialization id.\r
+ */\r
+ private static final long serialVersionUID = 3313636124141766495L;\r
+ \r
+ /**\r
+ * Constructor to create a new VduException instance\r
+ * @param detail error details\r
+ */\r
+ public VduException (String detail) {\r
+ // Set the detailed error as the Exception 'message'\r
+ super(detail);\r
+ // TODO: Need a more generic category than OPENSTACK\r
+ super.category = MsoExceptionCategory.OPENSTACK;\r
+ }\r
+ \r
+ /**\r
+ * Constructor to create a new VduException instance\r
+ * @param detail error details\r
+ * @param e the cause\r
+ */\r
+ public VduException (String detail, Exception e) {\r
+ // Set the detailed error as the Exception 'message'\r
+ super(detail, e);\r
+ // TODO: Need a more generic category than OPENSTACK\r
+ super.category = MsoExceptionCategory.OPENSTACK;\r
+ }\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * OPENECOMP - MSO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+import java.util.Map;\r
+import java.util.HashMap;\r
+\r
+/*\r
+ * This Java bean class relays VDU status information in a cloud-agnostic format.\r
+ * \r
+ * This bean is returned by all implementors of the VduPlugin interface operations\r
+ * (instantiate, query, delete).\r
+ */\r
+\r
+public class VduInstance {\r
+ // Set defaults for everything\r
+ protected String vduInstanceId;\r
+ protected String vduInstanceName;\r
+ protected VduStatus status;\r
+ protected Map<String, Object> outputs = new HashMap<>();\r
+ protected Map<String, Object> inputs = new HashMap<>();\r
+\r
+ public String getVduInstanceId() {\r
+ return vduInstanceId;\r
+ }\r
+\r
+ public void setVduInstanceId(String vduInstanceId) {\r
+ this.vduInstanceId = vduInstanceId;\r
+ }\r
+\r
+ public String getVduInstanceName() {\r
+ return vduInstanceName;\r
+ }\r
+\r
+ public void setVduInstanceName(String vduInstanceName) {\r
+ this.vduInstanceName = vduInstanceName;\r
+ }\r
+\r
+ public VduStatus getStatus() {\r
+ return status;\r
+ }\r
+\r
+ public void setStatus(VduStatus status) {\r
+ this.status = status;\r
+ }\r
+\r
+ public Map<String, Object> getOutputs() {\r
+ return outputs;\r
+ }\r
+\r
+ public void setOutputs(Map<String, Object> outputs) {\r
+ this.outputs = outputs;\r
+ }\r
+\r
+ public Map<String, Object> getInputs() {\r
+ return inputs;\r
+ }\r
+\r
+ public void setInputs(Map<String, Object> inputs) {\r
+ this.inputs = inputs;\r
+ }\r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+public class VduModelInfo { \r
+ private String modelCustomizationUUID;\r
+ private int timeoutMinutes;\r
+ private List<VduArtifact> artifacts = new ArrayList<>();\r
+ \r
+ public String getModelCustomizationUUID() {\r
+ return modelCustomizationUUID;\r
+ }\r
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {\r
+ this.modelCustomizationUUID = modelCustomizationUUID;\r
+ }\r
+ public int getTimeoutMinutes() {\r
+ return timeoutMinutes;\r
+ }\r
+ public void setTimeoutMinutes(int timeoutMinutes) {\r
+ this.timeoutMinutes = timeoutMinutes;\r
+ }\r
+ public List<VduArtifact> getArtifacts() {\r
+ return artifacts;\r
+ }\r
+ public void setArtifacts(List<VduArtifact> artifacts) {\r
+ this.artifacts = artifacts;\r
+ }\r
+ \r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+/**\r
+ * This interface defines a common API for template-based cloud deployments.\r
+ * The methods here should be adaptable for Openstack (Heat), Cloudify (TOSCA),\r
+ * Aria (TOSCA), Multi-VIM (TBD), and others (e.g. Azure Resource Manager).\r
+ * \r
+ * The deployed instances are referred to here as Virtual Deployment Units (VDUs).\r
+ * The package of templates that define a give VDU is referred to as its blueprint.\r
+ * \r
+ * Template-based orchestrators all follow a similar template/blueprint model.\r
+ * - One main template that is the top level definition\r
+ * - Optional nested templates referenced/included by the main template\r
+ * - Optional files attached to the template package, typically containing\r
+ * configuration files, install scripts, orchestration scripts, etc.\r
+ * \r
+ * The main template also defines the required inputs for creating a new instance,\r
+ * and output values exposed by successfully deployed instances. Inputs and outputs\r
+ * may include simple or complex (JSON) data types.\r
+ * \r
+ * Each implementation of this interface is expected to understand the MSO CloudConfig\r
+ * to obtain the credentials for its sub-orchestrator and the targeted cloud.\r
+ * The sub-orchestrator may have different credentials from the cloud (e.g. an Aria \r
+ * instance in front of an Openstack cloud) or they may be the same (e.g. Heat)\r
+ */\r
+import java.util.Map;\r
+\r
+public interface VduPlugin {\r
+\r
+ /**\r
+ * The instantiateVdu interface deploys a new VDU instance from a vdu model package.\r
+ * \r
+ * For some VIMs, this may be a single command (e.g. Heat -> create stack) or may\r
+ * require a series of API calls (e.g. Cloudify -> upload blueprint, create deployment,\r
+ * execute install workflow). These details are hidden within the plug-in implementation.\r
+ * The instantiation should be fully completed before returning. On failures, this\r
+ * method is expected to back out the attempt, leaving the cloud in its previous state.\r
+ * \r
+ * It is expected that parameters have been validated and contain at minimum the\r
+ * required parameters for the given template with no extra parameters.\r
+ *\r
+ * The VDU name supplied by the caller will be globally unique, and identify the artifact\r
+ * in A&AI. Inventory is managed by the higher levels invoking this function.\r
+ *\r
+ * @param cloudInfo The target cloud + tenant identifiers for the VDU.\r
+ * @param instanceName A unique name for the VDU instance to update.\r
+ * @param inputs A map of key/value inputs. Values may be strings, numbers, or JSON objects.\r
+ * Will completely replace any inputs provided on the original instantiation.\r
+ * @param vduModel Object containing the collection of templates and files that comprise\r
+ * the blueprint for this VDU.\r
+ * @param rollbackOnFailure Flag to preserve or roll back the update on Failure. Should normally\r
+ * be True except in troubleshooting/debug cases. Might not be supported in all plug-ins.\r
+ * \r
+ * @return A VduInstance object\r
+ * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs.\r
+ * Various subclasses of VduException may be thrown.\r
+ */\r
+ public VduInstance instantiateVdu (\r
+ CloudInfo cloudInfo,\r
+ String instanceName,\r
+ Map<String,Object> inputs,\r
+ VduModelInfo vduModel,\r
+ boolean rollbackOnFailure)\r
+ throws VduException;\r
+ \r
+ /**\r
+ * Query a deployed VDU instance. This call will return a VduInstance object, or null\r
+ * if the deployment does not exist.\r
+ * \r
+ * Some VIM orchestrators identify deployment instances by string UUIDs, and others \r
+ * by integers. In the latter case, the ID will be passed in as a numeric string.\r
+ *\r
+ * The returned VduInstance object contains the input and output parameter maps,\r
+ * as well as other properties of the deployment (name, status, last action, etc.).\r
+ * \r
+ * @param cloudInfo The target cloud + tenant identifiers for the VDU.\r
+ * @param vduInstanceId The ID of the deployment to query\r
+ * \r
+ * @return A VduInstance object\r
+ * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs.\r
+ * Various subclasses of VduException may be thrown.\r
+ */\r
+ public VduInstance queryVdu (\r
+ CloudInfo cloudInfo,\r
+ String vduInstanceId)\r
+ throws VduException;\r
+\r
+ \r
+ /**\r
+ * Delete a VDU instance by ID. If the VIM sub-orchestrator supports pre-installation\r
+ * of blueprints/models, the blueprint itself may remain installed. This is recommended,\r
+ * since other VDU instances may be using it.\r
+ * \r
+ * Some VIM orchestrators identify deployment instances by string UUIDs, and others \r
+ * by integers. In the latter case, the ID will be passed in as a numeric string.\r
+ * \r
+ * For some VIMs, deletion may be a single command (e.g. Heat -> delete stack) or a\r
+ * series of API calls (e.g. Cloudify -> execute uninstall workflow, delete deployment).\r
+ * These details are hidden within the plug-in implementation. The deletion should be\r
+ * fully completed before returning. \r
+ * \r
+ * The successful return is a VduInstance object which contains the state of the VDU\r
+ * just prior to deletion, with a status of DELETED. If the deployment was not found,\r
+ * the VduInstance object should be empty (with a status of NOTFOUND).\r
+ * There is no rollback from a successful deletion.\r
+ * \r
+ * A deletion failure will result in an undefined deployment state - the components may\r
+ * or may not have been all or partially uninstalled, so the resulting deployment must\r
+ * be considered invalid.\r
+ *\r
+ * @param cloudInfo The target cloud + tenant identifiers for the VDU.\r
+ * @param instanceId The unique id of the deployment to delete.\r
+ * @param timeoutMinutes Timeout after which the delete action will be cancelled.\r
+ * Consider sending the entire model here, if it may be of use to the plug-in?\r
+ * \r
+ * @return A VduInstance object, representing its state just prior to deletion.\r
+ * \r
+ * @throws VduException Thrown if the API calls fail or if a timeout occurs.\r
+ * Various subclasses of VduException may be thrown.\r
+ */\r
+ public VduInstance deleteVdu (\r
+ CloudInfo cloudInfo,\r
+ String instanceId,\r
+ int timeoutMinutes)\r
+ throws VduException;\r
+\r
+ \r
+ /**\r
+ * The updateVdu interface attempts to update a VDU in-place, using either new inputs or\r
+ * a new model definition (i.e. updated templates/blueprints). This depends on the\r
+ * capabilities of the targeted sub-orchestrator, as not all implementations are expected\r
+ * to support this ability. It is primary included initially only for Heat.\r
+ *\r
+ * It is expected that parameters have been validated and contain at minimum the required\r
+ * parameters for the given template with no extra parameters. The VDU instance name cannot\r
+ * be updated. \r
+ * \r
+ * The update should be fully completed before returning. The successful return is a\r
+ * VduInstance object containing the updated VDU state.\r
+ * \r
+ * An update failure will result in an undefined deployment state - the components may\r
+ * or may not have been all or partially modified, deleted, recreated, etc. So the resulting\r
+ * VDU must be considered invalid.\r
+ * \r
+ * @param cloudInfo The target cloud + tenant identifiers for the VDU.\r
+ * @param instanceId The unique ID for the VDU instance to update.\r
+ * @param inputs A map of key/value inputs. Values may be strings, numbers, or JSON objects.\r
+ * Will completely replace any inputs provided on the original instantiation.\r
+ * @param vduModel Object containing the collection of templates and files that comprise\r
+ * the blueprint for this VDU.\r
+ * @param rollbackOnFailure Flag to preserve or roll back the update on Failure. Should normally\r
+ * be True except in troubleshooting/debug cases. Might not be supported in all plug-ins.\r
+ * \r
+ * @return A VduInfo object\r
+ * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs.\r
+ * Various subclasses of VduException may be thrown.\r
+ */\r
+ public VduInstance updateVdu (\r
+ CloudInfo cloudInfo,\r
+ String instanceId,\r
+ Map<String,Object> inputs,\r
+ VduModelInfo vduModel,\r
+ boolean rollbackOnFailure)\r
+ throws VduException;\r
+\r
+}
\ No newline at end of file
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * OPENECOMP - MSO\r
+ * ================================================================================\r
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+\r
+/*\r
+ * Enum status values to capture the state of a generic (cloud-agnostic) VDU.\r
+ */\r
+public enum VduStateType {\r
+ NOTFOUND,\r
+ INSTANTIATING,\r
+ INSTANTIATED,\r
+ DELETING,\r
+ DELETED, // Note - only returned in success response to deleteVdu call.\r
+ UPDATING,\r
+ FAILED,\r
+ UNKNOWN\r
+}\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu;\r
+\r
+public class VduStatus {\r
+ \r
+ private VduStateType state; \r
+ private String errorMessage;\r
+ private PluginAction lastAction; \r
+ \r
+ public VduStateType getState() {\r
+ return state;\r
+ }\r
+ public void setState(VduStateType state) {\r
+ this.state = state;\r
+ }\r
+ public String getErrorMessage() {\r
+ return errorMessage;\r
+ }\r
+ public void setErrorMessage(String errorMessage) {\r
+ this.errorMessage = errorMessage;\r
+ }\r
+ public PluginAction getLastAction() {\r
+ return lastAction;\r
+ }\r
+ public void setLastAction(PluginAction lastAction) {\r
+ this.lastAction = lastAction;\r
+ }\r
+ public void setLastAction (String action, String status, String rawCloudMessage) {\r
+ lastAction = new PluginAction();\r
+ lastAction.setAction (action);\r
+ lastAction.setStatus (status);\r
+ lastAction.setRawMessage(rawCloudMessage);\r
+ }\r
+ \r
+}
\ No newline at end of file
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
+import org.openecomp.mso.adapters.vdu.CloudInfo;
+import org.openecomp.mso.adapters.vdu.PluginAction;
+import org.openecomp.mso.adapters.vdu.VduArtifact;
+import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType;
+import org.openecomp.mso.adapters.vdu.VduException;
+import org.openecomp.mso.adapters.vdu.VduInstance;
+import org.openecomp.mso.adapters.vdu.VduModelInfo;
+import org.openecomp.mso.adapters.vdu.VduPlugin;
+import org.openecomp.mso.adapters.vdu.VduStateType;
+import org.openecomp.mso.adapters.vdu.VduStatus;
import org.openecomp.mso.cloud.CloudConfig;
import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.cloud.CloudSite;
import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.GetExecution;
import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.ListExecutions;
import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.StartExecution;
+import org.openecomp.mso.cloudify.v3.model.AzureConfig;
import org.openecomp.mso.cloudify.v3.model.Blueprint;
import org.openecomp.mso.cloudify.v3.model.CancelExecutionParams;
import org.openecomp.mso.cloudify.v3.model.CloudifyError;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class MsoCloudifyUtils extends MsoCommonUtils {
+public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
private MsoPropertiesFactory msoPropertiesFactory;
private CloudConfigFactory cloudConfigFactory;
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ /**
+ * This constructor MUST be used ONLY in the JUNIT tests, not for real code.
+ */
+ public MsoCloudifyUtils() {
+
+ }
/**
* This constructor MUST be used ONLY in the JUNIT tests, not for real code.
* The MsoPropertiesFactory will be added by EJB injection.
Cloudify cloudify = getCloudifyClient (cloudSite.get());
- // Create the Cloudify OpenstackConfig with the credentials
- OpenstackConfig openstackConfig = getOpenstackConfig (cloudSite.get(), tenantId);
-
LOGGER.debug ("Ready to Create Deployment (" + deploymentId + ") with input params: " + inputs);
// Build up the inputs, including:
// - from provided "environment" file
// - passed in by caller
- // - special input for Openstack Credentials
- Map<String,Object> expandedInputs = new HashMap<String,Object> (inputs);
- expandedInputs.put("openstack_config", openstackConfig);
+ // - special input for cloud-specific Credentials
+ Map<String,Object> expandedInputs = new HashMap<> (inputs);
+
+ String platform = cloudSite.get().getPlatform();
+ if (platform == null || platform.equals("") || platform.equalsIgnoreCase("OPENSTACK")) {
+ // Create the Cloudify OpenstackConfig with the credentials
+ OpenstackConfig openstackConfig = getOpenstackConfig (cloudSite.get(), tenantId);
+ expandedInputs.put("openstack_config", openstackConfig);
+ } else if (platform.equalsIgnoreCase("AZURE")) {
+ // Create Cloudify AzureConfig with the credentials
+ AzureConfig azureConfig = getAzureConfig (cloudSite.get(), tenantId);
+ expandedInputs.put("azure_config", azureConfig);
+ }
// Build up the parameters to create a new deployment
CreateDeploymentParams deploymentParams = new CreateDeploymentParams();
/*
* It can take some time for Cloudify to be ready to execute a workflow
- * on the deployment. Sleep 10 seconds.
+ * on the deployment. Sleep 30 seconds based on observation of behavior
+ * in a Cloudify VM instance (delay due to "create_deployment_environment").
*/
try {
- Thread.sleep(10000);
+ Thread.sleep(30000);
} catch (InterruptedException e) {}
/*
/*
* Common method to load a blueprint. May be called from
*/
- private boolean uploadBlueprint (Cloudify cloudify, String blueprintId, String mainFileName, Map<String,byte[]> blueprintFiles)
+ protected boolean uploadBlueprint (Cloudify cloudify, String blueprintId, String mainFileName, Map<String,byte[]> blueprintFiles)
throws MsoException
{
// Check if it already exists. If so, return false.
return me;
}
+
+
+ /*******************************************************************************
+ *
+ * Methods (and associated utilities) to implement the VduPlugin interface
+ *
+ *******************************************************************************/
+
+ /**
+ * VduPlugin interface for instantiate function.
+ *
+ * This one is a bit more complex, in that it will first upload the blueprint if needed,
+ * then create the Cloudify deployment and execute the install workflow.
+ *
+ * This implementation also merges any parameters defined in the ENV file with the other
+ * other input parameters for any undefined parameters).
+ * The basic MsoCloudifyUtils separates blueprint management from deploument actions,
+ * but the VduPlugin does not declare blueprint management operations.
+ */
+ 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 and uploading a blueprint. Use the model customization UUID as
+ // the blueprint identifier.
+
+ String blueprintId = vduModel.getModelCustomizationUUID();
+
+ try {
+
+ if (! isBlueprintLoaded (cloudSiteId, blueprintId)) {
+ LOGGER.debug ("Blueprint " + blueprintId + " is not loaded. Will upload it now.");
+
+ // Prepare the blueprint inputs. Need the set of blueprint templates and files,
+ // plus the main blueprint name.
+ Map<String,byte[]> blueprintFiles = new HashMap<>();
+ String mainTemplate = "";
+
+ // Add all of the blueprint artifacts from the VDU model
+ List<VduArtifact> vduArtifacts = vduModel.getArtifacts();
+ for (VduArtifact vduArtifact: vduArtifacts)
+ {
+ // Add all artifacts to the blueprint, with one exception.
+ // ENVIRONMENT files will be processed later as additional parameters.
+
+ ArtifactType artifactType = vduArtifact.getType();
+ if (artifactType != ArtifactType.ENVIRONMENT) {
+ blueprintFiles.put(vduArtifact.getName(), vduArtifact.getContent());
+
+ if (artifactType == ArtifactType.MAIN_TEMPLATE) {
+ mainTemplate = vduArtifact.getName();
+ }
+ }
+ }
+
+ // Upload the blueprint package
+ uploadBlueprint(cloudSiteId, blueprintId, mainTemplate, blueprintFiles, false);
+ }
+ }
+ catch (Exception e) {
+ throw new VduException ("CloudifyUtils (instantiateVDU): blueprint Exception", e);
+ }
+
+
+ // Next, create and install a new deployment based on the blueprint.
+ // For Cloudify, the deploymentId is specified by the client. Just use the instance name
+ // as the ID.
+
+ try {
+ // Query the Cloudify Deployment object and populate a VduInstance
+ DeploymentInfo deployment = createAndInstallDeployment (cloudSiteId,
+ tenantId,
+ instanceName,
+ blueprintId,
+ inputs,
+ true, // (poll for completion)
+ vduModel.getTimeoutMinutes(),
+ rollbackOnFailure);
+
+ VduInstance vduInstance = deploymentInfoToVduInstance(deployment);
+
+ return vduInstance;
+ }
+ catch (Exception e) {
+ throw new VduException ("CloudifyUtils (instantiateVDU): Create-and-install-deployment Exception", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for query function.
+ */
+ 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
+ DeploymentInfo deployment = queryDeployment (cloudSiteId, tenantId, instanceId);
+
+ VduInstance vduInstance = deploymentInfoToVduInstance(deployment);
+
+ return vduInstance;
+ }
+ catch (Exception e) {
+ throw new VduException ("Query VDU Exception", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for delete function.
+ */
+ public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes)
+ throws VduException
+ {
+ String cloudSiteId = cloudInfo.getCloudSiteId();
+ String tenantId = cloudInfo.getTenantId();
+
+ try {
+ // Uninstall and delete the Cloudify Deployment
+ DeploymentInfo deployment = uninstallAndDeleteDeployment (cloudSiteId, tenantId, instanceId, timeoutMinutes);
+
+ // Populate a VduInstance based on the deleted Cloudify Deployment object
+ VduInstance vduInstance = deploymentInfoToVduInstance(deployment);
+
+ return vduInstance;
+ }
+ catch (Exception e) {
+ throw new VduException ("Delete VDU Exception", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for update function.
+ *
+ * Update is currently not supported in the MsoCloudifyUtils implementation.
+ * Just return a VduException.
+ *
+ */
+ public VduInstance updateVdu (
+ CloudInfo cloudInfo,
+ String instanceId,
+ Map<String,Object> inputs,
+ VduModelInfo vduModel,
+ boolean rollbackOnFailure)
+ throws VduException
+ {
+ throw new VduException ("CloudifyUtils: updateVDU interface not supported");
+ }
+
+
+ /*
+ * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object
+ */
+ protected VduInstance deploymentInfoToVduInstance (DeploymentInfo deployment)
+ {
+ VduInstance vduInstance = new VduInstance();
+
+ // only one ID in Cloudify, use for both VDU name and ID
+ vduInstance.setVduInstanceId(deployment.getId());
+ vduInstance.setVduInstanceName(deployment.getId());
+
+ // Copy inputs and outputs
+ vduInstance.setInputs(deployment.getInputs());
+ vduInstance.setOutputs(deployment.getOutputs());
+
+ // Translate the status elements
+ vduInstance.setStatus(deploymentStatusToVduStatus (deployment));
+
+ return vduInstance;
+ }
+
+ protected VduStatus deploymentStatusToVduStatus (DeploymentInfo deployment)
+ {
+ VduStatus vduStatus = new VduStatus();
+
+ // Determine the status based on last action & status
+ // DeploymentInfo object should be enhanced to report a better status internally.
+ DeploymentStatus status = deployment.getStatus();
+
+ if (status == null) {
+ vduStatus.setState(VduStateType.UNKNOWN);
+ }
+ else if (status == DeploymentStatus.NOTFOUND) {
+ vduStatus.setState(VduStateType.NOTFOUND);
+ }
+ else if (status == DeploymentStatus.INSTALLED) {
+ vduStatus.setState(VduStateType.INSTANTIATED);
+ }
+ else if (status == DeploymentStatus.CREATED) {
+ // Deployment exists but is not installed. This shouldn't really happen,
+ // since create + install or uninstall + delete are always done together.
+ // But account for it anyway, assuming the operation is still in progress.
+ String lastAction = deployment.getLastAction();
+ if (lastAction == null)
+ vduStatus.setState(VduStateType.INSTANTIATING);
+ else
+ vduStatus.setState(VduStateType.DELETING);
+ }
+ else if (status == DeploymentStatus.FAILED) {
+ vduStatus.setState(VduStateType.FAILED);
+ } else {
+ vduStatus.setState(VduStateType.UNKNOWN);
+ }
+
+ vduStatus.setErrorMessage(deployment.getErrorMessage());
+ vduStatus.setLastAction(new PluginAction(deployment.getLastAction(), deployment.getActionStatus(), deployment.getErrorMessage()));
+
+ return vduStatus;
+ }
+
/*
* Return an OpenstackConfig object as expected by Cloudify Openstack Plug-in.
* Base the values on the CloudSite definition.
*/
- private OpenstackConfig getOpenstackConfig (CloudSite cloudSite, String tenantId) {
+ protected OpenstackConfig getOpenstackConfig (CloudSite cloudSite, String tenantId) {
OpenstackConfig openstackConfig = new OpenstackConfig();
openstackConfig.setRegion (cloudSite.getRegionId());
openstackConfig.setAuthUrl (cloudSite.getIdentityService().getIdentityUrl());
openstackConfig.setTenantName (tenantId);
return openstackConfig;
}
+
+ /*
+ * Return an Azure object as expected by Cloudify Azure Plug-in.
+ * Base the values on the CloudSite definition.
+ */
+ protected AzureConfig getAzureConfig (CloudSite cloudSite, String tenantId) {
+ AzureConfig azureConfig = new AzureConfig();
+ // TODO: Use adminTenant for now, instead of adding another element
+ azureConfig.setSubscriptionId (cloudSite.getIdentityService().getAdminTenant());
+ azureConfig.setTenantId (tenantId);
+ azureConfig.setClientId (cloudSite.getIdentityService().getMsoId());
+ azureConfig.setClientSecret (cloudSite.getIdentityService().getMsoPass());
+ return azureConfig;
+ }
}
package org.openecomp.mso.openstack.utils;
-
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Set;
+
import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
import org.openecomp.mso.logger.MsoLogger;
public class MsoHeatEnvironmentEntry {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-
- private Set<MsoHeatEnvironmentParameter> parameters = null;
- private Set<MsoHeatEnvironmentResource> resources = null;
- private StringBuilder rawEntry = null;
- private boolean valid = true;
- private String errorString = null;
- private StringBuilder resourceRegistryEntryRaw = null;
-
- public MsoHeatEnvironmentEntry() {
- super();
- }
-
- public MsoHeatEnvironmentEntry(StringBuilder sb) {
- this();
- this.rawEntry = sb;
- this.processRawEntry();
- }
-
- private void processRawEntry() {
- try {
- if (this.rawEntry == null || "".equals(this.rawEntry))
- return;
- byte[] b = this.rawEntry.toString().getBytes();
- MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b);
- this.parameters = yaml.getParameterListFromEnvt();
- //this.resources = yaml.getResourceListFromEnvt();
- StringBuilder sb = this.getResourceRegistryRawEntry();
- if (sb == null) {
- this.resourceRegistryEntryRaw = new StringBuilder("");
- } else {
- this.resourceRegistryEntryRaw = sb;
- }
- } catch (Exception e) {
- LOGGER.debug("Exception:", e);
- this.valid = false;
- this.errorString = e.getMessage();
- //e.printStackTrace();
- }
- }
-
- public boolean isValid() {
- return this.valid;
- }
- public String getErrorString() {
- return this.errorString;
- }
-
- public Set<MsoHeatEnvironmentParameter> getParameters() {
- return this.parameters;
- }
- public Set<MsoHeatEnvironmentResource> getResources() {
- return this.resources;
- }
- public void setParameters(Set<MsoHeatEnvironmentParameter> paramSet) {
- if (paramSet == null) {
- this.parameters = null;
- } else {
- this.parameters = paramSet;
- }
- }
- public void setResources(Set<MsoHeatEnvironmentResource> resourceSet) {
- if (resourceSet == null) {
- this.resources = null;
- } else {
- this.resources = resourceSet;
- }
- }
-
- public void addParameter(MsoHeatEnvironmentParameter hep) {
- if (this.parameters == null) {
- this.parameters = new HashSet<>();
- }
- this.parameters.add(hep);
- }
- public void addResource(MsoHeatEnvironmentResource her) {
- if (this.resources == null) {
- this.resources = new HashSet<>();
- }
- this.resources.add(her);
- }
-
- public int getNumberOfParameters() {
- return this.parameters.size();
- }
- public int getNumberOfResources() {
- return this.resources.size();
- }
-
- public boolean hasResources() {
- if (this.resources != null && this.resources.size() > 0) {
- return true;
- }
- return false;
- }
- public boolean hasParameters() {
- if (this.parameters != null && this.parameters.size() > 0) {
- return true;
- }
- return false;
- }
-
- public boolean containsParameter(String paramName) {
- boolean contains = false;
- if (this.parameters == null || this.parameters.size() < 1) {
- return false;
- }
- if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) {
- contains = true;
- }
- return contains;
- }
-
- public boolean containsParameter(String paramName, String paramAlias) {
- if (this.containsParameter(paramName)) {
- return true;
- }
- if (this.containsParameter(paramAlias)) {
- return true;
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "MsoHeatEnvironmentEntry{" + "parameters=" + parameters +
- ", resourceRegistryEntryRaw='" + resourceRegistryEntryRaw + '\'' +
- '}';
- }
-
- public StringBuilder toFullStringExcludeNonParams(Set<HeatTemplateParam> params) {
- // Basically give back the envt - but exclude the params that aren't in the HeatTemplate
-
- StringBuilder sb = new StringBuilder();
- ArrayList<String> paramNameList = new ArrayList<String>(params.size());
- for (HeatTemplateParam htp : params) {
- paramNameList.add(htp.getParamName());
- }
-
- if (this.hasParameters()) {
- sb.append("parameters:\n");
- for (MsoHeatEnvironmentParameter hep : this.parameters) {
- String paramName = hep.getName();
- if (paramNameList.contains(paramName)) {
- // This parameter *is* in the Heat Template - so include it:
- sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n");
- // New - 1607 - if any of the params mapped badly - JUST RETURN THE ORIGINAL ENVT!
- if (hep.getValue().startsWith("_BAD")) {
- return this.rawEntry;
- }
- }
- }
- sb.append("\n");
- }
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+
+ private Set<MsoHeatEnvironmentParameter> parameters = null;
+ private Set<MsoHeatEnvironmentResource> resources = null;
+ private StringBuilder rawEntry = null;
+ private boolean valid = true;
+ private String errorString = null;
+ private StringBuilder resourceRegistryEntryRaw = null;
+
+ public MsoHeatEnvironmentEntry() {
+ super();
+ }
+
+ public MsoHeatEnvironmentEntry(StringBuilder sb) {
+ this();
+ this.rawEntry = sb;
+ this.processRawEntry();
+ }
+
+ private void processRawEntry() {
+ try {
+ if (this.rawEntry == null || "".equals(this.rawEntry))
+ return;
+ byte[] b = this.rawEntry.toString().getBytes();
+ MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b);
+ this.parameters = yaml.getParameterListFromEnvt();
+ //this.resources = yaml.getResourceListFromEnvt();
+ StringBuilder sb = this.getResourceRegistryRawEntry();
+ if (sb == null) {
+ this.resourceRegistryEntryRaw = new StringBuilder("");
+ } else {
+ this.resourceRegistryEntryRaw = sb;
+ }
+ } catch (Exception e) {
+ LOGGER.debug("Exception:", e);
+ this.valid = false;
+ this.errorString = e.getMessage();
+ //e.printStackTrace();
+ }
+ }
+
+ public boolean isValid() {
+ return this.valid;
+ }
+
+ public String getErrorString() {
+ return this.errorString;
+ }
+
+ public Set<MsoHeatEnvironmentParameter> getParameters() {
+ return this.parameters;
+ }
+
+ public Set<MsoHeatEnvironmentResource> getResources() {
+ return this.resources;
+ }
+
+ public void setParameters(Set<MsoHeatEnvironmentParameter> paramSet) {
+ if (paramSet == null) {
+ this.parameters = null;
+ } else {
+ this.parameters = paramSet;
+ }
+ }
+
+ public void setResources(Set<MsoHeatEnvironmentResource> resourceSet) {
+ if (resourceSet == null) {
+ this.resources = null;
+ } else {
+ this.resources = resourceSet;
+ }
+ }
+
+ public void addParameter(MsoHeatEnvironmentParameter hep) {
+ if (this.parameters == null) {
+ this.parameters = new HashSet<>();
+ }
+ this.parameters.add(hep);
+ }
+
+ public void addResource(MsoHeatEnvironmentResource her) {
+ if (this.resources == null) {
+ this.resources = new HashSet<>();
+ }
+ this.resources.add(her);
+ }
+
+ public int getNumberOfParameters() {
+ return this.parameters.size();
+ }
+
+ public int getNumberOfResources() {
+ return this.resources.size();
+ }
+
+ public boolean hasResources() {
+ if (this.resources != null && this.resources.size() > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean hasParameters() {
+ if (this.parameters != null && this.parameters.size() > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean containsParameter(String paramName) {
+ boolean contains = false;
+ if (this.parameters == null || this.parameters.size() < 1) {
+ return false;
+ }
+ if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) {
+ contains = true;
+ }
+ return contains;
+ }
+
+ public boolean containsParameter(String paramName, String paramAlias) {
+ if (this.containsParameter(paramName)) {
+ return true;
+ }
+ if (this.containsParameter(paramAlias)) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "MsoHeatEnvironmentEntry{" + "parameters=" + parameters +
+ ", resourceRegistryEntryRaw='" + resourceRegistryEntryRaw + '\'' +
+ '}';
+ }
+
+ public StringBuilder toFullStringExcludeNonParams(Set<HeatTemplateParam> params) {
+ // Basically give back the envt - but exclude the params that aren't in the HeatTemplate
+
+ StringBuilder sb = new StringBuilder();
+ ArrayList<String> paramNameList = new ArrayList<String>(params.size());
+ for (HeatTemplateParam htp : params) {
+ paramNameList.add(htp.getParamName());
+ }
+
+ if (this.hasParameters()) {
+ sb.append("parameters:\n");
+ for (MsoHeatEnvironmentParameter hep : this.parameters) {
+ String paramName = hep.getName();
+ if (paramNameList.contains(paramName)) {
+ // This parameter *is* in the Heat Template - so include it:
+ sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n");
+ // New - 1607 - if any of the params mapped badly - JUST RETURN THE ORIGINAL ENVT!
+ if (hep.getValue().startsWith("_BAD")) {
+ return this.rawEntry;
+ }
+ }
+ }
+ sb.append("\n");
+ }
// if (this.hasResources()) {
// sb.append("resource_registry:\n");
// for (MsoHeatEnvironmentResource her : this.resources) {
// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n");
// }
// }
- sb.append("\n");
- sb.append(this.resourceRegistryEntryRaw);
- return sb;
- }
-
- public StringBuilder toFullString() {
- StringBuilder sb = new StringBuilder();
-
- if (this.hasParameters()) {
- sb.append("parameters:\n");
- for (MsoHeatEnvironmentParameter hep : this.parameters) {
- sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n");
- }
- sb.append("\n");
- }
+ sb.append("\n");
+ sb.append(this.resourceRegistryEntryRaw);
+ return sb;
+ }
+
+ public StringBuilder toFullString() {
+ StringBuilder sb = new StringBuilder();
+
+ if (this.hasParameters()) {
+ sb.append("parameters:\n");
+ for (MsoHeatEnvironmentParameter hep : this.parameters) {
+ sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n");
+ }
+ sb.append("\n");
+ }
// if (this.hasResources()) {
// sb.append("resource_registry:\n");
// for (MsoHeatEnvironmentResource her : this.resources) {
// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n");
// }
// }
- sb.append("\n");
- sb.append(this.resourceRegistryEntryRaw);
- return sb;
- }
-
- public StringBuilder getRawEntry() {
- return this.rawEntry;
- }
-
- private StringBuilder getResourceRegistryRawEntry() {
-
- if (this.rawEntry == null) {
- return null;
- }
-
- StringBuilder sb = new StringBuilder();
- int indexOf = this.rawEntry.indexOf("resource_registry:");
- if (indexOf < 0) { // no resource_registry:
- return null;
- }
- sb.append(this.rawEntry.substring(indexOf));
- return sb;
- }
-
+ sb.append("\n");
+ sb.append(this.resourceRegistryEntryRaw);
+ return sb;
+ }
+
+ public StringBuilder getRawEntry() {
+ return this.rawEntry;
+ }
+
+ private StringBuilder getResourceRegistryRawEntry() {
+
+ if (this.rawEntry == null) {
+ return null;
+ }
+
+ StringBuilder sb = new StringBuilder();
+ int indexOf = this.rawEntry.indexOf("resource_registry:");
+ if (indexOf < 0) { // no resource_registry:
+ return null;
+ }
+ sb.append(this.rawEntry.substring(indexOf));
+ return sb;
+ }
+
+ public void setHPAParameters(StringBuilder hpasb) {
+ try {
+ MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(hpasb.toString().getBytes());
+ Set<MsoHeatEnvironmentParameter> hpaParams = yaml.getParameterListFromEnvt();
+ for (MsoHeatEnvironmentParameter hpaparam : hpaParams) {
+ for (MsoHeatEnvironmentParameter param : this.parameters) {
+ if (param.getName() == hpaparam.getName()) {
+ param.setValue(hpaparam.getValue());
+ }
+ }
+ }
+ } catch (Exception e) {
+ LOGGER.debug("Exception:", e);
+ this.errorString = e.getMessage();
+ //e.printStackTrace();
+ }
+ }
}
import java.util.Map;
import java.util.Set;
+import org.openecomp.mso.adapters.vdu.CloudInfo;
+import org.openecomp.mso.adapters.vdu.PluginAction;
+import org.openecomp.mso.adapters.vdu.VduArtifact;
+import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType;
+import org.openecomp.mso.adapters.vdu.VduException;
+import org.openecomp.mso.adapters.vdu.VduInstance;
+import org.openecomp.mso.adapters.vdu.VduModelInfo;
+import org.openecomp.mso.adapters.vdu.VduPlugin;
+import org.openecomp.mso.adapters.vdu.VduStateType;
+import org.openecomp.mso.adapters.vdu.VduStatus;
import org.openecomp.mso.cloud.CloudConfig;
import org.openecomp.mso.cloud.CloudConfigFactory;
import org.openecomp.mso.cloud.CloudIdentity;
import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.base.client.OpenStackConnectException;
import com.woorea.openstack.keystone.model.Authentication;
import com.woorea.openstack.keystone.utils.KeystoneUtils;
-public class MsoHeatUtils extends MsoCommonUtils {
+public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
private MsoPropertiesFactory msoPropertiesFactory;
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ /**
+ * This constructor MUST be used ONLY in the JUNIT tests, not for real code.
+ */
+ public MsoHeatUtils() {
+
+ }
+
/**
* This constructor MUST be used ONLY in the JUNIT tests, not for real code.
* The MsoPropertiesFactory will be added by EJB injection.
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.
+ */
+ 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
+ VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
+
+ return vduInstance;
+ }
+ catch (Exception e) {
+ throw new VduException ("MsoHeatUtils (instantiateVDU): createStack Exception", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for query function.
+ */
+ 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);
+
+ VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
+
+ return vduInstance;
+ }
+ catch (Exception e) {
+ throw new VduException ("MsoHeatUtile (queryVdu): queryStack Exception ", e);
+ }
+ }
+
+
+ /**
+ * VduPlugin interface for delete function.
+ */
+ public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes)
+ throws VduException
+ {
+ 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.
+ *
+ */
+ public VduInstance updateVdu (
+ CloudInfo cloudInfo,
+ String instanceId,
+ Map<String,Object> inputs,
+ VduModelInfo vduModel,
+ boolean rollbackOnFailure)
+ throws VduException
+ {
+ 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)
+ {
+ 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;
+ }
+
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.openecomp.mso.adapters.vdu;
+
+import org.junit.Test;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+public class BeansTest {
+
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ @Test
+ public void pojoStructure() {
+ test("org.openecomp.mso.adapters.vdu");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create()
+ .with(new GetterMustExistRule())
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .build();
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses);
+ }
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.cloudify.utils;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.cloudify.beans.DeploymentInfo;
+import org.openecomp.mso.cloudify.exceptions.MsoCloudifyManagerNotFound;
+import org.openecomp.mso.cloudify.v3.client.Cloudify;
+import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.util.HashMap;
+import java.util.Map;
+import static org.mockito.Mockito.mock;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({MsoCloudifyUtils.class})
+
+
+public class MsoCloudifyUtilsTest {
+
+
+ @Mock
+ MsoPropertiesFactory msoPropertiesFactory;
+
+ @Mock
+ CloudConfigFactory cloudConfigFactory;
+
+ @Mock
+ DeploymentInfo deploymentInfo;
+
+ @Mock
+ Cloudify cloudify;
+
+ @Mock
+ DeploymentOutputs deploymentOutputs;
+
+ @Mock
+ CloudSite cloudSite;
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateandInstallDeployment() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+ Map<String, Object> inputs = new HashMap<>();
+ inputs.put("1", "value");
+
+ mcu.createAndInstallDeployment("cloudSiteId", "tenantId", "deploymentId", "blueprintId"
+ , inputs, true, 1, true);
+
+ assert (mcu.createAndInstallDeployment("cloudSiteId", "tenantId", "deploymentId", "blueprintId"
+ , inputs, true, 1, true) != null);
+
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testDeploymentOutputs() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+ mcu.queryDeployment("cloudSiteId", "tenantId", "deploymentId");
+ assert (mcu.queryDeployment("cloudSiteId", "tenantId", "deploymentId") != null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testUninstallAndDeleteDeployment() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+ mcu.uninstallAndDeleteDeployment("cloudSiteId", "tenantId", "deploymentId", 1);
+ assert (mcu.uninstallAndDeleteDeployment("cloudSiteId", "tenantId", "deploymentId", 1) != null);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testIsBlueprintLoaded() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+ mcu.isBlueprintLoaded("cloudSiteId", "blueprintId");
+ assertTrue(mcu.isBlueprintLoaded("cloudSiteId", "blueprintId"));
+ }
+
+ @Test(expected = MsoCloudifyManagerNotFound.class)
+ public void testCloudifyClient() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+ mcu.getCloudifyClient(cloudSite);
+ assert (mcu.getCloudifyClient(cloudSite) != null);
+
+ }
+
+
+ @Test(expected = NullPointerException.class)
+ public void testuploadBlueprint() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+
+ Map<String, byte[]> blueprintFiles = new HashMap<String, byte[]>();
+ byte[] byteArray = new byte[]{8, 1, 2, 8};
+ blueprintFiles.put("1", byteArray);
+
+ mcu.uploadBlueprint("cloudSiteId", "blueprintId", "mainFileName", blueprintFiles, false);
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testqueryDeployment() throws MsoException {
+
+ MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory);
+ mcu.queryDeployment(cloudify, "deploymentId");
+ assert (mcu.queryDeployment(cloudify, "deploymentId") != null);
+
+
+ }
+
+}
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.cloudify.utils;\r
+\r
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;\r
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;\r
+import static org.mockito.Mockito.doReturn;\r
+import static org.mockito.Mockito.when;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Optional;\r
+\r
+import org.junit.Test;\r
+import org.mockito.Mockito;\r
+import org.openecomp.mso.adapters.vdu.CloudInfo;\r
+import org.openecomp.mso.adapters.vdu.PluginAction;\r
+import org.openecomp.mso.adapters.vdu.VduArtifact;\r
+import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType;\r
+import org.openecomp.mso.adapters.vdu.VduInstance;\r
+import org.openecomp.mso.adapters.vdu.VduModelInfo;\r
+import org.openecomp.mso.adapters.vdu.VduStateType;\r
+import org.openecomp.mso.adapters.vdu.VduStatus;\r
+import org.openecomp.mso.cloud.CloudConfig;\r
+import org.openecomp.mso.cloud.CloudIdentity;\r
+import org.openecomp.mso.cloud.CloudSite;\r
+import org.openecomp.mso.cloudify.beans.DeploymentInfo;\r
+import org.openecomp.mso.cloudify.beans.DeploymentStatus;\r
+import org.openecomp.mso.cloudify.v3.client.Cloudify;\r
+import org.openecomp.mso.cloudify.v3.model.AzureConfig;\r
+import org.openecomp.mso.cloudify.v3.model.OpenstackConfig;\r
+import org.openecomp.mso.openstack.exceptions.MsoException;\r
+\r
+public class MsoCloudifyUtilsTest2 {\r
+\r
+ @Test\r
+ public void instantiateVduTest() throws MsoException {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("id");\r
+ expected.setVduInstanceName("id");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.INSTANTIATED);\r
+ status.setLastAction(new PluginAction(null, null, null));\r
+ expected.setStatus(status);\r
+\r
+ MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class);\r
+ CloudSite site = new CloudSite();\r
+ Optional<CloudSite> opSite = Optional.ofNullable(site);\r
+ CloudConfig config = Mockito.mock(CloudConfig.class);\r
+ cloudify.cloudConfig = config;\r
+ Cloudify cloudifyClient = new Cloudify("cloudSite");\r
+ CloudInfo cloudInfo = new CloudInfo();\r
+ cloudInfo.setCloudSiteId("cloudSiteId");\r
+ cloudInfo.setTenantId("tenantId");\r
+ VduModelInfo vduModel = new VduModelInfo();\r
+ vduModel.setModelCustomizationUUID("blueprintId");\r
+ vduModel.setTimeoutMinutes(1);\r
+ VduArtifact artifact = new VduArtifact();\r
+ artifact.setName("name");\r
+ artifact.setType(ArtifactType.MAIN_TEMPLATE);\r
+ byte[] content = new byte[1];\r
+ artifact.setContent(content);\r
+ List<VduArtifact> artifacts = new ArrayList<>();\r
+ artifacts.add(artifact);\r
+ vduModel.setArtifacts(artifacts);\r
+ DeploymentInfo deployment = new DeploymentInfo();\r
+ deployment.setId("id");\r
+ deployment.setStatus(DeploymentStatus.INSTALLED);\r
+ Map<String, byte[]> blueprintFiles = new HashMap<>();\r
+ blueprintFiles.put(artifact.getName(), artifact.getContent());\r
+ String instanceName = "instanceName";\r
+ Map<String, Object> inputs = new HashMap<>();\r
+ boolean rollbackOnFailure = true;\r
+\r
+ when(config.getCloudSite(cloudInfo.getCloudSiteId())).thenReturn(opSite);\r
+ doReturn(false).when(cloudify).isBlueprintLoaded(cloudInfo.getCloudSiteId(),\r
+ vduModel.getModelCustomizationUUID());\r
+ doReturn(cloudifyClient).when(cloudify).getCloudifyClient(site);\r
+ doReturn(true).when(cloudify).uploadBlueprint(cloudifyClient, vduModel.getModelCustomizationUUID(),\r
+ artifact.getName(), blueprintFiles);\r
+ doReturn(deployment).when(cloudify).createAndInstallDeployment(cloudInfo.getCloudSiteId(),\r
+ cloudInfo.getTenantId(), instanceName, vduModel.getModelCustomizationUUID(), inputs, true,\r
+ vduModel.getTimeoutMinutes(), rollbackOnFailure);\r
+\r
+ VduInstance actual = cloudify.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void queryVduTest() throws MsoException {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("id");\r
+ expected.setVduInstanceName("id");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.INSTANTIATED);\r
+ status.setLastAction(new PluginAction(null, null, null));\r
+ expected.setStatus(status);\r
+\r
+ CloudInfo cloudInfo = new CloudInfo();\r
+ cloudInfo.setCloudSiteId("cloudSiteId");\r
+ cloudInfo.setTenantId("tenantId");\r
+ DeploymentInfo deployment = new DeploymentInfo();\r
+ deployment.setId("id");\r
+ deployment.setStatus(DeploymentStatus.INSTALLED);\r
+ String instanceId = "instanceId";\r
+\r
+ MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class);\r
+\r
+ doReturn(deployment).when(cloudify).queryDeployment(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(),\r
+ instanceId);\r
+\r
+ VduInstance actual = cloudify.queryVdu(cloudInfo, instanceId);\r
+\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void deleteVduTest() throws MsoException {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("id");\r
+ expected.setVduInstanceName("id");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.DELETING);\r
+ status.setLastAction(new PluginAction("deleting", null, null));\r
+ expected.setStatus(status);\r
+\r
+ CloudInfo cloudInfo = new CloudInfo();\r
+ cloudInfo.setCloudSiteId("cloudSiteId");\r
+ cloudInfo.setTenantId("tenantId");\r
+ String instanceId = "instanceId";\r
+ int timeoutMinutes = 1;\r
+ DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class);\r
+ deployment.setId("id");\r
+ deployment.setStatus(DeploymentStatus.CREATED);\r
+ when(deployment.getId()).thenReturn("id");\r
+ when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED);\r
+ when(deployment.getLastAction()).thenReturn("deleting");\r
+ MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class);\r
+ doReturn(deployment).when(cloudify).uninstallAndDeleteDeployment(cloudInfo.getCloudSiteId(),\r
+ cloudInfo.getTenantId(), instanceId, timeoutMinutes);\r
+\r
+ VduInstance actual = cloudify.deleteVdu(cloudInfo, instanceId, timeoutMinutes);\r
+\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void deploymentInfoToVduInstanceTest() {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("id");\r
+ expected.setVduInstanceName("id");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.DELETING);\r
+ status.setLastAction(new PluginAction("deleting", null, null));\r
+ expected.setStatus(status);\r
+\r
+ DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class);\r
+ deployment.setId("id");\r
+ deployment.setStatus(DeploymentStatus.CREATED);\r
+ when(deployment.getId()).thenReturn("id");\r
+ when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED);\r
+ when(deployment.getLastAction()).thenReturn("deleting");\r
+\r
+ MsoCloudifyUtils cloudify = new MsoCloudifyUtils();\r
+\r
+ VduInstance actual = cloudify.deploymentInfoToVduInstance(deployment);\r
+\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void deploymentStatusToVduStatusTest() {\r
+ VduStatus expected = new VduStatus();\r
+ expected.setState(VduStateType.DELETING);\r
+ expected.setLastAction(new PluginAction("deleting", null, null));\r
+\r
+ DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class);\r
+ deployment.setId("id");\r
+ deployment.setStatus(DeploymentStatus.CREATED);\r
+ when(deployment.getId()).thenReturn("id");\r
+ when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED);\r
+ when(deployment.getLastAction()).thenReturn("deleting");\r
+\r
+ MsoCloudifyUtils cloudify = new MsoCloudifyUtils();\r
+\r
+ VduStatus actual = cloudify.deploymentStatusToVduStatus(deployment);\r
+\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void getOpenstackConfigTest() {\r
+ OpenstackConfig expected = new OpenstackConfig();\r
+ expected.setRegion("regionId");\r
+ expected.setAuthUrl("identityUrl");\r
+ expected.setUsername("msoId");\r
+ expected.setPassword("msoPass");\r
+ expected.setTenantName("tenantId");\r
+\r
+ MsoCloudifyUtils cloudify = new MsoCloudifyUtils();\r
+ CloudSite cloudSite = Mockito.mock(CloudSite.class);\r
+ CloudIdentity cloudIdentity = Mockito.mock(CloudIdentity.class);\r
+ when(cloudSite.getIdentityService()).thenReturn(cloudIdentity);\r
+ when(cloudSite.getRegionId()).thenReturn("regionId");\r
+ when(cloudIdentity.getIdentityUrl()).thenReturn("identityUrl");\r
+ when(cloudIdentity.getMsoId()).thenReturn("msoId");\r
+ when(cloudIdentity.getMsoPass()).thenReturn("msoPass");\r
+ String tenantId = "tenantId";\r
+ OpenstackConfig actual = cloudify.getOpenstackConfig(cloudSite, tenantId);\r
+\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void getAzureConfigTest() {\r
+ AzureConfig expected = new AzureConfig();\r
+ expected.setSubscriptionId("subscriptionId");\r
+ expected.setTenantId("tenantId");\r
+ expected.setClientId("msoId");\r
+ expected.setClientSecret("msoPass");\r
+\r
+ MsoCloudifyUtils cloudify = new MsoCloudifyUtils();\r
+ CloudSite cloudSite = Mockito.mock(CloudSite.class);\r
+ CloudIdentity cloudIdentity = Mockito.mock(CloudIdentity.class);\r
+ when(cloudSite.getIdentityService()).thenReturn(cloudIdentity);\r
+ when(cloudIdentity.getAdminTenant()).thenReturn("subscriptionId");\r
+ when(cloudIdentity.getMsoId()).thenReturn("msoId");\r
+ when(cloudIdentity.getMsoPass()).thenReturn("msoPass");\r
+ String tenantId = "tenantId";\r
+ AzureConfig actual = cloudify.getAzureConfig(cloudSite, tenantId);\r
+\r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+}\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.openstack.utils;
+
+
+import com.woorea.openstack.heat.Heat;
+import com.woorea.openstack.heat.model.Stack;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.openstack.beans.HeatStatus;
+import org.openecomp.mso.openstack.beans.StackInfo;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest({MsoHeatUtils.class})
+
+
+public class MsoHeatUtilsTest {
+
+ @Mock
+
+ StackInfo stackInfo;
+
+ @Mock
+
+ MsoPropertiesFactory msoPropertiesFactory;
+
+ @Mock
+
+ CloudConfigFactory cloudConfigFactory;
+
+ @Mock
+
+ Heat heatClient;
+
+ @Mock
+
+ CloudSite cloudSite;
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateStack() throws MsoException
+ {
+
+ MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1);
+ doReturn(mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ null, null,
+ null,
+ true));
+
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateStackOne() throws MsoException
+ {
+ MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ "env");
+ doReturn(mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ "env", null,
+ null,
+ true));
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateStackTwo() throws MsoException
+ {
+ MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ Map<String,Object>fileMap=new HashMap<>();
+ fileMap.put("2", "value");
+ mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ "env",
+ fileMap);
+ doReturn(mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ "env", fileMap,
+ null,
+ true));
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testCreateStackThree() throws MsoException
+ {
+ MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
+ Map<String,String>metadata=new HashMap<>();
+ metadata.put("1", "value");
+ Map<String,Object>fileMap=new HashMap<>();
+ fileMap.put("2", "value");
+ Map<String,Object>heatFileMap=new HashMap<>();
+ heatFileMap.put("3", "value");
+ mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ "env",
+ fileMap,
+ heatFileMap);
+ doReturn(mht.createStack("cloudSiteId",
+ "tenantId",
+ "stackName",
+ "heatTemplate",
+ metadata,
+ true,
+ 1,
+ "env", fileMap,
+ heatFileMap,
+ true));
+ }
+
+ @Test(expected = NullPointerException.class)
+
+
+ public void testqueryStack() throws MsoException
+ {
+ MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory));
+
+ mht.queryStack("cloudSiteId","tenantId","stackName");
+
+ try {
+ heatClient = mht.getHeatClient (cloudSite, "tenantId");
+ assertNotNull(heatClient);
+
+ } catch (MsoTenantNotFound e) {
+ doReturn(new StackInfo ("stackName", HeatStatus.NOTFOUND));
+ } catch (MsoException me) {
+
+ me.addContext ("QueryStack");
+ throw me;
+ }
+
+ Stack heatStack = mht.queryHeatStack (heatClient, "stackName");
+
+ assertNull(heatStack);
+ StackInfo stackInfo = new StackInfo ("stackName", HeatStatus.NOTFOUND);
+ doReturn(stackInfo);
+
+ assertNotNull(heatStack);
+ doReturn(new StackInfo (heatStack));
+
+
+
+ }
+
+}
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.openstack.utils;\r
+\r
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;\r
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;\r
+import static org.mockito.Mockito.doReturn;\r
+import static org.mockito.Mockito.when;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Optional;\r
+\r
+import org.junit.Test;\r
+import org.mockito.Mockito;\r
+import org.openecomp.mso.adapters.vdu.CloudInfo;\r
+import org.openecomp.mso.adapters.vdu.PluginAction;\r
+import org.openecomp.mso.adapters.vdu.VduArtifact;\r
+import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType;\r
+import org.openecomp.mso.adapters.vdu.VduInstance;\r
+import org.openecomp.mso.adapters.vdu.VduModelInfo;\r
+import org.openecomp.mso.adapters.vdu.VduStateType;\r
+import org.openecomp.mso.adapters.vdu.VduStatus;\r
+import org.openecomp.mso.cloud.CloudConfig;\r
+import org.openecomp.mso.cloud.CloudSite;\r
+import org.openecomp.mso.cloudify.beans.DeploymentInfo;\r
+import org.openecomp.mso.cloudify.beans.DeploymentStatus;\r
+import org.openecomp.mso.cloudify.utils.MsoCloudifyUtils;\r
+import org.openecomp.mso.openstack.beans.HeatStatus;\r
+import org.openecomp.mso.openstack.beans.StackInfo;\r
+import org.openecomp.mso.openstack.exceptions.MsoException;\r
+\r
+import com.fasterxml.jackson.core.JsonProcessingException;\r
+\r
+public class MsoHeatUtilsTest2 {\r
+\r
+ @Test\r
+ public void instantiateVduTest() throws MsoException, JsonProcessingException {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("canonicalName");\r
+ expected.setVduInstanceName("name");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.INSTANTIATED);\r
+ status.setLastAction((new PluginAction("create", "complete", "")));\r
+ expected.setStatus(status);\r
+\r
+ MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class);\r
+ CloudSite site = new CloudSite();\r
+ Optional<CloudSite> opSite = Optional.ofNullable(site);\r
+ CloudConfig config = Mockito.mock(CloudConfig.class);\r
+ heatUtils.cloudConfig = config;\r
+ CloudInfo cloudInfo = new CloudInfo();\r
+ cloudInfo.setCloudSiteId("cloudSiteId");\r
+ cloudInfo.setTenantId("tenantId");\r
+ VduModelInfo vduModel = new VduModelInfo();\r
+ vduModel.setModelCustomizationUUID("blueprintId");\r
+ vduModel.setTimeoutMinutes(1);\r
+ VduArtifact artifact = new VduArtifact();\r
+ artifact.setName("name");\r
+ artifact.setType(ArtifactType.MAIN_TEMPLATE);\r
+ byte[] content = new byte[1];\r
+ artifact.setContent(content);\r
+ List<VduArtifact> artifacts = new ArrayList<>();\r
+ artifacts.add(artifact);\r
+ vduModel.setArtifacts(artifacts);\r
+ Map<String, byte[]> blueprintFiles = new HashMap<>();\r
+ blueprintFiles.put(artifact.getName(), artifact.getContent());\r
+ String instanceName = "instanceName";\r
+ Map<String, Object> inputs = new HashMap<>();\r
+ boolean rollbackOnFailure = true;\r
+ String heatTemplate = new String(artifact.getContent());\r
+ when(config.getCloudSite(cloudInfo.getCloudSiteId())).thenReturn(opSite);\r
+ Map<String, Object> nestedTemplates = new HashMap<String, Object>();\r
+ Map<String, Object> files = new HashMap<String, Object>();\r
+\r
+ StackInfo stackInfo = new StackInfo();\r
+ stackInfo.setCanonicalName("canonicalName");\r
+ stackInfo.setName("name");\r
+ stackInfo.setStatus(HeatStatus.CREATED);\r
+\r
+ doReturn(stackInfo).when(heatUtils).createStack(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(),\r
+ instanceName, heatTemplate, inputs, true, vduModel.getTimeoutMinutes(), null, nestedTemplates, files,\r
+ rollbackOnFailure);\r
+\r
+ VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure);\r
+ \r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+ \r
+ @Test\r
+ public void queryVduTest() throws MsoException, JsonProcessingException {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("canonicalName");\r
+ expected.setVduInstanceName("name");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.INSTANTIATED);\r
+ status.setLastAction((new PluginAction("create", "complete", "")));\r
+ expected.setStatus(status);\r
+\r
+ CloudInfo cloudInfo = new CloudInfo();\r
+ cloudInfo.setCloudSiteId("cloudSiteId");\r
+ cloudInfo.setTenantId("tenantId");\r
+ String instanceId = "instanceId";\r
+\r
+ StackInfo stackInfo = new StackInfo();\r
+ stackInfo.setCanonicalName("canonicalName");\r
+ stackInfo.setName("name");\r
+ stackInfo.setStatus(HeatStatus.CREATED);\r
+ \r
+ MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class);\r
+\r
+ doReturn(stackInfo).when(heatUtils).queryStack(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(), instanceId);\r
+\r
+ VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId);\r
+ \r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+ @Test\r
+ public void deleteVduTest() throws MsoException {\r
+ VduInstance expected = new VduInstance();\r
+ expected.setVduInstanceId("canonicalName");\r
+ expected.setVduInstanceName("name");\r
+ VduStatus status = new VduStatus();\r
+ status.setState(VduStateType.DELETED);\r
+ expected.setStatus(status);\r
+\r
+ CloudInfo cloudInfo = new CloudInfo();\r
+ cloudInfo.setCloudSiteId("cloudSiteId");\r
+ cloudInfo.setTenantId("tenantId");\r
+ String instanceId = "instanceId";\r
+\r
+ StackInfo stackInfo = new StackInfo();\r
+ stackInfo.setCanonicalName("canonicalName");\r
+ stackInfo.setName("name");\r
+ stackInfo.setStatus(HeatStatus.NOTFOUND);\r
+ \r
+ int timeoutInMinutes = 1;\r
+ \r
+ MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class);\r
+\r
+ doReturn(stackInfo).when(heatUtils).deleteStack( cloudInfo.getTenantId(), cloudInfo.getCloudSiteId(), instanceId, true);\r
+\r
+ VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes);\r
+ \r
+ assertThat(actual, sameBeanAs(expected));\r
+ }\r
+\r
+}\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoAdapterExceptionTest {
+ MsoAdapterException msoAdapterException = new MsoAdapterException("test");
+ MsoAdapterException msoAdapterExceptionThr = new MsoAdapterException("test" , new Throwable());
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoCloudIdentityNotFoundTest {
+ MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound();
+ MsoCloudIdentityNotFound msoCloudIdentityNotFoundStr = new MsoCloudIdentityNotFound("test");
+ public String str = msoCloudIdentityNotFound.toString();
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoCloudSiteNotFoundTest {
+ MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound();
+ MsoCloudSiteNotFound msoCloudSiteNotFoundStr = new MsoCloudSiteNotFound("test");
+ public String str = msoCloudSiteNotFoundStr.toString();
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoIOExceptionTest {
+ MsoIOException msoIOException = new MsoIOException("test");
+ MsoIOException msoIOExceptionTh = new MsoIOException("test" , new Throwable());
+ public String str = msoIOException.toString();
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoNetworkAlreadyExistsTest {
+ MsoNetworkAlreadyExists msoNetworkAlreadyExists = new MsoNetworkAlreadyExists("test","test","test");
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoNetworkNotFoundTest {
+ MsoNetworkNotFound msoNetworkNotFound =new MsoNetworkNotFound("test","test","test");
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoOpenstackExceptionTest {
+ MsoOpenstackException msoOpenstackException= new MsoOpenstackException(404,"test","test");
+ MsoOpenstackException msoOpenstackExceptionEx= new MsoOpenstackException(404,"test","test",new Exception());
+ public String str = msoOpenstackException.toString();
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoStackAlreadyExistsTest {
+ MsoStackAlreadyExists msoStackAlreadyExists = new MsoStackAlreadyExists("test","test","test");
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoStackNotFoundTest {
+ MsoStackNotFound msoStackNotFound = new MsoStackNotFound("test","test","test");
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoTenantAlreadyExistsTest {
+ MsoTenantAlreadyExists msoTenantAlreadyExists = new MsoTenantAlreadyExists("test","test");
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.openstack.exceptions;
+
+public class MsoTenantNotFoundTest {
+ MsoTenantNotFound msoTenantNotFound = new MsoTenantNotFound("test","test");
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.adapters.catalogdb.catalogrest;
+
+import org.junit.Test;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+public class CatalogQueryExceptionTest {
+ @Test
+ public void catalogQueryExceptionConstructor(){
+ CatalogQueryException messageCatalogQueryException = new CatalogQueryException("TestMessage");
+ assertNotNull(messageCatalogQueryException.getMessage());
+ assertEquals("TestMessage",messageCatalogQueryException.getMessage());
+
+ CatalogQueryException paramsCatalogQueryException = new CatalogQueryException("TestMessage",CatalogQueryExceptionCategory.INTERNAL,true,"messageID");
+ assertParams(paramsCatalogQueryException);
+
+ CatalogQueryException defaultCatalogQueryException = new CatalogQueryException();
+ defaultCatalogQueryException.setCategory(CatalogQueryExceptionCategory.INTERNAL);
+ defaultCatalogQueryException.setMessage("TestMessage");
+ defaultCatalogQueryException.setRolledBack(true);
+ defaultCatalogQueryException.setMessageId("messageID");
+ assertParams(defaultCatalogQueryException);
+ }
+
+ private void assertParams(CatalogQueryException paramsCatalogQueryException) {
+ assertNotNull(paramsCatalogQueryException.getMessage());
+ assertEquals("TestMessage",paramsCatalogQueryException.getMessage());
+ assertNotNull(paramsCatalogQueryException.getCategory());
+ assertEquals(CatalogQueryExceptionCategory.INTERNAL,paramsCatalogQueryException.getCategory());
+ assertNotNull(paramsCatalogQueryException.getRolledBack());
+ assertEquals(true,paramsCatalogQueryException.getRolledBack());
+ assertNotNull(paramsCatalogQueryException.getMessageId());
+ assertEquals("messageID",paramsCatalogQueryException.getMessageId());
+ }
+}
<version>3.1.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+
<!-- added for unit testing -->
private static final String TESTING_KEYWORD = "___TESTING___";
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_createNetwork_async_Test()
{
NetworkAdapterRest api = new NetworkAdapterRest();
assertEquals(resp.getStatus(),HttpStatus.SC_ACCEPTED);
// test if another thread has executed run method
- Mockito.verify(taskMock, Mockito.times(1)).run();
+ //Mockito.verify(taskMock, Mockito.times(1)).run();
} catch (Exception e) {
e.printStackTrace();
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_createNetwork_sync_Test()
{
NetworkAdapterRest api = new NetworkAdapterRest();
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_deleteNetwork_async_Test()
{
NetworkAdapterRest api = new NetworkAdapterRest();
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_deleteNetwork_sync_Test()
{
NetworkAdapterRest api = new NetworkAdapterRest();
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_queryNetwork_Test()
{
/*
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_rollBackNetwork_async_Test()
{
rollbackReqMock = PowerMockito.mock(RollbackNetworkRequest.class);
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_rollBackNetwork_sync_Test()
{
rollbackReqMock = PowerMockito.mock(RollbackNetworkRequest.class);
}
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_updateNetwork_sync_TestString_Test()
{
UpdateNetworkRequest req = new UpdateNetworkRequest();
@SuppressWarnings("unchecked")
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_updateNetwork_sync_ContrailRequest_Test()
{
try {
@SuppressWarnings("unchecked")
@Test
- @Ignore // 1802 merge
public void NetworkAdapterRest_updateNetwork_async_Test()
{
UpdateNetworkRequest updateReqMock = PowerMockito.mock(UpdateNetworkRequest.class);
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.adapters.requestsdb;
+
+import org.junit.Test;
+
+public class HealthCheckHandlerTestException {
+
+ @Test(expected = NullPointerException.class)
+ public void testHealthCheckSiteNameNull() {
+
+ HealthCheckHandler hcH = new HealthCheckHandler();
+ hcH.healthcheck("request");
+ }
+}
+
+
package org.openecomp.mso.adapters.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
fail ();
}
String marshalled = writer.toString ();
- assert(marshalled.contains ("<RequestId>reqid</RequestId>"));
+ assertThat(marshalled, containsString("<RequestId>reqid</RequestId>"));
InputStream inputStream = new ByteArrayInputStream(marshalled.getBytes(Charset.forName("UTF-8")));
try {
RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal (inputStream);
- assert(res2.getCallbackUrl ().equals ("callback"));
- assert(res2.getMsoAction ().equals ("action"));
- assert(res2.getSvcOperation ().equals ("op"));
+ assertEquals("callback", res2.getCallbackUrl ());
+ assertEquals("action", res2.getMsoAction ());
+ assertEquals("op", res2.getSvcOperation ());
} catch (JAXBException e) {
e.printStackTrace();
fail();
public final void testCreateSDNCAdapterResponse () {
ObjectFactory of = new ObjectFactory ();
SDNCAdapterResponse ar = of.createSDNCAdapterResponse ();
- assert (ar != null);
+ assertNotNull(ar);
}
+
+ @Test
+ public final void testCreateSDNCAdapterRequest () {
+ ObjectFactory of = new ObjectFactory ();
+ SDNCAdapterRequest ar = of.createSDNCAdapterRequest ();
+ assertNotNull(ar);
+ }
+
}
package org.openecomp.mso.adapters.sdnc;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.BeforeClass;
import org.junit.Test;
import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest;
public final void testtoString(){
((SDNCAdapterRequest) sd).setRequestData("data");
((SDNCAdapterRequest) sd).setRequestHeader(rh);
- assert (((SDNCAdapterRequest) sd).getRequestData()!= null) ;
- assert(((SDNCAdapterRequest) sd).getRequestData().equals("data"));
- assert(((SDNCAdapterRequest) sd).getRequestHeader().equals(rh));
+ assertNotNull(((SDNCAdapterRequest) sd).getRequestData()) ;
+ assertEquals("data", ((SDNCAdapterRequest) sd).getRequestData());
+ assertEquals(rh, ((SDNCAdapterRequest) sd).getRequestHeader());
}
}
package org.openecomp.mso.adapters.sdnc.client;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
-import org.openecomp.mso.adapters.sdnc.client.CallbackHeader;
public class CallbackHeaderTest {
cb.setRequestId("413658f4-7f42-482e-b834-23a5c15657da-1474471336781");
cb.setResponseCode("200");
cb.setResponseMessage("OK");
- assert (cb.getRequestId() != null);
- assert (cb.getResponseCode() != null);
- assert (cb.getResponseMessage() != null);
- assert (cb.getRequestId().equals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781"));
- assert (cb.getResponseCode().equals("200"));
- assert (cb.getResponseMessage().equals("OK"));
+ assertNotNull(cb.getRequestId());
+ assertNotNull(cb.getResponseCode());
+ assertNotNull(cb.getResponseMessage());
+ assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", cb.getRequestId());
+ assertEquals("200", cb.getResponseCode());
+ assertEquals("OK", cb.getResponseMessage());
}
@Test
public void testtoString() {
- assert (cb.toString() != null);
+ assertNotNull(cb.toString());
}
}
package org.openecomp.mso.adapters.sdnc.client;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
import org.openecomp.mso.adapters.sdnc.client.CallbackHeader;
import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest;
{
sdc.setCallbackHeader(ch);
sdc.setRequestData("data");
- assert(sdc.getCallbackHeader()!=null);
- assert(sdc.getRequestData()!=null);
- assert(sdc.getCallbackHeader().equals(ch));
- assert(sdc.getRequestData().equals("data"));
+ assertNotNull(sdc.getCallbackHeader());
+ assertNotNull(sdc.getRequestData());
+ assertEquals(ch, sdc.getCallbackHeader());
+ assertEquals("data", sdc.getRequestData());
}
@Test
public void testtoString()
{
- assert(ch.toString()!=null);
+ assertNotNull(ch.toString());
+ assertNotNull(sdc.toString());
}
}
package org.openecomp.mso.adapters.sdnc.impl;
+import static org.junit.Assert.*;
+
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
@Test
public final void testRequestTunables () {
RequestTunables rt = new RequestTunables (null, null, "op", null,msoPropertiesFactory);
- assert(rt.getReqId ().length ()==0);
+ assertEquals(0, rt.getReqId ().length ());
rt = new RequestTunables ("reqId", "msoAction", null, "query",msoPropertiesFactory);
rt.setTunables ();
System.out.println(rt.toString ());
// assert (rt.getReqMethod ().equals ("toto"));
- assert (rt.getTimeout () != null);
- assert (rt.getAction ().equals ("query"));
- assert (rt.getMsoAction ().equals ("msoAction"));
- assert (rt.getHeaderName ().equals ("sdnc-request-header"));
- assert (rt.getOperation ().length () == 0);
- assert (rt.getAsyncInd ().equals ("N"));
- assert (rt.getReqId ().equals ("reqId"));
+ assertNotNull(rt.getTimeout ());
+ assertEquals("query", rt.getAction ());
+ assertEquals("msoAction", rt.getMsoAction ());
+ assertEquals("sdnc-request-header", rt.getHeaderName ());
+ assertEquals(0, rt.getOperation ().length ());
+ assertEquals("N", rt.getAsyncInd ());
+ assertEquals("reqId", rt.getReqId ());
+ }
+
+ @Test
+ public final void testRequestTunablesSet() {
+ RequestTunables rt = new RequestTunables("reqId", "gammainternet", "service-configuration-operation", "changeactivate", msoPropertiesFactory);
+ rt.setTunables ();
+ assertNotNull(rt.getTimeout ());
+ assertEquals("changeactivate", rt.getAction ());
+ assertEquals("gammainternet", rt.getMsoAction ());
+ assertEquals("sdnc-request-header", rt.getHeaderName ());
+ assertEquals("service-configuration-operation", rt.getOperation ());
+ assertEquals("N", rt.getAsyncInd ());
+ assertEquals("reqId", rt.getReqId ());
}
}
@Test
public void testtoString()
{
- assert(sdncresponse.toString()!=null);
+ assertNotNull(sdncresponse.toString());
}
}
\ No newline at end of file
package org.openecomp.mso.adapters.sdnc.util;
+import static org.junit.Assert.assertEquals;
+
import java.util.UUID;
import org.junit.Test;
String postfixedRequestId = originalRequestId + "-1466203712068";
String postfixedRequestId2 = originalRequestId + "-1466203712068-2";
- assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId).equals(originalRequestId));
- assert(SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2).equals(postfixedRequestId2));
+ assertEquals(originalRequestId, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId));
+ assertEquals(postfixedRequestId2, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2));
}
import org.openecomp.mso.adapters.vfc.model.NsProgressStatus;
import org.openecomp.mso.adapters.vfc.model.ResponseDescriptor;
import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
+import org.openecomp.mso.adapters.vfc.model.*;
import org.openecomp.mso.adapters.vfc.util.JsonUtil;
import org.openecomp.mso.adapters.vfc.util.RestfulUtil;
import org.openecomp.mso.adapters.vfc.util.ValidateUtil;
nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL);
nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL);
nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
+ nfvoUrlMap.put(Step.SCALE, CommonConstant.NFVO_SCALE_URL);
}
public VfcManager() {
return rsp;
}
+ /**
+ * Scale NS instance
+ * <br>
+ *
+ * @param nsInstanceId The NS instance id
+ * @param segInput input parameters for current node from http request
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public RestfulResponse scaleNs(String nsInstanceId, NSResourceInputParameter segInput)
+ throws ApplicationException {
+ // Call the NFVO to scale service
+ LOGGER.info("scale ns -> begin");
+
+ // Step1: Prepare restful parameters and options
+ VFCScaleData oRequest = new VFCScaleData();
+ oRequest.setNsInstanceId(nsInstanceId);
+ NsScaleParameters nsScaleParameters = segInput.getNsScaleParameters();
+ oRequest.setScaleType(nsScaleParameters.getScaleType());
+ oRequest.setScaleNsData(nsScaleParameters.getScaleNsByStepsData());
+ String scaleReq = JsonUtil.marshal(oRequest);
+
+ // Step2: prepare url and method type
+ String url = getUrl(nsInstanceId, CommonConstant.Step.SCALE);
+ String methodType = CommonConstant.MethodType.POST;
+ LOGGER.info("scale ns request is {}", scaleReq);
+ // Step3: Call NFVO lcm to scale ns
+ RestfulResponse scaleRsp = RestfulUtil.send(url, methodType, scaleReq);
+ ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
+ segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
+ segInput.getNsOperationKey().getNodeTemplateUUID());
+ ValidateUtil.assertObjectNotNull(scaleRsp);
+ if(!HttpCode.isSucess(scaleRsp.getStatus())) {
+ LOGGER.error("update segment operation status : fail to scale ns");
+ nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+ nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
+ nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_SCALE_NS);
+ }
+ LOGGER.info("scale ns response status is {}", scaleRsp.getStatus());
+ LOGGER.info("scale ns response content is {}", scaleRsp.getResponseContent());
+
+ ValidateUtil.assertObjectNotNull(scaleRsp.getResponseContent());
+ @SuppressWarnings("unchecked")
+ Map<String, String> rsp = JsonUtil.unMarshal(scaleRsp.getResponseContent(), Map.class);
+ String jobId = rsp.get(CommonConstant.JOB_ID);
+ if(ValidateUtil.isStrEmpty(jobId)) {
+ LOGGER.error("Invalid jobId from scale operation");
+ nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+ nsOperInfo.setErrorCode(String.valueOf(scaleRsp.getStatus()));
+ nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.SCALE_NS_FAILED);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+ throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+ DriverExceptionID.INVALID_RESPONSE_FROM_SCALE_OPERATION);
+ }
+
+ LOGGER.info("update resource operation status job id -> begin");
+ // Step 4: update segment operation job id
+ nsOperInfo.setJobId(jobId);
+ (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+ LOGGER.info("update segment operation job id -> end");
+ LOGGER.info("scale ns -> end");
+
+ return scaleRsp;
+ }
+
/**
* get url for the operation <br>
*
public static final String NFVO_QUERY_URL = "/api/nslcm/v1/jobs/%s";
+ public static final String NFVO_SCALE_URL = "/api/nslcm/v1/ns/%s/scale";
+
/**
*
* <br>
public static final String DELETE = "delete";
+ public static final String SCALE = "scale";
+
private Step() {
}
public static final String CREATE_NS_FAILED = "create ns failed";
+ public static final String SCALE_NS_FAILED = "scale ns failed";
+
private StatusDesc() {
}
public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status";
+ public static final String FAIL_TO_SCALE_NS = "Fail to scale network service";
+
+ public static final String INVALID_RESPONSE_FROM_SCALE_OPERATION = "Invalid response from scale operation";
+
+
private DriverExceptionID() {
}
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2018 CMCC 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.
private NsParameters nsParameters;
+ private NsScaleParameters nsScaleParameters;
-
/**
* @return Returns the nsServiceName.
*/
return "";
}
}
+
+ public NsScaleParameters getNsScaleParameters() {
+ return nsScaleParameters;
+ }
+
+ public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
+ this.nsScaleParameters = nsScaleParameters;
+ }
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 CMCC Technologies Co., Ltd. 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.openecomp.mso.adapters.vfc.model;
+
+import java.util.List;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class NsScaleParameters {
+
+ private List<ScaleNsByStepsData> scaleNsByStepsData;
+
+ private String scaleType;
+
+ /**
+ * @return Returns the scaleNsByStepsData.
+ */
+ public List<ScaleNsByStepsData> getScaleNsByStepsData() {
+ return scaleNsByStepsData;
+ }
+
+ /**
+ * @param scaleNsByStepsData The scaleNsByStepsData to set.
+ */
+ public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) {
+ this.scaleNsByStepsData = scaleNsByStepsData;
+ }
+
+ /**
+ * @return Returns the scale Type.
+ */
+ public String getScaleType() {
+ return scaleType;
+ }
+
+ /**
+ * @param scaleType The scaleType to set.
+ */
+ public void setScaleType(String scaleType) {
+ this.scaleType = scaleType;
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 CMCC Technologies Co., Ltd. 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.openecomp.mso.adapters.vfc.model;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ * request model for scale
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class NsScaleReq extends NsScaleParameters {
+
+ String nsInstanceId;
+
+ /**
+ * @return Returns the nsInstanceId.
+ */
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ /**
+ * @param nsInstanceId The nsInstanceId to set.
+ */
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 CMCC Technologies Co., Ltd. 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.openecomp.mso.adapters.vfc.model;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class ScaleNsByStepsData {
+
+ /**
+ * scaling Direction
+ */
+ private String scalingDirection;
+
+ /**
+ * aspect ID
+ */
+ private String aspectId;
+
+ /**
+ * number of Steps
+ */
+ private Integer numberOfSteps;
+
+ /**
+ * @return Returns the scalingDirection.
+ */
+ public String getScalingDirection() {
+ return scalingDirection;
+ }
+
+ /**
+ * @param scalingDirection The scalingDirection to set.
+ */
+ public void setScalingDirection(String scalingDirection) {
+ this.scalingDirection = scalingDirection;
+ }
+
+ /**
+ * @return Returns the aspectId.
+ */
+ public String getAspectId() {
+ return aspectId;
+ }
+
+ /**
+ * @param aspectId The aspectId to set.
+ */
+ public void setAspectId(String aspectId) {
+ this.aspectId = aspectId;
+ }
+
+ /**
+ * @return Returns the numberOfSteps.
+ */
+ public Integer getNumberOfSteps() {
+ return numberOfSteps;
+ }
+
+ /**
+ * @param numberOfSteps The numberOfSteps to set.
+ */
+ public void setNumberOfSteps(int numberOfSteps) {
+ this.numberOfSteps = numberOfSteps;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Technologies Co., Ltd. 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.openecomp.mso.adapters.vfc.model;
+
+import java.util.List;
+
+/**
+ * aim to wrap List<ScaleNsByStepsData> as a new list
+ * then be provided for the usage of vfc json
+ *
+ * added on 2018/01/30 by Qihui Zhao from CMCC
+ * */
+
+public class ScaleNsData {
+
+ private List<ScaleNsByStepsData> scaleNsByStepsData;
+
+ /**
+ * @return Returns the scaleNsByStepsData.
+ */
+ public List<ScaleNsByStepsData> getScaleNsByStepsData() {
+ return scaleNsByStepsData;
+ }
+
+ /**
+ * @param scaleNsByStepsData The scaleNsByStepsData to set.
+ */
+ public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) {
+ this.scaleNsByStepsData = scaleNsByStepsData;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Technologies Co., Ltd. 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.openecomp.mso.adapters.vfc.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Object totally matches required VFC input json format
+ * JsonUtil.marshal will convert this Object to string
+ *
+ * added on 2018/01/30 by Qihui Zhao from CMCC*/
+
+public class VFCScaleData {
+
+ private String nsInstanceId;
+
+ private String scaleType;
+
+ private List<ScaleNsData> scaleNsData = new ArrayList<>();
+
+ /**
+ * @return Returns the nsInstanceId.
+ */
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ /**
+ * @param nsInstanceId The nsInstanceId to set.
+ */
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+ /**
+ * @return Returns the scale Type.
+ */
+ public String getScaleType() {
+ return scaleType;
+ }
+
+ /**
+ * @param scaleType The scaleType to set.
+ */
+ public void setScaleType(String scaleType) {
+ this.scaleType = scaleType;
+ }
+
+ /**
+ *@return Returns the scaleNsDate.
+ */
+ public List<ScaleNsData> getScaleNsData(){return scaleNsData;}
+
+ /**
+ * The scaleNsData to set.
+ */
+ public void setScaleNsData(List<ScaleNsByStepsData> scaleNsByStepsData){
+ ScaleNsData scaleNsDataObj = new ScaleNsData();
+ scaleNsDataObj.setScaleNsByStepsData(scaleNsByStepsData);
+
+ this.scaleNsData.add(scaleNsDataObj);
+ }
+}
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.adapters.vdu.mapper;\r
+\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+import org.openecomp.mso.adapters.vdu.VduArtifact;\r
+import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType;\r
+import org.openecomp.mso.adapters.vdu.VduModelInfo;\r
+import org.openecomp.mso.db.catalog.CatalogDatabase;\r
+import org.openecomp.mso.db.catalog.beans.HeatEnvironment;\r
+import org.openecomp.mso.db.catalog.beans.HeatFiles;\r
+import org.openecomp.mso.db.catalog.beans.HeatTemplate;\r
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;\r
+import org.openecomp.mso.logger.MsoLogger;\r
+import org.springframework.stereotype.Component;\r
+\r
+@Component\r
+public class VfModuleCustomizationToVduMapper {\r
+\r
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);\r
+\r
+ public VduModelInfo mapVfModuleCustomizationToVdu(VfModuleCustomization vfModuleCustom) throws Exception {\r
+ CatalogDatabase db = CatalogDatabase.getInstance();\r
+ VduModelInfo vduModel = new VduModelInfo();\r
+ vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUuid());\r
+ try {\r
+ // Map the cloud templates, attached files, and environment file\r
+ mapCloudTemplates(\r
+ db.getHeatTemplateByArtifactUuid(vfModuleCustom.getVfModule().getHeatTemplateArtifactUUId()),\r
+ vduModel);\r
+ mapCloudFiles(vfModuleCustom, vduModel);\r
+ mapEnvironment(db.getHeatEnvironmentByArtifactUuid(vfModuleCustom.getHeatEnvironmentArtifactUuid()),\r
+ vduModel);\r
+ } catch (Exception e) {\r
+ LOGGER.debug("unhandled exception in mapVfModuleCustomizationToVdu", e);\r
+ throw new Exception("Exception during mapVfModuleCustomizationToVdu " + e.getMessage());\r
+ } finally {\r
+ // Make sure DB session is closed\r
+ db.close();\r
+ }\r
+\r
+ return vduModel;\r
+ }\r
+\r
+ public VduModelInfo mapVfModuleCustVolumeToVdu(VfModuleCustomization vfModuleCustom) throws Exception {\r
+ CatalogDatabase db = CatalogDatabase.getInstance();\r
+ VduModelInfo vduModel = new VduModelInfo();\r
+ vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUuid());\r
+ try {\r
+ // Map the cloud templates, attached files, and environment file\r
+ mapCloudTemplates(\r
+ db.getHeatTemplateByArtifactUuid(vfModuleCustom.getVfModule().getVolHeatTemplateArtifactUUId()),\r
+ vduModel);\r
+ mapCloudFiles(vfModuleCustom, vduModel);\r
+ mapEnvironment(db.getHeatEnvironmentByArtifactUuid(vfModuleCustom.getVolEnvironmentArtifactUuid()),\r
+ vduModel);\r
+ } catch (Exception e) {\r
+ LOGGER.debug("unhandled exception in mapVfModuleCustVolumeToVdu", e);\r
+ throw new Exception("Exception during mapVfModuleCustVolumeToVdu " + e.getMessage());\r
+ } finally {\r
+ // Make sure DB session is closed\r
+ db.close();\r
+ }\r
+\r
+ return vduModel;\r
+ }\r
+\r
+ private void mapCloudTemplates(HeatTemplate heatTemplate, VduModelInfo vduModel) throws Exception {\r
+ // TODO: These catalog objects will be refactored to be\r
+ // non-Heat-specific\r
+ CatalogDatabase db = CatalogDatabase.getInstance();\r
+ try {\r
+ List<VduArtifact> vduArtifacts = vduModel.getArtifacts();\r
+\r
+ // Main template. Also set the VDU timeout based on the main\r
+ // template.\r
+ vduArtifacts.add(mapHeatTemplateToVduArtifact(heatTemplate, ArtifactType.MAIN_TEMPLATE));\r
+ vduModel.setTimeoutMinutes(heatTemplate.getTimeoutMinutes());\r
+ \r
+ // Nested templates\r
+ Map<String,Object> nestedTemplates = db.getNestedTemplates(heatTemplate.getArtifactUuid());\r
+ if (nestedTemplates != null) {\r
+ for (String name : nestedTemplates.keySet()) {\r
+ String body = (String) nestedTemplates.get(name);\r
+ VduArtifact vduArtifact = new VduArtifact(name, body.getBytes(), ArtifactType.NESTED_TEMPLATE);\r
+ vduArtifacts.add(vduArtifact);\r
+ }\r
+ }\r
+ \r
+ } catch (Exception e) {\r
+ LOGGER.debug("unhandled exception in mapCloudTemplates", e);\r
+ throw new Exception("Exception during mapCloudTemplates " + e.getMessage());\r
+ } finally {\r
+ // Make sure DB session is closed\r
+ db.close();\r
+ }\r
+ }\r
+\r
+ private VduArtifact mapHeatTemplateToVduArtifact(HeatTemplate heatTemplate, ArtifactType artifactType) {\r
+ VduArtifact vduArtifact = new VduArtifact();\r
+ vduArtifact.setName(heatTemplate.getTemplateName());\r
+ vduArtifact.setContent(heatTemplate.getHeatTemplate().getBytes());\r
+ vduArtifact.setType(artifactType);\r
+ return vduArtifact;\r
+ }\r
+\r
+ private void mapCloudFiles(VfModuleCustomization vfModuleCustom, VduModelInfo vduModel) throws Exception {\r
+ // TODO: These catalog objects will be refactored to be\r
+ // non-Heat-specific\r
+ CatalogDatabase db = CatalogDatabase.getInstance();\r
+\r
+ try{\r
+ Map <String, HeatFiles> heatFiles = db.getHeatFilesForVfModule(vfModuleCustom.getVfModuleModelUuid());\r
+ if (heatFiles != null) {\r
+ for (HeatFiles heatFile: heatFiles.values()) {\r
+ mapCloudFileToVduArtifact(heatFile, ArtifactType.TEXT_FILE);\r
+ }\r
+ }\r
+ } catch (Exception e) {\r
+ LOGGER.debug("unhandled exception in mapCloudFiles", e);\r
+ throw new Exception("Exception during mapCloudFiles " + e.getMessage());\r
+ } finally {\r
+ // Make sure DB session is closed\r
+ db.close();\r
+ }\r
+ \r
+ }\r
+\r
+ private VduArtifact mapCloudFileToVduArtifact(HeatFiles heatFile, ArtifactType artifactType) {\r
+ VduArtifact vduArtifact = new VduArtifact();\r
+ vduArtifact.setName(heatFile.getFileName());\r
+ vduArtifact.setContent(heatFile.getFileBody().getBytes());\r
+ vduArtifact.setType(artifactType);\r
+ return vduArtifact;\r
+ }\r
+\r
+ private void mapEnvironment(HeatEnvironment heatEnvironment, VduModelInfo vduModel) {\r
+ // TODO: These catalog objects will be refactored to be\r
+ // non-Heat-specific\r
+ if (heatEnvironment != null) {\r
+ List<VduArtifact> vduArtifacts = vduModel.getArtifacts();\r
+ vduArtifacts.add(mapEnvironmentFileToVduArtifact(heatEnvironment));\r
+ }\r
+ }\r
+\r
+ private VduArtifact mapEnvironmentFileToVduArtifact(HeatEnvironment heatEnv) {\r
+ VduArtifact vduArtifact = new VduArtifact();\r
+ vduArtifact.setName(heatEnv.getName());\r
+ vduArtifact.setContent(heatEnv.getEnvironment().getBytes());\r
+ vduArtifact.setType(ArtifactType.ENVIRONMENT);\r
+ return vduArtifact;\r
+ }\r
+\r
+}
\ No newline at end of file
@WebService(serviceName = "VnfAdapter", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapter", targetNamespace = "http://org.openecomp.mso/vnf")
public class MsoVnfAdapterImpl implements MsoVnfAdapter {
- CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
- protected CloudConfig cloudConfig = null;
+ CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+ protected CloudConfig cloudConfig = null;
- MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- private static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
+ private static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
private static final String CHECK_REQD_PARAMS = "org.openecomp.mso.adapters.vnf.checkRequiredParameters";
private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.openecomp.mso.adapters.vnf.addGetFilesOnVolumeReq";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
/**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
+ *
* @see MsoVnfAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
*/
public MsoVnfAdapterImpl() {
/**
* This constructor MUST be used if this class is called with the new operator.
+ *
* @param msoPropFactory
*/
public MsoVnfAdapterImpl(MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfigFact) {
- this.msoPropertiesFactory = msoPropFactory;
- this.cloudConfigFactory = cloudConfigFact;
+ this.msoPropertiesFactory = msoPropFactory;
+ this.cloudConfigFactory = cloudConfigFact;
}
/**
* Health Check web method. Does nothing but return to show the adapter is deployed.
*/
@Override
- public void healthCheck () {
- LOGGER.debug ("Health check call in VNF Adapter");
+ public void healthCheck() {
+ LOGGER.debug("Health check call in VNF Adapter");
}
/**
* This is the "Create VNF" web service implementation.
* It will create a new VNF of the requested type in the specified cloud
* and tenant. The tenant must exist before this service is called.
- *
+ * <p>
* If a VNF with the same name already exists, this can be considered a
* success or failure, depending on the value of the 'failIfExists' parameter.
- *
+ * <p>
* All VNF types will be defined in the MSO catalog. The caller must request
* one of these pre-defined types or an error will be returned. Within the
* catalog, each VNF type references (among other things) a Heat template
* which is used to deploy the required VNF artifacts (VMs, networks, etc.)
* to the cloud.
- *
+ * <p>
* Depending on the Heat template, a variable set of input parameters will
* be defined, some of which are required. The caller is responsible to
* pass the necessary input data for the VNF or an error will be thrown.
- *
+ * <p>
* The method returns the vnfId (the canonical name), a Map of VNF output
* attributes, and a VnfRollback object. This last object can be passed
* as-is to the rollbackVnf operation to undo everything that was created
* for the VNF. This is useful if a VNF is successfully created but the
* orchestrator fails on a subsequent operation.
*
- * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
- * @param tenantId Openstack tenant identifier
- * @param vnfType VNF type key, should match a VNF definition in catalog DB
- * @param vnfVersion VNF version key, should match a VNF definition in catalog DB
- * @param vnfName Name to be assigned to the new VNF
- * @param inputs Map of key=value inputs for VNF stack creation
+ * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param tenantId Openstack tenant identifier
+ * @param vnfType VNF type key, should match a VNF definition in catalog DB
+ * @param vnfVersion VNF version key, should match a VNF definition in catalog DB
+ * @param vnfName Name to be assigned to the new VNF
+ * @param inputs Map of key=value inputs for VNF stack creation
* @param failIfExists Flag whether already existing VNF should be considered
- * a success or failure
- * @param msoRequest Request tracking information for logs
- * @param vnfId Holder for output VNF Openstack ID
- * @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
- * @param rollback Holder for returning VnfRollback object
+ * a success or failure
+ * @param msoRequest Request tracking information for logs
+ * @param vnfId Holder for output VNF Openstack ID
+ * @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
+ * @param rollback Holder for returning VnfRollback object
*/
@Override
- public void createVnf (String cloudSiteId,
- String tenantId,
- String vnfType,
- String vnfVersion,
- String vnfName,
- String requestType,
- String volumeGroupHeatStackId,
- Map <String, String> inputs,
- Boolean failIfExists,
- Boolean backout,
- MsoRequest msoRequest,
- Holder <String> vnfId,
- Holder <Map <String, String>> outputs,
- Holder <VnfRollback> rollback) throws VnfException {
- // Create a hook here to catch shortcut createVf requests:
- if (requestType != null) {
- if (requestType.startsWith("VFMOD")) {
- LOGGER.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
- String newRequestType = requestType.substring(5);
- String vfVolGroupHeatStackId = "";
- String vfBaseHeatStackId = "";
- try {
- if (volumeGroupHeatStackId != null) {
- vfVolGroupHeatStackId = volumeGroupHeatStackId.substring(0, volumeGroupHeatStackId.lastIndexOf("|"));
- vfBaseHeatStackId = volumeGroupHeatStackId.substring(volumeGroupHeatStackId.lastIndexOf("|")+1);
- }
- } catch (Exception e) {
- // might be ok - both are just blank
- LOGGER.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e);
- }
- this.createVfModule(cloudSiteId,
- tenantId,
- vnfType,
- vnfVersion,
- vnfName,
- newRequestType,
- vfVolGroupHeatStackId,
- vfBaseHeatStackId,
+ public void createVnf(String cloudSiteId,
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ Map<String, String> inputs,
+ Boolean failIfExists,
+ Boolean backout,
+ MsoRequest msoRequest,
+ Holder<String> vnfId,
+ Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> rollback) throws VnfException {
+ // Create a hook here to catch shortcut createVf requests:
+ if (requestType != null) {
+ if (requestType.startsWith("VFMOD")) {
+ LOGGER.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
+ String newRequestType = requestType.substring(5);
+ String vfVolGroupHeatStackId = "";
+ String vfBaseHeatStackId = "";
+ try {
+ if (volumeGroupHeatStackId != null) {
+ vfVolGroupHeatStackId = volumeGroupHeatStackId.substring(0, volumeGroupHeatStackId.lastIndexOf("|"));
+ vfBaseHeatStackId = volumeGroupHeatStackId.substring(volumeGroupHeatStackId.lastIndexOf("|") + 1);
+ }
+ } catch (Exception e) {
+ // might be ok - both are just blank
+ LOGGER.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId, e);
+ }
+ this.createVfModule(cloudSiteId,
+ tenantId,
+ vnfType,
+ vnfVersion,
+ vnfName,
+ newRequestType,
+ vfVolGroupHeatStackId,
+ vfBaseHeatStackId,
null,
- inputs,
- failIfExists,
- backout,
- msoRequest,
- vnfId,
- outputs,
- rollback);
- return;
- }
- }
- // createVf will know if the requestType starts with "X" that it's the "old" way
- StringBuilder newRequestTypeSb = new StringBuilder("X");
- String vfVolGroupHeatStackId = "";
- String vfBaseHeatStackId = "";
- if (requestType != null) {
- newRequestTypeSb.append(requestType);
- }
- this.createVfModule(cloudSiteId,
- tenantId,
- vnfType,
- vnfVersion,
- vnfName,
- newRequestTypeSb.toString(),
- vfVolGroupHeatStackId,
- vfBaseHeatStackId,
- null,
- inputs,
- failIfExists,
- backout,
- msoRequest,
- vnfId,
- outputs,
- rollback);
- // End createVf shortcut
+ inputs,
+ failIfExists,
+ backout,
+ msoRequest,
+ vnfId,
+ outputs,
+ rollback);
+ return;
+ }
+ }
+ // createVf will know if the requestType starts with "X" that it's the "old" way
+ StringBuilder newRequestTypeSb = new StringBuilder("X");
+ String vfVolGroupHeatStackId = "";
+ String vfBaseHeatStackId = "";
+ if (requestType != null) {
+ newRequestTypeSb.append(requestType);
}
+ this.createVfModule(cloudSiteId,
+ tenantId,
+ vnfType,
+ vnfVersion,
+ vnfName,
+ newRequestTypeSb.toString(),
+ vfVolGroupHeatStackId,
+ vfBaseHeatStackId,
+ null,
+ inputs,
+ failIfExists,
+ backout,
+ msoRequest,
+ vnfId,
+ outputs,
+ rollback);
+ // End createVf shortcut
+ }
@Override
- public void updateVnf (String cloudSiteId,
- String tenantId,
- String vnfType,
- String vnfVersion,
- String vnfName,
- String requestType,
- String volumeGroupHeatStackId,
- Map <String, String> inputs,
- MsoRequest msoRequest,
- Holder <Map <String, String>> outputs,
- Holder <VnfRollback> rollback) throws VnfException {
- // As of 1707 - this method should no longer be called
- MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
- MsoLogger.setServiceName ("UpdateVnf");
- LOGGER.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
+ public void updateVnf(String cloudSiteId,
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ Map<String, String> inputs,
+ MsoRequest msoRequest,
+ Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> rollback) throws VnfException {
+ // As of 1707 - this method should no longer be called
+ MsoLogger.setLogContext(msoRequest.getRequestId(), msoRequest.getServiceInstanceId());
+ MsoLogger.setServiceName("UpdateVnf");
+ LOGGER.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
}
/**
* This is the "Query VNF" web service implementation.
* It will look up a VNF by name or ID in the specified cloud and tenant.
- *
+ * <p>
* The method returns an indicator that the VNF exists, its Openstack internal
* ID, its status, and the set of outputs (from when the stack was created).
*
* @param cloudSiteId CLLI code of the cloud site in which to query
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
- * @param vnfExists Flag reporting the result of the query
- * @param vnfId Holder for output VNF Openstack ID
- * @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
+ * @param tenantId Openstack tenant identifier
+ * @param vnfName VNF Name or Openstack ID
+ * @param msoRequest Request tracking information for logs
+ * @param vnfExists Flag reporting the result of the query
+ * @param vnfId Holder for output VNF Openstack ID
+ * @param outputs Holder for Map of VNF outputs from heat (assigned IPs, etc)
*/
@Override
- public void queryVnf (String cloudSiteId,
- String tenantId,
- String vnfName,
- MsoRequest msoRequest,
- Holder <Boolean> vnfExists,
- Holder <String> vnfId,
- Holder <VnfStatus> status,
- Holder <Map <String, String>> outputs) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("QueryVnf");
- LOGGER.debug ("Querying VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+ public void queryVnf(String cloudSiteId,
+ String tenantId,
+ String vnfName,
+ MsoRequest msoRequest,
+ Holder<Boolean> vnfExists,
+ Holder<String> vnfId,
+ Holder<VnfStatus> status,
+ Holder<Map<String, String>> outputs) throws VnfException {
+ MsoLogger.setLogContext(msoRequest);
+ MsoLogger.setServiceName("QueryVnf");
+ LOGGER.debug("Querying VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
StackInfo heatStack = null;
- long subStartTime = System.currentTimeMillis ();
+ long subStartTime = System.currentTimeMillis();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, vnfName);
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vnfName);
+ heatStack = heat.queryStack(cloudSiteId, tenantId, vnfName);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vnfName);
} catch (MsoException me) {
- me.addContext ("QueryVNF");
+ me.addContext("QueryVNF");
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error = "Query VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vnfName);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vnfName);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
// Populate the outputs based on the returned Stack information
//
- if (heatStack == null || heatStack.getStatus () == HeatStatus.NOTFOUND) {
+ if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
// Not Found
vnfExists.value = Boolean.FALSE;
status.value = VnfStatus.NOTFOUND;
vnfId.value = null;
outputs.value = new HashMap<>(); // Return as an empty map
- LOGGER.debug ("VNF " + vnfName + " not found");
+ LOGGER.debug("VNF " + vnfName + " not found");
} else {
vnfExists.value = Boolean.TRUE;
- status.value = stackStatusToVnfStatus (heatStack.getStatus ());
- vnfId.value = heatStack.getCanonicalName ();
- outputs.value = copyStringOutputs (heatStack.getOutputs ());
+ status.value = stackStatusToVnfStatus(heatStack.getStatus());
+ vnfId.value = heatStack.getCanonicalName();
+ outputs.value = copyStringOutputs(heatStack.getOutputs());
- LOGGER.debug ("VNF " + vnfName + " found, ID = " + vnfId.value);
+ LOGGER.debug("VNF " + vnfName + " found, ID = " + vnfId.value);
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query VNF");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query VNF");
}
/**
* This is the "Delete VNF" web service implementation.
* It will delete a VNF by name or ID in the specified cloud and tenant.
- *
+ * <p>
* The method has no outputs.
*
* @param cloudSiteId CLLI code of the cloud site in which to delete
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
+ * @param tenantId Openstack tenant identifier
+ * @param vnfName VNF Name or Openstack ID
+ * @param msoRequest Request tracking information for logs
*/
@Override
- public void deleteVnf (String cloudSiteId,
- String tenantId,
- String vnfName,
- MsoRequest msoRequest) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVnf");
- LOGGER.debug ("Deleting VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+ public void deleteVnf(String cloudSiteId,
+ String tenantId,
+ String vnfName,
+ MsoRequest msoRequest) throws VnfException {
+ MsoLogger.setLogContext(msoRequest);
+ MsoLogger.setServiceName("DeleteVnf");
+ LOGGER.debug("Deleting VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis ();
+ long subStartTime = System.currentTimeMillis();
try {
- heat.deleteStack (tenantId, cloudSiteId, vnfName, true);
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", vnfName);
+ heat.deleteStack(tenantId, cloudSiteId, vnfName, true);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", vnfName);
} catch (MsoException me) {
- me.addContext ("DeleteVNF");
+ me.addContext("DeleteVNF");
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error = "Delete VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", vnfName);
- LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "DeleteVNF", MsoLogger.ErrorCode.DataError, "Exception - DeleteVNF", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", vnfName);
+ LOGGER.error(MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "DeleteVNF", MsoLogger.ErrorCode.DataError, "Exception - DeleteVNF", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
// On success, nothing is returned.
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VNF");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VNF");
}
/**
* operation to undo the creation.
*/
@Override
- public void rollbackVnf (VnfRollback rollback) throws VnfException {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("RollbackVnf");
- // rollback may be null (e.g. if stack already existed when Create was called)
+ public void rollbackVnf(VnfRollback rollback) throws VnfException {
+ long startTime = System.currentTimeMillis();
+ MsoLogger.setServiceName("RollbackVnf");
+ // rollback may be null (e.g. if stack already existed when Create was called)
if (rollback == null) {
- LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "OpenStack", "rollbackVnf");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Rollback request content is null");
+ LOGGER.info(MessageEnum.RA_ROLLBACK_NULL, "OpenStack", "rollbackVnf");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Rollback request content is null");
return;
}
// Get the elements of the VnfRollback object for easier access
- String cloudSiteId = rollback.getCloudSiteId ();
- String tenantId = rollback.getTenantId ();
- String vnfId = rollback.getVnfId ();
+ String cloudSiteId = rollback.getCloudSiteId();
+ String tenantId = rollback.getTenantId();
+ String vnfId = rollback.getVnfId();
- MsoLogger.setLogContext (rollback.getMsoRequest());
+ MsoLogger.setLogContext(rollback.getMsoRequest());
- LOGGER.debug ("Rolling Back VNF " + vnfId + " in " + cloudSiteId + "/" + tenantId);
+ LOGGER.debug("Rolling Back VNF " + vnfId + " in " + cloudSiteId + "/" + tenantId);
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
// Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis ();
+ long subStartTime = System.currentTimeMillis();
try {
- heat.deleteStack (tenantId, cloudSiteId, vnfId, true);
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null);
+ heat.deleteStack(tenantId, cloudSiteId, vnfId, true);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", null);
} catch (MsoException me) {
// Failed to rollback the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext ("RollbackVNF");
+ me.addContext("RollbackVNF");
String error = "Rollback VNF: " + vnfId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
- LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfId, cloudSiteId, tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError, "Exception - DeleteStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
+ LOGGER.error(MessageEnum.RA_DELETE_VNF_ERR, vnfId, cloudSiteId, tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError, "Exception - DeleteStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back VNF");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back VNF");
}
- private VnfStatus stackStatusToVnfStatus (HeatStatus stackStatus) {
+ private VnfStatus stackStatusToVnfStatus(HeatStatus stackStatus) {
switch (stackStatus) {
case CREATED:
return VnfStatus.ACTIVE;
}
}
- private Map <String, String> copyStringOutputs (Map <String, Object> stackOutputs) {
- Map <String, String> stringOutputs = new HashMap <> ();
- for (Map.Entry<String,Object> entry : stackOutputs.entrySet ()) {
+ private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
+ Map<String, String> stringOutputs = new HashMap<>();
+ for (Map.Entry<String, Object> entry : stackOutputs.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof String) {
- stringOutputs.put (key, (String) value);
- } else if (value instanceof Integer) {
- try {
- String str = "" + value;
- stringOutputs.put(key, str);
- } catch (Exception e) {
- LOGGER.debug("Unable to add " + key + " to outputs",e);
- }
+ stringOutputs.put(key, (String) value);
+ } else if (value instanceof Integer) {
+ try {
+ String str = "" + value;
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs", e);
+ }
} else if (value instanceof JsonNode) {
- try {
- //String str = this.convertNode((JsonNode) value);
- String str = value.toString();
- stringOutputs.put(key, str);
- } catch (Exception e) {
- LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode",e);
- }
+ try {
+ //String str = this.convertNode((JsonNode) value);
+ String str = value.toString();
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
+ }
} else if (value instanceof java.util.LinkedHashMap) {
- try {
- //String str = JSON_MAPPER.writeValueAsString(value);
- String str = value.toString();
- stringOutputs.put(key, str);
- } catch (Exception e) {
- LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap",e);
- }
+ try {
+ //String str = JSON_MAPPER.writeValueAsString(value);
+ String str = value.toString();
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
+ }
} else {
- try {
- String str = value.toString();
- stringOutputs.put(key, str);
- } catch (Exception e) {
- LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(),e);
- }
+ try {
+ String str = value.toString();
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(), e);
+ }
}
}
return stringOutputs;
}
- private Map <String, Object> copyStringInputs (Map <String, String> stringInputs) {
- return new HashMap <> (stringInputs);
+ private Map<String, Object> copyStringInputs(Map<String, String> stringInputs) {
+ return new HashMap<>(stringInputs);
}
private boolean callHeatbridge(String heatStackId) {
boolean wait = p.waitFor(waitTimeMs, TimeUnit.MILLISECONDS);
LOGGER.debug(" HeatBridgeMain.py returned " + wait + " with code " + p.exitValue());
- return wait && p.exitValue()==0;
+ return wait && p.exitValue() == 0;
} catch (IOException e) {
LOGGER.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
return false;
StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
if (inputs == null) {
sb.append("\tNULL");
- }
- else if (inputs.size() < 1) {
+ } else if (inputs.size() < 1) {
sb.append("\tEMPTY");
} else {
- for (Map.Entry<String,Object> entry : inputs.entrySet()) {
+ for (Map.Entry<String, Object> entry : inputs.entrySet()) {
String outputString;
String str = entry.getKey();
Object value = entry.getValue();
try {
outputString = value.toString();
} catch (Exception e) {
- LOGGER.debug("Exception :",e);
+ LOGGER.debug("Exception :", e);
outputString = "Unable to call toString() on the value for " + str;
}
sb.append("\t\nitem ").append(i++).append(": '").append(str).append("'='").append(outputString)
- .append("'");
+ .append("'");
}
}
LOGGER.debug(sb.toString());
}
-
+
private void sendMapToDebug(Map<String, String> inputs) {
int i = 0;
StringBuilder sb = new StringBuilder("inputs:");
if (inputs == null) {
sb.append("\tNULL");
- }
- else if (inputs.size() < 1) {
+ } else if (inputs.size() < 1) {
sb.append("\tEMPTY");
} else {
for (String str : inputs.keySet()) {
final String json = JSON_MAPPER.writeValueAsString(obj);
return json;
} catch (Exception e) {
- LOGGER.debug("Error converting json to string " + e.getMessage(),e);
+ LOGGER.debug("Error converting json to string " + e.getMessage(), e);
}
return "[Error converting json to string]";
}
Object obj = objectMap.get(key);
if (obj instanceof String) {
stringMap.put(key, (String) objectMap.get(key));
- } else if (obj instanceof JsonNode ){
+ } else if (obj instanceof JsonNode) {
// This is a bit of mess - but I think it's the least impacting
// let's convert it BACK to a string - then it will get converted back later
try {
String str = this.convertNode((JsonNode) obj);
stringMap.put(key, str);
} catch (Exception e) {
- LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key,e);
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode " + key, e);
//okay in this instance - only string values (fqdn) are expected to be needed
}
} else if (obj instanceof java.util.LinkedHashMap) {
String str = JSON_MAPPER.writeValueAsString(obj);
stringMap.put(key, str);
} catch (Exception e) {
- LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key,e);
- }
- } else if (obj instanceof Integer) {
- try {
- String str = "" + obj;
- stringMap.put(key, str);
- } catch (Exception e) {
- LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key,e);
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + key, e);
+ }
+ } else if (obj instanceof Integer) {
+ try {
+ String str = "" + obj;
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer " + key, e);
}
} else {
try {
- String str = obj.toString();
+ String str = obj.toString();
stringMap.put(key, str);
} catch (Exception e) {
- LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")",e);
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value " + key + " (" + e.getMessage() + ")", e);
}
}
}
@Override
public void createVfModule(String cloudSiteId,
- String tenantId,
- String vnfType,
- String vnfVersion,
- String vnfName,
- String requestType,
- String volumeGroupHeatStackId,
- String baseVfHeatStackId,
- String modelCustomizationUuid,
- Map <String, String> inputs,
- Boolean failIfExists,
- Boolean backout,
- MsoRequest msoRequest,
- Holder <String> vnfId,
- Holder <Map <String, String>> outputs,
- Holder <VnfRollback> rollback) throws VnfException {
- String vfModuleName = vnfName;
- String vfModuleType = vnfType;
- String vfVersion = vnfVersion;
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ String baseVfHeatStackId,
+ String modelCustomizationUuid,
+ Map<String, String> inputs,
+ Boolean failIfExists,
+ Boolean backout,
+ MsoRequest msoRequest,
+ Holder<String> vnfId,
+ Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> rollback) throws VnfException {
+ String vfModuleName = vnfName;
+ String vfModuleType = vnfType;
+ String vfVersion = vnfVersion;
String mcu = modelCustomizationUuid;
boolean useMCUuid = false;
if (mcu != null && !mcu.isEmpty()) {
useMCUuid = true;
}
}
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateVfModule");
- String requestTypeString = "";
+ MsoLogger.setLogContext(msoRequest);
+ MsoLogger.setServiceName("CreateVfModule");
+ String requestTypeString = "";
if (requestType != null && !"".equals(requestType)) {
- requestTypeString = requestType;
+ requestTypeString = requestType;
}
String nestedStackId = null;
if (volumeGroupHeatStackId != null && !"".equals(volumeGroupHeatStackId)) {
- if (!"null".equalsIgnoreCase(volumeGroupHeatStackId)) {
- nestedStackId = volumeGroupHeatStackId;
- }
+ if (!"null".equalsIgnoreCase(volumeGroupHeatStackId)) {
+ nestedStackId = volumeGroupHeatStackId;
+ }
}
String nestedBaseStackId = null;
if (baseVfHeatStackId != null && !"".equals(baseVfHeatStackId)) {
- if (!"null".equalsIgnoreCase(baseVfHeatStackId)) {
- nestedBaseStackId = baseVfHeatStackId;
- }
+ if (!"null".equalsIgnoreCase(baseVfHeatStackId)) {
+ nestedBaseStackId = baseVfHeatStackId;
+ }
}
if (inputs == null) {
- // Create an empty set of inputs
- inputs = new HashMap<>();
- LOGGER.debug("inputs == null - setting to empty");
+ // Create an empty set of inputs
+ inputs = new HashMap<>();
+ LOGGER.debug("inputs == null - setting to empty");
} else {
- this.sendMapToDebug(inputs);
+ this.sendMapToDebug(inputs);
}
//This method will also handle doing things the "old" way - i.e., just orchestrate a VNF
boolean oldWay = false;
if (requestTypeString.startsWith("X")) {
- oldWay = true;
- LOGGER.debug("orchestrating a VNF - *NOT* a module!");
- requestTypeString = requestTypeString.substring(1);
+ oldWay = true;
+ LOGGER.debug("orchestrating a VNF - *NOT* a module!");
+ requestTypeString = requestTypeString.substring(1);
}
// 1607 - let's parse out the request type we're being sent
boolean isBaseRequest = false;
boolean isVolumeRequest = false;
if (requestTypeString.startsWith("VOLUME")) {
- isVolumeRequest = true;
+ isVolumeRequest = true;
}
LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
+
+ // TODO(sshank): Figure out the body format to be sent from Groovy.
+ String hpaEnviromnentString = "";
+ // Something similar to the following:
+ /*
+ if requestTypeString.substring(?) != "" {
+ hpaEnviromnentString = requestTypeString.substring(?)
+ }
+ */
+
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
// Build a default rollback object (no actions performed)
VnfRollback vfRollback = new VnfRollback();
callHeatbridge(baseVfHeatStackId);
// First, look up to see if the VF already exists.
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
StackInfo heatStack = null;
- long subStartTime1 = System.currentTimeMillis ();
+ long subStartTime1 = System.currentTimeMillis();
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName);
- LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName);
+ heatStack = heat.queryStack(cloudSiteId, tenantId, vfModuleName);
+ LOGGER.recordMetricEvent(subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName);
} catch (MsoException me) {
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - queryStack", me);
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent(subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - queryStack", me);
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext ("CreateVFModule");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ me.addContext("CreateVFModule");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
// New with 1607 - more precise handling/messaging if the stack already exists
- if (heatStack != null && !(heatStack.getStatus () == HeatStatus.NOTFOUND)) {
- // INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED
- HeatStatus status = heatStack.getStatus();
- if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING || status == HeatStatus.UPDATING) {
- // fail - it's in progress - return meaningful error
+ if (heatStack != null && !(heatStack.getStatus() == HeatStatus.NOTFOUND)) {
+ // INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED
+ HeatStatus status = heatStack.getStatus();
+ if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING || status == HeatStatus.UPDATING) {
+ // fail - it's in progress - return meaningful error
String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
- LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
- }
- if (status == HeatStatus.FAILED) {
- // fail - it exists and is in a FAILED state
+ LOGGER.error(MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+ }
+ if (status == HeatStatus.FAILED) {
+ // fail - it exists and is in a FAILED state
String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in FAILED state");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
- }
- if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
- // fail - it exists and is in a FAILED state
+ LOGGER.error(MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in FAILED state");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+ }
+ if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
+ // fail - it exists and is in a FAILED state
String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in UPDATED or UNKNOWN state");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
- }
- if (status == HeatStatus.CREATED) {
- // fail - it exists
- if (failIfExists != null && failIfExists) {
- String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
- LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
- throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
- } else {
- LOGGER.debug ("Found Existing stack, status=" + heatStack.getStatus ());
- // Populate the outputs from the existing stack.
- vnfId.value = heatStack.getCanonicalName ();
- outputs.value = copyStringOutputs (heatStack.getOutputs ());
- rollback.value = vfRollback; // Default rollback - no updates performed
- }
- }
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
+ LOGGER.error(MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in UPDATED or UNKNOWN state");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+ }
+ if (status == HeatStatus.CREATED) {
+ // fail - it exists
+ if (failIfExists != null && failIfExists) {
+ String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
+ LOGGER.error(MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+ } else {
+ LOGGER.debug("Found Existing stack, status=" + heatStack.getStatus());
+ // Populate the outputs from the existing stack.
+ vnfId.value = heatStack.getCanonicalName();
+ outputs.value = copyStringOutputs(heatStack.getOutputs());
+ rollback.value = vfRollback; // Default rollback - no updates performed
+ }
+ }
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
return;
}
// handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf
StackInfo nestedHeatStack = null;
- long subStartTime2 = System.currentTimeMillis ();
+ long subStartTime2 = System.currentTimeMillis();
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
- try {
- LOGGER.debug("Querying for nestedStackId = " + nestedStackId);
- nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
- LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName);
- } catch (MsoException me) {
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- me.addContext ("CreateVFModule");
- String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError, "MsoException trying to query nested stack", me);
- LOGGER.debug("ERROR trying to query nested stack= " + error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
- }
- if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached heatStack ID DOES NOT EXIST");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
- LOGGER.debug(error);
- throw new VnfException (error, MsoExceptionCategory.USERDATA);
- } else {
- LOGGER.debug("Found nested volume heat stack - copying values to inputs *later*");
- //this.sendMapToDebug(inputs);
- nestedVolumeOutputs = nestedHeatStack.getOutputs();
- this.sendMapToDebug(nestedVolumeOutputs, "volumeStackOutputs");
- //TODO
- //heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
- //this.sendMapToDebug(inputs);
- }
+ try {
+ LOGGER.debug("Querying for nestedStackId = " + nestedStackId);
+ nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
+ LOGGER.recordMetricEvent(subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName);
+ } catch (MsoException me) {
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ me.addContext("CreateVFModule");
+ String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent(subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError, "MsoException trying to query nested stack", me);
+ LOGGER.debug("ERROR trying to query nested stack= " + error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
+ }
+ if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
+ String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR";
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached heatStack ID DOES NOT EXIST");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ LOGGER.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found nested volume heat stack - copying values to inputs *later*");
+ //this.sendMapToDebug(inputs);
+ nestedVolumeOutputs = nestedHeatStack.getOutputs();
+ this.sendMapToDebug(nestedVolumeOutputs, "volumeStackOutputs");
+ //TODO
+ //heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
+ //this.sendMapToDebug(inputs);
+ }
}
// handle a nestedBaseStackId if sent- this is the stack ID of the base. Should be null for VNF requests
StackInfo nestedBaseHeatStack = null;
- long subStartTime3 = System.currentTimeMillis ();
+ long subStartTime3 = System.currentTimeMillis();
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
- try {
- LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId);
- nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
- LOGGER.recordMetricEvent (subStartTime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName);
- } catch (MsoException me) {
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- me.addContext ("CreateVFModule");
- String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.recordMetricEvent (subStartTime3, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError, "MsoException trying to query nested base stack", me);
- LOGGER.debug("ERROR trying to query nested base stack= " + error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
- }
- if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached base heatStack ID DOES NOT EXIST");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
- LOGGER.debug(error);
- throw new VnfException (error, MsoExceptionCategory.USERDATA);
- } else {
- LOGGER.debug("Found nested base heat stack - these values will be copied to inputs *later*");
- //this.sendMapToDebug(inputs);
- baseStackOutputs = nestedBaseHeatStack.getOutputs();
- this.sendMapToDebug(baseStackOutputs, "baseStackOutputs");
- //TODO
- //heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
- //this.sendMapToDebug(inputs);
- }
+ try {
+ LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId);
+ nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
+ LOGGER.recordMetricEvent(subStartTime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "QueryStack", vfModuleName);
+ } catch (MsoException me) {
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ me.addContext("CreateVFModule");
+ String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent(subStartTime3, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError, "MsoException trying to query nested base stack", me);
+ LOGGER.debug("ERROR trying to query nested base stack= " + error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
+ }
+ if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
+ String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR";
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached base heatStack ID DOES NOT EXIST");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ LOGGER.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found nested base heat stack - these values will be copied to inputs *later*");
+ //this.sendMapToDebug(inputs);
+ baseStackOutputs = nestedBaseHeatStack.getOutputs();
+ this.sendMapToDebug(baseStackOutputs, "baseStackOutputs");
+ //TODO
+ //heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
+ //this.sendMapToDebug(inputs);
+ }
}
// Ready to deploy the new VNF
try (CatalogDatabase db = CatalogDatabase.getInstance()) {
// Retrieve the VF
- VfModule vf = null;
- VnfResource vnfResource = null;
- VfModuleCustomization vfmc = null;
- LOGGER.debug("version: " + vfVersion);
+ VfModule vf = null;
+ VnfResource vnfResource = null;
+ VfModuleCustomization vfmc = null;
+ LOGGER.debug("version: " + vfVersion);
if (useMCUuid) {
- // 1707 - db refactoring
- vfmc = db.getVfModuleCustomizationByModelCustomizationId(mcu);
- vf = vfmc != null ? vfmc.getVfModule() : null;
+ // 1707 - db refactoring
+ vfmc = db.getVfModuleCustomizationByModelCustomizationId(mcu);
+ vf = vfmc != null ? vfmc.getVfModule() : null;
// 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
- //vf = db.getVfModuleByModelCustomizationUuid(mcu);
+ //vf = db.getVfModuleByModelCustomizationUuid(mcu);
if (vf == null) {
LOGGER.debug("Unable to find vfModuleCust with modelCustomizationUuid=" + mcu);
String error =
- "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu;
+ "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
- "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack", "",
- MsoLogger.ErrorCode.DataError,
- "Create VF Module: Unable to find vfModule with modelCustomizationUuid=" + mcu);
+ "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack", "",
+ MsoLogger.ErrorCode.DataError,
+ "Create VF Module: Unable to find vfModule with modelCustomizationUuid=" + mcu);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- error);
+ error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
- LOGGER.debug("Found vfModuleCust entry " + vfmc.toString());
+ LOGGER.debug("Found vfModuleCust entry " + vfmc.toString());
}
if (vf.isBase()) {
isBaseRequest = true;
LOGGER.debug("This is *not* a BASE VF request!");
if (!isVolumeRequest && nestedBaseStackId == null) {
LOGGER.debug(
- "DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request");
+ "DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request");
}
}
- }
- else { // This is to support gamma only - get info from vnf_resource table
- if (vfVersion != null && !vfVersion.isEmpty()) {
- vnfResource = db.getVnfResource(vnfType, vnfVersion);
- } else {
- vnfResource = db.getVnfResource(vnfType);
- }
- if (vnfResource == null) {
- String error = "Create VNF: Unknown VNF Type: " + vnfType;
- LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "VNF Type",
- vnfType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create VNF: Unknown VNF Type");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- throw new VnfException(error, MsoExceptionCategory.USERDATA);
- }
- LOGGER.debug("Got VNF module definition from Catalog: "
- + vnfResource.toString());
- }
- // By here - we have either a vf or vnfResource
+ } else { // This is to support gamma only - get info from vnf_resource table
+ if (vfVersion != null && !vfVersion.isEmpty()) {
+ vnfResource = db.getVnfResource(vnfType, vnfVersion);
+ } else {
+ vnfResource = db.getVnfResource(vnfType);
+ }
+ if (vnfResource == null) {
+ String error = "Create VNF: Unknown VNF Type: " + vnfType;
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "VNF Type",
+ vnfType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create VNF: Unknown VNF Type");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ }
+ LOGGER.debug("Got VNF module definition from Catalog: "
+ + vnfResource.toString());
+ }
+ // By here - we have either a vf or vnfResource
//1607 - Add version check
// First - see if it's in the VnfResource record
vnfResource = db.getVnfResourceByModelUuid(vnfResourceModelUuid);
if (vnfResource == null) {
LOGGER.debug(
- "Unable to find vnfResource at " + vnfResourceModelUuid + " will not error for now...");
+ "Unable to find vnfResource at " + vnfResourceModelUuid + " will not error for now...");
}
}
}
equalToMax = aicV.isTheSameVersion(maxVersionVnf);
} catch (Exception e) {
LOGGER.debug("An exception occured while trying to test AIC Version " + e.getMessage()
- + " - will default to not check", e);
+ + " - will default to not check", e);
doNotTest = true;
}
if (!doNotTest) {
if ((moreThanMin || equalToMin) // aic >= min
- && (equalToMax || !(moreThanMax))) { //aic <= max
+ && (equalToMax || !(moreThanMax))) { //aic <= max
LOGGER.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource
- .getModelUuid() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf
- + " supported on Cloud: " + cloudSiteOpt.get().getId() + " with AIC_Version:"
- + cloudSiteOpt.get().getAic_version());
+ .getModelUuid() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf
+ + " supported on Cloud: " + cloudSiteOpt.get().getId() + " with AIC_Version:"
+ + cloudSiteOpt.get().getAic_version());
} else {
// ERROR
String error =
- "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource
- .getModelUuid() + " VersionMin=" + minVersionVnf + " VersionMax:"
- + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteOpt.get().getId()
- + " with AIC_Version:" + cloudSiteOpt.get().getAic_version();
+ "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource
+ .getModelUuid() + " VersionMin=" + minVersionVnf + " VersionMax:"
+ + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteOpt.get().getId()
+ + " with AIC_Version:" + cloudSiteOpt.get().getAic_version();
LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
LOGGER.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
}
} else {
LOGGER.debug(
- "AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked.");
+ "AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked.");
}
// End Version check 1607
// with VNF_RESOURCE - we use the old methods.
//Integer heatTemplateId = null;
//Integer heatEnvtId = null;
-
+
String heatTemplateArtifactUuid = null;
String heatEnvironmentArtifactUuid = null;
- if (!oldWay) {
- if (isVolumeRequest) {
- heatTemplateArtifactUuid = vf.getVolHeatTemplateArtifactUUId();
- heatEnvironmentArtifactUuid = vfmc.getVolEnvironmentArtifactUuid();
- } else {
- heatTemplateArtifactUuid = vf.getHeatTemplateArtifactUUId();
- heatEnvironmentArtifactUuid = vfmc.getHeatEnvironmentArtifactUuid();
- }
- } else {
- if (isVolumeRequest) {
- LOGGER.debug("DANGER WILL ROBINSON! This should never apply - a VNF Request (gamma only now) *and* a volume request?");
- } else {
- heatTemplateArtifactUuid = vnfResource.getTemplateId();
- heatEnvironmentArtifactUuid = null;
- }
- }
- // By the time we get here - heatTemplateId and heatEnvtId should be populated (or null)
- HeatTemplate heatTemplate = null;
- if (heatTemplateArtifactUuid == null || "".equals(heatTemplateArtifactUuid)) {
- String error = "Create: No Heat Template ID defined in catalog database for " + vnfType + ", reqType=" + requestTypeString;
- LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vnfType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create: No Heat Template ID defined in catalog database");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
- MsoAlarmLogger.CRITICAL, error);
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- } else {
- heatTemplate = db.getHeatTemplateByArtifactUuidRegularQuery(heatTemplateArtifactUuid);
- }
- if (heatTemplate == null) {
- String error = "Create VF/VNF: no entry found for heat template ID = " + heatTemplateArtifactUuid;
- LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
- "Heat Template ID",
- String.valueOf(heatTemplateArtifactUuid), "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create VF/VNF: no entry found for heat template ID = " + heatTemplateArtifactUuid);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
- MsoAlarmLogger.CRITICAL, error);
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- }
- LOGGER.debug("Got HEAT Template from DB");
+ if (!oldWay) {
+ if (isVolumeRequest) {
+ heatTemplateArtifactUuid = vf.getVolHeatTemplateArtifactUUId();
+ heatEnvironmentArtifactUuid = vfmc.getVolEnvironmentArtifactUuid();
+ } else {
+ heatTemplateArtifactUuid = vf.getHeatTemplateArtifactUUId();
+ heatEnvironmentArtifactUuid = vfmc.getHeatEnvironmentArtifactUuid();
+ }
+ } else {
+ if (isVolumeRequest) {
+ LOGGER.debug("DANGER WILL ROBINSON! This should never apply - a VNF Request (gamma only now) *and* a volume request?");
+ } else {
+ heatTemplateArtifactUuid = vnfResource.getTemplateId();
+ heatEnvironmentArtifactUuid = null;
+ }
+ }
+ // By the time we get here - heatTemplateId and heatEnvtId should be populated (or null)
+ HeatTemplate heatTemplate = null;
+ if (heatTemplateArtifactUuid == null || "".equals(heatTemplateArtifactUuid)) {
+ String error = "Create: No Heat Template ID defined in catalog database for " + vnfType + ", reqType=" + requestTypeString;
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vnfType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create: No Heat Template ID defined in catalog database");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
+ MsoAlarmLogger.CRITICAL, error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ } else {
+ heatTemplate = db.getHeatTemplateByArtifactUuidRegularQuery(heatTemplateArtifactUuid);
+ }
+ if (heatTemplate == null) {
+ String error = "Create VF/VNF: no entry found for heat template ID = " + heatTemplateArtifactUuid;
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
+ "Heat Template ID",
+ String.valueOf(heatTemplateArtifactUuid), "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create VF/VNF: no entry found for heat template ID = " + heatTemplateArtifactUuid);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
+ MsoAlarmLogger.CRITICAL, error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ }
+ LOGGER.debug("Got HEAT Template from DB");
HeatEnvironment heatEnvironment = null;
String heatEnvironmentString = null;
heatEnvironment = db.getHeatEnvironmentByArtifactUuid(heatEnvironmentArtifactUuid);
if (heatEnvironment == null) {
String error = "Create VFModule: undefined Heat Environment. VFModule=" + vfModuleType
- + ", Environment ID="
- + heatEnvironmentArtifactUuid;
+ + ", Environment ID="
+ + heatEnvironmentArtifactUuid;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID",
- String.valueOf(heatEnvironmentArtifactUuid), "OpenStack", "getHeatEnvironment",
- MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: undefined Heat Environment");
+ String.valueOf(heatEnvironmentArtifactUuid), "OpenStack", "getHeatEnvironment",
+ MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: undefined Heat Environment");
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- error);
+ error);
// Alarm on this error, configuration must be fixed
alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
} else {
LOGGER.debug("Got Heat Environment from DB: " + heatEnvironment.toString());
heatEnvironmentString = heatEnvironment
- .getEnvironment(); //this.parseEnvironment (heatEnvironment.getEnvironment ());
+ .getEnvironment(); //this.parseEnvironment (heatEnvironment.getEnvironment ());
LOGGER.debug("after parsing: " + heatEnvironmentString);
}
} else {
// 1510 - Add the files: for nested templates *if* there are any
LOGGER.debug("In MsoVnfAdapterImpl, createVfModule about to call db.getNestedTemplates avec templateId="
- + heatTemplate.getArtifactUuid());
+ + heatTemplate.getArtifactUuid());
Map<String, Object> nestedTemplates = db.getNestedTemplates(heatTemplate.getArtifactUuid());
Map<String, Object> nestedTemplatesChecked = new HashMap<>();
if (nestedTemplates != null) {
// 1510 - Also add the files: for any get_files associated with this vnf_resource_id
// *if* there are any
Map<String, HeatFiles> heatFiles = null;
- Map<String, Object> heatFilesObjects = new HashMap<>();
+ Map<String, Object> heatFilesObjects = new HashMap<>();
// Add ability to turn on adding get_files with volume requests (by property).
boolean addGetFilesOnVolumeReq = false;
try {
- String propertyString = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_VNF_ADAPTER).getProperty(MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ, null);
- if ("true".equalsIgnoreCase(propertyString) || "y".equalsIgnoreCase(propertyString)) {
- addGetFilesOnVolumeReq = true;
- LOGGER.debug("AddGetFilesOnVolumeReq - setting to true! " + propertyString);
- }
+ String propertyString = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_VNF_ADAPTER).getProperty(MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ, null);
+ if ("true".equalsIgnoreCase(propertyString) || "y".equalsIgnoreCase(propertyString)) {
+ addGetFilesOnVolumeReq = true;
+ LOGGER.debug("AddGetFilesOnVolumeReq - setting to true! " + propertyString);
+ }
} catch (Exception e) {
- LOGGER.debug("An error occured trying to get property " + MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ + " - default to false", e);
- }
-
- if (!isVolumeRequest || addGetFilesOnVolumeReq) {
- if (oldWay) {
- LOGGER.debug("In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat files!");
- //heatFiles = db.getHeatFiles(vnfResource.getId());
- } else {
- // 1607 - now use VF_MODULE_TO_HEAT_FILES table
- LOGGER.debug("In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
- + vf.getModelUUID());
- heatFiles = db
- .getHeatFilesForVfModule(vf.getModelUUID());
- }
- if (heatFiles != null) {
- // add these to stack - to be done in createStack
- // here, we will map them to Map<String, Object> from
- // Map<String, HeatFiles>
- // this will match the nested templates format
- LOGGER.debug("Contents of heatFiles - to be added to files: on stack:");
-
- for (Map.Entry<String, HeatFiles> entry : heatFiles.entrySet()) {
- String heatFileName = entry.getKey();
- HeatFiles value = entry.getValue();
- if (heatFileName.startsWith("_ERROR|")) {
- // This means there was an invalid entry in VF_MODULE_TO_HEAT_FILES table - the heat file it pointed to could not be found.
- String heatFileId = heatFileName.substring(heatFileName.lastIndexOf("|")+1);
- String error = "Create: No HEAT_FILES entry in catalog database for " + vfModuleType + " at HEAT_FILES index=" + heatFileId;
- LOGGER.debug(error);
- LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "HEAT_FILES entry not found at " + heatFileId, vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "HEAT_FILES entry not found");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- // Alarm on this error, configuration must be fixed
- alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
- throw new VnfException (error, MsoExceptionCategory.INTERNAL);
- }
- String heatFileBody = value.getFileBody();
- String heatFileNameChecked = heatFileName;
- LOGGER.debug(heatFileNameChecked + " -> "
- + heatFileBody);
- heatFilesObjects.put(heatFileNameChecked, heatFileBody);
- }
- } else {
- LOGGER.debug("No heat files found -nothing to do here");
- heatFilesObjects = null;
- }
- } else {
- LOGGER.debug("Volume request - DO NOT CHECK for HEAT_FILES");
- }
+ LOGGER.debug("An error occured trying to get property " + MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ + " - default to false", e);
+ }
+
+ if (!isVolumeRequest || addGetFilesOnVolumeReq) {
+ if (oldWay) {
+ LOGGER.debug("In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat files!");
+ //heatFiles = db.getHeatFiles(vnfResource.getId());
+ } else {
+ // 1607 - now use VF_MODULE_TO_HEAT_FILES table
+ LOGGER.debug("In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
+ + vf.getModelUUID());
+ heatFiles = db
+ .getHeatFilesForVfModule(vf.getModelUUID());
+ }
+ if (heatFiles != null) {
+ // add these to stack - to be done in createStack
+ // here, we will map them to Map<String, Object> from
+ // Map<String, HeatFiles>
+ // this will match the nested templates format
+ LOGGER.debug("Contents of heatFiles - to be added to files: on stack:");
+
+ for (Map.Entry<String, HeatFiles> entry : heatFiles.entrySet()) {
+ String heatFileName = entry.getKey();
+ HeatFiles value = entry.getValue();
+ if (heatFileName.startsWith("_ERROR|")) {
+ // This means there was an invalid entry in VF_MODULE_TO_HEAT_FILES table - the heat file it pointed to could not be found.
+ String heatFileId = heatFileName.substring(heatFileName.lastIndexOf("|") + 1);
+ String error = "Create: No HEAT_FILES entry in catalog database for " + vfModuleType + " at HEAT_FILES index=" + heatFileId;
+ LOGGER.debug(error);
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "HEAT_FILES entry not found at " + heatFileId, vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "HEAT_FILES entry not found");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ // Alarm on this error, configuration must be fixed
+ alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ }
+ String heatFileBody = value.getFileBody();
+ String heatFileNameChecked = heatFileName;
+ LOGGER.debug(heatFileNameChecked + " -> "
+ + heatFileBody);
+ heatFilesObjects.put(heatFileNameChecked, heatFileBody);
+ }
+ } else {
+ LOGGER.debug("No heat files found -nothing to do here");
+ heatFilesObjects = null;
+ }
+ } else {
+ LOGGER.debug("Volume request - DO NOT CHECK for HEAT_FILES");
+ }
// Check that required parameters have been supplied
StringBuilder missingParams = null;
- List <String> paramList = new ArrayList <> ();
+ List<String> paramList = new ArrayList<>();
// New for 1510 - consult the PARAM_ALIAS field to see if we've been
// supplied an alias. Only check if we don't find it initially.
boolean checkRequiredParameters = true;
try {
String propertyString = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_VNF_ADAPTER)
- .getProperty(MsoVnfAdapterImpl.CHECK_REQD_PARAMS, null);
+ .getProperty(MsoVnfAdapterImpl.CHECK_REQD_PARAMS, null);
if ("false".equalsIgnoreCase(propertyString) || "n".equalsIgnoreCase(propertyString)) {
checkRequiredParameters = false;
LOGGER.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
- + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
+ + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
}
} catch (Exception e) {
// No problem - default is true
MsoHeatEnvironmentEntry mhee = null;
if (heatEnvironmentString != null && heatEnvironmentString.contains("parameters:")) {
//LOGGER.debug ("Have an Environment argument with a parameters: section - will bypass checking for valid params - but will still check for aliases");
- LOGGER.debug("Enhanced environment checking enabled - 1604");
+ LOGGER.debug("Enhanced environment checking enabled - 1604");
StringBuilder sb = new StringBuilder(heatEnvironmentString);
//LOGGER.debug("About to create MHEE with " + sb);
mhee = new MsoHeatEnvironmentEntry(sb);
+
+ // sshank: hpaEnviromnentString is obtained from requestTypeString above.
+ if (hpaEnviromnentString != null && hpaEnviromnentString.contains("parameters:")) {
+ StringBuilder hpasb = new StringBuilder(hpaEnviromnentString);
+ mhee.setHPAParameters(hpasb);
+ }
+
StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n");
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
- sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired());
+ sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired());
}
if (!mhee.isValid()) {
- sb2.append("Environment says it's not valid! " + mhee.getErrorString());
+ sb2.append("Environment says it's not valid! " + mhee.getErrorString());
} else {
- sb2.append("\nEnvironment:");
+ sb2.append("\nEnvironment:");
sb2.append(mhee);
}
LOGGER.debug(sb2.toString());
} else {
- LOGGER.debug("NO ENVIRONMENT for this entry");
+ LOGGER.debug("NO ENVIRONMENT for this entry");
}
// New with 1707 - all variables converted to their native object types
HashMap<String, Object> goldenInputs = null;
-
+
LOGGER.debug("Now handle the inputs....first convert");
ArrayList<String> parameterNames = new ArrayList<>();
HashMap<String, String> aliasToParam = new HashMap<>();
StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n");
int cntr = 0;
- try {
- for (HeatTemplateParam htp : heatTemplate.getParameters()) {
- sb.append("param[" + cntr++ + "]=" + htp.getParamName());
- parameterNames.add(htp.getParamName());
- if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) {
- aliasToParam.put(htp.getParamAlias(), htp.getParamName());
- sb.append(" ** (alias=" + htp.getParamAlias() + ")");
- }
- sb.append("\n");
- }
- LOGGER.debug(sb.toString());
+ try {
+ for (HeatTemplateParam htp : heatTemplate.getParameters()) {
+ sb.append("param[" + cntr++ + "]=" + htp.getParamName());
+ parameterNames.add(htp.getParamName());
+ if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) {
+ aliasToParam.put(htp.getParamAlias(), htp.getParamName());
+ sb.append(" ** (alias=" + htp.getParamAlias() + ")");
+ }
+ sb.append("\n");
+ }
+ LOGGER.debug(sb.toString());
} catch (Exception e) {
- LOGGER.debug("??An exception occurred trying to go through Parameter Names " + e.getMessage(),e);
+ LOGGER.debug("??An exception occurred trying to go through Parameter Names " + e.getMessage(), e);
}
- // Step 1 - convert what we got as inputs (Map<String, String>) to a
+ // Step 1 - convert what we got as inputs (Map<String, String>) to a
// Map<String, Object> - where the object matches the param type identified in the template
// This will also not copy over params that aren't identified in the template
goldenInputs = heat.convertInputMap(inputs, heatTemplate);
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
LOGGER.debug("Parameter:'" + parm.getParamName()
- + "', isRequired="
- + parm.isRequired()
- + ", alias="
- + parm.getParamAlias());
+ + "', isRequired="
+ + parm.isRequired()
+ + ", alias="
+ + parm.getParamAlias());
if (parm.isRequired() && (goldenInputs == null || !goldenInputs.containsKey(parm.getParamName()))) {
// The check for an alias was moved to the method in MsoHeatUtils - when we converted the Map<String, String> to Map<String, Object>
LOGGER.debug("**Parameter " + parm.getParamName()
- + " is required and not in the inputs...check environment");
+ + " is required and not in the inputs...check environment");
if (mhee != null && mhee.containsParameter(parm.getParamName())) {
LOGGER.debug("Required parameter " + parm.getParamName()
- + " appears to be in environment - do not count as missing");
+ + " appears to be in environment - do not count as missing");
} else {
LOGGER.debug("adding to missing parameters list: " + parm.getParamName());
if (missingParams == null) {
// Problem - missing one or more required parameters
String error = "Create VFModule: Missing Required inputs: " + missingParams;
LOGGER.error(MessageEnum.RA_MISSING_PARAM, missingParams.toString(), "OpenStack", "",
- MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs");
+ MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs");
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
- error);
+ error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
LOGGER.debug("found missing parameters - but checkRequiredParameters is false - will not block");
} else {
LOGGER.debug("No missing parameters found - ok to proceed");
}
- // We can now remove the recreating of the ENV with only legit params - that check is done for us,
+ // We can now remove the recreating of the ENV with only legit params - that check is done for us,
// and it causes problems with json that has arrays
String newEnvironmentString = null;
if (mhee != null) {
newEnvironmentString = mhee.getRawEntry().toString();
}
-
+
// "Fix" the template if it has CR/LF (getting this from Oracle)
String template = heatTemplate.getHeatTemplate();
template = template.replaceAll("\r\n", "\n");
LOGGER.debug("heat is not null!!");
}
heatStack = heat.createStack(cloudSiteId,
- tenantId,
- vfModuleName,
- template,
- goldenInputs,
- true,
- heatTemplate.getTimeoutMinutes(),
- newEnvironmentString,
- nestedTemplatesChecked,
- heatFilesObjects,
- backout.booleanValue());
+ tenantId,
+ vfModuleName,
+ template,
+ goldenInputs,
+ true,
+ heatTemplate.getTimeoutMinutes(),
+ newEnvironmentString,
+ nestedTemplatesChecked,
+ heatFilesObjects,
+ backout.booleanValue());
LOGGER
- .recordMetricEvent(createStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Successfully received response from Open Stack", "OpenStack", "CreateStack", vfModuleName);
+ .recordMetricEvent(createStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Successfully received response from Open Stack", "OpenStack", "CreateStack", vfModuleName);
} catch (MsoException me) {
me.addContext("CreateVFModule");
String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
LOGGER.recordMetricEvent(createStackStarttime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "CreateStack", vfModuleName);
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "CreateStack", vfModuleName);
LOGGER.error(MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "OpenStack", "",
- MsoLogger.ErrorCode.DataError, "MsoException - createStack", me);
+ MsoLogger.ErrorCode.DataError, "MsoException - createStack", me);
LOGGER
- .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- error);
+ .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+ error);
throw new VnfException(me);
} catch (NullPointerException npe) {
String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
LOGGER.recordMetricEvent(createStackStarttime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "CreateStack", vfModuleName);
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "CreateStack", vfModuleName);
LOGGER.error(MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "OpenStack", "",
- MsoLogger.ErrorCode.DataError, "NullPointerException - createStack", npe);
+ MsoLogger.ErrorCode.DataError, "NullPointerException - createStack", npe);
LOGGER
- .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- error);
+ .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+ error);
LOGGER.debug("NULL POINTER EXCEPTION at heat.createStack");
//npe.addContext ("CreateVNF");
throw new VnfException("NullPointerException during heat.createStack");
} catch (Exception e) {
LOGGER.recordMetricEvent(createStackStarttime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, "Exception while creating stack with OpenStack",
- "OpenStack", "CreateStack", vfModuleName);
+ MsoLogger.ResponseCode.CommunicationError, "Exception while creating stack with OpenStack",
+ "OpenStack", "CreateStack", vfModuleName);
LOGGER.debug("unhandled exception at heat.createStack", e);
LOGGER
- .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Exception while creating stack with OpenStack");
+ .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+ "Exception while creating stack with OpenStack");
throw new VnfException("Exception during heat.createStack! " + e.getMessage());
}
} catch (Exception e) {
// Reach this point if createStack is successful.
// Populate remaining rollback info and response parameters.
- vfRollback.setVnfId (heatStack.getCanonicalName ());
- vfRollback.setVnfCreated (true);
+ vfRollback.setVnfId(heatStack.getCanonicalName());
+ vfRollback.setVnfCreated(true);
- vnfId.value = heatStack.getCanonicalName ();
- outputs.value = copyStringOutputs (heatStack.getOutputs ());
+ vnfId.value = heatStack.getCanonicalName();
+ outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- LOGGER.debug ("VF Module " + vfModuleName + " successfully created");
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
+ LOGGER.debug("VF Module " + vfModuleName + " successfully created");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
}
@Override
- public void deleteVfModule (String cloudSiteId,
- String tenantId,
- String vnfName,
- MsoRequest msoRequest,
- Holder <Map <String, String>> outputs) throws VnfException {
- MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("DeleteVf");
- LOGGER.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+ public void deleteVfModule(String cloudSiteId,
+ String tenantId,
+ String vnfName,
+ MsoRequest msoRequest,
+ Holder<Map<String, String>> outputs) throws VnfException {
+ MsoLogger.setLogContext(msoRequest);
+ MsoLogger.setServiceName("DeleteVf");
+ LOGGER.debug("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
// 1702 capture the output parameters on a delete
// so we'll need to query first
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext ("DeleteVFModule");
+ me.addContext("DeleteVFModule");
String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
// call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types
outputs.value = this.convertMapStringObjectToStringString(stackOutputs);
// The possible outcomes of deleteStack are a StackInfo object with status
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
- long subStartTime = System.currentTimeMillis ();
+ long subStartTime = System.currentTimeMillis();
try {
- heat.deleteStack (tenantId, cloudSiteId, vnfName, true);
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", vnfName);
+ heat.deleteStack(tenantId, cloudSiteId, vnfName, true);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Open Stack", "OpenStack", "DeleteStack", vnfName);
} catch (MsoException me) {
- me.addContext ("DeleteVNF");
+ me.addContext("DeleteVNF");
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", vnfName);
- LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError, "Exception - deleteStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ LOGGER.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", vnfName);
+ LOGGER.error(MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError, "Exception - deleteStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
// On success, nothing is returned.
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VF");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VF");
}
@Override
- public void updateVfModule (String cloudSiteId,
- String tenantId,
- String vnfType,
- String vnfVersion,
- String vnfName,
- String requestType,
- String volumeGroupHeatStackId,
- String baseVfHeatStackId,
- String vfModuleStackId,
- String modelCustomizationUuid,
- Map <String, String> inputs,
- MsoRequest msoRequest,
- Holder <Map <String, String>> outputs,
- Holder <VnfRollback> rollback) throws VnfException {
+ public void updateVfModule(String cloudSiteId,
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ String baseVfHeatStackId,
+ String vfModuleStackId,
+ String modelCustomizationUuid,
+ Map<String, String> inputs,
+ MsoRequest msoRequest,
+ Holder<Map<String, String>> outputs,
+ Holder<VnfRollback> rollback) throws VnfException {
String vfModuleName = vnfName;
String vfModuleType = vnfType;
String methodName = "updateVfModule";
- MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
+ MsoLogger.setLogContext(msoRequest.getRequestId(), msoRequest.getServiceInstanceId());
String serviceName = VNF_ADAPTER_SERVICE_NAME + methodName;
- MsoLogger.setServiceName (serviceName);
+ MsoLogger.setServiceName(serviceName);
String strInit = "updateVfModule: cloudSiteId=" + cloudSiteId +
- ",tenantId=" + tenantId +
- ",vnfType=" + vnfType +
- ",vnfVersion=" + vnfVersion +
- ",vnfName=" + vnfName +
- ",requestType=" + requestType +
- ",volumeGroupHeatStackId=" + volumeGroupHeatStackId +
- ",baseVfHeatStackId=" + baseVfHeatStackId +
- ",vfModuleStackId=" + vfModuleStackId +
- ",modelCustomizationUuid=" + modelCustomizationUuid;
+ ",tenantId=" + tenantId +
+ ",vnfType=" + vnfType +
+ ",vnfVersion=" + vnfVersion +
+ ",vnfName=" + vnfName +
+ ",requestType=" + requestType +
+ ",volumeGroupHeatStackId=" + volumeGroupHeatStackId +
+ ",baseVfHeatStackId=" + baseVfHeatStackId +
+ ",vfModuleStackId=" + vfModuleStackId +
+ ",modelCustomizationUuid=" + modelCustomizationUuid;
LOGGER.debug(strInit);
String mcu = modelCustomizationUuid;
}
}
- String requestTypeString = "";
+ String requestTypeString = "";
if (requestType != null && !"".equals(requestType)) {
- requestTypeString = requestType;
+ requestTypeString = requestType;
}
String nestedStackId = null;
if (volumeGroupHeatStackId != null && !"".equals(volumeGroupHeatStackId)) {
- if (!"null".equalsIgnoreCase(volumeGroupHeatStackId)) {
- nestedStackId = volumeGroupHeatStackId;
- }
+ if (!"null".equalsIgnoreCase(volumeGroupHeatStackId)) {
+ nestedStackId = volumeGroupHeatStackId;
+ }
}
String nestedBaseStackId = null;
if (baseVfHeatStackId != null && !"".equals(baseVfHeatStackId)) {
- if (!"null".equalsIgnoreCase(baseVfHeatStackId)) {
- nestedBaseStackId = baseVfHeatStackId;
- }
+ if (!"null".equalsIgnoreCase(baseVfHeatStackId)) {
+ nestedBaseStackId = baseVfHeatStackId;
+ }
}
if (inputs == null) {
- // Create an empty set of inputs
- inputs = new HashMap<>();
- LOGGER.debug("inputs == null - setting to empty");
+ // Create an empty set of inputs
+ inputs = new HashMap<>();
+ LOGGER.debug("inputs == null - setting to empty");
} else {
- this.sendMapToDebug(inputs);
+ this.sendMapToDebug(inputs);
}
boolean isBaseRequest = false;
boolean isVolumeRequest = false;
if (requestTypeString.startsWith("VOLUME")) {
- isVolumeRequest = true;
+ isVolumeRequest = true;
}
if (vfModuleName == null || "".equals(vfModuleName.trim())) {
- if (vfModuleStackId != null) {
- vfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId);
- }
+ if (vfModuleStackId != null) {
+ vfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId);
+ }
}
- LOGGER.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudSiteId + "/" + tenantId);
+ LOGGER.debug("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudSiteId + "/" + tenantId);
LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
// Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+ long startTime = System.currentTimeMillis();
// Build a default rollback object (no actions performed)
- VnfRollback vfRollback = new VnfRollback ();
- vfRollback.setCloudSiteId (cloudSiteId);
- vfRollback.setTenantId (tenantId);
- vfRollback.setMsoRequest (msoRequest);
+ VnfRollback vfRollback = new VnfRollback();
+ vfRollback.setCloudSiteId(cloudSiteId);
+ vfRollback.setTenantId(tenantId);
+ vfRollback.setMsoRequest(msoRequest);
vfRollback.setRequestType(requestTypeString);
vfRollback.setVolumeGroupHeatStackId(volumeGroupHeatStackId);
vfRollback.setBaseGroupHeatStackId(baseVfHeatStackId);
vfRollback.setModelCustomizationUuid(mcu);
// First, look up to see if the VNF already exists.
- MsoHeatUtils heat = new MsoHeatUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
- MsoHeatUtilsWithUpdate heatU = new MsoHeatUtilsWithUpdate (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ MsoHeatUtils heat = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
+ MsoHeatUtilsWithUpdate heatU = new MsoHeatUtilsWithUpdate(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
StackInfo heatStack = null;
- long queryStackStarttime = System.currentTimeMillis ();
+ long queryStackStarttime = System.currentTimeMillis();
LOGGER.debug("UpdateVfModule - querying for " + vfModuleName);
try {
- heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName);
- LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
+ heatStack = heat.queryStack(cloudSiteId, tenantId, vfModuleName);
+ LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
- me.addContext ("UpdateVFModule");
+ me.addContext("UpdateVFModule");
String error = "Update VFModule: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
- LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
+ LOGGER.recordMetricEvent(queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
}
//TODO - do we need to check for the other status possibilities?
- if (heatStack == null || heatStack.getStatus () == HeatStatus.NOTFOUND) {
+ if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
// Not Found
String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudSiteId + "/" + tenantId;
- LOGGER.error (MessageEnum.RA_VNF_NOT_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- throw new VnfNotFound (cloudSiteId, tenantId, vfModuleName);
+ LOGGER.error(MessageEnum.RA_VNF_NOT_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ throw new VnfNotFound(cloudSiteId, tenantId, vfModuleName);
} else {
- LOGGER.debug ("Found Existing stack, status=" + heatStack.getStatus ());
+ LOGGER.debug("Found Existing stack, status=" + heatStack.getStatus());
// Populate the outputs from the existing stack.
- outputs.value = copyStringOutputs (heatStack.getOutputs ());
+ outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback; // Default rollback - no updates performed
}
// 1604 Cinder Volume support - handle a nestedStackId if sent (volumeGroupHeatStackId):
StackInfo nestedHeatStack = null;
- long queryStackStarttime2 = System.currentTimeMillis ();
+ long queryStackStarttime2 = System.currentTimeMillis();
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
- try {
- LOGGER.debug("Querying for nestedStackId = " + nestedStackId);
- nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
- LOGGER.recordMetricEvent (queryStackStarttime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
- } catch (MsoException me) {
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- me.addContext ("UpdateVFModule");
- String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.recordMetricEvent (queryStackStarttime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
- LOGGER.debug("ERROR trying to query nested stack= " + error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
- }
- if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- MsoLogger.setServiceName (serviceName);
- String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
- LOGGER.debug(error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- throw new VnfException (error, MsoExceptionCategory.USERDATA);
- } else {
- LOGGER.debug("Found nested heat stack - copying values to inputs *later*");
- nestedVolumeOutputs = nestedHeatStack.getOutputs();
- //this.sendMapToDebug(inputs);
- this.sendMapToDebug(nestedVolumeOutputs, "volumeStackOutputs");
- //TODO
- heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
- //this.sendMapToDebug(inputs);
- }
+ try {
+ LOGGER.debug("Querying for nestedStackId = " + nestedStackId);
+ nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
+ LOGGER.recordMetricEvent(queryStackStarttime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
+ } catch (MsoException me) {
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ me.addContext("UpdateVFModule");
+ String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent(queryStackStarttime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
+ LOGGER.debug("ERROR trying to query nested stack= " + error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
+ }
+ if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
+ MsoLogger.setServiceName(serviceName);
+ String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR";
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
+ LOGGER.debug(error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found nested heat stack - copying values to inputs *later*");
+ nestedVolumeOutputs = nestedHeatStack.getOutputs();
+ //this.sendMapToDebug(inputs);
+ this.sendMapToDebug(nestedVolumeOutputs, "volumeStackOutputs");
+ //TODO
+ heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
+ //this.sendMapToDebug(inputs);
+ }
}
// handle a nestedBaseStackId if sent - this is the stack ID of the base.
StackInfo nestedBaseHeatStack = null;
Map<String, Object> baseStackOutputs = null;
if (nestedBaseStackId != null) {
- long queryStackStarttime3 = System.currentTimeMillis ();
- try {
- LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId);
- nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
- LOGGER.recordMetricEvent (queryStackStarttime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
- } catch (MsoException me) {
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- me.addContext ("UpdateVfModule");
- String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.recordMetricEvent (queryStackStarttime3, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
- LOGGER.debug("ERROR trying to query nested base stack= " + error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- throw new VnfException (me);
- }
- if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
- MsoLogger.setServiceName (serviceName);
- String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ;
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
- LOGGER.debug(error);
- throw new VnfException (error, MsoExceptionCategory.USERDATA);
- } else {
- LOGGER.debug("Found nested base heat stack - copying values to inputs *later*");
- baseStackOutputs = nestedBaseHeatStack.getOutputs();
- //this.sendMapToDebug(inputs);
- this.sendMapToDebug(baseStackOutputs, "baseStackOutputs");
- //TODO
- heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
- //this.sendMapToDebug(inputs);
- }
+ long queryStackStarttime3 = System.currentTimeMillis();
+ try {
+ LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId);
+ nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
+ LOGGER.recordMetricEvent(queryStackStarttime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
+ } catch (MsoException me) {
+ // Failed to query the Stack due to an openstack exception.
+ // Convert to a generic VnfException
+ me.addContext("UpdateVfModule");
+ String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent(queryStackStarttime3, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
+ LOGGER.debug("ERROR trying to query nested base stack= " + error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException(me);
+ }
+ if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
+ MsoLogger.setServiceName(serviceName);
+ String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR";
+ LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ LOGGER.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found nested base heat stack - copying values to inputs *later*");
+ baseStackOutputs = nestedBaseHeatStack.getOutputs();
+ //this.sendMapToDebug(inputs);
+ this.sendMapToDebug(baseStackOutputs, "baseStackOutputs");
+ //TODO
+ heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
+ //this.sendMapToDebug(inputs);
+ }
}
// Ready to deploy the new VNF
try (CatalogDatabase db = CatalogDatabase.getInstance()) {
// Retrieve the VF definition
VnfResource vnfResource = null;
- VfModule vf = null;
- VfModuleCustomization vfmc = null;
+ VfModule vf = null;
+ VfModuleCustomization vfmc = null;
if (useMCUuid) {
- //vf = db.getVfModuleByModelCustomizationUuid(mcu);
- vfmc = db.getVfModuleCustomizationByModelCustomizationId(mcu);
- vf = vfmc != null ? vfmc.getVfModule() : null;
+ //vf = db.getVfModuleByModelCustomizationUuid(mcu);
+ vfmc = db.getVfModuleCustomizationByModelCustomizationId(mcu);
+ vf = vfmc != null ? vfmc.getVfModule() : null;
if (vf == null) {
LOGGER.debug("Unable to find a vfModule matching modelCustomizationUuid=" + mcu);
}
- } else {
- LOGGER.debug("1707 and later - MUST PROVIDE Model Customization UUID!");
+ } else {
+ LOGGER.debug("1707 and later - MUST PROVIDE Model Customization UUID!");
}
if (vf == null) {
String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "VF Module Type", vfModuleType, "OpenStack", "",
- MsoLogger.ErrorCode.DataError, error);
+ MsoLogger.ErrorCode.DataError, error);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
LOGGER.debug("Got VF module definition from Catalog: " + vf.toString());
if (vf.isBase()) {
- isBaseRequest = true;
- LOGGER.debug("This a BASE update request");
+ isBaseRequest = true;
+ LOGGER.debug("This a BASE update request");
} else {
LOGGER.debug("This is *not* a BASE VF update request");
if (!isVolumeRequest && nestedBaseStackId == null) {
LOGGER.debug("This is unexpected - no nestedBaseStackId with this non-base request");
}
}
-
+
//1607 - Add version check
// First - see if it's in the VnfResource record
// if we have a vf Module - then we have to query to get the VnfResource record.
vnfResource = db.getVnfResourceByModelUuid(vnfResourceModelUuid);
if (vnfResource == null) {
LOGGER
- .debug("Unable to find vnfResource at " + vnfResourceModelUuid + " will not error for now...");
+ .debug("Unable to find vnfResource at " + vnfResourceModelUuid + " will not error for now...");
}
}
String minVersionVnf = null;
if (cloudSiteOpt.isPresent()) {
aicV.setVersion(cloudSiteOpt.get().getAic_version());
if ((aicV.isMoreRecentThan(minVersionVnf) || aicV.isTheSameVersion(minVersionVnf)) // aic >= min
- && (aicV.isTheSameVersion(maxVersionVnf) || !(aicV
- .isMoreRecentThan(maxVersionVnf)))) { //aic <= max
+ && (aicV.isTheSameVersion(maxVersionVnf) || !(aicV
+ .isMoreRecentThan(maxVersionVnf)))) { //aic <= max
LOGGER.debug("VNF Resource " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
- + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteOpt.get().getId()
- + " with AIC_Version:" + cloudSiteOpt.get().getAic_version());
+ + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteOpt.get().getId()
+ + " with AIC_Version:" + cloudSiteOpt.get().getAic_version());
} else {
// ERROR
String error =
- "VNF Resource type: " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
- + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteOpt.get()
- .getId() + " with AIC_Version:" + cloudSiteOpt.get().getAic_version();
+ "VNF Resource type: " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
+ + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteOpt.get()
+ .getId() + " with AIC_Version:" + cloudSiteOpt.get().getAic_version();
LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "",
- MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
+ MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
LOGGER.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
}
} // let this error out downstream to avoid introducing uncertainty at this stage
} else {
- LOGGER.debug("cloudConfig is NULL - cannot check cloud site version");
+ LOGGER.debug("cloudConfig is NULL - cannot check cloud site version");
}
- } else {
- LOGGER.debug("AIC Version not set in VNF_Resource - do not error for now - not checked.");
+ } else {
+ LOGGER.debug("AIC Version not set in VNF_Resource - do not error for now - not checked.");
}
- // End Version check 1607
-
- String heatTemplateArtifactUuid = null;
- String heatEnvironmentArtifactUuid = null;
+ // End Version check 1607
+
+ String heatTemplateArtifactUuid = null;
+ String heatEnvironmentArtifactUuid = null;
HeatTemplate heatTemplate = null;
if (isVolumeRequest) {
}
if (heatTemplateArtifactUuid == null) {
String error =
- "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType="
- + requestTypeString;
+ "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType="
+ + requestTypeString;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "",
- MsoLogger.ErrorCode.DataError, error);
+ MsoLogger.ErrorCode.DataError, error);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- error);
+ error);
alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
- MsoAlarmLogger.CRITICAL, error);
+ MsoAlarmLogger.CRITICAL, error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
} else {
heatTemplate = db.getHeatTemplateByArtifactUuidRegularQuery(heatTemplateArtifactUuid);
if (heatTemplate == null) {
String error = "Update VNF: undefined Heat Template. VF="
- + vfModuleType + ", heat template id = " + heatTemplateArtifactUuid;
+ + vfModuleType + ", heat template id = " + heatTemplateArtifactUuid;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
- "Heat Template ID",
- String.valueOf(heatTemplateArtifactUuid), "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
+ "Heat Template ID",
+ String.valueOf(heatTemplateArtifactUuid), "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- error);
+ error);
// Alarm on this error, configuration must be fixed
alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR,
- MsoAlarmLogger.CRITICAL, error);
+ MsoAlarmLogger.CRITICAL, error);
- throw new VnfException(error, MsoExceptionCategory.INTERNAL);
- }
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ }
LOGGER.debug("Got HEAT Template from DB: " + heatTemplate.toString());
if (heatEnvironment == null) {
String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType
- + ", Environment ID="
- + heatEnvironmentArtifactUuid;
+ + ", Environment ID="
+ + heatEnvironmentArtifactUuid;
LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID",
- String.valueOf(heatEnvironmentArtifactUuid), "OpenStack", "", MsoLogger.ErrorCode.DataError,
- error);
+ String.valueOf(heatEnvironmentArtifactUuid), "OpenStack", "", MsoLogger.ErrorCode.DataError,
+ error);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound,
- error);
+ error);
// Alarm on this error, configuration must be fixed
alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
} else {
LOGGER.debug("Got Heat Environment from DB: " + heatEnvironment.toString());
heatEnvironmentString = heatEnvironment
- .getEnvironment(); //this.parseEnvironment (heatEnvironment.getEnvironment ());
+ .getEnvironment(); //this.parseEnvironment (heatEnvironment.getEnvironment ());
LOGGER.debug("After parsing: " + heatEnvironmentString);
}
} else {
}
LOGGER.debug("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId="
- + heatTemplate.getArtifactUuid());
+ + heatTemplate.getArtifactUuid());
Map<String, Object> nestedTemplates = db.getNestedTemplates(heatTemplate.getArtifactUuid());
Map<String, Object> nestedTemplatesChecked = new HashMap<>();
if (nestedTemplates != null) {
// Also add the files: for any get_files associated with this VfModule
// *if* there are any
LOGGER.debug("In MsoVnfAdapterImpl.updateVfModule, about to call db.getHeatFiles avec vfModuleId="
- + vf.getModelUUID());
+ + vf.getModelUUID());
Map<String, HeatFiles> heatFiles = null;
// Map <String, HeatFiles> heatFiles = db.getHeatFiles (vnf.getId ());
boolean addGetFilesOnVolumeReq = false;
try {
String propertyString = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_VNF_ADAPTER)
- .getProperty(MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ, null);
+ .getProperty(MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ, null);
if ("true".equalsIgnoreCase(propertyString) || "y".equalsIgnoreCase(propertyString)) {
addGetFilesOnVolumeReq = true;
LOGGER.debug("AddGetFilesOnVolumeReq - setting to true! " + propertyString);
}
} catch (Exception e) {
LOGGER.debug("An error occured trying to get property " + MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ
- + " - default to false", e);
+ + " - default to false", e);
}
if (!isVolumeRequest || addGetFilesOnVolumeReq) {
LOGGER.debug(
- "In MsoVnfAdapterImpl updateVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
- + vf.getModelUUID());
+ "In MsoVnfAdapterImpl updateVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
+ + vf.getModelUUID());
- heatFiles = db.getHeatFilesForVfModule(vf.getModelUUID());
+ heatFiles = db.getHeatFilesForVfModule(vf.getModelUUID());
if (heatFiles != null) {
// add these to stack - to be done in createStack
// here, we will map them to Map<String, Object> from Map<String, HeatFiles>
// This means there was an invalid entry in VF_MODULE_TO_HEAT_FILES table - the heat file it pointed to could not be found.
String heatFileId = heatFileName.substring(heatFileName.lastIndexOf("|") + 1);
String error = "Create: No HEAT_FILES entry in catalog database for " + vfModuleType
- + " at HEAT_FILES index=" + heatFileId;
+ + " at HEAT_FILES index=" + heatFileId;
LOGGER.debug(error);
LOGGER
- .error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "HEAT_FILES entry not found at " + heatFileId,
- vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
+ .error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "HEAT_FILES entry not found at " + heatFileId,
+ vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.DataNotFound, error);
+ MsoLogger.ResponseCode.DataNotFound, error);
// Alarm on this error, configuration must be fixed
alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
throw new VnfException(error, MsoExceptionCategory.INTERNAL);
boolean checkRequiredParameters = true;
try {
String propertyString = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_VNF_ADAPTER)
- .getProperty(MsoVnfAdapterImpl.CHECK_REQD_PARAMS, null);
+ .getProperty(MsoVnfAdapterImpl.CHECK_REQD_PARAMS, null);
if ("false".equalsIgnoreCase(propertyString) || "n".equalsIgnoreCase(propertyString)) {
checkRequiredParameters = false;
LOGGER.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
- + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
+ + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
}
} catch (Exception e) {
// No problem - default is true
mhee = new MsoHeatEnvironmentEntry(sb);
StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n");
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
- sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired());
+ sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired());
}
if (!mhee.isValid()) {
- sb2.append("Environment says it's not valid! " + mhee.getErrorString());
+ sb2.append("Environment says it's not valid! " + mhee.getErrorString());
} else {
- sb2.append("\nEnvironment:");
+ sb2.append("\nEnvironment:");
sb2.append(mhee);
}
LOGGER.debug(sb2.toString());
} else {
- LOGGER.debug("NO ENVIRONMENT for this entry");
+ LOGGER.debug("NO ENVIRONMENT for this entry");
}
// New for 1607 - support params of json type
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
LOGGER.debug("Parameter:'" + parm.getParamName()
- + "', isRequired="
- + parm.isRequired()
- + ", alias="
- + parm.getParamAlias());
+ + "', isRequired="
+ + parm.isRequired()
+ + ", alias="
+ + parm.getParamAlias());
// handle json
String parameterType = parm.getParamType();
if (parameterType == null || "".equals(parameterType.trim())) {
- parameterType = "String";
+ parameterType = "String";
}
JsonNode jsonNode = null;
if ("json".equalsIgnoreCase(parameterType) && inputs != null) {
String alias = parm.getParamAlias();
String value = inputs.get(alias);
LOGGER.debug("*Found an Alias: paramName=" + realParamName
- + ",alias="
- + alias
- + ",value="
- + value);
+ + ",alias="
+ + alias
+ + ",value="
+ + value);
inputs.remove(alias);
inputs.put(realParamName, value);
LOGGER.debug(alias + " entry removed from inputs, added back using " + realParamName);
else if (mhee != null && mhee.containsParameter(parm.getParamName())) {
LOGGER.debug("Required parameter " + parm.getParamName()
- + " appears to be in environment - do not count as missing");
+ + " appears to be in environment - do not count as missing");
} else {
LOGGER.debug("adding to missing parameters list: " + parm.getParamName());
if (missingParams == null) {
if (checkRequiredParameters) {
String error = "Update VNF: Missing Required inputs: " + missingParams;
LOGGER.error(MessageEnum.RA_MISSING_PARAM, missingParams.toString(), "OpenStack", "",
- MsoLogger.ErrorCode.DataError, error);
+ MsoLogger.ErrorCode.DataError, error);
LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest,
- error);
+ error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
} else {
LOGGER.debug("found missing parameters - but checkRequiredParameters is false - will not block");
extraParams.removeAll(paramList);
if (!extraParams.isEmpty()) {
LOGGER.warn(MessageEnum.RA_VNF_EXTRA_PARAM, vnfType, extraParams.toString(), "OpenStack", "",
- MsoLogger.ErrorCode.DataError, "Extra params");
+ MsoLogger.ErrorCode.DataError, "Extra params");
inputs.keySet().removeAll(extraParams);
}
}
// 1607 - when we get here - we have clean inputs. Create inputsTwo in case we have json
Map<String, Object> inputsTwo = null;
if (hasJson && jsonParams.size() > 0) {
- inputsTwo = new HashMap<>();
- for (Map.Entry<String, String> entry : inputs.entrySet()) {
- String keyParamName = entry.getKey();
- String value = entry.getValue();
- if (jsonParams.containsKey(keyParamName)) {
- inputsTwo.put(keyParamName, jsonParams.get(keyParamName));
- } else {
- inputsTwo.put(keyParamName, value);
- }
- }
+ inputsTwo = new HashMap<>();
+ for (Map.Entry<String, String> entry : inputs.entrySet()) {
+ String keyParamName = entry.getKey();
+ String value = entry.getValue();
+ if (jsonParams.containsKey(keyParamName)) {
+ inputsTwo.put(keyParamName, jsonParams.get(keyParamName));
+ } else {
+ inputsTwo.put(keyParamName, value);
+ }
+ }
}
// "Fix" the template if it has CR/LF (getting this from Oracle)
try {
if (!hasJson) {
heatStack = heatU.updateStack(cloudSiteId,
- tenantId,
- vfModuleName,
- template,
- copyStringInputs(inputs),
- true,
- heatTemplate.getTimeoutMinutes(),
- newEnvironmentString,
- //heatEnvironmentString,
- nestedTemplatesChecked,
- heatFilesObjects);
+ tenantId,
+ vfModuleName,
+ template,
+ copyStringInputs(inputs),
+ true,
+ heatTemplate.getTimeoutMinutes(),
+ newEnvironmentString,
+ //heatEnvironmentString,
+ nestedTemplatesChecked,
+ heatFilesObjects);
LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack",
- "UpdateStack", null);
+ MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack",
+ "UpdateStack", null);
} else {
heatStack = heatU.updateStack(cloudSiteId,
- tenantId,
- vfModuleName,
- template,
- inputsTwo,
- true,
- heatTemplate.getTimeoutMinutes(),
- newEnvironmentString,
- //heatEnvironmentString,
- nestedTemplatesChecked,
- heatFilesObjects);
+ tenantId,
+ vfModuleName,
+ template,
+ inputsTwo,
+ true,
+ heatTemplate.getTimeoutMinutes(),
+ newEnvironmentString,
+ //heatEnvironmentString,
+ nestedTemplatesChecked,
+ heatFilesObjects);
LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.COMPLETE,
- MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack",
- "UpdateStack", null);
- }
+ MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack",
+ "UpdateStack", null);
+ }
} catch (MsoException me) {
me.addContext("UpdateVFModule");
String error = "Update VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
LOGGER.recordMetricEvent(updateStackStarttime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null);
+ MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null);
LOGGER.error(MessageEnum.RA_UPDATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "OpenStack", "",
- MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
+ MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
LOGGER
- .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- error);
+ .recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
+ error);
throw new VnfException(me);
}
}
// Reach this point if updateStack is successful.
// Populate remaining rollback info and response parameters.
- vfRollback.setVnfId (heatStack.getCanonicalName ());
- vfRollback.setVnfCreated (true);
+ vfRollback.setVnfId(heatStack.getCanonicalName());
+ vfRollback.setVnfCreated(true);
- outputs.value = copyStringOutputs (heatStack.getOutputs ());
+ outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully update VF Module");
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully update VF Module");
}
private String getVfModuleNameFromModuleStackId(String vfModuleStackId) {
- // expected format of vfModuleStackId is "MSOTEST51-vSAMP3_base_module-0/1fc1f86c-7b35-447f-99a6-c23ec176ae24"
- // before the "/" is the vfModuleName and after the "/" is the heat stack id in Openstack
- if (vfModuleStackId == null)
- return null;
- int index = vfModuleStackId.lastIndexOf('/');
- if (index <= 0)
- return null;
- String vfModuleName = null;
- try {
- vfModuleName = vfModuleStackId.substring(0, index);
- } catch (Exception e) {
- LOGGER.debug("Exception", e);
- vfModuleName = null;
- }
- return vfModuleName;
+ // expected format of vfModuleStackId is "MSOTEST51-vSAMP3_base_module-0/1fc1f86c-7b35-447f-99a6-c23ec176ae24"
+ // before the "/" is the vfModuleName and after the "/" is the heat stack id in Openstack
+ if (vfModuleStackId == null)
+ return null;
+ int index = vfModuleStackId.lastIndexOf('/');
+ if (index <= 0)
+ return null;
+ String vfModuleName = null;
+ try {
+ vfModuleName = vfModuleStackId.substring(0, index);
+ } catch (Exception e) {
+ LOGGER.debug("Exception", e);
+ vfModuleName = null;
+ }
+ return vfModuleName;
}
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ * This VNF Adapter implementation is based on the VDU Plugin model. It assumes that each
+ * VF Module definition in the MSO catalog is expressed via a set of template and/or file
+ * artifacts that are appropriate for some specific sub-orchestrator that provides an
+ * implementation of the VduPlugin interface. This adapter handles all of the common
+ * VF Module logic, including:
+ * - catalog lookups for artifact retrieval
+ * - parameter filtering and validation
+ * - 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
+ * is expected (e.g. via a service-provider interface).
+ */
+package org.openecomp.mso.adapters.vnf;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+
+import org.openecomp.mso.adapters.vdu.CloudInfo;
+import org.openecomp.mso.adapters.vdu.VduException;
+import org.openecomp.mso.adapters.vdu.VduInstance;
+import org.openecomp.mso.adapters.vdu.VduModelInfo;
+import org.openecomp.mso.adapters.vdu.VduPlugin;
+import org.openecomp.mso.adapters.vdu.VduStateType;
+import org.openecomp.mso.adapters.vdu.VduStatus;
+import org.openecomp.mso.adapters.vdu.mapper.VfModuleCustomizationToVduMapper;
+import org.openecomp.mso.adapters.vnf.exceptions.VnfAlreadyExists;
+import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
+import org.openecomp.mso.cloud.CloudConfig;
+import org.openecomp.mso.cloud.CloudConfigFactory;
+import org.openecomp.mso.cloud.CloudSite;
+import org.openecomp.mso.cloudify.utils.MsoCloudifyUtils;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
+import org.openecomp.mso.db.catalog.beans.HeatTemplate;
+import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+import org.openecomp.mso.entity.MsoRequest;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoAlarmLogger;
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.openstack.beans.VnfRollback;
+import org.openecomp.mso.openstack.beans.VnfStatus;
+import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
+import org.openecomp.mso.openstack.utils.MsoHeatEnvironmentEntry;
+import org.openecomp.mso.openstack.utils.MsoHeatUtils;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@WebService(serviceName = "VnfAdapter", endpointInterface = "org.openecomp.mso.adapters.vnf.MsoVnfAdapter", targetNamespace = "http://org.openecomp.mso/vnf")
+public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
+
+ CloudConfigFactory cloudConfigFactory = new CloudConfigFactory();
+ protected CloudConfig cloudConfig = cloudConfigFactory.getCloudConfig();
+ protected MsoHeatUtils heatUtils;
+ protected VfModuleCustomizationToVduMapper vduMapper;
+ protected MsoCloudifyUtils cloudifyUtils;
+
+ MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
+
+ private static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
+ private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
+ private static final String CHECK_REQD_PARAMS = "org.openecomp.mso.adapters.vnf.checkRequiredParameters";
+ private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
+ /**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+ @Override
+ public void healthCheck () {
+ LOGGER.debug ("Health check call in VNF Plugin Adapter");
+ }
+
+ /**
+ * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
+ * @see MsoVnfPluginAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
+ */
+ public MsoVnfPluginAdapterImpl() {
+
+ }
+
+ /**
+ * This constructor MUST be used if this class is called with the new operator.
+ * @param msoPropFactory
+ */
+ public MsoVnfPluginAdapterImpl(MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfigFact) {
+ this.msoPropertiesFactory = msoPropFactory;
+ this.cloudConfigFactory = cloudConfigFact;
+ heatUtils = new MsoHeatUtils(MSO_PROP_VNF_ADAPTER, msoPropertiesFactory, cloudConfigFactory);
+ vduMapper = new VfModuleCustomizationToVduMapper();
+ cloudifyUtils = new MsoCloudifyUtils (MSO_PROP_VNF_ADAPTER, msoPropertiesFactory,cloudConfigFactory);
+ }
+
+ /**
+ * This is the "Create VNF" web service implementation.
+ * This function is now unsupported and will return an error.
+ *
+ */
+ @Override
+ public void createVnf (String cloudSiteId,
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ Map <String, String> inputs,
+ Boolean failIfExists,
+ Boolean backout,
+ MsoRequest msoRequest,
+ Holder <String> vnfId,
+ Holder <Map <String, String>> outputs,
+ Holder <VnfRollback> rollback)
+ throws VnfException
+ {
+ // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
+ LOGGER.debug ("CreateVNF command attempted but not supported");
+ throw new VnfException ("CreateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /**
+ * This is the "Update VNF" web service implementation.
+ * This function is now unsupported and will return an error.
+ *
+ */
+ @Override
+ public void updateVnf (String cloudSiteId,
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ Map <String, String> inputs,
+ MsoRequest msoRequest,
+ Holder <Map <String, String>> outputs,
+ Holder <VnfRollback> rollback)
+ throws VnfException
+ {
+ // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
+ LOGGER.debug ("UpdateVNF command attempted but not supported");
+ throw new VnfException ("UpdateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /**
+ * 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.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to query
+ * @param tenantId Openstack tenant identifier
+ * @param vnfNameOrId VNF Name or ID to query
+ * @param msoRequest Request tracking information for logs
+ * @param vnfExists Flag reporting the result of the query
+ * @param vnfId Holder for output VNF ID
+ * @param outputs Holder for Map of outputs from the deployed VF Module (assigned IPs, etc)
+ */
+ @Override
+ public void queryVnf (String cloudSiteId,
+ String tenantId,
+ String vnfNameOrId,
+ MsoRequest msoRequest,
+ Holder <Boolean> vnfExists,
+ Holder <String> vnfId,
+ Holder <VnfStatus> status,
+ Holder <Map <String, String>> outputs)
+ throws VnfException
+ {
+ MsoLogger.setLogContext (msoRequest);
+ MsoLogger.setServiceName ("QueryVnf");
+ LOGGER.debug ("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId);
+
+ // Will capture execution time for metrics
+ long startTime = System.currentTimeMillis ();
+ long subStartTime = System.currentTimeMillis ();
+
+ VduInstance vduInstance = null;
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null);
+
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
+
+ try {
+ vduInstance = vduPlugin.queryVdu(cloudInfo, vnfNameOrId);
+ LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received VDU Query response", "VDU", "QueryVDU", vnfNameOrId);
+ }
+ catch (VduException e) {
+ // Failed to query the VDU due to a plugin exception.
+ e.addContext ("QueryVNF");
+ String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+ LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVNF", vnfNameOrId);
+ LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfNameOrId, cloudSiteId, tenantId, "VDU", "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryVDU", e);
+ 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);
+ vnfId.value = vduInstance.getVduInstanceId();
+ outputs.value = copyStringOutputs (vduInstance.getOutputs ());
+
+ LOGGER.debug ("VNF " + vnfNameOrId + " found, ID = " + vnfId.value);
+ }
+ else {
+ vnfExists.value = Boolean.FALSE;
+ status.value = VnfStatus.NOTFOUND;
+ vnfId.value = null;
+ outputs.value = new HashMap <String, String> (); // Return as an empty map
+
+ LOGGER.debug ("VNF " + vnfNameOrId + " not found");
+ }
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query VNF");
+ return;
+ }
+
+
+ /**
+ * This is the "Delete VNF" web service implementation.
+ * This function is now unsupported and will return an error.
+ *
+ */
+ @Override
+ public void deleteVnf (String cloudSiteId,
+ String tenantId,
+ String vnfName,
+ 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);
+ }
+
+ /**
+ * This web service endpoint will rollback a previous Create VNF operation.
+ * 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.
+ */
+ @Override
+ public void rollbackVnf (VnfRollback rollback) throws VnfException {
+ long startTime = System.currentTimeMillis ();
+ MsoLogger.setServiceName ("RollbackVnf");
+ // rollback may be null (e.g. if stack already existed when Create was called)
+ if (rollback == null) {
+ LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "OpenStack", "rollbackVnf");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Rollback request content is null");
+ return;
+ }
+
+ // Don't rollback if nothing was done originally
+ if (!rollback.getVnfCreated()) {
+ 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 ();
+ CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null);
+
+ String vfModuleId = rollback.getVfModuleStackId ();
+
+ MsoLogger.setLogContext (rollback.getMsoRequest());
+
+ LOGGER.debug ("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
+
+ VduInstance vduInstance = null;
+
+ // Use the VduPlugin to delete the VF Module.
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
+
+ long subStartTime = System.currentTimeMillis ();
+ 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);
+ }
+ catch (VduException ve) {
+ // Failed to rollback the VF Module due to a plugin exception.
+ // Convert to a generic VnfException
+ ve.addContext ("RollbackVFModule");
+ String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + ve;
+ LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "DeleteVdu", null);
+ LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError, "Exception - DeleteVdu", ve);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException (ve);
+ }
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back VF Module");
+ return;
+ }
+
+
+ private VnfStatus vduStatusToVnfStatus (VduInstance vdu) {
+ // Determine the status based on last action & status
+ // 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;
+ }
+ else if (status == VduStateType.NOTFOUND) {
+ return VnfStatus.NOTFOUND;
+ }
+ else if (status == VduStateType.INSTANTIATED) {
+ return VnfStatus.ACTIVE;
+ }
+ else if (status == VduStateType.FAILED) {
+ return VnfStatus.FAILED;
+ }
+
+ return VnfStatus.UNKNOWN;
+ }
+
+ /*
+ * Normalize an input value to an Object, based on the target parameter type.
+ * If the type is not recognized, it will just be returned unchanged (as a string).
+ */
+ private Object convertInputValue (String inputValue, HeatTemplateParam templateParam)
+ {
+ String type = templateParam.getParamType();
+ LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type);
+
+ if (type.equalsIgnoreCase("number")) {
+ try {
+ return Integer.valueOf(inputValue);
+ }
+ catch (Exception e) {
+ LOGGER.debug("Unable to convert " + inputValue + " to an integer!");
+ return null;
+ }
+ } else if (type.equalsIgnoreCase("json")) {
+ try {
+ JsonNode jsonNode = new ObjectMapper().readTree(inputValue);
+ return jsonNode;
+ }
+ catch (Exception e) {
+ LOGGER.debug("Unable to convert " + inputValue + " to a JsonNode!");
+ return null;
+ }
+ } else if (type.equalsIgnoreCase("boolean")) {
+ return new Boolean(inputValue);
+ }
+
+ // Nothing else matched. Return the original string
+ return inputValue;
+ }
+
+ private Map <String, String> copyStringOutputs (Map <String, Object> stackOutputs) {
+ Map <String, String> stringOutputs = new HashMap <> ();
+ for (String key : stackOutputs.keySet ()) {
+ if (stackOutputs.get (key) instanceof String) {
+ stringOutputs.put (key, (String) stackOutputs.get (key));
+ } else if (stackOutputs.get(key) instanceof Integer) {
+ try {
+ String str = "" + stackOutputs.get(key);
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs");
+ }
+ } else if (stackOutputs.get(key) instanceof JsonNode) {
+ try {
+ String str = this.convertNode((JsonNode) stackOutputs.get(key));
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode");
+ }
+ } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
+ try {
+ String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap");
+ }
+ } else {
+ try {
+ String str = stackOutputs.get(key).toString();
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage());
+ }
+ }
+ }
+ return stringOutputs;
+ }
+
+
+ private void sendMapToDebug(Map<String, Object> inputs, String optionalName) {
+ int i = 0;
+ StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
+ if (inputs == null) {
+ sb.append("\tNULL");
+ }
+ else if (inputs.size() < 1) {
+ sb.append("\tEMPTY");
+ } else {
+ for (String str : inputs.keySet()) {
+ String outputString;
+ try {
+ outputString = inputs.get(str).toString();
+ } catch (Exception e) {
+ outputString = "Unable to call toString() on the value for " + str;
+ }
+ sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
+ }
+ }
+ LOGGER.debug(sb.toString());
+ return;
+ }
+
+ private void sendMapToDebug(Map<String, String> inputs) {
+ int i = 0;
+ StringBuilder sb = new StringBuilder("inputs:");
+ if (inputs == null) {
+ sb.append("\tNULL");
+ }
+ else if (inputs.size() < 1) {
+ sb.append("\tEMPTY");
+ } else {
+ for (String str : inputs.keySet()) {
+ sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
+ }
+ }
+ LOGGER.debug(sb.toString());
+ return;
+ }
+
+ private String convertNode(final JsonNode node) {
+ try {
+ final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
+ final String json = JSON_MAPPER.writeValueAsString(obj);
+ return json;
+ } catch (JsonParseException jpe) {
+ LOGGER.debug("Error converting json to string " + jpe.getMessage());
+ } catch (Exception e) {
+ LOGGER.debug("Error converting json to string " + e.getMessage());
+ }
+ return "[Error converting json to string]";
+ }
+
+ private Map<String, String> convertMapStringObjectToStringString(Map<String, Object> objectMap) {
+ if (objectMap == null) {
+ return null;
+ }
+ Map<String, String> stringMap = new HashMap<>();
+ for (String key : objectMap.keySet()) {
+ if (!stringMap.containsKey(key)) {
+ Object obj = objectMap.get(key);
+ if (obj instanceof String) {
+ stringMap.put(key, (String) objectMap.get(key));
+ } else if (obj instanceof JsonNode ){
+ // This is a bit of mess - but I think it's the least impacting
+ // let's convert it BACK to a string - then it will get converted back later
+ try {
+ String str = this.convertNode((JsonNode) obj);
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key);
+ //okay in this instance - only string values (fqdn) are expected to be needed
+ }
+ } else if (obj instanceof java.util.LinkedHashMap) {
+ LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
+ try {
+ String str = JSON_MAPPER.writeValueAsString(obj);
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key);
+ }
+ } else if (obj instanceof Integer) {
+ try {
+ String str = "" + obj;
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key);
+ }
+ } else {
+ try {
+ String str = obj.toString();
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")");
+ }
+ }
+ }
+ }
+
+ return stringMap;
+ }
+
+ /**
+ * This is the "Create VF Module" web service implementation.
+ * It will instantiate a new VF Module of the requested type in the specified cloud
+ * and tenant. The tenant must exist before this service is called.
+ *
+ * If a VF Module with the same name already exists, this can be considered a
+ * success or failure, depending on the value of the 'failIfExists' parameter.
+ *
+ * All VF Modules are defined in the MSO catalog. The caller must request one of
+ * the pre-defined module types or an error will be returned. Within the catalog,
+ * each VF Module references (among other things) a collection of artifacts that
+ * are used to deploy the required cloud resources (VMs, networks, etc.).
+ *
+ * Depending on the module templates, a variable set of input parameters will
+ * be defined, some of which are required. The caller is responsible to
+ * pass the necessary input data for the module or an error will be thrown.
+ *
+ * The method returns the vfModuleId, a Map of output attributes, and a VnfRollback
+ * object. This last object can be passed as-is to the rollbackVnf operation to
+ * undo everything that was created for the Module. This is useful if a VF module
+ * is successfully created but the orchestration fails on a subsequent step.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param tenantId Openstack tenant identifier
+ * @param vfModuleType VF Module type key, should match a VNF definition in catalog DB.
+ * Deprecated - should use modelCustomizationUuid
+ * @param vnfVersion VNF version key, should match a VNF definition in catalog DB
+ * Deprecated - VF Module versions also captured by modelCustomizationUuid
+ * @param vfModuleName Name to be assigned to the new VF Module
+ * @param requestType Indicates if this is a Volume Group or Module request
+ * @param volumeGroupId Identifier (i.e. deployment ID) for a Volume Group
+ * to attach to a VF Module
+ * @param baseVfModuleId Identifier (i.e. deployment ID) of the Base Module if
+ * this is an Add-on module
+ * @param modelCustomizationUuid Unique ID for the VF Module's model. Replaces
+ * the use of vfModuleType.
+ * @param inputs Map of key=value inputs for VNF stack creation
+ * @param failIfExists Flag whether already existing VNF should be considered
+ * @param backout Flag whether to suppress automatic backout (for testing)
+ * @param msoRequest Request tracking information for logs
+ * @param vnfId Holder for output VF Module instance ID in the cloud
+ * @param outputs Holder for Map of VNF outputs from Deployment (assigned IPs, etc)
+ * @param rollback Holder for returning VnfRollback object
+ */
+ public void createVfModule(String cloudSiteId,
+ String tenantId,
+ String vfModuleType,
+ String vnfVersion,
+ String vfModuleName,
+ String requestType,
+ String volumeGroupId,
+ String baseVfModuleId,
+ String modelCustomizationUuid,
+ Map <String, String> inputs,
+ Boolean failIfExists,
+ Boolean backout,
+ MsoRequest msoRequest,
+ Holder <String> vnfId,
+ Holder <Map <String, String>> outputs,
+ Holder <VnfRollback> rollback)
+ throws VnfException
+ {
+ // Will capture execution time for metrics
+ long startTime = System.currentTimeMillis ();
+
+ MsoLogger.setLogContext (msoRequest);
+ MsoLogger.setServiceName ("CreateVfModule");
+
+ // Require a model customization ID. Every VF Module definition must have one.
+ if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
+ LOGGER.debug("Missing required input: modelCustomizationUuid");
+ String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
+ "VF Module ModelCustomizationUuid", "null", "VDU", "", MsoLogger.ErrorCode.DataError, "Create VF Module: Missing required input: modelCustomizationUuid");
+ 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;
+
+ if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId))
+ baseVfModuleId = null;
+
+ if (inputs == null) {
+ // Create an empty set of inputs
+ inputs = new HashMap<String,String>();
+ LOGGER.debug("inputs == null - setting to empty");
+ } else {
+ this.sendMapToDebug(inputs);
+ }
+
+ // Check if this is for a "Volume" module
+ boolean isVolumeRequest = false;
+ if (requestType.startsWith("VOLUME")) {
+ isVolumeRequest = true;
+ }
+
+ LOGGER.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = " + baseVfModuleId);
+
+ // Build a default rollback object (no actions performed)
+ VnfRollback vfRollback = new VnfRollback();
+ vfRollback.setCloudSiteId(cloudSiteId);
+ vfRollback.setTenantId(tenantId);
+ vfRollback.setMsoRequest(msoRequest);
+ vfRollback.setRequestType(requestType);
+ vfRollback.setIsBase(false); // Until we know better
+ vfRollback.setVolumeGroupHeatStackId(volumeGroupId);
+ 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.
+ // There are three relevant records: VfModule, VfModuleCustomization, VnfResource
+
+ CatalogDatabase db = CatalogDatabase.getInstance();
+ VfModule vfModule = null;
+ VnfResource vnfResource = null;
+ VfModuleCustomization vfModuleCust = null;
+
+ try {
+ vfModuleCust = db.getVfModuleCustomizationByModelCustomizationId(modelCustomizationUuid);
+
+ if (vfModuleCust == null) {
+ String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid;
+ LOGGER.debug(error);
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
+ "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", "", MsoLogger.ErrorCode.DataError, error);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found vfModuleCust entry " + vfModuleCust.toString());
+ }
+
+ // Get the vfModule and vnfResource records
+ vfModule = vfModuleCust.getVfModule();
+ vnfResource = db.getVnfResourceByModelUuid(vfModule.getVnfResourceModelUUId());
+ }
+ catch (Exception e) {
+ db.close ();
+ LOGGER.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ throw new VnfException("Exception during create VF " + e.getMessage());
+ }
+
+ // Perform a version check against cloudSite
+ // Obtain the cloud site information where we will create the VF Module
+ Optional<CloudSite> cloudSite = cloudConfig.getCloudSite (cloudSiteId);
+ if (!cloudSite.isPresent()) {
+ throw new VnfException (new MsoCloudSiteNotFound (cloudSiteId));
+ }
+ MavenLikeVersioning aicV = new MavenLikeVersioning();
+ aicV.setVersion(cloudSite.get().getAic_version());
+
+ String vnfMin = vnfResource.getAicVersionMin();
+ String vnfMax = vnfResource.getAicVersionMax();
+
+ if ( (vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) ||
+ (vnfMax != null && aicV.isMoreRecentThan(vnfMax)))
+ {
+ // ERROR
+ String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUuid() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSite.get().getId() + " with AIC_Version:" + cloudSite.get().getAic_version();
+ LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
+ LOGGER.debug(error);
+ 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);
+
+ // First, look up to see if the VF already exists.
+
+ long subStartTime1 = System.currentTimeMillis ();
+ try {
+ vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleName);
+ LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "QueryVDU", vfModuleName);
+ }
+ catch (VduException me) {
+ // Failed to query the VDU due to a plugin exception.
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "Exception - queryVdu", me);
+ LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu", vfModuleName);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+
+ // Convert to a generic VnfException
+ 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
+ String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
+ LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ } else {
+ // Found existing deployment and client has not requested "failIfExists".
+ // Populate the outputs from the existing deployment.
+
+ vnfId.value = vduInstance.getVduInstanceId();
+ outputs.value = copyStringOutputs (vduInstance.getOutputs ());
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module (found existing)");
+ return;
+ }
+ }
+ // Check through various detailed error cases
+ else if (status == VduStateType.INSTANTIATING || status == VduStateType.DELETING || status == VduStateType.UPDATING) {
+ // fail - it's in progress - return meaningful error
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
+ LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ }
+ else if (status == VduStateType.FAILED) {
+ // fail - it exists and is in a FAILED state
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists and is in FAILED state");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ }
+ else if (status == VduStateType.UNKNOWN) {
+ // fail - it exists and is in a UNKNOWN state
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+ }
+ else {
+ // Unexpected, since all known status values have been tested for
+ String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists and is in an unknown state");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ 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;
+
+ // If a Volume Group was provided, query its outputs for inclusion in Module input parameters
+ if (volumeGroupId != null) {
+ long subStartTime2 = System.currentTimeMillis ();
+ VduInstance volumeVdu = null;
+ try {
+ volumeVdu = vduPlugin.queryVdu (cloudInfo, volumeGroupId);
+ LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from VduPlugin", "VDU", "QueryVdu", volumeGroupId);
+ }
+ catch (VduException me) {
+ // Failed to query the Volume Group VDU due to a plugin exception.
+ String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.DataError, "Exception - queryVdu(volume)", me);
+ LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu(volume)", volumeGroupId);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+
+ // Convert to a generic VnfException
+ 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");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ LOGGER.debug(error);
+ throw new VnfException (error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found nested volume group");
+ volumeGroupOutputs = volumeVdu.getOutputs();
+ 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
+
+ if (vfModule.isBase()) {
+ LOGGER.debug("This is a BASE Module request");
+ 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) {
+ LOGGER.debug ("WARNING: Add-on Module request - no Base Module ID provided");
+ }
+
+ if (baseVfModuleId != null) {
+ long subStartTime2 = System.currentTimeMillis ();
+ VduInstance baseVdu = null;
+ try {
+ baseVdu = vduPlugin.queryVdu (cloudInfo, baseVfModuleId);
+ LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from VduPlugin", "VDU", "QueryVdu(Base)", baseVfModuleId);
+ }
+ catch (MsoException me) {
+ // Failed to query the Base VF Module due to a Vdu Plugin exception.
+ String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ 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");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+ LOGGER.debug(error);
+ throw new VnfException (error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug("Found base module");
+ baseModuleOutputs = baseVdu.getOutputs();
+ this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
+ }
+ }
+ }
+
+ // 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.
+
+ // NOTE: The template is fixed for the VF Module. The environment is part of the customization.
+ String heatTemplateArtifactUuid = null;
+ String heatEnvironmentArtifactUuid = null;
+
+ if (isVolumeRequest) {
+ heatTemplateArtifactUuid = vfModule.getVolHeatTemplateArtifactUUId();
+ heatEnvironmentArtifactUuid = vfModuleCust.getVolEnvironmentArtifactUuid();
+ } else {
+ heatTemplateArtifactUuid = vfModule.getHeatTemplateArtifactUUId();
+ heatEnvironmentArtifactUuid = vfModuleCust.getHeatEnvironmentArtifactUuid();
+ }
+
+ if (heatTemplateArtifactUuid == null || heatTemplateArtifactUuid.equals("")) {
+ String error = "Create: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType;
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "Cloudify", "", MsoLogger.ErrorCode.DataError, "Create: No Heat Template ID defined in catalog database");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ }
+
+ HeatTemplate heatTemplate = db.getHeatTemplateByArtifactUuidRegularQuery(heatTemplateArtifactUuid);
+
+ if (heatTemplate == null) {
+ String error = "Create VF/VNF: no entry found for heat template ID = " + heatTemplateArtifactUuid;
+ LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
+ "Heat Template ID",
+ String.valueOf(heatTemplateArtifactUuid), "Cloudify", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create VF/VNF: no entry found for heat template ID = " + heatTemplateArtifactUuid);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ alarmLogger.sendAlarm(MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ }
+ LOGGER.debug("Got HEAT Template record from DB");
+
+ // Next get the Environment record. This is optional.
+ HeatEnvironment heatEnvironment = null;
+ if (heatEnvironmentArtifactUuid != null && !heatEnvironmentArtifactUuid.equals(""))
+ {
+ heatEnvironment = db.getHeatEnvironmentByArtifactUuid(heatEnvironmentArtifactUuid);
+ if (heatEnvironment == null) {
+ String error = "Create VFModule: undefined Heat Environment. VFModule=" + vfModuleType
+ + ", Environment ID="
+ + heatEnvironmentArtifactUuid;
+ LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", String.valueOf(heatEnvironmentArtifactUuid), "Cloudify", "getEnvironment", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: undefined Heat Environment");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+ // Alarm on this error, configuration must be fixed
+ alarmLogger.sendAlarm (MSO_CONFIGURATION_ERROR, MsoAlarmLogger.CRITICAL, error);
+
+ throw new VnfException (error, MsoExceptionCategory.INTERNAL);
+ }
+ LOGGER.debug ("Got Heat Environment from DB");
+ } else {
+ LOGGER.debug ("no environment parameter found for this Type " + vfModuleType);
+ }
+
+
+ // 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<>();
+ List<String> extraInputs = new ArrayList<>();
+
+ Boolean skipInputChecks = false;
+
+ if (skipInputChecks) {
+ goldenInputs = new HashMap<String,Object>();
+ for (String key : inputs.keySet()) {
+ goldenInputs.put(key, inputs.get(key));
+ }
+ }
+ else {
+ // Build maps for the parameters (including aliases) to simplify checks
+ HashMap<String, HeatTemplateParam> params = new HashMap<>();
+
+ Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
+ LOGGER.debug("paramSet has " + paramSet.size() + " entries");
+
+ for (HeatTemplateParam htp : paramSet) {
+ params.put(htp.getParamName(), htp);
+
+ // Include aliases.
+ String alias = htp.getParamAlias();
+ if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ params.put(alias, htp);
+ }
+ }
+
+ // First, convert all inputs to their "template" type
+ for (String key : inputs.keySet()) {
+ if (params.containsKey(key)) {
+ Object value = convertInputValue(inputs.get(key), params.get(key));
+ if (value != null) {
+ goldenInputs.put(key, value);
+ }
+ else {
+ LOGGER.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to " + params.get(key).getParamType());
+ }
+ } else {
+ extraInputs.add(key);
+ }
+ }
+
+ if (!extraInputs.isEmpty()) {
+ 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()) {
+ if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
+ goldenInputs.put(key, volumeGroupOutputs.get(key));
+ }
+ }
+ }
+
+ // Next add in Base Module Outputs if there are any. Copy directly without conversions.
+ if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
+ for (String key : baseModuleOutputs.keySet()) {
+ if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
+ goldenInputs.put(key, baseModuleOutputs.get(key));
+ }
+ }
+ }
+
+ // 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;
+ try {
+ String propertyString = this.msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_VNF_ADAPTER)
+ .getProperty(MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS,null);
+ if ("false".equalsIgnoreCase (propertyString) || "n".equalsIgnoreCase (propertyString)) {
+ checkRequiredParameters = false;
+ LOGGER.debug ("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
+ + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
+ }
+ } catch (Exception e) {
+ // 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
+ // support pre-set parameter/values does not yet exist in the model.
+ //
+ StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
+ MsoHeatEnvironmentEntry mhee = new MsoHeatEnvironmentEntry (sb);
+ for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
+ if (parm.isRequired () && (!goldenInputs.containsKey (parm.getParamName ()))) {
+ if (mhee != null && mhee.containsParameter(parm.getParamName())) {
+ LOGGER.debug ("Required parameter " + parm.getParamName ()
+ + " appears to be in environment - do not count as missing");
+ } else {
+ LOGGER.debug ("adding to missing parameters list: " + parm.getParamName ());
+ if (missingParams == null) {
+ missingParams = parm.getParamName ();
+ } else {
+ missingParams += "," + parm.getParamName ();
+ }
+ }
+ }
+ }
+
+ if (missingParams != null) {
+ if (checkRequiredParameters) {
+ // Problem - missing one or more required parameters
+ String error = "Create VFModule: Missing Required inputs: " + missingParams;
+ LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, "VDU", "", MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+ throw new VnfException (error, MsoExceptionCategory.USERDATA);
+ } else {
+ LOGGER.debug ("found missing parameters [" + missingParams + "] - but checkRequiredParameters is false - will not block");
+ }
+ } else {
+ LOGGER.debug ("No missing parameters found - ok to proceed");
+ }
+
+ } // 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;
+ if (! isVolumeRequest) {
+ vduModel = vduMapper.mapVfModuleCustomizationToVdu(vfModuleCust);
+ } 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) {
+ // Failed to instantiate the VDU.
+ me.addContext ("CreateVFModule");
+ String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "instantiateVdu", vfModuleName);
+ LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "VDU", "", MsoLogger.ErrorCode.DataError, "MsoException - instantiateVdu", me);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ // Convert to a generic VnfException
+ throw new VnfException (me);
+ }
+ catch (NullPointerException npe) {
+ String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
+ LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error, "VDU", "instantiateVdu", vfModuleName);
+ LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "VDU", "", MsoLogger.ErrorCode.DataError, "NullPointerException - instantiateVdu", npe);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
+ LOGGER.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe);
+ throw new VnfException ("NullPointerException during instantiateVdu");
+ }
+ catch (Exception e) {
+ String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+ LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, error, "VDU", "instantiateVdu", vfModuleName);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, error);
+ LOGGER.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
+ } finally {
+ db.close();
+ }
+
+ // Reach this point if create is successful.
+ // Populate remaining rollback info and response parameters.
+ vfRollback.setVnfCreated (true);
+ vfRollback.setVnfId (vduInstance.getVduInstanceId());
+ vnfId.value = vduInstance.getVduInstanceId();
+ outputs.value = copyStringOutputs (vduInstance.getOutputs ());
+
+ rollback.value = vfRollback;
+
+ LOGGER.debug ("VF Module " + vfModuleName + " successfully created");
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
+ return;
+ }
+
+ public void deleteVfModule (String cloudSiteId,
+ String tenantId,
+ String vfModuleId,
+ MsoRequest msoRequest,
+ Holder <Map <String, String>> outputs) throws VnfException
+ {
+ 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);
+
+ try {
+ vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleId);
+ LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received VDU Query response", "VDU", "QueryVDU", vfModuleId);
+ }
+ catch (VduException e) {
+ // Failed to query the VDU due to a plugin exception.
+ // Convert to a generic VnfException
+ e.addContext ("QueryVFModule");
+ String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+ LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVNF", vfModuleId);
+ LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "VDU", "QueryVFModule", MsoLogger.ErrorCode.DataError, "Exception - queryVDU", e);
+ 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());
+
+ // Use the VduPlugin to delete the VDU.
+ // The possible outcomes of deleteVdu are
+ // - a vnfInstance object with status of DELETED (success)
+ // - a vnfInstance object with status of NOTFOUND (VDU did not exist, treat as success)
+ // - a vnfInstance object with status of FAILED (error)
+ // Also, VduException could be thrown.
+ long subStartTime = System.currentTimeMillis ();
+ try {
+ // TODO: Get an appropriate timeout value - require access to the model
+ vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
+ LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from deleteVdu", "VDU", "DeleteVdu", vfModuleId);
+ } catch (VduException me) {
+ me.addContext ("DeleteVfModule");
+ // Convert to a generic VnfException
+ String error = "Delete VF: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+ LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "DeleteVdu", "DeleteVdu", vfModuleId);
+ LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError, "Exception - DeleteVdu: " + me.getMessage());
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ throw new VnfException (me);
+ }
+
+ // On success, nothing is returned.
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VF");
+ return;
+ }
+
+ // Update VF Module not yet implemented for generic VDU plug-in model.
+ @Override
+ public void updateVfModule (String cloudSiteId,
+ String tenantId,
+ String vnfType,
+ String vnfVersion,
+ String vnfName,
+ String requestType,
+ String volumeGroupHeatStackId,
+ String baseVfHeatStackId,
+ String vfModuleStackId,
+ String modelCustomizationUuid,
+ Map <String, String> inputs,
+ MsoRequest msoRequest,
+ Holder <Map <String, String>> outputs,
+ Holder <VnfRollback> rollback) throws VnfException
+ {
+ // This operation is not currently supported for VduPlugin-orchestrated VF Modules.
+ LOGGER.debug ("Update VF Module command attempted but not supported");
+ throw new VnfException ("UpdateVfModule: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /*
+ * Dynamic selection of a VduPlugin version. For initial tests, base on the "orchestrator"
+ * defined for the target cloud. Should really be looking at the VNF Model (ochestration_mode)
+ * but we don't currently have access to that in Query and Delete cases.
+ */
+ private VduPlugin getVduPlugin (String cloudSiteId) {
+ Optional<CloudSite> cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+ if (cloudSite.isPresent()) {
+ String orchestrator = cloudSite.get().getOrchestrator();
+
+ if (orchestrator.equalsIgnoreCase("CLOUDIFY")) {
+ return cloudifyUtils;
+ }
+ else if (orchestrator.equalsIgnoreCase("HEAT")) {
+ return heatUtils;
+ }
+ }
+
+ // Default - return HEAT plugin, though will fail later
+ return heatUtils;
+ }
+
+}
vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
}
else {
- // Don't expect this, but default is the HEAT adapter
- LOGGER.debug ("GetVnfAdapterImpl: Return Default (Heat) Adapter");
- vnfAdapter = new MsoVnfAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
+ // Default is the PLUGIN adapter
+ LOGGER.debug ("GetVnfAdapterImpl: Return Default (Plugin) Adapter");
+ vnfAdapter = new MsoVnfPluginAdapterImpl (msoPropertiesFactory, cloudConfigFactory);
}
return vnfAdapter;
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.adapters.vnf;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.mso.vdu.utils.VduBlueprint;
+import org.openecomp.mso.vdu.utils.VduPlugin;
+
+import java.util.HashMap;
+
+public class AriaVduPluginTest {
+
+ VduPlugin vduPlugin = new AriaVduPlugin();
+
+ @Test(expected = RuntimeException.class)
+ public void instantiateVduFailedToCreateCSAR() throws Exception {
+ VduBlueprint blueprint = new VduBlueprint();
+ blueprint.setMainTemplateName("blueprintmain");
+ vduPlugin.instantiateVdu("cloudid", "tenantid", "vduinstancename",
+ new VduBlueprint(), new HashMap<>(), null, 100, true);
+ Assert.assertFalse(true);
+ }
+}
\ No newline at end of file
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
+ *l
+ * 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.openecomp.mso.adapters.vnf;
+
+import org.junit.Test;
+
+import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertTrue;
+
+public class BpelRestClientTest {
+
+ @Test
+ public void testBpelRestClient() {
+
+ BpelRestClient test = new BpelRestClient();
+
+ assertEquals(test.getSocketTimeout(),5);
+ assertEquals(test.getConnectTimeout(),5);
+ assertEquals(test.getRetryCount(),5);
+ test.setRetryCount(6);
+ assertEquals(test.getRetryCount(),6);
+ assertEquals(test.getRetryInterval(),-15);
+ test.setRetryInterval(5);
+ assertEquals(test.getRetryInterval(),5);
+ test.setCredentials("credentials");
+ assertEquals(test.getCredentials(),"credentials");
+ test.setRetryList("1, 2, 3");
+ assertEquals(test.getRetryList(),"1, 2, 3");
+ assertEquals(test.getLastResponseCode(),0);
+ assertEquals(test.getLastResponse(),"");
+ assertTrue(test.bpelPost("bpelStr","url",true));
+
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.adapters.vnf;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.ws.Holder;
+
+import org.junit.Test;
+import org.openecomp.mso.adapters.vnf.exceptions.VnfException;
+import org.openecomp.mso.entity.MsoRequest;
+import org.openecomp.mso.openstack.beans.VnfRollback;
+
+public class MsoVnfPluginAdapterImplTest {
+
+ @Test(expected = NullPointerException.class)
+ public void queryVnfNullPointerExceptionTest() throws Exception {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.queryVnf("siteid", "1234", "vfname",
+ msoRequest, new Holder<>(), new Holder<>(), new Holder<>(),
+ new Holder<>());
+ }
+
+ @Test(expected = VnfException.class)
+ public void deleteVnfVnfExceptionTest() throws Exception {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.deleteVnf("12344", "234", "vnfname", msoRequest);
+
+ }
+
+ @Test
+ public void rollbackVnf() throws Exception {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ VnfRollback vnfRollback = new VnfRollback();
+ vnfRollback.setModelCustomizationUuid("1234");
+ vnfRollback.setVfModuleStackId("2134");
+ vnfRollback.setVnfId("123");
+ vnfRollback.setModelCustomizationUuid("1234");
+
+ instance.rollbackVnf(vnfRollback);
+ }
+
+ @Test(expected = VnfException.class)
+ public void createVfModuleVnfException() throws Exception {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.createVfModule("123", "123", "vf", "v1", "module-005", "create", "3245", "234", "123", new HashMap<>(), true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>());
+ }
+
+ @Test(expected = VnfException.class)
+ public void updateVfModuleVnfException() throws Exception {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ instance.updateVfModule("123", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>());
+ }
+
+ @Test
+ public void healthCheckVNFTest() {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ instance.healthCheck();
+ }
+
+ @Test
+ public void createVnfTest() {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+ map.put("key1", "value1");
+ try {
+ instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map,
+ Boolean.FALSE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(),
+ new Holder<>());
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void updateVnfTest() {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+
+ Map<String, String> map = new HashMap<>();
+
+ map.put("key1", "value1");
+ try {
+ instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD",
+ "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(),
+ new Holder<>());
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void deleteVnfTest() {
+ MsoVnfPluginAdapterImpl instance = new MsoVnfPluginAdapterImpl();
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId("12345");
+ msoRequest.setServiceInstanceId("12345");
+ try {
+ instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest);
+ } catch (Exception e) {
+
+ }
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.adapters.workflowmessage;
+
+import org.apache.http.entity.ContentType;
+import org.junit.Test;
+import org.mockito.Mock;
+
+import static junit.framework.Assert.assertFalse;
+
+public class BPRestCallbackTest {
+
+ @Mock
+ ContentType contentType;
+
+ @Test
+ public void testSendExceptionCase() {
+
+ BPRestCallback test = new BPRestCallback();
+ test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message");
+ assertFalse(test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message"));
+
+ }
+ }
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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
+ *l
+ * 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.openecomp.mso.adapters.workflowmessage;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class WMAdapterRestTest {
+
+ @Test(expected = ClassFormatError.class)
+ public void testHealthCheckException() throws Exception {
+
+ WMAdapterRest test = new WMAdapterRest();
+ test.healthcheck("34388737-cdad-4d96-ae6f-39d08024b495");
+ Assert.assertFalse(true);
+
+ }
+
+ @Test(expected = ClassFormatError.class)
+ public void testReceiveWorkflowMsgException() throws Exception {
+ WMAdapterRest test = new WMAdapterRest();
+ test.receiveWorkflowMessage("contentTypeHeader", "messageType", "correlator", "content");
+ Assert.assertFalse(true);
+
+ }
+}
+
+++ /dev/null
-1.0.1-SNAPSHOT
from setuptools import setup, find_packages
-try:
- with open('VERSION') as v_file:
- version = v_file.read().strip()
-except IOError:
- print "There was a problem parsing the VERSION file."
-
setup(
name='aria-rest-server',
- version=version,
+ version='0.1.0',
packages=find_packages(),
author = '',
author_email = '',
[tox]
-envlist = py27,py35
+envlist = py27
[testenv]
deps=
pytest
<groupId>org.onap.sdc.sdc-tosca</groupId>
<artifactId>sdc-tosca</artifactId>
<version>1.3.3</version>
+ <!-- sdc-tosca:1.3.3 depends on jtosca:1.3.4-SNAPSHOT,
+ which must be excluded, and the release version
+ of jtosca must be pulled in using an additional
+ dependency, below -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.onap.sdc.jtosca</groupId>
+ <artifactId>jtosca</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.jtosca</groupId>
+ <artifactId>jtosca</artifactId>
+ <version>1.3.4</version>
</dependency>
<dependency>
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.asdc.client.test.emulators;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class JsonArtifactInfoTest {
+ JsonArtifactInfo jsonArtifactInfo = new JsonArtifactInfo();
+
+ List<JsonArtifactInfo> artifactList = new ArrayList<>();
+
+ @Test
+ public final void addArtifactToUUIDMap()
+ {
+ jsonArtifactInfo.addArtifactToUUIDMap(artifactList);
+ }
+
+ @Test
+ public final void setAttribute()
+ {
+ jsonArtifactInfo.setAttribute("artifactName", "test");
+ }
+
+
+ @Test
+ public final void getArtifactDescription()
+ {
+ final String artifactDescription = jsonArtifactInfo.getArtifactDescription();
+ final String artifactName = jsonArtifactInfo.getArtifactName();
+ final String artifactChecksumfinal = jsonArtifactInfo.getArtifactChecksum();
+ final String artifactChecksum = jsonArtifactInfo.getArtifactChecksum();
+ final Integer artifactTimeout = jsonArtifactInfo.getArtifactTimeout();
+ final String artifactType = jsonArtifactInfo.getArtifactType();
+ final String artifactURL = jsonArtifactInfo.getArtifactURL();
+ final String artifactUUID = jsonArtifactInfo.getArtifactUUID();
+ final String artifactVersion = jsonArtifactInfo.getArtifactVersion();
+ jsonArtifactInfo.getGeneratedArtifact();
+ jsonArtifactInfo.getRelatedArtifacts();
+
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.asdc.client.test.emulators;
+
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class JsonNotificationDataTest {
+
+ @Test
+ public void setAttributeTest()
+ {
+ JsonNotificationData jsonNotificationData = new JsonNotificationData();
+ jsonNotificationData.setWorkloadContext("test");
+ jsonNotificationData.setAttribute("distributionID","test");
+ jsonNotificationData.setAttribute("workloadContext","test");
+ String getWorkloadContextVal = jsonNotificationData.getWorkloadContext();
+ assertEquals("test",getWorkloadContextVal);
+ }
+
+ @Test
+ public void getAttributeTest()
+ {
+ JsonNotificationData jsonNotificationData = new JsonNotificationData();
+ jsonNotificationData.setAttribute("workloadContext","test");;
+ jsonNotificationData.getArtifactMetadataByUUID("test");
+ jsonNotificationData.getDistributionID();
+ jsonNotificationData.getResources();
+ jsonNotificationData.getServiceArtifacts();
+ jsonNotificationData.getServiceDescription();
+ jsonNotificationData.getServiceInvariantUUID();
+ jsonNotificationData.getServiceName();
+ jsonNotificationData.getServiceUUID();
+ jsonNotificationData.getServiceVersion();
+ String getWorkloadContextVal = jsonNotificationData.getWorkloadContext();
+ assertEquals("test",getWorkloadContextVal);
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.asdc.client.test.emulators;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class JsonResourceInfoTest {
+
+
+ @Test
+ public void setAttributeTest()
+ {
+ JsonResourceInfo jsonResourceInfo = new JsonResourceInfo();
+ jsonResourceInfo.setAttribute("resourceInstanceName","resourceInstanceName");
+ String resourceInstanceName = jsonResourceInfo.getResourceInstanceName();
+ assertEquals(resourceInstanceName,"resourceInstanceName");
+ }
+
+ @Test
+ public void getAttributeTest()
+ {
+ JsonResourceInfo jsonResourceInfo = new JsonResourceInfo();
+ String resourceInstanceName = jsonResourceInfo.getResourceInstanceName();
+ assertEquals(resourceInstanceName,null);
+ }
+
+ @Test
+ public void getAttributeTestOthers()
+ {
+ JsonResourceInfo jsonResourceInfo = new JsonResourceInfo();
+ String resourceInvariantUUID = jsonResourceInfo.getResourceInvariantUUID();
+ jsonResourceInfo.getResourceName();
+ jsonResourceInfo.getResourceType();
+ jsonResourceInfo.getResourceUUID();
+ jsonResourceInfo.getResourceVersion();
+ jsonResourceInfo.getSubcategory();
+ jsonResourceInfo.getCategory();
+ jsonResourceInfo.getResourceCustomizationUUID();
+ jsonResourceInfo.getArtifacts();
+ assertEquals(resourceInvariantUUID,null);
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.asdc.client.test.emulators;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class JsonStatusDataTest {
+
+ @Test
+ public void instantiateNotifFromJsonFileTest() {
+ JsonStatusData jsonStatusData = new JsonStatusData();
+ JsonStatusData returnedVal = null;
+ try {
+ returnedVal = jsonStatusData.instantiateNotifFromJsonFile(jsonStatusData.getArtifactURL());
+ } catch (Exception ex) {
+
+ }
+ assertEquals(returnedVal, null);
+ }
+
+ @Test
+ public void setGetAttributes()
+ {
+ JsonStatusData jsonStatusData = new JsonStatusData();
+ jsonStatusData.setAttribute("test","test");
+ jsonStatusData.getStatus();
+ jsonStatusData.getTimestamp();
+ jsonStatusData.getComponentName();
+ jsonStatusData.getConsumerID();
+ jsonStatusData.getDistributionID();
+ String errReason = jsonStatusData.getErrorReason();
+ assertEquals(errReason,"MSO FAILURE");
+
+ }
+
+
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei 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.openecomp.mso.asdc.client.test.emulators;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class JsonVfModuleMetaDataTest {
+
+ @Test
+ public void setGetAttributeTest()
+ {
+ JsonVfModuleMetaData jsonVfModuleMetaDataTest = new JsonVfModuleMetaData();
+ jsonVfModuleMetaDataTest.setAttribute("vfModuleModelVersion",new String("test"));
+ jsonVfModuleMetaDataTest.setAttribute("isBase",new Boolean(true));
+ jsonVfModuleMetaDataTest.getArtifacts();
+ jsonVfModuleMetaDataTest.getProperties();
+ jsonVfModuleMetaDataTest.getVfModuleModelDescription();
+ jsonVfModuleMetaDataTest.getVfModuleModelInvariantUUID();
+ jsonVfModuleMetaDataTest.getVfModuleModelCustomizationUUID();
+ jsonVfModuleMetaDataTest.getVfModuleModelName();
+ jsonVfModuleMetaDataTest.getVfModuleModelUUID();
+ jsonVfModuleMetaDataTest.getVfModuleModelVersion();
+ Boolean baseVal = jsonVfModuleMetaDataTest.isBase();
+ assertEquals(baseVal, true);
+ }
+}
<properties>
<camunda.version>7.8.0</camunda.version>
<spring.version>4.3.2.RELEASE</spring.version>
- <httpclient.version>3.1</httpclient.version>
+ <httpclient.version>4.5.5</httpclient.version>
<jax.ws.rs>2.0.1</jax.ws.rs>
<jackson.version>1.1.1</jackson.version>
<maven.compiler.target>1.8</maven.compiler.target>
<artifactId>spring-test</artifactId>
<version>4.3.14.RELEASE</version>
</dependency>
- <dependency>
- <groupId>org.onap.sdc.sdc-tosca</groupId>
- <artifactId>sdc-tosca</artifactId>
- <version>1.3.3</version>
- </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.sdc-tosca</groupId>
+ <artifactId>sdc-tosca</artifactId>
+ <version>1.3.3</version>
+ <!-- sdc-tosca:1.3.3 depends on jtosca:1.3.4-SNAPSHOT,
+ which must be excluded, and the release version
+ of jtosca must be pulled in using an additional
+ dependency, below -->
+ <exclusions>
+ <exclusion>
+ <groupId>org.onap.sdc.jtosca</groupId>
+ <artifactId>jtosca</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.sdc.jtosca</groupId>
+ <artifactId>jtosca</artifactId>
+ <version>1.3.4</version>
+ </dependency>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-spring</artifactId>
<version>1.6.12</version>
</dependency>
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
+ <!-- bwj: duplicated one
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
+ -->
+ <!-- bwj: added -->
<dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${httpclient.version}</version>
+ <groupId>com.googlecode.libphonenumber</groupId>
+ <artifactId>libphonenumber</artifactId>
+ <version>8.9.1</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<dependency>
<groupId>org.onap.appc.client</groupId>
<artifactId>client-lib</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.onap.appc.client</groupId>
+++ /dev/null
-/*\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-package org.openecomp.mso.bpmn.common.scripts\r
-\r
-import org.camunda.bpm.engine.delegate.BpmnError\r
-import org.camunda.bpm.engine.delegate.DelegateExecution\r
-\r
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil\r
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil\r
-import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils\r
-import org.openecomp.mso.bpmn.core.domain.InventoryType\r
-import org.openecomp.mso.bpmn.core.domain.Resource\r
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition\r
-import org.openecomp.mso.bpmn.core.domain.Subscriber\r
-import org.openecomp.mso.bpmn.core.domain.VnfResource\r
-import org.openecomp.mso.bpmn.core.json.JsonUtils\r
-import org.openecomp.mso.rest.APIResponse\r
-import org.openecomp.mso.rest.RESTClient\r
-import org.openecomp.mso.rest.RESTConfig\r
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
-\r
-import org.json.JSONArray\r
-import org.json.JSONObject\r
-\r
-import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;\r
-\r
-/**\r
- * This class is contains the scripts used\r
- * by the Homing Subflow building block. The\r
- * subflow attempts to home the provided\r
- * resources by calling sniro.\r
- *\r
- * @author cb645j\r
- *\r
- */\r
-class Homing extends AbstractServiceTaskProcessor{\r
-\r
- ExceptionUtil exceptionUtil = new ExceptionUtil()\r
- JsonUtils jsonUtil = new JsonUtils()\r
- SNIROUtils sniroUtils = new SNIROUtils(this)\r
-\r
- /**\r
- * This method validates the incoming variables.\r
- * The method then prepares the sniro request\r
- * and posts it to sniro's rest api.\r
- *\r
- * @param execution\r
- *\r
- * @author cb645j\r
- */\r
- public void callSniro(DelegateExecution execution){\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- execution.setVariable("prefix","HOME_")\r
- utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled)\r
- try{\r
- execution.setVariable("rollbackData", null)\r
- execution.setVariable("rolledBack", false)\r
-\r
- String requestId = execution.getVariable("msoRequestId")\r
- utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)\r
- String serviceInstanceId = execution.getVariable("serviceInstanceId")\r
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)\r
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")\r
- utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)\r
- String subscriberInfo = execution.getVariable("subscriberInfo")\r
- utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)\r
-\r
- if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")\r
- }else{\r
- String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")\r
- String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")\r
- String subCommonSiteId = ""\r
- if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){\r
- subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")\r
- }\r
- Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId)\r
-\r
- String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used\r
- String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format\r
-\r
- //Authentication\r
- def authHeader = ""\r
- String basicAuth = execution.getVariable("URN_mso_sniro_auth")\r
- String msokey = execution.getVariable("URN_mso_msoKey")\r
- String basicAuthValue = utils.encrypt(basicAuth, msokey)\r
- if(basicAuthValue != null){\r
- utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled)\r
- try {\r
- authHeader = utils.getBasicAuth(basicAuthValue, msokey)\r
- execution.setVariable("BasicAuthHeaderValue",authHeader)\r
- } catch (Exception ex) {\r
- utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string")\r
- }\r
- }else{\r
- utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null" , isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null")\r
- }\r
-\r
- //Prepare Callback\r
- String timeout = execution.getVariable("timeout")\r
- if(isBlank(timeout)){\r
- timeout = execution.getVariable("URN_mso_sniro_timeout");\r
- if(isBlank(timeout)) {\r
- timeout = "PT30M";\r
- }\r
- }\r
- utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)\r
-\r
- execution.setVariable("timeout", timeout);\r
- execution.setVariable("correlator", requestId);\r
- execution.setVariable("messageType", "SNIROResponse");\r
-\r
- //Build Request & Call Sniro\r
- String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)\r
- execution.setVariable("sniroRequest", sniroRequest)\r
- utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled)\r
-\r
- String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint")\r
- String host = execution.getVariable("URN_mso_service_agnostic_sniro_host")\r
- String url = host + endpoint\r
- utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled)\r
-\r
- logDebug( "URL to be used is: " + url, isDebugEnabled)\r
-\r
- RESTConfig config = new RESTConfig(url);\r
- RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json")\r
- APIResponse response = client.httpPost(sniroRequest)\r
-\r
- int responseCode = response.getStatusCode()\r
- execution.setVariable("syncResponseCode", responseCode);\r
- logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled)\r
- String syncResponse = response.getResponseBodyAsString()\r
- execution.setVariable("syncResponse", syncResponse);\r
- logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled)\r
-\r
- utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled)\r
- }\r
- }catch(BpmnError b){\r
- throw b\r
- }catch(Exception e){\r
- utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())\r
- }\r
- }\r
-\r
- /**\r
- * This method processes the callback response\r
- * and the contained homing solution. It sets\r
- * homing solution assignment and license\r
- * information to the corresponding resources\r
- *\r
- * @param execution\r
- *\r
- * @author cb645j\r
- */\r
- public void processHomingSolution(DelegateExecution execution){\r
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
- utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)\r
- try{\r
- String response = execution.getVariable("asyncCallbackResponse")\r
- utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled)\r
- utils.logAudit("Sniro Async Callback Response is: " + response)\r
-\r
- sniroUtils.validateCallbackResponse(execution, response)\r
- String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")\r
-\r
- ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")\r
- utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)\r
-\r
- List<Resource> resourceList = decomposition.getServiceResources()\r
- JSONArray arr = new JSONArray(placements)\r
- for(int i = 0; i < arr.length(); i++){\r
- JSONObject placement = arr.getJSONObject(i)\r
- String jsonServiceResourceId = placement.getString("serviceResourceId")\r
- for(Resource resource:resourceList){\r
- String serviceResourceId = resource.getResourceId()\r
- if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){\r
- //match\r
- String inventoryType = placement.getString("inventoryType")\r
- resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))\r
- resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId"))\r
- resource.getHomingSolution().setRehome(placement.getBoolean("isRehome"))\r
- JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")\r
- Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue")\r
- resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))\r
- resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli"))\r
- resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion"))\r
- if(inventoryType.equalsIgnoreCase("service")){\r
- VnfResource vnf = new VnfResource()\r
- vnf.setVnfHostname(assignmentMap.get("vnfHostName"))\r
- resource.getHomingSolution().setVnf(vnf)\r
- resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"))\r
- }\r
- }\r
- }\r
- }\r
- if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){\r
- String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")\r
- JSONArray licenseArr = new JSONArray(licenseInfo)\r
- for(int l = 0; l < licenseArr.length(); l++){\r
- JSONObject license = licenseArr.getJSONObject(l)\r
- String jsonServiceResourceId = license.getString("serviceResourceId")\r
- for(Resource resource:resourceList){\r
- String serviceResourceId = resource.getResourceId()\r
- if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){\r
- //match\r
- String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList")\r
- List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)\r
- resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)\r
-\r
- String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList")\r
- List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)\r
- resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)\r
- }\r
- }\r
- }\r
- }\r
- execution.setVariable("serviceDecomposition", decomposition)\r
- execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable\r
-\r
- utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)\r
- }catch(BpmnError b){\r
- throw b\r
- }catch(Exception e){\r
- utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled)\r
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution")\r
- }\r
- }\r
-\r
- /**\r
- * This method logs the start of DHVCreateService\r
- * to make debugging easier.\r
- *\r
- * @param - execution\r
- * @author cb645j\r
- */\r
- public String logStart(DelegateExecution execution){\r
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
- String requestId = execution.getVariable("testReqId")\r
- if(isBlank(requestId)){\r
- requestId = execution.getVariable("msoRequestId")\r
- }\r
- execution.setVariable("DHVCS_requestId", requestId)\r
- utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")\r
- utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")\r
- utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")\r
- }\r
-\r
-\r
- /**\r
- * Auto-generated method stub\r
- */\r
- public void preProcessRequest(DelegateExecution execution){}\r
-\r
-}\r
--- /dev/null
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.domain.InventoryType
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.Subscriber
+import org.openecomp.mso.bpmn.core.domain.VnfResource
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+
+import org.json.JSONArray
+import org.json.JSONObject
+
+import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*
+
+/**
+ * This class contains the scripts used
+ * by the OOF Homing Subflow building block. The
+ * subflow attempts to home the provided
+ * resources by calling OOF.
+ */
+class OofHoming extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ OofUtils oofUtils = new OofUtils(this)
+
+ /**
+ * This method validates the incoming variables.
+ * The method then prepares the OOF request
+ * and posts it to OOF's rest api.
+ *
+ * @param execution
+ */
+ public void callOof(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix", "HOME_")
+ utils.log("DEBUG", "*** Started Homing Call OOF ***", isDebugEnabled)
+ try {
+ execution.setVariable("rollbackData", null)
+ execution.setVariable("rolledBack", false)
+
+ String requestId = execution.getVariable("msoRequestId")
+ utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)
+ String subscriberInfo = execution.getVariable("subscriberInfo")
+ utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)
+ Map customerLocation = execution.getVariable("customerLocation")
+ utils.log("DEBUG", "Incoming Customer Location is: " + customerLocation.toString(), isDebugEnabled)
+ String cloudOwner = execution.getVariable("cloudOwner")
+ utils.log("DEBUG", "Incoming cloudOwner is: " + cloudOwner, isDebugEnabled)
+ String cloudRegionId = execution.getVariable("cloudRegionId")
+ utils.log("DEBUG", "Incoming cloudRegionId is: " + cloudRegionId, isDebugEnabled)
+
+ if (isBlank(requestId) ||
+ isBlank(serviceInstanceId) ||
+ isBlank(serviceDecomposition.toString()) ||
+ isBlank(subscriberInfo) ||
+ isBlank(customerLocation.toString()) ||
+ isBlank(cloudOwner) ||
+ isBlank(cloudRegionId)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 4000,
+ "A required input variable is missing or null")
+ } else {
+ String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
+ String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
+ String subCommonSiteId = ""
+ if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) {
+ subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
+ }
+ Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId)
+
+ //Authentication
+ def authHeader = ""
+ String basicAuth = execution.getVariable("URN_mso_oof_auth")
+ String msokey = execution.getVariable("URN_mso_msoKey")
+ String basicAuthValue = utils.encrypt(basicAuth, msokey)
+ if (basicAuthValue != null) {
+ utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue,
+ isDebugEnabled)
+ try {
+ authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+ execution.setVariable("BasicAuthHeaderValue", authHeader)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
+ "encode username and password string")
+ }
+ } else {
+ utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
+ "value null")
+ }
+
+ //Prepare Callback
+ String timeout = execution.getVariable("timeout")
+ if (isBlank(timeout)) {
+ timeout = execution.getVariable("URN_mso_oof_timeout");
+ if (isBlank(timeout)) {
+ timeout = "PT30M"
+ }
+ }
+ utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)
+
+ execution.setVariable("timeout", timeout)
+ execution.setVariable("correlator", requestId)
+ execution.setVariable("messageType", "oofResponse")
+
+ //Build Request & Call OOF
+ String oofRequest = oofUtils.buildRequest(execution, requestId, serviceDecomposition,
+ subscriber, customerLocation)
+ execution.setVariable("oofRequest", oofRequest)
+ utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled)
+
+ String endpoint = execution.getVariable("URN_mso_service_agnostic_oof_endpoint")
+ String host = execution.getVariable("URN_mso_service_agnostic_oof_host")
+ String url = host + endpoint
+ utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled)
+
+ logDebug("URL to be used is: " + url, isDebugEnabled)
+
+ RESTConfig config = new RESTConfig(url)
+ RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).
+ addHeader("Content-Type", "application/json")
+ APIResponse response = client.httpPost(oofRequest)
+
+ int responseCode = response.getStatusCode()
+ execution.setVariable("syncResponseCode", responseCode)
+ logDebug("OOF sync response code is: " + responseCode, isDebugEnabled)
+ String syncResponse = response.getResponseBodyAsString()
+ execution.setVariable("syncResponse", syncResponse)
+ logDebug("OOF sync response is: " + syncResponse, isDebugEnabled)
+
+ utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled)
+ }
+ } catch (BpmnError b) {
+ throw b
+ } catch (Exception e) {
+ utils.log("DEBUG", "Error encountered within Homing callOof method: " + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Internal Error - Occured in Homing callOof: " + e.getMessage())
+ }
+ }
+
+ /**
+ * This method processes the callback response
+ * and the contained homing solution. It sets
+ * homing solution assignment and license
+ * information to the corresponding resources
+ *
+ * @param execution
+ */
+ public void processHomingSolution(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
+ try {
+ String response = execution.getVariable("asyncCallbackResponse")
+ utils.log("DEBUG", "OOF Async Callback Response is: " + response, isDebugEnabled)
+ utils.logAudit("OOF Async Callback Response is: " + response)
+
+ oofUtils.validateCallbackResponse(execution, response)
+ String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions")
+ utils.log("DEBUG", "****** Solution Placements: " + placements + " *****", isDebugEnabled)
+
+ ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
+ utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
+
+ List<Resource> resourceList = decomposition.getServiceResources()
+ JSONArray arr = new JSONArray(placements)
+ for (int i = 0; i < arr.length(); i++) {
+ JSONObject placement = arr.getJSONObject(i)
+ utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true")
+ String jsonServiceResourceId = placement.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ JSONObject solution = placement.getJSONObject("solution")
+ String solutionType = solution.getString("identifierType")
+ String inventoryType = ""
+ if (solutionType.equalsIgnoreCase("serviceInstanceId")) {
+ inventoryType = "service"
+ } else {
+ inventoryType = "cloud"
+
+ }
+ resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
+
+ // TODO Deal with Placement Solutions & Assignment Info here
+ JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
+ Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value")
+ resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
+ resource.getHomingSolution().setCloudRegionId(assignmentMap.get("cloudRegionId"))
+ if (inventoryType.equalsIgnoreCase("service")) {
+ resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean())
+ VnfResource vnf = new VnfResource()
+ vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ resource.getHomingSolution().setVnf(vnf)
+ resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
+ }
+ }
+ }
+ }
+ if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) {
+ String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions")
+ JSONArray licenseArr = new JSONArray(licenseSolutions)
+ for (int l = 0; l < licenseArr.length(); l++) {
+ JSONObject license = licenseArr.getJSONObject(l)
+ String jsonServiceResourceId = license.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID")
+ List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
+ resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
+
+ String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID")
+ List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
+ resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ }
+ }
+ }
+ }
+ execution.setVariable("serviceDecomposition", decomposition)
+ execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable
+
+ utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)
+ } catch (BpmnError b) {
+ throw b
+ } catch (Exception e) {
+ utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution")
+ }
+ }
+
+ /**
+ * This method logs the start of DHVCreateService
+ * to make debugging easier.
+ *
+ * @param - execution
+ */
+ public String logStart(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ String requestId = execution.getVariable("testReqId")
+ if (isBlank(requestId)) {
+ requestId = execution.getVariable("msoRequestId")
+ }
+ execution.setVariable("DHVCS_requestId", requestId)
+ utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")
+ utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")
+ utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
+ }
+
+ /**
+ * Auto-generated method stub
+ */
+ public void preProcessRequest(DelegateExecution execution) {}
+ // Not Implemented Method
+}
--- /dev/null
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.apache.commons.lang3.StringUtils
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.MsoUtils
+import org.openecomp.mso.bpmn.core.domain.HomingSolution
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance
+import org.openecomp.mso.bpmn.core.domain.Subscriber
+import org.openecomp.mso.bpmn.core.domain.VnfResource
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+
+import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*
+
+class OofUtils {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ private AbstractServiceTaskProcessor utils
+
+ public MsoUtils msoUtils = new MsoUtils()
+
+ public OofUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.utils = taskProcessor
+ }
+
+ /**
+ * This method builds the service-agnostic
+ * OOF json request to get a homing solution
+ * and license solution
+ *
+ * @param execution
+ * @param requestId
+ * @param decomposition - ServiceDecomposition object
+ * @param customerLocation -
+ * @param existingCandidates -
+ * @param excludedCandidates -
+ * @param requiredCandidates -
+ *
+ * @return request - OOF v1 payload - https://wiki.onap.org/pages/viewpage.action?pageId=25435066
+ */
+ String buildRequest(DelegateExecution execution,
+ String requestId,
+ ServiceDecomposition decomposition,
+ Subscriber subscriber,
+ Map customerLocation,
+ ArrayList existingCandidates = null,
+ ArrayList excludedCandidates = null,
+ ArrayList requiredCandidates = null) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled)
+ def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "oofResponse", requestId)
+ def transactionId = requestId
+ //ServiceInstance Info
+ ServiceInstance serviceInstance = decomposition.getServiceInstance()
+ def serviceInstanceId = ""
+ def serviceInstanceName = ""
+ if (serviceInstance == null) {
+ utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
+ "obtain Service Instance Id, ServiceInstance Object is null")
+ } else {
+ serviceInstanceId = serviceInstance.getInstanceId()
+ serviceInstanceName = serviceInstance.getInstanceName()
+ }
+ //Model Info
+ ModelInfo model = decomposition.getModelInfo()
+ String modelType = model.getModelType()
+ String modelInvariantId = model.getModelInvariantUuid()
+ String modelVersionId = model.getModelUuid()
+ String modelName = model.getModelName()
+ String modelVersion = model.getModelVersion()
+ //Subscriber Info
+ String subscriberId = subscriber.getGlobalId()
+ String subscriberName = subscriber.getName()
+ String commonSiteId = subscriber.getCommonSiteId()
+
+ //Determine RequestType
+ //TODO Figure out better way to determine this
+ String requestType = "create"
+ List<Resource> resources = decomposition.getServiceResources()
+ for(Resource r:resources){
+ HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution()
+ if(currentSolution != null){
+ requestType = "speed changed"
+ }
+ }
+
+ //Demands
+ String placementDemands = ""
+ StringBuilder sb = new StringBuilder()
+ List<Resource> resourceList = decomposition.getServiceAllottedResources()
+ List<VnfResource> vnfResourceList = decomposition.getServiceVnfs()
+
+ if (resourceList.isEmpty() || resourceList == null) {
+ utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.",
+ isDebugEnabled)
+ resourceList = decomposition.getServiceVnfs()
+ }
+
+ if (resourceList.isEmpty() || resourceList == null) {
+ utils.log("DEBUG", "Resources List is Empty", isDebugEnabled)
+ } else {
+ for (Resource resource : resourceList) {
+ ModelInfo resourceModelInfo = resource.getModelInfo()
+ def serviceResourceId = resource.getResourceId()
+ def resourceModuleName = resource.getResourceType()
+ def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid()
+ def resouceModelName = resourceModelInfo.getModelName()
+ def resouceModelVersion = resourceModelInfo.getModelVersion()
+ def resouceModelVersionId = resourceModelInfo.getModelUuid()
+ def resouceModelType = resourceModelInfo.getModelType()
+ def tenantId = execution.getTenantId()
+ def requiredCandidatesJson = ""
+
+ requiredCandidatesJson = createCandidateJson(
+ existingCandidates,
+ excludedCandidates,
+ requiredCandidates)
+
+ String demand =
+ "{\n" +
+ "\"resourceModuleName\": \"${resourceModuleName}\",\n" +
+ "\"serviceResourceId\": \"${serviceResourceId}\",\n" +
+ "\"tenantId\": \"${tenantId}\",\n" +
+ "\"resourceModelInfo\": {\n" +
+ " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" +
+ " \"modelVersionId\": \"${resouceModelVersionId}\",\n" +
+ " \"modelName\": \"${resouceModelName}\",\n" +
+ " \"modelType\": \"${resouceModelType}\",\n" +
+ " \"modelVersion\": \"${resouceModelVersion}\",\n" +
+ " \"modelCustomizationName\": \"\"\n" +
+ " }" + requiredCandidatesJson + "\n" +
+ "},"
+
+ placementDemands = sb.append(demand)
+ }
+ placementDemands = placementDemands.substring(0, placementDemands.length() - 1)
+ }
+
+ String licenseDemands = ""
+ sb = new StringBuilder()
+ if (vnfResourceList.isEmpty() || vnfResourceList == null) {
+ utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled)
+ } else {
+ for (VnfResource vnfResource : vnfResourceList) {
+ ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
+ def resourceInstanceType = vnfResource.getResourceType()
+ def serviceResourceId = vnfResource.getResourceId()
+ def resourceModuleName = vnfResource.getResourceType()
+ def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid()
+ def resouceModelName = vnfResourceModelInfo.getModelName()
+ def resouceModelVersion = vnfResourceModelInfo.getModelVersion()
+ def resouceModelVersionId = vnfResourceModelInfo.getModelUuid()
+ def resouceModelType = vnfResourceModelInfo.getModelType()
+
+ // TODO Add Existing Licenses to demand
+ //"existingLicenses": {
+ //"entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b",
+ // "43257b49-9602-4fe5-9337-094e52bc9435"],
+ //"licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b",
+ // "43257b49-9602-4fe5-9337-094e52bc9435"]
+ //}
+
+ String licenseDemand =
+ "{\n" +
+ "\"resourceModuleName\": \"${resourceModuleName}\",\n" +
+ "\"serviceResourceId\": \"${serviceResourceId}\",\n" +
+ "\"resourceInstanceType\": \"${resourceInstanceType}\",\n" +
+ "\"resourceModelInfo\": {\n" +
+ " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" +
+ " \"modelVersionId\": \"${resouceModelVersionId}\",\n" +
+ " \"modelName\": \"${resouceModelName}\",\n" +
+ " \"modelType\": \"${resouceModelType}\",\n" +
+ " \"modelVersion\": \"${resouceModelVersion}\",\n" +
+ " \"modelCustomizationName\": \"\"\n" +
+ " }\n"
+ "},"
+
+ licenseDemands = sb.append(licenseDemand)
+ }
+ licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1)
+ }
+
+ String request =
+ "{\n" +
+ " \"requestInfo\": {\n" +
+ " \"transactionId\": \"${transactionId}\",\n" +
+ " \"requestId\": \"${requestId}\",\n" +
+ " \"callbackUrl\": \"${callbackUrl}\",\n" +
+ " \"sourceId\": \"so\",\n" +
+ " \"requestType\": \"${requestType}\"," +
+ " \"numSolutions\": 1,\n" +
+ " \"optimizers\": [\"placement\"],\n" +
+ " \"timeout\": 600\n" +
+ " },\n" +
+ " \"placementInfo\": {\n" +
+ " \"requestParameters\": {\n" +
+ " \"customerLatitude\": \"${customerLocation.customerLatitude}\",\n" +
+ " \"customerLongitude\": \"${customerLocation.customerLongitude}\",\n" +
+ " \"customerName\": \"${customerLocation.customerName}\"\n" +
+ " }," +
+ " \"subscriberInfo\": { \n" +
+ " \"globalSubscriberId\": \"${subscriberId}\",\n" +
+ " \"subscriberName\": \"${subscriberName}\",\n" +
+ " \"subscriberCommonSiteId\": \"${commonSiteId}\"\n" +
+ " },\n" +
+ " \"placementDemands\": [\n" +
+ " ${placementDemands}\n" +
+ " ]\n" +
+ " },\n" +
+ " \"serviceInfo\": {\n" +
+ " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" +
+ " \"serviceName\": \"${serviceInstanceName}\",\n" +
+ " \"modelInfo\": {\n" +
+ " \"modelType\": \"${modelType}\",\n" +
+ " \"modelInvariantId\": \"${modelInvariantId}\",\n" +
+ " \"modelVersionId\": \"${modelVersionId}\",\n" +
+ " \"modelName\": \"${modelName}\",\n" +
+ " \"modelVersion\": \"${modelVersion}\",\n" +
+ " \"modelCustomizationName\": \"\"\n" +
+ " }\n" +
+ " },\n" +
+ " \"licenseInfo\": {\n" +
+ " \"licenseDemands\": [\n" +
+ " ${licenseDemands}\n" +
+ " }]\n" +
+ " }\n" +
+ "}"
+
+
+ utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled)
+ return request
+ }
+
+ /**
+ * This method validates the callback response
+ * from OOF. If the response contains an
+ * exception the method will build and throw
+ * a workflow exception.
+ *
+ * @param execution
+ * @param response - the async callback response from oof
+ */
+ Void validateCallbackResponse(DelegateExecution execution, String response) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ String placements = ""
+ if (isBlank(response)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "OOF Async Callback Response is Empty")
+ } else {
+ if (JsonUtils.jsonElementExist(response, "solutions.placementSolutions")) {
+ placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions")
+ if (isBlank(placements) || placements.equalsIgnoreCase("[]")) {
+ String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
+ if (isBlank(statusMessage)) {
+ utils.log("DEBUG", "Error Occurred in Homing: OOF Async Callback Response does " +
+ "not contain placement solution.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400,
+ "OOF Async Callback Response does not contain placement solution.")
+ } else {
+ utils.log("DEBUG", "Error Occurred in Homing: " + statusMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage)
+ }
+ } else {
+ return
+ }
+ } else if (JsonUtils.jsonElementExist(response, "requestError") == true) {
+ String errorMessage = ""
+ if (response.contains("policyException")) {
+ String text = jsonUtil.getJsonValue(response, "requestError.policyException.text")
+ errorMessage = "OOF Async Callback Response contains a Request Error Policy Exception: " + text
+ } else if (response.contains("serviceException")) {
+ String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text")
+ errorMessage = "OOF Async Callback Response contains a Request Error Service Exception: " + text
+ } else {
+ errorMessage = "OOF Async Callback Response contains a Request Error. Unable to determine the Request Error Exception."
+ }
+ utils.log("DEBUG", "Error Occurred in Homing: " + errorMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
+
+ } else {
+ utils.log("DEBUG", "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from OOF.")
+ }
+ }
+
+ }
+
+ /**
+ * This method creates candidates json for placement Demands.
+ *
+ * @param execution
+ * @param existingCandidates -
+ * @param excludedCandidates -
+ * @param requiredCandidates -
+ *
+ * @return candidatesJson - a JSON string with candidates
+ */
+ String createCandidateJson(ArrayList existingCandidates = null,
+ ArrayList excludedCandidates = null,
+ ArrayList requiredCandidates = null) {
+ def candidatesJson = ""
+ def type = ""
+ if (existingCandidates != null && existingCandidates != {}) {
+ sb = new StringBuilder()
+ sb.append(",\n" +
+ " \"existingCandidates\": [\n")
+ def existingCandidateJson = ""
+ existingCandidates.each {
+ type = existingCandidate.get('identifierType')
+ if (type == 'vimId') {
+ def cloudOwner = existingCandidate.get('cloudOwner')
+ def cloudRegionId = existingCandidate.get('identifiers')
+ existingCandidateJson = "{\n" +
+ " \"identifierType\": \"vimId\",\n" +
+ " \"cloudOwner\": \"${cloudOwner}\",\n" +
+ " \"identifiers\": [\"${cloudRegionId}\"]\n" +
+ " },"
+ sb.append(existingCandidateJson)
+ }
+ if (type == 'serviceInstanceId') {
+ def serviceInstanceId = existingCandidate.get('identifiers')
+ existingCandidateJson += "{\n" +
+ " \"identifierType\": \"serviceInstanceId\",\n" +
+ " \"identifiers\": [\"${serviceInstanceId}\"]\n" +
+ " },"
+ sb.append(existingCandidateJson)
+ }
+ }
+ if (existingCandidateJson != "") {
+ sb.setLength(sb.length() - 1)
+ candidatesJson = sb.append(",\n],")
+ }
+ }
+ if (excludedCandidates != null && excludedCandidates != {}) {
+ sb = new StringBuilder()
+ sb.append(",\n" +
+ " \"excludedCandidates\": [\n")
+ def excludedCandidateJson = ""
+ excludedCandidates.each {
+ type = excludedCandidate.get('identifierType')
+ if (type == 'vimId') {
+ def cloudOwner = excludedCandidate.get('cloudOwner')
+ def cloudRegionId = excludedCandidate.get('identifiers')
+ excludedCandidateJson = "{\n" +
+ " \"identifierType\": \"vimId\",\n" +
+ " \"cloudOwner\": \"${cloudOwner}\",\n" +
+ " \"identifiers\": [\"${cloudRegionId}\"]\n" +
+ " },"
+ sb.append(excludedCandidateJson)
+ }
+ if (type == 'serviceInstanceId') {
+ def serviceInstanceId = excludedCandidate.get('identifiers')
+ excludedCandidateJson += "{\n" +
+ " \"identifierType\": \"serviceInstanceId\",\n" +
+ " \"identifiers\": [\"${serviceInstanceId}\"]\n" +
+ " },"
+ sb.append(excludedCandidateJson)
+ }
+ }
+ if (excludedCandidateJson != "") {
+ sb.setLength(sb.length() - 1)
+ candidatesJson = sb.append(",\n],")
+ }
+ }
+ if (requiredCandidates != null && requiredCandidates != {}) {
+ sb = new StringBuilder()
+ sb.append(",\n" +
+ " \"requiredCandidates\": [\n")
+ def requiredCandidatesJson = ""
+ requiredCandidates.each {
+ type = requiredCandidate.get('identifierType')
+ if (type == 'vimId') {
+ def cloudOwner = requiredCandidate.get('cloudOwner')
+ def cloudRegionId = requiredCandidate.get('identifiers')
+ requiredCandidatesJson = "{\n" +
+ " \"identifierType\": \"vimId\",\n" +
+ " \"cloudOwner\": \"${cloudOwner}\",\n" +
+ " \"identifiers\": [\"${cloudRegionId}\"]\n" +
+ " },"
+ sb.append(requiredCandidatesJson)
+ }
+ if (type == 'serviceInstanceId') {
+ def serviceInstanceId = requiredCandidate.get('identifiers')
+ requiredCandidatesJson += "{\n" +
+ " \"identifierType\": \"serviceInstanceId\",\n" +
+ " \"identifiers\": [\"${serviceInstanceId}\"]\n" +
+ " },"
+ sb.append(requiredCandidatesJson)
+ }
+ }
+ if (requiredCandidatesJson != "") {
+ sb.setLength(sb.length() - 1)
+ candidatesJson = sb.append(",\n],")
+ }
+ }
+ if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)}
+ return candidatesJson
+ }
+}
\ No newline at end of file
String requestType = "initial"\r
List<Resource> resources = decomposition.getServiceResources()\r
for(Resource r:resources){\r
- HomingSolution currentSolution = r.getCurrentHomingSolution()\r
+ HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution()\r
if(currentSolution != null){\r
requestType = "speed changed"\r
}\r
--- /dev/null
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.domain.InventoryType
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.Subscriber
+import org.openecomp.mso.bpmn.core.domain.VnfResource
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+
+import org.json.JSONArray
+import org.json.JSONObject
+
+import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;
+
+/**
+ * This class is contains the scripts used
+ * by the Homing Subflow building block. The
+ * subflow attempts to home the provided
+ * resources by calling sniro.
+ *
+ * @author cb645j
+ *
+ */
+class SniroHoming extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ SNIROUtils sniroUtils = new SNIROUtils(this)
+
+ /**
+ * This method validates the incoming variables.
+ * The method then prepares the sniro request
+ * and posts it to sniro's rest api.
+ *
+ * @param execution
+ *
+ * @author cb645j
+ */
+ public void callSniro(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix", "HOME_")
+ utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled)
+ try {
+ execution.setVariable("rollbackData", null)
+ execution.setVariable("rolledBack", false)
+
+ String requestId = execution.getVariable("msoRequestId")
+ utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)
+ String subscriberInfo = execution.getVariable("subscriberInfo")
+ utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)
+
+ if (isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")
+ } else {
+ String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
+ String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
+ String subCommonSiteId = ""
+ if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) {
+ subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
+ }
+ Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId)
+
+ String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used
+ String homingParameters = execution.getVariable("homingParameters")
+ // (aka. request parameters) Should be json format. TODO confirm its json format
+
+ //Authentication
+ def authHeader = ""
+ String basicAuth = execution.getVariable("URN_mso_sniro_auth")
+ String msokey = execution.getVariable("URN_mso_msoKey")
+ String basicAuthValue = utils.encrypt(basicAuth, msokey)
+ if (basicAuthValue != null) {
+ utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled)
+ try {
+ authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+ execution.setVariable("BasicAuthHeaderValue", authHeader)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string")
+ }
+ } else {
+ utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null")
+ }
+
+ //Prepare Callback
+ String timeout = execution.getVariable("timeout")
+ if (isBlank(timeout)) {
+ timeout = execution.getVariable("URN_mso_sniro_timeout");
+ if (isBlank(timeout)) {
+ timeout = "PT30M";
+ }
+ }
+ utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)
+
+ execution.setVariable("timeout", timeout);
+ execution.setVariable("correlator", requestId);
+ execution.setVariable("messageType", "SNIROResponse");
+
+ //Build Request & Call Sniro
+ String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)
+ execution.setVariable("sniroRequest", sniroRequest)
+ utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled)
+
+ String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint")
+ String host = execution.getVariable("URN_mso_service_agnostic_sniro_host")
+ String url = host + endpoint
+ utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled)
+
+ logDebug("URL to be used is: " + url, isDebugEnabled)
+
+ RESTConfig config = new RESTConfig(url)
+ RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json")
+ APIResponse response = client.httpPost(sniroRequest)
+
+ int responseCode = response.getStatusCode()
+ execution.setVariable("syncResponseCode", responseCode);
+ logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled)
+ String syncResponse = response.getResponseBodyAsString()
+ execution.setVariable("syncResponse", syncResponse);
+ logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled)
+
+ utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled)
+ }
+ } catch (BpmnError b) {
+ throw b
+ } catch (Exception e) {
+ utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
+ }
+ }
+
+ /**
+ * This method processes the callback response
+ * and the contained homing solution. It sets
+ * homing solution assignment and license
+ * information to the corresponding resources
+ *
+ * @param execution
+ *
+ * @author cb645j
+ */
+ public void processHomingSolution(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
+ try {
+ String response = execution.getVariable("asyncCallbackResponse")
+ utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled)
+ utils.logAudit("Sniro Async Callback Response is: " + response)
+
+ sniroUtils.validateCallbackResponse(execution, response)
+ String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
+
+ ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
+ utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
+
+ List<Resource> resourceList = decomposition.getServiceResources()
+ JSONArray arr = new JSONArray(placements)
+ for (int i = 0; i < arr.length(); i++) {
+ JSONObject placement = arr.getJSONObject(i)
+ String jsonServiceResourceId = placement.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ //match
+ String inventoryType = placement.getString("inventoryType")
+ resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
+ resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId"))
+ resource.getHomingSolution().setRehome(placement.getBoolean("isRehome"))
+ JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
+ Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue")
+ resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
+ resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli"))
+ resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion"))
+ if (inventoryType.equalsIgnoreCase("service")) {
+ VnfResource vnf = new VnfResource()
+ vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ resource.getHomingSolution().setVnf(vnf)
+ resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"))
+ }
+ }
+ }
+ }
+ if (JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")) {
+ String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")
+ JSONArray licenseArr = new JSONArray(licenseInfo)
+ for (int l = 0; l < licenseArr.length(); l++) {
+ JSONObject license = licenseArr.getJSONObject(l)
+ String jsonServiceResourceId = license.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ //match
+ String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList")
+ List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
+ resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
+
+ String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList")
+ List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
+ resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ }
+ }
+ }
+ }
+ execution.setVariable("serviceDecomposition", decomposition)
+ execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable
+
+ utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)
+ } catch (BpmnError b) {
+ throw b
+ } catch (Exception e) {
+ utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution")
+ }
+ }
+
+ /**
+ * This method logs the start of DHVCreateService
+ * to make debugging easier.
+ *
+ * @param - execution
+ * @author cb645j
+ */
+ public String logStart(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ String requestId = execution.getVariable("testReqId")
+ if (isBlank(requestId)) {
+ requestId = execution.getVariable("msoRequestId")
+ }
+ execution.setVariable("DHVCS_requestId", requestId)
+ utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")
+ utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")
+ utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
+ }
+
+ /**
+ * Auto-generated method stub
+ */
+ public void preProcessRequest(DelegateExecution execution) {}
+
+}
-<?xml version="1.0" encoding="UTF-8"?>\r
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">\r
- <bpmn2:process id="Homing" name="Homing" isExecutable="true">\r
- <bpmn2:startEvent id="StartEvent_1">\r
- <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing>\r
- </bpmn2:startEvent>\r
- <bpmn2:scriptTask id="callSniro" name="Call Sniro" scriptFormat="groovy">\r
- <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming>\r
- <bpmn2:outgoing>SequenceFlow_10x3ocp</bpmn2:outgoing>\r
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*\r
-Homing sniro = new Homing()\r
-sniro.callSniro(execution)]]></bpmn2:script>\r
- </bpmn2:scriptTask>\r
- <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" />\r
- <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true">\r
- <bpmn2:endEvent id="EndEvent_07tjq3v">\r
- <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming>\r
- <bpmn2:terminateEventDefinition />\r
- </bpmn2:endEvent>\r
- <bpmn2:startEvent id="StartEvent_1qiitb2">\r
- <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing>\r
- <bpmn2:errorEventDefinition />\r
- </bpmn2:startEvent>\r
- <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy">\r
- <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming>\r
- <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing>\r
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*\r
-ExceptionUtil ex = new ExceptionUtil()\r
-ex.processSubflowsBPMNException(execution)]]></bpmn2:script>\r
- </bpmn2:scriptTask>\r
- <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" />\r
- <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" />\r
- </bpmn2:subProcess>\r
- <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true">\r
- <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy">\r
- <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming>\r
- <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing>\r
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*\r
-ExceptionUtil ex = new ExceptionUtil()\r
-ex.processJavaException(execution)]]></bpmn2:script>\r
- </bpmn2:scriptTask>\r
- <bpmn2:startEvent id="StartEvent_1fbpeuw">\r
- <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing>\r
- <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" />\r
- </bpmn2:startEvent>\r
- <bpmn2:endEvent id="EndEvent_0jbvnr0">\r
- <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming>\r
- <bpmn2:terminateEventDefinition />\r
- </bpmn2:endEvent>\r
- <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" />\r
- <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" />\r
- </bpmn2:subProcess>\r
- <bpmn2:scriptTask id="processHomingSolution" name="Process Solution " scriptFormat="groovy">\r
- <bpmn2:incoming>SequenceFlow_043r3j8</bpmn2:incoming>\r
- <bpmn2:outgoing>SequenceFlow_1h9opg9</bpmn2:outgoing>\r
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*\r
-Homing homing = new Homing()\r
-homing.processHomingSolution(execution)]]></bpmn2:script>\r
- </bpmn2:scriptTask>\r
- <bpmn2:exclusiveGateway id="responseCheck" name="Response Ok?" default="badResponse">\r
- <bpmn2:incoming>SequenceFlow_10x3ocp</bpmn2:incoming>\r
- <bpmn2:outgoing>badResponse</bpmn2:outgoing>\r
- <bpmn2:outgoing>goodResponse</bpmn2:outgoing>\r
- </bpmn2:exclusiveGateway>\r
- <bpmn2:sequenceFlow id="SequenceFlow_10x3ocp" sourceRef="callSniro" targetRef="responseCheck" />\r
- <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy">\r
- <bpmn2:incoming>badResponse</bpmn2:incoming>\r
- <bpmn2:outgoing>SequenceFlow_0clfkld</bpmn2:outgoing>\r
- <bpmn2:script><![CDATA[int responseCode = execution.getVariable("syncResponseCode") \r
-\r
-import org.openecomp.mso.bpmn.common.scripts.*\r
-ExceptionUtil ex = new ExceptionUtil()\r
-ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")]]></bpmn2:script>\r
- </bpmn2:scriptTask>\r
- <bpmn2:sequenceFlow id="badResponse" name="No" sourceRef="responseCheck" targetRef="assignError" />\r
- <bpmn2:sequenceFlow id="SequenceFlow_0clfkld" sourceRef="assignError" targetRef="throwMSOWorkflowException" />\r
- <bpmn2:endEvent id="throwMSOWorkflowException">\r
- <bpmn2:incoming>SequenceFlow_0clfkld</bpmn2:incoming>\r
- <bpmn2:errorEventDefinition errorRef="Error_10hit0u" />\r
- </bpmn2:endEvent>\r
- <bpmn2:sequenceFlow id="goodResponse" name="Yes" sourceRef="responseCheck" targetRef="receiveAsyncCallback">\r
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("syncResponseCode") == 202}]]></bpmn2:conditionExpression>\r
- </bpmn2:sequenceFlow>\r
- <bpmn2:sequenceFlow id="SequenceFlow_043r3j8" sourceRef="receiveAsyncCallback" targetRef="processHomingSolution" />\r
- <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" calledElement="ReceiveWorkflowMessage" camunda:modelerTemplate="receiveWorkflowMessage">\r
- <bpmn2:extensionElements>\r
- <camunda:in source="true" target="isDebugLogEnabled" />\r
- <camunda:out source="WorkflowException" target="WorkflowException" />\r
- <camunda:in source="messageType" target="RCVWFMSG_messageType" />\r
- <camunda:in source="correlator" target="RCVWFMSG_correlator" />\r
- <camunda:in source="timeout" target="RCVWFMSG_timeout" />\r
- <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" />\r
- </bpmn2:extensionElements>\r
- <bpmn2:incoming>goodResponse</bpmn2:incoming>\r
- <bpmn2:outgoing>SequenceFlow_043r3j8</bpmn2:outgoing>\r
- </bpmn2:callActivity>\r
- <bpmn2:sequenceFlow id="SequenceFlow_1h9opg9" sourceRef="processHomingSolution" targetRef="EndEvent_0n56tas" />\r
- <bpmn2:endEvent id="EndEvent_0n56tas">\r
- <bpmn2:incoming>SequenceFlow_1h9opg9</bpmn2:incoming>\r
- <bpmn2:terminateEventDefinition />\r
- </bpmn2:endEvent>\r
- </bpmn2:process>\r
- <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />\r
- <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" />\r
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">\r
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing">\r
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">\r
- <dc:Bounds x="147" y="275" width="36" height="36" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro">\r
- <dc:Bounds x="286" y="253" width="100" height="80" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6">\r
- <di:waypoint xsi:type="dc:Point" x="183" y="293" />\r
- <di:waypoint xsi:type="dc:Point" x="286" y="293" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="235" y="278" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true">\r
- <dc:Bounds x="254" y="496" width="409" height="168" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true">\r
- <dc:Bounds x="284" y="679" width="350" height="159" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v">\r
- <dc:Bounds x="579" y="570" width="36" height="36" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="597" y="611" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2">\r
- <dc:Bounds x="299" y="570" width="36" height="36" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="317" y="611" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException">\r
- <dc:Bounds x="406" y="548" width="100" height="80" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException">\r
- <dc:Bounds x="410" y="727" width="100" height="80" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw">\r
- <dc:Bounds x="318" y="749" width="36" height="36" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="336" y="790" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0">\r
- <dc:Bounds x="567" y="749" width="36" height="36" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="585" y="790" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8">\r
- <di:waypoint xsi:type="dc:Point" x="506" y="588" />\r
- <di:waypoint xsi:type="dc:Point" x="579" y="588" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="543" y="573" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l">\r
- <di:waypoint xsi:type="dc:Point" x="335" y="588" />\r
- <di:waypoint xsi:type="dc:Point" x="363" y="588" />\r
- <di:waypoint xsi:type="dc:Point" x="363" y="588" />\r
- <di:waypoint xsi:type="dc:Point" x="406" y="588" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="378" y="588" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53">\r
- <di:waypoint xsi:type="dc:Point" x="354" y="767" />\r
- <di:waypoint xsi:type="dc:Point" x="410" y="767" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="382" y="752" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s">\r
- <di:waypoint xsi:type="dc:Point" x="510" y="767" />\r
- <di:waypoint xsi:type="dc:Point" x="567" y="767" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="539" y="752" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processHomingSolution">\r
- <dc:Bounds x="630" y="325" width="100" height="80" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNShape id="ExclusiveGateway_03gt5b8_di" bpmnElement="responseCheck" isMarkerVisible="true">\r
- <dc:Bounds x="419" y="268" width="50" height="50" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="474" y="287" width="74" height="12" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNEdge id="SequenceFlow_10x3ocp_di" bpmnElement="SequenceFlow_10x3ocp">\r
- <di:waypoint xsi:type="dc:Point" x="386" y="293" />\r
- <di:waypoint xsi:type="dc:Point" x="419" y="293" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="403" y="278" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNShape id="ScriptTask_0ikcqeo_di" bpmnElement="assignError">\r
- <dc:Bounds x="490" y="176" width="100" height="80" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNEdge id="SequenceFlow_1m1c9nu_di" bpmnElement="badResponse">\r
- <di:waypoint xsi:type="dc:Point" x="444" y="268" />\r
- <di:waypoint xsi:type="dc:Point" x="444" y="216" />\r
- <di:waypoint xsi:type="dc:Point" x="490" y="216" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="451" y="226" width="14" height="12" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNEdge id="SequenceFlow_0clfkld_di" bpmnElement="SequenceFlow_0clfkld">\r
- <di:waypoint xsi:type="dc:Point" x="590" y="216" />\r
- <di:waypoint xsi:type="dc:Point" x="662" y="216" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="626" y="201" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNShape id="EndEvent_13ejfwp_di" bpmnElement="throwMSOWorkflowException">\r
- <dc:Bounds x="662" y="198" width="36" height="36" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="680" y="234" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNEdge id="SequenceFlow_1o3br3u_di" bpmnElement="goodResponse">\r
- <di:waypoint xsi:type="dc:Point" x="444" y="318" />\r
- <di:waypoint xsi:type="dc:Point" x="444" y="365" />\r
- <di:waypoint xsi:type="dc:Point" x="490" y="365" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="447" y="339.5" width="18" height="12" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNEdge id="SequenceFlow_043r3j8_di" bpmnElement="SequenceFlow_043r3j8">\r
- <di:waypoint xsi:type="dc:Point" x="590" y="365" />\r
- <di:waypoint xsi:type="dc:Point" x="630" y="365" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="610" y="350" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback">\r
- <dc:Bounds x="490" y="325" width="100" height="80" />\r
- </bpmndi:BPMNShape>\r
- <bpmndi:BPMNEdge id="SequenceFlow_1h9opg9_di" bpmnElement="SequenceFlow_1h9opg9">\r
- <di:waypoint xsi:type="dc:Point" x="730" y="365" />\r
- <di:waypoint xsi:type="dc:Point" x="825" y="365" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="778" y="350" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNEdge>\r
- <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas">\r
- <dc:Bounds x="825" y="347" width="36" height="36" />\r
- <bpmndi:BPMNLabel>\r
- <dc:Bounds x="843" y="383" width="0" height="0" />\r
- </bpmndi:BPMNLabel>\r
- </bpmndi:BPMNShape>\r
- </bpmndi:BPMNPlane>\r
- </bpmndi:BPMNDiagram>\r
-</bpmn2:definitions>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="Homing" name="Homing" isExecutable="true">
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:scriptTask id="callSniro" name="Call Sniro" scriptFormat="groovy">
+ <bpmn2:incoming>sniroCall</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0gajic6</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+SniroHoming homing = new SniroHoming()
+homing.callSniro(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="homingSolutionCheck" />
+ <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true">
+ <bpmn2:endEvent id="EndEvent_07tjq3v">
+ <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition />
+ </bpmn2:endEvent>
+ <bpmn2:startEvent id="StartEvent_1qiitb2">
+ <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition />
+ </bpmn2:startEvent>
+ <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" />
+ <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" />
+ </bpmn2:subProcess>
+ <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true">
+ <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:startEvent id="StartEvent_1fbpeuw">
+ <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" />
+ </bpmn2:startEvent>
+ <bpmn2:endEvent id="EndEvent_0jbvnr0">
+ <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition />
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" />
+ </bpmn2:subProcess>
+ <bpmn2:scriptTask id="processSniroHomingSolution" name="Process Sniro Homing Solution " scriptFormat="groovy">
+ <bpmn2:incoming>sniroProcess</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1h9opg9</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+SniroHoming homing = new SniroHoming()
+homing.processHomingSolution(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:exclusiveGateway id="responseCheck" name="Response Ok?" default="badResponse">
+ <bpmn2:incoming>SequenceFlow_12t0lqb</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0gajic6</bpmn2:incoming>
+ <bpmn2:outgoing>badResponse</bpmn2:outgoing>
+ <bpmn2:outgoing>goodResponse</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy">
+ <bpmn2:incoming>badResponse</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0clfkld</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[int responseCode = execution.getVariable("syncResponseCode")
+
+import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro/OOF.")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="badResponse" name="No" sourceRef="responseCheck" targetRef="assignError" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0clfkld" sourceRef="assignError" targetRef="throwMSOWorkflowException2" />
+ <bpmn2:endEvent id="throwMSOWorkflowException2">
+ <bpmn2:incoming>SequenceFlow_0clfkld</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_10hit0u" />
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="goodResponse" name="Yes" sourceRef="responseCheck" targetRef="receiveAsyncCallback">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("syncResponseCode") == 202}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage">
+ <bpmn2:extensionElements>
+ <camunda:in source="true" target="isDebugLogEnabled" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="messageType" target="RCVWFMSG_messageType" />
+ <camunda:in source="correlator" target="RCVWFMSG_correlator" />
+ <camunda:in source="timeout" target="RCVWFMSG_timeout" />
+ <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>goodResponse</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1fipbmk</bpmn2:outgoing>
+ </bpmn2:callActivity>
+ <bpmn2:sequenceFlow id="SequenceFlow_1h9opg9" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0n56tas" />
+ <bpmn2:endEvent id="EndEvent_0n56tas">
+ <bpmn2:incoming>SequenceFlow_1h9opg9</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_07u9d7f</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition />
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="homingSolutionCheck" name="Which homing Solution?" default="SequenceFlow_02eywxz">
+ <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming>
+ <bpmn2:outgoing>sniroCall</bpmn2:outgoing>
+ <bpmn2:outgoing>oofCall</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_02eywxz</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:scriptTask id="ScriptTask_1pkjo1d" name="Call OOF" scriptFormat="groovy">
+ <bpmn2:incoming>oofCall</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_12t0lqb</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+OofHoming homing = new OofHoming()
+homing.callOof(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="sniroCall" name="Sniro" sourceRef="homingSolutionCheck" targetRef="callSniro">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "sniro"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="oofCall" name="OOF" sourceRef="homingSolutionCheck" targetRef="ScriptTask_1pkjo1d">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_12t0lqb" sourceRef="ScriptTask_1pkjo1d" targetRef="responseCheck" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0gajic6" sourceRef="callSniro" targetRef="responseCheck" />
+ <bpmn2:exclusiveGateway id="processHomingCheck" name="Which homing Solution?">
+ <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming>
+ <bpmn2:outgoing>sniroProcess</bpmn2:outgoing>
+ <bpmn2:outgoing>oofProcess</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processHomingCheck" />
+ <bpmn2:sequenceFlow id="sniroProcess" name="Sniro" sourceRef="processHomingCheck" targetRef="processSniroHomingSolution">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "sniro"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="oofProcess" name="OOF" sourceRef="processHomingCheck" targetRef="processOofHomingSolution">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="processOofHomingSolution" name="Process OOF Homing Solution " scriptFormat="groovy">
+ <bpmn2:incoming>oofProcess</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_07u9d7f</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+OofHoming homing = new OofHoming()
+homing.processHomingSolution(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_07u9d7f" sourceRef="processOofHomingSolution" targetRef="EndEvent_0n56tas" />
+ <bpmn2:endEvent id="throwMSOWorkflowException1">
+ <bpmn2:incoming>SequenceFlow_1bub8mj</bpmn2:incoming>
+ <bpmn2:errorEventDefinition errorRef="Error_10hit0u" />
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="ScriptTask_0t0fs4n" name="Assign Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_02eywxz</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1bub8mj</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[int responseCode = execution.getVariable("sniroHomingSolution")
+
+import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.buildAndThrowWorkflowException(execution, responseCode, "No sniroHomingSolution found for Sniro/OOF.")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1bub8mj" sourceRef="ScriptTask_0t0fs4n" targetRef="throwMSOWorkflowException1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_02eywxz" sourceRef="homingSolutionCheck" targetRef="ScriptTask_0t0fs4n" />
+ </bpmn2:process>
+ <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="147" y="275" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro">
+ <dc:Bounds x="391" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6">
+ <di:waypoint xsi:type="dc:Point" x="183" y="293" />
+ <di:waypoint xsi:type="dc:Point" x="274" y="293" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="183.5" y="278" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true">
+ <dc:Bounds x="254" y="496" width="409" height="168" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true">
+ <dc:Bounds x="284" y="679" width="350" height="159" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v">
+ <dc:Bounds x="579" y="570" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="597" y="611" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2">
+ <dc:Bounds x="299" y="570" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="317" y="611" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException">
+ <dc:Bounds x="406" y="548" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException">
+ <dc:Bounds x="410" y="727" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw">
+ <dc:Bounds x="318" y="749" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="336" y="790" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0">
+ <dc:Bounds x="567" y="749" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="585" y="790" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8">
+ <di:waypoint xsi:type="dc:Point" x="506" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="579" y="588" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="543" y="573" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l">
+ <di:waypoint xsi:type="dc:Point" x="335" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="363" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="363" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="406" y="588" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="378" y="588" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53">
+ <di:waypoint xsi:type="dc:Point" x="354" y="767" />
+ <di:waypoint xsi:type="dc:Point" x="410" y="767" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="382" y="752" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s">
+ <di:waypoint xsi:type="dc:Point" x="510" y="767" />
+ <di:waypoint xsi:type="dc:Point" x="567" y="767" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="539" y="752" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processSniroHomingSolution">
+ <dc:Bounds x="1293" y="253" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_03gt5b8_di" bpmnElement="responseCheck" isMarkerVisible="true">
+ <dc:Bounds x="566" y="268" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="554" y="328" width="74" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0ikcqeo_di" bpmnElement="assignError">
+ <dc:Bounds x="777" y="184" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1m1c9nu_di" bpmnElement="badResponse">
+ <di:waypoint xsi:type="dc:Point" x="610" y="287" />
+ <di:waypoint xsi:type="dc:Point" x="777" y="239" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="665.309770337371" y="246.39875517690592" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0clfkld_di" bpmnElement="SequenceFlow_0clfkld">
+ <di:waypoint xsi:type="dc:Point" x="877" y="224" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="224" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="868" y="209" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_13ejfwp_di" bpmnElement="throwMSOWorkflowException2">
+ <dc:Bounds x="949" y="206" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="922" y="242" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o3br3u_di" bpmnElement="goodResponse">
+ <di:waypoint xsi:type="dc:Point" x="610" y="299" />
+ <di:waypoint xsi:type="dc:Point" x="777" y="356" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="667.027112499105" y="300.1275453507" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback">
+ <dc:Bounds x="777" y="333" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1h9opg9_di" bpmnElement="SequenceFlow_1h9opg9">
+ <di:waypoint xsi:type="dc:Point" x="1393" y="293" />
+ <di:waypoint xsi:type="dc:Point" x="1509" y="293" />
+ <di:waypoint xsi:type="dc:Point" x="1509" y="355" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1406" y="278" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas">
+ <dc:Bounds x="1491" y="355" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1464" y="391" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_03vhlpt_di" bpmnElement="homingSolutionCheck" isMarkerVisible="true">
+ <dc:Bounds x="274" y="268" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="266" y="322" width="69" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1pkjo1d_di" bpmnElement="ScriptTask_1pkjo1d">
+ <dc:Bounds x="391" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1x12ld7_di" bpmnElement="sniroCall">
+ <di:waypoint xsi:type="dc:Point" x="299" y="268" />
+ <di:waypoint xsi:type="dc:Point" x="299" y="177" />
+ <di:waypoint xsi:type="dc:Point" x="391" y="177" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="329" y="192" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0iu4ms3_di" bpmnElement="oofCall">
+ <di:waypoint xsi:type="dc:Point" x="299" y="318" />
+ <di:waypoint xsi:type="dc:Point" x="299" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="391" y="410" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="333" y="378" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12t0lqb_di" bpmnElement="SequenceFlow_12t0lqb">
+ <di:waypoint xsi:type="dc:Point" x="491" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="410" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="318" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="496" y="389" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gajic6_di" bpmnElement="SequenceFlow_0gajic6">
+ <di:waypoint xsi:type="dc:Point" x="491" y="177" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="177" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="268" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="496" y="156" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0dwcgfe_di" bpmnElement="processHomingCheck" isMarkerVisible="true">
+ <dc:Bounds x="942" y="348" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="934" y="402" width="69" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fipbmk_di" bpmnElement="SequenceFlow_1fipbmk">
+ <di:waypoint xsi:type="dc:Point" x="877" y="373" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="373" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="909.5" y="352" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_14jzswu_di" bpmnElement="sniroProcess">
+ <di:waypoint xsi:type="dc:Point" x="967" y="348" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="293" />
+ <di:waypoint xsi:type="dc:Point" x="1293" y="293" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1034" y="312" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_158imry_di" bpmnElement="oofProcess">
+ <di:waypoint xsi:type="dc:Point" x="967" y="398" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="469" />
+ <di:waypoint xsi:type="dc:Point" x="1293" y="469" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1039" y="432" width="25" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0ihb64o_di" bpmnElement="processOofHomingSolution">
+ <dc:Bounds x="1293" y="429" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_07u9d7f_di" bpmnElement="SequenceFlow_07u9d7f">
+ <di:waypoint xsi:type="dc:Point" x="1393" y="469" />
+ <di:waypoint xsi:type="dc:Point" x="1509" y="469" />
+ <di:waypoint xsi:type="dc:Point" x="1509" y="391" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1451" y="448" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1rxyas7_di" bpmnElement="throwMSOWorkflowException1">
+ <dc:Bounds x="507" y="275" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="480" y="311" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0t0fs4n_di" bpmnElement="ScriptTask_0t0fs4n">
+ <dc:Bounds x="364" y="253" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bub8mj_di" bpmnElement="SequenceFlow_1bub8mj">
+ <di:waypoint xsi:type="dc:Point" x="464" y="293" />
+ <di:waypoint xsi:type="dc:Point" x="507" y="293" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="485.5" y="272" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_02eywxz_di" bpmnElement="SequenceFlow_02eywxz">
+ <di:waypoint xsi:type="dc:Point" x="324" y="293" />
+ <di:waypoint xsi:type="dc:Point" x="364" y="293" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="344" y="272" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+package org.openecomp.mso.bpmn.common;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.openecomp.mso.bpmn.core.WorkflowException;
+import org.openecomp.mso.bpmn.core.domain.AllottedResource;
+import org.openecomp.mso.bpmn.core.domain.HomingSolution;
+import org.openecomp.mso.bpmn.core.domain.ModelInfo;
+import org.openecomp.mso.bpmn.core.domain.NetworkResource;
+import org.openecomp.mso.bpmn.core.domain.Resource;
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition;
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance;
+import org.openecomp.mso.bpmn.core.domain.VnfResource;
+import org.openecomp.mso.bpmn.mock.FileUtil;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
+import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof;
+import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof_500;
+
+
+/**
+ * Test the OOF Homing subflow building block.
+ */
+public class OofHomingTest extends WorkflowTest {
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ String subscriber = "";
+ String subscriber2 = "";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public OofHomingTest() throws IOException {
+ String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf");
+ String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf");
+ String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net");
+
+ String oofCallbackNoSolution = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound");
+ String oofCallbackPolicyException = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException");
+ String oofCallbackServiceException = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackServiceException");
+
+ callbacks.put("oof", JSON, "oofResponse", oofCallback);
+ callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
+ callbacks.put("oof3", JSON, "oofResponse", oofCallback3);
+ callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution);
+ callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException);
+ callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException);
+
+ // Service Model
+ ModelInfo sModel = new ModelInfo();
+ sModel.setModelCustomizationName("testModelCustomizationName");
+ sModel.setModelInstanceName("testModelInstanceName");
+ sModel.setModelInvariantUuid("testModelInvariantId");
+ sModel.setModelName("testModelName");
+ sModel.setModelUuid("testModelUuid");
+ sModel.setModelVersion("testModelVersion");
+ // Service Instance
+ ServiceInstance si = new ServiceInstance();
+ si.setInstanceId("testServiceInstanceId123");
+ // Allotted Resources
+ List<AllottedResource> arList = new ArrayList<AllottedResource>();
+ AllottedResource ar = new AllottedResource();
+ ar.setResourceId("testResourceIdAR");
+ ar.setResourceInstanceName("testARInstanceName");
+ ModelInfo arModel = new ModelInfo();
+ arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+ arModel.setModelInvariantUuid("testModelInvariantIdAR");
+ arModel.setModelName("testModelNameAR");
+ arModel.setModelVersion("testModelVersionAR");
+ arModel.setModelUuid("testARModelUuid");
+ arModel.setModelType("testModelTypeAR");
+ ar.setModelInfo(arModel);
+ AllottedResource ar2 = new AllottedResource();
+ ar2.setResourceId("testResourceIdAR2");
+ ar2.setResourceInstanceName("testAR2InstanceName");
+ ModelInfo arModel2 = new ModelInfo();
+ arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+ arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+ arModel2.setModelName("testModelNameAR2");
+ arModel2.setModelVersion("testModelVersionAR2");
+ arModel2.setModelUuid("testAr2ModelUuid");
+ arModel2.setModelType("testModelTypeAR2");
+ ar2.setModelInfo(arModel2);
+ arList.add(ar);
+ arList.add(ar2);
+ // Vnfs
+ List<VnfResource> vnfList = new ArrayList<VnfResource>();
+ VnfResource vnf = new VnfResource();
+ vnf.setResourceId("testResourceIdVNF");
+ vnf.setResourceInstanceName("testVnfInstanceName");
+ ModelInfo vnfModel = new ModelInfo();
+ vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+ vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+ vnfModel.setModelName("testModelNameVNF");
+ vnfModel.setModelVersion("testModelVersionVNF");
+ vnfModel.setModelUuid("testVnfModelUuid");
+ vnfModel.setModelType("testModelTypeVNF");
+ vnf.setModelInfo(vnfModel);
+ vnfList.add(vnf);
+ System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
+ serviceDecomposition.setModelInfo(sModel);
+ serviceDecomposition.setServiceAllottedResources(arList);
+ serviceDecomposition.setServiceVnfs(vnfList);
+ serviceDecomposition.setServiceInstance(si);
+
+ // Subscriber
+ subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_2AR1Vnf() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oof2");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifyOofRequest(), expectedOofRequest);
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables2(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oof3");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+ HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+ Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+ HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ String resourceNetHomingString = resourceNetHoming.toString();
+ resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+ String resourceNetHoming2String = resourceNetHoming2.toString();
+ resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+ expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
+
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),
+ "aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud","aic",
+ "testCloudRegionId3",
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
+ "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
+ "testCloudRegionIdNet",
+ null, null), resourceNetHomingString);
+ assertEquals(homingSolutionCloud("cloud", "aic",
+ "testCloudRegionIdNet2",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+ resourceNetHoming2String);
+ assertEquals(verifyOofRequest(), expectedOofRequest);
+
+ }
+
+ @Test
+ @Ignore
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn",
+ "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_vnfResourceList() throws Exception {
+
+ // Create a Service Decomposition
+ MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "/BuildingBlocks/oofCatalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123",
+ "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey,
+ "serviceDecomposition");
+ System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
+ List<VnfResource> vnfResourceList = sd.getServiceVnfs();
+//System.out.println(" vnfResourceList = " + vnfResourceList);
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+ // Invoke Homing
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("homingService", "oof");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", sd);
+ variables.put("subscriberInfo", subscriber2);
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "oof3");
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp);
+
+ Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+ System.out.println("resourceVnf is: " + resourceVnf);
+ HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+ String resourceVnfHomingString = resourceVnfHoming.toString();
+ System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString);
+ resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+ System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString);
+
+ assertNull(workflowException);
+
+ //Verify request
+ String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+ System.out.println("oofRequest is: " + oofRequest);
+ assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
+ replaceAll("\n", "").replaceAll("\r", "").
+ replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
+ replaceAll("\r", "").replaceAll("\t", ""));
+
+ //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
+
+ assertEquals(homingSolutionService("service", "service-instance-01234",
+ "MDTNJ01", "test-resource-id-000","att-aic",
+ "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
+ " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
+ " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ }
+
+ @Test
+ @Ignore // 1802 merge
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_success_existingLicense() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ setVariablesExistingLicense(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ oofRequest = oofRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ "aic", "dfwtx", "KDTNJ01",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "aic",
+ "testCloudRegionId3",
+ "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifyOofRequestExistingLicense(), oofRequest);
+
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_inputVariable() throws Exception {
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
+ "input variable is missing or null]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_badResponse() throws Exception {
+ mockOof_500();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " +
+ "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_oofNoSolution() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofNoSol");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " +
+ "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_oofPolicyException() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofPolicyEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
+ "limit]", workflowException.toString());
+ }
+
+ @Test
+ @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
+ public void testHoming_error_oofServiceException() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofServiceEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains a Request Error Service Exception: OOF PlacementError: " +
+ "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
+ "url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+ workflowException.toString());
+ }
+
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables2(Map<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ NetworkResource net = new NetworkResource();
+ net.setResourceId("testResourceIdNet");
+ ModelInfo netModel = new ModelInfo();
+ netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+ netModel.setModelInvariantUuid("testModelInvariantIdNet");
+ netModel.setModelName("testModelNameNet");
+ netModel.setModelVersion("testModelVersionNet");
+ net.setModelInfo(netModel);
+ netList.add(net);
+ NetworkResource net2 = new NetworkResource();
+ net2.setResourceId("testResourceIdNet2");
+ ModelInfo netModel2 = new ModelInfo();
+ netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+ netModel2.setModelCustomizationName("testModelCustomizationNameNet2");
+ netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+ netModel2.setModelName("testModelNameNet2");
+ netModel2.setModelVersion("testModelVersionNet2");
+ net2.setModelInfo(netModel2);
+ netList.add(net2);
+ serviceDecomposition.setServiceNetworks(netList);
+
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables3(Map<String, Object> variables) {
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", null);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariablesExistingLicense(Map<String, Object> variables) {
+ HomingSolution currentHomingSolution = new HomingSolution();
+ serviceDecomposition.getServiceVnfs().get(0).setCurrentHomingSolution(currentHomingSolution);
+ serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+
+ serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ /*private String homingSolutionService(String resourceModuleName, String serviceInstanceId, String vnfHostname, String cloudOwner,
+ String cloudRegionId, String licenseList) {
+ String solution = "";
+ if (licenseList == null || licenseList == "") {
+ solution = "{\n" +
+ " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
+ " \"serviceResourceId\": \"some_resource_id\",\n" +
+ " \"solution\": {\n" +
+ " \"identifierType\": \"serviceInstanceId\",\n" +
+ " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" +
+ " }\n" +
+ " \"assignmentInfo\": [\n" +
+ " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
+ " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" +
+ " { \"key\": \"isRehome\", \"value\": \"False\" },\n" +
+ " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
+ " ]\n" +
+ " }";
+ } else {
+ solution = "{\n" +
+ " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
+ " \"serviceResourceId\": \"some_resource_id\",\n" +
+ " \"solution\": {\n" +
+ " \"identifierType\": \"service_instance_id\",\n" +
+ " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" +
+ " }\n" +
+ " \"assignmentInfo\": [\n" +
+ " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
+ " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" +
+ " { \"key\": \"isRehome\", \"value\": \"False\" },\n" +
+ " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
+ " ], " +
+ " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] " +
+ "}";
+ }
+ return solution;
+ }*/
+ private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
+ String vnfResourceId, String cloudOwner,
+ String cloudRegionId, String enList,
+ String licenseList){
+
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
+ serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
+ cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
+ "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
+ " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
+ " \"rehome\" : false } }";
+ }else{
+ //language=JSON
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
+ serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
+ cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
+ " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
+ " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
+ " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ /*private String homingSolutionCloud(String resourceModuleName, String cloudOwner,
+ String cloudRegionId, String licenseList) {
+ String solution = "";
+ if (licenseList == null || licenseList == "") {
+ solution = "{\n" +
+ " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
+ " \"serviceResourceId\": \"some_resource_id\",\n" +
+ " \"solution\": {\n" +
+ " \"identifierType\": \"cloudRegionId\",\n" +
+ " \"cloudOwner\": \"" + cloudOwner + "\",\n" +
+ " \"identifiers\": [\"" + cloudRegionId + "\"]\n" +
+ " }\n" +
+ " \"assignmentInfo\": [\n" +
+ " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
+ " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
+ " ]\n" +
+ "}";
+ } else {
+ solution = "{\n" +
+ " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
+ " \"serviceResourceId\": \"some_resource_id\",\n" +
+ " \"solution\": {\n" +
+ " \"identifierType\": \"cloudRegionId\",\n" +
+ " \"cloudOwner\": \"" + cloudOwner + "\",\n" +
+ " \"identifiers\": [\"" + cloudRegionId + "\"]\n" +
+ " }\n" +
+ " \"assignmentInfo\": [\n" +
+ " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
+ " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
+ " ]," +
+ " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] } " +
+ "}";
+ }
+ return solution;
+ }*/
+ private String homingSolutionCloud(String type, String cloudOwner,
+ String cloudRegionId, String enList,
+ String licenseList){
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"license\" : { }, \"rehome\" : false } }";
+ }else{
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
+ licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("homingService", "oof");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+
+
+ String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
+ "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ }
+
+ private String verifyOofRequest() {
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
+ "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
+ "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
+ "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
+ "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
+ "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
+ "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" +
+ ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
+ "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," +
+ "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" +
+ "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," +
+ "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," +
+ "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," +
+ "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," +
+ "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," +
+ "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
+ "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
+ "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
+ "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
+ "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
+ "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":" +
+ "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":" +
+ "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":" +
+ "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
+ "\"modelCustomizationName\":\"\"}}]}}";
+ return request;
+ }
+
+ private String verifyOofRequestExistingLicense(){
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
+ "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
+ "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
+ "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
+ "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
+ "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
+ "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
+ "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
+ "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
+ "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
+ "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
+ "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
+ "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
+ "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
+ "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
+ "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
+ "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
+ "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
+ "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
+ "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
+ "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
+ "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
+ "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
+ "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
+ "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
+ "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
+ "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
+}
import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.core.domain.*;
import org.openecomp.mso.bpmn.mock.FileUtil;
-import org.openecomp.mso.bpmn.common.WorkflowTest;
/**
- * Test the Homing subflow building block.
- *
- * @author cb645j
+ * Test the SNIRO Homing subflow building block.
*/
-public class HomingTest extends WorkflowTest {
+public class SniroHomingTest extends WorkflowTest {
ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
String subscriber = "";
private final CallbackSet callbacks = new CallbackSet();
- public HomingTest() throws IOException {
+ public SniroHomingTest() throws IOException {
String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
String businessKey = UUID.randomUUID().toString();
Map<String, Object> variables = new HashMap<>();
+ variables.put("homingService", "sniro");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId");
//Get Variables
WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
- assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro.]", workflowException.toString());
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString());
}
@Test
private void setVariables(Map<String, Object> variables) {
+ variables.put("homingService", "sniro");
variables.put("isDebugLogEnabled", "true");
// variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
netList.add(net2);
serviceDecomposition.setServiceNetworks(netList);
+ variables.put("homingService", "sniro");
variables.put("isDebugLogEnabled", "true");
variables.put("msoRequestId", "testRequestId");
variables.put("serviceInstanceId", "testServiceInstanceId");
}
private void setVariables3(Map<String, Object> variables) {
+ variables.put("homingService", "sniro");
variables.put("isDebugLogEnabled", "true");
// variables.put("mso-request-id", "testRequestId");
variables.put("msoRequestId", "testRequestId");
}
private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("homingService", "sniro");
variables.put("isDebugLogEnabled", "true");
variables.put("mso-request-id", requestId);
variables.put("msoRequestId", requestId);
}
@Test
- @Ignore // 1802 merge
@Deployment(resources = {
"subprocess/VnfAdapterRestV1.bpmn"
})
}
@Test
- @Ignore // 1802 merge
@Deployment(resources = {
"subprocess/VnfAdapterRestV1.bpmn"
})
}
@Test
- @Ignore // 1802 merge
@Deployment(resources = {
"subprocess/VnfAdapterRestV1.bpmn"
})
logEnd();
}
- @Ignore // 1802 merge
@Test
@Deployment(resources = {
"subprocess/VnfAdapterRestV1.bpmn"
}
@Test
- @Ignore // 1802 merge
@Deployment(resources = {
"subprocess/VnfAdapterRestV1.bpmn"
})
--- /dev/null
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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=========================================================
+ */
+
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+package org.openecomp.mso.bpmn.mock;
+
+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;
+
+/**
+ * StubResponseOof.java class
+ */
+public class StubResponseOof {
+
+ public static void setupAllMocks() {
+
+ }
+
+ public static void mockOof() {
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockOof(String responseFile) {
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile(responseFile)));
+ }
+
+ public static void mockOof_400() {
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse()
+ .withStatus(400)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+ public static void mockOof_500() {
+ stubFor(post(urlEqualTo("/api/oof/v1/placement"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "application/json")));
+ }
+
+}
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockVNFPut(String vfModuleId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockPostVNFVolumeGroup(int statusCode) {
stubFor(post(urlEqualTo("/vnfs/v1/volume-groups"))
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockVNFAdapterRest(String vnfId) {
stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
.willReturn(aResponse()
.withStatus(200)));
+ stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(200)));
}
public static void mockVNFAdapterRest_500(String vnfId) {
stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules"))
.willReturn(aResponse()
.withStatus(500)));
+ stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules"))
+ .willReturn(aResponse()
+ .withStatus(500)));
}
public static void mockVfModuleDelete(String volumeGroupId) {
.willReturn(aResponse()
.withStatus(202)
.withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/xml")));
}
public static void mockVfModuleDelete(String volumeGroupId, int statusCode) {
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "application/xml")));
+ stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987"))
+ .willReturn(aResponse()
+ .withStatus(statusCode)
+ .withHeader("Content-Type", "application/xml")));
}
}
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class CallbackHeaderTest {\r
+ \r
+ CallbackHeader cbh = new CallbackHeader();\r
+ CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg");\r
+\r
+ @Test\r
+ public void testCallbackHeader() {\r
+ cbh.setRequestId("requestId");\r
+ cbh.setResponseCode("responseCode");\r
+ cbh.setResponseMessage("responseMessage");\r
+ assertEquals(cbh.getRequestId(), "requestId");\r
+ assertEquals(cbh.getResponseCode(), "responseCode");\r
+ assertEquals(cbh.getResponseMessage(), "responseMessage");\r
+ assert(cbh.toString()!=null);\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class ObjectFactoryTest {\r
+ ObjectFactory of = new ObjectFactory();\r
+\r
+ @Test\r
+ public void testObjectFactory() {\r
+ of.createRequestHeader();\r
+ of.createSDNCAdapterRequest();\r
+ of.createSDNCAdapterResponse();\r
+ \r
+ \r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class RequestHeaderTest {\r
+ RequestHeader rh = new RequestHeader();\r
+\r
+ @Test\r
+ public void testRequestHeader() {\r
+ rh.setRequestId("requestId");\r
+ rh.setSvcInstanceId("svcInstanceId");\r
+ rh.setSvcAction("svcAction");\r
+ rh.setSvcOperation("svcOperation");\r
+ rh.setCallbackUrl("callbackUrl");\r
+ rh.setMsoAction("msoAction");\r
+ assertEquals(rh.getRequestId(), "requestId");\r
+ assertEquals(rh.getSvcInstanceId(), "svcInstanceId");\r
+ assertEquals(rh.getSvcAction(), "svcAction");\r
+ assertEquals(rh.getSvcOperation(), "svcOperation");\r
+ assertEquals(rh.getCallbackUrl(), "callbackUrl");\r
+ assertEquals(rh.getMsoAction(), "msoAction");\r
+ assert(rh.toString()!=null); \r
+ }\r
+}\r
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.properties.MsoPropertiesFactory;\r
+\r
+public class RequestTunablesTest {\r
+ MsoPropertiesFactory mpf = new MsoPropertiesFactory();\r
+ \r
+ RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf);\r
+\r
+ @Test\r
+ public void testRequestTunables() {\r
+ rt.setReqId("reqId");\r
+ rt.setReqMethod("reqMethod");\r
+ rt.setMsoAction("msoAction");\r
+ rt.setAction("action");\r
+ rt.setOperation("operation");\r
+ rt.setSdncUrl("sdncUrl");\r
+ rt.setTimeout("timeout");\r
+ rt.setAsyncInd("asyncInd");\r
+ rt.setHeaderName("headerName");\r
+ rt.setSdncaNotificationUrl("sdncaNotificationUrl");\r
+ rt.setNamespace("namespace");\r
+ assertEquals(rt.getReqId(), "reqId");\r
+ assertEquals(rt.getReqMethod(), "reqMethod");\r
+ assertEquals(rt.getMsoAction(), "msoAction");\r
+ assertEquals(rt.getAction(), "action");\r
+ assertEquals(rt.getOperation(), "operation");\r
+ assertEquals(rt.getSdncUrl(), "sdncUrl");\r
+ assertEquals(rt.getTimeout(), "timeout");\r
+ assertEquals(rt.getAsyncInd(), "asyncInd");\r
+ assertEquals(rt.getHeaderName(), "headerName");\r
+ assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl");\r
+ assertEquals(rt.getNamespace(), "namespace");\r
+ assert(rt.toString()!=null); \r
+ }\r
+}\r
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class SDNCAdapterCallbackRequestTest {\r
+ \r
+ SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();\r
+ CallbackHeader cbh = new CallbackHeader();\r
+ Object o = new Object();\r
+\r
+ @Test\r
+ public void testSDNCAdapterCallbackRequest() {\r
+ sdnccall.setCallbackHeader(cbh);\r
+ sdnccall.setRequestData(o);\r
+ assertEquals(sdnccall.getCallbackHeader(), cbh);\r
+ assertEquals(sdnccall.getRequestData(), o);\r
+ assert(sdnccall.toString()!=null); \r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class SDNCAdapterRequestTest {\r
+ \r
+ SDNCAdapterRequest adapter = new SDNCAdapterRequest();\r
+ RequestHeader rh = new RequestHeader();\r
+ Object o = new Object();\r
+\r
+ @Test\r
+ public void testSDNCAdapterRequest() {\r
+ adapter.setRequestHeader(rh);\r
+ adapter.setRequestData(o);\r
+ assertEquals(adapter.getRequestHeader(), rh);\r
+ assertEquals(adapter.getRequestData(), o);\r
+ }\r
+}\r
--- /dev/null
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class SDNCResponseTest {\r
+ \r
+ SDNCResponse sdnc = new SDNCResponse("reqId");\r
+ SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg");\r
+\r
+ @Test\r
+ public void testSDNCResponse() {\r
+ sdnc.setReqId("reqId");\r
+ sdnc.setRespCode(0);\r
+ sdnc.setRespMsg("respMsg");\r
+ sdnc.setSdncResp("sdncResp");\r
+ assertEquals(sdnc.getReqId(), "reqId");\r
+ assertEquals(sdnc.getRespCode(), 0);\r
+ assertEquals(sdnc.getRespMsg(), "respMsg");\r
+ assertEquals(sdnc.getSdncResp(), "sdncResp");\r
+ assert(sdnc.toString()!= null); \r
+ }\r
+}\r
--- /dev/null
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "complete",
+ "statusMessage": "success",
+ "solutions": {
+ "licenseSolutions": [
+ {
+ "entitlementPoolUUID": [
+ "f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupUUID": [
+ "s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_primary_1",
+ "serviceResourceId": "testResourceIdAR"
+ },
+ {
+ "entitlementPoolUUID": [
+ "91d563e8-e714-4393-8f99-cc480144a05e",
+ "21d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "licenseKeyGroupUUID": [
+ "31d563e8-e714-4393-8f99-cc480144a05e",
+ "71d563e8-e714-4393-8f99-cc480144a05e"
+ ],
+ "resourceModuleName": "vHNPortalaaS_secondary_1",
+ "serviceResourceId": "testResourceIdVNF"
+ }
+ ],
+ "placementSolutions": [
+ {
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceInstanceId": "testSIID1",
+ "serviceResourceId": "testResourceIdAR",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID1"]
+ },
+ "assignmentInfo": [
+ {
+ "key": "cloudOwner",
+ "value": "aic"
+ },
+ {
+ "key": "vnfHostName",
+ "value": "MDTNJ01"
+ },
+ {
+ "key": "isRehome",
+ "value": "False"
+ },
+ {
+ "key": "cloudRegionId",
+ "value": "dfwtx"
+ }
+ ]
+ },
+ { "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceResourceId": "testResourceIdAR2",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID2"]
+ },
+ "assignmentInfo": [
+ {
+ "key": "cloudOwner",
+ "value": "aic"
+ },
+ {
+ "key": "vnfHostName",
+ "value": "testVnfHostname2"
+ },
+ {
+ "key": "isRehome",
+ "value": "False"
+ },
+ {
+ "key": "cloudRegionId",
+ "value": "testCloudRegionId2"
+ }
+ ]
+ },
+ {
+ "resourceModuleName": "VNF",
+ "serviceResourceId": "testResourceIdVNF",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "aic",
+ "identifiers": [
+ "testCloudRegionId3"
+ ]
+ },
+ "assignmentInfo": [
+ {
+ "key": "cloudOwner",
+ "value": "aic"
+ },
+ {
+ "key": "cloudRegionId",
+ "value": "testCloudRegionId3"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "requestState": "completed",
+ "statusMessage": "success",
+ "solutions": {
+ "licenseSolutions": [
+ {
+ "resourceModuleName": "vHNPortalaaS_primary_1",
+ "serviceResourceId": "testResourceIdAR",
+ "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e",
+ "j1d563e8-e714-4393-8f99-cc480144a05e"],
+ "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e",
+ "b1d563e8-e714-4393-8f99-cc480144a05e"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ },
+ {
+ "resourceModuleName": "net",
+ "serviceResourceId": "testResourceIdNet2",
+ "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n",
+ "j1d563e8-e714-4393-8f99-cc480144a05n"],
+ "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n",
+ "b1d563e8-e714-4393-8f99-cc480144a05n"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ },
+ {
+ "resourceModuleName": "vHNPortalaaS_secondary_1",
+ "serviceResourceId": "testResourceIdVNF",
+ "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e",
+ "21d563e8-e714-4393-8f99-cc480144a05e"],
+ "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e",
+ "71d563e8-e714-4393-8f99-cc480144a05e"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+ "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ },
+ ],
+ "placementSolutions": [
+ {
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceResourceId": "testResourceIdAR",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID1"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "vnfHostName", "value": "MDTNJ01" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "cloudRegionId", "value": "dfwtx" }
+ ]
+ },
+ {
+ "resourceModuleName": "ALLOTTED_RESOURCE",
+ "serviceResourceId": "testResourceIdAR2",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testSIID2"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "vnfHostName", "value": "testVnfHostname2" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "cloudRegionId", "value": "testCloudRegionId2" }
+ ]
+ },
+ {
+ "resourceModuleName": "NETWORK",
+ "serviceResourceId": "testResourceIdNet",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["testServiceInstanceIdNet"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "vnfHostName", "value": "testVnfHostNameNet" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "cloudRegionId", "value": "testCloudRegionIdNet" }
+ ]
+ },
+ {
+ "resourceModuleName": "NETWORK",
+ "serviceResourceId": "testResourceIdNet2",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "aic",
+ "identifiers": ["testCloudRegionIdNet2"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "cloudRegionId", "value": "testCloudRegionIdNet2" }
+ ]
+ },
+ {
+ "resourceModuleName": "VNF",
+ "serviceResourceId": "testResourceIdVNF",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "aic",
+ "identifiers": ["testCloudRegionId3"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "aic" },
+ { "key": "cloudRegionId", "value": "testCloudRegionId3" }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "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": "cloudRegionId", "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": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }
+ ]
+ }
+ ],
+ "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
--- /dev/null
+{
+ "solutions": {
+ "placementSolutions": [],
+ "licenseSolutions": []
+ },
+ "transactionId": "08e1b8cf-144a-4bac-b293-d5e2eedc97e8",
+ "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e",
+ "requestStatus": "completed",
+ "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8"
+}
\ No newline at end of file
--- /dev/null
+{
+ "requestError": {
+ "policyException": {
+ "requestId": "ae81d9a8-c949-493a-999c-f76c80503233",
+ "text": "Message content size exceeds the allowable limit",
+ "messageId": "SVC0001"
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "requestError": {
+ "serviceException": {
+ "variables": [
+ "severity", 400
+ ],
+ "requestId": "ae81d9a8-c949-493a-999c-f76c80503233",
+ "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8",
+ "messageId": "SVC0001"
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "serviceResources": {
+ "serviceType": null,
+ "serviceAllottedResources": [],
+ "modelInfo": {
+ "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8",
+ "modelName": "ADIOD vRouter vCE 011017 Service",
+ "modelVersion": "5.0",
+ "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4"
+ },
+ "serviceRole": null,
+ "serviceVnfs": [
+ {
+ "toscaNodeType": "org.openecomp.resource.vf.AdiodVce",
+ "vfModules": [
+ {
+ "initialCount": null,
+ "vfModuleLabel": null,
+ "modelInfo": {
+ "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5",
+ "modelName": "AdiodVce..base_vCE..module-0",
+ "modelVersion": "2",
+ "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829",
+ "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276"
+ },
+ "hasVolumeGroup": true,
+ "isBase": true
+ }
+ ],
+ "modelInfo": {
+ "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelName": "ADIoD vCE",
+ "modelVersion": "2.0",
+ "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587",
+ "modelInstanceName": "ADIoD vCE 0",
+ "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1"
+ },
+ "nfRole": "",
+ "nfType": "",
+ "nfFunction": "",
+ "nfNamingCode": "",
+ "multiStageDesign": "N"
+ }
+ ],
+ "serviceNetworks": []
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "requestInfo": {
+ "transactionId": "testRequestId-xxx-xxx",
+ "requestId": "testRequestId-yyy-yyy",
+ "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId",
+ "sourceId": "so",
+ "requestType": "create",
+ "numSolutions": 1,
+ "optimizers": ["placement"],
+ "timeout": 600
+ },
+ "placementInfo": {
+ "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" },
+ "placementDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "tenantId": "vGMuxInfra-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vGMuxInfra-customeModelName"
+ }
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e",
+ "tenantId": "vG-tenant",
+ "resourceModelInfo": {
+ "modelInvariantId": "vG-modelInvariantId",
+ "modelVersionId": "vG-versionId",
+ "modelName": "vG-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "vG-customeModelName"
+ },
+ "existingCandidates": [
+ {
+ "identifierType": "service_instance_id",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ }
+ ],
+ "excludedCandidates": [
+ {
+ "identifierType": "service_instance_id",
+ "cloudOwner": "",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "vmware",
+ "identifiers": ["NYMDT67"]
+ }
+ ],
+ "requiredCandidates": [
+ {
+ "identifierType": "vimId",
+ "cloudOwner": "amazon",
+ "identifiers": ["TXAUS219"]
+ }
+ ]
+ }
+ ]
+ },
+ "serviceInfo": {
+ "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec",
+ "serviceName": "vCPE",
+ "modelInfo": {
+ "modelInvariantId": "vCPE-invariantId",
+ "modelVersionId": "vCPE-versionId",
+ "modelName": "vCPE-model",
+ "modelType": "service",
+ "modelVersion": "1.0",
+ "modelCustomizationName": ""
+ }
+ },
+ "licenseDemands": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "vGMuxInfra-xx",
+ "resourceModelInfo": {
+ "modelInvariantId": "vGMuxInfra-modelInvariantId",
+ "modelVersionId": "vGMuxInfra-versionId",
+ "modelName": "vGMuxInfra-model",
+ "modelType": "resource",
+ "modelVersion": "1.0",
+ "modelCustomizationName": ""
+ },
+ "existingLicenses": {
+ "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"],
+ "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"]
+ }
+ }
+ ]
+}
\ No newline at end of file
--- /dev/null
+{
+ "requestInfo": {
+ "transactionId": "testRequestId",
+ "requestId": "testRequestId",
+ "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId",
+ "sourceId": "so",
+ "requestType": "create",
+ "numSolutions": 1,
+ "optimizers": ["placement"],
+ "timeout": 600 },
+ "placementInfo": {
+ "requestParameters": {
+ "customerLatitude": "32.89748",
+ "customerLongitude": "-97.040443",
+ "customerName": "xyz" },
+ "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201",
+ "subscriberName": "SUB_12_0322_DS_1201",
+ "subscriberCommonSiteId": "" },
+ "placementDemands": [
+ {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": {
+ "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1",
+ "modelName": "ADIoD vCE",
+ "modelType": "",
+ "modelVersion": "2.0",
+ "modelCustomizationName": "" }}
+ ]
+ },
+ "serviceInfo": {
+ "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff",
+ "serviceName": "null",
+ "modelInfo": {
+ "modelType": "",
+ "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8",
+ "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "modelName": "ADIOD vRouter vCE 011017 Service",
+ "modelVersion": "5.0",
+ "modelCustomizationName": ""
+ }
+ },
+ "licenseInfo": {
+ "licenseDemands": [
+ {
+"resourceModuleName": "VNF",
+"serviceResourceId": "test-resource-id-000",
+"resourceInstanceType": "VNF",
+"resourceModelInfo": {
+ "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b",
+ "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1",
+ "modelName": "ADIoD vCE",
+ "modelType": "",
+ "modelVersion": "2.0",
+ "modelCustomizationName": ""
+ }
+ }]
+ }}
\ No newline at end of file
-# Default URN Mappings for unit tests\r
-\r
-mso.rollback=true\r
-\r
-canopi.auth=757A94191D685FD2092AC1490730A4FC\r
-csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest\r
-csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification\r
-mso.csi.pwd=4EA237303511EFBBC37F17A351562131\r
-mso.csi.usrname=mso\r
-mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7\r
-\r
-mso.healthcheck.log.debug=false\r
-\r
-mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess\r
-\r
-mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
-mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter\r
-mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC\r
-\r
-mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter\r
-mso.adapters.network.rest.endpoint=http://localhost:28090/networks/rest/v1/networks\r
-\r
-mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC\r
-mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B\r
-mso.po.timeout=PT60S\r
-mso.default.adapter.namespace=http://org.openecomp.mso\r
-mso.adapters.workflow.message.endpoint=http://localhost:28090/workflows/messages/message\r
-\r
-aai.auth=26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764\r
-\r
-policy.endpoint=https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/\r
-policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk\r
-policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw==\r
-policy.environment=TEST\r
-\r
-appc.topic.read=APPC-TEST-AMDOCS2\r
-appc.topic.write=APPC-TEST-AMDOCS1-DEV3\r
-appc.topic.read.timeout=120000\r
-appc.client.response.timeout=120000\r
-appc.service=ueb\r
-appc.poolMembers=uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904\r
-appc.client.key=iaEMAfjsVsZnraBP\r
-appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz\r
-\r
-mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter\r
-mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc\r
-mso.adapters.sdnc.timeout=PT60S\r
-mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui\r
-mso.sdnc.firewall.yang.model.version=2015-05-15\r
-mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B\r
-mso.sdnc.timeout.firewall.minutes=20\r
-mso.callbackRetryAttempts=5\r
-mso.sdnc.timeout=PT10S\r
-mso.sdnc.timeout.ucpe.async.hours=120\r
-mso.sdnc.timeout.ucpe.async.minutes=5\r
-mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage\r
-mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService\r
-\r
-mso.sniro.auth=test:testpwd\r
-mso.sniro.timeout=PT30M\r
-mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1\r
-mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1\r
-\r
-mso.service.agnostic.sniro.host=http://localhost:28090\r
-mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement\r
-\r
-mso.catalog.db.endpoint=http://localhost:28090/\r
-\r
-ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com\r
-ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc\r
-ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1\r
-\r
-\r
-mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock\r
-mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync\r
-mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter\r
-mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/rest/v1/vnfs\r
-mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify\r
-mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify\r
-mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1\r
-mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify\r
-mso.workflow.createvce.delay.seconds=1\r
-mso.infra.customer.id=testCustIdInfra\r
-\r
-aai.endpoint=http://localhost:28090\r
-\r
-# AAI version mappings\r
-\r
-# Example to override default version for a resource:\r
-#mso.workflow.default.aai.vce.version=6\r
-#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce\r
-mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/\r
-mso.workflow.global.default.aai.version=8\r
-mso.workflow.default.aai.cloud-region.version=9\r
-mso.workflow.default.aai.generic-vnf.version=9\r
-\r
-mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic\r
-mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer\r
-mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query\r
-mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf\r
-mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network\r
-mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy\r
-mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query\r
-mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference\r
-mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant\r
-mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce\r
-mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding\r
-mso.workflow.notification.name=GenericNotificationService\r
-mso.bpmn.optimisticlockingexception.retrycount=3\r
-\r
-log.debug.CompleteMsoProcess=true\r
-log.debug.CreateNetworkInstanceInfra=true\r
-log.debug.CreateServiceInstanceInfra=true\r
-log.debug.DeleteNetworkInstanceInfra=true\r
-log.debug.FalloutHandler=true\r
-log.debug.GenericGetService=true\r
-log.debug.sdncAdapter=true\r
-log.debug.UpdateNetworkInstanceInfra=true\r
-log.debug.VnfAdapterRestV1=true\r
-log.debug.GenericGetNetwork=true\r
-log.debug.GenericGetVnf=true\r
-log.debug.GenericDeleteService=true\r
-log.debug.GenericDeleteNetwork=true\r
-log.debug.GenericDeleteVnf=true\r
-log.debug.vnfAdapterCreateV1=true\r
-log.debug.vnfAdapterRestV1=true\r
-\r
-sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com\r
-sdno.health-check.dmaap.password=eHQ1cUJrOUc\r
-sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02\r
+# Default URN Mappings for unit tests
+
+mso.rollback=true
+
+canopi.auth=757A94191D685FD2092AC1490730A4FC
+csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest
+csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification
+mso.csi.pwd=4EA237303511EFBBC37F17A351562131
+mso.csi.usrname=mso
+mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7
+
+mso.healthcheck.log.debug=false
+
+mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess
+
+mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter
+mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter
+mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC
+
+mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter
+mso.adapters.network.rest.endpoint=http://localhost:28090/networks/rest/v1/networks
+
+mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC
+mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B
+mso.po.timeout=PT60S
+mso.default.adapter.namespace=http://org.openecomp.mso
+mso.adapters.workflow.message.endpoint=http://localhost:28090/workflows/messages/message
+
+aai.auth=26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
+
+policy.endpoint=https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/
+policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk
+policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw==
+policy.environment=TEST
+
+appc.topic.read=APPC-TEST-AMDOCS2
+appc.topic.write=APPC-TEST-AMDOCS1-DEV3
+appc.topic.read.timeout=120000
+appc.client.response.timeout=120000
+appc.service=ueb
+appc.poolMembers=uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904
+appc.client.key=iaEMAfjsVsZnraBP
+appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz
+
+mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter
+mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc
+mso.adapters.sdnc.timeout=PT60S
+mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui
+mso.sdnc.firewall.yang.model.version=2015-05-15
+mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B
+mso.sdnc.timeout.firewall.minutes=20
+mso.callbackRetryAttempts=5
+mso.sdnc.timeout=PT10S
+mso.sdnc.timeout.ucpe.async.hours=120
+mso.sdnc.timeout.ucpe.async.minutes=5
+mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage
+mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService
+
+mso.sniro.auth=test:testpwd
+mso.sniro.timeout=PT30M
+mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1
+mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1
+
+mso.service.agnostic.sniro.host=http://localhost:28090
+mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement
+
+mso.oof.auth=test:testpwd
+mso.oof.endpoint=http://localhost:28090/api/oof/v1/placement
+mso.oof.timeout=PT30M
+mso.service.agnostic.oof.host=http://localhost:28090
+mso.service.agnostic.oof.endpoint=/api/oof/v1/placement
+
+mso.catalog.db.endpoint=http://localhost:28090/
+
+ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com
+ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc
+ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1
+
+
+mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock
+mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync
+mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter
+mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/rest/v1/vnfs
+mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify
+mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify
+mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1
+mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify
+mso.workflow.createvce.delay.seconds=1
+mso.infra.customer.id=testCustIdInfra
+
+aai.endpoint=http://localhost:28090
+
+# AAI version mappings
+
+# Example to override default version for a resource:
+#mso.workflow.default.aai.vce.version=6
+#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce
+mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/
+mso.workflow.global.default.aai.version=8
+mso.workflow.default.aai.cloud-region.version=9
+mso.workflow.default.aai.generic-vnf.version=9
+
+mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
+mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer
+mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query
+mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf
+mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network
+mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy
+mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query
+mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference
+mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
+mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce
+mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding
+mso.workflow.notification.name=GenericNotificationService
+mso.bpmn.optimisticlockingexception.retrycount=3
+
+log.debug.CompleteMsoProcess=true
+log.debug.CreateNetworkInstanceInfra=true
+log.debug.CreateServiceInstanceInfra=true
+log.debug.DeleteNetworkInstanceInfra=true
+log.debug.FalloutHandler=true
+log.debug.GenericGetService=true
+log.debug.sdncAdapter=true
+log.debug.UpdateNetworkInstanceInfra=true
+log.debug.VnfAdapterRestV1=true
+log.debug.GenericGetNetwork=true
+log.debug.GenericGetVnf=true
+log.debug.GenericDeleteService=true
+log.debug.GenericDeleteNetwork=true
+log.debug.GenericDeleteVnf=true
+log.debug.vnfAdapterCreateV1=true
+log.debug.vnfAdapterRestV1=true
+
+sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com
+sdno.health-check.dmaap.password=eHQ1cUJrOUc
+sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02
sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.bpmn.core.domain;\r
-\r
-import java.io.Serializable;\r
-import java.util.List;\r
-\r
-import com.fasterxml.jackson.annotation.JsonInclude;\r
-import com.fasterxml.jackson.annotation.JsonRootName;\r
-\r
-/**\r
- * Stores resources placement and licensing information\r
- *\r
- */\r
-@JsonRootName("homingSolution")\r
-@JsonInclude(JsonInclude.Include.NON_NULL)\r
-public class HomingSolution extends JsonWrapper implements Serializable {\r
-\r
- private static final long serialVersionUID = 1L;\r
-\r
- private InventoryType inventoryType;\r
- private boolean isRehome;\r
- private String serviceInstanceId; //TODO should start using si object instead\r
- private String cloudOwner;\r
- private String cloudRegionId;\r
- private String aicClli;\r
- private String aicVersion;\r
- private String tenant;\r
- private VnfResource vnf;\r
- private License license = new License();\r
-\r
-\r
- /**\r
- * @return the inventoryType which indicates the solution type\r
- */\r
- public InventoryType getInventoryType() {\r
- return inventoryType;\r
- }\r
-\r
- public void setInventoryType(InventoryType inventoryType) {\r
- this.inventoryType = inventoryType;\r
- }\r
- public boolean isRehome() {\r
- return isRehome;\r
- }\r
- public void setRehome(boolean isRehome) {\r
- this.isRehome = isRehome;\r
- }\r
-\r
- public String getServiceInstanceId() {\r
- return serviceInstanceId;\r
- }\r
-\r
- public void setServiceInstanceId(String serviceInstanceId) {\r
- this.serviceInstanceId = serviceInstanceId;\r
- }\r
-\r
- public String getCloudOwner() {\r
- return cloudOwner;\r
- }\r
-\r
- public void setCloudOwner(String cloudOwner) {\r
- this.cloudOwner = cloudOwner;\r
- }\r
-\r
- public String getCloudRegionId() {\r
- return cloudRegionId;\r
- }\r
-\r
- public void setCloudRegionId(String cloudRegionId) {\r
- this.cloudRegionId = cloudRegionId;\r
- }\r
- /**\r
- * @return the aicClli (aka aic site, physical location id)\r
- */\r
- public String getAicClli() {\r
- return aicClli;\r
- }\r
-\r
- public void setAicClli(String aicClli) {\r
- this.aicClli = aicClli;\r
- }\r
-\r
- public String getAicVersion() {\r
- return aicVersion;\r
- }\r
-\r
- public void setAicVersion(String aicVersion) {\r
- this.aicVersion = aicVersion;\r
- }\r
-\r
- public String getTenant() {\r
- return tenant;\r
- }\r
-\r
- public void setTenant(String tenant) {\r
- this.tenant = tenant;\r
- }\r
-\r
- /**\r
- * @return the vnf that the resource was homed too.\r
- */\r
- public VnfResource getVnf() {\r
- return vnf;\r
- }\r
-\r
- public void setVnf(VnfResource vnf) {\r
- this.vnf = vnf;\r
- }\r
-\r
- public License getLicense() {\r
- return license;\r
- }\r
-\r
- public void setLicense(License license) {\r
- this.license = license;\r
- }\r
-\r
-\r
- public static long getSerialversionuid() {\r
- return serialVersionUID;\r
- }\r
-\r
-\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+/**
+ * Stores resources placement and licensing information
+ *
+ */
+@JsonRootName("homingSolution")
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class HomingSolution extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private InventoryType inventoryType;
+ private boolean isRehome;
+ private String serviceInstanceId; //TODO should start using si object instead
+ private String cloudOwner;
+ private String cloudRegionId;
+ private String aicClli;
+ private String aicVersion;
+ private String tenant;
+ private VnfResource vnf;
+ private License license = new License();
+
+
+ /**
+ * @return the inventoryType which indicates the solution type
+ */
+ public InventoryType getInventoryType() {
+ return inventoryType;
+ }
+
+ public void setInventoryType(InventoryType inventoryType) {
+ this.inventoryType = inventoryType;
+ }
+ public boolean isRehome() {
+ return isRehome;
+ }
+ public void setRehome(boolean isRehome) {
+ this.isRehome = isRehome;
+ }
+
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ public void setServiceInstanceId(String serviceInstanceId) {
+ this.serviceInstanceId = serviceInstanceId;
+ }
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getCloudRegionId() {
+ return cloudRegionId;
+ }
+
+ public void setCloudRegionId(String cloudRegionId) {
+ this.cloudRegionId = cloudRegionId;
+ }
+ /**
+ * @return the aicClli (aka aic site, physical location id)
+ */
+ public String getAicClli() {
+ return aicClli;
+ }
+
+ public void setAicClli(String aicClli) {
+ this.aicClli = aicClli;
+ }
+
+ public String getAicVersion() {
+ return aicVersion;
+ }
+
+ public void setAicVersion(String aicVersion) {
+ this.aicVersion = aicVersion;
+ }
+
+ public String getTenant() {
+ return tenant;
+ }
+
+ public void setTenant(String tenant) {
+ this.tenant = tenant;
+ }
+
+ /**
+ * @return the vnf that the resource was homed too.
+ */
+ public VnfResource getVnf() {
+ return vnf;
+ }
+
+ public void setVnf(VnfResource vnf) {
+ this.vnf = vnf;
+ }
+
+ public License getLicense() {
+ return license;
+ }
+
+ public void setLicense(License license) {
+ this.license = license;
+ }
+
+
+ public static long getSerialversionuid() {
+ return serialVersionUID;
+ }
+
+
}
\ No newline at end of file
private String modelVersion = "";\r
//additionally on resource level\r
private String modelCustomizationUuid = "";\r
+ private String modelCustomizationName = "";\r
private String modelInstanceName = "";\r
private String modelType = "";\r
\r
public void setModelCustomizationUuid(String modelCustomizationUuid) {\r
this.modelCustomizationUuid = modelCustomizationUuid;\r
}\r
+ public String getModelCustomizationName() {\r
+ return modelCustomizationName;\r
+ }\r
+ public void setModelCustomizationName(String modelCustomizationName) {\r
+ this.modelCustomizationName = modelCustomizationName;\r
+ }\r
public String getModelInstanceName() {\r
return modelInstanceName;\r
}\r
<artifactId>libphonenumber</artifactId>
<version>8.9.1</version>
</dependency>
-
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <version>1.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
</dependencies>
</project>
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.infrastructure.scripts;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance
+import org.openecomp.mso.bpmn.core.domain.CompareModelsResult
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.common.scripts.VidUtils
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+import java.util.UUID;
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONObject;
+import org.json.JSONArray;
+import org.apache.commons.lang3.*
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.web.util.UriUtils;
+
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList
+import org.xml.sax.InputSource
+/**
+ * This groovy class supports the <class>CompareModelofE2EServiceInstance.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - globalSubscriberId
+ * @param - subscriptionServiceType
+ * @param - serviceInstanceId
+ * @param - modelInvariantIdTarget
+ * @param - modelVersionIdTarget
+
+ *
+ * Outputs:
+ * @param - WorkflowException
+ */
+public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor {
+
+ String Prefix="CMPMDSI_"
+ private static final String DebugFlag = "isDebugEnabled"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ VidUtils vidUtils = new VidUtils()
+
+ public void preProcessRequest (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ String msg = ""
+
+ utils.log("INFO", " *** preProcessRequest Request *** ", isDebugEnabled)
+
+ try {
+ // check for incoming json message/input
+ String siRequest = execution.getVariable("bpmnRequest")
+ utils.logAudit(siRequest)
+
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ msg = "Input serviceInstanceId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+
+ Map reqMap = jsonSlurper.parseText(siRequest)
+
+ //InputParams
+ def userParams = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+ if (userParams) {
+ userParams.each {
+ userParam -> inputMap.put(userParam.name, userParam.value.toString())
+ }
+ }
+ execution.setVariable("operationType", "CompareModel")
+
+ utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
+ execution.setVariable("serviceInputParams", inputMap)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult")
+
+ // RESTResponse (for API Handler(APIH) Reply Task)
+ String syncResponse = compareModelsResult.toString()
+ utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, syncResponse)
+
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse: " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ }
+
+ public void sendSyncError (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled)
+
+ try {
+ String errorMessage = ""
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException")
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ utils.logAudit(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+ }
+
+ }
+
+ public void prepareCompletionRequest (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled)
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String source = execution.getVariable("source")
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>COMPAREMODEL</action>
+ <source>${source}</source>
+ </request-info>
+ <aetgt:status-message>E2E Service Instance Compare model successfully.</aetgt:status-message>
+ <aetgt:mso-bpel-name>CompareModelofE2EServiceInstance</aetgt:mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // Format Response
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable("completionRequest", xmlMsoCompletionRequest)
+ utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+
+ } catch (Exception ex) {
+ String msg = " Exception in prepareCompletion:" + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
+ }
+
+ public void prepareFalloutRequest(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled)
+
+ try {
+ WorkflowException wfex = execution.getVariable("WorkflowException")
+ utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled)
+ String requestId = execution.getVariable("msoRequestId")
+ String source = execution.getVariable("source")
+ String requestInfo =
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>COMPAREMODEL</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
+ execution.setVariable("falloutRequest", falloutRequest)
+ } catch (Exception ex) {
+ utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
+ String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
+ String requestId = execution.getVariable("msoRequestId")
+ String falloutRequest =
+ """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1"
+ xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>COMPAREMODEL</action>
+ <source>UUI</source>
+ </request-info>
+ <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+
+ execution.setVariable("falloutRequest", falloutRequest)
+ }
+ utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled)
+ }
+
+}
+
utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)\r
}\r
\r
- public void prepareDecomposeService_Target(Execution execution) {\r
+ public void prepareDecomposeService_Target(DelegateExecution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
\r
try {\r
}\r
}\r
\r
- public void processDecomposition_Target(Execution execution) {\r
+ public void processDecomposition_Target(DelegateExecution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
\r
utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled) \r
}\r
}\r
\r
- public void prepareDecomposeService_Original(Execution execution) {\r
+ public void prepareDecomposeService_Original(DelegateExecution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
\r
try {\r
}\r
}\r
\r
- public void processDecomposition_Original(Execution execution) {\r
+ public void processDecomposition_Original(DelegateExecution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
\r
utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled) \r
}\r
} \r
\r
- public void doCompareModelVersions(execution){\r
+ public void doCompareModelVersions(DelegateExecution execution){\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled) \r
\r
List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();\r
List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();\r
\r
- List<Resource> addedResource = new ArrayList<String>()\r
- List<Resource> delResource = new ArrayList<String>()\r
+ List<Resource> addResourceList = new ArrayList<String>()\r
+ List<Resource> delResourceList = new ArrayList<String>()\r
\r
addResourceList.addAll(allSR_target)\r
delResourceList.addAll(allSR_original)\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.bpmn.infrastructure.scripts;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.ServiceInstance
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.CompareModelsResult
+import org.openecomp.mso.bpmn.core.domain.ResourceModelInfo
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+
+import java.util.List
+import java.util.Map
+import java.util.UUID;
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONObject;
+import org.json.JSONArray;
+import org.apache.commons.lang3.*
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.web.util.UriUtils;
+
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList
+import org.xml.sax.InputSource
+/**
+ * This groovy class supports the <class>DoCompareModelofE2EServiceInstance.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - globalSubscriberId
+ * @param - subscriptionServiceType
+ * @param - serviceInstanceId
+ * @param - modelInvariantIdTarget
+ * @param - modelVersionIdTarget
+ *
+ * Outputs:
+ * @param - compareModelsResult CompareModelsResult
+
+ */
+public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor {
+
+ String Prefix="DCMPMDSI_"
+ private static final String DebugFlag = "isDebugEnabled"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void preProcessRequest (DelegateExecution execution) {
+ execution.setVariable("isDebugLogEnabled","true")
+
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO","Entered " + method, isDebugEnabled)
+ String msg = ""
+ utils.log("INFO"," ***** Enter CompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled)
+
+ execution.setVariable("prefix", Prefix)
+ //Inputs
+
+ //subscriberInfo. for AAI GET
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled)
+
+ String serviceType = execution.getVariable("serviceType")
+ utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled)
+
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ if (isBlank(serviceType)) {
+ msg = "Input serviceType is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)){
+ msg = "Input serviceInstanceId is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String modelInvariantUuid = execution.getVariable('modelInvariantIdTarget')
+ if (isBlank(modelInvariantUuid)){
+ msg = "Input modelInvariantUuid is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String modelUuid = execution.getVariable('modelVersionIdTarget')
+ if (isBlank(modelUuid)){
+ msg = "Input modelUuid is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ // Set Target Template info
+ execution.setVariable("model-invariant-id-target", modelInvariantUuid)
+ execution.setVariable("model-version-id-target", modelUuid)
+
+
+ utils.log("INFO", "Exited " + method, isDebugEnabled)
+ }
+
+ public void postProcessAAIGET(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled)
+ String msg = ""
+
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator")
+ String serviceType = ""
+
+ if(foundInAAI){
+ utils.log("INFO","Found Service-instance in AAI", isDebugEnabled)
+
+ String siData = execution.getVariable("GENGS_service")
+ utils.log("INFO", "SI Data", isDebugEnabled)
+ if (isBlank(siData))
+ {
+ msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ else
+ {
+ utils.log("INFO", "SI Data" + siData, isDebugEnabled)
+
+ // Get Template uuid and version
+ if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
+ utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled)
+
+ def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id")
+ def modelVersionId = utils.getNodeText1(siData, "model-version-id")
+
+ // Set Original Template info
+ execution.setVariable("model-invariant-id-original", modelInvariantId)
+ execution.setVariable("model-version-id-original", modelVersionId)
+ }
+ }
+ }else{
+ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
+ if(!succInAAI){
+ utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled)
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ utils.logAudit("workflowException: " + workflowException)
+ if(workflowException != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
+ }
+ else
+ {
+ msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled)
+ }
+ }catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage()
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
+ }
+
+ public void postCompareModelVersions(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+
+ List<Resource> addResourceList = execution.getVariable("addResourceList")
+ List<Resource> delResourceList = execution.getVariable("delResourceList")
+
+ CompareModelsResult cmpResult = new CompareModelsResult()
+ List<ResourceModelInfo> addedResourceList = new ArrayList<ResourceModelInfo>()
+ List<ResourceModelInfo> deletedResourceList = new ArrayList<ResourceModelInfo>()
+
+
+ String serviceModelUuid = execution.getVariable("model-version-id-target")
+ List<String> requestInputs = new ArrayList<String>()
+ ModelInfo mi = null;
+ for(Resource rc : addResourceList) {
+ mi = rc.getModelInfo()
+ String resourceCustomizationUuid = mi.getModelCustomizationUuid()
+ ResourceModelInfo rmodel = new ResourceModelInfo()
+ rmodel.setResourceName(mi.getModelName())
+ rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid())
+ rmodel.setResourceUuid(mi.getModelUuid())
+ rmodel.setResourceCustomizationUuid(resourceCustomizationUuid)
+ addedResourceList.add(rmodel)
+
+ Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null)
+ requestInputs.addAll(resourceParameters.keySet())
+ }
+
+ for(Resource rc : deletedResourceList) {
+ mi = rc.getModelInfo()
+ String resourceCustomizationUuid = mi.getModelCustomizationUuid()
+ ResourceModelInfo rmodel = new ResourceModelInfo()
+ rmodel.setResourceName(mi.getModelName())
+ rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid())
+ rmodel.setResourceUuid(mi.getModelUuid())
+ rmodel.setResourceCustomizationUuid(resourceCustomizationUuid)
+ deletedResourceList.add(rmodel)
+ }
+
+ cmpResult.setAddedResourceList(addedResourceList)
+ cmpResult.setDeletedResourceList(deletedResourceList)
+ cmpResult.setRequestInputs(requestInputs)
+
+ execution.setVariable("compareModelsResult", cmpResult)
+ }
+
+}
+
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
List<Resource> resourceList = serviceDecomposition.getServiceResources()
- for(String resource : resourceList){
- resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
+ for(Resource resource : resourceList){
+ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
}
def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
<soapenv:Header/>
<soapenv:Body>
<ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <operationType>${operationType}</operationType>
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
- </ns:initResourceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
payload = utils.formatXml(payload)
execution.setVariable("CVFMI_initResOperStatusRequest", payload)
}
utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
}
-
- /**
- * sequence resource. we should analyze resource sequence from service template
- * Here we make VF first, and then network for E2E service.
- */
- public void sequenceResoure(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled)
- String serviceModelUUID = execution.getVariable("modelUuid")
- JSONArray networks = cutils.getAllNetworksByServiceModelUuid(execution, serviceModelUUID)
- utils.log("DEBUG", "obtained Network list: " + networks, isDebugEnabled)
- if (networks == null) {
- utils.log("INFO", "No matching networks in Catalog DB for serviceModelUUID=" + serviceModelUUID, isDebugEnabled)
- }
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //we use VF to define a network service
- List<VnfResource> vnfResourceList= serviceDecomposition.getServiceVnfs()
-
- //here wan is defined as a network resource
- List<NetworkResource> networkResourceList = serviceDecomposition.getServiceNetworks()
-
- //allotted resource
- List<AllottedResource> arResourceList= serviceDecomposition.getServiceAllottedResources()
- //define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
- List<Resource> sequencedResourceList = new ArrayList<Resource>();
- if(null != vnfResourceList){
- sequencedResourceList.addAll(vnfResourceList)
- }
- if(null != networkResourceList){
- sequencedResourceList.addAll(networkResourceList)
- }
- if(null != arResourceList){
- sequencedResourceList.addAll(arResourceList)
- }
-
- String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true"
- execution.setVariable("isContainsWanResource", isContainsWanResource)
- execution.setVariable("currentResourceIndex", 0)
- execution.setVariable("sequencedResourceList", sequencedResourceList)
- utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled)
- utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
+ // prepare input param for using DoCreateResources.bpmn
+ public void preProcessForAddResource(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " ======== STARTED preProcessForAddResource Process ======== ", isDebugEnabled)
+
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ List<Resource> addResourceList = serviceDecomposition.getServiceResources()
+ execution.setVariable("addResourceList", addResourceList)
+
+ utils.log("INFO", "======== COMPLETED preProcessForAddResource Process ======== ", isDebugEnabled)
}
+
+ public void postProcessForAddResource(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ // do nothing now
- public void getCurrentResoure(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)
- def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- Resource currentResource = sequencedResourceList.get(currentIndex)
- utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled)
- utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
- }
+ }
- /**
- * sequence resource
- */
- public void parseNextResource(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
- def currentIndex = execution.getVariable("currentResourceIndex")
- def nextIndex = currentIndex + 1
- execution.setVariable("currentResourceIndex", nextIndex)
- List<String> sequencedResourceList = execution.getVariable("sequencedResourceList")
- if(nextIndex >= sequencedResourceList.size()){
- execution.setVariable("allResourceFinished", "true")
- }else{
- execution.setVariable("allResourceFinished", "false")
- }
- utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
- }
-
- /**
- * post config request.
- */
- public void postConfigRequest(DelegateExecution execution){
- //now do noting
- }
-
- public void prepareResourceRecipeRequest(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- ResourceInput resourceInput = new ResourceInput()
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- String resourceInstanceName = resourceType + "_" + serviceInstanceName
- resourceInput.setResourceInstanceName(resourceInstanceName)
- utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- String serviceType = execution.getVariable("serviceType")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
- String operationType = execution.getVariable("operationType")
- resourceInput.setGlobalSubscriberId(globalSubscriberId)
- resourceInput.setServiceType(serviceType)
- resourceInput.setServiceInstanceId(serviceInstanceId)
- resourceInput.setOperationId(operationId)
- resourceInput.setOperationType(operationType);
- def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- Resource currentResource = sequencedResourceList.get(currentIndex)
- resourceInput.setResourceModelInfo(currentResource.getModelInfo());
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
-
- String incomingRequest = execution.getVariable("uuiRequest")
- //set the requestInputs from tempalte To Be Done
- String serviceModelUuid = execution.getVariable("modelUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
- resourceInput.setResourceParameters(resourceParameters)
- execution.setVariable("resourceInput", resourceInput)
- utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- }
-
- public void executeResourceRecipe(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled)
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceType = execution.getVariable("serviceType")
- ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction)
- String recipeUri = resourceRecipe.getString("orchestrationUri")
- String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
- HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
-
- }
}
import java.util.ArrayList
import java.util.Iterator
import java.util.List
-import javax.mail.Quota.Resource
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.core.domain.AllottedResource
import org.openecomp.mso.bpmn.core.domain.NetworkResource
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
/**
* This groovy class supports the <class>DoCreateResources.bpmn</class> process.
{
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest(DelegateExecution execution)
{
utils.log("INFO", " ***** Exit preProcessRequest *****", isDebugEnabled)
}
- public void sequenceResoure(Object execution)
+ public void sequenceResoure(DelegateExecution execution)
{
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled)
if (rc instanceof VnfResource) {
vnfResourceList.add(rc)
} else if (rc instanceof NetworkResource) {
- NetworkResource.add(rc)
+ networkResourceList.add(rc)
} else if (rc instanceof AllottedResource) {
- AllottedResource.add(rc)
+ arResourceList.add(rc)
}
}
sequencedResourceList.addAll(vnfResourceList)
utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
}
- public void getCurrentResoure(execution){
+ public void getCurrentResoure(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)
def currentIndex = execution.getVariable("currentResourceIndex")
utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
}
- public void parseNextResource(execution){
+ public void parseNextResource(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
def currentIndex = execution.getVariable("currentResourceIndex")
}
utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
}
+
+ public void prepareResourceRecipeRequest(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
+ ResourceInput resourceInput = new ResourceInput()
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String resourceInstanceName = resourceType + "_" + serviceInstanceName
+ resourceInput.setResourceInstanceName(resourceInstanceName)
+ utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
+ resourceInput.setGlobalSubscriberId(globalSubscriberId)
+ resourceInput.setServiceType(serviceType)
+ resourceInput.setServiceInstanceId(serviceInstanceId)
+ resourceInput.setOperationId(operationId)
+ resourceInput.setOperationType(operationType);
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
+ Resource currentResource = sequencedResourceList.get(currentIndex)
+ resourceInput.setResourceModelInfo(currentResource.getModelInfo());
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo());
+
+ String incomingRequest = execution.getVariable("uuiRequest")
+ //set the requestInputs from tempalte To Be Done
+ String serviceModelUuid = execution.getVariable("modelUuid")
+ String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
+ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
+ resourceInput.setResourceParameters(resourceParameters)
+ execution.setVariable("resourceInput", resourceInput)
+ utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
+ }
+
+ public void executeResourceRecipe(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled)
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceType = execution.getVariable("serviceType")
+ ResourceInput resourceInput = execution.getVariable("resourceInput")
+ String requestAction = resourceInput.getOperationType()
+ JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
+ String recipeUri = resourceRecipe.getString("orchestrationUri")
+ String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
+ String recipeParamXsd = resourceRecipe.get("paramXSD")
+ HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+
+ }
- public void prepareResourceRecipeRequest(execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- ResourceInput resourceInput = new ResourceInput()
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
- String resourceInstanceName = resourceType + "_" + serviceInstanceName
- resourceInput.setResourceInstanceName(resourceInstanceName)
- utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled)
- String globalSubscriberId = execution.getVariable("globalSubscriberId")
- String serviceType = execution.getVariable("serviceType")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String operationId = execution.getVariable("operationId")
- String operationType = execution.getVariable("operationType")
- resourceInput.setGlobalSubscriberId(globalSubscriberId)
- resourceInput.setServiceType(serviceType)
- resourceInput.setServiceInstanceId(serviceInstanceId)
- resourceInput.setOperationId(operationId)
- resourceInput.setOperationType(operationType);
- def currentIndex = execution.getVariable("currentResourceIndex")
- List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList")
- Resource currentResource = sequencedResourceList.get(currentIndex)
- String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid()
- resourceInput.setResourceCustomizationUuid(resourceCustomizationUuid);
- String resourceInvariantUuid = currentResource.getModelInfo().getModelInvariantUuid()
- resourceInput.setResourceInvariantUuid(resourceInvariantUuid)
- String resourceUuid = currentResource.getModelInfo().getModelUuid()
- resourceInput.setResourceUuid(resourceUuid)
-
- String incomingRequest = execution.getVariable("uuiRequest")
- //set the requestInputs from tempalte To Be Done
- String serviceModelUuid = execution.getVariable("modelUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
- resourceInput.setResourceParameters(resourceParameters)
- execution.setVariable("resourceInput", resourceInput)
- utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
- }
-
- public void executeResourceRecipe(execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled)
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceType = execution.getVariable("serviceType")
- ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction)
- String recipeUri = resourceRecipe.getString("orchestrationUri")
- String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
- HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
-
- }
-
- public void postConfigRequest(execution){
+ public void postConfigRequest(DelegateExecution execution){
//now do noting
}
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONArray;
+import static org.apache.commons.lang3.StringUtils.*;
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.json.JSONObject;
+import org.springframework.web.util.UriUtils;
+
+/**
+ * This groovy class supports the <class>DoScaleServiceInstance.bpmn</class> process.
+ *
+ */
+public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor {
+
+ String Prefix = "DCRESI_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ public void preProcessRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ String msg = ""
+ utils.log("DEBUG", " ***** preProcessRequest *****", isDebugEnabled)
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ execution.setVariable("prefix", Prefix)
+
+ //Inputs
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+ String serviceType = execution.getVariable("serviceType")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ execution.setVariable("serviceType", serviceType)
+
+ String resourceTemplateUUIDs = ""
+ String scaleNsRequest = execution.getVariable("bpmnRequest")
+ JSONObject jsonObject = new JSONObject(scaleNsRequest).getJSONObject("service")
+ JSONArray jsonArray = jsonObject.getJSONArray("resources")
+
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject reqBodyJsonObj = jsonArray.getJSONObject(i)
+ String nsInstanceId = reqBodyJsonObj.getString("resourceInstanceId")
+ resourceTemplateUUIDs = resourceTemplateUUIDs + nsInstanceId + ":"
+ }
+
+ execution.setVariable("resourceTemplateUUIDs", resourceTemplateUUIDs)
+
+ if (serviceInstanceName == null) {
+ execution.setVariable("serviceInstanceName", "")
+ }
+ if (isBlank(serviceInstanceId)) {
+ msg = "Input serviceInstanceId is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+
+ public void preInitResourcesOperStatus(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+ utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String operationType = "SCALE"
+
+ // resourceTemplateUUIDs should be created ??
+ String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs")
+ utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled)
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONArray
+import org.json.JSONObject;
+
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.codehaus.jackson.map.ObjectMapper
+
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.rest.APIResponse;
+
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleResource
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsData
+
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NSResourceInputParameter
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsOperationKey
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsScaleParameters
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsParameters
+import org.openecomp.mso.bpmn.infrastructure.vfcmodel.LocationConstraint
+
+
+/**
+ * This groovy class supports the <class>DoScaleVFCNetworkServiceInstance.bpmn</class> process.
+ * flow for VFC Network Service Scale
+ */
+public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
+
+ String host = "http://mso.mso.testlab.openecomp.org:8080"
+
+ String scaleUrl = "/vfc/rest/v1/vfcadapter/ns/{nsInstanceId}/scale"
+
+ String queryJobUrl = "/vfc/rest/v1/vfcadapter/jobs/{jobId}"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ * generate the nsParameters
+ */
+ public void preProcessRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+
+ List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution)
+ String requestJsonStr = ""
+ int size = nsRIPList.size()
+ for (int i = 0; i < size; i++) {
+ NSResourceInputParameter nsRIP = nsRIPList.get(i)
+
+ if (i == size - 1) {
+ requestJsonStr += objectToJsonStr(nsRIP)
+ } else {
+ requestJsonStr += objectToJsonStr(nsRIP) + "|"
+ }
+ }
+
+ execution.setVariable("reqBody", requestJsonStr)
+
+ utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+ /**
+ * scale NS task
+ */
+ public void scaleNetworkService(DelegateExecution execution) {
+
+ String saleNsRequest = execution.getVariable("reqBody")
+ String[] nsReqStr = saleNsRequest.split("\\|")
+
+ def jobIdArray = ['jobId001', 'jobId002'] as String[]
+
+ for (int i = 0; i < nsReqStr.length; i++) {
+ JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i])
+ String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId")
+ reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId")
+ String reqBody = reqBodyJsonObj.toString()
+
+ String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId)
+
+ APIResponse apiResponse = postRequest(execution, url, reqBody)
+
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ String jobId = "";
+ if (returnCode == "200") {
+ jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId")
+ }
+
+ execution.setVariable("jobId", jobIdArray[i])
+
+ String isScaleFinished = ""
+
+ // query the requested network service scale status, if finished, then start the next one, otherwise, wait
+ while (isScaleFinished != "finished"){
+ timeDelay()
+ queryNSProgress(execution)
+ isScaleFinished = execution.getVariable("operationStatus")
+ }
+ }
+ }
+
+ /**
+ * query NS task
+ */
+ private void queryNSProgress(DelegateExecution execution) {
+ String jobId = execution.getVariable("jobId")
+ String url = host + queryJobUrl.replaceAll("\\{jobId\\}", jobId)
+
+ NsOperationKey nsOperationKey = new NsOperationKey()
+ // is this net work service ID or E2E service ID?
+ nsOperationKey.setServiceId(execution.getVariable("serviceId"))
+ nsOperationKey.setServiceType(execution.getVariable("serviceType"))
+ nsOperationKey.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+ nsOperationKey.setNodeTemplateUUID(execution.getVariable("nodeTemplateUUID"))
+ nsOperationKey.setOperationId(execution.getVariable("operationId"))
+ String queryReqBody = objectToJsonStr(nsOperationKey)
+
+ APIResponse apiResponse = postRequest(execution,url, queryReqBody)
+
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+
+ String operationStatus = "error"
+
+ if (returnCode == "200") {
+ operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status")
+ }
+
+ execution.setVariable("operationStatus", operationStatus)
+ }
+
+ /**
+ * delay 5 sec
+ *
+ */
+ private void timeDelay() {
+ try {
+ Thread.sleep(5000)
+ } catch (InterruptedException e) {
+ taskProcessor.utils.log("ERROR", "Time Delay exception" + e, isDebugEnabled)
+ }
+ }
+
+ /**
+ * finish NS task
+ */
+ public void finishNSScale(DelegateExecution execution) {
+ //no need to do anything util now
+ System.out.println("Scale finished.")
+ }
+
+ /**
+ * post request
+ * url: the url of the request
+ * requestBody: the body of the request
+ */
+ private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled)
+ utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled)
+ APIResponse apiResponse = null
+ try{
+ RESTConfig config = new RESTConfig(url)
+ RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+ apiResponse = client.httpPost(requestBody)
+ utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled)
+ utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled)
+ }catch(Exception e){
+ utils.log("ERROR","Exception occured while executing VFC Post Call. Exception is: \n" + e, isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ return apiResponse
+ }
+
+ /**
+ * create a Scale Resource object list from a NSScaleRequestJso nString
+ * This method is for the specific request from Scale Network Service BPMN workflow
+ * @param nsScaleRequestJsonString , a specific request Json string which conform to ?? class
+ * @return List < ScaleResource >
+ */
+ private List<ScaleResource> jsonGetNsResourceList(String nsScaleRequestJsonString) {
+ List<ScaleResource> list = new ArrayList<ScaleResource>()
+ JSONObject jsonObject = new JSONObject(nsScaleRequestJsonString)
+
+ JSONObject jsonResource = jsonObject.getJSONObject("service")
+ JSONArray arr = jsonResource.getJSONArray("resources")
+
+ for (int i = 0; i < arr.length(); i++) {
+ JSONObject tempResource = arr.getJSONObject(i)
+ ScaleResource resource = new ScaleResource()
+ resource.setResourceInstanceId(tempResource.getString("resourceInstanceId"))
+ resource.setScaleType(tempResource.getString("scaleType"))
+
+ JSONObject jsonScaleNsData = tempResource.getJSONObject("scaleNsData")
+ JSONObject jsonScaleNsByStepData = jsonScaleNsData.getJSONObject("scaleNsByStepsData")
+
+ ScaleNsData scaleNsData = new ScaleNsData()
+ ScaleNsByStepsData stepsData = new ScaleNsByStepsData()
+
+ stepsData.setAspectId(jsonScaleNsByStepData.getString("aspectId"))
+ stepsData.setScalingDirection(jsonScaleNsByStepData.getString("scalingDirection"))
+ stepsData.setNumberOfSteps(Integer.parseInt(jsonScaleNsByStepData.getString("numberOfSteps")))
+
+ scaleNsData.setScaleNsByStepsData(stepsData)
+ resource.setScaleNsData(scaleNsData)
+ list.add(resource)
+ }
+
+ return list
+ }
+
+ /**
+ * Convert a java class to JSON string
+ * @param obj
+ * @return
+ */
+ private String objectToJsonStr(Object obj) {
+ ObjectMapper mapper = new ObjectMapper()
+ String jsonStr = null
+ try {
+ jsonStr = mapper.writeValueAsString(obj)
+ } catch (IOException ioe) {
+ System.out.println(ioe.getMessage())
+ }
+ return jsonStr
+
+ }
+
+ /**
+ * create a NSResourceInputParameter list from a Scale Network request Json string
+ * @return
+ */
+ private List<NSResourceInputParameter> convertScaleNsReq2NSResInputParamList(DelegateExecution execution) {
+ String saleNsRequest = execution.getVariable("bpmnRequest")
+
+ //String requestId = execution.getVariable("msoRequestId")
+ //String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ //String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID")
+ String serviceType = execution.getVariable("serviceType")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String operationId = execution.getVariable("operationId")
+ String serviceId = execution.getVariable("serviceId")
+ String nsServiceDescription = execution.getVariable("requestDescription")
+
+ String resource = JsonUtils.getJsonValue(saleNsRequest, "service.resources")
+
+ // set nsScaleParameters properties
+ List<ScaleResource> scaleResourcesList = jsonGetNsResourceList(saleNsRequest)
+ List<NSResourceInputParameter> nsResourceInputParameterList = new ArrayList<NSResourceInputParameter>()
+
+ for (ScaleResource sr : scaleResourcesList) {
+ NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter()
+ NsOperationKey nsOperationKey = new NsOperationKey()
+ NsParameters nsParameters = new NsParameters()
+ NsScaleParameters nsScaleParameters = new NsScaleParameters()
+ nsParameters.setLocationConstraints(new ArrayList<LocationConstraint>())
+ nsParameters.setAdditionalParamForNs(new HashMap<String, Object>())
+
+ // set NsOperationKey properties
+ nsOperationKey.setGlobalSubscriberId(globalSubscriberId)
+ nsOperationKey.setServiceId(serviceId)
+ nsOperationKey.setServiceType(serviceType)
+ // for ns scale the resourceInstanceId is the nodeTemplateUUID
+ nsOperationKey.setNodeTemplateUUID(sr.getResourceInstanceId())
+ nsOperationKey.setOperationId(operationId)
+
+ nsScaleParameters.setScaleType(sr.getScaleType())
+ nsScaleParameters.setNsInstanceId(sr.getResourceInstanceId())
+
+ ScaleNsByStepsData scaleNsByStepsData = new ScaleNsByStepsData()
+ scaleNsByStepsData.setScalingDirection(sr.getScaleNsData().getScaleNsByStepsData().getScalingDirection())
+ scaleNsByStepsData.setNumberOfSteps(sr.getScaleNsData().getScaleNsByStepsData().getNumberOfSteps())
+ scaleNsByStepsData.setAspectId(sr.getScaleNsData().getScaleNsByStepsData().getAspectId())
+
+ List<ScaleNsByStepsData> scaleNsByStepsDataList = new ArrayList<ScaleNsByStepsData>()
+ scaleNsByStepsDataList.add(scaleNsByStepsData)
+ nsScaleParameters.setScaleNsByStepsData(scaleNsByStepsDataList)
+
+ nsResourceInputParameter.setNsOperationKey(nsOperationKey)
+ nsResourceInputParameter.setNsServiceName(serviceInstanceName)
+ nsResourceInputParameter.setNsServiceDescription(nsServiceDescription)
+ nsResourceInputParameter.setNsParameters(nsParameters)
+ nsResourceInputParameter.setNsScaleParameters(nsScaleParameters)
+
+ nsResourceInputParameterList.add(nsResourceInputParameter)
+ }
+ return nsResourceInputParameterList
+ }
+}
+
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition\r
import org.openecomp.mso.bpmn.core.domain.ServiceInstance\r
import org.openecomp.mso.bpmn.core.domain.ModelInfo\r
+import org.openecomp.mso.bpmn.core.domain.Resource\r
import org.openecomp.mso.bpmn.core.json.JsonUtils\r
import org.openecomp.mso.bpmn.common.scripts.AaiUtil\r
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
execution.setVariable("modelInvariantUuid", modelInvariantUuid)\r
execution.setVariable("model-invariant-id-target", modelInvariantUuid)\r
execution.setVariable("modelUuid", modelUuid)\r
- execution.setVariable("model-version-id-target", modelUuid_target)\r
+ execution.setVariable("model-version-id-target", modelUuid)\r
\r
//AAI PUT\r
String oStatus = execution.getVariable("initialStatus") ?: ""\r
String operationType = execution.getVariable("operationType")\r
String resourceTemplateUUIDs = ""\r
String result = "processing"\r
- String progress = "0"\r
+ String progress = "10"\r
String reason = ""\r
String operationContent = "Prepare service updating"\r
utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)\r
execution.setVariable("serviceInstanceId", serviceId)\r
execution.setVariable("operationId", operationId)\r
execution.setVariable("operationType", operationType)\r
- \r
- String serviceRelationShip = execution.getVariable("serviceRelationShip")\r
- \r
- def jsonSlurper = new JsonSlurper()\r
- def jsonOutput = new JsonOutput() \r
- List relationShipList = jsonSlurper.parseText(serviceRelationShip)\r
- \r
- if (relationShipList != null) {\r
- relationShipList.each {\r
- resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"\r
- }\r
- } \r
- execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
\r
- String payload =\r
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
+ List<Resource> resourceList = new ArrayList<String>()\r
+ List<Resource> addResourceList = execution.getVariable("addResourceList")\r
+ List<Resource> delResourceList = execution.setVariable("delResourceList")\r
+ resourceList.addAll(addResourceList)\r
+ resourceList.addAll(delResourceList)\r
+ for(Resource resource : resourceList){\r
+ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"\r
+ }\r
+ \r
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"\r
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)\r
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)\r
+\r
+ String payload =\r
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
xmlns:ns="http://org.openecomp.mso/requestsdb">\r
<soapenv:Header/>\r
<soapenv:Body>\r
<ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">\r
- <serviceId>${serviceId}</serviceId>\r
- <operationId>${operationId}</operationId>\r
- <operationType>${operationType}</operationType>\r
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>\r
- </ns:initResourceOperationStatus>\r
- </soapenv:Body>\r
- </soapenv:Envelope>"""\r
-\r
- payload = utils.formatXml(payload)\r
- execution.setVariable("CVFMI_initResOperStatusRequest", payload)\r
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)\r
- utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)\r
+ <serviceId>${serviceId}</serviceId>\r
+ <operationId>${operationId}</operationId>\r
+ <operationType>${operationType}</operationType>\r
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>\r
+ </ns:initResourceOperationStatus>\r
+ </soapenv:Body>\r
+ </soapenv:Envelope>"""\r
+\r
+ payload = utils.formatXml(payload)\r
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)\r
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)\r
+ utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)\r
\r
}catch(Exception e){\r
utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)\r
try{\r
String serviceId = execution.getVariable("serviceInstanceId")\r
String operationId = execution.getVariable("operationId")\r
+ String operationType = execution.getVariable("operationType")\r
String serviceName = execution.getVariable("serviceInstanceName")\r
String userId = ""\r
String result = "processing"\r
\r
public void postProcessForAddResource(DelegateExecution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
+ utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)\r
+ \r
+ ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")\r
+ execution.setVariable("serviceDecomposition", serviceDecomposition_Target)\r
\r
+ utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)\r
}\r
\r
public void preProcessForDeleteResource(DelegateExecution execution) {\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+
+import static org.apache.commons.lang3.StringUtils.*
+import org.openecomp.mso.logger.MsoLogger
+import org.openecomp.mso.utils.UUIDChecker
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+
+import org.springframework.web.util.UriUtils
+
+
+/**
+ * This groovy class supports the <class>ScaleCustomE2EServiceInstance.bpmn</class> process.
+ *
+ */
+public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor {
+ String Prefix = "CRESI_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH);
+
+ public void preProcessRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+ utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+
+ try {
+
+ String siRequest = execution.getVariable("bpmnRequest")
+ utils.logAudit(siRequest)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ serviceInstanceId = "NULL".toString()
+ }
+ utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)
+ serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8")
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+ // service instance ID is also service ID
+ execution.setVariable("serviceId", serviceInstanceId)
+ // service instance name
+ String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "service.serviceInstanceName")
+ execution.setVariable("serviceInstanceName", serviceInstanceName)
+
+ // service instance name
+ String serviceType = jsonUtil.getJsonValue(siRequest, "service.serviceType")
+ execution.setVariable("serviceType", serviceType)
+
+ // operationa ID (key)
+ //String operationKey = UUIDChecker.generateUUID(msoLogger)
+ String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
+ execution.setVariable("operationId", operationId)
+ utils.log("DEBUG", "Input Request:" + siRequest + " operationId:" + operationId, isDebugEnabled)
+
+
+ String resources = jsonUtil.getJsonValue(siRequest, "service.resources")
+ execution.setVariable("resources", resources)
+
+ // node template UUID
+ String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger)
+ execution.setVariable("nodeTemplateUUID", nodeTemplateUUID)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "service.globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ String requestDescription = "request description for test"
+ execution.setVariable("requestDescription", requestDescription)
+ execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+ public void sendSyncResponse(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ String operationId = execution.getVariable("operationId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ // RESTResponse for API Handler (APIH) Reply Task
+ String scaleServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${
+ operationId
+ }"}}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, scaleServiceRestRequest)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG", " ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ }
+
+
+ public void sendSyncError(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled)
+
+ try {
+ String errorMessage = ""
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException")
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ utils.logAudit(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+ }
+
+ }
+
+ public void prepareCompletionRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled)
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String source = execution.getVariable("source")
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>SCALE</action>
+ <source>${source}</source>
+ </request-info>
+ <status-message>Service Instance was scaled successfully.</status-message>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // Format Response
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+ utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+
+ } catch (Exception ex) {
+ String msg = " Exception in prepareCompletion:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
+ }
+
+ public void prepareFalloutRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled)
+
+ try {
+ WorkflowException wfex = execution.getVariable("WorkflowException")
+ utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled)
+ String requestId = execution.getVariable("msoRequestId")
+ String source = execution.getVariable("source")
+ String requestInfo =
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>SCALE</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
+ execution.setVariable("falloutRequest", falloutRequest)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
+ String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
+ String requestId = execution.getVariable("msoRequestId")
+ String falloutRequest =
+ """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1"
+ xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>SCALE</action>
+ <source>UUI</source>
+ </request-info>
+ <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+
+ execution.setVariable("falloutRequest", falloutRequest)
+ }
+ utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled)
+ }
+
+
+ /**
+ * Init the service Operation Status
+ */
+ public void prepareInitServiceOperationStatus(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String serviceName = execution.getVariable("serviceInstanceName")
+ String operationId = execution.getVariable("operationId")
+ String operationType = "SCALE"
+ String userId = ""
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service scaling"
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <serviceName>${serviceName}</serviceName>
+ <operationType>${operationType}</operationType>
+ <userId>${userId}</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason>${reason}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+ utils.logAudit("Scale network service updateServiceOperStatusRequest Request: " + payload)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
+ }
+ utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ }
+}
\ No newline at end of file
}
utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
+
+ /**
+ * Init the service Operation Status
+ */
+ public void prepareInitServiceOperationStatus(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ try{
+ String serviceId = execution.getVariable("serviceInstanceId")
+ String operationId = UUID.randomUUID().toString()
+ String operationType = execution.getVariable("operationType")
+ String userId = ""
+ String result = "processing"
+ String progress = "0"
+ String reason = ""
+ String operationContent = "Prepare service updating"
+ utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled)
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceId)
+ execution.setVariable("operationId", operationId)
+ execution.setVariable("operationType", operationType)
+
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <userId>${userId}</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason>${reason}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled)
+ utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled)
+ execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage())
+ }
+ utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
+ }
public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
*/
public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
- private static final String DebugFlag = "isDebugLogEnabled"
-
- String Prefix="CVRCS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
-
- /**
- * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
- * @param execution
- */
- public InitializeProcessVariables(DelegateExecution execution){
- /* Initialize all the process variables in this block */
-
- execution.setVariable("createVcpeServiceRequest", "")
- execution.setVariable("globalSubscriberId", "")
- execution.setVariable("serviceInstanceName", "")
- execution.setVariable("msoRequestId", "")
- execution.setVariable(Prefix+"VnfsCreatedCount", 0)
- execution.setVariable("productFamilyId", "")
- execution.setVariable("brgWanMacAddress", "")
-
- //TODO
- execution.setVariable("sdncVersion", "1707")
- }
-
- // **************************************************
- // Pre or Prepare Request Section
- // **************************************************
- /**
- * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
- * @param execution
- */
- public void preProcessRequest (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix",Prefix)
-
- utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
-
- try {
- // initialize flow variables
- InitializeProcessVariables(execution)
-
- //Config Inputs
- String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')
- if (isBlank(aaiDistDelay)) {
- msg = "URN_mso_workflow_aai_distribution_delay is null"
- utils.log("DEBUG", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
- execution.setVariable("aaiDistDelay", aaiDistDelay)
- utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled)
-
- // check for incoming json message/input
- String createVcpeServiceRequest = execution.getVariable("bpmnRequest")
- utils.logAudit(createVcpeServiceRequest)
- execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest);
- println 'createVcpeServiceRequest - ' + createVcpeServiceRequest
-
- // extract requestId
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
-
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {
- serviceInstanceId = UUID.randomUUID().toString()
- utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled)
- } else {
- utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled)
- }
-
- serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
- execution.setVariable("serviceInstanceId", serviceInstanceId)
-
- String requestAction = execution.getVariable("requestAction")
- execution.setVariable("requestAction", requestAction)
-
- setBasicDBAuthHeader(execution, isDebugEnabled)
-
- String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source")
- if ((source == null) || (source.isEmpty())) {
- source = "VID"
- }
- execution.setVariable("source", source)
-
- // extract globalSubscriberId
- String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")
-
- // verify element global-customer-id is sent from JSON input, throw exception if missing
- if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) {
- String dataErrorMessage = " Element 'globalSubscriberId' is missing. "
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
-
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- execution.setVariable("globalCustomerId", globalSubscriberId)
- }
-
- // extract subscriptionServiceType
- String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)
-
- String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback")
- execution.setVariable("disableRollback", suppressRollback)
- utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled)
-
- String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
- execution.setVariable("productFamilyId", productFamilyId)
- utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled)
-
- String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo")
- execution.setVariable("subscriberInfo", subscriberInfo)
- utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled)
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)
-\r
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
- Map<String, String> inputMap = [:]
-
-
- if (userParams) {
- userParams.each {
- userParam ->
- if("BRG_WAN_MAC_Address".equals(userParam?.name)) {
- execution.setVariable("brgWanMacAddress", userParam.value)
- inputMap.put("BRG_WAN_MAC_Address", userParam.value)
- }
- }
- }
-
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
- execution.setVariable("serviceInputParams", inputMap)
-
- utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled)
-
- //For Completion Handler & Fallout Handler
- String requestInfo =
- """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>"""
-
- execution.setVariable(Prefix+"requestInfo", requestInfo)
-
- utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
-
- } catch (BpmnError e) {
- throw e;
-
- } catch (Exception ex){
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void sendSyncResponse(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String requestId = execution.getVariable("mso-request-id")
-
- // RESTResponse (for API Handler (APIH) Reply Task)
- String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
-
- utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
- sendWorkflowResponse(execution, 202, syncResponse)
-
- } catch (Exception ex) {
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- //
- // *******************************
- public void prepareDecomposeService(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
-
- //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB
- String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo")
- execution.setVariable("serviceModelInfo", serviceModelInfo)
-
- utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- //
- // *******************************
- public void prepareCreateServiceInstance(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
-// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters")
-// execution.setVariable("serviceInputParams", serviceInputParams)
-
-
- String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName")
- execution.setVariable("serviceInstanceName", serviceInstanceName)
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName())
-
- utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void postProcessServiceInstanceCreate (DelegateExecution execution){
- def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable(DebugFlag)
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String requestId = execution.getVariable("mso-request-id")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String serviceInstanceName = execution.getVariable("serviceInstanceName")
-
- try {
-
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${requestId}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <serviceInstanceName>${serviceInstanceName}</serviceInstanceName>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
- execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload)
- utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload)
- logDebug('Exited ' + method, isDebugLogEnabled)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- }
-
-
- public void processDecomposition (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- // VNFs
- List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()
- filterVnfs(vnfList)
- serviceDecomposition.setServiceVnfs(vnfList)
-
- execution.setVariable("vnfList", vnfList)
- execution.setVariable("vnfListString", vnfList.toString())
-
- String vnfModelInfoString = ""
- if (vnfList != null && vnfList.size() > 0) {
- execution.setVariable(Prefix+"VNFsCount", vnfList.size())
- utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled)
- ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
-
- vnfModelInfoString = vnfModelInfo.toString()
- String vnfModelInfoWithRoot = vnfModelInfo.toString()
- vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
- } else {
- execution.setVariable(Prefix+"VNFsCount", 0)
- utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled)
- }
-
- execution.setVariable("vnfModelInfo", vnfModelInfoString)
- execution.setVariable("vnfModelInfoString", vnfModelInfoString)
- utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- sendSyncError(execution)
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage()
- utils.log("DEBUG", exceptionMessage, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- private void filterVnfs(List<VnfResource> vnfList) {
- if(vnfList == null) {
- return
- }
-
- // remove BRG & TXC from VNF list
-
- Iterator<VnfResource> it = vnfList.iterator()
- while(it.hasNext()) {
- VnfResource vr = it.next()
-
- String role = vr.getNfRole()
- if(role == "BRG" || role == "TunnelXConn") {
- it.remove()
- }
- }
- }
-
-
- public void prepareCreateAllottedResourceTXC(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //allottedResourceModelInfo
- //allottedResourceRole
- //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
- //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
- List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
- if (allottedResources != null) {
- Iterator iter = allottedResources.iterator();
- while (iter.hasNext()){
- AllottedResource allottedResource = (AllottedResource)iter.next();
-
- utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
- utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
- if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){
- //set create flag to true
- execution.setVariable("createTXCAR", true)
- ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
- execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName())
- execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole())
- execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType())
- //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC,
- //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated).
- execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId())
- }
- }
- }
-
- //unit test only
- String allottedResourceId = execution.getVariable("allottedResourceId")
- execution.setVariable("allottedResourceIdTXC", allottedResourceId)
- utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
- public void prepareCreateAllottedResourceBRG(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- /*
- * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
- * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
- *
- */
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- //allottedResourceModelInfo
- //allottedResourceRole
- //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
- //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
- List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
- if (allottedResources != null) {
- Iterator iter = allottedResources.iterator();
- while (iter.hasNext()){
- AllottedResource allottedResource = (AllottedResource)iter.next();
-
- utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
- utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
- if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){
- //set create flag to true
- execution.setVariable("createBRGAR", true)
- ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
- execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName())
- execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole())
- execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType())
- //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG,
- //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated).
- execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId())
- }
- }
- }
-
- //unit test only
- String allottedResourceId = execution.getVariable("allottedResourceId")
- execution.setVariable("allottedResourceIdBRG", allottedResourceId)
- utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
-
-
- // *******************************
- // Generate Network request Section
- // *******************************
- public void prepareVnfAndModulesCreate (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- // String disableRollback = execution.getVariable("disableRollback")
- // def backoutOnFailure = ""
- // if(disableRollback != null){
- // if ( disableRollback == true) {
- // backoutOnFailure = "false"
- // } else if ( disableRollback == false) {
- // backoutOnFailure = "true"
- // }
- // }
- //failIfExists - optional
-
- String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
- String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
- execution.setVariable("productFamilyId", productFamilyId)
- utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled)
-
- List<VnfResource> vnfList = execution.getVariable("vnfList")
-
- Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")
- String vnfModelInfoString = null;
-
- if (vnfList != null && vnfList.size() > 0 ) {
- utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled)
- ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo()
- utils.log("DEBUG", "got 0 ", isDebugEnabled)
- ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo()
- vnfModelInfoString = vnfModelInfo.toString()
- } else {
- //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored
- vnfModelInfoString = execution.getVariable("vnfModelInfo")
- }
-
- utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
-
- // extract cloud configuration
- String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId")
- execution.setVariable("lcpCloudRegionId", lcpCloudRegionId)
- utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled)
- String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId")
- execution.setVariable("tenantId", tenantId)
- utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled)
-
- String sdncVersion = execution.getVariable("sdncVersion")
- utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled)
-
- utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *******************************
- // Validate Vnf request Section -> increment count
- // *******************************
- public void validateVnfCreate (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- try {
- utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount")
- vnfsCreatedCount++
-
- execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount)
-
- utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- // *****************************************
- // Prepare Completion request Section
- // *****************************************
- public void postProcessResponse (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String source = execution.getVariable("source")
- String requestId = execution.getVariable("mso-request-id")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
-
- String msoCompletionRequest =
- """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:ns="http://org.openecomp/mso/request/types/v1">
- <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>
- <status-message>Service Instance has been created successfully via macro orchestration</status-message>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <mso-bpel-name>BPMN macro create</mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- // Format Response
- String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
-
- utils.logAudit(xmlMsoCompletionRequest)
- execution.setVariable(Prefix+"Success", true)
- execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest)
- utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
- public void preProcessRollback (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
- try {
-
- Object workflowException = execution.getVariable("WorkflowException");
-
- if (workflowException instanceof WorkflowException) {
- utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
- execution.setVariable("prevWorkflowException", workflowException);
- //execution.setVariable("WorkflowException", null);
- }
- } catch (BpmnError e) {
- utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
- } catch(Exception ex) {
- String msg = "Exception in preProcessRollback. " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- }
- utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
- }
-
- public void postProcessRollback (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
- String msg = ""
- try {
- Object workflowException = execution.getVariable("prevWorkflowException");
- if (workflowException instanceof WorkflowException) {
- utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
- execution.setVariable("WorkflowException", workflowException);
- }
- } catch (BpmnError b) {
- utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
- throw b;
- } catch(Exception ex) {
- msg = "Exception in postProcessRollback. " + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- }
- utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
- }
-
- public void prepareFalloutRequest(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable(DebugFlag)
-
- utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)
-
- try {
- WorkflowException wfex = execution.getVariable("WorkflowException")
- utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)
- String requestInfo = execution.getVariable(Prefix+"requestInfo")
- utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)
-
- //TODO. hmmm. there is no way to UPDATE error message.
-// String errorMessage = wfex.getErrorMessage()
-// boolean successIndicator = execution.getVariable("DCRESI_rolledBack")
-// if (successIndicator){
-// errorMessage = errorMessage + ". Rollback successful."
-// } else {
-// errorMessage = errorMessage + ". Rollback not completed."
-// }
-
- String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
-
- execution.setVariable(Prefix+"falloutRequest", falloutRequest)
-
- } catch (Exception ex) {
- utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process")
- }
- utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)
- }
-
-
- public void sendSyncError (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix", Prefix)
-
- utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled)
-
- try {
- String errorMessage = ""
- def wfe = execution.getVariable("WorkflowException")
- if (wfe instanceof WorkflowException) {
- errorMessage = wfe.getErrorMessage()
- } else {
- errorMessage = "Sending Sync Error."
- }
-
- String buildworkflowException =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- utils.logAudit(buildworkflowException)
- sendWorkflowResponse(execution, 500, buildworkflowException)
- } catch (Exception ex) {
- utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
- }
- }
-
- public void processJavaException(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable(DebugFlag)
- execution.setVariable("prefix",Prefix)
- try{
- utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)
- utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
- utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)
- execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
- }catch(BpmnError b){
- utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
- execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
- }
- utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
- }
+ private static final String DebugFlag = "isDebugLogEnabled"
+
+ String Prefix = "CVRCS_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ VidUtils vidUtils = new VidUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
+
+ /**
+ * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
+ * @param execution
+ */
+ public InitializeProcessVariables(DelegateExecution execution) {
+ /* Initialize all the process variables in this block */
+
+ execution.setVariable("createVcpeServiceRequest", "")
+ execution.setVariable("globalSubscriberId", "")
+ execution.setVariable("serviceInstanceName", "")
+ execution.setVariable("msoRequestId", "")
+ execution.setVariable(Prefix + "VnfsCreatedCount", 0)
+ execution.setVariable("productFamilyId", "")
+ execution.setVariable("brgWanMacAddress", "")
+ execution.setVariable("customerLocation", "")
+ execution.setVariable("homingService", "")
+
+ //TODO
+ execution.setVariable("sdncVersion", "1707")
+ }
+
+ // **************************************************
+ // Pre or Prepare Request Section
+ // **************************************************
+ /**
+ * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
+ * @param execution
+ */
+ public void preProcessRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+ execution.setVariable("prefix", Prefix)
+
+ utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
+
+ try {
+ // initialize flow variables
+ InitializeProcessVariables(execution)
+
+ //Config Inputs
+ String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay')
+ if (isBlank(aaiDistDelay)) {
+ msg = "URN_mso_workflow_aai_distribution_delay is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("aaiDistDelay", aaiDistDelay)
+ utils.log("DEBUG", "AAI distribution delay: " + aaiDistDelay, isDebugEnabled)
+
+ // check for incoming json message/input
+ String createVcpeServiceRequest = execution.getVariable("bpmnRequest")
+ utils.logAudit(createVcpeServiceRequest)
+ execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest);
+ println 'createVcpeServiceRequest - ' + createVcpeServiceRequest
+
+ // extract requestId
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) {
+ serviceInstanceId = UUID.randomUUID().toString()
+ utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId, isDebugEnabled)
+ } else {
+ utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId, isDebugEnabled)
+ }
+
+ serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8")
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+ String requestAction = execution.getVariable("requestAction")
+ execution.setVariable("requestAction", requestAction)
+
+ setBasicDBAuthHeader(execution, isDebugEnabled)
+
+ String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source")
+ if ((source == null) || (source.isEmpty())) {
+ source = "VID"
+ }
+ execution.setVariable("source", source)
+
+ // extract globalSubscriberId
+ String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId")
+
+ // verify element global-customer-id is sent from JSON input, throw exception if missing
+ if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) {
+ String dataErrorMessage = " Element 'globalSubscriberId' is missing. "
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
+
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ execution.setVariable("globalCustomerId", globalSubscriberId)
+ }
+
+ // extract subscriptionServiceType
+ String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType")
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled)
+
+ String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback")
+ execution.setVariable("disableRollback", suppressRollback)
+ utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled)
+
+ String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
+ execution.setVariable("productFamilyId", productFamilyId)
+ utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled)
+
+ String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo")
+ execution.setVariable("subscriberInfo", subscriberInfo)
+ utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled)
+
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+
+ Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest)
+
+ //InputParams
+ def userParams = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+
+ if (userParams) {
+ userParams.each {
+ userParam ->
+ if("BRG_WAN_MAC_Address".equals(userParam?.name)) {
+ execution.setVariable("brgWanMacAddress", userParam.value)
+ inputMap.put("BRG_WAN_MAC_Address", userParam.value)
+ }
+ if("Customer_Location".equals(userParam?.name)) {
+ execution.setVariable("customerLocation", userParam.value)
+ userParam.value.each {
+ customerLocParam ->
+ inputMap.put(customerLocParam.key, customerLocParam.value)
+ }
+ }
+ if("Homing_Solution".equals(userParam?.name)) {
+ execution.setVariable("homingService", userParam.value)
+ inputMap.put("Homing_Solution", userParam.value)
+ } else {
+ execution.setVariable("homingService", "oof")
+ }
+ }
+ }
+
+ utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
+ execution.setVariable("serviceInputParams", inputMap)
+
+ utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled)
+
+ //For Completion Handler & Fallout Handler
+ String requestInfo =
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ execution.setVariable(Prefix + "requestInfo", requestInfo)
+
+ utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled)
+
+ } catch (BpmnError e) {
+ throw e;
+
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void sendSyncResponse(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String requestId = execution.getVariable("mso-request-id")
+
+ // RESTResponse (for API Handler (APIH) Reply Task)
+ String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${
+ requestId
+ }"}}""".trim()
+
+ utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, syncResponse)
+
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ // *******************************
+ //
+ // *******************************
+ public void prepareDecomposeService(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
+
+ //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB
+ String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo")
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+ utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ // *******************************
+ //
+ // *******************************
+ public void prepareCreateServiceInstance(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ /*
+ * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
+ * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+ *
+ */
+ String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
+// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters")
+// execution.setVariable("serviceInputParams", serviceInputParams)
+
+
+ String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName")
+ execution.setVariable("serviceInstanceName", serviceInstanceName)
+
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName())
+
+ utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void postProcessServiceInstanceCreate(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')'
+ def isDebugLogEnabled = execution.getVariable(DebugFlag)
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String requestId = execution.getVariable("mso-request-id")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+
+ try {
+
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>${requestId}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ <serviceInstanceName>${serviceInstanceName}</serviceInstanceName>
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload)
+ utils.logAudit(Prefix + "setUpdateDbInstancePayload: " + payload)
+ logDebug('Exited ' + method, isDebugLogEnabled)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+ }
+
+
+ public void processDecomposition(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ try {
+
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ // VNFs
+ List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs()
+ filterVnfs(vnfList)
+ serviceDecomposition.setServiceVnfs(vnfList)
+
+ execution.setVariable("vnfList", vnfList)
+ execution.setVariable("vnfListString", vnfList.toString())
+
+ String vnfModelInfoString = ""
+ if (vnfList != null && vnfList.size() > 0) {
+ execution.setVariable(Prefix + "VNFsCount", vnfList.size())
+ utils.log("DEBUG", "vnfs to create: " + vnfList.size(), isDebugEnabled)
+ ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
+
+ vnfModelInfoString = vnfModelInfo.toString()
+ String vnfModelInfoWithRoot = vnfModelInfo.toString()
+ vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
+ } else {
+ execution.setVariable(Prefix + "VNFsCount", 0)
+ utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled)
+ }
+
+ execution.setVariable("vnfModelInfo", vnfModelInfoString)
+ execution.setVariable("vnfModelInfoString", vnfModelInfoString)
+ utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
+
+ utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ sendSyncError(execution)
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ private void filterVnfs(List<VnfResource> vnfList) {
+ if (vnfList == null) {
+ return
+ }
+
+ // remove BRG & TXC from VNF list
+
+ Iterator<VnfResource> it = vnfList.iterator()
+ while (it.hasNext()) {
+ VnfResource vr = it.next()
+
+ String role = vr.getNfRole()
+ if (role == "BRG" || role == "TunnelXConn") {
+ it.remove()
+ }
+ }
+ }
+
+
+ public void prepareCreateAllottedResourceTXC(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ /*
+ * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
+ * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+ *
+ */
+ String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ //allottedResourceModelInfo
+ //allottedResourceRole
+ //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
+ //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
+ List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
+ if (allottedResources != null) {
+ Iterator iter = allottedResources.iterator();
+ while (iter.hasNext()) {
+ AllottedResource allottedResource = (AllottedResource) iter.next();
+
+ utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
+ utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
+ if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) {
+ //set create flag to true
+ execution.setVariable("createTXCAR", true)
+ ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
+ execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName())
+ execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole())
+ execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType())
+ //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC,
+ //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated).
+ execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId())
+ }
+ }
+ }
+
+ //unit test only
+ String allottedResourceId = execution.getVariable("allottedResourceId")
+ execution.setVariable("allottedResourceIdTXC", allottedResourceId)
+ utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled)
+
+ utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void prepareCreateAllottedResourceBRG(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ /*
+ * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject
+ * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ * ModelInfo modelInfo = serviceDecomposition.getModelInfo()
+ *
+ */
+ String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ //allottedResourceModelInfo
+ //allottedResourceRole
+ //The model Info parameters are a JSON structure as defined in the Service Instantiation API.
+ //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB.
+ List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources()
+ if (allottedResources != null) {
+ Iterator iter = allottedResources.iterator();
+ while (iter.hasNext()) {
+ AllottedResource allottedResource = (AllottedResource) iter.next();
+
+ utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled)
+ utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled)
+ if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) {
+ //set create flag to true
+ execution.setVariable("createBRGAR", true)
+ ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo()
+ execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName())
+ execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole())
+ execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType())
+ //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG,
+ //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated).
+ execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId())
+ }
+ }
+ }
+
+ //unit test only
+ String allottedResourceId = execution.getVariable("allottedResourceId")
+ execution.setVariable("allottedResourceIdBRG", allottedResourceId)
+ utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled)
+
+ utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ // *******************************
+ // Generate Network request Section
+ // *******************************
+ public void prepareVnfAndModulesCreate(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ // String disableRollback = execution.getVariable("disableRollback")
+ // def backoutOnFailure = ""
+ // if(disableRollback != null){
+ // if ( disableRollback == true) {
+ // backoutOnFailure = "false"
+ // } else if ( disableRollback == false) {
+ // backoutOnFailure = "true"
+ // }
+ // }
+ //failIfExists - optional
+
+ String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest")
+ String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId")
+ execution.setVariable("productFamilyId", productFamilyId)
+ utils.log("DEBUG", "productFamilyId: " + productFamilyId, isDebugEnabled)
+
+ List<VnfResource> vnfList = execution.getVariable("vnfList")
+
+ Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount")
+ String vnfModelInfoString = null;
+
+ if (vnfList != null && vnfList.size() > 0) {
+ utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled)
+ ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo()
+ utils.log("DEBUG", "got 0 ", isDebugEnabled)
+ ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo()
+ vnfModelInfoString = vnfModelInfo.toString()
+ } else {
+ //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored
+ vnfModelInfoString = execution.getVariable("vnfModelInfo")
+ }
+
+ utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled)
+
+ // extract cloud configuration
+ String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
+ "requestDetails.cloudConfiguration.lcpCloudRegionId")
+ def cloudRegion = vimId.split("_")
+ execution.setVariable("cloudOwner", cloudRegion[0])
+ utils.log("DEBUG","cloudOwner: "+ cloudRegion[0], isDebugEnabled)
+ execution.setVariable("cloudRegionId", cloudRegion[1])
+ utils.log("DEBUG","cloudRegionId: "+ cloudRegion[1], isDebugEnabled)
+ execution.setVariable("lcpCloudRegionId", cloudRegion[1])
+ utils.log("DEBUG","lcpCloudRegionId: "+ cloudRegion[1], isDebugEnabled)
+ String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest,
+ "requestDetails.cloudConfiguration.tenantId")
+ execution.setVariable("tenantId", tenantId)
+ utils.log("DEBUG", "tenantId: " + tenantId, isDebugEnabled)
+
+ String sdncVersion = execution.getVariable("sdncVersion")
+ utils.log("DEBUG", "sdncVersion: " + sdncVersion, isDebugEnabled)
+
+ utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ // *******************************
+ // Validate Vnf request Section -> increment count
+ // *******************************
+ public void validateVnfCreate(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ try {
+ utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount")
+ vnfsCreatedCount++
+
+ execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount)
+
+ utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount, isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ // *****************************************
+ // Prepare Completion request Section
+ // *****************************************
+ public void postProcessResponse(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ try {
+ String source = execution.getVariable("source")
+ String requestId = execution.getVariable("mso-request-id")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>${source}</source>
+ </request-info>
+ <status-message>Service Instance has been created successfully via macro orchestration</status-message>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ <mso-bpel-name>BPMN macro create</mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // Format Response
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ utils.logAudit(xmlMsoCompletionRequest)
+ execution.setVariable(Prefix + "Success", true)
+ execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+ utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void preProcessRollback(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+ utils.log("DEBUG", " ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
+ try {
+
+ Object workflowException = execution.getVariable("WorkflowException");
+
+ if (workflowException instanceof WorkflowException) {
+ utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled)
+ execution.setVariable("prevWorkflowException", workflowException);
+ //execution.setVariable("WorkflowException", null);
+ }
+ } catch (BpmnError e) {
+ utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled)
+ } catch (Exception ex) {
+ String msg = "Exception in preProcessRollback. " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ }
+ utils.log("DEBUG", " *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
+ }
+
+ public void postProcessRollback(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+ utils.log("DEBUG", " ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled)
+ String msg = ""
+ try {
+ Object workflowException = execution.getVariable("prevWorkflowException");
+ if (workflowException instanceof WorkflowException) {
+ utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled)
+ execution.setVariable("WorkflowException", workflowException);
+ }
+ } catch (BpmnError b) {
+ utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled)
+ throw b;
+ } catch (Exception ex) {
+ msg = "Exception in postProcessRollback. " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ }
+ utils.log("DEBUG", " *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled)
+ }
+
+ public void prepareFalloutRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled)
+
+ try {
+ WorkflowException wfex = execution.getVariable("WorkflowException")
+ utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled)
+ String requestInfo = execution.getVariable(Prefix + "requestInfo")
+ utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled)
+
+ //TODO. hmmm. there is no way to UPDATE error message.
+// String errorMessage = wfex.getErrorMessage()
+// boolean successIndicator = execution.getVariable("DCRESI_rolledBack")
+// if (successIndicator){
+// errorMessage = errorMessage + ". Rollback successful."
+// } else {
+// errorMessage = errorMessage + ". Rollback not completed."
+// }
+
+ String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
+
+ execution.setVariable(Prefix + "falloutRequest", falloutRequest)
+
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process")
+ }
+ utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled)
+ }
+
+
+ public void sendSyncError(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+ execution.setVariable("prefix", Prefix)
+
+ utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled)
+
+ try {
+ String errorMessage = ""
+ def wfe = execution.getVariable("WorkflowException")
+ if (wfe instanceof WorkflowException) {
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ utils.logAudit(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+ } catch (Exception ex) {
+ utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+ }
+ }
+
+ public void processJavaException(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+ execution.setVariable("prefix", Prefix)
+ try {
+ utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled)
+ utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
+ utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled)
+ execution.setVariable(Prefix + "unexpectedError", "Caught a Java Lang Exception")
+ // Adding this line temporarily until this flows error handling gets updated
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception")
+ } catch (BpmnError b) {
+ utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ } catch (Exception e) {
+ utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
+ execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method")
+ // Adding this line temporarily until this flows error handling gets updated
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method")
+ }
+ utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
+ }
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class LocationConstraint {
+
+ /**
+ * vnf profile id
+ */
+ private String vnfProfileId;
+
+ /**
+ * location constraints: vimId
+ */
+ private VimLocation locationConstraints;
+
+ /**
+ * @return Returns the vnfProfileId.
+ */
+ public String getVnfProfileId() {
+ return vnfProfileId;
+ }
+
+ /**
+ * @param vnfProfileId The vnfProfileId to set.
+ */
+ public void setVnfProfileId(String vnfProfileId) {
+ this.vnfProfileId = vnfProfileId;
+ }
+
+
+ /**
+ * @return Returns the locationConstraints.
+ */
+ public VimLocation getLocationConstraints() {
+ return locationConstraints;
+ }
+
+
+ /**
+ * @param locationConstraints The locationConstraints to set.
+ */
+ public void setLocationConstraints(VimLocation locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+import org.openecomp.mso.logger.MsoLogger;
+
+
+/**
+ * NS Create Input Parameter For VFC Adapter<br>
+ * <p>
+ * </p>
+ *
+ * @version ONAP Beijing Release 2018/2/5
+ */
+public class NSResourceInputParameter {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+
+ private NsOperationKey nsOperationKey;
+
+ private String nsServiceName;
+
+ private String nsServiceDescription;
+
+ private NsParameters nsParameters;
+
+ private NsScaleParameters nsScaleParameters;
+
+
+
+
+ /**
+ * @return Returns the nsServiceName.
+ */
+ public String getNsServiceName() {
+ return nsServiceName;
+ }
+
+
+ /**
+ * @param nsServiceName The nsServiceName to set.
+ */
+ public void setNsServiceName(String nsServiceName) {
+ this.nsServiceName = nsServiceName;
+ }
+
+
+ /**
+ * @return Returns the nsServiceDescription.
+ */
+ public String getNsServiceDescription() {
+ return nsServiceDescription;
+ }
+
+
+ /**
+ * @param nsServiceDescription The nsServiceDescription to set.
+ */
+ public void setNsServiceDescription(String nsServiceDescription) {
+ this.nsServiceDescription = nsServiceDescription;
+ }
+
+ /**
+ * @return Returns the nsParameters.
+ */
+ public NsParameters getNsParameters() {
+ return nsParameters;
+ }
+
+ /**
+ * @param nsParameters The nsParameters to set.
+ */
+ public void setNsParameters(NsParameters nsParameters) {
+ this.nsParameters = nsParameters;
+ }
+
+ public NsOperationKey getNsOperationKey() {
+ return nsOperationKey;
+ }
+
+ public void setNsOperationKey(NsOperationKey nsOperationKey) {
+ this.nsOperationKey = nsOperationKey;
+ }
+
+ /**
+ * @return Returns the nsScaleParameters.
+ */
+ public NsScaleParameters getNsScaleParameters() {
+ return nsScaleParameters;
+ }
+
+ /**
+ * @param nsScaleParameters The nsScaleParameters to set.
+ */
+ public void setNsScaleParameters(NsScaleParameters nsScaleParameters) {
+ this.nsScaleParameters = nsScaleParameters;
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+/**
+ * The operation key object for NS
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-09-15
+ */
+public class NsOperationKey {
+
+ /**
+ * The subscriber id
+ */
+ private String globalSubscriberId;
+
+ /**
+ * The serviceType
+ */
+ private String serviceType;
+
+ /**
+ * The service ID
+ */
+ private String serviceId;
+
+ /**
+ * The Operation ID
+ */
+ private String operationId;
+
+ /**
+ * the NS template uuid
+ */
+ private String nodeTemplateUUID;
+
+ /**
+ * @return Returns the globalSubscriberId.
+ */
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ /**
+ * @param globalSubscriberId The globalSubscriberId to set.
+ */
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ /**
+ * @return Returns the serviceType.
+ */
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ /**
+ * @param serviceType The serviceType to set.
+ */
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public String getServiceId() {
+ return serviceId;
+ }
+
+ /**
+ * <br>
+ *
+ * @param serviceId
+ * @since ONAP Amsterdam Release
+ */
+ public void setServiceId(String serviceId) {
+ this.serviceId = serviceId;
+ }
+
+ /**
+ * <br>
+ *
+ * @return
+ * @since ONAP Amsterdam Release
+ */
+ public String getOperationId() {
+ return operationId;
+ }
+
+ /**
+ * <br>
+ *
+ * @param operationId
+ * @since ONAP Amsterdam Release
+ */
+ public void setOperationId(String operationId) {
+ this.operationId = operationId;
+ }
+
+ /**
+ * @return Returns the nodeTemplateUUID.
+ */
+ public String getNodeTemplateUUID() {
+ return nodeTemplateUUID;
+ }
+
+ /**
+ * @param nodeTemplateUUID The nodeTemplateUUID to set.
+ */
+ public void setNodeTemplateUUID(String nodeTemplateUUID) {
+ this.nodeTemplateUUID = nodeTemplateUUID;
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-6
+ */
+public class NsParameters {
+
+ private List<LocationConstraint> locationConstraints;
+
+ private Map<String, Object> additionalParamForNs = new HashMap<String,Object>();
+ /**
+ * @return Returns the locationConstraints.
+ */
+ public List<LocationConstraint> getLocationConstraints() {
+ return locationConstraints;
+ }
+
+ /**
+ * @param locationConstraints The locationConstraints to set.
+ */
+ public void setLocationConstraints(List<LocationConstraint> locationConstraints) {
+ this.locationConstraints = locationConstraints;
+ }
+
+
+ /**
+ * @return Returns the additionalParamForNs.
+ */
+ public Map<String, Object> getAdditionalParamForNs() {
+ return additionalParamForNs;
+ }
+
+
+ /**
+ * @param additionalParamForNs The additionalParamForNs to set.
+ */
+ public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) {
+ this.additionalParamForNs = additionalParamForNs;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+import java.util.List;
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class NsScaleParameters {
+
+ private List<ScaleNsByStepsData> scaleNsByStepsData;
+
+ private String scaleType;
+
+
+ private String nsInstanceId;
+
+ /**
+ * @return Returns the scaleNsByStepsData.
+ */
+ public List<ScaleNsByStepsData> getScaleNsByStepsData() {
+ return scaleNsByStepsData;
+ }
+
+ /**
+ * @param scaleNsByStepsData The scaleNsByStepsData to set.
+ */
+ public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) {
+ this.scaleNsByStepsData = scaleNsByStepsData;
+ }
+
+ /**
+ * @return Returns the scale Type.
+ */
+ public String getScaleType() {
+ return scaleType;
+ }
+
+ /**
+ * @param scaleType The scaleType to set.
+ */
+ public void setScaleType(String scaleType) {
+ this.scaleType = scaleType;
+ }
+
+ public String getNsInstanceId() {
+ return nsInstanceId;
+ }
+
+ public void setNsInstanceId(String nsInstanceId) {
+ this.nsInstanceId = nsInstanceId;
+ }
+
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+
+/**
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-9-26
+ */
+public class ScaleNsByStepsData {
+
+ /**
+ * scaling Direction
+ */
+ private String scalingDirection;
+
+ /**
+ * aspect ID
+ */
+ private String aspectId;
+
+ /**
+ * number of Steps
+ */
+ private int numberOfSteps;
+
+ /**
+ * @return Returns the scalingDirection.
+ */
+ public String getScalingDirection() {
+ return scalingDirection;
+ }
+
+ /**
+ * @param scalingDirection The scalingDirection to set.
+ */
+ public void setScalingDirection(String scalingDirection) {
+ this.scalingDirection = scalingDirection;
+ }
+
+ /**
+ * @return Returns the aspectId.
+ */
+ public String getAspectId() {
+ return aspectId;
+ }
+
+ /**
+ * @param aspectId The aspectId to set.
+ */
+ public void setAspectId(String aspectId) {
+ this.aspectId = aspectId;
+ }
+
+ /**
+ * @return Returns the numberofSteps.
+ */
+ public int getNumberOfSteps() {
+ return numberOfSteps;
+ }
+
+ /**
+ * @param numberOfSteps The numberofSteps to set.
+ */
+ public void setNumberOfSteps(int numberOfSteps) {
+ this.numberOfSteps = numberOfSteps;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+public class ScaleNsData {
+
+ private ScaleNsByStepsData scaleNsByStepsData;
+
+ public ScaleNsByStepsData getScaleNsByStepsData() {
+ return scaleNsByStepsData;
+ }
+
+ public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) {
+ this.scaleNsByStepsData = scaleNsByStepsData;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+public class ScaleResource {
+
+ private String resourceInstanceId;
+
+ private String scaleType;
+
+ private ScaleNsData scaleNsData;
+
+ public String getResourceInstanceId() {
+ return resourceInstanceId;
+ }
+
+ public void setResourceInstanceId(String resourceInstanceId) {
+ this.resourceInstanceId = resourceInstanceId;
+ }
+
+ public String getScaleType() {
+ return scaleType;
+ }
+
+ public void setScaleType(String scaleType) {
+ this.scaleType = scaleType;
+ }
+
+ public ScaleNsData getScaleNsData() {
+ return scaleNsData;
+ }
+
+ public void setScaleNsData(ScaleNsData scaleNsData) {
+ this.scaleNsData = scaleNsData;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC. 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.openecomp.mso.bpmn.infrastructure.vfcmodel;
+
+
+/**
+ *
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version ONAP Amsterdam Release 2017-10-18
+ */
+public class VimLocation {
+ private String vimId;
+
+
+ /**
+ * @return Returns the vimId.
+ */
+ public String getVimId() {
+ return vimId;
+ }
+
+
+ /**
+ * @param vimId The vimId to set.
+ */
+ public void setVimId(String vimId) {
+ this.vimId = vimId;
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+ <bpmn:process id="ScaleCustomE2EServiceInstance" name="ScaleCustomE2EServiceInstance" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="Scale SI Start Flow">
+ <bpmn:outgoing>SequenceFlow_0c2denm</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="Task_03ivdxi" name="Pre Process Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0c2denm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ntnafv</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi= new ScaleCustomE2EServiceInstance()
+csi.preProcessRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0oezp57" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_14zd9we</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0er6ddi</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new ScaleCustomE2EServiceInstance()
+csi.sendSyncResponse(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_13jdprk" name="success ?">
+ <bpmn:incoming>SequenceFlow_1fis1j1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_06f0dx5</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_19b0pmt</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Task_1ogtanl" name="Prepare Completion Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_06f0dx5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1q6spfu</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new ScaleCustomE2EServiceInstance()
+csi.prepareCompletionRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="Task_1p5x1em" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" />
+ <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" />
+ <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" />
+ <camunda:in source="CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1q6spfu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mm4eqd</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_116d9ds" name="End">
+ <bpmn:incoming>SequenceFlow_0mm4eqd</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0mm4eqd" sourceRef="Task_1p5x1em" targetRef="EndEvent_116d9ds" />
+ <bpmn:sequenceFlow id="SequenceFlow_0c2denm" sourceRef="StartEvent_1" targetRef="Task_03ivdxi" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ntnafv" sourceRef="Task_03ivdxi" targetRef="Task_1rsd8qa" />
+ <bpmn:sequenceFlow id="SequenceFlow_0er6ddi" sourceRef="Task_0oezp57" targetRef="CallActivity_1vpyqzt" />
+ <bpmn:sequenceFlow id="SequenceFlow_06f0dx5" name="yes" sourceRef="ExclusiveGateway_13jdprk" targetRef="Task_1ogtanl">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) != null && execution.getVariable("jobId" ) != "" )}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_19b0pmt" name="no" sourceRef="ExclusiveGateway_13jdprk" targetRef="EndEvent_1sz49w7">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) == null || execution.getVariable("jobId" ) == "" )}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_1sz49w7">
+ <bpmn:incoming>SequenceFlow_19b0pmt</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_196t4z3" />
+ </bpmn:endEvent>
+ <bpmn:subProcess id="SubProcess_0bwngpt" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0yncnrj">
+ <bpmn:outgoing>SequenceFlow_04f826i</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1lp2j7l">
+ <bpmn:incoming>SequenceFlow_1t2ijcu</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_01p0bqh" name="Prepare Fallout Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_09z92mf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1sooz22</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new ScaleCustomE2EServiceInstance()
+csi.prepareFalloutRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1quc7x4" name="Send Error Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_04f826i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_09z92mf</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new ScaleCustomE2EServiceInstance()
+csi.sendSyncError(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_04f826i" sourceRef="StartEvent_0yncnrj" targetRef="ScriptTask_1quc7x4" />
+ <bpmn:sequenceFlow id="SequenceFlow_09z92mf" sourceRef="ScriptTask_1quc7x4" targetRef="ScriptTask_01p0bqh" />
+ <bpmn:sequenceFlow id="SequenceFlow_1t2ijcu" sourceRef="CallActivity_0miglgb" targetRef="EndEvent_1lp2j7l" />
+ <bpmn:sequenceFlow id="SequenceFlow_1sooz22" sourceRef="ScriptTask_01p0bqh" targetRef="CallActivity_0miglgb" />
+ <bpmn:callActivity id="CallActivity_0miglgb" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="falloutRequest" target="FalloutHandlerRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" />
+ <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" />
+ <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1sooz22</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1t2ijcu</bpmn:outgoing>
+ </bpmn:callActivity>
+ </bpmn:subProcess>
+ <bpmn:subProcess id="SubProcess_10vzjzh" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+ <bpmn:scriptTask id="ScriptTask_1jgr212" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0gna7ys</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0re5dm7</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:startEvent id="StartEvent_1awfo4s">
+ <bpmn:outgoing>SequenceFlow_0gna7ys</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_04azej9">
+ <bpmn:incoming>SequenceFlow_0re5dm7</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0gna7ys" name="" sourceRef="StartEvent_1awfo4s" targetRef="ScriptTask_1jgr212" />
+ <bpmn:sequenceFlow id="SequenceFlow_0re5dm7" name="" sourceRef="ScriptTask_1jgr212" targetRef="EndEvent_04azej9" />
+ </bpmn:subProcess>
+ <bpmn:callActivity id="CallActivity_1vpyqzt" name="Call DoScaleE2EServiceInstance " calledElement="DoScaleE2EServiceInstance">
+ <bpmn:extensionElements>
+ <camunda:out source="jobId" target="jobId" />
+ <camunda:in source="bpmnRequest" target="bpmnRequest" />
+ <camunda:out source="operationId" target="operationId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="requestDescription" target="requestDescription" />
+ <camunda:in source="operationId" target="operationId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0er6ddi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1fis1j1</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1fis1j1" sourceRef="CallActivity_1vpyqzt" targetRef="ExclusiveGateway_13jdprk" />
+ <bpmn:sequenceFlow id="SequenceFlow_1q6spfu" sourceRef="Task_1ogtanl" targetRef="Task_1p5x1em" />
+ <bpmn:sequenceFlow id="SequenceFlow_030pfun" sourceRef="Task_1rsd8qa" targetRef="Task_01n9mqa" />
+ <bpmn:scriptTask id="Task_1rsd8qa" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ntnafv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_030pfun</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi= new ScaleCustomE2EServiceInstance()
+csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_14zd9we" sourceRef="Task_01n9mqa" targetRef="Task_0oezp57" />
+ <bpmn:serviceTask id="Task_01n9mqa" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_030pfun</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_14zd9we</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmn:error id="Error_196t4z3" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ScaleCustomE2EServiceInstance">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="-13" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-28" y="138" width="67" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0nye5g4_di" bpmnElement="Task_03ivdxi">
+ <dc:Bounds x="87" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_08uouf4_di" bpmnElement="Task_0oezp57">
+ <dc:Bounds x="560" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_13jdprk_di" bpmnElement="ExclusiveGateway_13jdprk" isMarkerVisible="true">
+ <dc:Bounds x="928" y="95" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="927" y="73" width="51" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_11xceoj_di" bpmnElement="Task_1ogtanl">
+ <dc:Bounds x="1068" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1qhplvz_di" bpmnElement="Task_1p5x1em">
+ <dc:Bounds x="1068" y="281" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_116d9ds_di" bpmnElement="EndEvent_116d9ds">
+ <dc:Bounds x="1100" y="554" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1109" y="594" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mm4eqd_di" bpmnElement="SequenceFlow_0mm4eqd">
+ <di:waypoint xsi:type="dc:Point" x="1118" y="361" />
+ <di:waypoint xsi:type="dc:Point" x="1118" y="554" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1088" y="451.5" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c2denm_di" bpmnElement="SequenceFlow_0c2denm">
+ <di:waypoint xsi:type="dc:Point" x="23" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="87" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="10" y="99" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ntnafv_di" bpmnElement="SequenceFlow_1ntnafv">
+ <di:waypoint xsi:type="dc:Point" x="187" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="249" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="173" y="99" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0er6ddi_di" bpmnElement="SequenceFlow_0er6ddi">
+ <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="729" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="649.5" y="99" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_06f0dx5_di" bpmnElement="SequenceFlow_06f0dx5">
+ <di:waypoint xsi:type="dc:Point" x="978" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="1068" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1014" y="99" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_19b0pmt_di" bpmnElement="SequenceFlow_19b0pmt">
+ <di:waypoint xsi:type="dc:Point" x="953" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="953" y="232" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="962" y="183" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_00ekif2_di" bpmnElement="EndEvent_1sz49w7">
+ <dc:Bounds x="935" y="232" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="953" y="272" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_0bwngpt_di" bpmnElement="SubProcess_0bwngpt" isExpanded="true">
+ <dc:Bounds x="168" y="326" width="679" height="194" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0yncnrj_di" bpmnElement="StartEvent_0yncnrj">
+ <dc:Bounds x="183" y="412" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="66" y="453" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1lp2j7l_di" bpmnElement="EndEvent_1lp2j7l">
+ <dc:Bounds x="762" y="412" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="645" y="453" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_01p0bqh_di" bpmnElement="ScriptTask_01p0bqh">
+ <dc:Bounds x="441" y="390" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0miglgb_di" bpmnElement="CallActivity_0miglgb">
+ <dc:Bounds x="618" y="390" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1quc7x4_di" bpmnElement="ScriptTask_1quc7x4">
+ <dc:Bounds x="263" y="390" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_04f826i_di" bpmnElement="SequenceFlow_04f826i">
+ <di:waypoint xsi:type="dc:Point" x="219" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="241" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="241" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="262" y="430" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="121" y="430" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_09z92mf_di" bpmnElement="SequenceFlow_09z92mf">
+ <di:waypoint xsi:type="dc:Point" x="363" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="390" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="390" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="441" y="430" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="270" y="430" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1t2ijcu_di" bpmnElement="SequenceFlow_1t2ijcu">
+ <di:waypoint xsi:type="dc:Point" x="718" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="762" y="430" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="605" y="415" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1sooz22_di" bpmnElement="SequenceFlow_1sooz22">
+ <di:waypoint xsi:type="dc:Point" x="541" y="430" />
+ <di:waypoint xsi:type="dc:Point" x="618" y="430" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="447" y="415" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_10vzjzh_di" bpmnElement="SubProcess_10vzjzh" isExpanded="true">
+ <dc:Bounds x="294" y="593" width="394" height="188" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1jgr212_di" bpmnElement="ScriptTask_1jgr212">
+ <dc:Bounds x="442" y="648" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1awfo4s_di" bpmnElement="StartEvent_1awfo4s">
+ <dc:Bounds x="327" y="670" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="210" y="711" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_04azej9_di" bpmnElement="EndEvent_04azej9">
+ <dc:Bounds x="603" y="670" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="486" y="711" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gna7ys_di" bpmnElement="SequenceFlow_0gna7ys">
+ <di:waypoint xsi:type="dc:Point" x="363" y="688" />
+ <di:waypoint xsi:type="dc:Point" x="442" y="688" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="272" y="688" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0re5dm7_di" bpmnElement="SequenceFlow_0re5dm7">
+ <di:waypoint xsi:type="dc:Point" x="542" y="688" />
+ <di:waypoint xsi:type="dc:Point" x="603" y="688" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="444" y="688" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1vpyqzt_di" bpmnElement="CallActivity_1vpyqzt">
+ <dc:Bounds x="729" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fis1j1_di" bpmnElement="SequenceFlow_1fis1j1">
+ <di:waypoint xsi:type="dc:Point" x="829" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="928" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="878.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1q6spfu_di" bpmnElement="SequenceFlow_1q6spfu">
+ <di:waypoint xsi:type="dc:Point" x="1118" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="1118" y="281" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1088" y="214.5" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_030pfun_di" bpmnElement="SequenceFlow_030pfun">
+ <di:waypoint xsi:type="dc:Point" x="349" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="393" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="371" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_16ll9yo_di" bpmnElement="Task_1rsd8qa">
+ <dc:Bounds x="249" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_14zd9we_di" bpmnElement="SequenceFlow_14zd9we">
+ <di:waypoint xsi:type="dc:Point" x="493" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="526.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1kpeoxt_di" bpmnElement="Task_01n9mqa">
+ <dc:Bounds x="393" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
<bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" />
</bpmn:subProcess>
<bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1853xxi</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing>
<bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*\r
def csi = new UpdateCustomE2EServiceInstance()\r
<bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="DoUpdateE2EServiceInstance" />
<bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoUpdateE2EServiceInstance" targetRef="ExclusiveGateway_0aqn64l" />
<bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" />
- <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_0xupxj9" />
+ <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_09rx901" />
<bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
+ <bpmn:scriptTask id="ScriptTask_09rx901" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0utlsnd</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi= new UpdateCustomE2EServiceInstance()
+csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_0mr5k9q" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0utlsnd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1853xxi</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0utlsnd" sourceRef="ScriptTask_09rx901" targetRef="ServiceTask_0mr5k9q" />
+ <bpmn:sequenceFlow id="SequenceFlow_1853xxi" sourceRef="ServiceTask_0mr5k9q" targetRef="ScriptTask_0xupxj9" />
</bpmn:process>
<bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<dc:Bounds x="463" y="632" width="394" height="188" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoUpdateE2EServiceInstance">
- <dc:Bounds x="717" y="158" width="100" height="80" />
+ <dc:Bounds x="767" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0">
<dc:Bounds x="1258" y="286" width="36" height="36" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d">
- <dc:Bounds x="214" y="158" width="100" height="80" />
+ <dc:Bounds x="105" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r">
- <dc:Bounds x="1038" y="158" width="100" height="80" />
+ <dc:Bounds x="1073" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0">
<dc:Bounds x="1226" y="158" width="100" height="80" />
<dc:Bounds x="348" y="370" width="679" height="194" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9">
- <dc:Bounds x="459" y="158" width="100" height="80" />
+ <dc:Bounds x="600" y="158" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true">
- <dc:Bounds x="903" y="173" width="50" height="50" />
+ <dc:Bounds x="942" y="173" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="903" y="145" width="50" height="12" />
+ <dc:Bounds x="943" y="145" width="49" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy">
- <dc:Bounds x="910" y="286" width="36" height="36" />
+ <dc:Bounds x="949" y="286" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="883" y="322" width="0" height="12" />
+ <dc:Bounds x="877" y="322" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq">
<di:waypoint xsi:type="dc:Point" x="30" y="198" />
- <di:waypoint xsi:type="dc:Point" x="214" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="105" y="198" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="77" y="177" width="90" height="12" />
+ <dc:Bounds x="22.5" y="177" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro">
- <di:waypoint xsi:type="dc:Point" x="559" y="198" />
- <di:waypoint xsi:type="dc:Point" x="717" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="700" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="198" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="593" y="177" width="90" height="12" />
+ <dc:Bounds x="688.5" y="177" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx">
- <di:waypoint xsi:type="dc:Point" x="817" y="198" />
- <di:waypoint xsi:type="dc:Point" x="903" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="867" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="198" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="815" y="177" width="90" height="12" />
+ <dc:Bounds x="859.5" y="177" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf">
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9">
- <di:waypoint xsi:type="dc:Point" x="314" y="198" />
- <di:waypoint xsi:type="dc:Point" x="459" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="205" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="274" y="198" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="341.5" y="177" width="90" height="12" />
+ <dc:Bounds x="194.5" y="177" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr">
- <di:waypoint xsi:type="dc:Point" x="953" y="198" />
- <di:waypoint xsi:type="dc:Point" x="990" y="198" />
- <di:waypoint xsi:type="dc:Point" x="990" y="198" />
- <di:waypoint xsi:type="dc:Point" x="1038" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="992" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="1073" y="198" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="987" y="195" width="20" height="12" />
+ <dc:Bounds x="1023.5062499999999" y="195" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si">
- <di:waypoint xsi:type="dc:Point" x="1138" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="1173" y="198" />
<di:waypoint xsi:type="dc:Point" x="1226" y="198" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1137" y="183" width="0" height="12" />
+ <dc:Bounds x="1154.5" y="177" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69">
- <di:waypoint xsi:type="dc:Point" x="928" y="223" />
- <di:waypoint xsi:type="dc:Point" x="928" y="250" />
- <di:waypoint xsi:type="dc:Point" x="928" y="250" />
- <di:waypoint xsi:type="dc:Point" x="928" y="286" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="223" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="250" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="250" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="286" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="901" y="228" width="15" height="12" />
+ <dc:Bounds x="942" y="228" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39">
<dc:Bounds x="715.5" y="459" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_09rx901_di" bpmnElement="ScriptTask_09rx901">
+ <dc:Bounds x="274" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0mr5k9q_di" bpmnElement="ServiceTask_0mr5k9q">
+ <dc:Bounds x="444" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0utlsnd_di" bpmnElement="SequenceFlow_0utlsnd">
+ <di:waypoint xsi:type="dc:Point" x="374" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="444" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="409" y="177" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1853xxi_di" bpmnElement="SequenceFlow_1853xxi">
+ <di:waypoint xsi:type="dc:Point" x="544" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="600" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="572" y="177" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true">
<bpmn2:startEvent id="createSI_startEvent" name="Start Flow">
<bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing>
def ddsi = new DoCreateE2EServiceInstance()
ddsi.postProcessAAIPUT(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_16nxl6h</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0vbznai</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def csi = new DoCreateE2EServiceInstance()
-csi.postConfigRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:endEvent id="EndEvent_0kbbt94">
- <bpmn2:incoming>SequenceFlow_0vbznai</bpmn2:incoming>
- </bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" />
<bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming>
</camunda:connector>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10reo7r</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_13xfsff</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:serviceTask id="Task_0io5qby" name="Call Sync SDNC service Create " camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask">
- <bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_11f2zuu</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_10reo7r" sourceRef="Task_0raqlqc" targetRef="ScriptTask_1y0los4" />
- <bpmn2:sequenceFlow id="SequenceFlow_11f2zuu" sourceRef="Task_0io5qby" targetRef="IntermediateThrowEvent_0f2w7aj" />
- <bpmn2:scriptTask id="ScriptTask_1y0los4" name="Sequence Resource" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_10reo7r</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_13d9g1n</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoCreateE2EServiceInstance()
-ddsi.sequenceResoure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_13d9g1n" sourceRef="ScriptTask_1y0los4" targetRef="ExclusiveGateway_07rr3wp" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_0n9y4du" name="All ResourceFinished?">
- <bpmn2:incoming>SequenceFlow_1jenxlp</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0q6uy30</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_16nxl6h</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_0q6uy30" name="no" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_0l4nkqr">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "false" )}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="ScriptTask_0y4u2ty" name="Parse Next Resource" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_13c7bhn</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1jenxlp</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoCreateE2EServiceInstance()
-ddsi.parseNextResource(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1jenxlp" sourceRef="ScriptTask_0y4u2ty" targetRef="ExclusiveGateway_0n9y4du" />
- <bpmn2:scriptTask id="ScriptTask_0l4nkqr" name="Get Current Resource" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0q6uy30</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0uiygod</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoCreateE2EServiceInstance()
-ddsi.getCurrentResoure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_07rr3wp" name="Is SDN-C Service Needed">
- <bpmn2:incoming>SequenceFlow_13d9g1n</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_18wj44x</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_1vprtt9</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_18wj44x" name="no" sourceRef="ExclusiveGateway_07rr3wp" targetRef="IntermediateThrowEvent_0f2w7aj">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "false" )}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="Task_0qlkmvt" name="Prepare resource recipe Request" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0uiygod</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1u9k0dm</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoCreateE2EServiceInstance()
-ddsi.prepareResourceRecipeRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe">
- <bpmn2:incoming>SequenceFlow_1u9k0dm</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_13c7bhn</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoCreateE2EServiceInstance()
-ddsi.executeResourceRecipe(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service">
<bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming>
<bpmn2:linkEventDefinition name="Decompose_Service" />
<bpmn2:linkEventDefinition name="StartService" />
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EGetService" />
- <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0f2w7aj" name="GoTo ResourceLoop">
- <bpmn2:incoming>SequenceFlow_18wj44x</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_11f2zuu</bpmn2:incoming>
- <bpmn2:linkEventDefinition name="ResourceLoop" />
- </bpmn2:intermediateThrowEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_0io5qby">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
<bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing>
<bpmn2:linkEventDefinition name="StartPrepareResource" />
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" />
- <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_02bah5m" name="ResourceLoop">
- <bpmn2:outgoing>SequenceFlow_1qozd66</bpmn2:outgoing>
- <bpmn2:linkEventDefinition name="ResourceLoop" />
- </bpmn2:intermediateCatchEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_16nxl6h" name="yes" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_1xdjlzm">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "true" )}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_0uiygod" sourceRef="ScriptTask_0l4nkqr" targetRef="Task_0qlkmvt" />
- <bpmn2:sequenceFlow id="SequenceFlow_1u9k0dm" sourceRef="Task_0qlkmvt" targetRef="Task_12ghoph" />
- <bpmn2:sequenceFlow id="SequenceFlow_13c7bhn" sourceRef="Task_12ghoph" targetRef="ScriptTask_0y4u2ty" />
- <bpmn2:sequenceFlow id="SequenceFlow_0vbznai" sourceRef="ScriptTask_1xdjlzm" targetRef="EndEvent_0kbbt94" />
- <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="ScriptTask_0l4nkqr" />
<bpmn2:sequenceFlow id="SequenceFlow_1gusrvp" sourceRef="Task_0ush1g4" targetRef="IntermediateThrowEvent_1mlbhmt" />
<bpmn2:scriptTask id="Task_0ush1g4" name="Call Homing(To be Done)" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_027owbf</bpmn2:incoming>
def dcsi= new DoCreateE2EServiceInstance()
dcsi.doServiceHoming(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
+ <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResources">
+ <bpmn2:extensionElements>
+ <camunda:in source="nsServiceName" target="nsServiceName" />
+ <camunda:in source="nsServiceDescription" target="nsServiceDescription" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="operationId" target="operationId" />
+ <camunda:in source="resourceType" target="resourceType" />
+ <camunda:in source="resourceUUID" target="resourceUUID" />
+ <camunda:in source="resourceParameters" target="resourceParameters" />
+ <camunda:in source="operationType" target="operationType" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>SequenceFlow_0bf6bzp</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing>
+ </bpmn2:callActivity>
+ <bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new DoCreateE2EServiceInstance()
+csi.preProcessForAddResource(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:scriptTask id="ScriptTask_1y7jr4t" name="PostProcess for Add Resource" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_0d0c20n</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0a6vgsu</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def csi = new DoCreateE2EServiceInstance()
+csi.postProcessForAddResource(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="ScriptTask_04b21gb" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" />
+ <bpmn2:endEvent id="EndEvent_0hzmoug">
+ <bpmn2:incoming>SequenceFlow_0a6vgsu</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
<dc:Bounds x="679" y="960" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm">
- <dc:Bounds x="1119" y="485" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94">
- <dc:Bounds x="1315" y="507" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1197" y="547" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0">
<di:waypoint xsi:type="dc:Point" x="296" y="300" />
<di:waypoint xsi:type="dc:Point" x="402" y="300" />
<bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc">
<dc:Bounds x="402" y="260" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0qi8cgg_di" bpmnElement="Task_0io5qby">
- <dc:Bounds x="944" y="353" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_10reo7r_di" bpmnElement="SequenceFlow_10reo7r">
- <di:waypoint xsi:type="dc:Point" x="502" y="300" />
- <di:waypoint xsi:type="dc:Point" x="583" y="300" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="497.5" y="279" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu">
- <di:waypoint xsi:type="dc:Point" x="1044" y="393" />
- <di:waypoint xsi:type="dc:Point" x="1090" y="393" />
- <di:waypoint xsi:type="dc:Point" x="1090" y="300" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="300" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1060" y="340.5" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1y0los4_di" bpmnElement="ScriptTask_1y0los4">
- <dc:Bounds x="583" y="260" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_13d9g1n_di" bpmnElement="SequenceFlow_13d9g1n">
- <di:waypoint xsi:type="dc:Point" x="683" y="300" />
- <di:waypoint xsi:type="dc:Point" x="753" y="300" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="673" y="279" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ExclusiveGateway_0n9y4du_di" bpmnElement="ExclusiveGateway_0n9y4du" isMarkerVisible="true">
- <dc:Bounds x="929" y="500" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="912" y="554" width="83" height="36" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0q6uy30_di" bpmnElement="SequenceFlow_0q6uy30">
- <di:waypoint xsi:type="dc:Point" x="954" y="550" />
- <di:waypoint xsi:type="dc:Point" x="954" y="691" />
- <di:waypoint xsi:type="dc:Point" x="246" y="691" />
- <di:waypoint xsi:type="dc:Point" x="246" y="565" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="594" y="670" width="12" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0y4u2ty_di" bpmnElement="ScriptTask_0y4u2ty">
- <dc:Bounds x="728" y="485" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1jenxlp_di" bpmnElement="SequenceFlow_1jenxlp">
- <di:waypoint xsi:type="dc:Point" x="828" y="525" />
- <di:waypoint xsi:type="dc:Point" x="929" y="525" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="833.5" y="504" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0l4nkqr_di" bpmnElement="ScriptTask_0l4nkqr">
- <dc:Bounds x="196" y="485" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_07rr3wp_di" bpmnElement="ExclusiveGateway_07rr3wp" isMarkerVisible="true">
- <dc:Bounds x="753" y="275" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="736" y="329" width="87" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_18wj44x_di" bpmnElement="SequenceFlow_18wj44x">
- <di:waypoint xsi:type="dc:Point" x="803" y="300" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="300" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="832.3633633633633" y="294" width="12" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0u88n0f_di" bpmnElement="Task_0qlkmvt">
- <dc:Bounds x="357" y="485" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1y17r20_di" bpmnElement="Task_12ghoph">
- <dc:Bounds x="551" y="485" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs">
<dc:Bounds x="1315" y="-207" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="125" y="76" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="IntermediateThrowEvent_0f2w7aj_di" bpmnElement="IntermediateThrowEvent_0f2w7aj">
- <dc:Bounds x="1315" y="282" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1299" y="323" width="73" height="24" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9">
- <di:waypoint xsi:type="dc:Point" x="778" y="325" />
- <di:waypoint xsi:type="dc:Point" x="778" y="393" />
- <di:waypoint xsi:type="dc:Point" x="944" y="393" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="784" y="353" width="19" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b">
<dc:Bounds x="18" y="282" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="125" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="IntermediateCatchEvent_02bah5m_di" bpmnElement="IntermediateCatchEvent_02bah5m">
- <dc:Bounds x="18" y="507" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="2" y="543" width="73" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_16nxl6h_di" bpmnElement="SequenceFlow_16nxl6h">
- <di:waypoint xsi:type="dc:Point" x="979" y="525" />
- <di:waypoint xsi:type="dc:Point" x="1119" y="525" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1040" y="504" width="19" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0uiygod_di" bpmnElement="SequenceFlow_0uiygod">
- <di:waypoint xsi:type="dc:Point" x="296" y="525" />
- <di:waypoint xsi:type="dc:Point" x="357" y="525" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1gusrvp_di" bpmnElement="SequenceFlow_1gusrvp">
+ <di:waypoint xsi:type="dc:Point" x="1157" y="-39" />
+ <di:waypoint xsi:type="dc:Point" x="1315" y="-39" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="326.5" y="504" width="0" height="12" />
+ <dc:Bounds x="1236" y="-60" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1u9k0dm_di" bpmnElement="SequenceFlow_1u9k0dm">
- <di:waypoint xsi:type="dc:Point" x="457" y="525" />
- <di:waypoint xsi:type="dc:Point" x="551" y="525" />
+ <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4">
+ <dc:Bounds x="1057" y="-79" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas">
+ <dc:Bounds x="852" y="260" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb">
+ <dc:Bounds x="629" y="260" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t">
+ <dc:Bounds x="1068" y="260" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff">
+ <di:waypoint xsi:type="dc:Point" x="502" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="629" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="504" y="504" width="0" height="12" />
+ <dc:Bounds x="565.5" y="279" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_13c7bhn_di" bpmnElement="SequenceFlow_13c7bhn">
- <di:waypoint xsi:type="dc:Point" x="651" y="525" />
- <di:waypoint xsi:type="dc:Point" x="728" y="525" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp">
+ <di:waypoint xsi:type="dc:Point" x="729" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="789" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="789" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="852" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="689.5" y="504" width="0" height="12" />
+ <dc:Bounds x="804" y="294" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0vbznai_di" bpmnElement="SequenceFlow_0vbznai">
- <di:waypoint xsi:type="dc:Point" x="1219" y="525" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="525" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n">
+ <di:waypoint xsi:type="dc:Point" x="952" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1009" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1009" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1068" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1267" y="504" width="0" height="12" />
+ <dc:Bounds x="1024" y="294" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1qozd66_di" bpmnElement="SequenceFlow_1qozd66">
- <di:waypoint xsi:type="dc:Point" x="54" y="525" />
- <di:waypoint xsi:type="dc:Point" x="196" y="525" />
+ <bpmndi:BPMNShape id="EndEvent_0hzmoug_di" bpmnElement="EndEvent_0hzmoug">
+ <dc:Bounds x="1315" y="282.4076655052265" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="125" y="504" width="0" height="12" />
+ <dc:Bounds x="1333" y="322.4076655052265" width="0" height="12" />
</bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1gusrvp_di" bpmnElement="SequenceFlow_1gusrvp">
- <di:waypoint xsi:type="dc:Point" x="1157" y="-39" />
- <di:waypoint xsi:type="dc:Point" x="1315" y="-39" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0a6vgsu_di" bpmnElement="SequenceFlow_0a6vgsu">
+ <di:waypoint xsi:type="dc:Point" x="1168" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1242" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1242" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1315" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1236" y="-60" width="0" height="12" />
+ <dc:Bounds x="1257" y="294" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4">
- <dc:Bounds x="1057" y="-79" width="100" height="80" />
- </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+ <bpmn:process id="DoScaleE2EServiceInstance" name="DoScaleE2EServiceInstance" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_08ndnk6" name="Start Flow">
+ <bpmn:outgoing>SequenceFlow_1fhno84</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_16yrgke" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1fhno84</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_194bhkx</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def ddsi = new DoScaleE2EServiceInstance()
+ddsi.preProcessRequest(execution)
+]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1f5ursk">
+ <bpmn:incoming>SequenceFlow_1yee730</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_0vmzliy" name="Prepare Resource Oper Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_194bhkx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0b5p6gy</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def ddsi = new DoScaleE2EServiceInstance()
+ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_17d588b" name="Init Resource Oper Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0b5p6gy</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0nqrq1k</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:callActivity id="CallActivity_1jkl1i3" name="Call Network Service Scale" calledElement="DoScaleVFCServiceInstance">
+ <bpmn:extensionElements>
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="operationId" target="operationId" />
+ <camunda:in source="resouceTemplateUUID" target="resouceTemplateUUID" />
+ <camunda:in source="resouceInstanceId" target="resouceInstanceId" />
+ <camunda:in source="resourceType" target="resourceType" />
+ <camunda:in source="operationType" target="operationType" />
+ <camunda:in source="nsScaleParams" target="nsScaleParams" />
+ <camunda:in source="bpmnRequest" target="bpmnRequest" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="requestDescription" target="requestDescription" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0nqrq1k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yee730</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1fhno84" sourceRef="StartEvent_08ndnk6" targetRef="ScriptTask_16yrgke" />
+ <bpmn:sequenceFlow id="SequenceFlow_194bhkx" sourceRef="ScriptTask_16yrgke" targetRef="ScriptTask_0vmzliy" />
+ <bpmn:sequenceFlow id="SequenceFlow_1yee730" sourceRef="CallActivity_1jkl1i3" targetRef="EndEvent_1f5ursk" />
+ <bpmn:sequenceFlow id="SequenceFlow_0nqrq1k" sourceRef="ServiceTask_17d588b" targetRef="CallActivity_1jkl1i3" />
+ <bpmn:sequenceFlow id="SequenceFlow_0b5p6gy" sourceRef="ScriptTask_0vmzliy" targetRef="ServiceTask_17d588b" />
+ <bpmn:subProcess id="SubProcess_19qmltk" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0581c7y">
+ <bpmn:outgoing>SequenceFlow_0yyws1p</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_0k146bt">
+ <bpmn:incoming>SequenceFlow_0i814ke</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_0l79kxj" name="Log / Print Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0yyws1p</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0i814ke</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0yyws1p" name="" sourceRef="StartEvent_0581c7y" targetRef="ScriptTask_0l79kxj" />
+ <bpmn:sequenceFlow id="SequenceFlow_0i814ke" name="" sourceRef="ScriptTask_0l79kxj" targetRef="EndEvent_0k146bt" />
+ </bpmn:subProcess>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleE2EServiceInstance">
+ <bpmndi:BPMNShape id="StartEvent_08ndnk6_di" bpmnElement="StartEvent_08ndnk6">
+ <dc:Bounds x="96" y="129" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="90" y="170" width="50" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_16yrgke_di" bpmnElement="ScriptTask_16yrgke">
+ <dc:Bounds x="189" y="107" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1f5ursk_di" bpmnElement="EndEvent_1f5ursk">
+ <dc:Bounds x="1016" y="279" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="899" y="320" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0vmzliy_di" bpmnElement="ScriptTask_0vmzliy">
+ <dc:Bounds x="436" y="107" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_17d588b_di" bpmnElement="ServiceTask_17d588b">
+ <dc:Bounds x="695" y="107" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1jkl1i3_di" bpmnElement="CallActivity_1jkl1i3">
+ <dc:Bounds x="984" y="107" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fhno84_di" bpmnElement="SequenceFlow_1fhno84">
+ <di:waypoint xsi:type="dc:Point" x="132" y="147" />
+ <di:waypoint xsi:type="dc:Point" x="189" y="147" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="72" y="126" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_194bhkx_di" bpmnElement="SequenceFlow_194bhkx">
+ <di:waypoint xsi:type="dc:Point" x="289" y="147" />
+ <di:waypoint xsi:type="dc:Point" x="436" y="147" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="317.5" y="126" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yee730_di" bpmnElement="SequenceFlow_1yee730">
+ <di:waypoint xsi:type="dc:Point" x="1033" y="187" />
+ <di:waypoint xsi:type="dc:Point" x="1034" y="279" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="988.5" y="212" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0nqrq1k_di" bpmnElement="SequenceFlow_0nqrq1k">
+ <di:waypoint xsi:type="dc:Point" x="795" y="147" />
+ <di:waypoint xsi:type="dc:Point" x="984" y="147" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="844.5" y="126" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0b5p6gy_di" bpmnElement="SequenceFlow_0b5p6gy">
+ <di:waypoint xsi:type="dc:Point" x="536" y="147" />
+ <di:waypoint xsi:type="dc:Point" x="695" y="147" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="570.5" y="126" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_19qmltk_di" bpmnElement="SubProcess_19qmltk" isExpanded="true">
+ <dc:Bounds x="132" y="351" width="467" height="193" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0581c7y_di" bpmnElement="StartEvent_0581c7y">
+ <dc:Bounds x="201" y="419" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="84" y="460" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0k146bt_di" bpmnElement="EndEvent_0k146bt">
+ <dc:Bounds x="494" y="419" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="377" y="460" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0l79kxj_di" bpmnElement="ScriptTask_0l79kxj">
+ <dc:Bounds x="305" y="397" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yyws1p_di" bpmnElement="SequenceFlow_0yyws1p">
+ <di:waypoint xsi:type="dc:Point" x="237" y="437" />
+ <di:waypoint xsi:type="dc:Point" x="305" y="437" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="136" y="422" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0i814ke_di" bpmnElement="SequenceFlow_0i814ke">
+ <di:waypoint xsi:type="dc:Point" x="405" y="437" />
+ <di:waypoint xsi:type="dc:Point" x="494" y="437" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="317" y="422" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+ <bpmn:process id="DoScaleVFCServiceInstance" name="DoScaleVFCServiceInstance" isExecutable="true">
+ <bpmn:startEvent id="scaleNS_StartEvent" name="scaleNS_StartEvent">
+ <bpmn:outgoing>SequenceFlow_00w1ntj</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="PreprocessIncomingRequest" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_00w1ntj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0izumqq</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoScaleVFCNetworkServiceInstance()
+dcsi.preProcessRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0ia872k" name="Scale Network Service" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0izumqq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0hzy01n</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoScaleVFCNetworkServiceInstance()
+dcsi.scaleNetworkService(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_00w1ntj" sourceRef="scaleNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:sequenceFlow id="SequenceFlow_0izumqq" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0ia872k" />
+ <bpmn:endEvent id="EndEvent_1r0dxhy">
+ <bpmn:incoming>SequenceFlow_18hdal9</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_18hdal9" sourceRef="finishNSScale_Task" targetRef="EndEvent_1r0dxhy" />
+ <bpmn:scriptTask id="finishNSScale_Task" name="Finish NS Scale" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0hzy01n</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18hdal9</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoScaleVFCNetworkServiceInstance()
+dcsi.finishNSScale(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0hzy01n" sourceRef="Task_0ia872k" targetRef="finishNSScale_Task" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleVFCServiceInstance">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="scaleNS_StartEvent">
+ <dc:Bounds x="-33" y="182" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-56" y="218" width="83" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0fxwmkv_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="117" y="160" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_14ppugf_di" bpmnElement="Task_0ia872k">
+ <dc:Bounds x="739" y="160" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_00w1ntj_di" bpmnElement="SequenceFlow_00w1ntj">
+ <di:waypoint xsi:type="dc:Point" x="3" y="200" />
+ <di:waypoint xsi:type="dc:Point" x="117" y="200" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="15" y="179" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0izumqq_di" bpmnElement="SequenceFlow_0izumqq">
+ <di:waypoint xsi:type="dc:Point" x="217" y="200" />
+ <di:waypoint xsi:type="dc:Point" x="739" y="200" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="433" y="179" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1r0dxhy_di" bpmnElement="EndEvent_1r0dxhy">
+ <dc:Bounds x="771" y="676" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="744" y="716" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_18hdal9_di" bpmnElement="SequenceFlow_18hdal9">
+ <di:waypoint xsi:type="dc:Point" x="789" y="451" />
+ <di:waypoint xsi:type="dc:Point" x="789" y="676" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="759" y="557.5" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1elwlqc_di" bpmnElement="finishNSScale_Task">
+ <dc:Bounds x="739" y="371" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hzy01n_di" bpmnElement="SequenceFlow_0hzy01n">
+ <di:waypoint xsi:type="dc:Point" x="789" y="240" />
+ <di:waypoint xsi:type="dc:Point" x="789" y="371" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="759" y="299.5" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def csi = new DoUpdateE2EServiceInstance()
csi.postProcessForAddResource(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:scriptTask id="ScriptTask_04rn9mp" name="Post Config Service Instance Update" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0cnuo36</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1ryg78h</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def csi = new DoUpdateE2EServiceInstance()
-csi.postConfigRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:intermediateCatchEvent id="StartEvent_StartResource" name="StartAddResources">
<bpmn2:outgoing>SequenceFlow_115mdln</bpmn2:outgoing>
<bpmn2:linkEventDefinition name="StartAddResource" />
</bpmn2:intermediateCatchEvent>
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1dwg5lz" name="GoToStartCompareModelVersions">
- <bpmn2:incoming>SequenceFlow_1i45vfx</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_167wc99</bpmn2:incoming>
<bpmn2:linkEventDefinition name="StartCompareModelVersions" />
</bpmn2:intermediateThrowEvent>
- <bpmn2:scriptTask id="ScriptTask_1wk7zcu" name="Prepare Update Service Oper Status(90%)" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1uu6uiu</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0gr3l25</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-execution.setVariable("progress", "90")
-def ddsi = new DoUpdateE2EServiceInstance()
-ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:serviceTask id="ServiceTask_1a6cmdu" name="Update Service Oper Status">
- <bpmn2:extensionElements>
- <camunda:connector>
- <camunda:inputOutput>
- <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
- <camunda:inputParameter name="headers">
- <camunda:map>
- <camunda:entry key="content-type">application/soap+xml</camunda:entry>
- <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
- </camunda:map>
- </camunda:inputParameter>
- <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
- <camunda:inputParameter name="method">POST</camunda:inputParameter>
- <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
- <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
- </camunda:inputOutput>
- <camunda:connectorId>http-connector</camunda:connectorId>
- </camunda:connector>
- </bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_0gr3l25</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0cnuo36</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_0gr3l25" sourceRef="ScriptTask_1wk7zcu" targetRef="ServiceTask_1a6cmdu" />
- <bpmn2:sequenceFlow id="SequenceFlow_0cnuo36" sourceRef="ServiceTask_1a6cmdu" targetRef="ScriptTask_04rn9mp" />
- <bpmn2:scriptTask id="ScriptTask_1pwo0jp" name="Prepare Resource Oper Status" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_167wc99</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0aylb6e</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def ddsi = new DoUpdateE2EServiceInstance()
-ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_0aylb6e" sourceRef="ScriptTask_1pwo0jp" targetRef="ServiceTask_1dqzdko" />
- <bpmn2:serviceTask id="ServiceTask_1dqzdko" name="Init Resource Oper Status">
- <bpmn2:extensionElements>
- <camunda:connector>
- <camunda:inputOutput>
- <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
- <camunda:inputParameter name="headers">
- <camunda:map>
- <camunda:entry key="content-type">application/soap+xml</camunda:entry>
- <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
- </camunda:map>
- </camunda:inputParameter>
- <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
- <camunda:inputParameter name="method">POST</camunda:inputParameter>
- <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
- <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
- </camunda:inputOutput>
- <camunda:connectorId>http-connector</camunda:connectorId>
- </camunda:connector>
- </bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_0aylb6e</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1r1hl23</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1r1hl23" sourceRef="ServiceTask_1dqzdko" targetRef="ScriptTask_17ssed5" />
<bpmn2:sequenceFlow id="SequenceFlow_115mdln" sourceRef="StartEvent_StartResource" targetRef="Task_09laxun" />
<bpmn2:sequenceFlow id="SequenceFlow_0yztz2p" sourceRef="Task_09laxun" targetRef="Task_1wyyy33" />
<bpmn2:sequenceFlow id="SequenceFlow_0lblyhi" sourceRef="Task_1wyyy33" targetRef="Task_0ag30bf" />
<bpmn2:outgoing>SequenceFlow_0qg0uyn</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:sequenceFlow id="SequenceFlow_0qg0uyn" sourceRef="CallActivity_18nvmnn" targetRef="ScriptTask_0i8cqdy_PostProcessAAIGET" />
- <bpmn2:scriptTask id="ScriptTask_17ssed5" name="Post Resource Oper Status" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1r1hl23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1i45vfx</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def dcsi = new DoUpdateE2EServiceInstance()
-dcsi.postResourcesOperStatus(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1i45vfx" sourceRef="ScriptTask_17ssed5" targetRef="IntermediateThrowEvent_1dwg5lz" />
- <bpmn2:scriptTask id="ScriptTask_0acnvkp" name="Prepare Resource Oper Status(10%)" scriptFormat="groovy">
+ <bpmn2:scriptTask id="ScriptTask_0acnvkp" name="Prepare Resource Oper Status" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_0l4gosl</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0r6c0ci</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-execution.setVariable("progress", "10")
def ddsi = new DoUpdateE2EServiceInstance()
-ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
+ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:serviceTask id="ServiceTask_17u9q9u" name="Init Resource Oper Status">
<bpmn2:extensionElements>
<bpmn2:sequenceFlow id="SequenceFlow_0r6c0ci" sourceRef="ScriptTask_0acnvkp" targetRef="ServiceTask_17u9q9u" />
<bpmn2:sequenceFlow id="SequenceFlow_1muxopq" sourceRef="ServiceTask_17u9q9u" targetRef="ScriptTask_0r74c3c" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0vneaao" name="GoTo StartDeleteResources">
- <bpmn2:incoming>SequenceFlow_0s57qft</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1nqfgvs</bpmn2:incoming>
<bpmn2:linkEventDefinition name="StartDeleteResources" />
</bpmn2:intermediateThrowEvent>
- <bpmn2:scriptTask id="ScriptTask_1na4qzo" name="Prepare Resource Oper Status(60%)" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1nqfgvs</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1fa1yjd</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-execution.setVariable("progress", "60")
-def ddsi = new DoUpdateE2EServiceInstance()
-ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:serviceTask id="ServiceTask_0c13nyt" name="Init Resource Oper Status">
- <bpmn2:extensionElements>
- <camunda:connector>
- <camunda:inputOutput>
- <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
- <camunda:inputParameter name="headers">
- <camunda:map>
- <camunda:entry key="content-type">application/soap+xml</camunda:entry>
- <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
- </camunda:map>
- </camunda:inputParameter>
- <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter>
- <camunda:inputParameter name="method">POST</camunda:inputParameter>
- <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
- <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
- </camunda:inputOutput>
- <camunda:connectorId>http-connector</camunda:connectorId>
- </camunda:connector>
- </bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_1fa1yjd</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1eg944u</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:scriptTask id="ScriptTask_0iq531p" name="Post Resource Oper Status" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1eg944u</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0s57qft</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def dcsi = new DoUpdateE2EServiceInstance()
-dcsi.postResourcesOperStatus(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_0s57qft" sourceRef="ScriptTask_0iq531p" targetRef="IntermediateThrowEvent_0vneaao" />
- <bpmn2:sequenceFlow id="SequenceFlow_1eg944u" sourceRef="ServiceTask_0c13nyt" targetRef="ScriptTask_0iq531p" />
<bpmn2:callActivity id="CallActivity_1nm9zq7" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService">
<bpmn2:extensionElements>
<camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" />
<bpmn2:sequenceFlow id="SequenceFlow_0ku36oy" sourceRef="IntermediateCatchEvent_0z04o3s" targetRef="ScriptTask_0jsblrq" />
<bpmn2:sequenceFlow id="SequenceFlow_0mwh16g" sourceRef="ScriptTask_0jsblrq" targetRef="ServiceTask_1ydxyw0" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_06lo96a" name="GoTo UpdateAAI">
- <bpmn2:incoming>SequenceFlow_1ryg78h</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1uu6uiu</bpmn2:incoming>
<bpmn2:linkEventDefinition name="UpdateAAI" />
</bpmn2:intermediateThrowEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1ryg78h" sourceRef="ScriptTask_04rn9mp" targetRef="IntermediateThrowEvent_06lo96a" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0hucdtk" name="GoTo FinishProcess">
<bpmn2:incoming>SequenceFlow_0x0mhlj</bpmn2:incoming>
<bpmn2:linkEventDefinition name="FinishProcess" />
</bpmn2:intermediateThrowEvent>
<bpmn2:sequenceFlow id="SequenceFlow_0x0mhlj" sourceRef="ScriptTask_0xtabf8" targetRef="IntermediateThrowEvent_0hucdtk" />
- <bpmn2:sequenceFlow id="SequenceFlow_167wc99" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="ScriptTask_1pwo0jp" />
+ <bpmn2:sequenceFlow id="SequenceFlow_167wc99" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="IntermediateThrowEvent_1dwg5lz" />
<bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_09ur9ds" name="GoTo StartAddResources">
<bpmn2:incoming>SequenceFlow_1sgsysh</bpmn2:incoming>
<bpmn2:linkEventDefinition name="StartAddResource" />
</bpmn2:intermediateThrowEvent>
<bpmn2:sequenceFlow id="SequenceFlow_0l4gosl" sourceRef="ScriptTask_0wl77h6" targetRef="ScriptTask_0acnvkp" />
<bpmn2:sequenceFlow id="SequenceFlow_1sgsysh" sourceRef="ScriptTask_0r74c3c" targetRef="IntermediateThrowEvent_09ur9ds" />
- <bpmn2:sequenceFlow id="SequenceFlow_1fa1yjd" sourceRef="ScriptTask_1na4qzo" targetRef="ServiceTask_0c13nyt" />
- <bpmn2:sequenceFlow id="SequenceFlow_1nqfgvs" sourceRef="Task_0ag30bf" targetRef="ScriptTask_1na4qzo" />
- <bpmn2:sequenceFlow id="SequenceFlow_1uu6uiu" sourceRef="ScriptTask_00wgfrc" targetRef="ScriptTask_1wk7zcu" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1nqfgvs" sourceRef="Task_0ag30bf" targetRef="IntermediateThrowEvent_0vneaao" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1uu6uiu" sourceRef="ScriptTask_00wgfrc" targetRef="IntermediateThrowEvent_06lo96a" />
<bpmn2:subProcess id="SubProcess_0jo0nms" name="Sub-process for Application Errors" triggeredByEvent="true">
<bpmn2:startEvent id="StartEvent_06768u3">
<bpmn2:outgoing>SequenceFlow_05j3sat</bpmn2:outgoing>
<bpmndi:BPMNShape id="ScriptTask_1fj89ew_di" bpmnElement="Task_0ag30bf">
<dc:Bounds x="858" y="828" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_04rn9mp_di" bpmnElement="ScriptTask_04rn9mp">
- <dc:Bounds x="1675" y="1081" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0jks7by_di" bpmnElement="StartEvent_StartResource">
<dc:Bounds x="74" y="850" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1925" y="444" width="90" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1wk7zcu_di" bpmnElement="ScriptTask_1wk7zcu">
- <dc:Bounds x="1152" y="1081" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1a6cmdu_di" bpmnElement="ServiceTask_1a6cmdu">
- <dc:Bounds x="1421" y="1081" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0gr3l25_di" bpmnElement="SequenceFlow_0gr3l25">
- <di:waypoint xsi:type="dc:Point" x="1252" y="1121" />
- <di:waypoint xsi:type="dc:Point" x="1421" y="1121" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1291.5" y="1100" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0cnuo36_di" bpmnElement="SequenceFlow_0cnuo36">
- <di:waypoint xsi:type="dc:Point" x="1521" y="1121" />
- <di:waypoint xsi:type="dc:Point" x="1675" y="1121" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1553" y="1100" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1pwo0jp_di" bpmnElement="ScriptTask_1pwo0jp">
- <dc:Bounds x="1152" y="382" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0aylb6e_di" bpmnElement="SequenceFlow_0aylb6e">
- <di:waypoint xsi:type="dc:Point" x="1252" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1337" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1337" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1421" y="422" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1307" y="416" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1dqzdko_di" bpmnElement="ServiceTask_1dqzdko">
- <dc:Bounds x="1421" y="382" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1r1hl23_di" bpmnElement="SequenceFlow_1r1hl23">
- <di:waypoint xsi:type="dc:Point" x="1521" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1598" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1598" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1675" y="422" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1568" y="416" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_115mdln_di" bpmnElement="SequenceFlow_115mdln">
<di:waypoint xsi:type="dc:Point" x="110" y="868" />
<di:waypoint xsi:type="dc:Point" x="293" y="868" />
<dc:Bounds x="724.5" y="400" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_17ssed5_di" bpmnElement="ScriptTask_17ssed5">
- <dc:Bounds x="1675" y="382" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1i45vfx_di" bpmnElement="SequenceFlow_1i45vfx">
- <di:waypoint xsi:type="dc:Point" x="1775" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1951" y="422" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1818" y="401" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0acnvkp_di" bpmnElement="ScriptTask_0acnvkp">
<dc:Bounds x="1152" y="600" width="100" height="80" />
</bpmndi:BPMNShape>
<dc:Bounds x="1925" y="890" width="90" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1na4qzo_di" bpmnElement="ScriptTask_1na4qzo">
- <dc:Bounds x="1152" y="828" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0c13nyt_di" bpmnElement="ServiceTask_0c13nyt">
- <dc:Bounds x="1421" y="828" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_0iq531p_di" bpmnElement="ScriptTask_0iq531p">
- <dc:Bounds x="1675" y="828" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0s57qft_di" bpmnElement="SequenceFlow_0s57qft">
- <di:waypoint xsi:type="dc:Point" x="1775" y="868" />
- <di:waypoint xsi:type="dc:Point" x="1951" y="868" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1818" y="847" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1eg944u_di" bpmnElement="SequenceFlow_1eg944u">
- <di:waypoint xsi:type="dc:Point" x="1521" y="868" />
- <di:waypoint xsi:type="dc:Point" x="1675" y="868" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1553" y="847" width="90" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1nm9zq7_di" bpmnElement="CallActivity_1nm9zq7">
<dc:Bounds x="1410" y="1333" width="100" height="80" />
</bpmndi:BPMNShape>
<dc:Bounds x="1939" y="1143" width="82" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1ryg78h_di" bpmnElement="SequenceFlow_1ryg78h">
- <di:waypoint xsi:type="dc:Point" x="1775" y="1121" />
- <di:waypoint xsi:type="dc:Point" x="1951" y="1121" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1863" y="1100" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0hucdtk_di" bpmnElement="IntermediateThrowEvent_0hucdtk">
<dc:Bounds x="1951" y="1355" width="36" height="36" />
<bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_167wc99_di" bpmnElement="SequenceFlow_167wc99">
<di:waypoint xsi:type="dc:Point" x="958" y="422" />
- <di:waypoint xsi:type="dc:Point" x="1152" y="422" />
+ <di:waypoint xsi:type="dc:Point" x="1951" y="422" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1055" y="401" width="0" height="12" />
+ <dc:Bounds x="1409.5" y="401" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_09ur9ds_di" bpmnElement="IntermediateThrowEvent_09ur9ds">
<dc:Bounds x="1863" y="619" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1fa1yjd_di" bpmnElement="SequenceFlow_1fa1yjd">
- <di:waypoint xsi:type="dc:Point" x="1252" y="868" />
- <di:waypoint xsi:type="dc:Point" x="1421" y="868" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1336.5" y="847" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1nqfgvs_di" bpmnElement="SequenceFlow_1nqfgvs">
<di:waypoint xsi:type="dc:Point" x="958" y="868" />
- <di:waypoint xsi:type="dc:Point" x="1152" y="868" />
+ <di:waypoint xsi:type="dc:Point" x="1951" y="868" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1055" y="847" width="0" height="12" />
+ <dc:Bounds x="1409.5" y="847" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1uu6uiu_di" bpmnElement="SequenceFlow_1uu6uiu">
<di:waypoint xsi:type="dc:Point" x="958" y="1121" />
- <di:waypoint xsi:type="dc:Point" x="1152" y="1121" />
+ <di:waypoint xsi:type="dc:Point" x="1951" y="1121" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1055" y="1100" width="0" height="12" />
+ <dc:Bounds x="1409.5" y="1100" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_0jo0nms_di" bpmnElement="SubProcess_0jo0nms" isExpanded="true">
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC 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.openecomp.mso.bpmn.infrastructure.scripts
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.junit.Before
+import org.junit.BeforeClass
+import org.junit.Rule
+import org.junit.Test
+import org.mockito.MockitoAnnotations
+import org.openecomp.mso.bpmn.mock.FileUtil
+import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase
+
+import static org.mockito.Mockito.verify
+import static org.mockito.Mockito.when
+
+class DoScaleE2EServiceInstanceTest extends GroovyTestBase {
+
+ private static String request
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT)
+
+ String Prefix = "CVRCS_"
+
+ @BeforeClass
+ public static void setUpBeforeClass() {
+ request = FileUtil.readResourceFile("__files/InfrastructureFlows/DoScaleE2EServiceInstance.json")
+ }
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+ public DoScaleE2EServiceInstanceTest(){
+ super("DoScaleE2EServiceInstance")
+ }
+
+ @Test
+ public void preProcessRequestTest(){
+
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+
+ DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance()
+ instance.preProcessRequest(mex)
+ verify(mex).setVariable("resourceTemplateUUIDs", "ns111:ns333:")
+ }
+
+ @Test
+ public void preInitResourcesOperStatusTest(){
+ ExecutionEntity mex = setupMock()
+ def map = setupMap(mex)
+ initPreProcess(mex)
+ DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance()
+ instance.preInitResourcesOperStatus(mex)
+
+ verify(mex).setVariable("serviceInstanceId","e151059a-d924-4629-845f-264db19e50b4")
+ verify(mex).setVariable("operationId", "59960003992")
+ verify(mex).setVariable("operationType", "SCALE")
+ verify(mex).setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
+
+ String payload =
+ """<soapenv:Envelope xmlns:ns="http://org.openecomp.mso/requestsdb"
+ xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:initResourceOperationStatus>
+ <serviceId>e151059a-d924-4629-845f-264db19e50b4</serviceId>
+ <operationId>59960003992</operationId>
+ <operationType>SCALE</operationType>
+ <resourceTemplateUUIDs>ns111:ns333:</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+</soapenv:Envelope>"""
+ verify(mex).setVariable("CVFMI_initResOperStatusRequest", payload)
+ }
+
+ private void initPreProcess(ExecutionEntity mex) {
+ when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true")
+ when(mex.getVariable("bpmnRequest")).thenReturn(request)
+ when(mex.getVariable("msoRequestId")).thenReturn("mri")
+ when(mex.getVariable("serviceType")).thenReturn("VoLTE")
+ when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4")
+ when(mex.getVariable("serviceInstanceName")).thenReturn("ra")
+ when(mex.getVariable("operationId")).thenReturn("59960003992")
+ when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123")
+ when(mex.getVariable("resourceTemplateUUIDs")).thenReturn("ns111:ns333:")
+ }
+}
\ No newline at end of file
--- /dev/null
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import static org.mockito.Mockito.*
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.ProcessEngineServices
+import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.repository.ProcessDefinition
+import org.camunda.bpm.engine.runtime.Execution
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.MockitoAnnotations
+import org.mockito.runners.MockitoJUnitRunner
+import org.openecomp.mso.bpmn.common.scripts.MsoUtils
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+
+@RunWith(MockitoJUnitRunner.class)
+class SacleCustomE2EServiceInstanceTest{
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(8090);
+
+ String Prefix="CRESI_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String globalSubscriberId="test_custormer"
+ String requestDescription = "request description for test"
+ def utils = new MsoUtils()
+
+ String jsonIncomingRequest = """{"service":{
+ "serviceType":"example-service-type",
+ "globalSubscriberId":"test_custormer",
+ "resources":[
+ {
+ "resourceInstanceId":"ns111",
+ "scaleType":"SCALE_NS",
+ "scaleNsData":{
+ "scaleNsByStepsData":{
+ "numberOfSteps":"4",
+ "aspectId":"TIC_EDGE_HW",
+ "scalingDirection":"UP"
+ }
+ }
+ },
+ {
+ "resourceInstanceId":"ns333",
+ "scaleType":"SCALE_NS",
+ "scaleNsData":{
+ "scaleNsByStepsData":{
+ "numberOfSteps":"4",
+ "aspectId":"TIC_EDGE_HW",
+ "scalingDirection":"UP"
+ }
+ }
+ }],
+ "serviceInstanceName":"XXXX"
+ },
+ "operationId":"0a5b1651-c56e-4263-8c26-c8f8a6ef72d8"
+ }"""
+
+ String xmlMsoCompletionRequest = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1"
+ xmlns:w1aaan0="http://org.openecomp/mso/infra/vnf-request/v1">
+ <w1aaan0:request-info>
+ <w1aaan0:request-id>56c881ad-6c9d-4b79-aacc-401e5640b47f</w1aaan0:request-id>
+ <w1aaan0:action>SCALE</w1aaan0:action>
+ <w1aaan0:source>null</w1aaan0:source>
+ </w1aaan0:request-info>
+ <status-message>Service Instance was scaled successfully.</status-message>
+ <serviceInstanceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceInstanceId>
+ <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name>
+</aetgt:MsoCompletionRequest>"""
+
+ String requestInfo = """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>56c881ad-6c9d-4b79-aacc-401e5640b47f</request-id>
+ <action>SCALE</action>
+ <source>null</source>
+ </request-info>"""
+
+ String payload ="""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceId>
+ <operationId>0a5b1651-c56e-4263-8c26-c8f8a6ef72d8</operationId>
+ <serviceName>XXXX</serviceName>
+ <operationType>SCALE</operationType>
+ <userId></userId>
+ <result>processing</result>
+ <operationContent>Prepare service scaling</operationContent>
+ <progress>0</progress>
+ <reason></reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ @Before
+ public void init()
+ {
+ MockitoAnnotations.initMocks(this)
+ }
+
+ @Test
+ public void preProcessRequestTest() {
+ println "************ preProcessRequest_Payload ************* "
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ // Initialize prerequisite variables
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest)
+
+ when(mockExecution.getVariable("mso-request-id")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f")
+
+ ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance()
+ scaleCustomE2EServiceInstance.preProcessRequest(mockExecution)
+
+ verify(mockExecution).setVariable("globalSubscriberId", globalSubscriberId)
+ verify(mockExecution).setVariable("prefix", Prefix)
+ verify(mockExecution).setVariable("requestDescription", requestDescription)
+ }
+
+ @Test
+ public void sendSyncResponseTest() {
+ println "************ sendSyncResponse ************* "
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ when(mockExecution.getVariable("operationId")).thenReturn("3338b250-e995-4782-8936-081b66ba4dbf")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f")
+
+ ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance()
+ scaleCustomE2EServiceInstance.sendSyncResponse(mockExecution)
+
+ verify(mockExecution).setVariable("sentSyncResponse", true)
+ }
+
+ @Test
+ public void prepareCompletionRequestTest() {
+ println "************ prepareCompletionRequest ************* "
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ when(mockExecution.getVariable("msoRequestId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f")
+
+ ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance()
+ scaleCustomE2EServiceInstance.prepareCompletionRequest(mockExecution)
+
+ verify(mockExecution).setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+
+ }
+
+ @Test
+ public void prepareInitServiceOperationStatusTest() {
+ println "************ prepareInitServiceOperationStatus ************* "
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f")
+ when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX")
+ when(mockExecution.getVariable("operationId")).thenReturn("0a5b1651-c56e-4263-8c26-c8f8a6ef72d8")
+
+ ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance()
+ scaleCustomE2EServiceInstance.prepareInitServiceOperationStatus(mockExecution)
+
+ payload = utils.formatXml(payload)
+ verify(mockExecution).setVariable("CVFMI_updateServiceOperStatusRequest", payload)
+ }
+
+}
import org.mockito.MockitoAnnotations
import org.camunda.bpm.engine.delegate.BpmnError
import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.domain.HomingSolution
import org.openecomp.mso.bpmn.mock.FileUtil
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse
verify(mex).setVariable("brgWanMacAddress", "brgmac")
verify(mex).setVariable("customerLocation", ["customerLatitude":"32.897480", "customerLongitude":"-97.040443", "customerName":"some_company"])
+ verify(mex).setVariable("homingService", "sniro")
assertTrue(map.containsKey("serviceInputParams"))
assertTrue(map.containsKey(Prefix+"requestInfo"))
assertEquals("", map.get("brgWanMacAddress"))
assertEquals("", map.get("customerLocation"))
+ assertEquals("oof", map.get("homingService"))
assertTrue(map.containsKey("serviceInputParams"))
assertTrue(map.containsKey(Prefix+"requestInfo"))
import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.domain.AllottedResource
import org.openecomp.mso.bpmn.core.domain.ModelInfo
-import org.openecomp.mso.bpmn.core.domain.HomingSolution
+
import org.openecomp.mso.bpmn.core.RollbackData
import org.openecomp.mso.bpmn.vcpe.scripts.MapGetter
import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter
"modelVersion": "1.0"
},
"cloudConfiguration": {
- "lcpCloudRegionId": "MDTWNJ21",
+ "lcpCloudRegionId": "cloudowner_MDTWNJ21",
"tenantId": "fba1bd1e195a404cacb9ce17a9b2b421"
},
"requestInfo": {
--- /dev/null
+{
+ "service":
+ {
+ "serviceType":"example-service-type",
+ "globalSubscriberId":"test_custormer",
+ "resources":
+ [
+ {
+ "resourceInstanceId":"ns111",
+ "scaleType":"SCALE_NS",
+ "scaleNsData":
+ {
+ "scaleNsByStepsData":
+ {
+ "numberOfSteps":"4",
+ "aspectId":"TIC_EDGE_HW",
+ "scalingDirection":"UP"
+ }
+ }
+ },
+ {
+ "resourceInstanceId":"ns333",
+ "scaleType":"SCALE_NS",
+ "scaleNsData":
+ {
+ "scaleNsByStepsData":
+ {
+ "numberOfSteps":"4",
+ "aspectId":"TIC_EDGE_HW",
+ "scalingDirection":"UP"
+ }
+ }
+ }
+ ],
+ "serviceInstanceName":"service1"
+ },
+ "operationId":"15c01683-4f15-45e7-b213-dcbfe6f42a1b"
+ }
\ No newline at end of file
},
"cloudConfiguration":
{
- "lcpCloudRegionId":"mdt1",
+ "lcpCloudRegionId":"cloudowner_mdt1",
"tenantId":"8b1df54faa3b49078e3416e21370a3ba"
},
"requestParameters":
"customerLongitude": "-97.040443",
"customerName": "some_company"
}
+ },
+ {
+ "name":"Homing_Solution",
+ "value":"sniro"
}
]
}
},
"cloudConfiguration":
{
- "lcpCloudRegionId":"mdt1",
+ "lcpCloudRegionId":"cloudowner_mdt1",
"tenantId":"8b1df54faa3b49078e3416e21370a3ba"
},
"requestParameters":
"customerLongitude": "-97.040443",
"customerName": "some_company"
}
+ },
+ {
+ "name":"Homing_Solution",
+ "value":"sniro"
}
]
}
},
"cloudConfiguration":
{
- "lcpCloudRegionId":"mdt1",
+ "lcpCloudRegionId":"cloudowner_mdt1",
"tenantId":"8b1df54faa3b49078e3416e21370a3ba"
},
"requestParameters":
"customerLongitude": "-97.040443",
"customerName": "some_company"
}
- }
+ },
+ {
+ "name":"Homing_Solution",
+ "value":"sniro"
+ }
]
}
}
<dependency>\r
<groupId>commons-fileupload</groupId>\r
<artifactId>commons-fileupload</artifactId>\r
- <version>1.3.2</version>\r
+ <version>1.3.3</version>\r
</dependency>\r
<dependency>\r
<groupId>javax.ws.rs</groupId>\r
--- /dev/null
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.cloudify.v3.model;\r
+\r
+import java.io.Serializable;\r
+\r
+import com.fasterxml.jackson.annotation.JsonProperty;\r
+\r
+public class AzureConfig implements Serializable {\r
+\r
+ private static final long serialVersionUID = 1L;\r
+ \r
+ @JsonProperty("subscription_id")\r
+ String subscriptionId;\r
+\r
+ @JsonProperty("tenant_id")\r
+ String tenantId;\r
+\r
+ @JsonProperty("client_id")\r
+ String clientId;\r
+\r
+ @JsonProperty("client_secret")\r
+ String clientSecret;\r
+\r
+ public String getSubscriptionId() {\r
+ return subscriptionId;\r
+ }\r
+\r
+ public void setSubscriptionId(String subscriptionId) {\r
+ this.subscriptionId = subscriptionId;\r
+ }\r
+\r
+ public String getTenantId() {\r
+ return tenantId;\r
+ }\r
+\r
+ public void setTenantId(String tenantId) {\r
+ this.tenantId = tenantId;\r
+ }\r
+\r
+ public String getClientId() {\r
+ return clientId;\r
+ }\r
+\r
+ public void setClientId(String clientId) {\r
+ this.clientId = clientId;\r
+ }\r
+\r
+ public String getClientSecret() {\r
+ return clientSecret;\r
+ }\r
+\r
+ public void setClientSecret(String clientSecret) {\r
+ this.clientSecret = clientSecret;\r
+ }\r
+ \r
+}
\ No newline at end of file
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.anything;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
private final Matcher m;
+ private boolean onlyDeclaredMethods = false;
public EqualsAndHashCodeTester() {
m = anything();
}
public EqualsAndHashCodeTester(Matcher m) {
this.m = m;
}
+
+ public EqualsAndHashCodeTester onlyDeclaredMethods() {
+ this.onlyDeclaredMethods = true;
+ return this;
+ }
@Override
public void run(PojoClass pojoClass) {
Class<?> clazz = pojoClass.getClazz();
if (anyOf(m).matches(clazz)) {
final Object classInstanceOne = ValidationHelper.getBasicInstance(pojoClass);
final Object classInstanceTwo = ValidationHelper.getBasicInstance(pojoClass);
+ if (onlyDeclaredMethods) {
+ Method[] methods = classInstanceOne.getClass().getDeclaredMethods();
+ boolean hasEquals = false;
+ boolean hasHashcode = false;
+ for (Method method : methods) {
+ if (method.getName().equals("equals")) {
+ hasEquals = true;
+ } else if (method.getName().equals("hashCode")) {
+ hasHashcode = true;
+ }
+ }
+
+ if (!(hasEquals && hasHashcode)) {
+ return;
+ }
+ }
Set<PojoField> identityFields = hasIdOrBusinessKey(pojoClass);
List<PojoField> otherFields = new ArrayList<>(pojoClass.getPojoFields());
otherFields.removeAll(identityFields);
import static org.junit.Assert.assertEquals;
import java.io.IOException;
+import java.util.UUID;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@Test
public void tesCamundaPost() throws JsonGenerationException,
JsonMappingException, IOException {
-
-
String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
HttpResponse mockResponse = createResponse(200, responseBody);
assertEquals(statusCode, HttpStatus.SC_OK);
}
+ @Test
+ public void testCamundaPostJson() throws IOException {
+ String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}";
+
+ HttpResponse mockResponse = createResponse(200, responseBody);
+ mockHttpClient = Mockito.mock(HttpClient.class);
+ Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class)))
+ .thenReturn(mockResponse);
+
+ String reqXML = "<xml>test</xml>";
+ String orchestrationURI = "/engine-rest/process-definition/key/dummy/start";
+
+ MsoJavaProperties props = new MsoJavaProperties();
+ props.setProperty(CommonConstants.CAMUNDA_URL, "http://localhost:8089");
+
+ RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props);
+ requestClient.setClient(mockHttpClient);
+ HttpResponse response = requestClient.post("mso-req-id", false, 180,
+ "createInstance", "svc-inst-id", "vnf-id", "vf-module-id", "vg-id", "nw-id", "conf-id", "svc-type",
+ "vnf-type", "vf-module-type", "nw-type", "", "");
+ assertEquals(requestClient.getType(), CommonConstants.CAMUNDA);
+ assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK);
+ }
+
private HttpResponse createResponse(int respStatus,
String respBody) {
HttpResponse response = new BasicHttpResponse(
<jax-rs-version>1.1.1</jax-rs-version>
<json4s-jackson-version>3.2.4</json4s-jackson-version>
<json4s-core-version>3.0.0</json4s-core-version>
- <fasterxml-json-version>2.2.2</fasterxml-json-version>
+ <fasterxml-json-version>2.8.7</fasterxml-json-version>
<scala-lang-version>2.9.1-1</scala-lang-version>
<reflections-version>0.9.9-RC1</reflections-version>
<javassist-version>3.16.1-GA</javassist-version>
<version>1.9.13</version>
</dependency>
<dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>1.9.13</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.8.7</version>
</dependency>
<dependency>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>pl.pragmatists</groupId>
<artifactId>JUnitParams</artifactId>
removeRelationships,
inPlaceSoftwareUpdate,
applyUpdatedConfig,
- compareModel
+ compareModel,
+ scaleInstance
}
\r
import org.apache.http.HttpResponse;\r
import org.apache.http.HttpStatus;\r
-import org.codehaus.jackson.map.ObjectMapper;\r
+import com.fasterxml.jackson.databind.ObjectMapper;\r
import org.hibernate.Session;\r
import org.json.JSONObject;\r
import org.openecomp.mso.apihandler.common.ErrorNumbers;\r
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceRequest;\r
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EUserParam;\r
import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.GetE2EServiceInstanceResponse;\r
+import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.*;\r
import org.openecomp.mso.serviceinstancebeans.ModelInfo;\r
import org.openecomp.mso.serviceinstancebeans.ModelType;\r
import org.openecomp.mso.serviceinstancebeans.RequestDetails;\r
return getE2EServiceInstances(serviceId, operationId);\r
}\r
\r
+ /**\r
+ * Scale Requests for E2E Service scale Instance on a specified version \r
+ */\r
+ \r
+ @POST\r
+ @Path("/{version:[vV][3-5]}/{serviceId}/scale")\r
+ @Consumes(MediaType.APPLICATION_JSON)\r
+ @Produces(MediaType.APPLICATION_JSON)\r
+ @ApiOperation(value="Scale E2E Service Instance on a specified version",response=Response.class)\r
+ public Response scaleE2EServiceInstance(String request,\r
+ @PathParam("version") String version,\r
+ @PathParam("serviceId") String serviceId) {\r
+\r
+ msoLogger.debug("------------------scale begin------------------");\r
+ instanceIdMap.put("serviceId", serviceId);\r
+ return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version);\r
+ }\r
/**\r
* GET Requests for Comparing model of service instance with target version\r
*/\r
return response;\r
}\r
\r
- if (curStatus != null && !curStatus.getProgress().equals("100")) {\r
+ if (curStatus != null && curStatus.getResult() != null && curStatus.getResult().equalsIgnoreCase("processing")) {\r
String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "\r
+ "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "\r
+ curStatus.getServiceName()\r
return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap);\r
}\r
\r
+ private Response scaleE2EserviceInstances(String requestJSON,\r
+ Action action, HashMap<String, String> instanceIdMap, String version) {\r
+\r
+ String requestId = instanceIdMap.get("serviceId");\r
+ long startTime = System.currentTimeMillis();\r
+ msoLogger.debug("requestId is: " + requestId);\r
+ E2EServiceInstanceScaleRequest e2eScaleReq = null;\r
+\r
+ MsoRequest msoRequest = new MsoRequest(requestId);\r
+\r
+ ObjectMapper mapper = new ObjectMapper();\r
+ try {\r
+ e2eScaleReq = mapper.readValue(requestJSON,\r
+ E2EServiceInstanceScaleRequest.class);\r
+\r
+ } catch (Exception e) {\r
+\r
+ msoLogger.debug("Mapping of request to JSON object failed : ", e);\r
+ Response response = msoRequest.buildServiceErrorResponse(\r
+ HttpStatus.SC_BAD_REQUEST,\r
+ MsoException.ServiceException,\r
+ "Mapping of request to JSON object failed. "\r
+ + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER,\r
+ null);\r
+ msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR,\r
+ MSO_PROP_APIHANDLER_INFRA, "", "",\r
+ MsoLogger.ErrorCode.SchemaError, requestJSON, e);\r
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+ MsoLogger.ResponseCode.SchemaError,\r
+ "Mapping of request to JSON object failed");\r
+ msoLogger.debug("End of the transaction, the final response is: "\r
+ + (String) response.getEntity());\r
+ createOperationStatusRecordForError(action, requestId);\r
+ return response;\r
+ }\r
+\r
+ CatalogDatabase db = null;\r
+ RecipeLookupResult recipeLookupResult = null;\r
+ try {\r
+ db = CatalogDatabase.getInstance();\r
+ //TODO Get the service template model version uuid from AAI.\r
+ recipeLookupResult = getServiceInstanceOrchestrationURI(db, null, action);\r
+ } catch (Exception e) {\r
+ msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC,\r
+ MSO_PROP_APIHANDLER_INFRA, "", "",\r
+ MsoLogger.ErrorCode.AvailabilityError,\r
+ "Exception while communciate with Catalog DB", e);\r
+ msoRequest\r
+ .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);\r
+ Response response = msoRequest.buildServiceErrorResponse(\r
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,\r
+ "No communication to catalog DB " + e.getMessage(),\r
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);\r
+ alarmLogger.sendAlarm("MsoDatabaseAccessError",\r
+ MsoAlarmLogger.CRITICAL, Messages.errors\r
+ .get(ErrorNumbers.NO_COMMUNICATION_TO_CATALOG_DB));\r
+ msoRequest.createRequestRecord(Status.FAILED, action);\r
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+ MsoLogger.ResponseCode.DBAccessError,\r
+ "Exception while communciate with DB");\r
+ msoLogger.debug(END_OF_THE_TRANSACTION\r
+ + (String) response.getEntity());\r
+ return response;\r
+ } finally {\r
+ closeCatalogDB(db);\r
+ }\r
+ if (recipeLookupResult == null) {\r
+ msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,\r
+ MSO_PROP_APIHANDLER_INFRA, "", "",\r
+ MsoLogger.ErrorCode.DataError, "No recipe found in DB");\r
+ msoRequest\r
+ .setStatus(org.openecomp.mso.apihandlerinfra.vnfbeans.RequestStatusType.FAILED);\r
+ Response response = msoRequest.buildServiceErrorResponse(\r
+ HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,\r
+ "Recipe does not exist in catalog DB",\r
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null);\r
+ msoRequest.createRequestRecord(Status.FAILED, action);\r
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+ MsoLogger.ResponseCode.DataNotFound,\r
+ "No recipe found in DB");\r
+ msoLogger.debug(END_OF_THE_TRANSACTION\r
+ + (String) response.getEntity());\r
+ createOperationStatusRecordForError(action, requestId);\r
+ return response;\r
+ }\r
+\r
+ RequestClient requestClient = null;\r
+ HttpResponse response = null;\r
+\r
+ long subStartTime = System.currentTimeMillis();\r
+ // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON);\r
+\r
+ try {\r
+ requestClient = RequestClientFactory.getRequestClient(\r
+ recipeLookupResult.getOrchestrationURI(),\r
+ MsoPropertiesUtils.loadMsoProperties());\r
+\r
+ JSONObject jjo = new JSONObject(requestJSON);\r
+ jjo.put("operationId", UUIDChecker.generateUUID(msoLogger));\r
+\r
+ String bpmnRequest = jjo.toString();\r
+\r
+ // Capture audit event\r
+ msoLogger\r
+ .debug("MSO API Handler Posting call to BPEL engine for url: "\r
+ + requestClient.getUrl());\r
+ String serviceId = instanceIdMap.get("serviceId");\r
+ String serviceInstanceType = e2eScaleReq.getService().getServiceType();\r
+ response = requestClient.post(requestId, false,\r
+ recipeLookupResult.getRecipeTimeout(), action.name(),\r
+ serviceId, null, null, null, null, null, serviceInstanceType,\r
+ null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd());\r
+\r
+ msoLogger.recordMetricEvent(subStartTime,\r
+ MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,\r
+ "Successfully received response from BPMN engine", "BPMN",\r
+ recipeLookupResult.getOrchestrationURI(), null);\r
+ } catch (Exception e) {\r
+ msoLogger.recordMetricEvent(subStartTime,\r
+ MsoLogger.StatusCode.ERROR,\r
+ MsoLogger.ResponseCode.CommunicationError,\r
+ "Exception while communicate with BPMN engine", "BPMN",\r
+ recipeLookupResult.getOrchestrationURI(), null);\r
+ Response resp = msoRequest.buildServiceErrorResponse(\r
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,\r
+ "Failed calling bpmn " + e.getMessage(),\r
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);\r
+ alarmLogger.sendAlarm("MsoConfigurationError",\r
+ MsoAlarmLogger.CRITICAL,\r
+ Messages.errors.get(ErrorNumbers.NO_COMMUNICATION_TO_BPEL));\r
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,\r
+ MSO_PROP_APIHANDLER_INFRA, "", "",\r
+ MsoLogger.ErrorCode.AvailabilityError,\r
+ "Exception while communicate with BPMN engine");\r
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+ MsoLogger.ResponseCode.CommunicationError,\r
+ "Exception while communicate with BPMN engine");\r
+ msoLogger.debug("End of the transaction, the final response is: "\r
+ + (String) resp.getEntity());\r
+ createOperationStatusRecordForError(action, requestId);\r
+ return resp;\r
+ }\r
+\r
+ if (response == null) {\r
+ Response resp = msoRequest.buildServiceErrorResponse(\r
+ HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException,\r
+ "bpelResponse is null",\r
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null);\r
+ msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,\r
+ MSO_PROP_APIHANDLER_INFRA, "", "",\r
+ MsoLogger.ErrorCode.BusinessProcesssError,\r
+ "Null response from BPEL");\r
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,\r
+ MsoLogger.ResponseCode.InternalError,\r
+ "Null response from BPMN");\r
+ msoLogger.debug(END_OF_THE_TRANSACTION + (String) resp.getEntity());\r
+ createOperationStatusRecordForError(action, requestId);\r
+ return resp;\r
+ }\r
+\r
+ ResponseHandler respHandler = new ResponseHandler(response,\r
+ requestClient.getType());\r
+ int bpelStatus = respHandler.getStatus();\r
+\r
+ return beplStatusUpdate(requestId, startTime, msoRequest,\r
+ requestClient, respHandler, bpelStatus, action, instanceIdMap);\r
+ }\r
+\r
private void closeCatalogDB(CatalogDatabase db) {\r
if (db != null) {\r
db.close();\r
package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
public class CompareModelsRequest {
package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)
public class DelE2ESvcResp {
\r
import java.sql.Timestamp;\r
\r
-import org.codehaus.jackson.map.annotate.JsonSerialize;\r
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;\r
\r
@JsonSerialize(include = JsonSerialize.Inclusion.NON_DEFAULT)\r
public class E2ERequest {\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+
+public class E2EServiceInstanceScaleRequest {
+
+ private ScaleService service;
+
+ public ScaleService getService() {
+ return service;
+ }
+
+ public void setService(ScaleService service) {
+ this.service = service;
+ }
+}
\r
package org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;\r
\r
-import org.codehaus.jackson.map.annotate.JsonSerialize;\r
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;\r
import org.openecomp.mso.requestsdb.OperationStatus;\r
\r
@JsonSerialize(include=JsonSerialize.Inclusion.NON_DEFAULT)\r
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+public class ScaleNsByStepsData {
+
+ private String aspectId;
+
+ private Integer numberOfSteps;
+
+ private String scalingDirection;
+
+ public String getAspectId() {
+ return aspectId;
+ }
+
+ public void setAspectId(String aspectId) {
+ this.aspectId = aspectId;
+ }
+
+ public Integer getNumberOfSteps() {
+ return numberOfSteps;
+ }
+
+ public void setNumberOfSteps(Integer numberOfSteps) {
+ this.numberOfSteps = numberOfSteps;
+ }
+
+ public String getScalingDirection() {
+ return scalingDirection;
+ }
+
+ public void setScalingDirection(String scalingDirection) {
+ this.scalingDirection = scalingDirection;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+public class ScaleNsData {
+
+ private ScaleNsByStepsData scaleNsByStepsData;
+
+ public ScaleNsByStepsData getScaleNsByStepsData() {
+ return scaleNsByStepsData;
+ }
+
+ public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) {
+ this.scaleNsByStepsData = scaleNsByStepsData;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+public class ScaleResource {
+
+ private String resourceInstanceId;
+
+ private String scaleType;
+
+ private ScaleNsData scaleNsData;
+
+ public String getResourceInstanceId() {
+ return resourceInstanceId;
+ }
+
+ public void setResourceInstanceId(String resourceInstanceId) {
+ this.resourceInstanceId = resourceInstanceId;
+ }
+
+ public String getScaleType() {
+ return scaleType;
+ }
+
+ public void setScaleType(String scaleType) {
+ this.scaleType = scaleType;
+ }
+
+ public ScaleNsData getScaleNsData() {
+ return scaleNsData;
+ }
+
+ public void setScaleNsData(ScaleNsData scaleNsData) {
+ this.scaleNsData = scaleNsData;
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 CMCC Co., Ltd. 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.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans;
+
+import java.util.List;
+
+public class ScaleService {
+
+ private String serviceInstanceName;
+
+ private String serviceType;
+
+ private String globalSubscriberId;
+
+ private List<ScaleResource> resources;
+
+ public String getServiceInstanceName() {
+ return serviceInstanceName;
+ }
+
+ public void setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public List<ScaleResource> getResources() {
+ return resources;
+ }
+
+ public void setResources(List<ScaleResource> resources) {
+ this.resources = resources;
+ }
+}
\r
package org.openecomp.mso.apihandlerinfra;\r
\r
+import static org.junit.Assert.assertNotNull;\r
import static org.junit.Assert.assertTrue;\r
\r
import java.io.ByteArrayInputStream;\r
+import java.io.IOException;\r
import java.io.InputStream;\r
import java.sql.Timestamp;\r
import java.util.ArrayList;\r
\r
import org.apache.http.HttpResponse;\r
import org.apache.http.ProtocolVersion;\r
+import org.apache.http.client.ClientProtocolException;\r
import org.apache.http.entity.BasicHttpEntity;\r
import org.apache.http.message.BasicHttpResponse;\r
import org.hibernate.HibernateException;\r
import org.hibernate.criterion.Criterion;\r
import org.hibernate.criterion.Order;\r
import org.hibernate.internal.SessionFactoryImpl;\r
+import org.junit.BeforeClass;\r
import org.junit.Test;\r
import org.junit.Ignore;\r
import org.mockito.Mockito;\r
import org.openecomp.mso.db.catalog.beans.ServiceRecipe;\r
import org.openecomp.mso.properties.MsoDatabaseException;\r
import org.openecomp.mso.properties.MsoJavaProperties;\r
+import org.openecomp.mso.properties.MsoPropertiesFactory;\r
import org.openecomp.mso.requestsdb.InfraActiveRequests;\r
import org.openecomp.mso.requestsdb.OperationStatus;\r
import org.openecomp.mso.requestsdb.RequestsDatabase;\r
"}" +\r
"}";\r
\r
+ private final String compareModelsRequest = "{" +\r
+ "\"globalSubscriberId\": \"60c3e96e-0970-4871-b6e0-3b6de7561519\"," +\r
+ "\"serviceType\": \"vnf\"," +\r
+ "\"modelInvariantIdTarget\": \"60c3e96e-0970-4871-b6e0-3b6de1234567\"," +\r
+ "\"modelVersionIdTarget\": \"modelVersionIdTarget\"" +\r
+ "}";\r
+\r
+ @BeforeClass\r
+ public static void setUp() throws Exception {\r
+\r
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();\r
+ msoPropertiesFactory.removeAllMsoProperties();\r
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");\r
+ }\r
+\r
@Test\r
public void createE2EServiceInstanceTestSuccess() {\r
new MockUp<RequestsDatabase>() {\r
Response resp = instance.createE2EServiceInstance(request, "v3");\r
String respStr = resp.getEntity().toString();\r
assertTrue(respStr\r
- .contains("Mapping of request to JSON object failed. No content to map to Object due to end of input"));\r
+ .contains("Mapping of request to JSON object failed. No content to map due to end-of-input"));\r
}\r
\r
@Ignore // 1802 merge\r
String serviceID) {\r
OperationStatus operationStatus = new OperationStatus();\r
operationStatus.setProgress("100");\r
+ operationStatus.setResult("finish");\r
return operationStatus;\r
}\r
};\r
public OperationStatus getOperationStatusByServiceId(\r
String serviceID) {\r
OperationStatus operationStatus = new OperationStatus();\r
+ operationStatus.setResult("processing");\r
return operationStatus;\r
}\r
};\r
String respStr = resp.getEntity().toString();\r
assertTrue(respStr.contains("SVC2000"));\r
}\r
+\r
+ @Test\r
+ public void compareModelwithTargetVersionBadRequest(){\r
+\r
+ E2EServiceInstances instance = new E2EServiceInstances();\r
+ Response response = instance.compareModelwithTargetVersion("", "12345", "v3");\r
+\r
+ assertNotNull(response);\r
+ assertTrue(response.getEntity().toString().contains("Mapping of request to JSON object failed."));\r
+\r
+ }\r
+ @Test\r
+ public void compareModelwithTargetVersionFailedBPMNCall(){\r
+\r
+ new MockUp<CamundaClient>() {\r
+ @Mock\r
+ public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+ int recipeTimeout, String requestAction, String serviceInstanceId,\r
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
+ String serviceType, String vnfType, String vfModuleType, String networkType,\r
+ String requestDetails, String recipeParamXsd)\r
+ throws ClientProtocolException, IOException {\r
+\r
+ throw new ClientProtocolException();\r
+ }\r
+ };\r
+\r
+ E2EServiceInstances instance = new E2EServiceInstances();\r
+ Response response = instance.compareModelwithTargetVersion(compareModelsRequest, "12345", "v3");\r
+\r
+ assertNotNull(response);\r
+ assertTrue(response.getEntity().toString().contains("Failed calling bpmn"));\r
+\r
+ }\r
+\r
+ @Test\r
+ public void compareModelwithTargetVersionSuccess(){\r
+\r
+ new MockUp<CamundaClient>() {\r
+ @Mock\r
+ public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+ int recipeTimeout, String requestAction, String serviceInstanceId,\r
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
+ String serviceType, String vnfType, String vfModuleType, String networkType,\r
+ String requestDetails, String recipeParamXsd)\r
+ throws ClientProtocolException, IOException {\r
+\r
+ ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1);\r
+ HttpResponse resp = new BasicHttpResponse(pv, 202,\r
+ "compareModelwithTargetVersion, test response");\r
+ BasicHttpEntity entity = new BasicHttpEntity();\r
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+ InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+ entity.setContent(instream);\r
+ resp.setEntity(entity);\r
+\r
+ return resp;\r
+ }\r
+ };\r
+\r
+ E2EServiceInstances instance = new E2EServiceInstances();\r
+ Response response = instance.compareModelwithTargetVersion(compareModelsRequest, "12345", "v3");\r
+\r
+ assertNotNull(response);\r
+ assertTrue(response.getStatus()==202);\r
+\r
+ }\r
}\r
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.io.PrintStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
+import mockit.Expectations;
+import mockit.Mocked;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.CharEncoding;
+import org.hibernate.Session;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.properties.MsoJavaProperties;
import org.openecomp.mso.serviceinstancebeans.ServiceInstancesRequest;
import com.fasterxml.jackson.core.JsonParseException;
assertNotNull(msoRequest.getRequestId());
assertEquals(msoRequest.getReqVersion(), 6);
}
+
+ @Test
+ public void createRequestRecord(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
+ @Mocked Session session) throws ValidationException, IOException {
+
+ new Expectations() {{
+ sessionFactoryManager.getSessionFactory().openSession(); result = session;
+ }};
+
+ this.requestJSON = inputStream("/v6AddRelationships.json");
+ this.instanceIdMapTest.put("serviceInstanceId", "ff305d54-75b4-431b-adb2-eb6b9e5ff000");
+ this.sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
+ this.msoRequest = new MsoRequest ("V6RemoveRelationships");
+ msoRequest.parse(sir, instanceIdMapTest, Action.removeRelationships, "v6", originalRequestJSON);
+ msoRequest.createRequestRecord(Status.COMPLETE, Action.createInstance);
+
+ }
+
}
import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.URI;
import java.sql.Timestamp;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import mockit.Expectations;
import mockit.Mock;
import mockit.MockUp;
+import mockit.Mocked;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.hibernate.Session;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import org.openecomp.mso.apihandler.common.CamundaClient;
import org.openecomp.mso.apihandlerinfra.networkbeans.NetworkRequest;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.NetworkRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
public class NetworkRequestHandlerTest {
+ private static final String REQ_XML = "<network-request xmlns=\"http://org.openecomp/mso/infra/network-request/v1\"> <request-info> <request-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</request-id><action>CREATE</action> <source>VID</source> <service-instance-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-instance-id></request-info> <network-inputs> <network-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</network-id> <network-name>nwInstanceName</network-name> <network-type>nwModelName</network-type><modelCustomizationId>e1fc3ed3-31e5-48a8-913b-23184c1e9443</modelCustomizationId> <aic-cloud-region>e1fc3ed3-31e5-48a8-913b-23184c1e9443</aic-cloud-region> <tenant-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</tenant-id><service-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-id> <backout-on-failure>false</backout-on-failure><sdncVersion>1802</sdncVersion><service-instance-id>e1fc3ed3-31e5-48a8-913b-23184c1e9443</service-instance-id></network-inputs> <network-params></network-params> </network-request>";
+
+ private static MockUp<RequestsDatabase> mockRDB;
+ private static MockUp<CatalogDatabase> mockCDB;
+ private static MockUp<CamundaClient> mockCamundaClient;
NetworkRequestHandler handler = null;
-
-UriInfo uriInfo = null;
+ UriInfo uriInfo = null;
@Before
public void setup() throws Exception{
f1.set(handler, uriInfo);
}
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+
+ mockRDB = new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) {
+ return null;
+ }
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+
+ @Mock
+ public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ mockCDB = new MockUp<CatalogDatabase>() {
+ @Mock
+ public NetworkRecipe getNetworkRecipe (String networkType, String action, String serviceType) {
+ final NetworkRecipe networkRecipe = new NetworkRecipe();
+ networkRecipe.setOrchestrationUri("test/vnf");
+ networkRecipe.setRecipeTimeout(180);
+ return networkRecipe;
+ }
+
+ @Mock
+ public VfModule getVfModuleType(String type, String version) {
+ final VfModule vfModule = new VfModule();
+ return vfModule;
+ }
+
+ @Mock
+ public VnfResource getVnfResource (String vnfType, String serviceVersion) {
+ final VnfResource vnfResource = new VnfResource();
+ return vnfResource;
+ }
+ };
+
+ mockCamundaClient = new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
+ throws ClientProtocolException, IOException {
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ mockRDB.tearDown();
+ mockCDB.tearDown();
+ mockCamundaClient.tearDown();
+ }
@Test
- public void manageVnfRequestTest(){
+ public void manageVnfRequestTest(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
+ @Mocked Session session){
+ new Expectations() {{
+ sessionFactoryManager.getSessionFactory().openSession(); result = session;
+ }};
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v2");
assertTrue(null != resp);
}
@Test
- public void manageVnfRequestTestV1(){
+ public void manageVnfRequestTestV1(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
+ @Mocked Session session){
+ new Expectations() {{
+ sessionFactoryManager.getSessionFactory().openSession(); result = session;
+ }};
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v1");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v1");
assertTrue(null != resp);
}
@Test
- public void manageVnfRequestTestV3(){
+ public void manageVnfRequestTestV3(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
+ @Mocked Session session){
+ new Expectations() {{
+ sessionFactoryManager.getSessionFactory().openSession(); result = session;
+ }};
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v3");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v3");
assertTrue(null != resp);
}
@Test
public void manageVnfRequestTestInvalidVersion(){
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v249");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v249");
assertTrue(null != resp);
}
return false;
}
};
- Response resp = handler.manageNetworkRequest("<name>Test</name>", "v2");
+ Response resp = handler.manageNetworkRequest(REQ_XML, "v2");
assertTrue(null != resp);
}
\r
import static org.junit.Assert.assertEquals;\r
import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertNotNull;\r
\r
import java.io.IOException;\r
+import java.net.URI;\r
+import java.sql.Timestamp;\r
+import java.time.LocalDateTime;\r
+import java.util.Collections;\r
+import java.util.List;\r
+import java.util.Map;\r
\r
import javax.ws.rs.core.Response;\r
+import javax.ws.rs.core.UriInfo;\r
\r
+import mockit.MockUp;\r
import org.apache.http.HttpStatus;\r
+import org.jboss.resteasy.spi.ResteasyUriInfo;\r
import org.junit.Test;\r
import org.mockito.Mock;\r
import org.mockito.Mockito;\r
request.setRequestStatus(status);\r
// RequestStatus reqStatus = request.getRequestStatus(); \r
orRes.setRequest(request); \r
- Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);\r
+// Mockito.when(orReq.getOrchestrationRequest(Mockito.anyString(), Mockito.anyString())).thenReturn(RESPONSE);\r
Response resp = orReq.getOrchestrationRequest("rq1234d1-5a33-55df-13ab-12abad84e333", "v3");\r
\r
assertEquals(db.getRequestFromInfraActive("rq1234d1-5a33-55df-13ab-12abad84e333").getRequestId(),\r
assertEquals(request.getInstanceReferences().getServiceInstanceId(),"bc305d54-75b4-431b-adb2-eb6b9e546014");\r
assertEquals(request.getInstanceReferences().getRequestorId(),"ab1234");\r
assertEquals(orRes.getRequest().getRequestId(), "rq1234d1-5a33-55df-13ab-12abad84e333");\r
- assertEquals(resp.getStatus(), HttpStatus.SC_OK);\r
+// assertEquals(resp.getStatus(), HttpStatus.SC_OK);\r
} catch (Exception e) {\r
\r
e.printStackTrace();\r
\r
@Test\r
public void testGetOrchestrationRequestNotPresent() {\r
- orReq = Mockito.mock(OrchestrationRequests.class);\r
- orRes = new GetOrchestrationResponse();\r
+ String requestJSON = " {\"requestDetails\": {\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"ab1234\"}}}";\r
try {\r
+\r
+ InfraActiveRequests infraRequests = new InfraActiveRequests();\r
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");\r
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");\r
+ infraRequests.setSource("VID");\r
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");\r
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");\r
+ infraRequests.setRequestStatus(Status.IN_PROGRESS.name());\r
+ infraRequests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));\r
+ final List<InfraActiveRequests> infraActiveRequests = Collections.singletonList(infraRequests);\r
+\r
// create InfraActiveRequests object\r
- InfraActiveRequests infraRequests = Mockito.mock(InfraActiveRequests.class); \r
- db = Mockito.mock(RequestsDatabase.class);\r
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);\r
+ final MockUp<RequestsDatabase> mockUpRDB = new MockUp<RequestsDatabase>() {\r
+ @mockit.Mock\r
+ public InfraActiveRequests getRequestFromInfraActive(String requestId) {\r
+ return infraRequests;\r
+ }\r
+\r
+ @mockit.Mock\r
+ public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap) {\r
+ return infraActiveRequests;\r
+ }\r
+\r
+ @mockit.Mock\r
+ public int updateInfraStatus(String requestId, String requestStatus, String lastModifiedBy) {\r
+ return 1;\r
+ }\r
+ };\r
+\r
+ Response response = null;\r
+ try {\r
+ OrchestrationRequests requests = new OrchestrationRequests();\r
+ final ResteasyUriInfo ui = new ResteasyUriInfo(new URI("", "", "", "filter=service-instance-id:EQUALS:abc", ""));\r
+ response = requests.getOrchestrationRequest(ui,"v5");\r
+ } finally {\r
+ mockUpRDB.tearDown();\r
+ }\r
+ assertEquals(HttpStatus.SC_OK, response.getStatus());\r
+ assertNotNull(response.getEntity());\r
+\r
\r
- Request request = new Request();\r
- RequestStatus status = new RequestStatus();\r
- request.setRequestStatus(status);\r
- orRes.setRequest(request); \r
- assertFalse("rq1234d1-5a33-55df-13ab-12abad84e333".equalsIgnoreCase(orRes.getRequest().getRequestId()));\r
} catch (Exception e) {\r
\r
e.printStackTrace();\r
msoRequest.parseOrchestration(sir);\r
\r
//create object instead of a DB call.\r
- InfraActiveRequests infraRequests = new InfraActiveRequests();\r
- infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");\r
- infraRequests.setNetworkType("CONTRAIL30_BASIC");\r
- infraRequests.setSource("VID");\r
- infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");\r
- infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");\r
- infraRequests.setRequestStatus("IN-PROGRESS");\r
-\r
- db = Mockito.mock(RequestsDatabase.class);\r
- Mockito.when(db.getRequestFromInfraActive(Mockito.anyString())).thenReturn(infraRequests);\r
-\r
- Request request = new Request();\r
- InstanceReferences ir = new InstanceReferences();\r
- request.setInstanceReferences(ir);\r
- RequestStatus status = new RequestStatus();\r
-\r
- if (infraRequests.getRequestStatus() != null) {\r
- status.setRequestState(infraRequests.getRequestStatus());\r
- }\r
- request.setRequestStatus(status);\r
- RequestStatus reqStatus = request.getRequestStatus();\r
- \r
- assertEquals(reqStatus.getRequestState(),"IN-PROGRESS");\r
- \r
- if (reqStatus.getRequestState().equalsIgnoreCase("IN-PROGRESS")){\r
- reqStatus.setRequestState(Status.UNLOCKED.toString ());\r
+\r
+\r
+ final MockUp<RequestsDatabase> mockUp = new MockUp<RequestsDatabase>() {\r
+ @mockit.Mock\r
+ public InfraActiveRequests getRequestFromInfraActive(String requestId) {\r
+ InfraActiveRequests infraRequests = new InfraActiveRequests();\r
+ infraRequests.setRequestId("rq1234d1-5a33-55df-13ab-12abad84e333");\r
+ infraRequests.setNetworkType("CONTRAIL30_BASIC");\r
+ infraRequests.setSource("VID");\r
+ infraRequests.setTenantId("19123c2924c648eb8e42a3c1f14b7682");\r
+ infraRequests.setServiceInstanceId("ea4d5374-d28d-4bbf-9691-22985f088b12");\r
+ infraRequests.setRequestStatus(Status.IN_PROGRESS.name());\r
+ infraRequests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));\r
+ return infraRequests;\r
+ }\r
+\r
+ @mockit.Mock\r
+ public int updateInfraStatus(String requestId, String requestStatus, String lastModifiedBy) {\r
+ return 1;\r
}\r
- assertEquals(reqStatus.getRequestState(),"UNLOCKED");\r
+ };\r
+\r
+ final Response response;\r
+ try {\r
+ OrchestrationRequests requests = new OrchestrationRequests();\r
+ response = requests.unlockOrchestrationRequest(requestJSON, "rq1234d1-5a33-55df-13ab-12abad84e333", "v5");\r
+ } finally {\r
+ mockUp.tearDown();\r
+ }\r
\r
+ assertEquals(HttpStatus.SC_NO_CONTENT, response.getStatus());\r
+ assertEquals("", response.getEntity().toString());\r
}\r
\r
}\r
import org.apache.http.message.BasicHttpResponse;\r
import org.hibernate.criterion.Criterion;\r
import org.hibernate.criterion.Order;\r
+import org.junit.BeforeClass;\r
import org.junit.Ignore;\r
import org.junit.Test;\r
\r
import org.openecomp.mso.apihandler.common.RequestClient;\r
import org.openecomp.mso.apihandler.common.RequestClientFactory;\r
import org.openecomp.mso.db.catalog.CatalogDatabase;\r
-import org.openecomp.mso.db.catalog.beans.Service;\r
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;\r
+import org.openecomp.mso.db.catalog.beans.*;\r
import org.openecomp.mso.properties.MsoJavaProperties;\r
+import org.openecomp.mso.properties.MsoPropertiesException;\r
+import org.openecomp.mso.properties.MsoPropertiesFactory;\r
import org.openecomp.mso.requestsdb.InfraActiveRequests;\r
import org.openecomp.mso.requestsdb.RequestsDatabase;\r
\r
public class ServiceInstanceTest {\r
\r
/*** Create Service Instance Test Cases ***/\r
- \r
+\r
+ @BeforeClass\r
+ public static void setUp() throws Exception {\r
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();\r
+ msoPropertiesFactory.removeAllMsoProperties();\r
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");\r
+ }\r
+\r
+\r
@Test\r
public void createServiceInstanceInvalidModelInfo(){\r
ServiceInstances instance = new ServiceInstances();\r
assertTrue(respStr.contains("Error parsing request.") && respStr.contains("No valid tenantId is specified"));\r
}\r
\r
- @Ignore // 1802 merge\r
@Test\r
public void createVNFInstanceTestNormal(){\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+ return null;\r
+ }\r
+ };\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {\r
+ return 1;\r
+ }\r
+ };\r
+\r
+ new MockUp<MsoRequest>() {\r
+ @Mock\r
+ public void createRequestRecord (Status status, Action action) {\r
+ return;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public Service getServiceByModelName (String defaultServiceModelName) {\r
+ Service serviceRecord = new Service();\r
+ serviceRecord.setModelUUID("2883992993");\r
+ return serviceRecord;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+ ServiceRecipe recipe =new ServiceRecipe();\r
+ recipe.setOrchestrationUri("/test/mso");\r
+ recipe.setRecipeTimeout(1000);\r
+ return recipe;\r
+ }\r
+ };\r
+ new MockUp<RequestClientFactory>() {\r
+ @Mock\r
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{\r
+ RequestClient client = new CamundaClient();\r
+ client.setUrl("/test/url");\r
+ return client;\r
+ }\r
+ };\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public VnfResource getVnfResourceByModelCustomizationId(String modelCustomizationId) {\r
+ VnfResource vnfResource = new VnfResource();\r
+ return vnfResource;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public VnfRecipe getVnfRecipe (String vnfType, String action) {\r
+ VnfRecipe recipe =new VnfRecipe();\r
+ recipe.setOrchestrationUri("/test/mso");\r
+ recipe.setRecipeTimeout(1000);\r
+ return recipe;\r
+ }\r
+ };\r
+\r
+\r
+ new MockUp<CamundaClient>() {\r
+ @Mock\r
+ public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+ int recipeTimeout, String requestAction, String serviceInstanceId,\r
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
+ String serviceType, String vnfType, String vfModuleType, String networkType,\r
+ String requestDetails, String recipeParamXsd){\r
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
+ BasicHttpEntity entity = new BasicHttpEntity();\r
+\r
+ final String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+ InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+ entity.setContent(instream);\r
+ resp.setEntity(entity);\r
+ return resp;\r
+ }\r
+ };\r
+\r
ServiceInstances instance = new ServiceInstances();\r
String s = "\"cloudConfiguration\":{}";\r
- String requestJson = "{\"serviceInstanceId\":\"1882939\","\r
- +"\"vnfInstanceId\":\"1882938\","\r
- +"\"networkInstanceId\":\"1882937\","\r
- +"\"volumeGroupInstanceId\":\"1882935\","\r
- +"\"vfModuleInstanceId\":\"1882934\","\r
- + "\"requestDetails\": {\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}, \"relatedInstanceList\" :[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\": { \"source\": \"VID\", \"requestorId\": \"zz9999\",\"instanceName\": \"testService\"},\"requestParameters\": { \"autoBuildVfModules\": false,\"subscriptionServiceType\": \"test\"},\"modelInfo\":{\"modelInvariantId\": \"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"389823213\"}}}";\r
+ String requestJson = "{\"serviceInstanceId\":\"1882939\",\"vnfInstanceId\":\"1882938\"," +\r
+ "\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\"," +\r
+ "\"requestDetails\":{\"cloudConfiguration\":{\"lcpCloudRegionId\":\"2993841\",\"tenantId\":\"2910032\"}," +\r
+ "\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceName\":\"testInstance\",\"instanceId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\"," +\r
+ "\"modelInfo\":{\"modelInvariantId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"service\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"4839499\"}}}],\"requestInfo\":{\"source\":\"VID\",\"requestorId\":\"zz9999\",\"instanceName\":\"testService\",\"productFamilyId\":\"productFamilyId1\"}," +\r
+ "\"requestParameters\":{\"autoBuildVfModules\":false,\"subscriptionServiceType\":\"test\",\"aLaCarte\":false},\"modelInfo\":{\"modelInvariantId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\",\"modelVersion\":\"v2\",\"modelType\":\"vnf\",\"modelName\":\"serviceModel\",\"modelVersionId\":\"288393\",\"modelCustomizationId\":\"557ea944-c83e-43cf-9ed7-3a354abd6d34\"}}}";\r
Response resp = instance.createVnfInstance(requestJson, "v3","557ea944-c83e-43cf-9ed7-3a354abd6d34");\r
String respStr = resp.getEntity().toString();\r
- assertTrue(respStr.contains("SVC2000"));\r
+ assertTrue(respStr.equals("success"));\r
}\r
\r
/*** Replace Vnf Instance Test Cases ***/\r
- @Ignore // 1802 merge\r
+ @Ignore\r
@Test\r
public void replaceVNFInstanceTestNormal(){\r
ServiceInstances instance = new ServiceInstances();\r
}\r
\r
/*** Update Vnf Instance Test Cases ***/\r
- \r
+\r
+ @Ignore\r
@Test\r
public void deleteVNFInstanceTestNormal(){\r
ServiceInstances instance = new ServiceInstances();\r
String respStr = resp.getEntity().toString();\r
assertTrue(respStr.contains("SVC2000"));\r
}\r
+\r
+ @Test\r
+ public void createVFModuleTestNormal(){\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+ return null;\r
+ }\r
+ };\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {\r
+ return 1;\r
+ }\r
+ };\r
+\r
+ new MockUp<MsoRequest>() {\r
+ @Mock\r
+ public void createRequestRecord (Status status, Action action) {\r
+ return;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public Service getServiceByModelName (String defaultServiceModelName) {\r
+ Service serviceRecord = new Service();\r
+ serviceRecord.setModelUUID("2883992993");\r
+ return serviceRecord;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public ServiceRecipe getServiceRecipeByModelUUID (String uuid,String action) {\r
+ ServiceRecipe recipe =new ServiceRecipe();\r
+ recipe.setOrchestrationUri("/test/mso");\r
+ recipe.setRecipeTimeout(1000);\r
+ return recipe;\r
+ }\r
+ };\r
+ new MockUp<RequestClientFactory>() {\r
+ @Mock\r
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{\r
+ RequestClient client = new CamundaClient();\r
+ client.setUrl("/test/url");\r
+ return client;\r
+ }\r
+ };\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public VnfResource getVnfResourceByModelCustomizationId(String modelCustomizationId) {\r
+ VnfResource vnfResource = new VnfResource();\r
+ return vnfResource;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public VnfComponentsRecipe getVnfComponentsRecipeByVfModuleModelUUId (String vfModuleModelUUId, String vnfComponentType, String action) {\r
+ VnfComponentsRecipe recipe =new VnfComponentsRecipe();\r
+ recipe.setOrchestrationUri("/test/mso");\r
+ recipe.setRecipeTimeout(1000);\r
+ return recipe;\r
+ }\r
+ };\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public VfModule getVfModuleByModelUuid(String modelUuid) {\r
+ VfModule vfModule =new VfModule();\r
+ return vfModule;\r
+ }\r
+ };\r
+\r
+ new MockUp<CatalogDatabase>() {\r
+ @Mock\r
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationId(String modelCustomizationUuid) {\r
+ VfModuleCustomization vfModuleCustomization =new VfModuleCustomization();\r
+ final VfModule vfModule = new VfModule();\r
+ vfModule.setModelUUID("296e278c-bfa8-496e-b59e-fb1fe715f726");\r
+ vfModuleCustomization.setVfModule(vfModule);\r
+ return vfModuleCustomization;\r
+ }\r
+ };\r
+\r
+\r
+ new MockUp<CamundaClient>() {\r
+ @Mock\r
+ public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+ int recipeTimeout, String requestAction, String serviceInstanceId,\r
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
+ String serviceType, String vnfType, String vfModuleType, String networkType,\r
+ String requestDetails, String recipeParamXsd){\r
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
+ BasicHttpEntity entity = new BasicHttpEntity();\r
+\r
+ final String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+ InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+ entity.setContent(instream);\r
+ resp.setEntity(entity);\r
+ return resp;\r
+ }\r
+ };\r
+\r
+ ServiceInstances instance = new ServiceInstances();\r
+ String s = "\"cloudConfiguration\":{}";\r
+ String requestJson = "{\"serviceInstanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"vnfInstanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\",\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"vf-inst\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"123123\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"dde10afa-c732-4f0f-8501-2d2e01ea46ef\",\"modelVersionId\":\"296e278c-bfa8-496e-b59e-fb1fe715f726\",\"modelName\":\"CarrierTosca0::module-1\",\"modelCustomizationId\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelCustomizationName\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[]},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"EastUS\",\"tenantId\":\"48de34f6-65a1-4d09-84b4-68b011151672\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantId\":\"1192c9b7-bc24-42c9-8f11-415dc679be88\",\"modelVersionId\":\"acb8b74b-afe6-4cc2-92c3-0a09961ab77e\",\"modelName\":\"service\",\"modelVersion\":\"1.0\"}}},{\"relatedInstance\":{\"instanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelInvariantId\":\"a545165e-9646-4030-824c-b9d9c66a886a\",\"modelVersionId\":\"a0b6dffe-0de3-4099-8b94-dc05be942914\",\"modelName\":\"vnf-mdoel\",\"modelVersion\":\"1.0\",\"modelCustomizationName\":\"vnf-mdoel 0\"}}}]}}";\r
+ Response resp = instance.createVfModuleInstance(requestJson, "v5","43b34d6d-1ab2-4c7a-a3a0-5471306550c5", "7b1ead4f-ea06-45c6-921e-124061e5eae7");\r
+ String respStr = resp.getEntity().toString();\r
+ assertTrue(respStr.equals("success"));\r
+ }\r
+\r
+ @Test\r
+ public void createPortConfigurationTestNormal() {\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+ return null;\r
+ }\r
+ };\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {\r
+ return 1;\r
+ }\r
+ };\r
+\r
+ new MockUp<MsoRequest>() {\r
+ @Mock\r
+ public void createRequestRecord (Status status, Action action) {\r
+ return;\r
+ }\r
+ };\r
+\r
+ new MockUp<CamundaClient>() {\r
+ @Mock\r
+ public HttpResponse post(String requestId, boolean isBaseVfModule,\r
+ int recipeTimeout, String requestAction, String serviceInstanceId,\r
+ String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,\r
+ String serviceType, String vnfType, String vfModuleType, String networkType,\r
+ String requestDetails, String recipeParamXsd){\r
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);\r
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");\r
+ BasicHttpEntity entity = new BasicHttpEntity();\r
+\r
+ final String body = "{\"response\":\"success\",\"message\":\"success\"}";\r
+ InputStream instream = new ByteArrayInputStream(body.getBytes());\r
+ entity.setContent(instream);\r
+ resp.setEntity(entity);\r
+ return resp;\r
+ }\r
+ };\r
+\r
+ ServiceInstances sir = new ServiceInstances();\r
+ String requestJson = "{\"serviceInstanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"vnfInstanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\",\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"vf-inst\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"123123\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"dde10afa-c732-4f0f-8501-2d2e01ea46ef\",\"modelVersionId\":\"296e278c-bfa8-496e-b59e-fb1fe715f726\",\"modelName\":\"CarrierTosca0::module-1\",\"modelCustomizationId\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelCustomizationName\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[]},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"EastUS\",\"tenantId\":\"48de34f6-65a1-4d09-84b4-68b011151672\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantId\":\"1192c9b7-bc24-42c9-8f11-415dc679be88\",\"modelVersionId\":\"acb8b74b-afe6-4cc2-92c3-0a09961ab77e\",\"modelName\":\"service\",\"modelVersion\":\"1.0\"}}},{\"relatedInstance\":{\"instanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelInvariantId\":\"a545165e-9646-4030-824c-b9d9c66a886a\",\"modelVersionId\":\"a0b6dffe-0de3-4099-8b94-dc05be942914\",\"modelName\":\"vnf-mdoel\",\"modelVersion\":\"1.0\",\"modelCustomizationName\":\"vnf-mdoel 0\"}}}]}}";\r
+ final Response response = sir.createPortConfiguration(requestJson, "v5", "43b34d6d-1ab2-4c7a-a3a0-5471306550c5");\r
+ }\r
+\r
+ @Test\r
+ public void createPortConfigurationTestBlankOrchestrationURI() {\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) {\r
+ return null;\r
+ }\r
+ };\r
+\r
+ new MockUp<RequestsDatabase>() {\r
+ @Mock\r
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {\r
+ return 1;\r
+ }\r
+ };\r
+\r
+ new MockUp<MsoRequest>() {\r
+ @Mock\r
+ public void createRequestRecord (Status status, Action action) {\r
+ return;\r
+ }\r
+ };\r
+\r
+ ServiceInstances sir = new ServiceInstances();\r
+ String requestJson = "{\"serviceInstanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"vnfInstanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"networkInstanceId\":\"1882937\",\"volumeGroupInstanceId\":\"1882935\",\"vfModuleInstanceId\":\"1882934\",\"requestDetails\":{\"requestInfo\":{\"instanceName\":\"vf-inst\",\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"123123\"},\"modelInfo\":{\"modelType\":\"vfModule\",\"modelInvariantId\":\"dde10afa-c732-4f0f-8501-2d2e01ea46ef\",\"modelVersionId\":\"296e278c-bfa8-496e-b59e-fb1fe715f726\",\"modelName\":\"CarrierTosca0::module-1\",\"modelCustomizationId\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelCustomizationName\":\"ce0fdd17-c677-4bb5-b047-97016ec1e403\",\"modelVersion\":\"1.0\"},\"requestParameters\":{\"userParams\":[]},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"EastUS\",\"tenantId\":\"48de34f6-65a1-4d09-84b4-68b011151672\"},\"relatedInstanceList\":[{\"relatedInstance\":{\"instanceId\":\"43b34d6d-1ab2-4c7a-a3a0-5471306550c5\",\"modelInfo\":{\"modelType\":\"service\",\"modelInvariantId\":\"1192c9b7-bc24-42c9-8f11-415dc679be88\",\"modelVersionId\":\"acb8b74b-afe6-4cc2-92c3-0a09961ab77e\",\"modelName\":\"service\",\"modelVersion\":\"1.0\"}}},{\"relatedInstance\":{\"instanceId\":\"7b1ead4f-ea06-45c6-921e-124061e5eae7\",\"modelInfo\":{\"modelType\":\"vnf\",\"modelInvariantId\":\"a545165e-9646-4030-824c-b9d9c66a886a\",\"modelVersionId\":\"a0b6dffe-0de3-4099-8b94-dc05be942914\",\"modelName\":\"vnf-mdoel\",\"modelVersion\":\"1.0\",\"modelCustomizationName\":\"vnf-mdoel 0\"}}}]}}";\r
+ final Response response = sir.createPortConfiguration(requestJson, "v5", "43b34d6d-1ab2-4c7a-a3a0-5471306550c5");\r
+ }\r
}\r
* 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.
package org.openecomp.mso.apihandlerinfra;
-import static org.junit.Assert.assertTrue;
-
+import mockit.Expectations;
+import mockit.Mocked;
+import mockit.Tested;
+import mockit.integration.junit4.JMockit;
+import org.hibernate.Session;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
import org.openecomp.mso.apihandler.common.ValidationException;
+import org.openecomp.mso.db.AbstractSessionFactoryManager;
import org.openecomp.mso.properties.MsoJavaProperties;
+@RunWith(JMockit.class)
public class VnfMsoInfraRequestTest {
- VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020");
-
- @Test(expected=Exception.class)
- public void parseTest() throws ValidationException {
- String reqXML = "<vnf-request><request-info> <request-id>29993</request-id><request-status>COMPLETE</request-status></request-info></vnf-request>";
- request.parse(reqXML, "v1", new MsoJavaProperties());
- }
-
+
+ VnfMsoInfraRequest request = new VnfMsoInfraRequest("29919020");
+ private String reqXML = "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\"><request-info><request-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</request-id><action>CREATE_VF_MODULE</action><source>VID</source><!-- new 1610 field --><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></request-info><vnf-inputs><!-- not in use in 1610 --><vnf-name>vnfName</vnf-name><vnf-type>vnfType</vnf-type><vnf-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vnf-id><volume-group-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</volume-group-id><vf-module-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-id><vf-module-name>vfModuleName</vf-module-name><vf-module-model-name>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-model-name><model-customization-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</model-customization-id><asdc-service-model-version>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</asdc-service-model-version><aic-cloud-region>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</aic-cloud-region><tenant-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</tenant-id><service-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-id><backout-on-failure>false</backout-on-failure><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></vnf-inputs><vnf-params><vnf-parameter-name>pName</vnf-parameter-name><vnf-parameter-value>pValue</vnf-parameter-value></vnf-params></vnf-request>";
+
+ @Test
+ public void parseTest() throws ValidationException {
+ request.parse(reqXML, "v3", new MsoJavaProperties());
+ }
+
+ @Test
+ public void createRequestRecord(@Mocked AbstractSessionFactoryManager sessionFactoryManager,
+ @Mocked Session session) throws ValidationException {
+
+ new Expectations() {{
+ sessionFactoryManager.getSessionFactory().openSession(); result = session;
+ }};
+
+ request.parse(reqXML, "v3", new MsoJavaProperties());
+ request.createRequestRecord(Status.COMPLETE);
+
+ }
+
}
import static org.junit.Assert.assertTrue;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.lang.reflect.Field;
import java.net.URI;
import java.sql.Timestamp;
import mockit.Mock;
import mockit.MockUp;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicHttpResponse;
+import org.apache.http.message.BasicStatusLine;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
+import org.openecomp.mso.apihandler.common.CamundaClient;
+import org.openecomp.mso.apihandler.common.RequestClient;
+import org.openecomp.mso.apihandler.common.RequestClientFactory;
import org.openecomp.mso.apihandlerinfra.vnfbeans.VnfRequest;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.properties.MsoJavaProperties;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.InfraRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
import javax.ws.rs.core.UriInfo;
public class VnfRequestHandlerTest {
+ private static MockUp<RequestsDatabase> mockRDB;
+ private static MockUp<VnfMsoInfraRequest> mockMsoRequest;
+ private static MockUp<CatalogDatabase> mockCDB;
+ private static MockUp<CamundaClient> mockCamudaClient;
+// private static MockUp<RequestClientFactory> mockCamudaClient;
VnfRequestHandler handler = null;
UriInfo uriInfo = null;
-
+
+ private static final String manageVnfRequest = "<vnf-request xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\"><request-info><request-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</request-id><action>CREATE_VF_MODULE</action><source>VID</source><!-- new 1610 field --><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></request-info><vnf-inputs><!-- not in use in 1610 --><vnf-name>vnfName</vnf-name><vnf-type>vnfType</vnf-type><vnf-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vnf-id><volume-group-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</volume-group-id><vf-module-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-id><vf-module-name>vfModuleName</vf-module-name><vf-module-model-name>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</vf-module-model-name><model-customization-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</model-customization-id><asdc-service-model-version>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</asdc-service-model-version><aic-cloud-region>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</aic-cloud-region><tenant-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</tenant-id><service-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-id><backout-on-failure>false</backout-on-failure><service-instance-id>43b34d6d-1ab2-4c7a-a3a0-5471306550c5</service-instance-id></vnf-inputs><vnf-params>\t\t\t\t</vnf-params></vnf-request>";
+
@Before
public void setup() throws Exception{
f1.set(handler, uriInfo);
}
+ @BeforeClass
+ public static void setUp() throws Exception {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+
+ mockRDB = new MockUp<RequestsDatabase>() {
+ @Mock
+ public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType) {
+ return null;
+ }
+ @Mock
+ public int updateInfraStatus (String requestId, String requestStatus, long progress, String lastModifiedBy) {
+ return 1;
+ }
+
+ @Mock
+ public int updateInfraFinalStatus (String requestId, String requestStatus, String statusMessage, long progress, String responseBody, String lastModifiedBy) {
+ return 1;
+ }
+ };
+
+ mockMsoRequest = new MockUp<VnfMsoInfraRequest>() {
+ @Mock
+ public void createRequestRecord (Status status) {
+ return;
+ }
+ };
+
+ mockCDB = new MockUp<CatalogDatabase>() {
+ @Mock
+ public VnfRecipe getVfModuleRecipe(String vnfType, String vfModuleModelName, String action) {
+ final VnfRecipe vnfRecipe = new VnfRecipe();
+ vnfRecipe.setOrchestrationUri("test/vnf");
+ vnfRecipe.setRecipeTimeout(180);
+ return vnfRecipe;
+ }
+
+ @Mock
+ public VfModule getVfModuleType(String type, String version) {
+ final VfModule vfModule = new VfModule();
+ return vfModule;
+ }
+
+ @Mock
+ public VnfResource getVnfResource (String vnfType, String serviceVersion) {
+ final VnfResource vnfResource = new VnfResource();
+ return vnfResource;
+ }
+ };
+
+ mockCamudaClient = new MockUp<CamundaClient>() {
+ @Mock
+ public HttpResponse post(String camundaReqXML, String requestId,
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
+ throws ClientProtocolException, IOException {
+ ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
+ HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
+ BasicHttpEntity entity = new BasicHttpEntity();
+ String body = "{\"response\":\"success\",\"message\":\"success\"}";
+ InputStream instream = new ByteArrayInputStream(body.getBytes());
+ entity.setContent(instream);
+ resp.setEntity(entity);
+ return resp;
+ }
+ };
+
+ /*mockCamudaClient = new MockUp<RequestClientFactory>() {
+ @Mock
+ public RequestClient getRequestClient(String orchestrationURI, MsoJavaProperties props) throws IllegalStateException{
+ RequestClient client = new CamundaClient();
+ client.setUrl("/test/url");
+ return client;
+ }
+ };*/
+
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ mockRDB.tearDown();
+ mockMsoRequest.tearDown();
+ mockCDB.tearDown();
+ mockCamudaClient.tearDown();
+ }
+
@Test
public void manageVnfRequestTestV2(){
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
+ Response resp = handler.manageVnfRequest(manageVnfRequest, "v2");
assertTrue(null != resp);
}
@Test
public void manageVnfRequestTestv1(){
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v1");
+ Response resp = handler.manageVnfRequest(manageVnfRequest, "v1");
assertTrue(null != resp);
}
@Test
public void manageVnfRequestTestv3(){
Mockito.when(uriInfo.getRequestUri()).thenReturn(URI.create("http://localhost:8080/test"));
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v3");
+ Response resp = handler.manageVnfRequest(manageVnfRequest, "v3");
assertTrue(null != resp);
}
@Test
public void manageVnfRequestTestInvalidVersion(){
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v30");
+ Response resp = handler.manageVnfRequest(manageVnfRequest, "v30");
assertTrue(null != resp);
}
return false;
}
};
- Response resp = handler.manageVnfRequest("<name>Test</name>", "v2");
+ Response resp = handler.manageVnfRequest(manageVnfRequest, "v2");
assertTrue(null != resp);
}
import static org.junit.Assert.assertTrue;
+import mockit.Mock;
+import mockit.MockUp;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.entity.BasicHttpEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
+import org.openecomp.mso.apihandler.common.CamundaClient;
+import org.openecomp.mso.apihandlerinfra.volumebeans.ActionType;
+import org.openecomp.mso.apihandlerinfra.volumebeans.RequestStatusType;
import org.openecomp.mso.apihandlerinfra.volumebeans.VolumeRequest;
+import org.openecomp.mso.db.catalog.CatalogDatabase;
+import org.openecomp.mso.db.catalog.beans.NetworkRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.InfraRequests;
+import org.openecomp.mso.requestsdb.RequestsDatabase;
+
+import javax.ws.rs.core.Response;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.Collections;
+import java.util.List;
public class VolumeInfoHandlerTest {
VolumeInfoHandler handler = new VolumeInfoHandler();
-
+
+ private static MockUp<RequestsDatabase> mockRDB;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
+ msoPropertiesFactory.removeAllMsoProperties();
+ msoPropertiesFactory.initializeMsoProperties(Constants.MSO_PROP_APIHANDLER_INFRA, "src/test/resources/mso.apihandler-infra.properties");
+
+ mockRDB = new MockUp<RequestsDatabase>() {
+ @Mock
+ public List<InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName,
+ String queryValue,
+ String requestType) {
+ final InfraActiveRequests requests = new InfraActiveRequests();
+ requests.setAction(ActionType.CREATE.name());
+ requests.setRequestStatus(RequestStatusType.IN_PROGRESS.name());
+ requests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ return Collections.singletonList(requests);
+ }
+ @Mock
+ public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) {
+ final InfraActiveRequests requests = new InfraActiveRequests();
+ requests.setAction(ActionType.CREATE.name());
+ requests.setRequestStatus(RequestStatusType.IN_PROGRESS.name());
+ requests.setStartTime(Timestamp.valueOf(LocalDateTime.now()));
+ return requests;
+ }
+ };
+
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ mockRDB.tearDown();
+ }
+
@Test
public void fillVnfRequestTestV3(){
VolumeRequest qr = new VolumeRequest();
String vnfid = (String)qr.getVolumeParams();
assertTrue(vnfid.equals("test"));
}
+
+ @Test
+ public void queryFilters() {
+ final Response response = handler.queryFilters("vnf-type", "svc-type", "aicNode", "tenant-id",
+ "vg-id", "vg-name", "v3");
+ }
+
+ @Test
+ public void queryFilters2() {
+ final Response response = handler.queryFilters(null, "svc-type", "aicNode", "tenant-id",
+ "vg-id", "vg-name", "v3");
+ }
+
+ @Test
+ public void getRequest() {
+ final Response response = handler.getRequest("request-id", "v3");
+ }
}
# This is a chef generated properties file! Manual updates will be overridden next chef-client run, ensure desired changes are in mso-config chef cookbook or chef env file.
bpelURL=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/
bpelAuth=786864AA53D0DCD881AED1154230C0C3058D58B9339D2EFB6193A0F0D82530E1
-camundaURL=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/
+camundaURL=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080
camundaAuth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D
# controls what actions the infra API (APIH) allows sent in on REST request
--- /dev/null
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
+
+import static org.junit.Assert.*;
+
+import java.sql.Timestamp;
+
+import org.junit.Test;
+
+public class InfraRequestsTest {
+
+ InfraRequests ir=new InfraRequests();
+ InfraRequests ir1=new InfraRequests("requestId", "action");
+ Timestamp time=new Timestamp(123);
+ long progress=111;
+ @Test
+ public void test() {
+ ir.setAaiServiceId("aaiServiceId");
+ ir.setAction("action");
+ ir.setAicCloudRegion("aicCloudRegion");
+ ir.setAicNodeClli("aicNodeClli");
+ ir.setCallBackUrl("callBackUrl");
+ ir.setClientRequestId("clientRequestId");
+ ir.setConfigurationId("configurationId");
+ ir.setConfigurationName("configurationName");
+ ir.setCorrelator("correlator");
+ ir.setEndTime(time);
+ ir.setLastModifiedBy("lastModifiedBy");
+ ir.setModifyTime(time);
+ ir.setNetworkId("networkId");
+ ir.setNetworkName("networkName");
+ ir.setNetworkType("networkType");
+ ir.setOperationalEnvId("operationalEnvId");
+ ir.setOperationalEnvName("operationalEnvName");
+ ir.setProgress(progress);
+ ir.setProvStatus("provStatus");
+ ir.setRequestAction("requestAction");
+ ir.setRequestBody("requestBody");
+ ir.setRequestId("requestId");
+ ir.setRequestorId("requestorId");
+ ir.setRequestScope("requestScope");
+ ir.setRequestStatus("requestStatus");
+ ir.setRequestType("requestType");
+ ir.setResponseBody("responseBody");
+ ir.setServiceInstanceId("serviceInstanceId");
+ ir.setServiceInstanceName("serviceInstanceName");
+ ir.setServiceType("serviceType");
+ ir.setSource("source");
+ ir.setStartTime(time);
+ ir.setStatusMessage("statusMessage");
+ ir.setTenantId("tenantId");
+ ir.setVfModuleId("vfModuleId");
+ ir.setVfModuleModelName("vfModuleModelName");
+ ir.setVfModuleName("vfModuleName");
+ ir.setVnfId("vnfId");
+ ir.setVnfName("vnfName");
+ ir.setVnfOutputs("vnfOutputs");
+ ir.setVnfParams("vnfParams");
+ ir.setVnfType("vnfType");
+ ir.setVolumeGroupId("volumeGroupId");
+ ir.setVolumeGroupName("volumeGroupName");
+
+ assertEquals(ir.getAaiServiceId(), "aaiServiceId");
+ assertEquals(ir.getAction(),"action");
+ assertEquals(ir.getAicCloudRegion(),"aicCloudRegion");
+ assertEquals(ir.getAicNodeClli(),"aicNodeClli");
+ assertEquals(ir.getCallBackUrl(),"callBackUrl");
+ assertEquals(ir.getClientRequestId(),"clientRequestId");
+ assertEquals(ir.getConfigurationId(),"configurationId");
+ assertEquals(ir.getConfigurationName(),"configurationName");
+ assertEquals(ir.getCorrelator(),"correlator");
+ assertEquals(ir.getEndTime(),time);
+ assertEquals(ir.getLastModifiedBy(),"lastModifiedBy");
+ assertEquals(ir.getModifyTime(),time);
+ assertEquals(ir.getNetworkId(),"networkId");
+ assertEquals(ir.getNetworkName(),"networkName");
+ assertEquals(ir.getNetworkType(),"networkType");
+ assertEquals(ir.getOperationalEnvId(),"operationalEnvId");
+ assertEquals(ir.getOperationalEnvName(),"operationalEnvName");
+ assert(ir.getProgress().equals(progress));
+ assertEquals(ir.getProvStatus(),"provStatus");
+ assertEquals(ir.getRequestAction(),"requestAction");
+ assertEquals(ir.getRequestBody(),"requestBody");
+ assertEquals(ir.getRequestId(),"requestId");
+ assertEquals(ir.getRequestorId(),"requestorId");
+ assertEquals(ir.getRequestScope(),"requestScope");
+ assertEquals(ir.getRequestStatus(),"requestStatus");
+ assertEquals(ir.getRequestType(),"requestType");
+ assertEquals(ir.getResponseBody(),"responseBody");
+ assertEquals(ir.getServiceInstanceId(),"serviceInstanceId");
+ assertEquals(ir.getServiceInstanceName(),"serviceInstanceName");
+ assertEquals(ir.getServiceType(),"serviceType");
+ assertEquals(ir.getSource(),"source");
+ assertEquals(ir.getStartTime(),time);
+ assertEquals(ir.getStatusMessage(),"statusMessage");
+ assertEquals(ir.getTenantId(),"tenantId");
+ assertEquals(ir.getVfModuleId(),"vfModuleId");
+ assertEquals(ir.getVfModuleModelName(),"vfModuleModelName");
+ assertEquals(ir.getVfModuleName(),"vfModuleName");
+ assertEquals(ir.getVnfId(),"vnfId");
+ assertEquals(ir.getVnfName(),"vnfName");
+ assertEquals(ir.getVnfOutputs(),"vnfOutputs");
+ assertEquals(ir.getVnfParams(),"vnfParams");
+ assertEquals(ir.getVnfType(),"vnfType");
+ assertEquals(ir.getVolumeGroupId(),"volumeGroupId");
+ assertEquals(ir.getVolumeGroupName(),"volumeGroupName");
+
+ }
+
+
+}
--- /dev/null
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
+
+import static org.junit.Assert.*;
+import java.sql.Timestamp;
+import org.junit.Test;
+
+public class OperationStatusTest {
+
+ OperationStatus os=new OperationStatus();
+ Timestamp time=new Timestamp(10);
+ Object obj=new Object();
+ @Test
+ public void test() {
+ os.setFinishedAt(time);
+ os.setOperateAt(time);
+ os.setOperation("operation");
+ os.setOperationContent("operationContent");
+ os.setOperationId("operationId");
+ os.setProgress("progress");
+ os.setReason("reason");
+ os.setResult("result");
+ os.setServiceId("serviceId");
+ os.setServiceName("serviceName");
+ os.setUserId("userId");
+
+ assertEquals(os.getFinishedAt(), time);
+ assertEquals(os.getOperateAt(), time);
+ assertEquals(os.getOperation(), "operation");
+ assertEquals(os.getOperationContent(), "operationContent");
+ assertEquals(os.getOperationId(), "operationId");
+ assertEquals(os.getProgress(), "progress");
+ assertEquals(os.getReason(), "reason");
+ assertEquals(os.getResult(), "result");
+ assertEquals(os.getServiceId(), "serviceId");
+ assertEquals(os.getServiceName(), "serviceName");
+ assertEquals(os.getUserId(), "userId");
+
+ os.equals(obj);
+ os.hashCode();
+ }
+
+}
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
import java.sql.Timestamp;
public class OperationalEnvDistributionStatusTest {
- OperationalEnvDistributionStatus _operationalEnvDistributionStatus;
+ OperationalEnvDistributionStatus oeds=new OperationalEnvDistributionStatus();
+ Timestamp time=new Timestamp(10);
+ @Test
+ public void test(){
+ oeds.setCreateTime(time);
+ oeds.setDistributionId("distributionId");
+ oeds.setDistributionIdErrorReason("distributionIdErrorReason");
+ oeds.setDistributionIdStatus("distributionIdStatus");
+ oeds.setModifyTime(time);
+ oeds.setOperationalEnvId("operationalEnvId");
+ oeds.setRequestId("requestId");
+ oeds.setServiceModelVersionId("serviceModelVersionId");
+
+ assertEquals(oeds.getCreateTime(), time);
+ assertEquals(oeds.getDistributionId(), "distributionId");
+ assertEquals(oeds.getDistributionIdErrorReason(), "distributionIdErrorReason");
+ assertEquals(oeds.getDistributionIdStatus(), "distributionIdStatus");
+ assertEquals(oeds.getModifyTime(),time);
+ assertEquals(oeds.getOperationalEnvId(), "operationalEnvId");
+ assertEquals(oeds.getRequestId(), "requestId");
+ assertEquals(oeds.getServiceModelVersionId(), "serviceModelVersionId");
+ }
+}
- protected String _distributionId;
+ /*protected String _distributionId;
protected String _operationalEnvId;
protected String _serviceModelVersionId;
protected String _requestId;
_operationalEnvDistributionStatus = null;
}
- /**
+ *//**
* Test of getDistributionId method
- */
+ *//*
@Test
public void testGetDistributionId() {
_operationalEnvDistributionStatus.setDistributionId(_distributionId);
}
- /**
+ *//**
* Test setDistributionId method
- */
+ *//*
@Test
public void testSetDistributionId() {
_operationalEnvDistributionStatus.setDistributionId(_distributionId);
verify(_operationalEnvDistributionStatus).setDistributionId(_distributionId);
}
- /**
+ *//**
* Test of getOperationalEnvId method
- */
+ *//*
@Test
public void testGetOperationalEnvId() {
_operationalEnvDistributionStatus.setOperationalEnvId(_operationalEnvId);
}
- /**
+ *//**
* Test setOperationalEnvId method
- */
+ *//*
@Test
public void testSetOperationalEnvId() {
_operationalEnvDistributionStatus.setOperationalEnvId(_operationalEnvId);
verify(_operationalEnvDistributionStatus).setOperationalEnvId(_operationalEnvId);
}
- /**
+ *//**
* Test of getServiceModelVersionId method
- */
+ *//*
@Test
public void testGetServiceModelVersionId() {
_operationalEnvDistributionStatus.setServiceModelVersionId(_serviceModelVersionId);
}
- /**
+ *//**
* Test setServiceModelVersionId method
- */
+ *//*
@Test
public void testSetServiceModelVersionId() {
_operationalEnvDistributionStatus.setServiceModelVersionId(_serviceModelVersionId);
verify(_operationalEnvDistributionStatus).setServiceModelVersionId(_serviceModelVersionId);
}
- /**
+ *//**
* Test of getRequestId method
- */
+ *//*
@Test
public void testGetRequestId() {
_operationalEnvDistributionStatus.setRequestId(_requestId);
}
- /**
+ *//**
* Test setRequestId method
- */
+ *//*
@Test
public void testSetRequestId() {
_operationalEnvDistributionStatus.setRequestId(_requestId);
verify(_operationalEnvDistributionStatus).setRequestId(_requestId);
}
- /**
+ *//**
* Test of getDistributionIdStatus method
- */
+ *//*
@Test
public void testGetDistributionIdStatus() {
_operationalEnvDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
}
- /**
+ *//**
* Test setDistributionIdStatus method
- */
+ *//*
@Test
public void testSetDistributionIdStatus() {
_operationalEnvDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
verify(_operationalEnvDistributionStatus).setDistributionIdStatus(_distributionIdStatus);
}
- /**
+ *//**
* Test of getDistributionIdErrorReason method
- */
+ *//*
@Test
public void testGetDistributionIdErrorReason() {
_operationalEnvDistributionStatus.setDistributionIdErrorReason(_distributionIdErrorReason);
}
- /**
+ *//**
* Test setDistributionIdErrorReason method
- */
+ *//*
@Test
public void testSetDistributionIdErrorReason() {
_operationalEnvDistributionStatus.setDistributionIdErrorReason(_distributionIdErrorReason);
verify(_operationalEnvDistributionStatus).setDistributionIdErrorReason(_distributionIdErrorReason);
}
- /**
+ *//**
* Test of getCreateTime method
- */
+ *//*
@Test
public void testGetCreateTime() {
_operationalEnvDistributionStatus.setCreateTime(_createTime);
}
- /**
+ *//**
* Test setCreateTime method
- */
+ *//*
@Test
public void testSetCreateTime() {
_operationalEnvDistributionStatus.setCreateTime(_createTime);
verify(_operationalEnvDistributionStatus).setCreateTime(_createTime);
}
- /**
+ *//**
* Test of getModifyTime method
- */
+ *//*
@Test
public void testGetModifyTime() {
_operationalEnvDistributionStatus.setModifyTime(_modifyTime);
}
- /**
+ *//**
* Test setModifyTime method
- */
+ *//*
@Test
public void testSetModifyTime() {
_operationalEnvDistributionStatus.setModifyTime(_modifyTime);
}
+*/
\ No newline at end of file
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import java.sql.Timestamp;
-
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
public class OperationalEnvServiceModelStatusTest {
- OperationalEnvServiceModelStatus _operationalEnvServiceModelStatus;
+ OperationalEnvServiceModelStatus oesms=new OperationalEnvServiceModelStatus();
+ Timestamp time=new Timestamp(10);
+ @Test
+ public void test(){
+ oesms.setCreateTime(time);
+ oesms.setModifyTime(time);
+ oesms.setOperationalEnvId("operationalEnvId");
+ oesms.setRecoveryAction("recoveryAction");
+ oesms.setRequestId("requestId");
+ oesms.setRetryCount(0);
+ oesms.setServiceModelVersionDistrStatus("serviceModelVersionDistrStatus");
+ oesms.setServiceModelVersionId("serviceModelVersionId");
+ oesms.setWorkloadContext("workloadContext");
+
+ assertEquals(oesms.getCreateTime(), time);
+ assertEquals(oesms.getModifyTime(), time);
+ assertEquals(oesms.getOperationalEnvId(), "operationalEnvId");
+ assertEquals(oesms.getRecoveryAction(), "recoveryAction");
+ assertEquals(oesms.getRequestId(), "requestId");
+ assertEquals(oesms.getRetryCount(), 0);
+ assertEquals(oesms.getServiceModelVersionDistrStatus(), "serviceModelVersionDistrStatus");
+ assertEquals(oesms.getServiceModelVersionId(), "serviceModelVersionId");
+ assertEquals(oesms.getWorkloadContext(), "workloadContext");
+ }
+}
+ /*OperationalEnvServiceModelStatus _operationalEnvServiceModelStatus;
protected String _requestId;
protected String _operationalEnvId;
_operationalEnvServiceModelStatus = null;
}
- /**
+ *//**
* Test of getRequestId method
- */
+ *//*
@Test
public void testGetRequestId() {
_operationalEnvServiceModelStatus.setRequestId(_requestId);
}
- /**
+ *//**
* Test setRequestId method
- */
+ *//*
@Test
public void testSetRequestId() {
_operationalEnvServiceModelStatus.setRequestId(_requestId);
verify(_operationalEnvServiceModelStatus).setRequestId(_requestId);
}
- /**
+ *//**
* Test of getOperationalEnvId method
- */
+ *//*
@Test
public void testGetOperationalEnvId() {
_operationalEnvServiceModelStatus.setOperationalEnvId(_operationalEnvId);
}
- /**
+ *//**
* Test setOperationalEnvId method
- */
+ *//*
@Test
public void testSetOperationalEnvId() {
_operationalEnvServiceModelStatus.setOperationalEnvId(_operationalEnvId);
verify(_operationalEnvServiceModelStatus).setOperationalEnvId(_operationalEnvId);
}
- /**
+ *//**
* Test of getServiceModelVersionId method
- */
+ *//*
@Test
public void testGetServiceModelVersionId() {
_operationalEnvServiceModelStatus.setServiceModelVersionId(_serviceModelVersionId);
}
- /**
+ *//**
* Test setServiceModelVersionId method
- */
+ *//*
@Test
public void testSetServiceModelVersionId() {
_operationalEnvServiceModelStatus.setServiceModelVersionId(_serviceModelVersionId);
verify(_operationalEnvServiceModelStatus).setServiceModelVersionId(_serviceModelVersionId);
}
- /**
+ *//**
* Test of getServiceModelVersionId method
- */
+ *//*
@Test
public void testGetServiceModelVersionDistrStatus() {
_operationalEnvServiceModelStatus.setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus);
}
- /**
+ *//**
* Test setServiceModelVersionId method
- */
+ *//*
@Test
public void testSetServiceModelVersionDistrStatus() {
_operationalEnvServiceModelStatus.setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus);
verify(_operationalEnvServiceModelStatus).setServiceModelVersionDistrStatus(_serviceModelVersionDistrStatus);
}
- /**
+ *//**
* Test of getOperationalEnvId method
- */
+ *//*
@Test
public void testGetRecoveryAction() {
_operationalEnvServiceModelStatus.setRecoveryAction(_recoveryAction);
}
- /**
+ *//**
* Test setOperationalEnvId method
- */
+ *//*
@Test
public void testSetRecoveryAction() {
_operationalEnvServiceModelStatus.setRecoveryAction(_recoveryAction);
verify(_operationalEnvServiceModelStatus).setRecoveryAction(_recoveryAction);
}
- /**
+ *//**
* Test of getOperationalEnvId method
- */
+ *//*
@Test
public void testGetRetryCount() {
_operationalEnvServiceModelStatus.setRetryCount(_retryCount);
}
- /**
+ *//**
* Test setOperationalEnvId method
- */
+ *//*
@Test
public void testSetRetryCount() {
_operationalEnvServiceModelStatus.setRetryCount(_retryCount);
verify(_operationalEnvServiceModelStatus).setRetryCount(_retryCount);
}
- /**
+ *//**
* Test of getOperationalEnvId method
- */
+ *//*
@Test
public void testGetWorkloadContext() {
_operationalEnvServiceModelStatus.setWorkloadContext(_workloadContext);
}
- /**
+ *//**
* Test setOperationalEnvId method
- */
+ *//*
@Test
public void testSetWorkloadContext() {
_operationalEnvServiceModelStatus.setWorkloadContext(_workloadContext);
verify(_operationalEnvServiceModelStatus).setWorkloadContext(_workloadContext);
}
- /**
+ *//**
* Test of getCreateTime method
- */
+ *//*
@Test
public void testGetCreateTime() {
_operationalEnvServiceModelStatus.setCreateTime(_createTime);
}
- /**
+ *//**
* Test setCreateTime method
- */
+ *//*
@Test
public void testSetCreateTime() {
_operationalEnvServiceModelStatus.setCreateTime(_createTime);
verify(_operationalEnvServiceModelStatus).setCreateTime(_createTime);
}
- /**
+ *//**
* Test of getModifyTime method
- */
+ *//*
@Test
public void testGetModifyTime() {
_operationalEnvServiceModelStatus.setModifyTime(_modifyTime);
}
- /**
+ *//**
* Test setModifyTime method
- */
+ *//*
@Test
public void testSetModifyTime() {
_operationalEnvServiceModelStatus.setModifyTime(_modifyTime);
verify(_operationalEnvServiceModelStatus).setModifyTime(_modifyTime);
}
-
-}
+ */
+
--- /dev/null
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ResourceOperationStatusTest {
+
+ ResourceOperationStatus ros=new ResourceOperationStatus();
+ ResourceOperationStatus ros1=new ResourceOperationStatus("serviceId", "operationId", "resourceTemplateUUID");
+ Object obj=new Object();
+ @Test
+ public void test() {
+ ros.setErrorCode("errorCode");
+ ros.setJobId("jobId");
+ ros.setOperationId("operationId");
+ ros.setOperType("operType");
+ ros.setProgress("progress");
+ ros.setResourceInstanceID("resourceInstanceID");
+ ros.setResourceTemplateUUID("resourceTemplateUUId");
+ ros.setServiceId("serviceId");
+ ros.setStatus("101");
+ ros.setStatusDescription("statusDescription");
+
+ assertEquals(ros.getErrorCode(), "errorCode");
+ assertEquals(ros.getJobId(), "jobId");
+ assertEquals(ros.getOperationId(), "operationId");
+ assertEquals(ros.getOperType(), "operType");
+ assertEquals(ros.getProgress(), "progress");
+ assertEquals(ros.getResourceInstanceID(), "resourceInstanceID");
+ assertEquals(ros.getResourceTemplateUUID(), "resourceTemplateUUId");
+ assertEquals(ros.getServiceId(), "serviceId");
+ assertEquals(ros.getStatus(), "101");
+ assertEquals(ros.getStatusDescription(), "statusDescription");
+ ros.equals(obj);
+ ros.hashCode();
+ }
+
+}
--- /dev/null
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
+
+import static org.junit.Assert.*;
+import java.sql.Timestamp;
+import org.junit.Test;
+
+public class SiteStatusTest {
+
+ SiteStatus ss=new SiteStatus();
+ Timestamp time=new Timestamp(10);
+ @Test
+ public void test() {
+ ss.setCreated(time);
+ ss.setSiteName("siteName");
+ ss.setStatus(true);
+
+ assertEquals(ss.getCreated(), time);
+ assertEquals(ss.getSiteName(), "siteName");
+ assertEquals(ss.getStatus(), true);
+ }
+ @Test
+ public void testToString(){
+ assert(ss.toString()!=null);
+ }
+}
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import java.sql.Timestamp;
-
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
public class WatchdogComponentDistributionStatusTest {
+
+ WatchdogComponentDistributionStatus wcds=new WatchdogComponentDistributionStatus();
+ Timestamp time=new Timestamp(10);
+
+ @Test
+ public void test(){
+ wcds.setComponentDistributionStatus("componentDistributionStatus");
+ wcds.setComponentName("componentName");
+ wcds.setCreateTime(time);
+ wcds.setDistributionId("distributionId");
+ wcds.setModifyTime(time);
+
+ assertEquals(wcds.getComponentDistributionStatus(), "componentDistributionStatus");
+ assertEquals(wcds.getComponentName(), "componentName");
+ assertEquals(wcds.getCreateTime(), time);
+ assertEquals(wcds.getDistributionId(), "distributionId");
+ assertEquals(wcds.getModifyTime(), time);
+ }
+}
- WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus;
+ /*WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus;
protected String _distributionId;
protected String _componentName;
_watchdogComponentDistributionStatus = null;
}
- /**
+ *//**
* Test of getDistributionId method
- */
+ *//*
@Test
public void testGetDistributionId() {
_watchdogComponentDistributionStatus.setDistributionId(_distributionId);
}
- /**
+ *//**
* Test setDistributionId method
- */
+ *//*
@Test
public void testSetDistributionId() {
_watchdogComponentDistributionStatus.setDistributionId(_distributionId);
verify(_watchdogComponentDistributionStatus).setDistributionId(_distributionId);
}
- /**
+ *//**
* Test of getDistributionId method
- */
+ *//*
@Test
public void testGetComponentName() {
_watchdogComponentDistributionStatus.setComponentName(_componentName);
}
- /**
+ *//**
* Test setDistributionId method
- */
+ *//*
@Test
public void testSetComponentName() {
_watchdogComponentDistributionStatus.setComponentName(_componentName);
verify(_watchdogComponentDistributionStatus).setComponentName(_componentName);
}
- /**
+ *//**
* Test of getDistributionId method
- */
+ *//*
@Test
public void testGetComponentDistributionStatus() {
_watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
}
- /**
+ *//**
* Test setDistributionId method
- */
+ *//*
@Test
public void testSetComponentDistributionStatus() {
_watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
verify(_watchdogComponentDistributionStatus).setComponentDistributionStatus(_componentDistributionStatus);
}
- /**
+ *//**
* Test of getCreateTime method
- */
+ *//*
@Test
public void testGetCreateTime() {
_watchdogComponentDistributionStatus.setCreateTime(_createTime);
}
- /**
+ *//**
* Test setCreateTime method
- */
+ *//*
@Test
public void testSetCreateTime() {
_watchdogComponentDistributionStatus.setCreateTime(_createTime);
verify(_watchdogComponentDistributionStatus).setCreateTime(_createTime);
}
- /**
+ *//**
* Test of getModifyTime method
- */
+ *//*
@Test
public void testGetModifyTime() {
_watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
}
- /**
+ *//**
* Test setModifyTime method
- */
+ *//*
@Test
public void testSetModifyTime() {
_watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
}
}
+*/
\ No newline at end of file
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import java.sql.Timestamp;
-
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
public class WatchdogDistributionStatusTest {
+
+ WatchdogDistributionStatus wds=new WatchdogDistributionStatus();
+ Timestamp time=new Timestamp(10);
+ @Test
+ public void test() {
+ wds.setCreateTime(time);
+ wds.setDistributionId("distributionId");
+ wds.setDistributionIdStatus("distributionIdStatus");
+ wds.setModifyTime(time);
+
+ assertEquals(wds.getCreateTime(), time);
+ assertEquals(wds.getDistributionId(), "distributionId");
+ assertEquals(wds.getDistributionIdStatus(), "distributionIdStatus");
+ assertEquals(wds.getModifyTime(), time);
- WatchdogDistributionStatus _watchdogDistributionStatus;
+ }
+
+
+/* WatchdogDistributionStatus _watchdogDistributionStatus;
protected String _distributionId;
protected String _distributionIdStatus;
_watchdogDistributionStatus = null;
}
- /**
+ *//**
* Test of getDistributionId method
- */
+ *//*
@Test
public void testGetDistributionId() {
_watchdogDistributionStatus.setDistributionId(_distributionId);
}
- /**
+ *//**
* Test setDistributionId method
- */
+ *//*
@Test
public void testSetDistributionId() {
_watchdogDistributionStatus.setDistributionId(_distributionId);
verify(_watchdogDistributionStatus).setDistributionId(_distributionId);
}
- /**
+ *//**
* Test of getDistributionIdStatus method
- */
+ *//*
@Test
public void testGetComponentDistributionStatus() {
_watchdogDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
}
- /**
+ *//**
* Test setDistributionIdStatus method
- */
+ *//*
@Test
public void testSetComponentDistributionStatus() {
_watchdogDistributionStatus.setDistributionIdStatus(_distributionIdStatus);
verify(_watchdogDistributionStatus).setDistributionIdStatus(_distributionIdStatus);
}
- /**
+ *//**
* Test of getCreateTime method
- */
+ *//*
@Test
public void testGetCreateTime() {
_watchdogDistributionStatus.setCreateTime(_createTime);
}
- /**
+ *//**
* Test setCreateTime method
- */
+ *//*
@Test
public void testSetCreateTime() {
_watchdogDistributionStatus.setCreateTime(_createTime);
verify(_watchdogDistributionStatus).setCreateTime(_createTime);
}
- /**
+ *//**
* Test of getModifyTime method
- */
+ *//*
@Test
public void testGetModifyTime() {
_watchdogDistributionStatus.setModifyTime(_modifyTime);
}
- /**
+ *//**
* Test setModifyTime method
- */
+ *//*
@Test
public void testSetModifyTime() {
_watchdogDistributionStatus.setModifyTime(_modifyTime);
verify(_watchdogDistributionStatus).setModifyTime(_modifyTime);
- }
+ }*/
}
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.requestsdb;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
import java.sql.Timestamp;
-
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
public class WatchdogServiceModVerIdLookupTest {
-
- WatchdogServiceModVerIdLookup _watchdogServiceModVerIdLookup;
+
+ WatchdogServiceModVerIdLookup wsmil=new WatchdogServiceModVerIdLookup();
+ Timestamp time=new Timestamp(10);
+ @Test
+ public void test(){
+ wsmil.setCreateTime(time);
+ wsmil.setDistributionId("distributionId");
+ wsmil.setServiceModelVersionId("serviceModelVersionId");
+
+ assertEquals(wsmil.getCreateTime(),time);
+ assertEquals(wsmil.getDistributionId(), "distributionId");
+ assertEquals(wsmil.getServiceModelVersionId(), "serviceModelVersionId");
+ }
+}
+/*WatchdogServiceModVerIdLookup _watchdogServiceModVerIdLookup;
protected String _distributionId;
protected String _serviceModelVersionId;
_watchdogServiceModVerIdLookup = null;
}
- /**
+ *//**
* Test of getDistributionId method
- */
+ *//*
@Test
public void testGetDistributionId() {
_watchdogServiceModVerIdLookup.setDistributionId(_distributionId);
}
- /**
+ *//**
* Test setDistributionId method
- */
+ *//*
@Test
public void testSetDistributionId() {
_watchdogServiceModVerIdLookup.setDistributionId(_distributionId);
verify(_watchdogServiceModVerIdLookup).setDistributionId(_distributionId);
}
- /**
+ *//**
* Test of getServiceModelVersionId method
- */
+ *//*
@Test
public void testGetServiceModelVersionId() {
_watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId);
}
- /**
+ *//**
* Test setServiceModelVersionId method
- */
+ *//*
@Test
public void testSetServiceModelVersionId() {
_watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId);
verify(_watchdogServiceModVerIdLookup).setServiceModelVersionId(_serviceModelVersionId);
}
- /**
+ *//**
* Test of getCreateTime method
- */
+ *//*
@Test
public void testGetCreateTime() {
_watchdogServiceModVerIdLookup.setCreateTime(_createTime);
}
- /**
+ *//**
* Test setCreateTime method
- */
+ *//*
@Test
public void testSetCreateTime() {
_watchdogServiceModVerIdLookup.setCreateTime(_createTime);
verify(_watchdogServiceModVerIdLookup).setCreateTime(_createTime);
}
-}
\ No newline at end of file
+}*/
\ No newline at end of file
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-\r
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;\r
-\r
-public class AllottedResource extends MavenLikeVersioning implements Serializable {\r
- \r
- private static final long serialVersionUID = 768026109321305392L;\r
- \r
- private String modelUuid;\r
- private String modelInvariantUuid;\r
- private String modelVersion; \r
- private String modelName;\r
- private String toscaNodeType;\r
- private String subcategory;\r
- private String description;\r
- private Timestamp created;\r
-\r
- public AllottedResource() {\r
- }\r
- \r
- public String getModelUuid() {\r
- return this.modelUuid;\r
- }\r
- public void setModelUuid(String modelUuid) {\r
- this.modelUuid = modelUuid;\r
- }\r
- public String getModelInvariantUuid() {\r
- return this.modelInvariantUuid;\r
- }\r
- public void setModelInvariantUuid(String modelInvariantUuid) {\r
- this.modelInvariantUuid = modelInvariantUuid;\r
- }\r
- public String getModelVersion() {\r
- return this.modelVersion;\r
- }\r
- public void setModelVersion(String modelVersion) {\r
- this.modelVersion = modelVersion;\r
- }\r
- public String getModelName() {\r
- return this.modelName;\r
- }\r
- public void setModelName(String modelName) {\r
- this.modelName = modelName;\r
- }\r
- public String getToscaNodeType() {\r
- return this.toscaNodeType;\r
- }\r
- public void setToscaNodeType(String toscaNodeType) {\r
- this.toscaNodeType = toscaNodeType;\r
- } \r
- public String getSubcategory() {\r
- return this.subcategory;\r
- }\r
- public void setSubcategory(String subcategory) {\r
- this.subcategory = subcategory;\r
- } \r
- public String getDescription() {\r
- return this.description;\r
- }\r
- public void setDescription(String description) {\r
- this.description = description;\r
- }\r
- public Timestamp getCreated() {\r
- return created;\r
- }\r
- public void setCreated(Timestamp created) {\r
- this.created = created;\r
- } \r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+
+public class AllottedResource extends MavenLikeVersioning implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ private String modelUuid = null;
+ private String modelInvariantUuid = null;
+ private String modelVersion = null;
+ private String modelName = null;
+ private String toscaNodeType = null;
+ private String subcategory = null;
+ private String description = null;
+ private Timestamp created = null;
+
+ public AllottedResource() {
+ }
+
+ public String getModelUuid() {
+ return this.modelUuid;
+ }
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+ public String getModelInvariantUuid() {
+ return this.modelInvariantUuid;
+ }
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+ public String getModelVersion() {
+ return this.modelVersion;
+ }
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+ public String getModelName() {
+ return this.modelName;
+ }
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+ public String getToscaNodeType() {
+ return this.toscaNodeType;
+ }
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+ public String getSubcategory() {
+ return this.subcategory;
+ }
+ public void setSubcategory(String subcategory) {
+ this.subcategory = subcategory;
+ }
+ public String getDescription() {
+ return this.description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public Timestamp getCreated() {
+ return created;
+ }
+ public void setCreated(Timestamp created) {
+ this.created = created;
+ }
+
+}
private static final long serialVersionUID = 768026109321305392L;
- private String modelCustomizationUuid;
- private String arModelUuid;
- private Timestamp created;
- private String modelInstanceName;
- private String providingServiceModelInvariantUuid;
- private String targetNetworkRole;
- private String nfFunction;
- private String nfType;
- private String nfRole;
- private String nfNamingCode;
+ private String modelCustomizationUuid = null;
+ private String arModelUuid = null;
+ private Timestamp created = null;
+ private String modelInstanceName = null;
+ private String providingServiceModelInvariantUuid = null;
+ private String targetNetworkRole = null;
+ private String nfFunction = null;
+ private String nfType = null;
+ private String nfRole = null;
+ private String nfNamingCode = null;
private Integer minInstances;
private Integer maxInstances;
- private AllottedResource ar = null;
- private String providingServiceModelUuid;
- private String providingServiceModelName;
+ private AllottedResource allottedResource = null;
+ private String providingServiceModelUuid = null;
+ private String providingServiceModelName = null;
public AllottedResourceCustomization() {
super();
this.modelInstanceName = modelInstanceName;
}
public AllottedResource getAllottedResource() {
- return this.ar;
+ return this.allottedResource;
}
public void setAllottedResource(AllottedResource ar) {
- this.ar = ar;
+ this.allottedResource = ar;
}
public String getProvidingServiceModelInvariantUuid() {
return this.providingServiceModelInvariantUuid;
",modelInstanceName=" + this.modelInstanceName +
",modelInstanceName=" + this.modelInstanceName +
",created=" + this.created +
- ",ar=" + this.ar;
+ ",ar=" + this.allottedResource;
}
}
public class ArRecipe extends Recipe implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
- private String modelName;
+ private String modelName = null;
public ArRecipe() {}
public String getModelName() {
private static final long serialVersionUID = 768026109321305392L;
- private String artifactUuid;
+ private String artifactUuid = null;
private String name = null;
private String description = null;
private String environment = null;
- private String artifactChecksum;
+ private String artifactChecksum = null;
- private Timestamp created;
+ private Timestamp created = null;
public HeatEnvironment() {}
private static final long serialVersionUID = 768026109321305392L;
- private String artifactUuid;
+ private String artifactUuid = null;
private String description = null;
- private String fileName;
- private String fileBody;
- private Timestamp created;
- private String version;
- private String artifactChecksum;
+ private String fileName = null;
+ private String fileBody = null;
+ private Timestamp created = null;
+ private String version = null;
+ private String artifactChecksum = null;
public HeatFiles() {}
import java.io.Serializable;
+import com.openpojo.business.annotation.BusinessKey;
+
public class HeatNestedTemplate implements Serializable {
- private String parentTemplateId;
- private String childTemplateId;
- private String providerResourceFile;
+ @BusinessKey
+ private String parentTemplateId = null;
+ @BusinessKey
+ private String childTemplateId = null;
+ private String providerResourceFile = null;
public static final long serialVersionUID = -1322322139926390329L;
public HeatNestedTemplate () {
// hash code does not have to be a unique result - only that two objects that should be treated as equal
// return the same value. so this should work.
int result;
- result = this.parentTemplateId.hashCode() + this.childTemplateId.hashCode();
+ int parentTemplateIdHash = 0;
+ int childTemplateIdHash = 0;
+ if (this.parentTemplateId != null) {
+ parentTemplateIdHash = this.parentTemplateId.hashCode();
+ }
+ if (this.childTemplateId != null) {
+ childTemplateIdHash = this.childTemplateId.hashCode();
+ }
+ result = parentTemplateIdHash + childTemplateIdHash;
return result;
}
}
private static final long serialVersionUID = 768026109321305392L;
- private String artifactUuid;
- private String templateName;
+ private String artifactUuid = null;
+ private String templateName = null;
private String templateBody = null;
private int timeoutMinutes;
private Set <HeatTemplateParam> parameters;
private Set <HeatNestedTemplate> files;
- private String description;
- private String asdcUuid;
- private String artifactChecksum;
+ private String description = null;
+ private String asdcUuid = null;
+ private String artifactChecksum = null;
- private Timestamp created;
+ private Timestamp created = null;
public enum TemplateStatus {
PARENT, CHILD, PARENT_COMPLETE
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-\r
-// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring\r
-public class HeatTemplateArtifactUuidModelUuid implements Serializable {\r
- \r
- private String heatTemplateArtifactUuid;\r
- private String modelUuid;\r
- public static final long serialVersionUID = -1322322139926390329L;\r
-\r
- public HeatTemplateArtifactUuidModelUuid() {\r
- }\r
- \r
- public String getHeatTemplateArtifactUuid() {\r
- return this.heatTemplateArtifactUuid;\r
- }\r
- public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {\r
- this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;\r
- }\r
- public String getModelUuid() {\r
- return this.modelUuid;\r
- }\r
- public void setModelUuid(String modelUuid) {\r
- this.modelUuid = modelUuid;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid + " modelUuid=" + this.modelUuid;\r
- }\r
-\r
- @Override\r
- public boolean equals (Object o) {\r
- if (!(o instanceof HeatTemplateArtifactUuidModelUuid)) {\r
- return false;\r
- }\r
- if (this == o) {\r
- return true;\r
- }\r
- HeatTemplateArtifactUuidModelUuid htaumu = (HeatTemplateArtifactUuidModelUuid) o;\r
- if (htaumu.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) \r
- && htaumu.getModelUuid().equals(this.getModelUuid())) {\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- @Override\r
- public int hashCode () {\r
- // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
- // return the same value. so this should work.\r
- return this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode();\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+// an embeddable class to represent the Composite key for NetworkResource in the 1707 db refactoring
+public class HeatTemplateArtifactUuidModelUuid implements Serializable {
+
+ @BusinessKey
+ private String heatTemplateArtifactUuid = null;
+ @BusinessKey
+ private String modelUuid = null;
+ public static final long serialVersionUID = -1322322139926390329L;
+
+ public HeatTemplateArtifactUuidModelUuid() {
+ }
+
+ public String getHeatTemplateArtifactUuid() {
+ return this.heatTemplateArtifactUuid;
+ }
+ public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {
+ this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;
+ }
+ public String getModelUuid() {
+ return this.modelUuid;
+ }
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ @Override
+ public String toString() {
+ return "heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid + " modelUuid=" + this.modelUuid;
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ if (!(o instanceof HeatTemplateArtifactUuidModelUuid)) {
+ return false;
+ }
+ if (this == o) {
+ return true;
+ }
+ HeatTemplateArtifactUuidModelUuid htaumu = (HeatTemplateArtifactUuidModelUuid) o;
+ if (htaumu.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid())
+ && htaumu.getModelUuid().equals(this.getModelUuid())) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode () {
+ // hash code does not have to be a unique result - only that two objects that should be treated as equal
+ // return the same value. so this should work.
+ return this.heatTemplateArtifactUuid.hashCode() + this.modelUuid.hashCode();
+ }
+
+}
import java.io.Serializable;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+import com.openpojo.business.annotation.BusinessKey;
+
public class HeatTemplateParam implements Serializable {
- private String heatTemplateArtifactUuid;
- private String paramName;
+ @BusinessKey
+ private String heatTemplateArtifactUuid = null;
+ @BusinessKey
+ private String paramName = null;
private boolean required;
- private String paramType;
- private String paramAlias;
+ private String paramType = null;
+ private String paramAlias = null;
public static final long serialVersionUID = -1322322139926390329L;
public HeatTemplateParam() {}
public String toString () {
return "Param=" + paramName + ",type=" + paramType + ",required=" + required + ",paramAlias=" + paramAlias + ", heatTemplateArtifactUuid=" + this.heatTemplateArtifactUuid;
}
-
- @Override
- public boolean equals (Object o) {
- if (!(o instanceof HeatTemplateParam)) {
- return false;
- }
- if (this == o) {
- return true;
- }
- HeatTemplateParam htp = (HeatTemplateParam) o;
- if (htp.getHeatTemplateArtifactUuid().equals(this.heatTemplateArtifactUuid) && htp.getParamName().equalsIgnoreCase(this.paramName)) {
- return true;
- }
- return false;
- }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof HeatTemplateParam)) {
+ return false;
+ }
+ HeatTemplateParam castOther = (HeatTemplateParam) other;
+ return new EqualsBuilder().append(heatTemplateArtifactUuid, castOther.heatTemplateArtifactUuid)
+ .append(paramName, castOther.paramName).isEquals();
+ }
@Override
public int hashCode () {
private static final long serialVersionUID = 768026109321305392L;
private int id;
- private String modelCustomizationId;
- private String modelCustomizationName;
- private String modelInvariantId;
- private String modelName;
- private String modelType;
- private String modelVersion;
- private String modelVersionId;
- private Timestamp created;
+ private String modelCustomizationId = null;
+ private String modelCustomizationName = null;
+ private String modelInvariantId = null;
+ private String modelName = null;
+ private String modelType = null;
+ private String modelVersion = null;
+ private String modelVersionId = null;
+ private Timestamp created = null;
private Map<String,ServiceRecipe> recipes;
/**
private int id;
private Integer modelId;
- private String action;
- private String schemaVersion;
- private String description;
- private String orchestrationUri;
- private String modelParamXSD;
+ private String action = null;
+ private String schemaVersion = null;
+ private String description = null;
+ private String orchestrationUri = null;
+ private String modelParamXSD = null;
private Integer recipeTimeout;
- private Timestamp created;
+ private Timestamp created = null;
/**
* @return the id
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ModelRecipe: ");
- sb.append("modelId=").append(modelId.toString());
+ sb.append("modelId=").append(modelId);
sb.append(",action=").append(action);
sb.append(",schemaVersion=").append(schemaVersion);
sb.append(",orchestrationUri=").append(orchestrationUri);
sb.append(",modelParamXSD=").append(modelParamXSD);
- sb.append(",recipeTimeout=").append(recipeTimeout.toString());
+ sb.append(",recipeTimeout=").append(recipeTimeout);
if (created != null) {
sb.append (",created=");
sb.append (DateFormat.getInstance().format(created));
public class NetworkRecipe extends Recipe implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
- private String modelName;
+ private String modelName = null;
public NetworkRecipe() {}
public String getModelName() {
private String neutronNetworkType = null;
private String aicVersionMin = null;
private String aicVersionMax = null;
- private String modelName;
- private String modelInvariantUUID;
- private String modelVersion;
- private String toscaNodeType;
- private Timestamp created;
- private String modelUUID;
- private String category;
- private String subCategory;
- private String heatTemplateArtifactUUID;
+ private String modelName = null;
+ private String modelInvariantUUID = null;
+ private String modelVersion = null;
+ private String toscaNodeType = null;
+ private Timestamp created = null;
+ private String modelUUID = null;
+ private String category = null;
+ private String subCategory = null;
+ private String heatTemplateArtifactUUID = null;
public NetworkResource() {}
package org.openecomp.mso.db.catalog.beans;
import java.sql.Timestamp;
+
+import com.openpojo.business.annotation.BusinessKey;
+
import java.io.Serializable;
public class NetworkResourceCustomization implements Serializable{
// modelCustomizationUuid and networkResourceModelUuid form a composite primary key
+ @BusinessKey
private String modelCustomizationUuid = null;
+ @BusinessKey
private String networkResourceModelUuid = null;
public static final long serialVersionUID = -1322322139926390329L;
- private String modelInstanceName;
- private Timestamp created;
- private String networkTechnology;
+ private String modelInstanceName = null;
+ private Timestamp created = null;
+ private String networkTechnology = null;
private String networkType = null;
- private String networkScope;
- private String networkRole;
+ private String networkScope = null;
+ private String networkRole = null;
// These fields are not in the table directly - but I'm adding them here for storage in the objects we're dealing with
private NetworkResource networkResource = null;
private static final long serialVersionUID = 768026109321305392L;
private int id;
- protected String action;
- private String description;
- protected String orchestrationUri;
+ protected String action = null;
+ private String description = null;
+ protected String orchestrationUri = null;
private int recipeTimeout;
- private String serviceType;
- private String paramXSD;
- private Timestamp created;
+ private String serviceType = null;
+ private String paramXSD = null;
+ private Timestamp created = null;
public Recipe () {
super ();
package org.openecomp.mso.db.catalog.beans;
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
-
import java.io.Serializable;
import java.sql.Timestamp;
import java.text.DateFormat;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+
public class Service extends MavenLikeVersioning implements Serializable {
private static final long serialVersionUID = 768026109321305392L;
- private String modelName;
- private String description;
- private String modelUUID;
- private String modelInvariantUUID;
- private Timestamp created;
- private String toscaCsarArtifactUUID;
- private String modelVersion;
- private String category;
- private String serviceType;
- private String serviceRole;
- private String environmentContext;
- private String workloadContext;
- private Map<String,ServiceRecipe> recipes;
- private Set<ServiceToResourceCustomization> serviceResourceCustomizations;
+ private String modelName = null;
+ private String description = null;
+ private String modelUUID = null;
+ private String modelInvariantUUID = null;
+ private Timestamp created = null;
+ private String toscaCsarArtifactUUID = null;
+ private String modelVersion = null;
+ private String category = null;
+ private String serviceType = null;
+ private String serviceRole = null;
+ private String environmentContext = null;
+ private String workloadContext = null;
+ private Map<String,ServiceRecipe> recipes = new HashMap<>();
+ private Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>();
public Service() {}
*/
package org.openecomp.mso.db.catalog.beans;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VfModule;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.List;
/*
* A simple holder for Service and its associated elements:
private static final long serialVersionUID = 768026109321305392L;
private Service service;
- private ArrayList<VnfResource> vnfResources;
- private ArrayList<NetworkResourceCustomization> networkResourceCustomizations;
- private ArrayList<AllottedResourceCustomization> allottedResourceCustomizations;
- private ArrayList<VnfResourceCustomization> vnfResourceCustomizations;
+ private List<VnfResource> vnfResources;
+ private List<NetworkResourceCustomization> networkResourceCustomization;
+ private List<AllottedResourceCustomization> allottedResourceCustomization;
+ private List<VnfResourceCustomization> vnfResourceCustomizations;
public ServiceMacroHolder() {
super();
this.service = null;
this.vnfResources = new ArrayList<>();
- this.networkResourceCustomizations = new ArrayList<>();
- this.allottedResourceCustomizations = new ArrayList<>();
+ this.networkResourceCustomization = new ArrayList<>();
+ this.allottedResourceCustomization = new ArrayList<>();
this.vnfResourceCustomizations = new ArrayList<>();
}
public ServiceMacroHolder(Service service) {
this.service = service;
}
- public void setVnfResources(ArrayList<VnfResource> vnfResources) {
+ public void setVnfResources(List<VnfResource> vnfResources) {
this.vnfResources = vnfResources;
}
- public ArrayList<VnfResource> getVnfResources() {
+ public List<VnfResource> getVnfResources() {
return this.vnfResources;
}
public void addVnfResource(VnfResource vr) {
}
}
- public void setVnfResourceCustomizations(ArrayList<VnfResourceCustomization> vnfResourceCustomizations) {
+ public void setVnfResourceCustomizations(List<VnfResourceCustomization> vnfResourceCustomizations) {
this.vnfResourceCustomizations = vnfResourceCustomizations;
}
- public ArrayList<VnfResourceCustomization> getVnfResourceCustomizations() {
+ public List<VnfResourceCustomization> getVnfResourceCustomizations() {
return this.vnfResourceCustomizations;
}
public void addVnfResourceCustomizations(VnfResourceCustomization vrc) {
}
}
- public void setNetworkResourceCustomization(ArrayList<NetworkResourceCustomization> networkResourceCustomizations) {
- this.networkResourceCustomizations = networkResourceCustomizations;
+ public void setNetworkResourceCustomization(List<NetworkResourceCustomization> networkResourceCustomizations) {
+ this.networkResourceCustomization = networkResourceCustomizations;
}
- public ArrayList<NetworkResourceCustomization> getNetworkResourceCustomization() {
- return this.networkResourceCustomizations;
+ public List<NetworkResourceCustomization> getNetworkResourceCustomization() {
+ return this.networkResourceCustomization;
}
- public void addNetworkResourceCustomization(NetworkResourceCustomization nrc) {
- if (this.networkResourceCustomizations != null) {
- this.networkResourceCustomizations.add(nrc);
+ public void addNetworkResourceCustomizations(NetworkResourceCustomization nrc) {
+ if (this.networkResourceCustomization != null) {
+ this.networkResourceCustomization.add(nrc);
} else {
- this.networkResourceCustomizations = new ArrayList<>();
- this.networkResourceCustomizations.add(nrc);
+ this.networkResourceCustomization = new ArrayList<>();
+ this.networkResourceCustomization.add(nrc);
}
}
- public void setAllottedResourceCustomization(ArrayList<AllottedResourceCustomization> allottedResourceCustomizations) {
- this.allottedResourceCustomizations = allottedResourceCustomizations;
+ public void setAllottedResourceCustomization(List<AllottedResourceCustomization> allottedResourceCustomizations) {
+ this.allottedResourceCustomization = allottedResourceCustomizations;
}
- public ArrayList<AllottedResourceCustomization> getAllottedResourceCustomization() {
- return this.allottedResourceCustomizations;
+ public List<AllottedResourceCustomization> getAllottedResourceCustomization() {
+ return this.allottedResourceCustomization;
}
public void addAllottedResourceCustomization(AllottedResourceCustomization arc) {
- if (this.allottedResourceCustomizations != null) {
- this.allottedResourceCustomizations.add(arc);
+ if (this.allottedResourceCustomization != null) {
+ this.allottedResourceCustomization.add(arc);
} else {
- this.allottedResourceCustomizations = new ArrayList<>();
- this.allottedResourceCustomizations.add(arc);
+ this.allottedResourceCustomization = new ArrayList<>();
+ this.allottedResourceCustomization.add(arc);
}
}
} else {
sb.append("none");
}
- if (this.networkResourceCustomizations != null && this.networkResourceCustomizations.size() > 0) {
+ if (this.networkResourceCustomization != null && this.networkResourceCustomization.size() > 0) {
int i=0;
sb.append("NetworkResourceCustomizations:");
- for (NetworkResourceCustomization nrc : this.networkResourceCustomizations) {
+ for (NetworkResourceCustomization nrc : this.networkResourceCustomization) {
sb.append("NRC[").append(i++).append("]: ").append(nrc.toString());
}
}
- if (this.allottedResourceCustomizations != null && this.allottedResourceCustomizations.size() > 0) {
+ if (this.allottedResourceCustomization != null && this.allottedResourceCustomization.size() > 0) {
int i=0;
sb.append("AllottedResourceCustomizations:");
- for (AllottedResourceCustomization arc : this.allottedResourceCustomizations) {
+ for (AllottedResourceCustomization arc : this.allottedResourceCustomization) {
sb.append("ARC[").append(i++).append("]: ").append(arc.toString());
}
}
private static final long serialVersionUID = 768026109321305392L;
private int id;
- private String serviceModelUUID;
- private String action;
- private String description;
- private String orchestrationUri;
- private String serviceParamXSD;
+ private String serviceModelUUID = null;
+ private String action = null;
+ private String description = null;
+ private String orchestrationUri = null;
+ private String serviceParamXSD = null;
private int recipeTimeout;
private Integer serviceTimeoutInterim;
- private Timestamp created;
+ private Timestamp created = null;
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
import java.io.Serializable;
import java.sql.Timestamp;
+import com.openpojo.business.annotation.BusinessKey;
+
public class ServiceToAllottedResources implements Serializable {
- private String serviceModelUuid;
- private String arModelCustomizationUuid;
- private Timestamp created;
+ @BusinessKey
+ private String serviceModelUuid = null;
+ @BusinessKey
+ private String arModelCustomizationUuid = null;
+ private Timestamp created = null;
public static final long serialVersionUID = -1322322139926390329L;
import java.io.Serializable;
import java.sql.Timestamp;
+import com.openpojo.business.annotation.BusinessKey;
+
public class ServiceToNetworks implements Serializable {
// This maps to SERVICE.SERVICE_NAME_VERSION_ID / Service.serviceNameVersionId in SERVICE/Service table
- private String serviceModelUuid;
+ @BusinessKey
+ private String serviceModelUuid = null;
// This maps to NETWORK_RESOURCE_CUSTOMIZATION.MODEL_CUSTOMIZATION_UUID / NetworkResourceCustomization.ModelCustomizationUuid
- private String networkModelCustomizationUuid;
- private Timestamp created;
+ @BusinessKey
+ private String networkModelCustomizationUuid = null;
+ private Timestamp created = null;
public static final long serialVersionUID = -1322322139926390329L;
public ServiceToNetworks() {
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-import java.text.DateFormat;\r
-\r
-public class ServiceToResourceCustomization implements Serializable {\r
-\r
- private static final long serialVersionUID = 768026109321305392L;\r
- \r
- private String modelType;\r
- private String serviceModelUUID;\r
- private Timestamp created;\r
- private String resourceModelCustomizationUUID;\r
- \r
- public ServiceToResourceCustomization() {}\r
- \r
- public String getServiceModelUUID() {\r
- return serviceModelUUID;\r
- }\r
- \r
- public void setServiceModelUUID(String serviceModelUUID) {\r
- this.serviceModelUUID = serviceModelUUID;\r
- }\r
- \r
- public String getModelType() {\r
- return modelType;\r
- }\r
- \r
- public void setModelType(String modelType) {\r
- this.modelType = modelType;\r
- }\r
- \r
- public Timestamp getCreated() {\r
- return created;\r
- }\r
- \r
- public void setCreated(Timestamp created) {\r
- this.created = created;\r
- }\r
- \r
- public String getResourceModelCustomizationUUID() {\r
- return resourceModelCustomizationUUID;\r
- }\r
-\r
- public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {\r
- this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;\r
- }\r
- \r
- @Override\r
- public boolean equals(Object o) {\r
- if (!(o instanceof ServiceToResourceCustomization)) {\r
- return false;\r
- }\r
- if (this == o) {\r
- return true;\r
- }\r
- ServiceToResourceCustomization strc = (ServiceToResourceCustomization) o;\r
- if (strc.getServiceModelUUID().equals(this.getServiceModelUUID()) \r
- && strc.getResourceModelCustomizationUUID().equals(this.getResourceModelCustomizationUUID())\r
- && strc.getModelType().equals(this.getModelType())) {\r
- return true;\r
- }\r
- return false;\r
- \r
- }\r
- \r
- @Override \r
- public int hashCode() {\r
- \r
- int code = this.modelType == null ? 0 : this.modelType.hashCode();\r
- code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();\r
- code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();\r
- \r
- return code;\r
- \r
- }\r
-\r
- @Override\r
- public String toString() {\r
- StringBuilder sb = new StringBuilder();\r
- sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=")\r
- .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID);\r
- if (created != null) {\r
- sb.append (",created=");\r
- sb.append (DateFormat.getInstance().format(created));\r
- }\r
- return sb.toString();\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class ServiceToResourceCustomization implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @BusinessKey
+ private String modelType = null;
+ @BusinessKey
+ private String serviceModelUUID = null;
+ private Timestamp created = null;
+ @BusinessKey
+ private String resourceModelCustomizationUUID = null;
+
+ public ServiceToResourceCustomization() {}
+
+ public String getServiceModelUUID() {
+ return serviceModelUUID;
+ }
+
+ public void setServiceModelUUID(String serviceModelUUID) {
+ this.serviceModelUUID = serviceModelUUID;
+ }
+
+ public String getModelType() {
+ return modelType;
+ }
+
+ public void setModelType(String modelType) {
+ this.modelType = modelType;
+ }
+
+ public Timestamp getCreated() {
+ return created;
+ }
+
+ public void setCreated(Timestamp created) {
+ this.created = created;
+ }
+
+ public String getResourceModelCustomizationUUID() {
+ return resourceModelCustomizationUUID;
+ }
+
+ public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {
+ this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;
+ }
+
+
+ @Override
+ public boolean equals (final Object other) {
+ if (!(other instanceof ServiceToResourceCustomization)) {
+ return false;
+ }
+ ServiceToResourceCustomization castOther = (ServiceToResourceCustomization) other;
+ return new EqualsBuilder().append(modelType, castOther.modelType)
+ .append(serviceModelUUID, castOther.serviceModelUUID)
+ .append(resourceModelCustomizationUUID, castOther.resourceModelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+
+ int code = this.modelType == null ? 0 : this.modelType.hashCode();
+ code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();
+ code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();
+
+ return code;
+
+ }@Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=")
+ .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID);
+ if (created != null) {
+ sb.append (",created=");
+ sb.append (DateFormat.getInstance().format(created));
+ }
+ return sb.toString();
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-\r
-public class TempNetworkHeatTemplateLookup implements Serializable {\r
-\r
- private String networkResourceModelName;\r
- private String heatTemplateArtifactUuid;\r
- private String aicVersionMin;\r
- private String aicVersionMax;\r
- public static final long serialVersionUID = -1322322139926390329L;\r
-\r
- public TempNetworkHeatTemplateLookup() {\r
- super();\r
- }\r
-\r
- public String getNetworkResourceModelName() {\r
- return this.networkResourceModelName;\r
- }\r
- public void setNetworkResourceModelName(String networkResourceModelName) {\r
- this.networkResourceModelName = networkResourceModelName;\r
- }\r
-\r
- public String getHeatTemplateArtifactUuid() {\r
- return this.heatTemplateArtifactUuid;\r
- }\r
- public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {\r
- this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;\r
- }\r
- public String getAicVersionMin() {\r
- return this.aicVersionMin;\r
- }\r
-\r
- public void setAicVersionMin(String aicVersionMin) {\r
- this.aicVersionMin = aicVersionMin;\r
- }\r
-\r
- public String getAicVersionMax() {\r
- return this.aicVersionMax;\r
- }\r
-\r
- public void setAicVersionMax(String aicVersionMax) {\r
- this.aicVersionMax = aicVersionMax;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "NetworkResourceModelName=" + this.networkResourceModelName + "HeatTemplateArtifactUuid=" +\r
- this.heatTemplateArtifactUuid + "aicVersionMin=" + this.aicVersionMin + "aicVersionMax=" + this.aicVersionMax;\r
- }\r
-\r
- @Override\r
- public boolean equals (Object o) {\r
- if (!(o instanceof TempNetworkHeatTemplateLookup)) {\r
- return false;\r
- }\r
- if (this == o) {\r
- return true;\r
- }\r
- TempNetworkHeatTemplateLookup tnhtl = (TempNetworkHeatTemplateLookup) o;\r
- if (tnhtl.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) && tnhtl.getNetworkResourceModelName().equals(this.getNetworkResourceModelName())) {\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- @Override\r
- public int hashCode () {\r
- // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
- // return the same value. so this should work.\r
- int result;\r
- result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0);\r
- return result;\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class TempNetworkHeatTemplateLookup implements Serializable {
+
+ @BusinessKey
+ private String networkResourceModelName = null;
+ @BusinessKey
+ private String heatTemplateArtifactUuid = null;
+ private String aicVersionMin = null;
+ private String aicVersionMax = null;
+ public static final long serialVersionUID = -1322322139926390329L;
+
+ public TempNetworkHeatTemplateLookup() {
+ super();
+ }
+
+ public String getNetworkResourceModelName() {
+ return this.networkResourceModelName;
+ }
+ public void setNetworkResourceModelName(String networkResourceModelName) {
+ this.networkResourceModelName = networkResourceModelName;
+ }
+
+ public String getHeatTemplateArtifactUuid() {
+ return this.heatTemplateArtifactUuid;
+ }
+ public void setHeatTemplateArtifactUuid(String heatTemplateArtifactUuid) {
+ this.heatTemplateArtifactUuid = heatTemplateArtifactUuid;
+ }
+ public String getAicVersionMin() {
+ return this.aicVersionMin;
+ }
+
+ public void setAicVersionMin(String aicVersionMin) {
+ this.aicVersionMin = aicVersionMin;
+ }
+
+ public String getAicVersionMax() {
+ return this.aicVersionMax;
+ }
+
+ public void setAicVersionMax(String aicVersionMax) {
+ this.aicVersionMax = aicVersionMax;
+ }
+
+ @Override
+ public String toString() {
+ return "NetworkResourceModelName=" + this.networkResourceModelName + "HeatTemplateArtifactUuid=" +
+ this.heatTemplateArtifactUuid + "aicVersionMin=" + this.aicVersionMin + "aicVersionMax=" + this.aicVersionMax;
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ if (!(o instanceof TempNetworkHeatTemplateLookup)) {
+ return false;
+ }
+ if (this == o) {
+ return true;
+ }
+ TempNetworkHeatTemplateLookup tnhtl = (TempNetworkHeatTemplateLookup) o;
+ if (tnhtl.getHeatTemplateArtifactUuid().equals(this.getHeatTemplateArtifactUuid()) && tnhtl.getNetworkResourceModelName().equals(this.getNetworkResourceModelName())) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode () {
+ // hash code does not have to be a unique result - only that two objects that should be treated as equal
+ // return the same value. so this should work.
+ int result;
+ result = (this.networkResourceModelName != null ? this.networkResourceModelName.hashCode() : 0) + (this.heatTemplateArtifactUuid != null ? this.heatTemplateArtifactUuid.hashCode() : 0);
+ return result;
+ }
+
+}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-import java.text.DateFormat;\r
-import java.util.Set;\r
-\r
-import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;\r
-\r
-public class ToscaCsar extends MavenLikeVersioning implements Serializable {\r
- \r
- private static final long serialVersionUID = 768026109321305392L;\r
-\r
- private String artifactUUID;\r
- private String name;\r
- private String artifactChecksum;\r
- private String url;\r
- private String description;\r
- private Timestamp created;\r
- private Set<Service> services;\r
- \r
- public ToscaCsar() { }\r
- \r
- public String getArtifactUUID() {\r
- return artifactUUID;\r
- }\r
- \r
- public void setArtifactUUID(String artifactUUID) {\r
- this.artifactUUID = artifactUUID;\r
- }\r
- \r
- public String getName() {\r
- return name;\r
- }\r
- \r
- public void setName(String name) {\r
- this.name = name;\r
- }\r
- \r
- public String getArtifactChecksum() {\r
- return artifactChecksum;\r
- }\r
- \r
- public void setArtifactChecksum(String artifactChecksum) {\r
- this.artifactChecksum = artifactChecksum;\r
- }\r
- \r
- public String getUrl() {\r
- return url;\r
- }\r
- \r
- public void setUrl(String url) {\r
- this.url = url;\r
- }\r
- \r
- public String getDescription() {\r
- return description;\r
- }\r
- \r
- public void setDescription(String description) {\r
- this.description = description;\r
- }\r
- \r
- public Timestamp getCreated() {\r
- return created;\r
- }\r
- \r
- public void setCreated(Timestamp created) {\r
- this.created = created;\r
- }\r
- \r
- public Set<Service> getServices() {\r
- return services;\r
- }\r
- \r
- public void setServices(Set<Service> services) {\r
- this.services = services;\r
- }\r
- \r
- @Override\r
- public String toString() {\r
- StringBuilder sb = new StringBuilder();\r
- sb.append("TOSCACSAR: artifactUUID=").append(artifactUUID).append(",name=").append(name).append(",version=")\r
- .append(version).append(",description=").append(description).append(",artifactChecksum=")\r
- .append(artifactChecksum).append(",url=").append(url);\r
- for (Service service : services) {\r
- sb.append("\n").append(service.toString());\r
- }\r
- if (created != null) {\r
- sb.append (",created=");\r
- sb.append (DateFormat.getInstance().format(created));\r
- }\r
- return sb.toString();\r
- }\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
+
+public class ToscaCsar extends MavenLikeVersioning implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ private String artifactUUID = null;
+ private String name = null;
+ private String artifactChecksum = null;
+ private String url = null;
+ private String description = null;
+ private Timestamp created = null;
+ private Set<Service> services = new HashSet<>();
+
+ public ToscaCsar() { }
+
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Timestamp getCreated() {
+ return created;
+ }
+
+ public void setCreated(Timestamp created) {
+ this.created = created;
+ }
+
+ public Set<Service> getServices() {
+ return services;
+ }
+
+ public void setServices(Set<Service> services) {
+ this.services = services;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("TOSCACSAR: artifactUUID=").append(artifactUUID).append(",name=").append(name).append(",version=")
+ .append(version).append(",description=").append(description).append(",artifactChecksum=")
+ .append(artifactChecksum).append(",url=").append(url);
+ for (Service service : services) {
+ sb.append("\n").append(service.toString());
+ }
+ if (created != null) {
+ sb.append (",created=");
+ sb.append (DateFormat.getInstance().format(created));
+ }
+ return sb.toString();
+ }
+}
private static final long serialVersionUID = 768026109321305392L;
- private String modelInvariantUUID;
- private String modelName;
- private String modelVersion;
- private String description;
+ private String modelInvariantUUID = null;
+ private String modelName = null;
+ private String modelVersion = null;
+ private String description = null;
private int isBase;
- private String heatTemplateArtifactUUId;
- private String volHeatTemplateArtifactUUId;
- private Timestamp created;
- private String modelUUID;
- private String vnfResourceModelUUId;
+ private String heatTemplateArtifactUUId = null;
+ private String volHeatTemplateArtifactUUId = null;
+ private Timestamp created = null;
+ private String modelUUID = null;
+ private String vnfResourceModelUUId = null;
public VfModule() {
super();
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-\r
-public class VfModuleCustomization implements Serializable {\r
- \r
- private String modelCustomizationUuid;\r
- private String vfModuleModelUuid;\r
- private String label;\r
- private Integer minInstances;\r
- private Integer maxInstances;\r
- private Integer initialCount;\r
- private Integer availabilityZoneCount;\r
- private String heatEnvironmentArtifactUuid;\r
- private String volEnvironmentArtifactUuid;\r
- private Timestamp created;\r
- private VfModule vfModule;\r
- public static final long serialVersionUID = -1322322139926390329L;\r
-\r
- public VfModuleCustomization() {\r
- super();\r
- }\r
- \r
- public String getModelCustomizationUuid() {\r
- return this.modelCustomizationUuid;\r
- }\r
- public void setModelCustomizationUuid(String modelCustomizationUuid) {\r
- this.modelCustomizationUuid = modelCustomizationUuid;\r
- }\r
- public String getVfModuleModelUuid() {\r
- return this.vfModuleModelUuid;\r
- }\r
- public void setVfModuleModelUuid(String vfModuleModelUuid) {\r
- this.vfModuleModelUuid = vfModuleModelUuid;\r
- }\r
- public String getHeatEnvironmentArtifactUuid() {\r
- return this.heatEnvironmentArtifactUuid;\r
- }\r
- public void setHeatEnvironmentArtifactUuid(String heatEnvironmentArtifactUuid) {\r
- this.heatEnvironmentArtifactUuid = heatEnvironmentArtifactUuid;\r
- }\r
- public String getVolEnvironmentArtifactUuid() {\r
- return this.volEnvironmentArtifactUuid;\r
- }\r
- public void setVolEnvironmentArtifactUuid(String volEnvironmentArtifactUuid) {\r
- this.volEnvironmentArtifactUuid = volEnvironmentArtifactUuid;\r
- }\r
- \r
- public Integer getMinInstances() {\r
- return this.minInstances;\r
- }\r
- public void setMinInstances(Integer minInstances) {\r
- this.minInstances = minInstances;\r
- }\r
- public Integer getMaxInstances() {\r
- return this.maxInstances;\r
- }\r
- public void setMaxInstances(Integer maxInstances) {\r
- this.maxInstances = maxInstances;\r
- }\r
- public Integer getInitialCount() {\r
- return this.initialCount;\r
- }\r
- public void setInitialCount(Integer initialCount) {\r
- this.initialCount = initialCount;\r
- }\r
- public Integer getAvailabilityZoneCount() {\r
- return this.availabilityZoneCount;\r
- }\r
- public void setAvailabilityZoneCount(Integer availabilityZoneCount) {\r
- this.availabilityZoneCount = availabilityZoneCount;\r
- }\r
- public Timestamp getCreated() {\r
- return created;\r
- }\r
- public void setCreated(Timestamp created) {\r
- this.created = created;\r
- }\r
- public String getLabel() {\r
- return this.label;\r
- }\r
- public void setLabel(String label) {\r
- this.label = label;\r
- }\r
- public VfModule getVfModule() {\r
- return this.vfModule;\r
- }\r
- public void setVfModule(VfModule vfModule) {\r
- this.vfModule = vfModule;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "modelCustomizationUuid=" + this.modelCustomizationUuid +\r
- "vfModuleModelUuid=" + this.vfModuleModelUuid +\r
- "label=" + this.label +\r
- "initalCount=" + this.initialCount +\r
- "minInstances=" + this.minInstances +\r
- "maxInstances=" + this.maxInstances +\r
- "availabilityZoneCount=" + this.availabilityZoneCount +\r
- "heatEnvironmentArtifactUuid=" + this.heatEnvironmentArtifactUuid +\r
- "volEnvironmentArtifactUuid=" + this.volEnvironmentArtifactUuid +\r
- "created=" + this.created;\r
- }\r
-\r
- @Override\r
- public boolean equals (Object o) {\r
- if (!(o instanceof VfModuleCustomization)) {\r
- return false;\r
- }\r
- if (this == o) {\r
- return true;\r
- }\r
- VfModuleCustomization vfmc = (VfModuleCustomization) o;\r
- if (vfmc.getModelCustomizationUuid().equals(this.getModelCustomizationUuid()) && vfmc.getVfModuleModelUuid().equals(this.getVfModuleModelUuid())) {\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- @Override\r
- public int hashCode () {\r
- // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
- // return the same value. so this should work.\r
- int result = 0;\r
- result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.vfModuleModelUuid != null ? this.vfModuleModelUuid.hashCode() : 0);\r
- return result;\r
- }\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class VfModuleCustomization implements Serializable {
+
+ @BusinessKey
+ private String modelCustomizationUuid = null;
+ @BusinessKey
+ private String vfModuleModelUuid = null;
+ private String label = null;
+ private Integer minInstances;
+ private Integer maxInstances;
+ private Integer initialCount;
+ private Integer availabilityZoneCount;
+ private String heatEnvironmentArtifactUuid = null;
+ private String volEnvironmentArtifactUuid = null;
+ private Timestamp created = null;
+ private VfModule vfModule;
+ public static final long serialVersionUID = -1322322139926390329L;
+
+ public VfModuleCustomization() {
+ super();
+ }
+
+ public String getModelCustomizationUuid() {
+ return this.modelCustomizationUuid;
+ }
+ public void setModelCustomizationUuid(String modelCustomizationUuid) {
+ this.modelCustomizationUuid = modelCustomizationUuid;
+ }
+ public String getVfModuleModelUuid() {
+ return this.vfModuleModelUuid;
+ }
+ public void setVfModuleModelUuid(String vfModuleModelUuid) {
+ this.vfModuleModelUuid = vfModuleModelUuid;
+ }
+ public String getHeatEnvironmentArtifactUuid() {
+ return this.heatEnvironmentArtifactUuid;
+ }
+ public void setHeatEnvironmentArtifactUuid(String heatEnvironmentArtifactUuid) {
+ this.heatEnvironmentArtifactUuid = heatEnvironmentArtifactUuid;
+ }
+ public String getVolEnvironmentArtifactUuid() {
+ return this.volEnvironmentArtifactUuid;
+ }
+ public void setVolEnvironmentArtifactUuid(String volEnvironmentArtifactUuid) {
+ this.volEnvironmentArtifactUuid = volEnvironmentArtifactUuid;
+ }
+
+ public Integer getMinInstances() {
+ return this.minInstances;
+ }
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+ public Integer getMaxInstances() {
+ return this.maxInstances;
+ }
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+ public Integer getInitialCount() {
+ return this.initialCount;
+ }
+ public void setInitialCount(Integer initialCount) {
+ this.initialCount = initialCount;
+ }
+ public Integer getAvailabilityZoneCount() {
+ return this.availabilityZoneCount;
+ }
+ public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
+ this.availabilityZoneCount = availabilityZoneCount;
+ }
+ public Timestamp getCreated() {
+ return created;
+ }
+ public void setCreated(Timestamp created) {
+ this.created = created;
+ }
+ public String getLabel() {
+ return this.label;
+ }
+ public void setLabel(String label) {
+ this.label = label;
+ }
+ public VfModule getVfModule() {
+ return this.vfModule;
+ }
+ public void setVfModule(VfModule vfModule) {
+ this.vfModule = vfModule;
+ }
+
+ @Override
+ public String toString() {
+ return "modelCustomizationUuid=" + this.modelCustomizationUuid +
+ "vfModuleModelUuid=" + this.vfModuleModelUuid +
+ "label=" + this.label +
+ "initalCount=" + this.initialCount +
+ "minInstances=" + this.minInstances +
+ "maxInstances=" + this.maxInstances +
+ "availabilityZoneCount=" + this.availabilityZoneCount +
+ "heatEnvironmentArtifactUuid=" + this.heatEnvironmentArtifactUuid +
+ "volEnvironmentArtifactUuid=" + this.volEnvironmentArtifactUuid +
+ "created=" + this.created;
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ if (!(o instanceof VfModuleCustomization)) {
+ return false;
+ }
+ if (this == o) {
+ return true;
+ }
+ VfModuleCustomization vfmc = (VfModuleCustomization) o;
+ if (vfmc.getModelCustomizationUuid().equals(this.getModelCustomizationUuid()) && vfmc.getVfModuleModelUuid().equals(this.getVfModuleModelUuid())) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode () {
+ // hash code does not have to be a unique result - only that two objects that should be treated as equal
+ // return the same value. so this should work.
+ int result = 0;
+ result = (this.modelCustomizationUuid != null ? this.modelCustomizationUuid.hashCode() : 0) + (this.vfModuleModelUuid != null ? this.vfModuleModelUuid.hashCode() : 0);
+ return result;
+ }
+
+}
public class VfModuleToHeatFiles implements Serializable {
- private String vfModuleModelUuid;
- private String heatFilesArtifactUuid;
+ private String vfModuleModelUuid = null;
+ private String heatFilesArtifactUuid = null;
public static final long serialVersionUID = -1322322139926390329L;
public VfModuleToHeatFiles() {
import java.sql.Timestamp;
import java.text.DateFormat;
+import com.openpojo.business.annotation.BusinessKey;
+
import java.io.Serializable;
public class VnfComponent implements Serializable {
- private int vnfId;
+ @BusinessKey
+ private int vnfId;
+ @BusinessKey
private String componentType = null;
private Integer heatTemplateId;
private Integer heatEnvironmentId;
public static final long serialVersionUID = -1322322139926390329L;
- private Timestamp created;
+ private Timestamp created = null;
public VnfComponent() {}
private static final long serialVersionUID = 768026109321305392L;
- private String vnfType;
- private String vnfComponentType;
- private String vfModuleModelUUId;
+ private String vnfType = null;
+ private String vnfComponentType = null;
+ private String vfModuleModelUUId = null;
public VnfComponentsRecipe() {}
private static final long serialVersionUID = 768026109321305392L;
- private String vnfType;
- private String vfModuleId;
+ private String vnfType = null;
+ private String vfModuleId = null;
public VnfRecipe() {}
-/*-\r
- * ============LICENSE_START=======================================================\r
- * ONAP - SO\r
- * ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
- * ================================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- * ============LICENSE_END=========================================================\r
- */\r
-\r
-package org.openecomp.mso.db.catalog.beans;\r
-\r
-import java.io.Serializable;\r
-import java.sql.Timestamp;\r
-\r
-public class VnfResCustomToVfModuleCustom implements Serializable {\r
- \r
- private String vnfResourceCustModelCustomizationUuid;\r
- private String vfModuleCustModelCustomizationUuid;\r
- private Timestamp created;\r
- \r
- public static final long serialVersionUID = -1322322139926390329L;\r
-\r
-\r
- public VnfResCustomToVfModuleCustom() {\r
- super();\r
- }\r
- public String getVnfResourceCustModelCustomizationUuid() {\r
- return this.vnfResourceCustModelCustomizationUuid;\r
- }\r
- public void setVnfResourceCustModelCustomizationUuid(String vnfResourceCustModelCustomizationUuid) {\r
- this.vnfResourceCustModelCustomizationUuid = vnfResourceCustModelCustomizationUuid;\r
- }\r
- public String getVfModuleCustModelCustomizationUuid() {\r
- return this.vfModuleCustModelCustomizationUuid;\r
- }\r
- public void setVfModuleCustModelCustomizationUuid(String vfModuleCustModelCustomizationUuid) {\r
- this.vfModuleCustModelCustomizationUuid = vfModuleCustModelCustomizationUuid;\r
- }\r
- public Timestamp getCreated() {\r
- return created;\r
- }\r
- public void setCreated(Timestamp created) {\r
- this.created = created;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- return "vnfResourceCustModelCustomizationUuid=" + this.vnfResourceCustModelCustomizationUuid +\r
- "vfModuleCustModelCustomizationUuid=" + this.vfModuleCustModelCustomizationUuid + "created=" + this.created;\r
- }\r
-\r
- @Override\r
- public boolean equals (Object o) {\r
- if (!(o instanceof VnfResCustomToVfModuleCustom)) {\r
- return false;\r
- }\r
- if (this == o) {\r
- return true;\r
- }\r
- VnfResCustomToVfModuleCustom vrctvmc = (VnfResCustomToVfModuleCustom) o;\r
- if (vrctvmc.getVnfResourceCustModelCustomizationUuid().equals(this.getVnfResourceCustModelCustomizationUuid()) && vrctvmc.getVfModuleCustModelCustomizationUuid().equals(this.getVfModuleCustModelCustomizationUuid())) {\r
- return true;\r
- }\r
- return false;\r
- }\r
-\r
- @Override\r
- public int hashCode () {\r
- // hash code does not have to be a unique result - only that two objects that should be treated as equal\r
- // return the same value. so this should work.\r
- int result = 0;\r
- result = (this.vnfResourceCustModelCustomizationUuid != null ? this.vnfResourceCustModelCustomizationUuid.hashCode() : 0) + (this.vfModuleCustModelCustomizationUuid != null ? this.vfModuleCustModelCustomizationUuid.hashCode() : 0);\r
- return result;\r
- }\r
-\r
-\r
-}\r
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.db.catalog.beans;
+
+import java.io.Serializable;
+import java.sql.Timestamp;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+public class VnfResCustomToVfModuleCustom implements Serializable {
+
+ @BusinessKey
+ private String vnfResourceCustModelCustomizationUuid = null;
+ @BusinessKey
+ private String vfModuleCustModelCustomizationUuid = null;
+ private Timestamp created = null;
+
+ public static final long serialVersionUID = -1322322139926390329L;
+
+
+ public VnfResCustomToVfModuleCustom() {
+ super();
+ }
+ public String getVnfResourceCustModelCustomizationUuid() {
+ return this.vnfResourceCustModelCustomizationUuid;
+ }
+ public void setVnfResourceCustModelCustomizationUuid(String vnfResourceCustModelCustomizationUuid) {
+ this.vnfResourceCustModelCustomizationUuid = vnfResourceCustModelCustomizationUuid;
+ }
+ public String getVfModuleCustModelCustomizationUuid() {
+ return this.vfModuleCustModelCustomizationUuid;
+ }
+ public void setVfModuleCustModelCustomizationUuid(String vfModuleCustModelCustomizationUuid) {
+ this.vfModuleCustModelCustomizationUuid = vfModuleCustModelCustomizationUuid;
+ }
+ public Timestamp getCreated() {
+ return created;
+ }
+ public void setCreated(Timestamp created) {
+ this.created = created;
+ }
+
+ @Override
+ public String toString() {
+ return "vnfResourceCustModelCustomizationUuid=" + this.vnfResourceCustModelCustomizationUuid +
+ "vfModuleCustModelCustomizationUuid=" + this.vfModuleCustModelCustomizationUuid + "created=" + this.created;
+ }
+
+ @Override
+ public boolean equals (Object o) {
+ if (!(o instanceof VnfResCustomToVfModuleCustom)) {
+ return false;
+ }
+ if (this == o) {
+ return true;
+ }
+ VnfResCustomToVfModuleCustom vrctvmc = (VnfResCustomToVfModuleCustom) o;
+ if (vrctvmc.getVnfResourceCustModelCustomizationUuid().equals(this.getVnfResourceCustModelCustomizationUuid()) && vrctvmc.getVfModuleCustModelCustomizationUuid().equals(this.getVfModuleCustModelCustomizationUuid())) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode () {
+ // hash code does not have to be a unique result - only that two objects that should be treated as equal
+ // return the same value. so this should work.
+ int result = 0;
+ result = (this.vnfResourceCustModelCustomizationUuid != null ? this.vnfResourceCustModelCustomizationUuid.hashCode() : 0) + (this.vfModuleCustModelCustomizationUuid != null ? this.vfModuleCustModelCustomizationUuid.hashCode() : 0);
+ return result;
+ }
+
+
+}
private static final long serialVersionUID = 768026109321305392L;
- private String modelUuid;
- private String modelInvariantUuid;
- private String modelName;
- private String toscaNodeType;
- private String description;
- private String orchestrationMode;
- private String aicVersionMin;
- private String aicVersionMax;
- private String category;
- private String subCategory;
- private String heatTemplateArtifactUUId;
- private Timestamp created;
- private String modelVersion;
- private Set<VnfResourceCustomization> vnfResourceCustomizations;
- private Set<VfModule> vfModules;
- private List<VfModule> vfModuleList;
- private List<VfModuleCustomization> vfModuleCustomizations;
+ private String modelUuid = null;
+ private String modelInvariantUuid = null;
+ private String modelName = null;
+ private String toscaNodeType = null;
+ private String description = null;
+ private String orchestrationMode = null;
+ private String aicVersionMin = null;
+ private String aicVersionMax = null;
+ private String category = null;
+ private String subCategory = null;
+ private String heatTemplateArtifactUUId = null;
+ private Timestamp created = null;
+ private String modelVersion = null;
+ private Set<VnfResourceCustomization> vnfResourceCustomizations = new HashSet<>();
+ private Set<VfModule> vfModules = new HashSet<>();
+ private List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>();
public VnfResource () { }
public List<VfModuleCustomization> getVfModuleCustomizations() {
return this.vfModuleCustomizations == null ? new ArrayList<>() : this.vfModuleCustomizations;
}
- public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) {
+ public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
this.vfModuleCustomizations = vfModuleCustomizations;
}
public void addVfModuleCustomization(VfModuleCustomization vfmc) {
private static final long serialVersionUID = 768026109321305392L;
private String modelCustomizationUuid = null;
- private String modelInstanceName;
- private Timestamp created;
+ private String modelInstanceName = null;
+ private Timestamp created = null;
private String vnfResourceModelUuid = null;
- private String vnfResourceModelUUID;
+ private String vnfResourceModelUUID = null;
private Integer minInstances;
private Integer maxInstances;
private Integer availabilityZoneMaxCount;
private VnfResource vnfResource;
- private String nfFunction;
- private String nfType;
- private String nfRole;
- private String nfNamingCode;
- private String multiStageDesign;
+ private String nfFunction = null;
+ private String nfType = null;
+ private String nfRole = null;
+ private String nfNamingCode = null;
+ private String multiStageDesign = null;
private List<VfModuleCustomization> vfModuleCustomizations;
private Set<ServiceToResourceCustomization> serviceResourceCustomizations;
public List<VfModuleCustomization> getVfModuleCustomizations() {
return this.vfModuleCustomizations;
}
- public void setVfModuleCustomizations(ArrayList<VfModuleCustomization> vfModuleCustomizations) {
+ public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
this.vfModuleCustomizations = vfModuleCustomizations;
}
public void addVfModuleCustomization(VfModuleCustomization vfmc) {
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.db.catalog;
+
+import org.junit.Test;
+import org.mockito.Mock;
+import org.openecomp.mso.db.catalog.CatalogDbSessionFactoryManager;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.*;
+
+
+public class CatalogDbSessionFactoryManagerTest {
+ @Test
+ public void testgetHibernateConfigFile() {
+ CatalogDbSessionFactoryManager catalogDbSessionFactoryManager = new CatalogDbSessionFactoryManager();
+ System.setProperty("mso.db", "MYSQL");
+ assertNotNull(catalogDbSessionFactoryManager.getHibernateConfigFile());
+ }
+
+ @Test
+ public void testgetHibernateConfigFileNonMSODB() {
+ CatalogDbSessionFactoryManager catalogDbSessionFactoryManager = new CatalogDbSessionFactoryManager();
+ System.setProperty("mso.db", "test");
+ assertNull(catalogDbSessionFactoryManager.getHibernateConfigFile());
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.openecomp.mso.db.catalog.beans;
+
+import static org.hamcrest.CoreMatchers.isA;
+import static org.mockito.Matchers.eq;
+
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matcher;
+import org.junit.Test;
+import org.openecomp.mso.openpojo.rules.EqualsAndHashCodeTester;
+import org.openecomp.mso.openpojo.rules.HasToStringRule;
+import org.openecomp.mso.openpojo.rules.ToStringTester;
+
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterEnum;
+import com.openpojo.reflection.filters.FilterNonConcrete;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+
+public class BeansTest {
+
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ private PojoClassFilter enumFilter = new FilterEnum();
+
+
+
+ @Test
+ public void pojoStructure() {
+ test("org.openecomp.mso.db.catalog.beans");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create()
+ .with(new GetterMustExistRule())
+ .with(new SetterMustExistRule())
+ .with(new HasToStringRule())
+
+
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .with(new ToStringTester())
+ .with(new EqualsAndHashCodeTester().onlyDeclaredMethods())
+ .build();
+
+
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete());
+ }
+ private static class FilterTestClasses implements PojoClassFilter {
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
+}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.db.catalog.test;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.AllottedResource;
+import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.sql.Timestamp;
+
+public class AllottedResourceCustomizationTest {
+ @Test
+ public void test(){
+ AllottedResource allottedResource = new AllottedResource();
+ allottedResource.setModelUuid("ModelUuid");
+ allottedResource.setCreated(new Timestamp(System.currentTimeMillis()));
+ allottedResource.setModelVersion("ModelVersion");
+ allottedResource.setDescription("Description");
+ allottedResource.setModelInvariantUuid("ModelInvariantUuid");
+ allottedResource.setModelName("ModelName");
+ allottedResource.setSubcategory("Subcategory");
+ allottedResource.setToscaNodeType("ToscaNodeType");
+ allottedResource.setVersion("Version");
+
+ AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization();
+ allottedResourceCustomization.setCreated(new Timestamp(System.currentTimeMillis()));
+ allottedResourceCustomization.setAllottedResource(allottedResource);
+ allottedResourceCustomization.setVersion("Version");
+ allottedResourceCustomization.setArModelUuid("ArModelUuid");
+ allottedResourceCustomization.setMaxInstances(100);
+ allottedResourceCustomization.setMinInstances(1);
+ allottedResourceCustomization.setModelCustomizationUuid("ModelCustomizationUuid");
+ allottedResourceCustomization.setModelInstanceName("ModelInstanceName");
+ allottedResourceCustomization.setNfFunction("NfFunction");
+ allottedResourceCustomization.setNfNamingCode("NfNamingCode");
+ allottedResourceCustomization.setNfRole("NfRole");
+ allottedResourceCustomization.setNfType("NfType");
+ allottedResourceCustomization.setTargetNetworkRole("TargetNetworkRole");
+ allottedResourceCustomization.setProvidingServiceModelUuid("ProvidingServiceModelUuid");
+ allottedResourceCustomization.setProvidingServiceModelInvariantUuid("ProvidingServiceModelInvariantUuid");
+ allottedResourceCustomization.setProvidingServiceModelName("ProvidingServiceModelName");
+
+ assertNotNull(allottedResource.getModelUuid());
+ assertNotNull(allottedResource.getCreated());
+ assertNotNull(allottedResource.getModelVersion());
+ assertNotNull(allottedResource.getDescription());
+ assertNotNull(allottedResource.getModelInvariantUuid());
+ assertNotNull(allottedResource.getModelName());
+ assertNotNull(allottedResource.getSubcategory());
+ assertNotNull(allottedResource.getToscaNodeType());
+ assertNotNull(allottedResource.getVersion());
+
+ assertNotNull(allottedResourceCustomization.getAllottedResource());
+ assertNotNull(allottedResourceCustomization.getVersion());
+ assertNotNull(allottedResourceCustomization.getCreated());
+ assertNotNull(allottedResourceCustomization.getArModelUuid());
+ assertNotNull(allottedResourceCustomization.getMaxInstances());
+ assertNotNull(allottedResourceCustomization.getMinInstances());
+ assertNotNull(allottedResourceCustomization.getModelCustomizationUuid());
+ assertNotNull(allottedResourceCustomization.getModelInstanceName());
+ assertNotNull(allottedResourceCustomization.getNfFunction());
+ assertNotNull(allottedResourceCustomization.getNfNamingCode());
+ assertNotNull(allottedResourceCustomization.getNfRole());
+ assertNotNull(allottedResourceCustomization.getNfType());
+ assertNotNull(allottedResourceCustomization.getTargetNetworkRole());
+ assertNotNull(allottedResourceCustomization.getProvidingServiceModelUuid());
+ assertNotNull(allottedResourceCustomization.getProvidingServiceModelInvariantUuid());
+ assertNotNull(allottedResourceCustomization.getProvidingServiceModelName());
+ }
+}
* 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.
package org.openecomp.mso.db.catalog.test;
-import mockit.Mock;
-import mockit.MockUp;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.hibernate.HibernateException;
import org.hibernate.NonUniqueResultException;
import org.hibernate.Query;
import org.hibernate.Session;
+import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.AllottedResource;
-import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.HeatEnvironment;
-import org.openecomp.mso.db.catalog.beans.HeatFiles;
-import org.openecomp.mso.db.catalog.beans.HeatTemplate;
-import org.openecomp.mso.db.catalog.beans.HeatTemplateParam;
-import org.openecomp.mso.db.catalog.beans.NetworkResource;
-import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.Service;
-import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
-import org.openecomp.mso.db.catalog.beans.ServiceToResourceCustomization;
-import org.openecomp.mso.db.catalog.beans.TempNetworkHeatTemplateLookup;
-import org.openecomp.mso.db.catalog.beans.ToscaCsar;
-import org.openecomp.mso.db.catalog.beans.VfModule;
-import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
-import org.openecomp.mso.db.catalog.beans.VfModuleToHeatFiles;
-import org.openecomp.mso.db.catalog.beans.VnfComponent;
-import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
-import org.openecomp.mso.db.catalog.beans.VnfRecipe;
-import org.openecomp.mso.db.catalog.beans.VnfResource;
-import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization;
+import org.openecomp.mso.db.catalog.beans.*;
import org.openecomp.mso.db.catalog.utils.RecordNotFoundException;
-import java.io.Serializable;
-import java.util.*;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
+import mockit.Mock;
+import mockit.MockUp;
public class CatalogDatabaseTest {
CatalogDatabase cd = null;
-
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+ private MockUp<CatalogDatabase> mockCd = null;
+ private MockUp<Session> mockedSession = null;
+ private MockUp<Query> mockUpQuery = null;
+ private MockUp<Query> mockUpQuery2 = null;
+ private MockUp<Query> mockUpQuery3 = null;
+ private MockUp<Query> mockUpQuery4 = null;
@Before
public void setup(){
cd = CatalogDatabase.getInstance();
}
+
+
+ @After
+ public void tearDown() {
+ if (mockCd!=null) { mockCd.tearDown(); mockCd = null; }
+ if (mockedSession!=null) { mockedSession.tearDown(); mockedSession = null; }
+ if (mockUpQuery!=null) { mockUpQuery.tearDown(); mockUpQuery = null; }
+ }
+
@Test
public void getAllHeatTemplatesTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
HeatTemplate heatTemplate = new HeatTemplate();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
List <HeatTemplate> list = cd.getAllHeatTemplates();
assertEquals(list.size(), 1);
+
+
}
@Test
public void getHeatTemplateByIdTest(){
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Object get(Class cls, Serializable id) {
HeatTemplate heatTemplate = new HeatTemplate();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplate(10);
assertEquals("123-uuid", ht.getAsdcUuid());
+
+
}
@Test
public void getHeatTemplateByNameEmptyListTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
HeatTemplate heatTemplate = new HeatTemplate();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplate("heat123");
assertEquals(null, ht);
+
+
}
@Test
public void getHeatTemplateByNameTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
HeatTemplate heatTemplate1 = new HeatTemplate();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplate("heat123");
assertEquals("456-uuid", ht.getAsdcUuid());
+
+
}
@Test
public void getHeatTemplateByTemplateNameTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
HeatTemplate heatTemplate = new HeatTemplate();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
assertEquals("1234-uuid", ht.getAsdcUuid());
+
+
}
@Test
public void getHeatTemplateByTemplateNameEmptyResultTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplate("heat123","v2");
assertEquals(null, ht);
+
+
}
@Test
public void getHeatTemplateByArtifactUuidException(){
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Object get(Class cls, Serializable id) {
HeatTemplate heatTemplate = new HeatTemplate();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplateByArtifactUuid("123");
assertEquals("123-uuid", ht.getAsdcUuid());
+
+
}
@Test
public void getHeatTemplateByArtifactUuidTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
assertEquals("123-uuid", ht.getAsdcUuid());
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
+ @Ignore
public void getHeatTemplateByArtifactUuidHibernateErrorTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getHeatTemplateByArtifactUuidNonUniqueResultTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(NonUniqueResultException.class);
HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatTemplateByArtifactUuidGenericExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(Exception.class);
HeatTemplate ht = cd.getHeatTemplateByArtifactUuidRegularQuery("123-uuid");
+
+
}
@Test
public void getParametersForHeatTemplateTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
HeatTemplate heatTemplate = new HeatTemplate();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3");
assertEquals(1, htList.size());
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getParametersForHeatTemplateHibernateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() {
throw new HibernateException("hibernate exception");
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3");
+
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getParametersForHeatTemplateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<HeatTemplate> list() throws Exception {
throw new Exception();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(Exception.class);
List<HeatTemplateParam> htList = cd.getParametersForHeatTemplate("12l3");
+
+
}
@Test
public void getHeatEnvironmentByArtifactUuidTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123");
assertEquals("123-uuid", he.getArtifactUuid());
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getHeatEnvironmentByArtifactUuidHibernateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatEnvironmentByArtifactUuidExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(Exception.class);
HeatEnvironment he = cd.getHeatEnvironmentByArtifactUuid("123");
+
+
}
@Test
public void getServiceByInvariantUUIDTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<Service> list() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
Service service = cd.getServiceByInvariantUUID("123");
assertEquals("123-uuid", service.getModelUUID());
+
+
}
@Test
public void getServiceByInvariantUUIDEmptyResultTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<Service> list() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
Service service = cd.getServiceByInvariantUUID("123");
assertEquals(null, service);
+
+
}
@Test
public void getServiceTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
Service service = cd.getService("123");
assertEquals("123-uuid", service.getModelUUID());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getServiceNoUniqueResultTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(NonUniqueResultException.class);
Service service = cd.getService("123");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getServiceHibernateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
Service service = cd.getService("123");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getServiceExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(Exception.class);
Service service = cd.getService("123");
+
+
}
@Test
public void getServiceByModelUUIDTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
Service service = cd.getServiceByModelUUID("123");
assertEquals("123-uuid", service.getModelUUID());
+
+
}
@Test
public void getService2Test(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
Service service = cd.getService(map, "123");
assertEquals("123-uuid", service.getModelUUID());
+
+ map.remove("serviceNameVersionId");
+ service = cd.getService(map, "123");
+ assertNotNull(service);
}
@Test
public void getServiceByModelNameTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<Service> list() throws Exception {
Service service = new Service();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
Service service = cd.getServiceByModelName("123");
assertEquals("123-uuid", service.getModelUUID());
+
+
}
@Test
public void getServiceByModelNameEmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<Service> list() throws Exception {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
Service service = cd.getServiceByModelName("123");
assertEquals(null, service);
+
+
}
@Test
public void getServiceByVersionAndInvariantIdTest() throws Exception{
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
Service service = cd.getServiceByVersionAndInvariantId("123","tetwe");
assertEquals("123-uuid", service.getModelUUID());
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getServiceByVersionAndInvariantIdNonUniqueResultTest() throws Exception{
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(Exception.class);
Service service = cd.getServiceByVersionAndInvariantId("123","tetwe");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getServiceRecipeTestException() throws Exception{
+ thrown.expect(Exception.class);
ServiceRecipe ht = cd.getServiceRecipe("123","tetwe");
}
@Test
public void getServiceRecipeByServiceModelUuidTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<ServiceRecipe> list() throws Exception {
ServiceRecipe serviceRecipe = new ServiceRecipe();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
assertEquals(1, serviceRecipe.getId());
+
+
}
@Test
public void getServiceRecipeByServiceModelUuidEmptyTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<ServiceRecipe> list() throws Exception {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
ServiceRecipe serviceRecipe = cd.getServiceRecipeByServiceModelUuid("123","tetwe");
assertEquals(null, serviceRecipe);
+
+
}
@Test
public void getServiceRecipesTestException() throws Exception{
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<ServiceRecipe> list() {
ServiceRecipe serviceRecipe = new ServiceRecipe();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123");
assertEquals(1, serviceRecipes.size());
+
+
}
@Test
public void getServiceRecipesEmptyTest() throws Exception{
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<ServiceRecipe> list() {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
List<ServiceRecipe> serviceRecipes = cd.getServiceRecipes("123");
assertEquals(0, serviceRecipes.size());
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfComponentTestException() throws Exception{
+ thrown.expect(Exception.class);
VnfComponent ht = cd.getVnfComponent(123,"vnf");
}
@Test
public void getVnfResourceTest() throws Exception{
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResource> list() {
VnfResource vnfResource = new VnfResource();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResource vnfResource = cd.getVnfResource("vnf");
assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
}
@Test
public void getVnfResourceEmptyTest() throws Exception{
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResource> list() {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResource vnfResource = cd.getVnfResource("vnf");
assertEquals(null, vnfResource);
+
+
}
@Test
public void getVnfResourceByTypeTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResource vnfResource = cd.getVnfResource("vnf","3992");
assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getVnfResourceNURExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(NonUniqueResultException.class);
VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getVnfResourceHibernateExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(HibernateException.class);
VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfResourceExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(Exception.class);
VnfResource vnfResource = cd.getVnfResource("vnf","3992");
+
+
}
@Test
public void getVnfResourceByModelCustomizationIdTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
assertEquals("123-uuid",vnfResource.getModelUuid());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getVnfResourceByModelCustomizationIdNURExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(NonUniqueResultException.class);
VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getVnfResourceByModelCustomizationIdHibernateExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
VnfResource vnfResource = cd.getVnfResourceByModelCustomizationId("3992");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getServiceRecipeTest2Exception() throws Exception{
+ thrown.expect(Exception.class);
ServiceRecipe ht = cd.getServiceRecipe(1001,"3992");
}
@Test
public void getVnfResourceCustomizationByModelCustomizationNameTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResourceCustomization> list() throws Exception {
VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
assertEquals("123-uuid", vnf.getVnfResourceModelUUID());
+
+
}
@Test
public void getVnfResourceCustomizationByModelCustomizationNameEmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfResourceCustomization> list() throws Exception {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationName("test", "test234");
assertEquals(null, vnf);
+
+
}
@Test
public void getVnfResourceByModelInvariantIdTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult(){
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
assertEquals("123-uuid", vnf.getModelUuid());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getVnfResourceByModelInvariantIdNURExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult(){
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(NonUniqueResultException.class);
VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getVnfResourceByModelInvariantIdHibernateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult(){
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(HibernateException.class);
VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfResourceByModelInvariantIdExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(Exception.class);
VnfResource vnf = cd.getVnfResourceByModelInvariantId("test", "test234");
+
+
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVnfResourceByIdTestException(){
+ thrown.expect(Exception.class);
VnfResource vnf = cd.getVnfResourceById(19299);
}
@Test
public void getVfModuleModelName(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModule> list() throws Exception {
VfModule vfModule = new VfModule();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VfModule vfModule = cd.getVfModuleModelName("vfmodule");
assertEquals("123-uuid", vfModule.getModelUUID());
+
+
}
@Test
public void getVfModuleModelNameExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModule> list() throws Exception {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VfModule vfModule = cd.getVfModuleModelName("vfmodule");
assertEquals(null, vfModule);
+
+
}
@Test
public void getVfModuleModelNameTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
assertEquals("123-uuid", vfModule.getModelUUID());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getVfModuleModelNameNURExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(NonUniqueResultException.class);
VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getVfModuleModelNameHibernateExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleModelNameGenericExceptionTest() {
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(Exception.class);
VfModule vfModule = cd.getVfModuleModelName("tetes","4kidsl");
+
+
}
@Test
public void ggetVfModuleCustomizationByModelNameTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModuleCustomization> list() throws Exception {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes");
assertEquals("123-uuid", vfModuleCustomization.getVfModuleModelUuid());
+
+
}
@Test
public void ggetVfModuleCustomizationByModelNameEmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModuleCustomization> list() throws Exception {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VfModuleCustomization vfModuleCustomization = cd.getVfModuleCustomizationByModelName("tetes");
assertEquals(null, vfModuleCustomization);
+
+
}
@Test
public void getNetworkResourceTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<NetworkResource> list() throws Exception {
NetworkResource networkResource = new NetworkResource();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
NetworkResource networkResource = cd.getNetworkResource("tetes");
assertEquals("123-uuid", networkResource.getModelUUID());
+
+
}
@Test
public void getNetworkResourceTestEmptyException(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<NetworkResource> list() throws Exception {
return Arrays.asList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
NetworkResource networkResource = cd.getNetworkResource("tetes");
assertEquals(null, networkResource);
+
+
}
@Test
public void getVnfRecipeTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
VnfRecipe vnfRecipe = new VnfRecipe();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493");
assertEquals("123-id", vnfRecipe.getVfModuleId());
+
+
}
@Test
public void getVnfRecipeEmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
return Collections.emptyList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","ergfedrf","4993493");
assertEquals(null, vnfRecipe);
+
+
}
@Test
public void getVnfRecipe2Test(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
VnfRecipe vnfRecipe = new VnfRecipe();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493");
assertEquals(1, vnfRecipe.getId());
+
+
}
@Test
public void getVnfRecipe2EmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
return Collections.emptyList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfRecipe vnfRecipe = cd.getVnfRecipe("tetes","4993493");
assertEquals(null, vnfRecipe);
+
+
}
@Test
public void getVnfRecipeByVfModuleIdTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
VnfRecipe vnfRecipe = new VnfRecipe();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
assertEquals(1, vnfRecipe.getId());
+
+
}
@Test
public void getVnfRecipeByVfModuleIdEmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VnfRecipe> list() throws Exception {
return Collections.emptyList();
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VnfRecipe vnfRecipe = cd.getVnfRecipeByVfModuleId("tetes","4993493","vnf");
assertEquals(null, vnfRecipe);
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleTypeTestException(){
+ thrown.expect(Exception.class);
VfModule vnf = cd.getVfModuleType("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleType2TestException(){
+ thrown.expect(Exception.class);
VfModule vnf = cd.getVfModuleType("4993493","vnf");
}
@Test
public void getVnfResourceByServiceUuidTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
};
VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getVnfResourceByServiceUuidNURExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(NonUniqueResultException.class);
VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getVnfResourceByServiceUuidHibernateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(HibernateException.class);
VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfResourceByServiceUuidExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
+ thrown.expect(Exception.class);
VnfResource vnfResource = cd.getVnfResourceByServiceUuid("4993493");
+
+
}
@Test
public void getVnfResourceByVnfUuidTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
assertEquals("123-uuid", vnfResource.getModelUuid());
+
+
}
- @Test(expected = NonUniqueResultException.class)
+ @Test
public void getVnfResourceByVnfUuidNURExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(NonUniqueResultException.class);
VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
+
+
}
- @Test(expected = HibernateException.class)
+ @Test
public void getVnfResourceByVnfUuidHibernateExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(HibernateException.class);
VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfResourceByVnfUuidExceptionTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public Object uniqueResult() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
}
};
-
+ thrown.expect(Exception.class);
VnfResource vnfResource = cd.getVnfResourceByVnfUuid("4993493");
+
+
}
@Test
public void getVfModuleByModelInvariantUuidTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModule> list() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493");
assertEquals("123-uuid", vfModule.getModelUUID());
+
+
}
@Test
public void getVfModuleByModelInvariantUuidEmptyTest(){
- MockUp<Query> mockUpQuery = new MockUp<Query>() {
+ mockUpQuery = new MockUp<Query>() {
@Mock
public List<VfModule> list() throws Exception {
}
};
- MockUp<Session> mockedSession = new MockUp<Session>() {
+ mockedSession = new MockUp<Session>() {
@Mock
public Query createQuery(String hql) {
return mockUpQuery.getMockInstance();
}
};
- new MockUp<CatalogDatabase>() {
+ mockCd = new MockUp<CatalogDatabase>() {
@Mock
private Session getSession() {
return mockedSession.getMockInstance();
VfModule vfModule = cd.getVfModuleByModelInvariantUuid("4993493");
assertEquals(null, vfModule);
+
+
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleByModelCustomizationUuidTestException(){
+ thrown.expect(Exception.class);
VfModuleCustomization vnf = cd.getVfModuleByModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleByModelInvariantUuidAndModelVersionTestException(){
+ thrown.expect(Exception.class);
VfModule vnf = cd.getVfModuleByModelInvariantUuidAndModelVersion("4993493","vnf");
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleCustomizationByModelCustomizationIdTestException(){
+ thrown.expect(Exception.class);
VfModuleCustomization vnf = cd.getVfModuleCustomizationByModelCustomizationId("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleByModelUuidTestException(){
+ thrown.expect(Exception.class);
VfModule vnf = cd.getVfModuleByModelUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVnfResourceCustomizationByModelCustomizationUuidTestException(){
+ thrown.expect(Exception.class);
VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfResourceCustomizationByModelVersionIdTestException(){
+ thrown.expect(Exception.class);
VnfResourceCustomization vnf = cd.getVnfResourceCustomizationByModelVersionId("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleByModelCustomizationIdAndVersionTestException(){
+ thrown.expect(Exception.class);
cd.getVfModuleByModelCustomizationIdAndVersion("4993493","test");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantIdTestException(){
+ thrown.expect(Exception.class);
cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("4993493","vnf","test");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVnfResourceCustomizationByModelInvariantIdTest(){
+ thrown.expect(Exception.class);
cd.getVnfResourceCustomizationByModelInvariantId("4993493","vnf","test");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleCustomizationByVnfModuleCustomizationUuidTest(){
- cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VfModule> list() throws Exception {
+ return Collections.emptyList();
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertEquals(cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("4993493").size(), 0);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionIdTest(){
- cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493","test");
- }
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getAllVfModuleCustomizationstest(){
- cd.getAllVfModuleCustomizations("4993493");
- }
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getVnfResourceByModelUuidTest(){
- cd.getVnfResourceByModelUuid("4993493");
- }
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getVnfResCustomToVfModuleTest(){
- cd.getVnfResCustomToVfModule("4993493","test");
- }
- @Test(expected = Exception.class)
- public void getVfModulesForVnfResourceTest(){
- VnfResource vnfResource = new VnfResource();
+
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResourceCustomization> list() {
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("SELECT vrc FROM VnfResourceCustomization as vrc WHERE vrc.vnfResourceModelUuid IN (SELECT vr.modelUuid FROM VnfResource vr WHERE vr.modelUuid = :modelVersionId)AND vrc.modelInstanceName = :modelCustomizationName"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("modelCustomizationName","modelVersionId"));
+
+ VnfResourceCustomization result = cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493", "test");
+ assertNotNull(result);
+ }
+
+ @Test
+ public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId_NullReturnTest(){
+
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResourceCustomization> list() {
+ return Arrays.asList();
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("SELECT vrc FROM VnfResourceCustomization as vrc WHERE vrc.vnfResourceModelUuid IN (SELECT vr.modelUuid FROM VnfResource vr WHERE vr.modelUuid = :modelVersionId)AND vrc.modelInstanceName = :modelCustomizationName"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ VnfResourceCustomization result = cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("4993493", "test");
+ assertNull(result);
+ }
+ @Test
+ public void getAllVfModuleCustomizationstest(){
+ thrown.expect(Exception.class);
+ cd.getAllVfModuleCustomizations("4993493");
+ }
+ @Test
+ public void getVnfResourceByModelUuidTest(){
+ thrown.expect(Exception.class);
+ cd.getVnfResourceByModelUuid("4993493");
+ }
+ @Test
+ public void getVnfResCustomToVfModuleTest(){
+ thrown.expect(Exception.class);
+ cd.getVnfResCustomToVfModule("4993493","test");
+ }
+ @Test
+ public void getVfModulesForVnfResourceTest(){
+ VnfResource vnfResource = new VnfResource();
vnfResource.setModelUuid("48839");
+ thrown.expect(Exception.class);
cd.getVfModulesForVnfResource(vnfResource);
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModulesForVnfResource2Test(){
+ thrown.expect(Exception.class);
cd.getVfModulesForVnfResource("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getServiceByUuidTest(){
+ thrown.expect(Exception.class);
cd.getServiceByUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getNetworkResourceById2Test(){
+ thrown.expect(Exception.class);
cd.getNetworkResourceById(4993493);
}
- @Test(expected = Exception.class)
+ @Test
public void getNetworkResourceByIdTest(){
+ thrown.expect(Exception.class);
cd.getVfModuleTypeByUuid("4993493");
}
@Test
boolean is = cd.isEmptyOrNull("4993493");
assertFalse(is);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getSTRTest(){
- cd.getSTR("4993493","test","vnf");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<ServiceToResourceCustomization> list() {
+ ServiceToResourceCustomization vnfResourceCustomization = new ServiceToResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ List<ServiceToResourceCustomization> str = cd.getSTR("4993493", "test", "vnf");
+ assertFalse(str.isEmpty());
+
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVRCtoVFMCTest(){
- cd.getVRCtoVFMC("4993493","388492");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResCustomToVfModuleCustom> list() {
+ VnfResCustomToVfModuleCustom vnfResourceCustomization = new VnfResCustomToVfModuleCustom();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM VnfResCustomToVfModuleCustom WHERE vnfResourceCustModelCustomizationUuid = :vrc_mcu AND vfModuleCustModelCustomizationUuid = :vfmc_mcu"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ List<VnfResCustomToVfModuleCustom> vrCtoVFMC = cd.getVRCtoVFMC("4993493", "388492");
+ assertFalse(vrCtoVFMC.isEmpty());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleTypeByUuidTestException(){
+ thrown.expect(Exception.class);
cd.getVfModuleTypeByUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getTempNetworkHeatTemplateLookupTest(){
- cd.getTempNetworkHeatTemplateLookup("4993493");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<TempNetworkHeatTemplateLookup> list() {
+ TempNetworkHeatTemplateLookup vnfResourceCustomization = new TempNetworkHeatTemplateLookup();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<TempNetworkHeatTemplateLookup> tempNetworkHeatTemplateLookup = cd.getTempNetworkHeatTemplateLookup("4993493");
+ assertFalse(tempNetworkHeatTemplateLookup.isEmpty());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllNetworksByServiceModelUuidTest(){
- cd.getAllNetworksByServiceModelUuid("4993493");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VfModule> list() throws Exception {
+ return Collections.emptyList();
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertEquals(cd.getAllNetworksByServiceModelUuid("4993493").size(), 0);
}
- @Test(expected = Exception.class)
+ @Test
public void getAllNetworksByServiceModelInvariantUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllNetworksByServiceModelInvariantUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllNetworksByServiceModelInvariantUuid2Test(){
+ thrown.expect(Exception.class);
cd.getAllNetworksByServiceModelInvariantUuid("4993493","test");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllNetworksByNetworkModelCustomizationUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllNetworksByNetworkModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllNetworksByNetworkTypeTest(){
+ thrown.expect(Exception.class);
cd.getAllNetworksByNetworkType("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllVfmcForVrcTest(){
VnfResourceCustomization re = new VnfResourceCustomization();
re.setModelCustomizationUuid("377483");
+ thrown.expect(Exception.class);
cd.getAllVfmcForVrc(re);
}
- @Test(expected = Exception.class)
+ @Test
public void getAllVnfsByServiceModelUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllVnfsByServiceModelUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllVnfsByServiceModelInvariantUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllVnfsByServiceModelInvariantUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllVnfsByServiceModelInvariantUuid2Test(){
+ thrown.expect(Exception.class);
cd.getAllVnfsByServiceModelInvariantUuid("4993493","test");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllVnfsByServiceNameTest(){
+ thrown.expect(Exception.class);
cd.getAllVnfsByServiceName("4993493","test");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllVnfsByServiceName2Test(){
+ thrown.expect(Exception.class);
cd.getAllVnfsByServiceName("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllVnfsByVnfModelCustomizationUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllVnfsByVnfModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllAllottedResourcesByServiceModelUuidTest(){
- cd.getAllAllottedResourcesByServiceModelUuid("4993493");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<ServiceToResourceCustomization> list() {
+ ServiceToResourceCustomization vnfResourceCustomization = new ServiceToResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockUpQuery2 = new MockUp<Query>() {
+
+ @Mock
+ public List<AllottedResourceCustomization> list() {
+ AllottedResourceCustomization vnfResourceCustomization = new AllottedResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockUpQuery3 = new MockUp<Query>() {
+
+ @Mock
+ public List<AllottedResource> list() {
+ AllottedResource vnfResourceCustomization = new AllottedResource();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ if(hql.contains("ServiceToResourceCustomization")){
+ return mockUpQuery.getMockInstance();
+
+ }else if(hql.contains("AllottedResource " )){
+ return mockUpQuery3.getMockInstance();
+
+ } else{
+ return mockUpQuery2.getMockInstance();
+ }
+
+
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ List<AllottedResourceCustomization> allAllottedResourcesByServiceModelUuid = cd.getAllAllottedResourcesByServiceModelUuid("4993493");
+ assertFalse(allAllottedResourcesByServiceModelUuid.isEmpty());
}
- @Test(expected = Exception.class)
+ @Test
public void getAllAllottedResourcesByServiceModelInvariantUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllAllottedResourcesByServiceModelInvariantUuid2Test(){
- cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493","test");
+
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<ServiceToResourceCustomization> list() {
+ ServiceToResourceCustomization vnfResourceCustomization = new ServiceToResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockUpQuery2 = new MockUp<Query>() {
+
+ @Mock
+ public List<AllottedResourceCustomization> list() {
+ AllottedResourceCustomization vnfResourceCustomization = new AllottedResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockUpQuery3 = new MockUp<Query>() {
+
+ @Mock
+ public List<AllottedResource> list() {
+ AllottedResource vnfResourceCustomization = new AllottedResource();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockUpQuery4 = new MockUp<Query>() {
+
+ @Mock
+ public List<Service> list() {
+ Service vnfResourceCustomization = new Service();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ if(hql.contains("ServiceToResourceCustomization")){
+ return mockUpQuery.getMockInstance();
+
+ }else if(hql.contains("AllottedResource " )){
+ return mockUpQuery3.getMockInstance();
+
+ } else if(hql.contains(" Service ")){
+ return mockUpQuery4.getMockInstance();
+ }else{
+ return mockUpQuery2.getMockInstance();
+ }
+
+
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+
+ List<AllottedResourceCustomization> allottedResourceCustomizations = cd.getAllAllottedResourcesByServiceModelInvariantUuid("4993493", "test");
+ assertFalse(allottedResourceCustomizations.isEmpty());
}
- @Test(expected = Exception.class)
+ @Test
public void getAllAllottedResourcesByArModelCustomizationUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllAllottedResourcesByArModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllottedResourceByModelUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllottedResourceByModelUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getAllResourcesByServiceModelUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllResourcesByServiceModelUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllResourcesByServiceModelInvariantUuidTest(){
+ thrown.expect(Exception.class);
cd.getAllResourcesByServiceModelInvariantUuid("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllResourcesByServiceModelInvariantUuid2Test(){
+ thrown.expect(Exception.class);
cd.getAllResourcesByServiceModelInvariantUuid("4993493","test");
}
- @Test(expected = Exception.class)
+ @Test
public void getSingleNetworkByModelCustomizationUuidTest(){
+ thrown.expect(Exception.class);
cd.getSingleNetworkByModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getSingleAllottedResourceByModelCustomizationUuidTest(){
+ thrown.expect(Exception.class);
cd.getSingleAllottedResourceByModelCustomizationUuid("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleRecipeTest(){
+ thrown.expect(Exception.class);
cd.getVfModuleRecipe("4993493","test","get");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getVfModuleTest(){
- cd.getVfModule("4993493","test","get","v2","vnf");
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VfModule> list() {
+ VfModule vnfResourceCustomization = new VfModule();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ List<VfModule> vfModule = cd.getVfModule("4993493", "test", "get", "v2", "vnf");
+ assertFalse(vfModule.isEmpty());
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfComponentsRecipeTest(){
+ thrown.expect(Exception.class);
cd.getVnfComponentsRecipe("4993493","test","v2","vnf","get","3992");
}
- @Test(expected = Exception.class)
+ @Test
public void getVnfComponentsRecipeByVfModuleTest(){
List <VfModule> resultList = new ArrayList<>();
VfModule m = new VfModule();
resultList.add(m);
+ thrown.expect(Exception.class);
cd.getVnfComponentsRecipeByVfModule(resultList,"4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllVnfResourcesTest(){
- cd.getAllVnfResources();
- }
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getVnfResourcesByRoleTest(){
- cd.getVnfResourcesByRole("4993493");
- }
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getVnfResourceCustomizationsByRoleTest(){
- cd.getVnfResourceCustomizationsByRole("4993493");
- }
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResource> list() {
+ VnfResource vnfResourceCustomization = new VnfResource();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM VnfResource"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<VnfResource> allVnfResources = cd.getAllVnfResources();
+ assertFalse(allVnfResources.isEmpty());
+ }
+ @Test
+ public void getVnfResourcesByRoleTest(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResource> list() {
+ VnfResource vnfResourceCustomization = new VnfResource();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM VnfResource WHERE vnfRole = :vnfRole"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<VnfResource> vnfResourcesByRole = cd.getVnfResourcesByRole("4993493");
+ assertFalse(vnfResourcesByRole.isEmpty());
+ }
+ @Test
+ public void getVnfResourceCustomizationsByRoleTest(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResourceCustomization> list() {
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM VnfResourceCustomization WHERE nfRole = :vnfRole"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<VnfResourceCustomization> vnfResourceCustomizationsByRole = cd.getVnfResourceCustomizationsByRole("4993493");
+ assertFalse(vnfResourceCustomizationsByRole.isEmpty());
+ }
+ @Test
public void getAllNetworkResourcesTest(){
- cd.getAllNetworkResources();
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<NetworkResource> list() {
+ NetworkResource vnfResourceCustomization = new NetworkResource();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM NetworkResource"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<NetworkResource> allNetworkResources = cd.getAllNetworkResources();
+ assertFalse(allNetworkResources.isEmpty());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllNetworkResourceCustomizationsTest(){
- cd.getAllNetworkResourceCustomizations();
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<NetworkResourceCustomization> list() {
+ NetworkResourceCustomization vnfResourceCustomization = new NetworkResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM NetworkResourceCustomization"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<NetworkResourceCustomization> allNetworkResourceCustomizations = cd.getAllNetworkResourceCustomizations();
+ assertFalse(allNetworkResourceCustomizations.isEmpty());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllVfModulesTest(){
- cd.getAllVfModules();
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VfModule> list() {
+ VfModule vnfResourceCustomization = new VfModule();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM VfModule"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<VfModule> allVfModules = cd.getAllVfModules();
+ assertFalse(allVfModules.isEmpty());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllVfModuleCustomizationsTest(){
- cd.getAllVfModuleCustomizations();
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VfModuleCustomization> list() {
+ VfModuleCustomization vnfResourceCustomization = new VfModuleCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM VfModuleCustomization"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<VfModuleCustomization> allVfModuleCustomizations = cd.getAllVfModuleCustomizations();
+ assertFalse(allVfModuleCustomizations.isEmpty());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getAllHeatEnvironmentTest(){
- cd.getAllHeatEnvironment();
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<HeatEnvironment> list() {
+ HeatEnvironment vnfResourceCustomization = new HeatEnvironment();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ assertTrue(hql.contains("FROM HeatEnvironment"));
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<HeatEnvironment> allHeatEnvironment = cd.getAllHeatEnvironment();
+ assertFalse(allHeatEnvironment.isEmpty());
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatEnvironment2Test(){
+ thrown.expect(Exception.class);
cd.getHeatEnvironment(4993493);
}
- @Test(expected = Exception.class)
+ @Test
public void getNestedTemplatesTest(){
+ thrown.expect(Exception.class);
cd.getNestedTemplates(4993493);
}
- @Test(expected = Exception.class)
+ @Test
public void getNestedTemplates2Test(){
+ thrown.expect(Exception.class);
cd.getNestedTemplates("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatFilesTest(){
+ thrown.expect(Exception.class);
cd.getHeatFiles(4993493);
}
- @Test(expected = Exception.class)
+ @Test
public void getVfModuleToHeatFilesEntryTest(){
+ thrown.expect(Exception.class);
cd.getVfModuleToHeatFilesEntry("4993493","49959499");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getServiceToResourceCustomization(){
+ thrown.expect(Exception.class);
cd.getServiceToResourceCustomization("4993493","599349","49900");
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatFilesForVfModuleTest(){
+ thrown.expect(Exception.class);
cd.getHeatFilesForVfModule("4993493");
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatTemplateTest(){
+ thrown.expect(Exception.class);
cd.getHeatTemplate("4993493","test","heat");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveHeatTemplateTest(){
HeatTemplate heat = new HeatTemplate();
Set <HeatTemplateParam> paramSet = new HashSet<>();
+ thrown.expect(Exception.class);
cd.saveHeatTemplate(heat,paramSet);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getHeatEnvironmentTest(){
- cd.getHeatEnvironment("4993493","test","heat");
+
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public Object uniqueResult() throws Exception {
+ return null;
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertEquals(cd.getHeatEnvironment("4993493","test","heat"), null);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void getHeatEnvironment3Test(){
+ thrown.expect(Exception.class);
cd.getHeatEnvironment("4993493","test");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveHeatEnvironmentTest(){
HeatEnvironment en = new HeatEnvironment();
+ thrown.expect(Exception.class);
cd.saveHeatEnvironment(en);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveHeatTemplate2Test(){
HeatTemplate heat = new HeatTemplate();
+ thrown.expect(Exception.class);
cd.saveHeatTemplate(heat);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveHeatFileTest(){
HeatFiles hf = new HeatFiles();
+ thrown.expect(Exception.class);
cd.saveHeatFile(hf);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveVnfRecipeTest(){
VnfRecipe vr = new VnfRecipe();
+ thrown.expect(Exception.class);
cd.saveVnfRecipe(vr);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveVnfComponentsRecipe(){
VnfComponentsRecipe vr = new VnfComponentsRecipe();
+ thrown.expect(Exception.class);
cd.saveVnfComponentsRecipe(vr);
}
- @Test(expected = Exception.class)
+ @Test
public void saveOrUpdateVnfResourceTest(){
VnfResource vr = new VnfResource();
+ thrown.expect(Exception.class);
cd.saveOrUpdateVnfResource(vr);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveVnfResourceCustomizationTest(){
VnfResourceCustomization vr = new VnfResourceCustomization();
+ thrown.expect(Exception.class);
cd.saveVnfResourceCustomization(vr);
}
- @Test(expected = Exception.class)
+ @Test
public void saveAllottedResourceCustomizationTest(){
AllottedResourceCustomization arc = new AllottedResourceCustomization();
+ thrown.expect(Exception.class);
cd.saveAllottedResourceCustomization(arc);
}
- @Test(expected = Exception.class)
+ @Test
public void saveAllottedResourceTest(){
AllottedResource ar = new AllottedResource();
+ thrown.expect(Exception.class);
cd.saveAllottedResource(ar);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveNetworkResourceTest() throws RecordNotFoundException {
NetworkResource nr = new NetworkResource();
+ thrown.expect(Exception.class);
cd.saveNetworkResource(nr);
}
- @Test(expected = Exception.class)
+ @Test
public void saveToscaCsarTest()throws RecordNotFoundException {
ToscaCsar ts = new ToscaCsar();
+ thrown.expect(Exception.class);
cd.saveToscaCsar(ts);
}
- @Test(expected = Exception.class)
+ @Test
public void getToscaCsar(){
+ thrown.expect(Exception.class);
cd.getToscaCsar("4993493");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveTempNetworkHeatTemplateLookupTest(){
TempNetworkHeatTemplateLookup t = new TempNetworkHeatTemplateLookup();
+ thrown.expect(Exception.class);
cd.saveTempNetworkHeatTemplateLookup(t);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void saveVfModuleToHeatFiles(){
- VfModuleToHeatFiles v = new VfModuleToHeatFiles();
- cd.saveVfModuleToHeatFiles(v);
- }
- @Test(expected = Exception.class)
+ @Test
public void saveVnfResourceToVfModuleCustomizationTest() throws RecordNotFoundException {
VnfResourceCustomization v =new VnfResourceCustomization();
VfModuleCustomization vm = new VfModuleCustomization();
+ thrown.expect(Exception.class);
cd.saveVnfResourceToVfModuleCustomization(v, vm);
}
- @Test(expected = Exception.class)
+ @Test
public void saveNetworkResourceCustomizationTest() throws RecordNotFoundException {
NetworkResourceCustomization nrc = new NetworkResourceCustomization();
+ thrown.expect(Exception.class);
cd.saveNetworkResourceCustomization(nrc);
}
- @Test(expected = Exception.class)
+ @Test
public void saveServiceToNetworksTest(){
AllottedResource ar = new AllottedResource();
+ thrown.expect(Exception.class);
cd.saveAllottedResource(ar);
}
- @Test(expected = Exception.class)
+ @Test
public void saveServiceToResourceCustomizationTest(){
ServiceToResourceCustomization ar = new ServiceToResourceCustomization();
+ thrown.expect(Exception.class);
cd.saveServiceToResourceCustomization(ar);
}
- @Test(expected = Exception.class)
+ @Test
public void saveServiceTest(){
Service ar = new Service();
+ thrown.expect(Exception.class);
cd.saveService(ar);
}
- @Test(expected = Exception.class)
+ @Test
public void saveOrUpdateVfModuleTest(){
VfModule ar = new VfModule();
+ thrown.expect(Exception.class);
cd.saveOrUpdateVfModule(ar);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void saveOrUpdateVfModuleCustomizationTest(){
VfModuleCustomization ar = new VfModuleCustomization();
+ thrown.expect(Exception.class);
cd.saveOrUpdateVfModuleCustomization(ar);
}
- @Test(expected = Exception.class)
+ @Test
public void getNestedHeatTemplateTest(){
+ thrown.expect(Exception.class);
cd.getNestedHeatTemplate(101,201);
}
- @Test(expected = Exception.class)
+ @Test
public void getNestedHeatTemplate2Test(){
+ thrown.expect(Exception.class);
cd.getNestedHeatTemplate("1002","1002");
}
- @Test(expected = Exception.class)
+ @Test
public void saveNestedHeatTemplateTest(){
HeatTemplate ar = new HeatTemplate();
+ thrown.expect(Exception.class);
cd.saveNestedHeatTemplate("1001",ar,"test");
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatFiles2Test(){
VfModuleCustomization ar = new VfModuleCustomization();
+ thrown.expect(Exception.class);
cd.getHeatFiles(101,"test","1001","v2");
}
- @Test(expected = Exception.class)
+ @Test
public void getHeatFiles3Test(){
VfModuleCustomization ar = new VfModuleCustomization();
+ thrown.expect(Exception.class);
cd.getHeatFiles("200192");
}
- @Test(expected = Exception.class)
+ @Test
public void saveHeatFilesTest(){
HeatFiles ar = new HeatFiles();
+ thrown.expect(Exception.class);
cd.saveHeatFiles(ar);
}
- @Test(expected = Exception.class)
+ @Test
public void saveVfModuleToHeatFilesTest(){
HeatFiles ar = new HeatFiles();
+ thrown.expect(Exception.class);
cd.saveVfModuleToHeatFiles("3772893",ar);
}
@Test
cd.getNetworkResourceByModelUuid("3899291");
}
- @Test(expected = Exception.class)
+ @Test
public void getNetworkRecipeTest(){
-
+ thrown.expect(Exception.class);
cd.getNetworkRecipe("test","test1","test2");
}
- @Test(expected = Exception.class)
+ @Test
public void getNetworkRecipe2Test(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<NetworkRecipe> list() {
+ NetworkRecipe heatTemplate = new NetworkRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ NetworkRecipe networkRecipe = cd.getNetworkRecipe("test","test1");assertNotNull(networkRecipe);
+ assertNotNull(networkRecipe);
- cd.getNetworkRecipe("test","test1");
}
@Test
public void getNetworkResourceByModelCustUuidTest(){
cd.getNetworkResourceByModelCustUuid("test");
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getVnfComponentsRecipe2Test(){
- cd.getVnfComponentsRecipe("test1","test2","test3","test4");
- }
- @Test(expected = Exception.class)
+ @Test
public void getVnfComponentsRecipeByVfModuleModelUUIdTest(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VnfComponentsRecipe> list() {
+ VnfComponentsRecipe heatTemplate = new VnfComponentsRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
- cd.getVnfComponentsRecipeByVfModuleModelUUId("test1","test2","test3");
- }
- @Test(expected = Exception.class)
- public void getVnfComponentRecipesTest(){
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
- cd.getVnfComponentRecipes("test");
- }
- @Test(expected = Exception.class)
- public void saveOrUpdateVnfComponentTest(){
- VnfComponent ar = new VnfComponent();
- cd.saveOrUpdateVnfComponent(ar);
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ VnfComponentsRecipe vnfComponentsRecipeByVfModuleModelUUId = cd.getVnfComponentsRecipeByVfModuleModelUUId("test1", "test2", "test3");
+ assertNotNull(vnfComponentsRecipeByVfModuleModelUUId);
}
+ @Test
+ public void getVnfComponentRecipesTest(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VnfComponentsRecipe> list() {
+ VnfComponentsRecipe heatTemplate = new VnfComponentsRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
- public void getVfModule2Test(){
-
- cd.getVfModule("test");
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ List<VnfComponentsRecipe> test = cd.getVnfComponentRecipes("test");
+ assertNotNull(test);
+ assertFalse(test.isEmpty());
+ }
+ @Test
+ public void saveOrUpdateVnfComponentTest(){
+ VnfComponent ar = new VnfComponent();
+ thrown.expect(Exception.class);
+ cd.saveOrUpdateVnfComponent(ar);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+
+ @Test
+ public void getVfModule2Test(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VfModule> list() {
+ VfModule heatTemplate = new VfModule();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ VfModule test = cd.getVfModule("test");
+ assertNotNull(test);
+ }
+ @Test
public void getVfModuleByModelUUIDTest(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VfModule> list() {
+ VfModule heatTemplate = new VfModule();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
- cd.getVfModuleByModelUUID("test");
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ VfModule test = cd.getVfModuleByModelUUID("test");
+ assertNotNull(test);
}
- @Test(expected = Exception.class)
+ @Test
public void getServiceRecipeByModelUUIDTest(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<ServiceRecipe> list() {
+ ServiceRecipe heatTemplate = new ServiceRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
- cd.getServiceRecipeByModelUUID("test1","test2");
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ Assert.assertNotNull(cd.getServiceRecipeByModelUUID("test1", "test2"));
}
- @Test(expected = Exception.class)
+ @Test
public void getModelRecipeTest(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<Object> list() {
+ return new ArrayList();
+ }
+ };
- cd.getModelRecipe("test1","test2","test3");
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ Assert.assertNull(cd.getModelRecipe("test1", "test2", "test3"));
}
- @Test(expected = Exception.class)
+ @Test
+ @Ignore
public void healthCheck(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<HeatTemplate> list() {
+ HeatTemplate heatTemplate = new HeatTemplate();
+ return Arrays.asList(heatTemplate);
+ }
+ };
- cd.healthCheck();
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createSQLQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.healthCheck());
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+ @Test
public void executeQuerySingleRow(){
VnfComponent ar = new VnfComponent();
HashMap<String, String> variables = new HashMap<>();
+ thrown.expect(Exception.class);
cd.executeQuerySingleRow("tets",variables,false);
}
- @Test(expected = Exception.class)
- @Ignore // 1802 merge
+
+ @Test
public void executeQueryMultipleRows(){
HashMap<String, String> variables = new HashMap<>();
- cd.executeQueryMultipleRows("select",variables,false);
+
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<HeatTemplate> list() {
+ HeatTemplate heatTemplate = new HeatTemplate();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+
+ List<Object> select = cd.executeQueryMultipleRows("select", variables, false);
+ assertFalse(select.isEmpty());
+ }
+
+ @Test
+ public void getArRecipeByNameVersion(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<ArRecipe> list() {
+ ArRecipe arRecipe = new ArRecipe();
+ return Arrays.asList(arRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getArRecipeByNameVersion("select","variables","String"));
+ }
+ @Test
+ public void getVnfComponentsRecipe(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<VnfComponentsRecipe> list() {
+ VnfComponentsRecipe heatTemplate = new VnfComponentsRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getVnfComponentsRecipe("vnfType","vnfComponentType","action","serviceType"));
+ }
+ @Test
+ public void getNetworkRecipeByNameVersion(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<NetworkRecipe> list() {
+ NetworkRecipe heatTemplate = new NetworkRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getNetworkRecipeByNameVersion("modelName","modelVersion","action"));
+ }
+ @Test
+ public void saveOrUpdateVfModuleCustomization(){
+ mockUpQuery = new MockUp<Query>() {
+ @Mock
+ public List<NetworkRecipe> list() {
+ NetworkRecipe heatTemplate = new NetworkRecipe();
+ return Arrays.asList(heatTemplate);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setHeatEnvironmentArtifactUuid("HeatEnvironmentArtifactUuid");
+ vfModuleCustomization.setVolEnvironmentArtifactUuid("VolEnvironmentArtifactUuid");
+ vfModuleCustomization.setVfModuleModelUuid("VfModuleModelUuid");
+ vfModuleCustomization.setModelCustomizationUuid("ModelCustomizationUuid");
+ cd.saveOrUpdateVfModuleCustomization(vfModuleCustomization);
+ }
+ @Test
+ public void saveServiceToNetworks(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<Service> list() {
+ Service service = new Service();
+ service.setModelUUID("123-uuid");
+ return Arrays.asList(service);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ ServiceToNetworks serviceToNetworks = new ServiceToNetworks();
+ cd.saveServiceToNetworks(serviceToNetworks);
+ }
+ @Test
+ public void saveVfModuleToHeatFiles() {
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<Service> list() {
+ Service service = new Service();
+ service.setModelUUID("123-uuid");
+ return Arrays.asList(service);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ VfModuleToHeatFiles vfModuleToHeatFiles = new VfModuleToHeatFiles();
+
+ cd.saveVfModuleToHeatFiles(vfModuleToHeatFiles);
+ }
+ @Test
+ public void saveTempNetworkHeatTemplateLookup() {
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<Service> list() {
+ Service service = new Service();
+ service.setModelUUID("123-uuid");
+ return Arrays.asList(service);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+ TempNetworkHeatTemplateLookup tempNetworkHeatTemplateLookup = new TempNetworkHeatTemplateLookup();
+
+ cd.saveTempNetworkHeatTemplateLookup(tempNetworkHeatTemplateLookup);
+ }
+ @Test
+ public void getToscaCsarByServiceModelUUID() {
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<Service> list() {
+ Service service = new Service();
+ service.setModelUUID("123-uuid");
+ return Arrays.asList(service);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+
+
+ assertNull(cd.getToscaCsarByServiceModelUUID("uuid-123"));
+ cd.close();
+ }
+ @Test
+ public void getVnfRecipeByNameVersion(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getVnfRecipeByNameVersion("modelName","modelVersion","action"));
+ }
+ @Test
+ public void getVnfRecipeByModuleUuid(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVnfRecipeByModuleUuid("vnfModelUuid","action"));
+ }
+ @Test
+ public void getVfModuleType(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVfModuleType("type","version"));
+ }
+ @Test
+ public void getVfModuleByModelInvariantUuidAndModelVersion(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVfModuleByModelInvariantUuidAndModelVersion("modelInvariantUuid","modelVersion"));
+ }
+ @Test
+ public void getVnfResourceCustomizationByModelCustomizationUuid(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVnfResourceCustomizationByModelCustomizationUuid("modelCustomizationUuid"));
+ }
+ @Test
+ public void getVfModuleByModelCustomizationIdAndVersion(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVfModuleByModelCustomizationIdAndVersion("modelCustomizationUuid","modelVersionId"));
+ }
+ @Test
+ public void getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVfModuleByModelCustomizationIdModelVersionAndModelInvariantId("modelCustomizationUuid","modelVersion","modelInvariantId"));
+ }
+ @Test
+ public void getVnfResourceCustomizationByModelInvariantId(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNull(cd.getVnfResourceCustomizationByModelInvariantId("modelInvariantId","modelVersion","modelCustomizationName"));
+ }
+ @Test
+ public void getVfModuleCustomizationByVnfModuleCustomizationUuid(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfRecipe> list() {
+ VnfRecipe vnfRecipe = new VnfRecipe();
+ return Arrays.asList(vnfRecipe);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getVfModuleCustomizationByVnfModuleCustomizationUuid("modelCustomizationUuid"));
+ }
+ @Test
+ public void getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId(){
+ mockUpQuery = new MockUp<Query>() {
+
+ @Mock
+ public List<VnfResourceCustomization> list() {
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ return Arrays.asList(vnfResourceCustomization);
+ }
+ };
+
+ mockedSession = new MockUp<Session>() {
+ @Mock
+ public Query createQuery(String hql) {
+ return mockUpQuery.getMockInstance();
+ }
+ };
+
+ mockCd = new MockUp<CatalogDatabase>() {
+ @Mock
+ private Session getSession() {
+ return mockedSession.getMockInstance();
+ }
+ };
+ assertNotNull(cd.getVnfResourceCustomizationByVnfModelCustomizationNameAndModelVersionId("modelCustomizationName","modelVersionId"));
}
}
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.openecomp.mso.db.catalog.test;
+
+import org.junit.Test;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.utils.RecordNotFoundException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+
+public class RecordNotFoundExceptionTest {
+
+ @Test
+ public void paramConstructor(){
+ RecordNotFoundException ex = new RecordNotFoundException("Exceoption raised", new Exception());
+ assertNotNull(ex);
+ assertNotNull(ex.getMessage());
+ }
+}
assertTrue(serviceMacroHolder.getService() == null);
serviceMacroHolder.addVnfResource(new VnfResource());
serviceMacroHolder.addVnfResourceCustomizations(new VnfResourceCustomization());
- serviceMacroHolder.addNetworkResourceCustomization(new NetworkResourceCustomization());
+ serviceMacroHolder.addNetworkResourceCustomizations(new NetworkResourceCustomization());
serviceMacroHolder.addAllottedResourceCustomization(new AllottedResourceCustomization());
assertTrue(serviceMacroHolder != null);
}
smh.setNetworkResourceCustomization(networkResourceCustomizations);
NetworkResourceCustomization nrc = new NetworkResourceCustomization();
- smh.addNetworkResourceCustomization(nrc);
+ smh.addNetworkResourceCustomizations(nrc);
ArrayList<AllottedResourceCustomization> allottedResourceCustomizations = new ArrayList<>();
smh.setAllottedResourceCustomization(allottedResourceCustomizations);
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
- <version>${resteasy.version}</version>
+ <version>3.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>