// Properties names and variables (with default values)
protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval";
- private String deletePollIntervalProp = "org.onap.so.adapters.po.pollInterval";
- private String deletePollTimeoutProp = "org.onap.so.adapters.po.pollTimeout";
private String pollingMultiplierProp = "org.onap.so.adapters.po.pollMultiplier";
protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
- private static final String DELETE_POLL_INTERVAL_DEFAULT = "15";
private static final String POLLING_MULTIPLIER_DEFAULT = "60";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
*/
- @SuppressWarnings("unchecked")
public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
VduModelInfo vduModel, String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion,
int timeoutMinutes, String environment, Map<String, Object> nestedTemplates, Map<String, Object> heatFiles,
* Boolean if any of the conversions should fail, we will default to adding it to the inputs as a string - see if
* Openstack can handle it. Also, will remove any params that are extra. Any aliases will be converted to their
* appropriate name (anyone use this feature?)
- *
+ *
* @param inputs - the Map<String, String> of the inputs received on the request
* @param template the HeatTemplate object - this is so we can also verify if the param is valid for this template
* @return HashMap<String, Object> of the inputs, cleaned and converted
* 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.
@XmlRootElement(name = "deleteVfModuleRequest")
public class DeleteVfModuleRequest extends VfRequestCommon implements Serializable {
/**
- *
+ *
*/
private static final long serialVersionUID = -8504083539107392561L;
private String cloudSiteId;
private String vnfId;
private String vfModuleId;
private String vfModuleStackId;
+ private String modelCustomizationUuid;
private MsoRequest msoRequest = new MsoRequest();
this.vfModuleStackId = vfModuleStackId;
}
+ public String getModelCustomizationUuid() {
+ return modelCustomizationUuid;
+ }
+
+ public void setModelCustomizationUuid(String modelCustomizationUuid) {
+ this.modelCustomizationUuid = modelCustomizationUuid;
+ }
+
public MsoRequest getMsoRequest() {
return msoRequest;
}
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
-
if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
if (!commonUtils.isNullOrEmpty(networkType)) {
networkResource = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType);
}
}
+ int timeoutMinutes = 118;
String mode = "";
if (networkResource != null) {
logger.debug(LOG_DEBUG_MSG, networkResource.toString());
mode = networkResource.getOrchestrationMode();
+ networkResource.getHeatTemplate().getTimeoutMinutes();
+ HeatTemplate heat = networkResource.getHeatTemplate();
+ if (heat != null && heat.getTimeoutMinutes() != null) {
+ if (heat.getTimeoutMinutes() < 118) {
+ timeoutMinutes = heat.getTimeoutMinutes();
+ }
+ }
}
if (NEUTRON_MODE.equals(mode)) {
}
} else {
try {
- heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, 120);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, timeoutMinutes);
networkDeleted.value = true;
} catch (MsoException me) {
me.addContext("DeleteNetwork");
* make these optional + " ip_version: %ipversion%\n" + " enable_dhcp: %enabledhcp%\n" +
* " gateway_ip: %gatewayip%\n" + " allocation_pools:\n" + " - start: %poolstart%\n" +
* " end: %poolend%\n";
- *
+ *
*/
String outputTempl = " subnet_id_%subnetId%:\n" + " description: Openstack subnet identifier\n"
@WebParam(name = "vfName") @XmlElement(required = true) String vfName,
@WebParam(name = "vnfId") @XmlElement(required = true) String vnfId,
@WebParam(name = "vfModuleId") @XmlElement(required = true) String vfModuleId,
+ @WebParam(name = "modelCustomizationUuid") @XmlElement(required = false) String modelCustomizationUuid,
@WebParam(name = "request") MsoRequest msoRequest,
@WebParam(name = "vfModuleOutputs", mode = Mode.OUT) Holder<Map<String, String>> vfModuleOutputs)
throws VnfException;
@Override
public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId,
- String vfModuleId, MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
+ String vfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
+ Holder<Map<String, String>> outputs) throws VnfException {
Map<String, Object> stackOutputs;
try {
stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
msoRequest, failRequestOnValetFailure);
}
+ int timeoutMinutes = 118;
+ VfModule vf = null;
+ VfModuleCustomization vfmc = null;
+ if (modelCustomizationUuid != null) {
+ vfmc = vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(modelCustomizationUuid);
+ if (vfmc != null) {
+ vf = vfmc.getVfModule();
+ }
+ if (vf != null) {
+ logger.trace("Found vfModuleCust entry {}", vfmc.toString());
+ HeatTemplate heat = vf.getModuleHeatTemplate();
+ if (heat != null && heat.getTimeoutMinutes() != null) {
+ if (heat.getTimeoutMinutes() < 118) {
+ timeoutMinutes = heat.getTimeoutMinutes();
+ }
+ }
+
+ } else {
+ logger.debug(
+ "Unable to find vfModuleCust with modelCustomizationUuid={} . Using default timeout for polling",
+ modelCustomizationUuid);
+ }
+ }
+
try {
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118);
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, timeoutMinutes);
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
}
public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId,
- String vfModuleId, MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
+ String vfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
+ Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Deleting VF " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
// 1702 capture the output parameters on a delete
public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleId, String vnfId,
- String aaiVfModuleId, MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
+ String aaiVfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
+ Holder<Map<String, String>> outputs) throws VnfException {
logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
Holder<Map<String, String>> outputs = new Holder<>();
if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) {
vnfAdapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getMsoRequest(),
- outputs);
+ req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
+ req.getModelCustomizationUuid(), req.getMsoRequest(), outputs);
}
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
// Support different Adapter Implementations
MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite);
adapter.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getMsoRequest(),
- outputs);
+ req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(),
+ req.getModelCustomizationUuid(), req.getMsoRequest(), outputs);
}
response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE,
req.getMessageId(), outputs.value);
* 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.
MsoRequest msoRequest = getMsoRequest();
try {
instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12",
- "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest,
+ "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", null, msoRequest,
new Holder<Map<String, String>>());
} catch (Exception e) {
* 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.
* msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); Holder<Map<String, String>> outputs =
* new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new
* Holder<>(), new Holder<>(), outputs);
- *
+ *
* assertTrue(outputs.value.isEmpty()); }
*/
/*
* @Test public void queryVnfTest() throws Exception {
- *
- *
+ *
+ *
* MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345");
* msoRequest.setServiceInstanceId("12345");
* wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
* .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
- *
+ *
* wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
* .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
* .withStatus(HttpStatus.SC_OK)));
- *
+ *
* wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
* .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
* .withStatus(HttpStatus.SC_OK)));
- *
+ *
* instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new
* Holder<>(), new Holder<>());
- *
+ *
* }
*/
msoRequest.setServiceInstanceId("12345");
instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", "5aae1e49-805c-4f9f-bd78-055bf7451157",
- "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, new Holder<>());
+ "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId", msoRequest, new Holder<>());
}
@Test
.willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK)));
instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", "5aae1e49-805c-4f9f-bd78-055bf7451157",
- "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, new Holder<>());
+ "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId", msoRequest, new Holder<>());
}
@Test
.willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT)));
instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", "5aae1e49-805c-4f9f-bd78-055bf7451157",
- "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest, new Holder<>());
+ "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId", msoRequest, new Holder<>());
}
@Test
expectedException.expect(VnfException.class);
MsoRequest msoRequest = getMsoRequest();
msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12",
- "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest,
- new Holder<Map<String, String>>());
+ "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId",
+ msoRequest, new Holder<Map<String, String>>());
}
@Test
.withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR)));
MsoRequest msoRequest = getMsoRequest();
msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12",
- "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", msoRequest,
- new Holder<Map<String, String>>());
+ "5aae1e49-805c-4f9f-bd78-055bf7451157", "11420693-3f69-4c61-b3ee-9787c744e760", "customizationId",
+ msoRequest, new Holder<Map<String, String>>());
}
private MsoRequest getMsoRequest() {
deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
+ if (vfModule.getModelInfoVfModule() != null) {
+ deleteVfModuleRequest
+ .setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ }
if (!StringUtils.isEmpty(vfModule.getHeatStackId())) {
deleteVfModuleRequest.setVfModuleStackId(vfModule.getHeatStackId());// DoDVfMod_heatStackId
} else {
-{
+{
"cloudSiteId" : "cloudRegionId",
- "tenantId" : "tenantId",
+ "tenantId" : "tenantId",
"vnfId" : "vnfId",
"vfModuleId" : "vfModuleId",
"vfModuleStackId" : "vfModuleName",
"skipAAI" : true,
+ "modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"msoRequest" : {
"requestId" : "requestId",
- "serviceInstanceId" : "serviceInstanceId"
+ "serviceInstanceId" : "serviceInstanceId"
}
}
\ No newline at end of file