aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.9__AddSkipPostInstantiationConfiguration.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java56
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java25
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java90
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java30
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java (renamed from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java)60
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java129
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java92
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java68
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java68
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java114
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java14
-rw-r--r--adapters/mso-openstack-adapters/src/main/resources/application.yaml1
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java)83
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java251
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java95
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java122
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json604
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json167
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json135
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json28
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json28
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json28
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json167
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json167
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json167
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json167
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json167
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java37
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java21
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java23
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java109
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java76
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java86
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java152
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java10
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java20
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java49
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java35
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java276
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java19
-rw-r--r--asdc-controller/src/test/resources/schema.sql2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn103
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn36
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn160
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java101
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java173
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java10
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java2
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql2
60 files changed, 4041 insertions, 787 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 93460ff119..850f16ff4d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -219,6 +219,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
public Optional<Port> getNeutronPort(String neutronPortId, String tenantId, String cloudSiteId)
{
try {
+ logger.debug("Finding Neutron port:" + neutronPortId);
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
@@ -525,6 +526,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
}
catch (OpenStackResponseException e) {
if (e.getStatus() == 404) {
+ logger.warn("Neutron port not found: " + neutronPortId,"Neutron port not found: " + neutronPortId);
return null;
} else {
logger.error("{} {} Openstack Error, GET Neutron Port By ID ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.9__AddSkipPostInstantiationConfiguration.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.9__AddSkipPostInstantiationConfiguration.sql
new file mode 100644
index 0000000000..b44ee1fcb2
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.9__AddSkipPostInstantiationConfiguration.sql
@@ -0,0 +1,8 @@
+use catalogdb;
+
+ALTER TABLE vnf_resource_customization
+ADD SKIP_POST_INSTANTIATION_CONFIGURATION boolean default true;
+
+ALTER TABLE pnf_resource_customization
+ADD SKIP_POST_INSTANTIATION_CONFIGURATION boolean default true;
+
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 461fce555f..599c99b435 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -23,6 +23,7 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import java.util.List;
import java.util.UUID;
@@ -190,6 +191,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
+ assertTrue("skip post instantiation configuration", vnfResourceCustomization.isSkipPostInstConf());
}
@Test
@@ -639,9 +641,9 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
+ assertTrue("skip post instantiation configuration", pnfResourceCustomization.isSkipPostInstConf());
PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
assertNotNull(pnfResource);
-
assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
pnfResource.getModelInvariantUUID());
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java
new file mode 100644
index 0000000000..a2c117b3d9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAudit.java
@@ -0,0 +1,56 @@
+package org.onap.so.adapters.audit;
+
+import java.io.Serializable;
+import java.net.URI;
+
+import org.onap.so.client.aai.AAIObjectType;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class AAIObjectAudit implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4560928512855386021L;
+ private boolean doesObjectExist = false;
+ private Object aaiObject;
+ private URI resourceURI;
+ private String aaiObjectType;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("doesObjectExist", doesObjectExist).append("aaiObject", aaiObject)
+ .append("resourceURI", resourceURI).append("aaiObjectType", aaiObjectType).toString();
+ }
+
+ public String getAaiObjectType() {
+ return aaiObjectType;
+ }
+
+ public void setAaiObjectType(String aaiObjectType) {
+ this.aaiObjectType = aaiObjectType;
+ }
+
+ public boolean isDoesObjectExist() {
+ return doesObjectExist;
+ }
+
+ public void setDoesObjectExist(boolean doesObjectExist) {
+ this.doesObjectExist = doesObjectExist;
+ }
+
+ public Object getAaiObject() {
+ return aaiObject;
+ }
+
+ public void setAaiObject(Object aaiObject) {
+ this.aaiObject = aaiObject;
+ }
+
+ public URI getResourceURI() {
+ return resourceURI;
+ }
+ public void setResourceURI(URI resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java
new file mode 100644
index 0000000000..a1a8d5b5ed
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AAIObjectAuditList.java
@@ -0,0 +1,25 @@
+package org.onap.so.adapters.audit;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class AAIObjectAuditList implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6712662349909726930L;
+ private List<AAIObjectAudit> auditList = new ArrayList<>();
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("auditList", auditList).toString();
+ }
+
+ public List<AAIObjectAudit> getAuditList() {
+ return auditList;
+ }
+
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
deleted file mode 100644
index 66d8fbd47c..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.audit;
-
-import org.camunda.bpm.client.task.ExternalTask;
-import org.camunda.bpm.client.task.ExternalTaskService;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.audit.beans.AuditInventory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AuditDeleteStackService {
-
- private static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI = "All VServers have not been deleted in A&AI";
-
- private static final int[] RETRY_SEQUENCE = new int[] { 1, 1, 2, 3, 5, 8, 13, 20};
-
-
- private static final Logger logger = LoggerFactory.getLogger(AuditDeleteStackService.class);
-
- @Autowired
- public HeatStackAudit heatStackAudit;
-
- @Autowired
- public Environment env;
-
- protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService){
- AuditInventory auditInventory = externalTask.getVariable("auditInventory");
- setupMDC(externalTask);
- boolean success = false;
- try {
- logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,externalTask.getRetries());
- success=heatStackAudit.auditHeatStackDeleted(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(),
- auditInventory.getTenantId(), auditInventory.getHeatStackName());
- } catch (Exception e) {
- logger.error("Error during audit of stack", e);
- }
-
- if (success) {
- externalTaskService.complete(externalTask);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
- } else {
- if(externalTask.getRetries() == null){
- logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", externalTask.getId(),RETRY_SEQUENCE.length);
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, RETRY_SEQUENCE.length, 10000);
- }else if(externalTask.getRetries() != null &&
- externalTask.getRetries()-1 == 0){
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
- externalTaskService.complete(externalTask);
- }else{
- logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(),externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
- }
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
- }
- }
- private void setupMDC(ExternalTask externalTask) {
- String msoRequestId = (String)externalTask.getVariable("mso-request-id");
- if(msoRequestId != null && !msoRequestId.isEmpty())
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
- }
- protected long calculateRetryDelay(int currentRetries){
- int retrySequence = RETRY_SEQUENCE.length - currentRetries;
- long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier","6000"));
- return RETRY_SEQUENCE[retrySequence] * retryMultiplier;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 6ea14dcac7..499c1137c7 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -46,30 +46,10 @@ public class AuditStackService {
public Environment env;
@Autowired
- private AuditCreateStackService auditCreateStack;
-
- @Autowired
- private AuditDeleteStackService auditDeleteStack;
+ private AuditStackServiceData auditStack;
@PostConstruct
- public void auditAddAAIInventory() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
- }
- ClientRequestInterceptor interceptor = new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"),
- auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).build();
- client.subscribe("InventoryAddAudit").lockDuration(60000)
- .handler(auditCreateStack::executeExternalTask).open();
- }
-
- @PostConstruct
- public void auditDeleteAAIInventory() {
+ public void auditAAIInventory() {
String auth = "";
try {
auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
@@ -80,9 +60,9 @@ public class AuditStackService {
auth);
ExternalTaskClient client = ExternalTaskClient.create()
.baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).build();
- client.subscribe("InventoryDeleteAudit").lockDuration(60000)
- .handler(auditDeleteStack::executeExternalTask).open();
+ .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build();
+ client.subscribe("InventoryAudit").lockDuration(60000)
+ .handler(auditStack::executeExternalTask).open();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java
index 24980ae4e0..da6bea7dec 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java
@@ -22,26 +22,29 @@
package org.onap.so.adapters.audit;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class AuditCreateStackService {
+public class AuditStackServiceData {
private static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI = "Unable to find all VServers and L-Interaces in A&AI";
- private static final int[] RETRY_SEQUENCE = new int[] { 1, 1, 2, 3, 5, 8, 13, 20};
-
-
- private static final Logger logger = LoggerFactory.getLogger(AuditCreateStackService.class);
+ private static final Logger logger = LoggerFactory.getLogger(AuditStackServiceData.class);
@Autowired
public HeatStackAudit heatStackAudit;
@@ -51,35 +54,39 @@ public class AuditCreateStackService {
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService){
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
+ Map<String, Object> variables = new HashMap<>();
setupMDC(externalTask);
boolean success = false;
try {
logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,externalTask.getRetries());
- success=heatStackAudit.auditHeatStackCreate(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(),
+ Optional<AAIObjectAuditList> auditListOpt= heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(),
auditInventory.getTenantId(), auditInventory.getHeatStackName());
+ if (auditListOpt.isPresent()) {
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
+ success = !didAuditFail(auditListOpt);
+ }
} catch (Exception e) {
logger.error("Error during audit of stack", e);
}
-
+ variables.put("auditIsSuccessful", success);
if (success) {
- externalTaskService.complete(externalTask);
+ externalTaskService.complete(externalTask,variables);
logger.debug("The External Task Id: {} Successful", externalTask.getId());
} else {
if(externalTask.getRetries() == null){
- logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", externalTask.getId(),RETRY_SEQUENCE.length);
- externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, RETRY_SEQUENCE.length, 10000);
+ logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}", externalTask.getId(),getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
}else if(externalTask.getRetries() != null &&
externalTask.getRetries()-1 == 0){
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
- externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ externalTaskService.complete(externalTask, variables);
}else{
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(),externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
}
logger.debug("The External Task Id: {} Failed", externalTask.getId());
}
-
-
}
private void setupMDC(ExternalTask externalTask) {
String msoRequestId = externalTask.getVariable("mso-request-id");
@@ -87,8 +94,29 @@ public class AuditCreateStackService {
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
}
protected long calculateRetryDelay(int currentRetries){
- int retrySequence = RETRY_SEQUENCE.length - currentRetries;
+ int retrySequence = getRetrySequence().length - currentRetries;
long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier","6000"));
- return RETRY_SEQUENCE[retrySequence] * retryMultiplier;
+ return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier;
+ }
+
+ /**
+ * @param auditHeatStackFailed
+ * @param auditList
+ * @return
+ */
+ protected boolean didAuditFail(Optional<AAIObjectAuditList> auditList) {
+ if (auditList.get().getAuditList() != null && !auditList.get().getAuditList().isEmpty()) {
+ if (logger.isInfoEnabled()) {
+ logger.info("Audit Results: {}", auditList.get().toString());
+ }
+ return auditList.get().getAuditList().stream().filter(auditObject -> !auditObject.isDoesObjectExist())
+ .findFirst().map(v -> true).orElse(false);
+ } else {
+ return false;
+ }
}
+ public String[] getRetrySequence() {
+ return env.getProperty("mso.workflow.topics.retrySequence",String[].class);
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
index c81dac7c6f..519e1c92b1 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
@@ -24,97 +24,106 @@ import java.util.Optional;
import java.util.Set;
import org.onap.aai.domain.yang.LInterface;
-import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+
@Component
public class AuditVServer extends AbstractAudit {
private static final Logger logger = LoggerFactory.getLogger(AuditVServer.class);
- public boolean auditAllVserversDoExist(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) {
+ public Optional<AAIObjectAuditList> auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) {
if (vServersToAudit == null || vServersToAudit.isEmpty()){
- return false;
+ return Optional.empty();
}
- return vServersToAudit.stream()
- .filter(vServer -> !doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion,true)).findFirst()
- .map(v -> false).orElse(true);
- }
-
- public boolean auditAllVserversDoNotExist(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) {
- if (vServersToAudit == null || vServersToAudit.isEmpty()){
- return true;
- }
- return vServersToAudit.stream()
- .filter(vServer -> doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion,false)).findFirst()
- .map(v -> false).orElse(true);
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ vServersToAudit.stream().forEach(vserver -> {
+ try {
+ logger.debug("Vserver to Audit: {}",objectMapper.getMapper().writeValueAsString(vserver));
+ } catch (JsonProcessingException e) {
+
+ }
+ });
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ vServersToAudit.stream()
+ .forEach(vServer -> auditList.getAuditList().addAll(doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion).getAuditList()));
+ return Optional.of(auditList);
}
- private boolean doesVServerExistInAAI(Vserver vServer, String tenantId, String cloudOwner, String cloudRegion, boolean checkLinterfaces) {
+ private AAIObjectAuditList doesVServerExistInAAI(Vserver vServer, String tenantId, String cloudOwner, String cloudRegion) {
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ AAIObjectAudit vServerAudit = new AAIObjectAudit();
AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
tenantId, vServer.getVserverId());
+ Vserver vServerShallow = new Vserver();
+ BeanUtils.copyProperties(vServer,vServerShallow,"LInterfaces");
boolean vServerExists = getAaiClient().exists(vserverURI);
- boolean doesExist = getAaiClient().exists(vserverURI);
- logger.info("v-server {} exists: {}", vServer.getVserverId(), doesExist);
- boolean allNeutronNetworksExist = true;
- if (vServerExists && vServer.getLInterfaces() != null && checkLinterfaces) {
- allNeutronNetworksExist = vServer.getLInterfaces()
- .getLInterface().stream().filter(lInterface -> !doesLinterfaceExistinAAI(lInterface,
- vServer.getVserverId(), tenantId, cloudOwner, cloudRegion))
- .findFirst().map(v -> false).orElse(true);
+ logger.info("v-server {} exists: {}", vServer.getVserverId(), vServerExists);
+ vServerAudit.setAaiObject(vServerShallow);
+ vServerAudit.setDoesObjectExist(vServerExists);
+ vServerAudit.setResourceURI(vserverURI.build());
+ vServerAudit.setAaiObjectType(AAIObjectType.VSERVER.typeName());
+ auditList.getAuditList().add(vServerAudit);
+ if (vServer.getLInterfaces() != null) {
+ vServer.getLInterfaces().getLInterface().stream().forEach(lInterface -> auditList.getAuditList().addAll(doesLinterfaceExistinAAI(lInterface,
+ vServer.getVserverId(), tenantId, cloudOwner, cloudRegion).getAuditList()));
}
- return vServerExists && allNeutronNetworksExist;
+ return auditList;
}
- private boolean doesLinterfaceExistinAAI(LInterface lInterface, String vServerId, String tenantId,
+ private AAIObjectAuditList doesLinterfaceExistinAAI(LInterface lInterface, String vServerId, String tenantId,
String cloudOwner, String cloudRegion) {
- boolean doesLInterfaceExist = false;
- boolean doSubInterfacesExist = true;
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+ AAIObjectAudit lInterfaceAudit = new AAIObjectAudit();
AAIResourceUri linterfaceURI = AAIUriFactory
- .createResourceUri(AAIObjectPlurals.L_INTERFACE, cloudOwner, cloudRegion, tenantId, vServerId)
- .queryParam("interface-id", lInterface.getInterfaceId());
- Optional<LInterfaces> queriedLInterface = getAaiClient().get(LInterfaces.class, linterfaceURI);
+ .createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, cloudRegion, tenantId, vServerId, lInterface.getInterfaceName());
+ Optional<LInterface> queriedLInterface = getAaiClient().get(LInterface.class, linterfaceURI);
if (queriedLInterface.isPresent()) {
- if (queriedLInterface.get().getLInterface().size() > 1) {
- logger.error("Non-Unique LInterface Found stopping audit, L-Interface Id: " +lInterface.getInterfaceId());
- doesLInterfaceExist = false;
- } else {
- doesLInterfaceExist = true;
- lInterface.setInterfaceName(queriedLInterface.get().getLInterface().get(0).getInterfaceName());
- }
+ lInterfaceAudit.setDoesObjectExist(true);
+ lInterface.setInterfaceName(lInterface.getInterfaceName());
}
- logger.info("l-interface id:{} name: {} exists: {}", lInterface.getInterfaceId(), lInterface.getInterfaceName(),
- doesLInterfaceExist);
+ LInterface lInterfaceShallow = new LInterface();
+ BeanUtils.copyProperties(lInterface,lInterfaceShallow,"LInterfaces");
+ lInterfaceAudit.setAaiObject(lInterface);
+ lInterfaceAudit.setResourceURI(linterfaceURI.build());
+ lInterfaceAudit.setAaiObjectType(AAIObjectType.L_INTERFACE.typeName());
+ auditList.getAuditList().add(lInterfaceAudit);
+ logger.info("l-interface id:{} name: {} exists: {} ", lInterface.getInterfaceId(), lInterface.getInterfaceName(),
+ lInterfaceAudit.isDoesObjectExist());
- if (doesLInterfaceExist && lInterface.getLInterfaces() != null) {
- doSubInterfacesExist = lInterface.getLInterfaces().getLInterface()
- .stream().filter(subInterface -> !doesSubInterfaceExistinAAI(subInterface,
- lInterface.getInterfaceName(), vServerId, tenantId, cloudOwner, cloudRegion))
- .findFirst().map(v -> false).orElse(true);
- } else
- logger.debug("l-interface {} does not contain any sub-iterfaces", lInterface.getInterfaceId());
+ if (lInterface.getLInterfaces() != null) {
+ lInterface.getLInterfaces().getLInterface().stream()
+ .forEach(subInterface -> auditList.getAuditList().add(doesSubInterfaceExistinAAI(subInterface,
+ lInterface.getInterfaceName(), vServerId, tenantId, cloudOwner, cloudRegion)));
+ }
+ logger.debug("l-interface {} does not contain any sub-iterfaces, skipping audit of sub-interfaces", lInterface.getInterfaceId());
- return doesLInterfaceExist && doSubInterfacesExist;
+ return auditList;
}
- private boolean doesSubInterfaceExistinAAI(LInterface subInterface, String linterfaceName, String vServerId,
+ private AAIObjectAudit doesSubInterfaceExistinAAI(LInterface subInterface, String linterfaceName, String vServerId,
String tenantId, String cloudOwner, String cloudRegion) {
logger.info("checking if sub-l-interface {} , linterfaceName: {} vserverId: {} exists",
- subInterface.getInterfaceId(), linterfaceName, vServerId);
-
- AAIResourceUri linterfaceURI = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE, cloudOwner,
- cloudRegion, tenantId, vServerId, linterfaceName)
- .queryParam("interface-id", subInterface.getInterfaceId());
-
- boolean doesExist = getAaiClient().exists(linterfaceURI);
- logger.info("sub-l-interface {} exists: {}", subInterface.getInterfaceId(), doesExist);
- return doesExist;
+ subInterface.getInterfaceName(), linterfaceName, vServerId);
+ AAIObjectAudit subInterfaceAudit = new AAIObjectAudit();
+
+
+ AAIResourceUri subInterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner,
+ cloudRegion, tenantId, vServerId, linterfaceName, subInterface.getInterfaceName());
+ subInterfaceAudit.setResourceURI(subInterfaceURI.build());
+ boolean doesExist = getAaiClient().exists(subInterfaceURI);
+ logger.info("sub-l-interface-id:{} exists: {}", subInterface.getInterfaceId(), doesExist);
+ subInterfaceAudit.setAaiObject(subInterface);
+ subInterfaceAudit.setDoesObjectExist(doesExist);
+ subInterfaceAudit.setAaiObjectType(AAIObjectType.SUB_L_INTERFACE.typeName());
+ return subInterfaceAudit;
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 72dee07379..31e913dc27 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -21,6 +21,7 @@
package org.onap.so.adapters.audit;
import java.net.URI;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -32,6 +33,8 @@ import java.util.stream.Stream;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
+import org.onap.aai.domain.yang.Vlan;
+import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
@@ -55,61 +58,38 @@ public class HeatStackAudit {
@Autowired
protected MsoHeatUtils heat;
-
+
@Autowired
protected MsoNeutronUtils neutron;
@Autowired
protected AuditVServer auditVservers;
- public boolean auditHeatStackCreate(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
+ public Optional<AAIObjectAuditList> auditHeatStack(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
try {
- return auditStack(cloudRegion,cloudOwner,tenantId,heatStackName,true);
- } catch (Exception e) {
- logger.error("Error during auditing stack resources", e);
- return false;
- }
- }
-
- public boolean auditHeatStackDeleted(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
- try {
- return auditStack(cloudRegion,cloudOwner,tenantId,heatStackName,false);
+ logger.debug("Fetching Top Level Stack Information");
+ Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName);
+ List<Resource> novaResources = resources.getList().stream()
+ .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
+ List<Resource> resourceGroups = resources.getList().stream()
+ .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType()) && p.getName().contains("subinterfaces"))
+ .collect(Collectors.toList());
+ List<Optional<Port>> neutronPortDetails = retrieveNeutronPortDetails(resources, cloudRegion, tenantId);
+ if (novaResources.isEmpty())
+ return Optional.of(new AAIObjectAuditList());
+ else {
+ Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources, neutronPortDetails);
+ Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
+ vserversToAudit);
+ return auditVservers.auditVservers(vserversWithSubInterfaces,
+ tenantId, cloudOwner, cloudRegion);
+ }
} catch (Exception e) {
logger.error("Error during auditing stack resources", e);
- return false;
- }
- }
-
- private boolean auditStack(String cloudRegion, String cloudOwner, String tenantId, String heatStackName,boolean isCreateAudit) throws Exception{
- logger.debug("Fetching Top Level Stack Information");
- Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName);
- List<Resource> novaResources = extractNovaResources(resources);
- if(novaResources.isEmpty())
- return true;
- else{
- List<Optional<Port>> neutronPortDetails = retrieveNeutronPortDetails(resources,cloudRegion,tenantId);
- List<Resource> resourceGroups = extractResourceGroups(resources);
- Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources,neutronPortDetails);
- Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
- vserversToAudit);
- if(isCreateAudit){
- return auditVservers.auditAllVserversDoExist(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion);
- }else{
- return auditVservers.auditAllVserversDoNotExist(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion);
- }
+ return Optional.empty();
}
}
- private List<Resource> extractResourceGroups(Resources resources) {
- return resources.getList().stream()
- .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType()) && p.getName().contains("subinterfaces")).collect(Collectors.toList());
- }
-
- private List<Resource> extractNovaResources(Resources resources) {
- return resources.getList().stream()
- .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
- }
-
protected Set<Vserver> processSubInterfaces(String cloudRegion, String tenantId, List<Resource> resourceGroups,
Set<Vserver> vServersToAudit) throws Exception {
for (Resource resourceGroup : resourceGroups) {
@@ -137,7 +117,6 @@ public class HeatStackAudit {
logger.error("Error Parsing Link to obtain Path", e);
throw new Exception("Error finding Path from Self Link");
}
-
}
}
@@ -182,7 +161,24 @@ public class HeatStackAudit {
}
LInterface subInterface = new LInterface();
subInterface.setInterfaceId(contrailVm.getPhysicalResourceId());
+ subInterface.setIsPortMirrored(false);
+ subInterface.setInMaint(false);
+ subInterface.setIsIpUnnumbered(false);
+ String macAddr = (String) subinterfaceStack.getParameters().get("mac_address");
+ subInterface.setMacaddr(macAddr);
+ String namePrefix = (String) subinterfaceStack.getParameters().get("subinterface_name_prefix");
+ Integer vlanIndex = Integer.parseInt((String) subinterfaceStack.getParameters().get("counter"));
+ String vlanTagList = (String) subinterfaceStack.getParameters().get("vlan_tag");
+ List<String> subInterfaceVlanTagList = Arrays.asList(vlanTagList.split(","));
+ subInterface.setInterfaceName(namePrefix+"_"+subInterfaceVlanTagList.get(vlanIndex));
+ subInterface.setVlans(new Vlans());
+ Vlan vlan = new Vlan();
+ vlan.setInMaint(false);
+ vlan.setIsIpUnnumbered(false);
+ vlan.setVlanIdInner(Long.parseLong(subInterfaceVlanTagList.get(vlanIndex)));
+ vlan.setVlanInterface(namePrefix+"_"+subInterfaceVlanTagList.get(vlanIndex));
+ subInterface.getVlans().getVlan().add(vlan);
if(lInterface.getLInterfaces() == null)
lInterface.setLInterfaces(new LInterfaces());
@@ -197,11 +193,12 @@ public class HeatStackAudit {
for (Resource novaResource : novaResources) {
Vserver auditVserver = new Vserver();
auditVserver.setLInterfaces(new LInterfaces());
- auditVserver.setVserverId(novaResource.getPhysicalResourceId());
+ auditVserver.setVserverId(novaResource.getPhysicalResourceId());
Stream<Port> filteredNeutronPorts = filterNeutronPorts(novaResource, neutronPortDetails);
filteredNeutronPorts.forEach(port -> {
LInterface lInterface = new LInterface();
lInterface.setInterfaceId(port.getId());
+ lInterface.setInterfaceName(port.getName());
auditVserver.getLInterfaces().getLInterface().add(lInterface);
});
vserversToAudit.add(auditVserver);
@@ -228,9 +225,9 @@ public class HeatStackAudit {
* @return List of optional neutron ports found within the cloud site and tenant
*/
protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources,String cloudSiteId,String tenantId){
- return resources.getList().stream()
+ return resources.getList().parallelStream()
.filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
- .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(),cloudSiteId,tenantId)).collect(Collectors.toList());
+ .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(),tenantId,cloudSiteId)).collect(Collectors.toList());
}
@@ -262,5 +259,6 @@ public class HeatStackAudit {
return Optional.empty();
}
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
new file mode 100644
index 0000000000..efced9d9f9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateAAIInventory.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.inventory.create;
+
+import java.util.Optional;
+import java.util.stream.Stream;
+
+import org.onap.aai.domain.yang.LInterface;
+import org.onap.so.adapters.audit.AAIObjectAudit;
+import org.onap.so.adapters.audit.AAIObjectAuditList;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateAAIInventory{
+
+ private AAIResourcesClient aaiClient;
+
+ public void createInventory(AAIObjectAuditList auditList) throws InventoryException {
+ if(didAuditFailVserverLInterfaces(auditList)){
+ throw new InventoryException("Audit failed for VServer or LInterface cannot write Sub-Interfaces");
+ }
+ auditList.getAuditList().parallelStream().filter(auditObject -> !auditObject.isDoesObjectExist() && AAIObjectType.SUB_L_INTERFACE.typeName().equals(auditObject.getAaiObjectType())).
+ forEach(auditObject -> getAaiClient().createIfNotExists(AAIUriFactory.createResourceFromExistingURI(AAIObjectType.fromTypeName(auditObject.getAaiObjectType()), auditObject.getResourceURI()), Optional.of(auditObject.getAaiObject())));
+ }
+
+
+ /**
+ * @param auditHeatStackFailed
+ * @param auditList
+ * @return
+ */
+ protected boolean didAuditFailVserverLInterfaces(AAIObjectAuditList auditList) {
+ Stream<AAIObjectAudit> issue = auditList.getAuditList().stream().filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName()) || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName()));
+
+ return issue.filter(auditObject -> !auditObject.isDoesObjectExist()).findFirst().map(v -> true).orElse(false);
+ }
+
+ protected AAIResourcesClient getAaiClient(){
+ if(aaiClient == null)
+ return new AAIResourcesClient();
+ else
+ return aaiClient;
+ }
+ protected void setAaiClient(AAIResourcesClient aaiResource){
+ aaiClient = aaiResource;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
new file mode 100644
index 0000000000..b2eadaf3c8
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.inventory.create;
+
+import java.security.GeneralSecurityException;
+
+import javax.annotation.PostConstruct;
+
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy;
+import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
+import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
+import org.onap.so.utils.CryptoUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Profile;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class CreateInventoryService {
+
+ private static final Logger logger = LoggerFactory.getLogger(CreateInventoryService.class);
+
+ @Autowired
+ public Environment env;
+
+ @Autowired
+ private CreateInventoryTask createInventory;
+
+ @PostConstruct
+ public void auditAAIInventory() {
+ String auth = "";
+ try {
+ auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
+ } catch (IllegalStateException | GeneralSecurityException e) {
+ logger.error("Error Decrypting Password", e);
+ }
+ ClientRequestInterceptor interceptor = new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"),
+ auth);
+ ExternalTaskClient client = ExternalTaskClient.create()
+ .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
+ .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build();
+ client.subscribe("InventoryCreate").lockDuration(60000)
+ .handler(createInventory::executeExternalTask).open();
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
new file mode 100644
index 0000000000..4a14b1460e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.inventory.create;
+
+import java.io.IOException;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.adapters.audit.AAIObjectAuditList;
+import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateInventoryTask {
+
+ private static final String UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI = "Unable to write all inventory to A&AI";
+
+ private static final Logger logger = LoggerFactory.getLogger(CreateInventoryTask.class);
+
+ @Autowired
+ CreateAAIInventory createInventory;
+
+ @Autowired
+ public Environment env;
+
+ protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
+ boolean success = true;
+ String auditInventoryString = externalTask.getVariable("auditInventoryResult");
+ GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
+ AAIObjectAuditList auditInventory = null;
+ try {
+ auditInventory = objectMapper.getMapper().readValue(auditInventoryString, AAIObjectAuditList.class);
+ } catch (IOException e1) {
+ success = false;
+ }
+ setupMDC(externalTask);
+
+ if (auditInventory != null) {
+ try {
+ logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", auditInventory,
+ externalTask.getRetries());
+ createInventory.createInventory(auditInventory);
+ } catch (Exception e) {
+ logger.error("Error during inventory of stack", e);
+ success = false;
+ }
+ if (success) {
+ externalTaskService.complete(externalTask);
+ logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ } else {
+ if (externalTask.getRetries() == null) {
+ logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
+ externalTask.getId(), getRetrySequence().length);
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
+ UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
+ } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ } else {
+ logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
+ externalTask.getId(), externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
+ UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, externalTask.getRetries() - 1,
+ calculateRetryDelay(externalTask.getRetries()));
+ }
+ logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ }
+ } else {
+ logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId());
+ externalTaskService.handleBpmnError(externalTask, "AAIInventoryFailure");
+ }
+ }
+
+ private void setupMDC(ExternalTask externalTask) {
+ String msoRequestId = (String)externalTask.getVariable("mso-request-id");
+ if(msoRequestId != null && !msoRequestId.isEmpty())
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ protected long calculateRetryDelay(int currentRetries){
+ int retrySequence = getRetrySequence().length - currentRetries;
+ long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier","6000"));
+ return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier;
+ }
+
+ public String[] getRetrySequence() {
+ return env.getProperty("mso.workflow.topics.retrySequence",String[].class);
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
new file mode 100644
index 0000000000..22c6902ed2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/InventoryException.java
@@ -0,0 +1,14 @@
+package org.onap.so.adapters.inventory.create;
+
+public class InventoryException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 912652713891488731L;
+
+ public InventoryException(String errorMessage) {
+ super(errorMessage);
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
index cdd04b8c21..f66d77db48 100644
--- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml
+++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml
@@ -16,6 +16,7 @@ mso:
workflow:
topics:
retryMultiplier: 60000
+ retrySequence: 1, 1, 2, 3, 5, 8, 13, 20
spring:
datasource:
url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
index bcf126d887..29e672a4a6 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -20,16 +20,24 @@
package org.onap.so.adapters.audit;
+import static org.hamcrest.CoreMatchers.isA;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.doReturn;
+import java.io.File;
import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
import java.util.Optional;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
+import org.hamcrest.Matchers;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -39,48 +47,76 @@ import org.onap.so.audit.beans.AuditInventory;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
-public class AuditCreateStackServiceTest extends AuditCreateStackService {
+public class AuditStackServiceDataTest extends AuditStackServiceData {
@InjectMocks
- AuditCreateStackService auditStackService = new AuditCreateStackService();
+ private AuditStackServiceData auditStackService = new AuditStackServiceData();
@Mock
- HeatStackAudit heatStackAuditMock;
+ private HeatStackAudit heatStackAuditMock;
@Mock
- Environment mockEnv;
+ private Environment mockEnv;
@Mock
- ExternalTask mockExternalTask;
+ private ExternalTask mockExternalTask;
@Mock
- ExternalTaskService mockExternalTaskService;
+ private ExternalTaskService mockExternalTaskService;
- AuditInventory auditInventory = new AuditInventory();
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ private AuditInventory auditInventory = new AuditInventory();
+ Optional<AAIObjectAuditList> auditListOptSuccess;
+
+ Optional<AAIObjectAuditList> auditListOptFailure;
+
@Before
- public void setup() {
+ public void setup() throws JsonParseException, JsonMappingException, IOException {
auditInventory.setCloudOwner("cloudOwner");
auditInventory.setCloudRegion("cloudRegion");
auditInventory.setTenantId("tenantId");
auditInventory.setHeatStackName("stackName");
MockitoAnnotations.initMocks(this);
+
+ AAIObjectAuditList auditListSuccess = objectMapper.readValue(new File("src/test/resources/ExpectedVServerFound.json"), AAIObjectAuditList.class);
+ auditListOptSuccess = Optional.of(auditListSuccess);
+
+ AAIObjectAuditList auditListFailure = objectMapper.readValue(new File("src/test/resources/Vserver2_Found_VServer1_Not_Found.json"), AAIObjectAuditList.class);
+ auditListOptFailure = Optional.of(auditListFailure);
+ String[] retrySequence = new String[8];
+ retrySequence[0] = "1";
+ retrySequence[1] = "1";
+ retrySequence[2] = "2";
+ retrySequence[3] = "3";
+ retrySequence[4] = "5";
+ retrySequence[5] = "8";
+ retrySequence[6] = "13";
+ retrySequence[7] = "20";
doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory");
doReturn("6000").when(mockEnv).getProperty("mso.workflow.topics.retryMultiplier","6000");
+ doReturn(retrySequence).when(mockEnv).getProperty("mso.workflow.topics.retrySequence",String[].class);
doReturn("aasdfasdf").when(mockExternalTask).getId();
}
@Test
public void execute_external_task_audit_success_Test() {
- doReturn(true).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
+ doReturn(auditListOptSuccess).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- Mockito.verify(mockExternalTaskService).complete(mockExternalTask);
+ ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
+ ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
+ Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(),captor.capture());
+ Map actualMap = captor.getValue();
+ assertEquals(true,actualMap.get("auditIsSuccessful"));
+ assertNotNull(actualMap.get("auditInventoryResult"));
}
@Test
public void execute_external_task_audit_first_failure_Test() {
- doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
+ doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
doReturn(null).when(mockExternalTask).getRetries();
auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask,
@@ -90,7 +126,7 @@ public class AuditCreateStackServiceTest extends AuditCreateStackService {
@Test
public void execute_external_task_audit_intermediate_failure_Test() {
- doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
+ doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
doReturn(6).when(mockExternalTask).getRetries();
auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask,
@@ -101,11 +137,15 @@ public class AuditCreateStackServiceTest extends AuditCreateStackService {
@Test
public void execute_external_task_audit_final_failure_Test() {
- doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
+ doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
doReturn(1).when(mockExternalTask).getRetries();
auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
- Mockito.verify(mockExternalTaskService).handleBpmnError(mockExternalTask,
- "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
+ ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);
+ ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class);
+ Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(),captor.capture());
+ Map actualMap = captor.getValue();
+ assertEquals(false,actualMap.get("auditIsSuccessful"));
+ assertNotNull(actualMap.get("auditInventoryResult"));
}
@Test
@@ -147,4 +187,17 @@ public class AuditCreateStackServiceTest extends AuditCreateStackService {
long eigthRetry = auditStackService.calculateRetryDelay(1);
assertEquals(120000L, eigthRetry);
}
+
+
+ @Test
+ public void determineAuditResult_Test() throws Exception{
+ boolean actual = auditStackService.didAuditFail(auditListOptSuccess);
+ assertEquals(false, actual);
+ }
+
+ @Test
+ public void determineAuditResult_Failure_Test() throws Exception{
+ boolean actual = auditStackService.didAuditFail(auditListOptFailure);
+ assertEquals(true, actual);
+ }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
index 9176b58de8..f0fce4db45 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -13,7 +13,7 @@
* 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
+ * See the License for the specific language governing perservice2sions and
* limitations under the License.
* ============LICENSE_END=========================================================
*/
@@ -27,6 +27,8 @@ import static org.mockito.Mockito.verify;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -48,7 +50,9 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.skyscreamer.jsonassert.JSONAssert;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -58,6 +62,8 @@ import com.woorea.openstack.heat.model.Resources;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AuditVServerTest extends AuditVServer {
+ private ObjectMapper objectMapper = new ObjectMapper();
+
@InjectMocks
private AuditVServer auditNova = new AuditVServer();
@@ -74,46 +80,43 @@ public class AuditVServerTest extends AuditVServer {
private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz");
- private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c");
-
- private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "1c56a24b-5f03-435a-850d-31cd4252de56");
+ private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_trusted_port_0");
- private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "12afcd28-929f-4d80-8a5a-0833bfd5e20b");
+ private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_service1_port_0");
- private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "80baec42-ffae-425f-ad8c-3f7b2c24bfff");
+ private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_mgmt_port_1");
- private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "13eddf95-4cf3-45f2-823a-2d890a6549b4");
+ private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_mgmt_port_0");
- private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "9cab2903-70f7-44fd-b681-491d6ae2adb8");
+ private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_service2_port_0");
- private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").queryParam("interface-id", "9cab2903-70f7-44fd-b681-491d6ae2adz1");
+ private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_int_ha_port_0");
+ private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz","test_port_1");
- private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").queryParam("interface-id", "9cab2903-70f7-44fd-b681-491d6ae2adz2");
-
-
+ private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz","test_port_2");
- private AAIResourceUri service2_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "f711be16-2654-4a09-b89d-0511fda20e81");
+ private AAIResourceUri service2_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_service2_port_0","service2_sub_interface_1");
- private AAIResourceUri service1_sub_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb");
+ private AAIResourceUri service1_sub_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_service1_port_0","service1_sub_interface_1");
- private AAIResourceUri service1_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE,
- cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "b7019dd0-2ee9-4447-bdef-ac25676b205a");
+ private AAIResourceUri service1_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE,
+ cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","ssc_1_service1_port_0","service1_sub_interface_2");
- private Set<Vserver> vserversToAudit = new HashSet<>();
+ private Set<Vserver> vserversToAudit = new HashSet<>();
LInterface test_port_1 = new LInterface();
LInterface test_port_2 = new LInterface();
@@ -126,22 +129,12 @@ public class AuditVServerTest extends AuditVServer {
LInterface service1_sub_interface_1 = new LInterface();
LInterface ssc_1_service1_port_0 = new LInterface();
LInterface ssc_1_trusted_port_0 = new LInterface();
-
- LInterfaces test_port_1_plural = new LInterfaces();
- LInterfaces test_port_2_plural = new LInterfaces();
- LInterfaces ssc_1_int_ha_port_0_plural = new LInterfaces();
- LInterfaces service2_sub_interface_1_plural = new LInterfaces();
- LInterfaces ssc_1_service2_port_0_plural = new LInterfaces();
- LInterfaces ssc_1_mgmt_port_0_plural = new LInterfaces();
- LInterfaces ssc_1_mgmt_port_1_plural = new LInterfaces();
- LInterfaces service1_sub_interface_2_plural = new LInterfaces();
- LInterfaces service1_sub_interface_1_plural = new LInterfaces();
- LInterfaces ssc_1_service1_port_0_plural = new LInterfaces();
- LInterfaces ssc_1_trusted_port_0_plural = new LInterfaces();
+
@Before
public void setup() {
+ objectMapper.setSerializationInclusion(Include.NON_NULL);
auditNova.setAaiClient(aaiResourcesMock);
Vserver vServer1= new Vserver();
@@ -150,109 +143,97 @@ public class AuditVServerTest extends AuditVServer {
vServer1.setLInterfaces(vServer1Linterfaces);
ssc_1_trusted_port_0.setInterfaceId("dec8bdc7-5718-41dc-bfbb-561ff6eeb81c");
- ssc_1_trusted_port_0.setInterfaceName("interface-name");
+ ssc_1_trusted_port_0.setInterfaceName("ssc_1_trusted_port_0");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
ssc_1_service1_port_0.setInterfaceId("1c56a24b-5f03-435a-850d-31cd4252de56");
- ssc_1_service1_port_0.setInterfaceName("interface-name");
+ ssc_1_service1_port_0.setInterfaceName("ssc_1_service1_port_0");
vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
ssc_1_service1_port_0.setLInterfaces(new LInterfaces());
service1_sub_interface_1.setInterfaceId("0d9cd813-2ae1-46c0-9ebb-48081f6cffbb");
+ service1_sub_interface_1.setInterfaceName("service1_sub_interface_1");
ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1);
service1_sub_interface_2.setInterfaceId("b7019dd0-2ee9-4447-bdef-ac25676b205a");
+ service1_sub_interface_2.setInterfaceName("service1_sub_interface_2");
ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2);
ssc_1_mgmt_port_1.setInterfaceId("12afcd28-929f-4d80-8a5a-0833bfd5e20b");
- ssc_1_mgmt_port_1.setInterfaceName("interface-name");
+ ssc_1_mgmt_port_1.setInterfaceName("ssc_1_mgmt_port_1");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
ssc_1_mgmt_port_0.setInterfaceId("80baec42-ffae-425f-ad8c-3f7b2c24bfff");
- ssc_1_mgmt_port_0.setInterfaceName("interface-name");
+ ssc_1_mgmt_port_0.setInterfaceName("ssc_1_mgmt_port_0");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
ssc_1_service2_port_0.setLInterfaces(new LInterfaces());
ssc_1_service2_port_0.setInterfaceId("13eddf95-4cf3-45f2-823a-2d890a6549b4");
- ssc_1_service2_port_0.setInterfaceName("interface-name");
+ ssc_1_service2_port_0.setInterfaceName("ssc_1_service2_port_0");
vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
- service2_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81");
+ service2_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81");
+ service2_sub_interface_1.setInterfaceName("service2_sub_interface_1");
ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1);
ssc_1_int_ha_port_0.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adb8");
+ ssc_1_int_ha_port_0.setInterfaceName("ssc_1_int_ha_port_0");
vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0);
-
Vserver vServer2= new Vserver();
vServer2.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz");
LInterfaces vServer2Linterfaces = new LInterfaces();
vServer2.setLInterfaces(vServer2Linterfaces);
test_port_1.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz1");
- test_port_1.setInterfaceName("interface-name");
+ test_port_1.setInterfaceName("test_port_1");
test_port_2.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz2");
- test_port_2.setInterfaceName("interface-name");
+ test_port_2.setInterfaceName("test_port_2");
vServer2.getLInterfaces().getLInterface().add(test_port_1);
vServer2.getLInterfaces().getLInterface().add(test_port_2);
vserversToAudit.add(vServer1);
vserversToAudit.add(vServer2);
-
-
- test_port_1_plural.getLInterface().add(test_port_1);
- test_port_2_plural.getLInterface().add(test_port_2);
- ssc_1_int_ha_port_0_plural.getLInterface().add(ssc_1_int_ha_port_0);
- ssc_1_service2_port_0_plural.getLInterface().add(ssc_1_service2_port_0);
- ssc_1_mgmt_port_0_plural.getLInterface().add(ssc_1_mgmt_port_0);
- ssc_1_mgmt_port_1_plural.getLInterface().add(ssc_1_mgmt_port_1);
- ssc_1_service1_port_0_plural.getLInterface().add(ssc_1_service1_port_0);
- ssc_1_trusted_port_0_plural.getLInterface().add(ssc_1_trusted_port_0);
-
}
@Test
public void audit_Vserver_Empty_HashSet() throws JsonParseException, JsonMappingException, IOException {
- boolean exists = auditNova.auditAllVserversDoExist(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
- assertEquals(false, exists);
-
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
- assertEquals(true, doNotExist);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
+ assertEquals(Optional.empty(), actual);
}
-
@Test
public void audit_Vserver_Found_Test() throws JsonParseException, JsonMappingException, IOException {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_1_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_1_uri);
- doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_2_uri);
+ doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
+ doReturn(Optional.of(service2_sub_interface_1)).when(aaiResourcesMock).get(LInterface.class,service1_sub_1_uri);
+ doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
+ doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
+ doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
- boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(true, exists);
-
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, doNotExist);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ String actualString = objectMapper.writeValueAsString(actual.get());
+ String expected = getJson("ExpectedVServerFound.json");
+ JSONAssert.assertEquals(expected,actualString, false);
}
@Test
@@ -260,24 +241,23 @@ public class AuditVServerTest extends AuditVServer {
throws JsonParseException, JsonMappingException, IOException {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_1_uri);
- doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_1_uri);
- doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_2_uri);
+ doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
+ doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
+ doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
+ doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
+ doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
- boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, exists);
-
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, doNotExist);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ String actualString = objectMapper.writeValueAsString(actual.get());
+ String expected = getJson("VServer_Found_network_Not_Found.json");
+ JSONAssert.assertEquals(expected,actualString, false);
}
@Test
@@ -285,70 +265,81 @@ public class AuditVServerTest extends AuditVServer {
throws JsonParseException, JsonMappingException, IOException {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
+ doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
+ doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
+ doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
- boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, exists);
-
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, doNotExist);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ String actualString = objectMapper.writeValueAsString(actual.get());
+ String expected = getJson("VServer_Found_Network_Sec_Server_Not_Found.json");
+ JSONAssert.assertEquals(expected,actualString, false);
}
@Test
- public void audit_Vservers_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
+ public void audit_Vserver_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
doReturn(false).when(aaiResourcesMock).exists(vserverURI);
doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
-
- boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, exists);
-
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(true, doNotExist);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ String actualString = objectMapper.writeValueAsString(actual.get());
+ String expected = getJson("Vservers_Not_Found.json");
+ JSONAssert.assertEquals(expected,actualString, false);
}
@Test
public void audit_Vserver_first_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
doReturn(false).when(aaiResourcesMock).exists(vserverURI);
doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
- doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
- doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
- boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, exists);
+ doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
+ doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ String actualString = objectMapper.writeValueAsString(actual.get());
+ String expected = getJson("Vserver2_Found_VServer1_Not_Found.json");
+ JSONAssert.assertEquals(expected,actualString, false);
+ }
+
+
+ @Test
+ public void doesSubInterfaceExistinAAI_Test(){
+ AAIResourceUri subInterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner,
+ cloudRegion, tenantId, "vserverId", "l-interface", "sub-interface");
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, doNotExist);
+ assertEquals("/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/vserverId/l-interfaces/l-interface/l-interface/l-interfaces/l-interface/sub-interface",subInterfaceURI.build().toString());
}
@Test
public void audit_Vserver_Second_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
doReturn(true).when(aaiResourcesMock).exists(vserverURI);
- doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
- doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
- doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
- doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
- doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
- doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
- doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
+ doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri);
+ doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri);
+ doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri);
+ doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri);
+ doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri);
+ doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
+ doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
- doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
- boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, exists);
-
- boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
- assertEquals(false, doNotExist);
+ doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
+ Optional<AAIObjectAuditList> actual = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ String actualString = objectMapper.writeValueAsString(actual.get());
+ String expected = getJson("VServer_Found_Sec_Server_Not_Found2.json");
+
+ JSONAssert.assertEquals(expected,actualString, false);
}
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
+ }
+
+
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
index 987e4cf76d..a7744a2ea7 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -26,6 +26,9 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -46,6 +49,7 @@ import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.skyscreamer.jsonassert.JSONAssert;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.heat.model.Resource;
@@ -74,9 +78,9 @@ public class HeatStackAuditTest extends HeatStackAudit {
private Resources resources = new Resources();
- private ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ private ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false).setSerializationInclusion(Include.NON_NULL);
- private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true).setSerializationInclusion(Include.NON_NULL);
private List<Optional<Port>> portList = new ArrayList<>();
@@ -131,62 +135,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
List<Resource> resourceGroups = resources.getList().stream()
.filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList());
-
- Set<Vserver> expectedVservers = new HashSet<>();
- Vserver vServer1= new Vserver();
- vServer1.setVserverId("92272b67-d23f-42ca-87fa-7b06a9ec81f3");
- LInterfaces vServer1Linterfaces = new LInterfaces();
- vServer1.setLInterfaces(vServer1Linterfaces);
-
- LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
-
-
-
- LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
-
- LInterface ssc_1_mgmt_port_0 = new LInterface();
- ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
-
- LInterface ssc_1_service2_port_0 = new LInterface();
- ssc_1_service2_port_0.setLInterfaces(new LInterfaces());
- ssc_1_service2_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
-
- LInterface service2_sub_interface_1 = new LInterface();
- service2_sub_interface_1.setInterfaceId("2bbfa345-33bb-495a-94b2-fb514ee1cffc");
- ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1);
-
- LInterface ssc_1_int_ha_port_0 = new LInterface();
- ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0);
-
-
- LInterface ssc_1_service1_port_0 = new LInterface();
- ssc_1_service1_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
- ssc_1_service1_port_0.setLInterfaces(new LInterfaces());
-
- LInterface service1_sub_interface_0 = new LInterface();
- service1_sub_interface_0.setInterfaceId("d54dfd09-75c6-4e04-b204-909455b8f933");
- ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_0);
-
- LInterface service1_sub_interface_1 = new LInterface();
- service1_sub_interface_1.setInterfaceId("f7a998c0-8939-4b07-bf4a-0862e9c325e1");
- ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1);
-
- LInterface service1_sub_interface_2 = new LInterface();
- service1_sub_interface_2.setInterfaceId("621c1fea-60b8-44ee-aede-c01b8b1aaa70");
- ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2);
-
- expectedVservers.add(vServer1);
-
-
Resources service1QueryResponse = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class);
doReturn(service1QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources", cloudRegion, tenantId, Resources.class);
@@ -219,20 +168,18 @@ public class HeatStackAuditTest extends HeatStackAudit {
Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit);
String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces);
- String expectedValue = objectMapper.writeValueAsString(expectedVservers);
-
+ String expectedValue = getJson("ExpectedVserversToAudit.json");
+ System.out.println(actualValue);
JSONAssert.assertEquals(expectedValue, actualValue, false);
}
@Test
public void auditHeatStackNoServers_Test() throws Exception{
-
-
Resources getResource = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class);
doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName");
- boolean actual = heatStackAudit.auditHeatStackCreate(cloudRegion, "cloudOwner", tenantId, "heatStackName");
- assertEquals(true, actual);
+ Optional<AAIObjectAuditList> actual = heatStackAudit.auditHeatStack(cloudRegion, "cloudOwner", tenantId, "heatStackName");
+ assertEquals(true, actual.get().getAuditList().isEmpty());
}
@@ -248,26 +195,32 @@ public class HeatStackAuditTest extends HeatStackAudit {
LInterface ssc_1_trusted_port_0 = new LInterface();
ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
+ ssc_1_trusted_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
- LInterface ssc_1_service1_port_0 = new LInterface();
- ssc_1_service1_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
+ LInterface ssc_1_svc2_port_0 = new LInterface();
+ ssc_1_svc2_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3");
+ ssc_1_svc2_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_svc2_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
+ ssc_1_mgmt_port_1.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315");
+ ssc_1_mgmt_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0);
- LInterface ssc_1_service2_port_0 = new LInterface();
- ssc_1_service2_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
- vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0);
+ LInterface ssc_1_svc1_port_0 = new LInterface();
+ ssc_1_svc1_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca");
+ ssc_1_svc1_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
+ vServer1.getLInterfaces().getLInterface().add(ssc_1_svc1_port_0);
LInterface ssc_1_int_ha_port_0 = new LInterface();
ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3");
+ ssc_1_int_ha_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port");
vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0);
expectedVservers.add(vServer1);
@@ -277,5 +230,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
assertThat(actualVservers, sameBeanAs(expectedVservers));
}
-
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
+ }
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
new file mode 100644
index 0000000000..4d34d18727
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.inventory.create;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.so.adapters.audit.AAIObjectAuditList;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class CreateAAIInventoryTest extends CreateAAIInventory {
+
+ @InjectMocks
+ private CreateAAIInventory createAAIInventory = new CreateAAIInventory();
+
+ @Mock
+ private ExternalTask mockExternalTask;
+
+ @Mock
+ private AAIResourcesClient mockClient;
+
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ private AuditInventory auditInventory = new AuditInventory();
+
+ AAIObjectAuditList auditListSuccess;
+
+ AAIObjectAuditList auditListFailure;
+
+ AAIObjectAuditList missingSubInterfaces;
+
+ @Before
+ public void setup() throws JsonParseException, JsonMappingException, IOException {
+ auditInventory.setCloudOwner("cloudOwner");
+ auditInventory.setCloudRegion("cloudRegion");
+ auditInventory.setTenantId("tenantId");
+ auditInventory.setHeatStackName("stackName");
+ MockitoAnnotations.initMocks(this);
+ auditListSuccess = objectMapper.readValue(new File("src/test/resources/ExpectedVServerFound.json"), AAIObjectAuditList.class);
+ auditListFailure = objectMapper.readValue(new File("src/test/resources/Vserver2_Found_VServer1_Not_Found.json"), AAIObjectAuditList.class);
+ missingSubInterfaces = objectMapper.readValue(new File("src/test/resources/AuditResultsMissSub.json"), AAIObjectAuditList.class);
+ doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory");
+ }
+
+ @Test
+ public void determineAuditResult_Test() throws Exception{
+ boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListSuccess);
+ assertEquals(false, actual);
+ }
+
+ @Test
+ public void determineAuditResult_Failure_Test() throws Exception{
+ boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListFailure);
+ assertEquals(true, actual);
+ }
+
+ @Test
+ public void missing_Sub_Interfaces_Test() throws Exception{
+ AAIResourceUri aaiURI2 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE,
+ "cloudOwner", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "tsbc0005v_tsbc0005vm002_svc1_port_0","tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81");
+ AAIResourceUri aaiURI1 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE,
+ "cloudOwner", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "tsbc0005v_tsbc0005vm002_svc2_port_0","tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103");
+ ArgumentCaptor<Optional> captor = ArgumentCaptor.forClass(Optional.class);
+ ArgumentCaptor<AAIResourceUri> uriCaptor = ArgumentCaptor.forClass(AAIResourceUri.class);
+
+ createAAIInventory.setAaiClient(mockClient);
+ createAAIInventory.createInventory(missingSubInterfaces);
+ Mockito.verify(mockClient,times(2)).createIfNotExists(uriCaptor.capture(),captor.capture());
+
+ List<AAIResourceUri> capturedURI = uriCaptor.getAllValues();
+ assertTrue(capturedURI.stream().anyMatch(item -> aaiURI1.build().toString().equals(item.build().toString())));
+ assertTrue(capturedURI.stream().anyMatch(item -> aaiURI2.build().toString().equals(item.build().toString())));
+
+
+
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json b/adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json
new file mode 100644
index 0000000000..13b0d6ae43
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json
@@ -0,0 +1,604 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "inMaint": null,
+ "isClosedLoopDisabled": null,
+ "linterfaces": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "volumes": null,
+ "vserverId": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "vserverName": null,
+ "vserverName2": null,
+ "vserverSelflink": null
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": null,
+ "interfaceDescription": null,
+ "interfaceId": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_trusted_port",
+ "interfaceRole": null,
+ "isIpUnnumbered": null,
+ "isPortMirrored": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": null,
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": null
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_trusted_port"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": null,
+ "interfaceDescription": null,
+ "interfaceId": "27391d94-33af-474a-927d-d409249e8fd3",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_svc2_port_0",
+ "interfaceRole": null,
+ "isIpUnnumbered": null,
+ "isPortMirrored": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "d54dfd09-75c6-4e04-b204-909455b8f933",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:27:39:1d:94:33",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 101,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "vpnKey": null
+ }
+ ]
+ }
+ },
+ {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "f7a998c0-8939-4b07-bf4a-0862e9c325e1",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:27:39:1d:94:33",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 101,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "vpnKey": null
+ }
+ ]
+ }
+ },
+ {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "621c1fea-60b8-44ee-aede-c01b8b1aaa70",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:27:39:1d:94:33",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 103,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103",
+ "vpnKey": null
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "macaddr": null,
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": null
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "d54dfd09-75c6-4e04-b204-909455b8f933",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:27:39:1d:94:33",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 101,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "vpnKey": null
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "f7a998c0-8939-4b07-bf4a-0862e9c325e1",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:27:39:1d:94:33",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 101,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101",
+ "vpnKey": null
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "621c1fea-60b8-44ee-aede-c01b8b1aaa70",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:27:39:1d:94:33",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 103,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103",
+ "vpnKey": null
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": null,
+ "interfaceDescription": null,
+ "interfaceId": "07f5b14c-147a-4d14-8c94-a9e94dbc097b",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_mgmt_port_1",
+ "interfaceRole": null,
+ "isIpUnnumbered": null,
+ "isPortMirrored": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": null,
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": null
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": null,
+ "interfaceDescription": null,
+ "interfaceId": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_mgmt_port_0",
+ "interfaceRole": null,
+ "isIpUnnumbered": null,
+ "isPortMirrored": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": null,
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": null
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": null,
+ "interfaceDescription": null,
+ "interfaceId": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_svc1_port_0",
+ "interfaceRole": null,
+ "isIpUnnumbered": null,
+ "isPortMirrored": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:05:94:a2:f2:7e",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 81,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81",
+ "vpnKey": null
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "macaddr": null,
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": null
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc1_port_0"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": false,
+ "interfaceDescription": null,
+ "interfaceId": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81",
+ "interfaceRole": null,
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": "02:05:94:a2:f2:7e",
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": {
+ "vlan": [
+ {
+ "backdoorConnection": null,
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "isPrivate": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "orchestrationStatus": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "speedUnits": null,
+ "speedValue": null,
+ "vlanDescription": null,
+ "vlanIdInner": 81,
+ "vlanIdOuter": null,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81",
+ "vpnKey": null
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc1_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81"
+ },
+ {
+ "aaiObject": {
+ "adminStatus": null,
+ "allowedAddressPairs": null,
+ "inMaint": null,
+ "interfaceDescription": null,
+ "interfaceId": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_int_ha_port_0",
+ "interfaceRole": null,
+ "isIpUnnumbered": null,
+ "isPortMirrored": null,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": null,
+ "macaddr": null,
+ "managementOption": null,
+ "networkName": null,
+ "priority": null,
+ "provStatus": null,
+ "relationshipList": null,
+ "resourceVersion": null,
+ "selflink": null,
+ "sriovVfs": null,
+ "v6WanLinkIp": null,
+ "vlans": null
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_int_ha_port_0"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json
new file mode 100644
index 0000000000..1f8e58ab5b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json
@@ -0,0 +1,167 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1",
+ "interfaceName": "test_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2",
+ "interfaceName": "test_port_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2"
+ },
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c",
+ "interfaceName": "ssc_1_trusted_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56",
+ "interfaceName": "ssc_1_service1_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b",
+ "interfaceName": "ssc_1_mgmt_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff",
+ "interfaceName": "ssc_1_mgmt_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4",
+ "interfaceName": "ssc_1_service2_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8",
+ "interfaceName": "ssc_1_int_ha_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json
new file mode 100644
index 0000000000..96fe500cc2
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json
@@ -0,0 +1,135 @@
+[
+ {
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "27391d94-33af-474a-927d-d409249e8fd3",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "inMaint": false,
+ "interfaceId": "d54dfd09-75c6-4e04-b204-909455b8f933",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101",
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "macaddr": "02:27:39:1d:94:33",
+ "vlans": {
+ "vlan": [
+ {
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "vlanIdInner": 101,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101"
+ }
+ ]
+ }
+ },
+ {
+ "inMaint": false,
+ "interfaceId": "f7a998c0-8939-4b07-bf4a-0862e9c325e1",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101",
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "macaddr": "02:27:39:1d:94:33",
+ "vlans": {
+ "vlan": [
+ {
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "vlanIdInner": 101,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101"
+ }
+ ]
+ }
+ },
+ {
+ "inMaint": false,
+ "interfaceId": "621c1fea-60b8-44ee-aede-c01b8b1aaa70",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_103",
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "macaddr": "02:27:39:1d:94:33",
+ "vlans": {
+ "vlan": [
+ {
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "vlanIdInner": 103,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_103"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "interfaceId": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "inMaint": false,
+ "interfaceId": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service2_81",
+ "isIpUnnumbered": false,
+ "isPortMirrored": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "macaddr": "02:05:94:a2:f2:7e",
+ "vlans": {
+ "vlan": [
+ {
+ "inMaint": false,
+ "isIpUnnumbered": false,
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "vlanIdInner": 81,
+ "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service2_81"
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "interfaceId": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ },
+ "vserverId": "92272b67-d23f-42ca-87fa-7b06a9ec81f3"
+ }
+]
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
index 0f3f35418e..d4745bec9f 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
@@ -4,23 +4,23 @@
"resources": [
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0",
+ "resource_name": "ssc_subint_svc1_vmi_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [
- "ssc_subint_mis_vmi_0_v6_ip_0",
- "ssc_subint_mis_vmi_0_ip_0"
+ "ssc_subint_svc1_vmi_0_v6_ip_0",
+ "ssc_subint_svc1_vmi_0_ip_0"
],
"resource_status_reason": "state changed",
"physical_resource_id": "d54dfd09-75c6-4e04-b204-909455b8f933",
@@ -28,18 +28,18 @@
},
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "resource_name": "ssc_subint_svc1_vmi_0_v6_ip_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_v6_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0_v6_ip_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [],
@@ -49,18 +49,18 @@
},
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_ip_0",
+ "resource_name": "ssc_subint_svc1_vmi_0_ip_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0_ip_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [],
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
index cfc4d7fed6..68d3e0f880 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
@@ -4,23 +4,23 @@
"resources": [
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0",
+ "resource_name": "ssc_subint_svc1_vmi_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [
- "ssc_subint_mis_vmi_0_v6_ip_0",
- "ssc_subint_mis_vmi_0_ip_0"
+ "ssc_subint_svc1_vmi_0_v6_ip_0",
+ "ssc_subint_svc1_vmi_0_ip_0"
],
"resource_status_reason": "state changed",
"physical_resource_id": "f7a998c0-8939-4b07-bf4a-0862e9c325e1",
@@ -28,18 +28,18 @@
},
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "resource_name": "ssc_subint_svc1_vmi_0_v6_ip_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_v6_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0_v6_ip_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [],
@@ -49,18 +49,18 @@
},
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_ip_0",
+ "resource_name": "ssc_subint_svc1_vmi_0_ip_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0_ip_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [],
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
index e8aa80eb6f..4f4d25d96b 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
@@ -4,23 +4,23 @@
"resources": [
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0",
+ "resource_name": "ssc_subint_svc1_vmi_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [
- "ssc_subint_mis_vmi_0_v6_ip_0",
- "ssc_subint_mis_vmi_0_ip_0"
+ "ssc_subint_svc1_vmi_0_v6_ip_0",
+ "ssc_subint_svc1_vmi_0_ip_0"
],
"resource_status_reason": "state changed",
"physical_resource_id": "621c1fea-60b8-44ee-aede-c01b8b1aaa70",
@@ -28,18 +28,18 @@
},
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "resource_name": "ssc_subint_svc1_vmi_0_v6_ip_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_v6_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0_v6_ip_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [],
@@ -49,18 +49,18 @@
},
{
"parent_resource": "0",
- "resource_name": "ssc_subint_mis_vmi_0_ip_0",
+ "resource_name": "ssc_subint_svc1_vmi_0_ip_0",
"links": [
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_ip_0",
"rel": "self"
},
{
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81",
"rel": "stack"
}
],
- "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
+ "logical_resource_id": "ssc_subint_svc1_vmi_0_ip_0",
"resource_status": "CREATE_COMPLETE",
"updated_time": "2019-01-23T19:34:56Z",
"required_by": [],
diff --git a/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json
new file mode 100644
index 0000000000..d13b4b7672
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json
@@ -0,0 +1,167 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c",
+ "interfaceName": "ssc_1_trusted_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56",
+ "interfaceName": "ssc_1_service1_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b",
+ "interfaceName": "ssc_1_mgmt_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff",
+ "interfaceName": "ssc_1_mgmt_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4",
+ "interfaceName": "ssc_1_service2_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8",
+ "interfaceName": "ssc_1_int_ha_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0"
+ },
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1",
+ "interfaceName": "test_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2",
+ "interfaceName": "test_port_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json
new file mode 100644
index 0000000000..eb0fb7ca76
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json
@@ -0,0 +1,167 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c",
+ "interfaceName": "ssc_1_trusted_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56",
+ "interfaceName": "ssc_1_service1_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b",
+ "interfaceName": "ssc_1_mgmt_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff",
+ "interfaceName": "ssc_1_mgmt_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4",
+ "interfaceName": "ssc_1_service2_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8",
+ "interfaceName": "ssc_1_int_ha_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0"
+ },
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1",
+ "interfaceName": "test_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2",
+ "interfaceName": "test_port_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json
new file mode 100644
index 0000000000..0cb47dcb5e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json
@@ -0,0 +1,167 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1",
+ "interfaceName": "test_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2",
+ "interfaceName": "test_port_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2"
+ },
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c",
+ "interfaceName": "ssc_1_trusted_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56",
+ "interfaceName": "ssc_1_service1_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b",
+ "interfaceName": "ssc_1_mgmt_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff",
+ "interfaceName": "ssc_1_mgmt_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4",
+ "interfaceName": "ssc_1_service2_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8",
+ "interfaceName": "ssc_1_int_ha_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json
new file mode 100644
index 0000000000..f3dc38d51b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json
@@ -0,0 +1,167 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1",
+ "interfaceName": "test_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2",
+ "interfaceName": "test_port_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": true,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2"
+ },
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c",
+ "interfaceName": "ssc_1_trusted_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56",
+ "interfaceName": "ssc_1_service1_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b",
+ "interfaceName": "ssc_1_mgmt_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff",
+ "interfaceName": "ssc_1_mgmt_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4",
+ "interfaceName": "ssc_1_service2_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8",
+ "interfaceName": "ssc_1_int_ha_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json
new file mode 100644
index 0000000000..d9089dc099
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json
@@ -0,0 +1,167 @@
+{
+ "auditList": [
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1",
+ "interfaceName": "test_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2",
+ "interfaceName": "test_port_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2"
+ },
+ {
+ "aaiObject": {
+ "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ "aaiObjectType": "vserver",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c",
+ "interfaceName": "ssc_1_trusted_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56",
+ "interfaceName": "ssc_1_service1_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "interfaceName": "service1_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "interfaceName": "service1_sub_interface_2",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b",
+ "interfaceName": "ssc_1_mgmt_port_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff",
+ "interfaceName": "ssc_1_mgmt_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4",
+ "interfaceName": "ssc_1_service2_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": [],
+ "linterfaces": {
+ "linterface": [
+ {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ }
+ ]
+ }
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "interfaceName": "service2_sub_interface_1",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "sub-l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1"
+ },
+ {
+ "aaiObject": {
+ "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8",
+ "interfaceName": "ssc_1_int_ha_port_0",
+ "l3InterfaceIpv4AddressList": [],
+ "l3InterfaceIpv6AddressList": []
+ },
+ "aaiObjectType": "l-interface",
+ "doesObjectExist": false,
+ "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 8da26e991e..694aedae10 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -77,6 +77,10 @@ mso:
core-pool-size: 50
max-pool-size: 50
queue-capacity: 500
+ workflow:
+ topics:
+ retryMultiplier: 60000
+ retrySequence: 1, 1, 2, 3, 5, 8, 13, 20
spring:
datasource:
url: jdbc:mariadb://localhost:3307/catalogdb
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 622e46583b..d9a38be771 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -1110,6 +1110,7 @@ CREATE TABLE `vnf_resource_customization` (
`RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) default null,
`CDS_BLUEPRINT_VERSION` varchar(20) default null,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
@@ -1191,6 +1192,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
index 043d2d309d..893df02019 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
@@ -29,6 +29,7 @@ import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
import org.onap.aai.domain.yang.RelationshipList;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIVersion;
@@ -92,20 +93,42 @@ public class AaiHelper {
* @return the VNFM to use, or <code>null</code> if no VNFM has been assigned yet
*/
public EsrVnfm getAssignedVnfm(final GenericVnf vnf) {
+ final Relationship relationship = getRelationship(vnf, "esr-vnfm");
+ final String vnfmId = getRelationshipKey(relationship, "esr-vnfm.vnfm-id");
+ return vnfmId == null ? null : aaiServiceProvider.invokeGetVnfm(vnfmId);
+ }
+
+ /**
+ * Get the tenant assigned for use for the given generic VNF.
+ *
+ * @param vnf the generic VNF
+ * @return the tenant to use, or <code>null</code> if no tenant has been assigned yet
+ */
+ public Tenant getAssignedTenant(final GenericVnf vnf) {
+ final Relationship relationship = getRelationship(vnf, "tenant");
+ final String cloudOwner = getRelationshipKey(relationship, "cloud-region.cloud-owner");
+ final String cloudRegion = getRelationshipKey(relationship, "cloud-region.cloud-region-id");
+ final String tenantId = getRelationshipKey(relationship, "tenant.tenant-id");
+ return cloudOwner == null || cloudRegion == null || tenantId == null ? null
+ : aaiServiceProvider.invokeGetTenant(cloudOwner, cloudRegion, tenantId);
+ }
+
+ private Relationship getRelationship(final GenericVnf vnf, final String relationshipRelatedToValue) {
for (final Relationship relationship : vnf.getRelationshipList() == null ? Collections.<Relationship>emptyList()
: vnf.getRelationshipList().getRelationship()) {
- if ("esr-vnfm".equals(relationship.getRelatedTo())) {
- return getRelatedVnfmId(relationship);
+ if (relationship.getRelatedTo().equals(relationshipRelatedToValue)) {
+ return relationship;
}
}
return null;
}
- private EsrVnfm getRelatedVnfmId(final Relationship relationship) {
- for (final RelationshipData relationshipData : relationship.getRelationshipData()) {
- if ("esr-vnfm.vnfm-id".equals(relationshipData.getRelationshipKey())) {
- logger.debug("VNFM URL from GenericVnf relataionship: " + relationshipData.getRelationshipValue());
- return aaiServiceProvider.invokeGetVnfm(relationshipData.getRelationshipValue());
+ private String getRelationshipKey(final Relationship relationship, final String relationshipKey) {
+ if (relationship != null) {
+ for (final RelationshipData relationshipData : relationship.getRelationshipData()) {
+ if (relationshipData.getRelationshipKey().equals(relationshipKey)) {
+ return relationshipData.getRelationshipValue();
+ }
}
}
return null;
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
index b8f0706a8e..d11da0c91b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
@@ -24,6 +24,7 @@ import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Tenant;
/**
* Provides methods for invoking REST calls to AAI.
@@ -52,7 +53,6 @@ public interface AaiServiceProvider {
*/
EsrSystemInfoList invokeGetVnfmEsrSystemInfoList(final String vnfmId);
-
/**
* Invoke a GET request for the a VNFM.
*
@@ -69,4 +69,23 @@ public interface AaiServiceProvider {
*/
void invokePutGenericVnf(GenericVnf vnf);
+ /**
+ * Invoke a GET request for the a tenant.
+ *
+ * @param cloudOwner the cloud owner
+ * @param cloudRegion the cloud region
+ * @param tenantId the ID of the tenant
+ * @return the tenant
+ */
+ Tenant invokeGetTenant(final String cloudOwner, final String cloudRegion, final String tenantId);
+
+ /**
+ * Invoke a GET request for the esr system info list for a cloud region.
+ *
+ * @param cloudOwner the cloud owner
+ * @param cloudRegion the cloud region
+ * @return the esr system info list for the VNFM
+ */
+ EsrSystemInfoList invokeGetCloudRegionEsrSystemInfoList(final String cloudOwner, final String cloudRegion);
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
index 234748e5e1..fa0dcf07f1 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
@@ -24,6 +24,7 @@ import org.onap.aai.domain.yang.EsrSystemInfoList;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.Tenant;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.slf4j.Logger;
@@ -87,4 +88,26 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
.update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()), vnf);
}
+ @Override
+ public Tenant invokeGetTenant(final String cloudOwner, final String cloudRegion, final String tenantId) {
+ return aaiClientProvider.getAaiClient()
+ .get(Tenant.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.TENANT, cloudOwner, cloudRegion, tenantId))
+ .orElseGet(() -> {
+ logger.debug("Tenant not found in AAI");
+ return null;
+ });
+ }
+
+ @Override
+ public EsrSystemInfoList invokeGetCloudRegionEsrSystemInfoList(final String cloudOwner, final String cloudRegion) {
+ return aaiClientProvider
+ .getAaiClient().get(EsrSystemInfoList.class, AAIUriFactory
+ .createResourceUri(AAIObjectType.CLOUD_ESR_SYSTEM_INFO_LIST, cloudOwner, cloudRegion))
+ .orElseGet(() -> {
+ logger.debug("Cloud esr system info list not found in AAI");
+ return null;
+ });
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java
new file mode 100644
index 0000000000..6f2827c7ff
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/AccessInfo.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.extclients.vim.model;
+
+import java.util.Objects;
+
+public class AccessInfo {
+
+ protected String projectId;
+ protected String projectName;
+ protected String domainName;
+ protected VimCredentials credentials;
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(final String value) {
+ projectId = value;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(final String value) {
+ projectName = value;
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public void setDomainName(final String value) {
+ domainName = value;
+ }
+
+ public VimCredentials getCredentials() {
+ return credentials;
+ }
+
+ public void setCredentials(final VimCredentials value) {
+ credentials = value;
+ }
+
+ @Override
+ public boolean equals(final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final AccessInfo accessInfo = (AccessInfo) o;
+ return Objects.equals(this.projectId, accessInfo.projectId)
+ && Objects.equals(this.projectName, accessInfo.projectName)
+ && Objects.equals(this.domainName, accessInfo.domainName)
+ && Objects.equals(this.credentials, accessInfo.credentials);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(projectId, projectName, domainName, credentials);
+ }
+
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AccessInfo {\n");
+
+ sb.append(" projectId: ").append(toIndentedString(projectId)).append("\n");
+ sb.append(" projectName: ").append(toIndentedString(projectName)).append("\n");
+ sb.append(" domainName: ").append(toIndentedString(domainName)).append("\n");
+ sb.append(" credentials: ").append(toIndentedString(credentials)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java
new file mode 100644
index 0000000000..c974f2bbaa
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/InterfaceInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.extclients.vim.model;
+
+import java.util.Objects;
+
+public class InterfaceInfo {
+
+ protected String identityEndPoint;
+
+ public String getIdentityEndPoint() {
+ return identityEndPoint;
+ }
+
+ public void setIdentityEndPoint(final String value) {
+ identityEndPoint = value;
+ }
+
+ @Override
+ public boolean equals(final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final InterfaceInfo interfaceInfo = (InterfaceInfo) o;
+ return Objects.equals(this.identityEndPoint, interfaceInfo.identityEndPoint);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(identityEndPoint);
+ }
+
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class InterfaceInfo {\n");
+
+ sb.append(" identityEndPoint: ").append(toIndentedString(identityEndPoint)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java
new file mode 100644
index 0000000000..35971bafe8
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vim/model/VimCredentials.java
@@ -0,0 +1,86 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.extclients.vim.model;
+
+import java.util.Objects;
+
+public class VimCredentials {
+
+ protected String username;
+
+ protected String password;
+
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(final String value) {
+ username = value;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(final String password) {
+ this.password = password;
+ }
+
+ @Override
+ public boolean equals(final java.lang.Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final VimCredentials vimCredentials = (VimCredentials) o;
+ return Objects.equals(this.username, vimCredentials.username)
+ && Objects.equals(this.password, vimCredentials.password);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(username, password);
+ }
+
+
+ @Override
+ public String toString() {
+ final StringBuilder sb = new StringBuilder();
+ sb.append("class AccessInfo {\n");
+
+ sb.append(" username: ").append(toIndentedString(username)).append("\n");
+ sb.append(" password: ").append(toIndentedString(password)).append("\n");
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /**
+ * Convert the given object to string with each line indented by 4 spaces (except the first line).
+ */
+ private String toIndentedString(final java.lang.Object o) {
+ if (o == null) {
+ return "null";
+ }
+ return o.toString().replace("\n", "\n ");
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
new file mode 100644
index 0000000000..3b2b87f661
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmHelper.java
@@ -0,0 +1,152 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
+
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.vnfmadapter.extclients.vim.model.AccessInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vim.model.InterfaceInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vim.model.VimCredentials;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.ExternalVirtualLink;
+import org.onap.vnfmadapter.v1.model.Tenant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Provides helper methods for interactions with VNFM.
+ */
+@Service
+public class VnfmHelper {
+
+ private static final Logger logger = LoggerFactory.getLogger(VnfmHelper.class);
+ private static final String SEPARATOR = "_";
+ private final AaiServiceProvider aaiServiceProvider;
+
+ @Autowired
+ public VnfmHelper(final AaiServiceProvider aaiServiceProvider) {
+ this.aaiServiceProvider = aaiServiceProvider;
+ }
+
+ /**
+ * Create an {@link InstantiateVnfRequest} to send in an instantiation request to a VNFM.
+ *
+ * @param tenant the tenant the request is to be fulfilled on
+ * @param createVnfRequest the request received by the VNFM adapter
+ */
+ public InstantiateVnfRequest createInstantiateRequest(final Tenant tenant,
+ final CreateVnfRequest createVnfRequest) {
+ final InstantiateVnfRequest instantiateVnfRequest = new InstantiateVnfRequest();
+ instantiateVnfRequest.setFlavourId(getFlavourId());
+ instantiateVnfRequest.setVimConnectionInfo(getVimConnectionInfos(tenant));
+ instantiateVnfRequest
+ .setAdditionalParams(getAdditionalParametersAsJsonObject(createVnfRequest.getAdditionalParams()));
+ instantiateVnfRequest.setExtVirtualLinks(getExternalVirtualLinks(createVnfRequest.getExternalVirtualLinks()));
+ createVnfRequest.getExternalVirtualLinks();
+ return instantiateVnfRequest;
+ }
+
+ private String getFlavourId() {
+ // TODO read from csar
+ return "default";
+ }
+
+ private List<VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo> getVimConnectionInfos(final Tenant tenant) {
+ final List<VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo> connectionInfos = new ArrayList<>();
+ connectionInfos.add(getVimConnectionInfo(tenant));
+ return connectionInfos;
+ }
+
+ private VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo getVimConnectionInfo(final Tenant tenant) {
+ final EsrSystemInfo esrSystemInfo =
+ aaiServiceProvider.invokeGetCloudRegionEsrSystemInfoList(tenant.getCloudOwner(), tenant.getRegionName())
+ .getEsrSystemInfo().iterator().next();
+
+ final VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo vnfInstancesVimConnectionInfo =
+ new VnfInstancesvnfInstanceIdinstantiateVimConnectionInfo();
+ final String vimId = createVimId(tenant.getCloudOwner(), tenant.getRegionName());
+ vnfInstancesVimConnectionInfo.setId(vimId);
+ vnfInstancesVimConnectionInfo.setVimId(vimId);
+ vnfInstancesVimConnectionInfo.setVimType(esrSystemInfo.getType());
+ vnfInstancesVimConnectionInfo.setInterfaceInfo(getInterfaceInfo(esrSystemInfo.getServiceUrl()));
+ vnfInstancesVimConnectionInfo.setAccessInfo(getAccessInfo(esrSystemInfo, tenant.getTenantId()));
+ return vnfInstancesVimConnectionInfo;
+ }
+
+ private InterfaceInfo getInterfaceInfo(final String url) {
+ final InterfaceInfo interfaceInfo = new InterfaceInfo();
+ interfaceInfo.setIdentityEndPoint(url);
+ return interfaceInfo;
+ }
+
+ private AccessInfo getAccessInfo(final EsrSystemInfo esrSystemInfo, final String tenantId) {
+ final AccessInfo accessInfo = new AccessInfo();
+ accessInfo.setProjectId(tenantId);
+ accessInfo.setDomainName(esrSystemInfo.getCloudDomain());
+
+ final VimCredentials vimCredentials = new VimCredentials();
+ vimCredentials.setUsername(esrSystemInfo.getUserName());
+ vimCredentials.setPassword(esrSystemInfo.getPassword());
+ accessInfo.setCredentials(vimCredentials);
+ return accessInfo;
+ }
+
+ private String createVimId(final String cloudOwner, final String cloudRegion) {
+ return cloudOwner + SEPARATOR + cloudRegion;
+ }
+
+ private JsonObject getAdditionalParametersAsJsonObject(final Map<String, String> additionalParameters) {
+ final JsonObject additionalParametersJsonObject = new JsonObject();
+ if (additionalParameters != null) {
+ for (final Map.Entry<String, JsonElement> item : new Gson().toJsonTree(additionalParameters)
+ .getAsJsonObject().entrySet()) {
+ additionalParametersJsonObject.add(item.getKey(), item.getValue());
+ }
+ } else {
+ logger.warn("No additional parameters were specified for the operation");
+ }
+ return additionalParametersJsonObject;
+ }
+
+ private List<VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks> getExternalVirtualLinks(
+ final List<ExternalVirtualLink> extVirtualLinks) {
+ if (extVirtualLinks != null) {
+ final String extVirtualLinksJsonObject =
+ new Gson().toJson(extVirtualLinks, new TypeToken<List<ExternalVirtualLink>>() {}.getType());
+ return new Gson().fromJson(extVirtualLinksJsonObject,
+ new TypeToken<List<VnfInstancesvnfInstanceIdinstantiateExtVirtualLinks>>() {}.getType());
+ }
+ return null;
+ }
+
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
index f0646f3cf2..aaf7e460ed 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java
@@ -23,6 +23,7 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
/**
* Provides methods for invoking REST calls to a VNFM.
@@ -38,6 +39,15 @@ public interface VnfmServiceProvider {
Optional<InlineResponse201> getVnf(final String vnfSelfLink);
/**
+ * Invoke an instantiate request for a VNF.
+ *
+ * @param vnfSelfLink the link to he VNF on the VNFM
+ * @param instantiateVnfRequest the instantiate request
+ * @return the operation ID of the instantiation operation
+ */
+ String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest);
+
+ /**
* Invoke a get request for a VNFM operation.
*
* @param vnfmId the id of the VNFM in AAI
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
index 43d4f1e0dd..4a2c7a9696 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java
@@ -23,13 +23,20 @@ package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmRequestFailureException;
import org.onap.so.rest.service.HttpRestServiceProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
@Service
public class VnfmServiceProviderImpl implements VnfmServiceProvider {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderImpl.class);
private final HttpRestServiceProvider httpServiceProvider;
private final VnfmUrlProvider urlProvider;
@@ -47,8 +54,21 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
+ public String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest) {
+ logger.debug("Sending instantiate request " + instantiateVnfRequest + " to : " + vnfSelfLink);
+ final ResponseEntity<Void> response = httpServiceProvider.getHttpResponse(vnfSelfLink, Void.class);
+ if (response.getStatusCode() != HttpStatus.ACCEPTED) {
+ throw new VnfmRequestFailureException("Instantiate request to " + vnfSelfLink + " return status code: "
+ + response.getStatusCode() + ", request: " + instantiateVnfRequest);
+ }
+ final String locationHeader = response.getHeaders().get("Location").iterator().next();
+ return locationHeader.substring(locationHeader.lastIndexOf("/") + 1);
+ }
+
+ @Override
public Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId) {
final String url = urlProvider.getOperationUrl(vnfmId, operationId);
return httpServiceProvider.get(url, InlineResponse200.class);
}
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
index f5a99b1d95..f0280d6a71 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmUrlProvider.java
@@ -46,10 +46,10 @@ public class VnfmUrlProvider {
}
/**
- * Get the URL for a generic VNF in AAI.
+ * Get the URL for an operation on a VNFM.
*
- * @param vnfId The identifier of the VNF
- * @return the URL of the VNF
+ * @param vnfmId The ID of the VNFM
+ * @return the URL of the operation
*/
public String getOperationUrl(final String vnfmId, final String operationId) {
final String url = UriComponentsBuilder.fromUri(getBaseUri(vnfmId)).pathSegment("/vnf_lcm_op_occs/")
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
index 5c944ca38b..4bedb47e3d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
@@ -24,14 +24,13 @@ import com.google.common.base.Optional;
import java.util.UUID;
import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiClientProvider;
import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiHelper;
+import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmHelper;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InstantiateVnfRequest;
import org.onap.so.adapters.vnfmadapter.jobmanagement.JobManager;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
@@ -46,17 +45,19 @@ import org.springframework.stereotype.Component;
@Component
public class LifecycleManager {
private static final Logger logger = LoggerFactory.getLogger(LifecycleManager.class);
- private final AaiClientProvider aaiClientProvider;
+ private final AaiServiceProvider aaiServiceProvider;
private final VnfmServiceProvider vnfmServiceProvider;
private final AaiHelper aaiHelper;
+ private final VnfmHelper vnfmHelper;
private final JobManager jobManager;
@Autowired
- LifecycleManager(final AaiClientProvider aaiClientProvider, final AaiHelper aaiHelper,
- final VnfmServiceProvider vnfmServiceProvider, final JobManager jobManager) {
- this.aaiClientProvider = aaiClientProvider;
+ LifecycleManager(final AaiServiceProvider aaiServiceProvider, final AaiHelper aaiHelper,
+ final VnfmHelper vnfmHelper, final VnfmServiceProvider vnfmServiceProvider, final JobManager jobManager) {
+ this.aaiServiceProvider = aaiServiceProvider;
this.vnfmServiceProvider = vnfmServiceProvider;
this.aaiHelper = aaiHelper;
+ this.vnfmHelper = vnfmHelper;
this.jobManager = jobManager;
}
@@ -77,22 +78,17 @@ public class LifecycleManager {
aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
}
- // operation ID set to random value for now, will be set correctly once we implement instantiate
- // call towards the VNFM
- final String jobId = jobManager.createJob(vnfm.getVnfmId(), UUID.randomUUID().toString(), false);
+ final String vnfIdInVnfm = sendCreateRequestToVnfm(genericVnf);
+ final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request, vnfIdInAai, vnfIdInVnfm);
+
+ final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, false);
final CreateVnfResponse response = new CreateVnfResponse();
response.setJobId(jobId);
return response;
}
private GenericVnf getGenericVnfFromAai(final String vnfIdInAai) {
- final GenericVnf genericVnf = aaiClientProvider.getAaiClient()
- .get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfIdInAai).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ final GenericVnf genericVnf = aaiServiceProvider.invokeGetGenericVnf(vnfIdInAai);
logger.debug("Retrieved generic VNF from AAI: " + genericVnf);
return genericVnf;
}
@@ -112,6 +108,23 @@ public class LifecycleManager {
}
}
+ private String sendCreateRequestToVnfm(final GenericVnf genericVnf) {
+ // TODO call create request
+ genericVnf.setSelflink("http://dummy.value/until/create/implememted/vnfId");
+ return "vnfId";
+ }
+
+ private String sendInstantiateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf,
+ final CreateVnfRequest createVnfRequest, final String vnfIdInAai, final String vnfIdInVnfm) {
+
+ final InstantiateVnfRequest instantiateVnfRequest =
+ vnfmHelper.createInstantiateRequest(createVnfRequest.getTenant(), createVnfRequest);
+ final String jobId = vnfmServiceProvider.instantiateVnf(genericVnf.getSelflink(), instantiateVnfRequest);
+
+ logger.info("Instantiate VNF request successfully sent to " + genericVnf.getSelflink());
+ return jobId;
+ }
+
/**
* Delete a VNF on a VNFM.
*
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java
new file mode 100644
index 0000000000..57a812da0a
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/exceptions/VnfmRequestFailureException.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.rest.exceptions;
+
+/**
+ * Exception indicating a request to a VNFM failed.
+ */
+public class VnfmRequestFailureException extends RuntimeException {
+
+ private static final long serialVersionUID = 6398018034431666933L;
+
+ public VnfmRequestFailureException(final String message) {
+ super(message);
+ }
+
+}
+
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index 29bab9dc6a..ae2e280b47 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.verify;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
import com.google.gson.Gson;
import java.net.URI;
@@ -90,6 +91,9 @@ public class VnfmAdapterControllerTest {
OffsetDateTime.of(LocalDateTime.of(2019, 1, 1, 12, 0), ZoneOffset.UTC);
private static final OffsetDateTime JAN_1_2019_1_00 =
OffsetDateTime.of(LocalDateTime.of(2019, 1, 1, 1, 0), ZoneOffset.UTC);
+ private static final String CLOUD_OWNER = "myTestCloudOwner";
+ private static final String REGION = "myTestRegion";
+ private static final String TENANT_ID = "myTestTenantId";
@LocalServerPort
private int port;
@@ -112,65 +116,28 @@ public class VnfmAdapterControllerTest {
@Test
public void createVnf_ValidRequest_Returns202AndJobId() throws Exception {
- final Tenant tenant =
- new Tenant().cloudOwner("myTestCloudOwner").regionName("myTestRegion").tenantId("myTestTenantId");
+ final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
- final GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("myTestVnfId");
- genericVnf.setNfType("vnfmType2");
-
- doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class), MockitoHamcrest
- .argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId?depth=1")));
-
- final EsrSystemInfo esrSystemInfo1 = new EsrSystemInfo();
- esrSystemInfo1.setServiceUrl("http://vnfm1:8080");
- esrSystemInfo1.setType("vnfmType1");
- esrSystemInfo1.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList1 = new EsrSystemInfoList();
- esrSystemInfoList1.getEsrSystemInfo().add(esrSystemInfo1);
+ setUpGenericVnfInMockAai("vnfmType2");
+ setUpVnfmsInMockAai();
+ setUpVimInMockAai();
- final EsrVnfm esrVnfm1 = new EsrVnfm();
- esrVnfm1.setVnfmId("vnfm1");
- esrVnfm1.setEsrSystemInfoList(esrSystemInfoList1);
- esrVnfm1.setResourceVersion("1234");
+ mockRestServer.expect(requestTo("http://dummy.value/until/create/implememted/vnfId"))
+ .andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
+ .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456")));
- final EsrSystemInfo esrSystemInfo2 = new EsrSystemInfo();
- esrSystemInfo2.setServiceUrl("http://vnfm2:8080");
- esrSystemInfo2.setType("vnfmType2");
- esrSystemInfo2.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList2 = new EsrSystemInfoList();
- esrSystemInfoList2.getEsrSystemInfo().add(esrSystemInfo2);
-
- final EsrVnfm esrVnfm2 = new EsrVnfm();
- esrVnfm2.setVnfmId("vnfm2");
- esrVnfm2.setEsrSystemInfoList(esrSystemInfoList2);
- esrVnfm2.setResourceVersion("1234");
-
- final EsrVnfmList esrVnfmList = new EsrVnfmList();
- esrVnfmList.getEsrVnfm().add(esrVnfm1);
- esrVnfmList.getEsrVnfm().add(esrVnfm2);
-
- doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
-
- doReturn(Optional.of(esrSystemInfoList1)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher(
- "/external-system/esr-vnfm-list/esr-vnfm/vnfm1/esr-system-info-list")));
- doReturn(Optional.of(esrSystemInfoList2)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher(
- "/external-system/esr-vnfm-list/esr-vnfm/vnfm2/esr-system-info-list")));
final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
- mockRestServer.expect(requestTo(new StringStartsWith("http://vnfm2:8080/vnf_lcm_op_occs")))
+ mockRestServer.expect(requestTo("http://vnfm2:8080/vnf_lcm_op_occs/123456"))
.andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.INSTANTIATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
- mockRestServer.expect(requestTo(new StringStartsWith("http://vnfm2:8080/vnf_lcm_op_occs")))
+ mockRestServer.expect(requestTo("http://vnfm2:8080/vnf_lcm_op_occs/123456"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
// Invoke the create request
@@ -214,138 +181,47 @@ public class VnfmAdapterControllerTest {
@Test(expected = IllegalArgumentException.class)
public void createVnf_VnfAlreadyExistsOnVnfm_ThrowsIllegalArgumentException() throws Exception {
- final Tenant tenant =
- new Tenant().cloudOwner("myTestCloudOwner").regionName("myTestRegion").tenantId("myTestTenantId");
+ final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
final GenericVnf genericVnf = new GenericVnf();
genericVnf.setVnfId("myTestVnfId");
- genericVnf.setNfType("vnfmType");
+ genericVnf.setNfType("vnfmType1");
genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm");
- doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class), MockitoHamcrest
- .argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId?depth=1")));
-
- final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
- esrSystemInfo.setServiceUrl("http://vnfm:8080");
- esrSystemInfo.setType("vnfmType");
- esrSystemInfo.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- esrSystemInfoList.getEsrSystemInfo().add(esrSystemInfo);
-
- final EsrVnfm esrVnfm = new EsrVnfm();
- esrVnfm.setVnfmId("vnfm");
- esrVnfm.setEsrSystemInfoList(esrSystemInfoList);
- esrVnfm.setResourceVersion("1234");
-
- final EsrVnfmList esrVnfmList = new EsrVnfmList();
- esrVnfmList.getEsrVnfm().add(esrVnfm);
+ doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
final InlineResponse201 reponse = new InlineResponse201();
mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")))
.andRespond(withSuccess(gson.toJson(reponse), MediaType.APPLICATION_JSON));
- doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
-
controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
}
@Test(expected = VnfmNotFoundException.class)
public void createVnf_NoMatchingVnfmFound_ThrowsException() throws Exception {
- final Tenant tenant =
- new Tenant().cloudOwner("myTestCloudOwner").regionName("myTestRegion").tenantId("myTestTenantId");
+ final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
- final GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("myTestVnfId");
- genericVnf.setNfType("anotherType");
-
- doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class), MockitoHamcrest
- .argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId?depth=1")));
-
- final EsrSystemInfo esrSystemInfo1 = new EsrSystemInfo();
- esrSystemInfo1.setServiceUrl("http://vnfm1:8080");
- esrSystemInfo1.setType("vnfmType1");
- esrSystemInfo1.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList1 = new EsrSystemInfoList();
- esrSystemInfoList1.getEsrSystemInfo().add(esrSystemInfo1);
-
- final EsrVnfm esrVnfm1 = new EsrVnfm();
- esrVnfm1.setVnfmId("vnfm1");
- esrVnfm1.setEsrSystemInfoList(esrSystemInfoList1);
- esrVnfm1.setResourceVersion("1234");
-
- final EsrSystemInfo esrSystemInfo2 = new EsrSystemInfo();
- esrSystemInfo2.setServiceUrl("http://vnfm2:8080");
- esrSystemInfo2.setType("vnfmType2");
- esrSystemInfo2.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList2 = new EsrSystemInfoList();
- esrSystemInfoList2.getEsrSystemInfo().add(esrSystemInfo2);
-
- final EsrVnfm esrVnfm2 = new EsrVnfm();
- esrVnfm2.setVnfmId("vnfm2");
- esrVnfm2.setEsrSystemInfoList(esrSystemInfoList2);
- esrVnfm2.setResourceVersion("1234");
-
- final EsrVnfmList esrVnfmList = new EsrVnfmList();
- esrVnfmList.getEsrVnfm().add(esrVnfm1);
- esrVnfmList.getEsrVnfm().add(esrVnfm2);
-
- doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
-
-
- doReturn(Optional.of(esrSystemInfoList1)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher(
- "/external-system/esr-vnfm-list/esr-vnfm/vnfm1/esr-system-info-list")));
-
- doReturn(Optional.of(esrSystemInfoList2)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher(
- "/external-system/esr-vnfm-list/esr-vnfm/vnfm2/esr-system-info-list")));
+ setUpGenericVnfInMockAai("anotherType");
+ setUpVnfmsInMockAai();
controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
}
@Test
public void createVnf_VnfmAlreadyAssociatedWithVnf_Returns202AndJobId() throws Exception {
- final Tenant tenant =
- new Tenant().cloudOwner("myTestCloudOwner").regionName("myTestRegion").tenantId("myTestTenantId");
+ final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
- final GenericVnf genericVnf = new GenericVnf();
- genericVnf.setVnfId("myTestVnfId");
- genericVnf.setNfType("vnfmType2");
-
- final Relationship relationshipToVnfm = new Relationship();
- relationshipToVnfm.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfm1");
- relationshipToVnfm.setRelatedTo("esr-vnfm");
- final RelationshipData relationshipData = new RelationshipData();
- relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
- relationshipData.setRelationshipValue("vnfm1");
- relationshipToVnfm.getRelationshipData().add(relationshipData);
-
- final RelationshipList relationshipList = new RelationshipList();
- relationshipList.getRelationship().add(relationshipToVnfm);
- genericVnf.setRelationshipList(relationshipList);
-
- doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class), MockitoHamcrest
- .argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId?depth=1")));
+ setUpGenericVnfWithVnfmRelationshipInMockAai("vnfmType2", "vnfm1");
+ setUpVnfmsInMockAai();
+ setUpVimInMockAai();
- final EsrSystemInfo esrSystemInfo1 = new EsrSystemInfo();
- esrSystemInfo1.setServiceUrl("http://vnfm1:8080");
- esrSystemInfo1.setType("vnfmType1");
- esrSystemInfo1.setSystemType("VNFM");
- final EsrSystemInfoList esrSystemInfoList1 = new EsrSystemInfoList();
- esrSystemInfoList1.getEsrSystemInfo().add(esrSystemInfo1);
-
- final EsrVnfm esrVnfm1 = new EsrVnfm();
- esrVnfm1.setVnfmId("vnfm1");
- esrVnfm1.setEsrSystemInfoList(esrSystemInfoList1);
- esrVnfm1.setResourceVersion("1234");
-
- doReturn(Optional.of(esrVnfm1)).when(aaiResourcesClient).get(eq(EsrVnfm.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1")));
+ mockRestServer.expect(requestTo("http://dummy.value/until/create/implememted/vnfId"))
+ .andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
+ .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/123456")));
final ResponseEntity<CreateVnfResponse> response =
controller.vnfCreate("myTestVnfId", createVnfRequest, "asadas", "so", "1213");
@@ -356,8 +232,7 @@ public class VnfmAdapterControllerTest {
@Test
public void createVnf_UnauthorizedUser_Returns401() throws Exception {
final TestRestTemplate restTemplateWrongPassword = new TestRestTemplate("test", "wrongPassword");
- final Tenant tenant =
- new Tenant().cloudOwner("myTestCloudOwner").regionName("myTestRegion").tenantId("myTestTenantId");
+ final Tenant tenant = new Tenant().cloudOwner(CLOUD_OWNER).regionName(REGION).tenantId(TENANT_ID);
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
final RequestEntity<CreateVnfRequest> request =
@@ -435,6 +310,101 @@ public class VnfmAdapterControllerTest {
return response;
}
+ private GenericVnf createGenericVnf(final String type) {
+ final GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId("myTestVnfId");
+ genericVnf.setNfType(type);
+ return genericVnf;
+ }
+
+ private void setUpGenericVnfInMockAai(final String type) {
+ final GenericVnf genericVnf = createGenericVnf(type);
+
+ doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
+ }
+
+ private void setUpGenericVnfWithVnfmRelationshipInMockAai(final String type, final String vnfmId) {
+ final GenericVnf genericVnf = createGenericVnf(type);
+
+ final Relationship relationshipToVnfm = new Relationship();
+ relationshipToVnfm.setRelatedLink(
+ "/aai/v15/external-system/esr-vnfm-li// final InlineResponse201 vnfInstance = new InlineResponse201();\n"
+ + "// vnfInstance.setInstantiationState(InstantiationStateEnum.NOT_INSTANTIATED);\n"
+ + "// mockRestServer.expect(requestTo(\"http://dummy.value/until/create/implememted/vnfId\"))\n"
+ + "// .andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));st/esr-vnfm/"
+ + vnfmId);
+ relationshipToVnfm.setRelatedTo("esr-vnfm");
+ final RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
+ relationshipData.setRelationshipValue(vnfmId);
+ relationshipToVnfm.getRelationshipData().add(relationshipData);
+
+ final RelationshipList relationshipList = new RelationshipList();
+ relationshipList.getRelationship().add(relationshipToVnfm);
+ genericVnf.setRelationshipList(relationshipList);
+
+ doReturn(Optional.of(genericVnf)).when(aaiResourcesClient).get(eq(GenericVnf.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher("/network/generic-vnfs/generic-vnf/myTestVnfId")));
+ }
+
+ private void setUpVnfmsInMockAai() {
+ final EsrSystemInfo esrSystemInfo1 = new EsrSystemInfo();
+ esrSystemInfo1.setServiceUrl("http://vnfm1:8080");
+ esrSystemInfo1.setType("vnfmType1");
+ esrSystemInfo1.setSystemType("VNFM");
+ final EsrSystemInfoList esrSystemInfoList1 = new EsrSystemInfoList();
+ esrSystemInfoList1.getEsrSystemInfo().add(esrSystemInfo1);
+
+ final EsrVnfm esrVnfm1 = new EsrVnfm();
+ esrVnfm1.setVnfmId("vnfm1");
+ esrVnfm1.setEsrSystemInfoList(esrSystemInfoList1);
+ esrVnfm1.setResourceVersion("1234");
+
+ final EsrSystemInfo esrSystemInfo2 = new EsrSystemInfo();
+ esrSystemInfo2.setServiceUrl("http://vnfm2:8080");
+ esrSystemInfo2.setType("vnfmType2");
+ esrSystemInfo2.setSystemType("VNFM");
+ final EsrSystemInfoList esrSystemInfoList2 = new EsrSystemInfoList();
+ esrSystemInfoList2.getEsrSystemInfo().add(esrSystemInfo2);
+
+ final EsrVnfm esrVnfm2 = new EsrVnfm();
+ esrVnfm2.setVnfmId("vnfm2");
+ esrVnfm2.setEsrSystemInfoList(esrSystemInfoList2);
+ esrVnfm2.setResourceVersion("1234");
+
+ final EsrVnfmList esrVnfmList = new EsrVnfmList();
+ esrVnfmList.getEsrVnfm().add(esrVnfm1);
+ esrVnfmList.getEsrVnfm().add(esrVnfm2);
+
+ doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
+
+ doReturn(Optional.of(esrSystemInfoList1)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher(
+ "/external-system/esr-vnfm-list/esr-vnfm/vnfm1/esr-system-info-list")));
+ doReturn(Optional.of(esrSystemInfoList2)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher(
+ "/external-system/esr-vnfm-list/esr-vnfm/vnfm2/esr-system-info-list")));
+ }
+
+ private void setUpVimInMockAai() {
+ final EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
+ esrSystemInfo.setServiceUrl("http://myVim:8080");
+ esrSystemInfo.setType("openstack");
+ esrSystemInfo.setSystemType("VIM");
+ esrSystemInfo.setCloudDomain("myDomain");
+ esrSystemInfo.setUserName("myUser");
+ esrSystemInfo.setPassword("myPassword");
+
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ esrSystemInfoList.getEsrSystemInfo().add(esrSystemInfo);
+
+ doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
+ MockitoHamcrest.argThat(new AaiResourceUriMatcher("/cloud-infrastructure/cloud-regions/cloud-region/"
+ + CLOUD_OWNER + "/" + REGION + "/esr-system-info-list")));
+ }
+
private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
final String uriAsString;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 9f914c586e..04e3782bbe 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -174,6 +174,7 @@ public class ToscaResourceInstaller {
private static String CUSTOMIZATION_UUID = "customizationUUID";
+ protected static final String SKIP_POST_INST_CONF = "skip_post_instantiation_configuration";
@Autowired
protected ServiceRepository serviceRepo;
@@ -887,13 +888,24 @@ public class ToscaResourceInstaller {
pnfResourceCustomization.setMultiStageDesign(getStringValue(properties.get(MULTI_STAGE_DESIGN)));
pnfResourceCustomization.setBlueprintName(getStringValue(properties.get(SDNC_MODEL_NAME)));
pnfResourceCustomization.setBlueprintVersion(getStringValue(properties.get(SDNC_MODEL_VERSION)));
-
+ pnfResourceCustomization.setSkipPostInstConf(getBooleanValue(properties.get(SKIP_POST_INST_CONF)));
pnfResourceCustomization.setPnfResources(pnfResource);
return pnfResourceCustomization;
}
/**
+ * Get value from {@link Property} and cast to boolean value. Return true if property is null.
+ */
+ private boolean getBooleanValue(Property property) {
+ if (null == property) {
+ return true;
+ }
+ Object value = property.getValue();
+ return new Boolean(String.valueOf(value));
+ }
+
+ /**
* Get value from {@link Property} and cast to String value. Return empty String if property is null value.
*/
private String getStringValue(Property property) {
@@ -2151,6 +2163,11 @@ public class ToscaResourceInstaller {
vnfResourceCustomization.setBlueprintVersion(testNull(toscaResourceStructure.getSdcCsarHelper()
.getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_VERSION)));
+ String skipPostInstConfText = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, SKIP_POST_INST_CONF);
+ if (skipPostInstConfText != null){
+ vnfResourceCustomization.setSkipPostInstConf(Boolean.parseBoolean(skipPostInstConfText));
+ }
+
vnfResourceCustomization.setVnfResources(vnfResource);
vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger(
vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)));
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index ec8e25dd13..2db2dfb5bf 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1114,6 +1114,7 @@ CREATE TABLE `vnf_resource_customization` (
`RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) default null,
`CDS_BLUEPRINT_VERSION` varchar(20) default null,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
@@ -1195,6 +1196,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
index c841da3e3a..289ab6e155 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
@@ -10,7 +10,8 @@
</bpmn:endEvent>
<bpmn:serviceTask id="ActivateVfModule" name="&#10;SDNC&#10;Activate&#10;(vf module)&#10;" camunda:expression="${SDNCActivateTasks.activateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_07ybdik</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_109oxx2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0arwo1o</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1a495wm</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="UpdateVfModuleActiveStatus" name="&#10;AAI&#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusActivateVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -39,14 +40,6 @@
<bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:boundaryEvent id="BoundaryEvent_1nb1hw4" attachedToRef="Audit_AAI_Inventory">
- <bpmn:outgoing>SequenceFlow_1t99ceh</bpmn:outgoing>
- <bpmn:errorEventDefinition />
- </bpmn:boundaryEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1t99ceh" sourceRef="BoundaryEvent_1nb1hw4" targetRef="Task_0swpw3v" />
- <bpmn:serviceTask id="Task_0swpw3v" name="Throw Exception" camunda:expression="${ExceptionBuilder.buildAndThrowWorkflowException(execution, &#34;AuditAAIInventoryFailure&#34;, &#34;Error Auditing Cloud Inventory in A&#38;AI&#34;)}" camunda:resultVariable="ExceptionBuilder">
- <bpmn:incoming>SequenceFlow_1t99ceh</bpmn:incoming>
- </bpmn:serviceTask>
<bpmn:exclusiveGateway id="ExclusiveGateway_1v8bmbu" default="SequenceFlow_07ybdik">
<bpmn:incoming>SequenceFlow_1xqyur9</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07ybdik</bpmn:outgoing>
@@ -56,12 +49,26 @@
<bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ActivateVfModule" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ExclusiveGateway_1h8avxn" />
<bpmn:serviceTask id="CheckAuditVariable" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0ieafii</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1xqyur9</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_1xqyur9" sourceRef="CheckAuditVariable" targetRef="ExclusiveGateway_1v8bmbu" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1h8avxn" default="SequenceFlow_1bo83qk">
+ <bpmn:incoming>SequenceFlow_0ee42yq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_109oxx2</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1bo83qk</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_109oxx2" sourceRef="ExclusiveGateway_1h8avxn" targetRef="ActivateVfModule">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditIsSuccessful")== true }]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1bo83qk" name="If Audit Fails" sourceRef="ExclusiveGateway_1h8avxn" targetRef="Create_AAI_Inventory" />
+ <bpmn:sequenceFlow id="SequenceFlow_0arwo1o" sourceRef="Create_AAI_Inventory" targetRef="ActivateVfModule" />
+ <bpmn:serviceTask id="Create_AAI_Inventory" name="Create A&#38;AI Inventory" camunda:type="external" camunda:topic="InventoryCreate">
+ <bpmn:incoming>SequenceFlow_1bo83qk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0arwo1o</bpmn:outgoing>
+ </bpmn:serviceTask>
</bpmn:process>
<bpmn:error id="Error_0q258vt" errorCode="7000" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -86,7 +93,7 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0hawa84_di" bpmnElement="ActivateVfModule">
- <dc:Bounds x="539" y="80" width="100" height="80" />
+ <dc:Bounds x="647" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_175e9ul_di" bpmnElement="UpdateVfModuleActiveStatus">
<dc:Bounds x="952" y="80" width="100" height="80" />
@@ -102,10 +109,10 @@
<dc:Bounds x="794" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1a495wm_di" bpmnElement="SequenceFlow_1a495wm">
- <di:waypoint xsi:type="dc:Point" x="639" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="747" y="120" />
<di:waypoint xsi:type="dc:Point" x="794" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="671.5" y="99" width="90" height="12" />
+ <dc:Bounds x="725.5" y="99" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1j4x1ej_di" bpmnElement="SequenceFlow_1j4x1ej">
@@ -117,36 +124,16 @@
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0xndboi_di" bpmnElement="SequenceFlow_0xndboi">
<di:waypoint xsi:type="dc:Point" x="365" y="256" />
- <di:waypoint xsi:type="dc:Point" x="452" y="256" />
- <di:waypoint xsi:type="dc:Point" x="452" y="256" />
- <di:waypoint xsi:type="dc:Point" x="539" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="408" y="256" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="422" y="249.5" width="90" height="13" />
+ <dc:Bounds x="341.5" y="234.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0krf1ur_di" bpmnElement="Setup_AAI_Inventory_Audit">
<dc:Bounds x="265" y="216" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_08rxjeb_di" bpmnElement="Audit_AAI_Inventory">
- <dc:Bounds x="539" y="216" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="BoundaryEvent_0s7rszu_di" bpmnElement="BoundaryEvent_1nb1hw4">
- <dc:Bounds x="575" y="278" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="548" y="317" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1t99ceh_di" bpmnElement="SequenceFlow_1t99ceh">
- <di:waypoint xsi:type="dc:Point" x="593" y="314" />
- <di:waypoint xsi:type="dc:Point" x="593" y="348" />
- <di:waypoint xsi:type="dc:Point" x="593" y="348" />
- <di:waypoint xsi:type="dc:Point" x="593" y="371" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="563" y="341.5" width="90" height="13" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0eujimg_di" bpmnElement="Task_0swpw3v">
- <dc:Bounds x="543" y="371" width="100" height="80" />
+ <dc:Bounds x="408" y="216" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1v8bmbu_di" bpmnElement="ExclusiveGateway_1v8bmbu" isMarkerVisible="true">
<dc:Bounds x="290" y="95" width="50" height="50" />
@@ -156,9 +143,9 @@
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_07ybdik_di" bpmnElement="SequenceFlow_07ybdik">
<di:waypoint xsi:type="dc:Point" x="340" y="120" />
- <di:waypoint xsi:type="dc:Point" x="539" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="647" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="439.5" y="98.5" width="0" height="13" />
+ <dc:Bounds x="448.5" y="98.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ghzwlo_di" bpmnElement="SequenceFlow_0ghzwlo">
@@ -169,12 +156,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0ee42yq_di" bpmnElement="SequenceFlow_0ee42yq">
- <di:waypoint xsi:type="dc:Point" x="589" y="216" />
- <di:waypoint xsi:type="dc:Point" x="589" y="193" />
- <di:waypoint xsi:type="dc:Point" x="589" y="193" />
- <di:waypoint xsi:type="dc:Point" x="589" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="508" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="566" y="256" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="604" y="186.5" width="0" height="13" />
+ <dc:Bounds x="492" y="234.5" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1eg5ryx_di" bpmnElement="CheckAuditVariable">
@@ -187,6 +172,38 @@
<dc:Bounds x="275.5" y="98.5" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1h8avxn_di" bpmnElement="ExclusiveGateway_1h8avxn" isMarkerVisible="true">
+ <dc:Bounds x="566" y="231" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="591" y="284" width="0" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_109oxx2_di" bpmnElement="SequenceFlow_109oxx2">
+ <di:waypoint xsi:type="dc:Point" x="616" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="670" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="670" y="160" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="643" y="234.5" width="0" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bo83qk_di" bpmnElement="SequenceFlow_1bo83qk">
+ <di:waypoint xsi:type="dc:Point" x="591" y="281" />
+ <di:waypoint xsi:type="dc:Point" x="591" y="345" />
+ <di:waypoint xsi:type="dc:Point" x="656" y="345" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="560" y="358" width="61" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0arwo1o_di" bpmnElement="SequenceFlow_0arwo1o">
+ <di:waypoint xsi:type="dc:Point" x="706" y="305" />
+ <di:waypoint xsi:type="dc:Point" x="706" y="160" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="721" y="226" width="0" height="13" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1eb09gr_di" bpmnElement="Create_AAI_Inventory">
+ <dc:Bounds x="656" y="305" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
index 7f70cc5756..cfb376c961 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/EtsiVnfDeleteBB.bpmn
@@ -1,38 +1,56 @@
<?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_1as67q3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
- <bpmn:process id="vnfmFoundCheck" name="vnfmFoundCheck" isExecutable="true">
+ <bpmn:process id="EtsiVnfDeleteBB" name="&#10;EtsiVnfDeleteBB" isExecutable="true">
<bpmn:startEvent id="StartEvent_0i3wi1x">
<bpmn:outgoing>SequenceFlow_01pwrcr</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:serviceTask id="ServiceTask_1d5jbsa" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${EtsiVnfDeleteTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="ServiceTask_1d5jbsb" name="&#10;Invoke VNFM Adaptor&#10;" camunda:asyncAfter="true" camunda:expression="${EtsiVnfDeleteTask.invokeVnfmAdapter(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_01pwrcr</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1064iul</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="EndEvent_1khf4qw">
- <bpmn:incoming>SequenceFlow_1064iul</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0qt5cvg</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1064iul" sourceRef="ServiceTask_1d5jbsa" targetRef="EndEvent_1khf4qw" />
- <bpmn:sequenceFlow id="SequenceFlow_01pwrcr" sourceRef="StartEvent_0i3wi1x" targetRef="ServiceTask_1d5jbsa" />
+ <bpmn:sequenceFlow id="SequenceFlow_1064iul" sourceRef="ServiceTask_1d5jbsb" targetRef="CallActivity_1f7uwws" />
+ <bpmn:sequenceFlow id="SequenceFlow_01pwrcr" sourceRef="StartEvent_0i3wi1x" targetRef="ServiceTask_1d5jbsb" />
+ <bpmn:callActivity id="CallActivity_1f7uwws" name="Monitor Delete Job" calledElement="MonitorVnfmDeleteJob">
+ <bpmn:extensionElements>
+ <camunda:in source="SDNCRequest" target="SDNCRequest" />
+ <camunda:out source="SDNCResponse" target="SDNCResponse" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1064iul</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0qt5cvg</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0qt5cvg" sourceRef="CallActivity_1f7uwws" targetRef="EndEvent_1khf4qw" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfmFoundCheck">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="EtsiVnfDeleteBB">
<bpmndi:BPMNShape id="StartEvent_0i3wi1x_di" bpmnElement="StartEvent_0i3wi1x">
<dc:Bounds x="325" y="183" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1d5jbsa_di" bpmnElement="ServiceTask_1d5jbsa">
+ <bpmndi:BPMNShape id="ServiceTask_1d5jbsa_di" bpmnElement="ServiceTask_1d5jbsb">
<dc:Bounds x="503" y="161" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1khf4qw_di" bpmnElement="EndEvent_1khf4qw">
- <dc:Bounds x="742" y="183" width="36" height="36" />
+ <dc:Bounds x="820" y="183" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1064iul_di" bpmnElement="SequenceFlow_1064iul">
<di:waypoint x="603" y="201" />
- <di:waypoint x="742" y="201" />
+ <di:waypoint x="659" y="201" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01pwrcr_di" bpmnElement="SequenceFlow_01pwrcr">
<di:waypoint x="361" y="201" />
<di:waypoint x="503" y="201" />
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1f7uwws_di" bpmnElement="CallActivity_1f7uwws">
+ <dc:Bounds x="659" y="161" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0qt5cvg_di" bpmnElement="SequenceFlow_0qt5cvg">
+ <di:waypoint x="759" y="201" />
+ <di:waypoint x="820" y="201" />
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn
new file mode 100644
index 0000000000..acd55e4fc2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/MonitorVnfmDeleteJob.bpmn
@@ -0,0 +1,160 @@
+<?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_12gnsyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.4">
+ <bpmn:process id="MonitorVnfmDeleteJob" name="MonitorVnfmDeleteJob" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_1x3tbl0</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_0rf1gde">
+ <bpmn:incoming>SequenceFlow_1543qy7</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:subProcess id="SubProcess_19j0v63">
+ <bpmn:incoming>SequenceFlow_1x3tbl0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1v4yr3f</bpmn:outgoing>
+ <bpmn:startEvent id="StartEvent_01r97z2">
+ <bpmn:outgoing>SequenceFlow_0s1plu9</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1hkl6yy" default="SequenceFlow_1vmxw9g">
+ <bpmn:incoming>SequenceFlow_153a3kp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1vmxw9g</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0is7myf</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1besn3n" name="Wait between checks" camunda:asyncAfter="true">
+ <bpmn:incoming>SequenceFlow_1vmxw9g</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0etw572</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_0qgh11t">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT15S</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:intermediateCatchEvent>
+ <bpmn:endEvent id="EndEvent_1ohsce9">
+ <bpmn:incoming>SequenceFlow_0is7myf</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0s1plu9" sourceRef="StartEvent_01r97z2" targetRef="ServiceTask_17jlnng" />
+ <bpmn:sequenceFlow id="SequenceFlow_0etw572" sourceRef="IntermediateCatchEvent_1besn3n" targetRef="ServiceTask_17jlnng" />
+ <bpmn:serviceTask id="ServiceTask_17jlnng" name="&#10;Get Current Operation Status&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmDeleteJobTask.getCurrentOperationStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0etw572</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0s1plu9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_153a3kp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1vmxw9g" sourceRef="ExclusiveGateway_1hkl6yy" targetRef="IntermediateCatchEvent_1besn3n" />
+ <bpmn:sequenceFlow id="SequenceFlow_0is7myf" sourceRef="ExclusiveGateway_1hkl6yy" targetRef="EndEvent_1ohsce9">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${MonitorVnfmCreateJobTask.hasOperationFinished(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_153a3kp" sourceRef="ServiceTask_17jlnng" targetRef="ExclusiveGateway_1hkl6yy" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_1w3t3t0" name="Timeout Exception">
+ <bpmn:incoming>SequenceFlow_0bcgtzj</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_0fjecl3" />
+ </bpmn:endEvent>
+ <bpmn:boundaryEvent id="BoundaryEvent_0xiabzp" name="Overall Wait" attachedToRef="SubProcess_19j0v63">
+ <bpmn:outgoing>SequenceFlow_1i1o9sh</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_10kqw61">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT3H</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1v4yr3f" sourceRef="SubProcess_19j0v63" targetRef="ServiceTask_1gms129" />
+ <bpmn:sequenceFlow id="SequenceFlow_1i1o9sh" sourceRef="BoundaryEvent_0xiabzp" targetRef="ServiceTask_1s87b92" />
+ <bpmn:sequenceFlow id="SequenceFlow_1x3tbl0" sourceRef="StartEvent_1" targetRef="SubProcess_19j0v63" />
+ <bpmn:serviceTask id="ServiceTask_1s87b92" name="&#10;Time Out Log Failure&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmDeleteJobTask.timeOutLogFailue(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1i1o9sh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0bcgtzj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0bcgtzj" sourceRef="ServiceTask_1s87b92" targetRef="EndEvent_1w3t3t0" />
+ <bpmn:serviceTask id="ServiceTask_1gms129" name="&#10;Check if operation was successful&#10;" camunda:asyncAfter="true" camunda:expression="${MonitorVnfmDeleteJobTask.checkIfOperationWasSuccessful(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1v4yr3f</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1543qy7</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1543qy7" sourceRef="ServiceTask_1gms129" targetRef="EndEvent_0rf1gde" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="MonitorVnfmDeleteJob">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="211" y="430" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0rf1gde_di" bpmnElement="EndEvent_0rf1gde">
+ <dc:Bounds x="1152" y="200" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_19j0v63_di" bpmnElement="SubProcess_19j0v63" isExpanded="true">
+ <dc:Bounds x="351" y="348" width="523" height="200" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1w3t3t0_di" bpmnElement="EndEvent_1w3t3t0">
+ <dc:Bounds x="1152" y="422" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1145" y="382" width="49" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_0xiabzp_di" bpmnElement="BoundaryEvent_0xiabzp">
+ <dc:Bounds x="856" y="422" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="844" y="461" width="60" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1v4yr3f_di" bpmnElement="SequenceFlow_1v4yr3f">
+ <di:waypoint x="613" y="348" />
+ <di:waypoint x="613" y="218" />
+ <di:waypoint x="973" y="218" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1i1o9sh_di" bpmnElement="SequenceFlow_1i1o9sh">
+ <di:waypoint x="892" y="440" />
+ <di:waypoint x="973" y="440" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_01r97z2_di" bpmnElement="StartEvent_01r97z2">
+ <dc:Bounds x="380" y="406" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1hkl6yy_di" bpmnElement="ExclusiveGateway_1hkl6yy" isMarkerVisible="true">
+ <dc:Bounds x="659" y="399" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_1besn3n_di" bpmnElement="IntermediateCatchEvent_1besn3n">
+ <dc:Bounds x="600" y="478" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="587" y="521" width="66" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1ohsce9_di" bpmnElement="EndEvent_1ohsce9">
+ <dc:Bounds x="772" y="406" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1x3tbl0_di" bpmnElement="SequenceFlow_1x3tbl0">
+ <di:waypoint x="247" y="448" />
+ <di:waypoint x="351" y="448" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_17jlnng_di" bpmnElement="ServiceTask_17jlnng">
+ <dc:Bounds x="475" y="384" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0s1plu9_di" bpmnElement="SequenceFlow_0s1plu9">
+ <di:waypoint x="416" y="424" />
+ <di:waypoint x="475" y="424" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0etw572_di" bpmnElement="SequenceFlow_0etw572">
+ <di:waypoint x="600" y="496" />
+ <di:waypoint x="536" y="496" />
+ <di:waypoint x="536" y="467" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vmxw9g_di" bpmnElement="SequenceFlow_1vmxw9g">
+ <di:waypoint x="684" y="449" />
+ <di:waypoint x="684" y="496" />
+ <di:waypoint x="636" y="496" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0is7myf_di" bpmnElement="SequenceFlow_0is7myf">
+ <di:waypoint x="709" y="424" />
+ <di:waypoint x="772" y="424" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_153a3kp_di" bpmnElement="SequenceFlow_153a3kp">
+ <di:waypoint x="575" y="424" />
+ <di:waypoint x="659" y="424" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1s87b92_di" bpmnElement="ServiceTask_1s87b92">
+ <dc:Bounds x="973" y="400" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0bcgtzj_di" bpmnElement="SequenceFlow_0bcgtzj">
+ <di:waypoint x="1073" y="440" />
+ <di:waypoint x="1152" y="440" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1gms128_di" bpmnElement="ServiceTask_1gms129">
+ <dc:Bounds x="973" y="178" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1543qy7_di" bpmnElement="SequenceFlow_1543qy7">
+ <di:waypoint x="1073" y="218" />
+ <di:waypoint x="1152" y="218" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
index 2dae1173d6..deac50ca30 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
@@ -40,6 +40,7 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{
public void before() {
variables.put("vfModuleActivateTimerDuration", "PT2S");
variables.put("auditInventoryNeeded", "true");
+ variables.put("auditIsSuccessful", "true");
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
index f89931063c..59ff71ab0c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmCreateJobTask.java
@@ -20,14 +20,11 @@
package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.CREATE_VNF_RESPONSE_PARAM_NAME;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_FINISHED_STATES;
-import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_RETRIEVAL_STATES;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
import org.onap.vnfmadapter.v1.model.OperationStateEnum;
-import org.onap.vnfmadapter.v1.model.QueryJobResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -40,17 +37,14 @@ import com.google.common.base.Optional;
*
*/
@Component
-public class MonitorVnfmCreateJobTask {
+public class MonitorVnfmCreateJobTask extends MonitorVnfmJobTask{
private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmCreateJobTask.class);
- private final ExceptionBuilder exceptionUtil;
- private final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
@Autowired
public MonitorVnfmCreateJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
final ExceptionBuilder exceptionUtil) {
- this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
- this.exceptionUtil = exceptionUtil;
+ super(vnfmAdapterServiceProvider, exceptionUtil);
}
/**
@@ -61,28 +55,11 @@ public class MonitorVnfmCreateJobTask {
public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
LOGGER.debug("Executing getCurrentOperationStatus ...");
final CreateVnfResponse vnfInstantiateResponse = execution.getVariable(CREATE_VNF_RESPONSE_PARAM_NAME);
- execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse));
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, vnfInstantiateResponse.getJobId()));
LOGGER.debug("Finished executing getCurrentOperationStatus ...");
}
/**
- * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
- * @return boolean to indicate whether job has competed or not
- */
- public boolean hasOperationFinished(final BuildingBlockExecution execution) {
- LOGGER.debug("Executing hasOperationFinished ...");
-
- final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
- if (operationStatusOption != null && operationStatusOption.isPresent()) {
- return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
- }
- LOGGER.debug("OperationStatus is not present yet... ");
- LOGGER.debug("Finished executing hasOperationFinished ...");
- return false;
-
- }
-
- /**
* Log and throw exception on timeout for job status
*
* @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
@@ -121,34 +98,4 @@ public class MonitorVnfmCreateJobTask {
LOGGER.debug("Successfully completed instatiation of job {}", vnfInstantiateResponse);
}
}
-
- private Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
- final CreateVnfResponse vnfInstantiateResponse) {
-
- final Optional<QueryJobResponse> instantiateOperationJobStatus =
- vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(vnfInstantiateResponse.getJobId());
-
- if (instantiateOperationJobStatus.isPresent()) {
- final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
-
- if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
- final String message =
- "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
- LOGGER.error(message);
- exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
- }
-
- if (queryJobResponse.getOperationState() != null) {
- final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
- LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
- operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
- return Optional.of(queryJobResponse.getOperationState());
- }
-
- LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
- queryJobResponse.getOperationStatusRetrievalStatus());
-
- }
- return Optional.absent();
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
new file mode 100644
index 0000000000..c4804c05c2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTask.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.DELETE_VNF_RESPONSE_PARAM_NAME;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
+
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+@Component
+public class MonitorVnfmDeleteJobTask extends MonitorVnfmJobTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmDeleteJobTask.class);
+
+ @Autowired
+ public MonitorVnfmDeleteJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ super(vnfmAdapterServiceProvider, exceptionUtil);
+ }
+
+ /**
+ * Get the current operation status of Delete job
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void getCurrentOperationStatus(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing getCurrentOperationStatus ...");
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME);
+ execution.setVariable(OPERATION_STATUS_PARAM_NAME, getOperationStatus(execution, deleteVnfResponse.getJobId()));
+ LOGGER.debug("Finished executing getCurrentOperationStatus ...");
+ }
+
+ /**
+ * Log and throw exception on timeout for job status
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void timeOutLogFailue(final BuildingBlockExecution execution) {
+ final String message = "Delete operation time out";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1213, message);
+ }
+
+ /**
+ * Check the final status of delete throw exception if not completed successfully
+ *
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ */
+ public void checkIfOperationWasSuccessful(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing checkIfOperationWasSuccessful ...");
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ final DeleteVnfResponse deleteVnfResponse = execution.getVariable(DELETE_VNF_RESPONSE_PARAM_NAME);
+ if (operationStatusOption == null || !operationStatusOption.isPresent()) {
+ final String message = "Unable to delete jobId: "
+ + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null") + "Unable to retrieve OperationStatus";
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1214, message);
+ }
+ if (operationStatusOption.isPresent()) {
+ final OperationStateEnum operationStatus = operationStatusOption.get();
+ if (operationStatus != OperationStateEnum.COMPLETED) {
+ final String message =
+ "Unable to Delete jobId: " + (deleteVnfResponse != null ? deleteVnfResponse.getJobId() : "null")
+ + " OperationStatus: " + operationStatus;
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1215, message);
+ }
+ LOGGER.debug("Successfully completed Deletion of job {}", deleteVnfResponse);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
new file mode 100644
index 0000000000..e3992428cb
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmJobTask.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Ericsson. 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_FINISHED_STATES;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_RETRIEVAL_STATES;
+import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.OPERATION_STATUS_PARAM_NAME;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import com.google.common.base.Optional;
+
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+@Component
+public class MonitorVnfmJobTask {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(MonitorVnfmJobTask.class);
+ protected final ExceptionBuilder exceptionUtil;
+ protected final VnfmAdapterServiceProvider vnfmAdapterServiceProvider;
+
+ @Autowired
+ public MonitorVnfmJobTask(final VnfmAdapterServiceProvider vnfmAdapterServiceProvider,
+ final ExceptionBuilder exceptionUtil) {
+ this.vnfmAdapterServiceProvider = vnfmAdapterServiceProvider;
+ this.exceptionUtil = exceptionUtil;
+ }
+
+ /**
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @return boolean to indicate whether job has competed or not
+ */
+ public boolean hasOperationFinished(final BuildingBlockExecution execution) {
+ LOGGER.debug("Executing hasOperationFinished ...");
+
+ final Optional<OperationStateEnum> operationStatusOption = execution.getVariable(OPERATION_STATUS_PARAM_NAME);
+ if (operationStatusOption != null && operationStatusOption.isPresent()) {
+ return OPERATION_FINISHED_STATES.contains(operationStatusOption.get());
+ }
+ LOGGER.debug("OperationStatus is not present yet... ");
+ LOGGER.debug("Finished executing hasOperationFinished ...");
+ return false;
+ }
+
+ /**
+ * This method calls the Vnfm adapter and gets the Operation status of the job
+ * @param execution {@link org.onap.so.bpmn.common.DelegateExecutionImpl}
+ * @param jobId unique job id
+ * @return Operation State
+ */
+ protected Optional<OperationStateEnum> getOperationStatus(final BuildingBlockExecution execution,
+ final String jobId) {
+
+ final Optional<QueryJobResponse> instantiateOperationJobStatus =
+ vnfmAdapterServiceProvider.getInstantiateOperationJobStatus(jobId);
+
+ if (instantiateOperationJobStatus.isPresent()) {
+ final QueryJobResponse queryJobResponse = instantiateOperationJobStatus.get();
+
+ if (!OPERATION_RETRIEVAL_STATES.contains(queryJobResponse.getOperationStatusRetrievalStatus())) {
+ final String message =
+ "Recevied invalid operation reterivel state: " + queryJobResponse.getOperationStatusRetrievalStatus();
+ LOGGER.error(message);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1203, message);
+ }
+ if (queryJobResponse.getOperationState() != null) {
+ final OperationStateEnum operationStatus = queryJobResponse.getOperationState();
+ LOGGER.debug("Operation {} with {} and operation retrieval status : {}", queryJobResponse.getId(),
+ operationStatus, queryJobResponse.getOperationStatusRetrievalStatus());
+ return Optional.of(queryJobResponse.getOperationState());
+ }
+
+ LOGGER.debug("Operation {} without operationStatus and operation retrieval status :{}", queryJobResponse.getId(),
+ queryJobResponse.getOperationStatusRetrievalStatus());
+ }
+ return Optional.absent();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
new file mode 100644
index 0000000000..e41c571765
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/MonitorVnfmDeleteJobTaskTest.java
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.UUID;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.vnfmadapter.v1.model.DeleteVnfResponse;
+import org.onap.vnfmadapter.v1.model.OperationStateEnum;
+import org.onap.vnfmadapter.v1.model.OperationStatusRetrievalStatusEnum;
+import org.onap.vnfmadapter.v1.model.QueryJobResponse;
+import com.google.common.base.Optional;
+
+/**
+ *
+ * @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
+ *
+ */
+public class MonitorVnfmDeleteJobTaskTest extends BaseTaskTest {
+
+ private static final String JOB_ID = UUID.randomUUID().toString();
+
+ private MonitorVnfmDeleteJobTask objUnderTest;
+
+ @Mock
+ private VnfmAdapterServiceProvider mockedVnfmAdapterServiceProvider;
+
+ private final BuildingBlockExecution stubbedxecution = new StubbedBuildingBlockExecution();
+
+ @Before
+ public void setUp() {
+ objUnderTest = getEtsiVnfMonitorJobTask();
+ stubbedxecution.setVariable(Constants.DELETE_VNF_RESPONSE_PARAM_NAME, getDeleteVnfResponse());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatus() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ queryJobResponse.get().setOperationState(OperationStateEnum.COMPLETED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.COMPLETED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusFailed() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.CANNOT_RETRIEVE_STATUS);
+ queryJobResponse.get().setOperationState(OperationStateEnum.FAILED);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertNotNull(operationState);
+ assertEquals(OperationStateEnum.FAILED, operationState.get());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusEmpty() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testGetCurrentOperationStatusException() throws Exception {
+ Optional<QueryJobResponse> queryJobResponse = getQueryJobResponse();
+ queryJobResponse.get().setOperationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.STATUS_FOUND);
+ when(mockedVnfmAdapterServiceProvider.getInstantiateOperationJobStatus(JOB_ID)).thenReturn(queryJobResponse);
+ objUnderTest.getCurrentOperationStatus(stubbedxecution);
+ final Optional<OperationStateEnum> operationState =
+ stubbedxecution.getVariable(Constants.OPERATION_STATUS_PARAM_NAME);
+ assertFalse(operationState.isPresent());
+ }
+
+ @Test
+ public void testHasOperationFinished() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ assertTrue(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testHasOperationPending() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ assertFalse(objUnderTest.hasOperationFinished(stubbedxecution));
+ }
+
+ @Test
+ public void testTimeOutLogFailue() throws Exception {
+ objUnderTest.timeOutLogFailue(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1213),
+ eq("Delete operation time out"));
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessful() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.COMPLETED));
+ MonitorVnfmDeleteJobTask spyObject = Mockito.spy(objUnderTest);
+ spyObject.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(spyObject, times(1)).checkIfOperationWasSuccessful(stubbedxecution);
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulWithPending() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.of(OperationStateEnum.PROCESSING));
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1215), anyString());
+ }
+
+ @Test
+ public void testCheckIfOperationWasSuccessfulEmpty() throws Exception {
+ stubbedxecution.setVariable(Constants.OPERATION_STATUS_PARAM_NAME, Optional.absent());
+ objUnderTest.checkIfOperationWasSuccessful(stubbedxecution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(1214), anyString());
+ }
+
+ private DeleteVnfResponse getDeleteVnfResponse() {
+ final DeleteVnfResponse response = new DeleteVnfResponse();
+ response.setJobId(JOB_ID);
+ return response;
+ }
+
+ private Optional<QueryJobResponse> getQueryJobResponse() {
+ final QueryJobResponse queryJobResponse = new QueryJobResponse();
+ queryJobResponse.setId(JOB_ID);
+ return Optional.of(queryJobResponse);
+ }
+
+ private MonitorVnfmDeleteJobTask getEtsiVnfMonitorJobTask() {
+ return new MonitorVnfmDeleteJobTask(mockedVnfmAdapterServiceProvider, exceptionUtil);
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index f6aa2fdb19..1807a0b95a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -138,6 +138,7 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType EXT_AAI_NETWORK = new AAIObjectType(AAINamespaceConstants.NETWORK, ExtAaiNetwork.class);
public static final AAIObjectType AGGREGATE_ROUTE = new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
public static final AAIObjectType L_INTERFACE = new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
+ public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), "/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
public static final AAIObjectType FLAVOR = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Flavor.class);
public static final AAIObjectType UNKNOWN = new AAIObjectType("", "", "unknown");
@@ -145,6 +146,7 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable {
public static final AAIObjectType VNFM = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list/esr-vnfm/{vnfm-id}", EsrVnfm.class);
public static final AAIObjectType VNFM_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM, "/esr-vnfm-list", "vnfm-list");
public static final AAIObjectType VNFM_ESR_SYSTEM_INFO_LIST = new AAIObjectType(AAINamespaceConstants.EXTERNAL_SYSTEM + "/esr-vnfm-list", "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list");
+ public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list");
private final String uriTemplate;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
index b2d40b8409..0c236897cb 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
@@ -85,6 +85,9 @@ public class PnfResourceCustomization implements Serializable {
@Column(name = "CDS_BLUEPRINT_VERSION")
private String blueprintVersion;
+ @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
+ private Boolean skipPostInstConf;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
@@ -217,4 +220,12 @@ public class PnfResourceCustomization implements Serializable {
this.blueprintVersion = blueprintVersion;
}
+ public Boolean isSkipPostInstConf() {
+ return skipPostInstConf;
+ }
+
+ public void setSkipPostInstConf(Boolean skipPostInstConf) {
+ this.skipPostInstConf = skipPostInstConf;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index e569c3b994..1cbc7b561f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -122,6 +122,9 @@ public class VnfResourceCustomization implements Serializable {
@Column(name = "CDS_BLUEPRINT_VERSION")
private String blueprintVersion;
+ @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
+ private Boolean skipPostInstConf;
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof VnfResourceCustomization)) {
@@ -318,4 +321,11 @@ public class VnfResourceCustomization implements Serializable {
this.blueprintVersion = blueprintVersion;
}
+ public Boolean isSkipPostInstConf() {
+ return skipPostInstConf;
+ }
+
+ public void setSkipPostInstConf(Boolean skipPostInstConf) {
+ this.skipPostInstConf = skipPostInstConf;
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
index 7ac80e222f..4ba344c845 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
@@ -21,6 +21,7 @@ package org.onap.so.db.catalog.data.repository;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.onap.so.db.catalog.BaseTest;
@@ -46,6 +47,7 @@ public class PnfCustomizationRepositoryTest extends BaseTest {
assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
+ assertTrue("skip post instantiation configuration", pnfResourceCustomization.isSkipPostInstConf());
PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
assertNotNull(pnfResource);
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index e61f5fc553..9002c92172 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -1110,6 +1110,7 @@ CREATE TABLE `vnf_resource_customization` (
`RESOURCE_INPUT` varchar(20000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) default null,
`CDS_BLUEPRINT_VERSION` varchar(20) default null,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
`CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
`SERVICE_MODEL_UUID` varchar(200) NOT NULL,
@@ -1191,6 +1192,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
`RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
`CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
`CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true,
PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE