aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java2
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java20
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java65
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProvider.java27
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java73
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderImpl.java55
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java9
-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/notificationhandling/NotificationHandler.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java40
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java43
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java39
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java79
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java20
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java111
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java75
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java10
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java7
-rw-r--r--docs/api/apis/SO_Interface.rst480
-rw-r--r--docs/architecture/architecture.rst32
-rw-r--r--docs/installconfigure/Install_Configure_SO.rst20
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java37
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java31
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java13
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json21
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java2
-rw-r--r--vnfm-simulator/vnfm-service/pom.xml5
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java28
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java49
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java31
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java36
49 files changed, 1371 insertions, 525 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index dd43837c76..e821d806dd 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -981,7 +981,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
return null;
}
} else if (("boolean").equalsIgnoreCase(type)) {
- return new Boolean(inputValue.toString());
+ return Boolean.valueOf(inputValue.toString());
}
// Nothing else matched. Return the original string
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java
index 2f99fed875..4a5a6119cd 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java
@@ -37,6 +37,16 @@ public class VduArtifact {
private byte[] content;
private ArtifactType type;
+ // Default constructor
+ public VduArtifact() {}
+
+ // Fully specified constructor
+ public VduArtifact(String name, byte[] content, ArtifactType type) {
+ this.name = name;
+ this.content = content;
+ this.type = type;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof VduArtifact)) {
@@ -52,16 +62,6 @@ public class VduArtifact {
return new HashCodeBuilder().append(name).append(content).append(type).toHashCode();
}
- // Default constructor
- public VduArtifact() {}
-
- // Fully specified constructor
- public VduArtifact(String name, byte[] content, ArtifactType type) {
- this.name = name;
- this.content = content;
- this.type = type;
- }
-
public String getName() {
return name;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
index fb8fb2ed84..6f24e60514 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +26,6 @@ import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.so.entity.MsoRequest;
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 06fff19205..ffa76cf8ee 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
@@ -3,6 +3,8 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ *
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +38,6 @@ 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.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index d9f47f5c3a..c934291246 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -330,14 +330,15 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
} else {
// Populate the outputs from the existing stack.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- rollback.value = networkRollback; // Default rollback - no updates performed
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
- }
- Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
- if (outputs != null) {
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ rollback.value = networkRollback; // Default rollback - no updates performed
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
+ Map<String, Object> outputs = heatStack.getOutputs();
+
for (Map.Entry<String, Object> entry : outputs.entrySet()) {
String key = entry.getKey();
if (key != null && key.startsWith("subnet")) {
@@ -437,9 +438,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
// For Heat-based orchestration, the MSO-tracked network ID is the heat stack,
// and the neutronNetworkId is the network UUID returned in stack outputs.
networkId.value = heatStack.getCanonicalName();
- neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
- if (aic3template) {
- networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ if (heatStack.getOutputs() != null) {
+ neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID);
+ if (aic3template) {
+ networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN);
+ }
}
Map<String, Object> outputs = heatStack.getOutputs();
Map<String, String> sMap = new HashMap<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index 2d77bf625a..70fb0b3857 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -339,7 +339,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
return null;
}
} else if ("boolean".equalsIgnoreCase(type)) {
- return new Boolean(inputValue.toString());
+ return Boolean.valueOf(inputValue.toString());
}
// Nothing else matched. Return the original string
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
index 3e5d4ad29a..16cc2c34de 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java
@@ -62,40 +62,37 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils {
cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369");
}
- @Test
- public void queryVnfExceptionTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- Holder<Map<String, String>> outputs = new Holder<>();
- instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), outputs);
-
- assertTrue(outputs.value.isEmpty());
- }
-
- @Test
- public void queryVnfTest() throws Exception {
- MsoRequest msoRequest = new MsoRequest();
- msoRequest.setRequestId("12345");
- msoRequest.setServiceInstanceId("12345");
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
- .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
- .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
- .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
- .withStatus(HttpStatus.SC_OK)));
-
- wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens"))
- .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK)));
-
- instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(),
- new Holder<>(), new Holder<>());
- }
+ /*
+ * @Test public void queryVnfExceptionTest() throws Exception { MsoRequest msoRequest = new MsoRequest();
+ * msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); Holder<Map<String, String>> outputs =
+ * new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new
+ * Holder<>(), new Holder<>(), outputs);
+ *
+ * assertTrue(outputs.value.isEmpty()); }
+ */
+
+ /*
+ * @Test public void queryVnfTest() throws Exception {
+ *
+ *
+ * MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345");
+ * msoRequest.setServiceInstanceId("12345");
+ * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname"))
+ * .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK)));
+ *
+ * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs"))
+ * .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }")
+ * .withStatus(HttpStatus.SC_OK)));
+ *
+ * wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse()
+ * .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ")
+ * .withStatus(HttpStatus.SC_OK)));
+ *
+ * instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new
+ * Holder<>(), new Holder<>());
+ *
+ * }
+ */
@Test
public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index e2dd64d0f4..bc491a6fc5 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -108,6 +108,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>2.3.6.RELEASE</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.so.adapters</groupId>
<artifactId>mso-adapters-rest-interface</artifactId>
<version>${project.version}</version>
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 7a0df0fdba..cb8c7c4e56 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
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
@@ -37,63 +38,67 @@ public interface VnfmServiceProvider {
/**
* Invoke a get request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to the VNF in the VNFM
* @return the VNF from the VNFM
*/
- Optional<InlineResponse201> getVnf(final String vnfSelfLink);
+ Optional<InlineResponse201> getVnf(final EsrVnfm vnfm, final String vnfSelfLink);
/**
* Invoke an instantiate request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @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);
+ String instantiateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final InstantiateVnfRequest instantiateVnfRequest);
/**
* Invoke a notification subscription request to a VNFM.
*
- * @param vnfmId the ID of the VNFM
+ * @param vnfm the VNFM in AAI
* @param subscriptionRequest
* @return the response to the subscription request
*/
- InlineResponse2001 subscribeForNotifications(final String vnfmId,
- final LccnSubscriptionRequest subscriptionRequest);
+ InlineResponse2001 subscribeForNotifications(final EsrVnfm vnfm, final LccnSubscriptionRequest subscriptionRequest);
/**
* Invoke a terminate request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @param terminateVnfRequest the terminate request
* @return the operation ID of the termination operation
*/
- String terminateVnf(final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest);
+ String terminateVnf(final EsrVnfm vnfm, final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest);
/**
* Invoke a delete request for a VNF.
*
+ * @param vnfm the VNFM in AAI
* @param vnfSelfLink the link to he VNF on the VNFM
* @return the operation ID of the instantiation operation
*/
- void deleteVnf(final String vnfSelfLink);
+ void deleteVnf(final EsrVnfm vnfm, final String vnfSelfLink);
/**
* Invoke a get request for a VNFM operation.
*
- * @param vnfmId the id of the VNFM in AAI
+ * @param vnfm the VNFM in AAI
* @param operationId the id of the operation on the VNFM
* @return the operation from the VNFM
*/
- Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId);
+ Optional<InlineResponse200> getOperation(final EsrVnfm vnfm, final String operationId);
/**
* Invoke a create request to a VNFM
*
- * @param vnfmId the id of the VNFM in AAI
+ * @param vnfm the VNFM in AAI
* @param createVnfRequest the parameters for creating a VNF
* @return the newly created VNF
*/
- Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest);
+ Optional<InlineResponse201> createVnf(final EsrVnfm vnfm, final CreateVnfRequest createVnfRequest);
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index ab631837db..a604f9a6b9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -29,14 +29,19 @@ import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.util.Iterator;
import java.util.ListIterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
import javax.net.ssl.SSLContext;
+import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
+import org.onap.aai.domain.yang.EsrSystemInfo;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
@@ -45,7 +50,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.ClientHttpRequestInterceptor;
@@ -53,6 +57,8 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.security.oauth2.client.OAuth2RestTemplate;
+import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.web.client.RestTemplate;
/**
@@ -62,26 +68,63 @@ import org.springframework.web.client.RestTemplate;
public class VnfmServiceProviderConfiguration {
private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class);
+ private Map<String, HttpRestServiceProvider> mapOfVnfmIdToHttpRestServiceProvider = new ConcurrentHashMap<>();
@Value("${http.client.ssl.trust-store:#{null}}")
- private Resource keyStore;
+ private Resource trustStore;
@Value("${http.client.ssl.trust-store-password:#{null}}")
- private String keyStorePassword;
+ private String trustPassword;
- @Bean(name = "vnfmServiceProvider")
- public HttpRestServiceProvider httpRestServiceProvider(
- @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate) {
- return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider());
+ /**
+ * This property is only intended to be temporary until the AAI schema is updated to support setting the endpoint
+ */
+ @Value("${vnfmadapter.temp.vnfm.oauth.endpoint:#{null}}")
+ private String oauthEndpoint;
+
+ @Qualifier(CONFIGURABLE_REST_TEMPLATE)
+ @Autowired()
+ private RestTemplate defaultRestTemplate;
+
+ public HttpRestServiceProvider getHttpRestServiceProvider(final EsrVnfm vnfm) {
+ if (!mapOfVnfmIdToHttpRestServiceProvider.containsKey(vnfm.getVnfmId())) {
+ mapOfVnfmIdToHttpRestServiceProvider.put(vnfm.getVnfmId(), createHttpRestServiceProvider(vnfm));
+ }
+ return mapOfVnfmIdToHttpRestServiceProvider.get(vnfm.getVnfmId());
}
- private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate,
- final HttpHeadersProvider httpHeadersProvider) {
+ private HttpRestServiceProvider createHttpRestServiceProvider(final EsrVnfm vnfm) {
+ final RestTemplate restTemplate = createRestTemplate(vnfm);
setGsonMessageConverter(restTemplate);
- if (keyStore != null) {
+ if (trustStore != null) {
setTrustStore(restTemplate);
}
removeSpringClientFilter(restTemplate);
- return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider);
+ return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider());
+ }
+
+ private RestTemplate createRestTemplate(final EsrVnfm vnfm) {
+ if (vnfm != null) {
+ for (final EsrSystemInfo esrSystemInfo : vnfm.getEsrSystemInfoList().getEsrSystemInfo()) {
+ if (!StringUtils.isEmpty(esrSystemInfo.getUserName())
+ && !StringUtils.isEmpty(esrSystemInfo.getPassword())) {
+ return createOAuth2RestTemplate(esrSystemInfo);
+ }
+ }
+ }
+ return defaultRestTemplate;
+ }
+
+ private OAuth2RestTemplate createOAuth2RestTemplate(final EsrSystemInfo esrSystemInfo) {
+ logger.debug("Getting OAuth2RestTemplate ...");
+ final ClientCredentialsResourceDetails resourceDetails = new ClientCredentialsResourceDetails();
+ resourceDetails.setId(UUID.randomUUID().toString());
+ resourceDetails.setClientId(esrSystemInfo.getUserName());
+ resourceDetails.setClientSecret(esrSystemInfo.getPassword());
+ resourceDetails.setAccessTokenUri(
+ oauthEndpoint == null ? esrSystemInfo.getServiceUrl().replace("vnflcm/v1", "oauth/token")
+ : oauthEndpoint);
+ resourceDetails.setGrantType("client_credentials");
+ return new OAuth2RestTemplate(resourceDetails);
}
private void setGsonMessageConverter(final RestTemplate restTemplate) {
@@ -98,9 +141,9 @@ public class VnfmServiceProviderConfiguration {
private void setTrustStore(final RestTemplate restTemplate) {
SSLContext sslContext;
try {
- sslContext = new SSLContextBuilder().loadTrustMaterial(keyStore.getURL(), keyStorePassword.toCharArray())
- .build();
- logger.info("Setting truststore: {}", keyStore.getURL());
+ sslContext =
+ new SSLContextBuilder().loadTrustMaterial(trustStore.getURL(), trustPassword.toCharArray()).build();
+ logger.info("Setting truststore: {}", trustStore.getURL());
final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
final HttpComponentsClientHttpRequestFactory factory =
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 c470008d08..948f5fc269 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
@@ -21,6 +21,7 @@
package org.onap.so.adapters.vnfmadapter.extclients.vnfm;
import com.google.common.base.Optional;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse2001;
@@ -33,7 +34,6 @@ 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;
@@ -42,28 +42,29 @@ import org.springframework.stereotype.Service;
public class VnfmServiceProviderImpl implements VnfmServiceProvider {
private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderImpl.class);
- private final HttpRestServiceProvider httpServiceProvider;
+ private final VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration;
private final VnfmUrlProvider urlProvider;
@Autowired
public VnfmServiceProviderImpl(final VnfmUrlProvider urlProvider,
- @Qualifier("vnfmServiceProvider") final HttpRestServiceProvider httpServiceProvider) {
- this.httpServiceProvider = httpServiceProvider;
+ VnfmServiceProviderConfiguration vnfmServiceProviderConfiguration) {
+ this.vnfmServiceProviderConfiguration = vnfmServiceProviderConfiguration;
this.urlProvider = urlProvider;
}
@Override
- public Optional<InlineResponse201> getVnf(final String vnfSelfLink) {
- return httpServiceProvider.get(vnfSelfLink, InlineResponse201.class);
+ public Optional<InlineResponse201> getVnf(final EsrVnfm vnfm, final String vnfSelfLink) {
+ return getHttpServiceProvider(vnfm).get(vnfSelfLink, InlineResponse201.class);
}
@Override
- public String instantiateVnf(final String vnfSelfLink, final InstantiateVnfRequest instantiateVnfRequest) {
+ public String instantiateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final InstantiateVnfRequest instantiateVnfRequest) {
logger.debug("Sending instantiate request " + instantiateVnfRequest + " to : " + vnfSelfLink);
ResponseEntity<Void> response = null;
try {
- response = httpServiceProvider.postHttpRequest(instantiateVnfRequest, vnfSelfLink + "/instantiate",
+ response = getHttpServiceProvider(vnfm).postHttpRequest(instantiateVnfRequest, vnfSelfLink + "/instantiate",
Void.class);
} catch (final Exception exception) {
final String errorMessage =
@@ -82,22 +83,22 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public InlineResponse2001 subscribeForNotifications(final String vnfmId,
+ public InlineResponse2001 subscribeForNotifications(final EsrVnfm vnfm,
final LccnSubscriptionRequest subscriptionRequest) {
logger.info("Subscribing for notifications {}", subscriptionRequest);
- final String url = urlProvider.getSubscriptionsUrl(vnfmId);
+ final String url = urlProvider.getSubscriptionsUrl(vnfm.getVnfmId());
ResponseEntity<InlineResponse2001> response = null;
try {
- response = httpServiceProvider.postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
+ response = getHttpServiceProvider(vnfm).postHttpRequest(subscriptionRequest, url, InlineResponse2001.class);
logger.info("Subscribing for notifications response {}", response);
} catch (final Exception exception) {
final String errorMessage =
- "Subscription to VNFM " + vnfmId + " resulted in exception" + subscriptionRequest;
+ "Subscription to VNFM " + vnfm.getVnfmId() + " resulted in exception" + subscriptionRequest;
logger.error(errorMessage, exception);
throw new VnfmRequestFailureException(errorMessage, exception);
}
if (response.getStatusCode() != HttpStatus.CREATED) {
- final String errorMessage = "Subscription to VNFM " + vnfmId + " returned status code: "
+ final String errorMessage = "Subscription to VNFM " + vnfm.getVnfmId() + " returned status code: "
+ response.getStatusCode() + ", request: " + subscriptionRequest;
logger.error(errorMessage);
throw new VnfmRequestFailureException(errorMessage);
@@ -106,12 +107,14 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public String terminateVnf(final String vnfSelfLink, final TerminateVnfRequest terminateVnfRequest) {
+ public String terminateVnf(final EsrVnfm vnfm, final String vnfSelfLink,
+ final TerminateVnfRequest terminateVnfRequest) {
logger.debug("Sending terminate request " + terminateVnfRequest + " to : " + vnfSelfLink);
ResponseEntity<Void> response = null;
try {
- response = httpServiceProvider.postHttpRequest(terminateVnfRequest, vnfSelfLink + "/terminate", Void.class);
+ response = getHttpServiceProvider(vnfm).postHttpRequest(terminateVnfRequest, vnfSelfLink + "/terminate",
+ Void.class);
} catch (final Exception exception) {
final String errorMessage =
"Terminate request to " + vnfSelfLink + " resulted in exception" + terminateVnfRequest;
@@ -130,9 +133,9 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public void deleteVnf(final String vnfSelfLink) {
+ public void deleteVnf(final EsrVnfm vnfm, final String vnfSelfLink) {
logger.debug("Sending delete request to : " + vnfSelfLink);
- final ResponseEntity<Void> response = httpServiceProvider.deleteHttpRequest(vnfSelfLink, Void.class);
+ final ResponseEntity<Void> response = getHttpServiceProvider(vnfm).deleteHttpRequest(vnfSelfLink, Void.class);
if (response.getStatusCode() != HttpStatus.NO_CONTENT) {
throw new VnfmRequestFailureException(
"Delete request to " + vnfSelfLink + " return status code: " + response.getStatusCode());
@@ -140,23 +143,27 @@ public class VnfmServiceProviderImpl implements VnfmServiceProvider {
}
@Override
- public Optional<InlineResponse200> getOperation(final String vnfmId, final String operationId) {
- final String url = urlProvider.getOperationUrl(vnfmId, operationId);
- return httpServiceProvider.get(url, InlineResponse200.class);
+ public Optional<InlineResponse200> getOperation(final EsrVnfm vnfm, final String operationId) {
+ final String url = urlProvider.getOperationUrl(vnfm.getVnfmId(), operationId);
+ return getHttpServiceProvider(vnfm).get(url, InlineResponse200.class);
}
@Override
- public Optional<InlineResponse201> createVnf(final String vnfmId, final CreateVnfRequest createVnfRequest) {
- final String url = urlProvider.getCreationUrl(vnfmId);
+ public Optional<InlineResponse201> createVnf(final EsrVnfm vnfm, final CreateVnfRequest createVnfRequest) {
+ final String url = urlProvider.getCreationUrl(vnfm.getVnfmId());
logger.debug("Sending create request {} to : {}", createVnfRequest, url);
try {
- return httpServiceProvider.post(createVnfRequest, url, InlineResponse201.class);
+ return getHttpServiceProvider(vnfm).post(createVnfRequest, url, InlineResponse201.class);
} catch (final Exception exception) {
final String errorMessage =
- "Create request to vnfm:" + vnfmId + " resulted in exception" + createVnfRequest;
+ "Create request to vnfm:" + vnfm.getVnfmId() + " resulted in exception" + createVnfRequest;
logger.error(errorMessage, exception);
throw new VnfmRequestFailureException(errorMessage, exception);
}
}
+ private HttpRestServiceProvider getHttpServiceProvider(final EsrVnfm vnfm) {
+ return vnfmServiceProviderConfiguration.getHttpRestServiceProvider(vnfm);
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
index 537bb77b32..19c8d22030 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/jobmanagement/JobManager.java
@@ -25,6 +25,7 @@ import com.google.common.base.Optional;
import com.google.common.collect.Maps;
import java.util.Map;
import java.util.UUID;
+import org.onap.so.adapters.vnfmadapter.extclients.aai.AaiServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.VnfmServiceProvider;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.JobNotFoundException;
@@ -45,10 +46,12 @@ public class JobManager {
private static Logger logger = getLogger(JobManager.class);
private final Map<String, VnfmOperation> mapOfJobIdToVnfmOperation = Maps.newConcurrentMap();
private final VnfmServiceProvider vnfmServiceProvider;
+ private final AaiServiceProvider aaiServiceProvider;
@Autowired
- JobManager(final VnfmServiceProvider vnfmServiceProvider) {
+ JobManager(final VnfmServiceProvider vnfmServiceProvider, final AaiServiceProvider aaiServiceProvider) {
this.vnfmServiceProvider = vnfmServiceProvider;
+ this.aaiServiceProvider = aaiServiceProvider;
}
/**
@@ -90,8 +93,8 @@ public class JobManager {
}
try {
- final Optional<InlineResponse200> operationOptional =
- vnfmServiceProvider.getOperation(vnfmOperation.getVnfmId(), vnfmOperation.getOperationId());
+ final Optional<InlineResponse200> operationOptional = vnfmServiceProvider.getOperation(
+ aaiServiceProvider.invokeGetVnfm(vnfmOperation.getVnfmId()), vnfmOperation.getOperationId());
if (!operationOptional.isPresent()) {
return response.operationStatusRetrievalStatus(OperationStatusRetrievalStatusEnum.OPERATION_NOT_FOUND);
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 fa2fa30b4a..0aad91e5be 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
@@ -82,16 +82,15 @@ public class LifecycleManager {
*/
public CreateVnfResponse createVnf(final String vnfIdInAai, final CreateVnfRequest request) {
final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
- checkIfVnfAlreadyExistsInVnfm(genericVnf);
-
EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
+ checkIfVnfAlreadyExistsInVnfm(vnfm, genericVnf);
+
if (vnfm == null) {
vnfm = aaiHelper.selectVnfm(genericVnf);
aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
}
aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant());
- final InlineResponse201 vnfmResponse =
- sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm.getVnfmId());
+ final InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm);
logger.info("Create response: {}", vnfmResponse);
@@ -102,8 +101,8 @@ public class LifecycleManager {
final OamIpAddressSource oamIpAddressSource = extractOamIpAddressSource(request);
aaiHelper.setOamIpAddressSource(vnfIdInVnfm, oamIpAddressSource);
- createNotificationSubscription(vnfm.getVnfmId(), vnfIdInVnfm);
- final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request, vnfIdInAai, vnfIdInVnfm);
+ createNotificationSubscription(vnfm, vnfIdInVnfm);
+ final String operationId = sendInstantiateRequestToVnfm(vnfm, genericVnf, request);
final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, false);
final CreateVnfResponse response = new CreateVnfResponse();
@@ -133,11 +132,11 @@ public class LifecycleManager {
}
}
- private void checkIfVnfAlreadyExistsInVnfm(final GenericVnf genericVnf) {
- if (genericVnf.getSelflink() != null && !genericVnf.getSelflink().isEmpty()) {
+ private void checkIfVnfAlreadyExistsInVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf) {
+ if (genericVnf.getSelflink() != null && !genericVnf.getSelflink().isEmpty() && vnfm != null) {
Optional<InlineResponse201> response = Optional.absent();
try {
- response = vnfmServiceProvider.getVnf(genericVnf.getSelflink());
+ response = vnfmServiceProvider.getVnf(vnfm, genericVnf.getSelflink());
} catch (final Exception exception) {
logger.debug("Ignoring invalid self link in generic vnf", exception);
}
@@ -149,7 +148,7 @@ public class LifecycleManager {
}
private InlineResponse201 sendCreateRequestToVnfm(final CreateVnfRequest aaiRequest, final GenericVnf genericVnf,
- final String vnfIdInAai, final String vnfmId) {
+ final String vnfIdInAai, final EsrVnfm vnfm) {
logger.debug("Sending a create request to SVNFM " + aaiRequest);
final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest vnfmRequest =
new org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest();
@@ -159,7 +158,7 @@ public class LifecycleManager {
vnfmRequest.setVnfInstanceName(aaiRequest.getName().replaceAll(" ", "_"));
vnfmRequest.setVnfInstanceDescription(vnfIdInAai);
- final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfmId, vnfmRequest);
+ final Optional<InlineResponse201> optionalResponse = vnfmServiceProvider.createVnf(vnfm, vnfmRequest);
try {
return optionalResponse.get();
@@ -170,24 +169,24 @@ public class LifecycleManager {
}
}
- private void createNotificationSubscription(final String vnfmId, final String vnfId) {
+ private void createNotificationSubscription(final EsrVnfm vnfm, final String vnfId) {
try {
final LccnSubscriptionRequest subscriptionRequest = vnfmHelper.createNotificationSubscriptionRequest(vnfId);
- vnfmServiceProvider.subscribeForNotifications(vnfmId, subscriptionRequest);
+ vnfmServiceProvider.subscribeForNotifications(vnfm, subscriptionRequest);
} catch (final Exception exception) {
- logger.warn("Subscription for notifications to VNFM: " + vnfmId + " for VNF " + vnfId
+ logger.warn("Subscription for notifications to VNFM: " + vnfm.getVnfmId() + " for VNF " + vnfId
+ " failed. AAI will not be updated unless the VNFM is configured by other means to send notifications relating to this VNF",
exception);
}
}
private String sendInstantiateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf,
- final CreateVnfRequest createVnfRequest, final String vnfIdInAai, final String vnfIdInVnfm) {
+ final CreateVnfRequest createVnfRequest) {
final InstantiateVnfRequest instantiateVnfRequest =
vnfmHelper.createInstantiateRequest(createVnfRequest.getTenant(), createVnfRequest,
packageProvider.getFlavourId(genericVnf.getModelVersionId()));
- final String jobId = vnfmServiceProvider.instantiateVnf(genericVnf.getSelflink(), instantiateVnfRequest);
+ final String jobId = vnfmServiceProvider.instantiateVnf(vnfm, genericVnf.getSelflink(), instantiateVnfRequest);
logger.info("Instantiate VNF request successfully sent to " + genericVnf.getSelflink());
return jobId;
@@ -201,18 +200,18 @@ public class LifecycleManager {
*/
public DeleteVnfResponse deleteVnf(final String vnfIdInAai) {
final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
- final String vnfmId = getIdOfAssignedVnfm(genericVnf);
+ final EsrVnfm vnfm = getAssignedVnfm(genericVnf);
- final String operationId = sendTerminateRequestToVnfm(genericVnf);
- final String jobId = jobManager.createJob(vnfmId, operationId, true);
+ final String operationId = sendTerminateRequestToVnfm(vnfm, genericVnf);
+ final String jobId = jobManager.createJob(vnfm.getVnfmId(), operationId, true);
return new DeleteVnfResponse().jobId(jobId);
}
- private String sendTerminateRequestToVnfm(final GenericVnf genericVnf) {
+ private String sendTerminateRequestToVnfm(final EsrVnfm vnfm, final GenericVnf genericVnf) {
final TerminateVnfRequest terminateVnfRequest = new TerminateVnfRequest();
terminateVnfRequest.setTerminationType(TerminationTypeEnum.FORCEFUL);
- return vnfmServiceProvider.terminateVnf(genericVnf.getSelflink(), terminateVnfRequest);
+ return vnfmServiceProvider.terminateVnf(vnfm, genericVnf.getSelflink(), terminateVnfRequest);
}
private GenericVnf getGenericVnfFromAai(final String vnfIdInAai) {
@@ -224,11 +223,11 @@ public class LifecycleManager {
return genericVnf;
}
- private String getIdOfAssignedVnfm(final GenericVnf genericVnf) {
- final String vnfmId = aaiHelper.getIdOfAssignedVnfm(genericVnf);
- if (vnfmId == null) {
+ private EsrVnfm getAssignedVnfm(final GenericVnf genericVnf) {
+ final EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
+ if (vnfm == null) {
throw new VnfmNotFoundException("No VNFM found in AAI for VNF " + genericVnf.getVnfId());
}
- return vnfmId;
+ return vnfm;
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
index 93c7ea91ff..eb912c8775 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
@@ -156,7 +156,7 @@ public class NotificationHandler implements Runnable {
boolean deleteSuccessful = false;
try {
- vnfmServiceProvider.deleteVnf(genericVnf.getSelflink());
+ vnfmServiceProvider.deleteVnf(aaiHelper.getAssignedVnfm(genericVnf), genericVnf.getSelflink());
deleteSuccessful = true;
} finally {
jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(),
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
index 9cb09e6261..f97822a0cd 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnContoller.java
@@ -20,6 +20,14 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
+import static org.slf4j.LoggerFactory.getLogger;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import javax.ws.rs.core.MediaType;
+import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.aai.domain.yang.GenericVnf;
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.VnfmServiceProvider;
@@ -39,12 +47,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
-import javax.ws.rs.core.MediaType;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
-import static org.onap.so.adapters.vnfmadapter.Constants.OPERATION_NOTIFICATION_ENDPOINT;
-import static org.slf4j.LoggerFactory.getLogger;
/**
* Controller for handling notifications from the VNFM (Virtual Network Function Manager).
@@ -118,8 +120,12 @@ public class Sol003LcnContoller {
private InlineResponse201 getVnfInstance(
final VnfLcmOperationOccurrenceNotification vnfLcmOperationOccurrenceNotification) {
- return vnfmServiceProvider.getVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
- .get();
+ GenericVnf vnfInAai = aaiServiceProvider
+ .invokeQueryGenericVnf(vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref())
+ .getGenericVnf().get(0);
+ EsrVnfm vnfm = aaiHelper.getAssignedVnfm(vnfInAai);
+ return vnfmServiceProvider
+ .getVnf(vnfm, vnfLcmOperationOccurrenceNotification.getLinks().getVnfInstance().getHref()).get();
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index aeb7cd3540..89a2c102f4 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -46,6 +46,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.hamcrest.MockitoHamcrest;
+import org.onap.aai.domain.yang.EsrSystemInfoList;
+import org.onap.aai.domain.yang.EsrVnfm;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.Relationship;
@@ -169,6 +171,7 @@ public class Sol003LcnControllerTest {
.andRespond(withSuccess(gson.toJson(vnfInstance), MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
listOfGenericVnfs.add(genericVnf);
final GenericVnfs genericVnfs = new GenericVnfs();
@@ -176,6 +179,12 @@ public class Sol003LcnControllerTest {
doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
+ EsrVnfm vnfm = new EsrVnfm();
+ vnfm.setVnfmId("vnfm1");
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ vnfm.setEsrSystemInfoList(esrSystemInfoList);
+ doReturn(Optional.of(vnfm)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
final ResponseEntity<Void> response =
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
@@ -226,6 +235,7 @@ public class Sol003LcnControllerTest {
.andRespond(withStatus(HttpStatus.NO_CONTENT).contentType(MediaType.APPLICATION_JSON));
final GenericVnf genericVnf = createGenericVnf("vnfmType1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
genericVnf.setSelflink("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm");
final List<GenericVnf> listOfGenericVnfs = new ArrayList<>();
listOfGenericVnfs.add(genericVnf);
@@ -236,6 +246,12 @@ public class Sol003LcnControllerTest {
doReturn(Optional.of(genericVnfs)).when(aaiResourcesClient).get(eq(GenericVnfs.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher(
"/network/generic-vnfs?selflink=http%3A%2F%2Fvnfm%3A8080%2Fvnfs%2FmyTestVnfIdOnVnfm")));
+ EsrVnfm vnfm = new EsrVnfm();
+ vnfm.setVnfmId("vnfm1");
+ final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
+ vnfm.setEsrSystemInfoList(esrSystemInfoList);
+ doReturn(Optional.of(vnfm)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
final ResponseEntity<Void> response =
controller.lcnVnfLcmOperationOccurrenceNotificationPost(vnfLcmOperationOccurrenceNotification);
@@ -323,6 +339,22 @@ public class Sol003LcnControllerTest {
return genericVnf;
}
+ private void addRelationshipFromGenericVnfToVnfm(final GenericVnf genericVnf, final String vnfmId) {
+ final Relationship relationshipToVnfm = new Relationship();
+ relationshipToVnfm.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/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);
+
+ if (genericVnf.getRelationshipList() == null) {
+ final RelationshipList relationshipList = new RelationshipList();
+ genericVnf.setRelationshipList(relationshipList);
+ }
+ genericVnf.getRelationshipList().getRelationship().add(relationshipToVnfm);
+ }
+
private void addRelationshipFromGenericVnfToVserver(final GenericVnf genericVnf, final String vserverId) {
final Relationship relationshipToVserver = new Relationship();
relationshipToVserver.setRelatedTo("vserver");
@@ -343,9 +375,11 @@ public class Sol003LcnControllerTest {
relationshipData4.setRelationshipValue(TENANT_ID);
relationshipToVserver.getRelationshipData().add(relationshipData4);
- final RelationshipList relationshipList = new RelationshipList();
- relationshipList.getRelationship().add(relationshipToVserver);
- genericVnf.setRelationshipList(relationshipList);
+ if (genericVnf.getRelationshipList() == null) {
+ final RelationshipList relationshipList = new RelationshipList();
+ genericVnf.setRelationshipList(relationshipList);
+ }
+ genericVnf.getRelationshipList().getRelationship().add(relationshipToVserver);
}
private class AaiResourceUriMatcher extends BaseMatcher<AAIResourceUri> {
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 b48de30f88..b45a13362d 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
@@ -214,6 +214,8 @@ public class VnfmAdapterControllerTest {
final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
final InlineResponse201 reponse = new InlineResponse201();
mockRestServer.expect(requestTo(new URI("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm")))
@@ -239,7 +241,7 @@ public class VnfmAdapterControllerTest {
final CreateVnfRequest createVnfRequest = new CreateVnfRequest().name("myTestName").tenant(tenant);
final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType2");
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm2");
setUpVnfmsInMockAai();
setUpVimInMockAai();
@@ -279,24 +281,25 @@ public class VnfmAdapterControllerTest {
public void deleteVnf_ValidRequest_Returns202AndJobId() throws Exception {
final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
- final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType");
+ final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.ACCEPTED).contentType(MediaType.APPLICATION_JSON)
- .location(new URI("http://vnfm2:8080/vnf_lcm_op_occs/1234567")));
+ .location(new URI("http://vnfm1:8080/vnf_lcm_op_occs/1234567")));
final InlineResponse200 firstOperationQueryResponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.PROCESSING);
- mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
+ mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(firstOperationQueryResponse), MediaType.APPLICATION_JSON));
final InlineResponse200 secondOperationQueryReponse = createOperationQueryResponse(
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum.TERMINATE,
org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationStateEnum.COMPLETED);
- mockRestServer.expect(requestTo("http://vnfm:8080/vnf_lcm_op_occs/1234567"))
+ mockRestServer.expect(requestTo("http://vnfm1:8080/vnf_lcm_op_occs/1234567"))
.andRespond(withSuccess(gson.toJson(secondOperationQueryReponse), MediaType.APPLICATION_JSON));
final RequestEntity<Void> request = RequestEntity
@@ -308,16 +311,6 @@ public class VnfmAdapterControllerTest {
assertEquals(202, deleteVnfResponse.getStatusCode().value());
assertNotNull(deleteVnfResponse.getBody().getJobId());
- 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);
-
- doReturn(Optional.of(esrSystemInfoList)).when(aaiResourcesClient).get(eq(EsrSystemInfoList.class),
- MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/...")));
-
final ResponseEntity<QueryJobResponse> firstJobQueryResponse =
controller.jobQuery(deleteVnfResponse.getBody().getJobId(), "", "so", "1213");
assertEquals(OperationEnum.TERMINATE, firstJobQueryResponse.getBody().getOperation());
@@ -367,9 +360,10 @@ public class VnfmAdapterControllerTest {
public void deleteVnf_ErrorStatusCodeFromVnfm_Returns500() throws Exception {
final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
- final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType");
+ final GenericVnf genericVnf = setUpGenericVnfInMockAai("vnfmType1");
addSelfLinkToGenericVnf(genericVnf);
- addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm");
+ addRelationshipFromGenericVnfToVnfm(genericVnf, "vnfm1");
+ setUpVnfmsInMockAai();
mockRestServer.expect(requestTo("http://vnfm:8080/vnfs/myTestVnfIdOnVnfm/terminate"))
.andRespond(withStatus(HttpStatus.BAD_REQUEST).contentType(MediaType.APPLICATION_JSON));
@@ -419,12 +413,7 @@ public class VnfmAdapterControllerTest {
private void addRelationshipFromGenericVnfToVnfm(final GenericVnf genericVnf, final String vnfmId) {
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.setRelatedLink("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/" + vnfmId);
relationshipToVnfm.setRelatedTo("esr-vnfm");
final RelationshipData relationshipData = new RelationshipData();
relationshipData.setRelationshipKey("esr-vnfm.vnfm-id");
@@ -465,6 +454,12 @@ public class VnfmAdapterControllerTest {
esrVnfmList.getEsrVnfm().add(esrVnfm1);
esrVnfmList.getEsrVnfm().add(esrVnfm2);
+ doReturn(Optional.of(esrVnfm1)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm1?depth=1")));
+
+ doReturn(Optional.of(esrVnfm2)).when(aaiResourcesClient).get(eq(EsrVnfm.class), MockitoHamcrest
+ .argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list/esr-vnfm/vnfm2?depth=1")));
+
doReturn(Optional.of(esrVnfmList)).when(aaiResourcesClient).get(eq(EsrVnfmList.class),
MockitoHamcrest.argThat(new AaiResourceUriMatcher("/external-system/esr-vnfm-list")));
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 a08206b477..e4c95f6290 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
@@ -1087,9 +1087,9 @@ public class ToscaResourceInstaller {
tempGroupList.addAll(groupList);
for (Group group : groupList) {
+ boolean isAllExists = true;
ArrayList<NodeTemplate> members = group.getMemberNodes();
for (NodeTemplate memberNode : members) {
- boolean isAllExists = true;
RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(memberNode);
if (requirements == null || requirements.getAll() == null || requirements.getAll().isEmpty()) {
continue;
@@ -1097,27 +1097,28 @@ public class ToscaResourceInstaller {
List<RequirementAssignment> rqaList = requirements.getAll();
for (RequirementAssignment rqa : rqaList) {
String name = rqa.getNodeTemplateName();
- for (NodeTemplate node : nodes) {
- if (name.equals(node.getName())) {
- break;
- }
+ Optional<NodeTemplate> findNode =
+ nodes.stream().filter(node -> node.getName().equals(name)).findFirst();
+ if (!findNode.isPresent()) {
+ isAllExists = false;
+ break;
}
-
- isAllExists = false;
- break;
}
-
- if (isAllExists) {
- strSequence.add(group.getName());
- tempGroupList.remove(group);
- nodes.addAll(group.getMemberNodes());
+ if (!isAllExists) {
+ break;
}
}
- if (!tempGroupList.isEmpty() && tempGroupList.size() < groupList.size()) {
- getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper);
+ if (isAllExists) {
+ strSequence.add(group.getName());
+ tempGroupList.remove(group);
+ nodes.addAll(group.getMemberNodes());
}
}
+
+ if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) {
+ getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper);
+ }
}
public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification,
@@ -1896,7 +1897,13 @@ public class ToscaResourceInstaller {
vnfcCustomization
.setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcTemplate, inputList));
- vfcInstanceGroupCustom.getVnfcCustomizations().add(vnfcCustomization);
+ List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations();
+
+ if (vnfcCustomizations == null) {
+ vnfcCustomizations = new ArrayList<>();
+ vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations);
+ }
+ vnfcCustomizations.add(vnfcCustomization);
}
}
}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
index 115af3adaf..7534ea645a 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java
@@ -32,6 +32,7 @@ import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -51,6 +52,8 @@ import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.RequirementAssignment;
+import org.onap.sdc.toscaparser.api.RequirementAssignments;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.elements.StatefulEntityType;
import org.onap.sdc.utils.DistributionStatusEnum;
@@ -76,6 +79,7 @@ import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatu
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.util.ReflectionTestUtils;
import java.util.Optional;
+import java.util.stream.Collectors;
public class ToscaResourceInstallerTest extends BaseTest {
@Autowired
@@ -488,6 +492,81 @@ public class ToscaResourceInstallerTest extends BaseTest {
verify(vnrConfigCustom, times(1)).setConfigResourceCustomization(vrfConfigCustom);
}
+ @Test
+ public void testProcessVNFCGroupSequence() {
+ List<Group> groupList = new ArrayList<>();
+
+ Group group1 = mock(Group.class);
+ NodeTemplate node1 = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeList1 = new ArrayList<>();
+ nodeList1.add(node1);
+ doReturn("VfcInstanceGroup..0").when(group1).getName();
+ doReturn(nodeList1).when(group1).getMemberNodes();
+ doReturn("deviceV3").when(node1).getName();
+
+ Group group2 = mock(Group.class);
+ NodeTemplate node2 = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeList2 = new ArrayList<>();
+ nodeList2.add(node2);
+ doReturn("VfcInstanceGroup..1").when(group2).getName();
+ doReturn(nodeList2).when(group2).getMemberNodes();
+ RequirementAssignments requirements2 = mock(RequirementAssignments.class);
+ RequirementAssignment requirement2 = mock(RequirementAssignment.class);
+ List<RequirementAssignment> requirementCollection2 = new ArrayList<>();
+ requirementCollection2.add(requirement2);
+ doReturn(requirementCollection2).when(requirements2).getAll();
+ doReturn("deviceV3").when(requirement2).getNodeTemplateName();
+ doReturn("SiteV2").when(node2).getName();
+
+ Group group3 = mock(Group.class);
+ NodeTemplate node3 = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeList3 = new ArrayList<>();
+ nodeList3.add(node3);
+ doReturn("VfcInstanceGroup..2").when(group3).getName();
+ doReturn(nodeList3).when(group3).getMemberNodes();
+ RequirementAssignments requirements3 = mock(RequirementAssignments.class);
+ RequirementAssignment requirement3 = mock(RequirementAssignment.class);
+ List<RequirementAssignment> requirementCollection3 = new ArrayList<>();
+ requirementCollection3.add(requirement3);
+ doReturn(requirementCollection3).when(requirements3).getAll();
+ doReturn("SiteV2").when(requirement3).getNodeTemplateName();
+ doReturn("siteWanV2").when(node3).getName();
+
+ groupList.add(group1);
+ groupList.add(group2);
+ groupList.add(group3);
+
+ doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper();
+ doReturn(null).when(csarHelper).getRequirementsOf(node1);
+ doReturn(requirements2).when(csarHelper).getRequirementsOf(node2);
+ doReturn(requirements3).when(csarHelper).getRequirementsOf(node3);
+
+ ToscaResourceInstaller installer = new ToscaResourceInstaller();
+ Method[] methods = installer.getClass().getDeclaredMethods();
+ Method testMethod = null;
+ for (Method method : methods) {
+ String name = method.getName();
+ if (name.equals("processVNFCGroupSequence")) {
+ method.setAccessible(true);
+ testMethod = method;
+ }
+ }
+
+ if (null != testMethod) {
+ try {
+ Object seqResult = testMethod.invoke(installer, toscaResourceStructure, groupList);
+ if (seqResult instanceof List) {
+ String resultStr = ((List<String>) seqResult).stream().collect(Collectors.joining(","));
+ assertEquals(((List<String>) seqResult).size(), 3);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ }
+
+
class MockConstants {
public final static String MODEL_NAME = "VLAN Network Receptor Configuration";
public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0";
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 4670b11b71..976ad1466d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -45,6 +45,20 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
public MsoUtils utils = new MsoUtils()
/**
+ * Logs a WorkflowException at the ERROR level with the specified message.
+ * @param execution the execution
+ */
+ public void logWorkflowException(DelegateExecution execution, String message) {
+ def workflowException = execution.getVariable("WorkflowException")
+
+ if (workflowException == null) {
+ logger.error(message);
+ } else {
+ logger.error('{}: {}', message, workflowException)
+ }
+ }
+
+ /**
* Saves the WorkflowException in the execution to the specified variable,
* clearing the WorkflowException variable so the workflow can continue
* processing (perhaps catching another WorkflowException).
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index c7665acc68..9a39334af1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -150,6 +150,17 @@ public class BBInputSetup implements JavaDelegate {
this.mapperLayer = mapperLayer;
}
+ /**
+ * This method is used for executing the building block.
+ *
+ * It will get the BB from the execution object by checking if the aLaCarte and homing is true.
+ *
+ * Then it will get the GBB and execute it.
+ *
+ * @param execution
+ * @throws Exception
+ * @return
+ */
@Override
public void execute(DelegateExecution execution) throws Exception {
try {
@@ -1538,6 +1549,14 @@ public class BBInputSetup implements JavaDelegate {
return serviceInstance;
}
+ /**
+ * This method is used for getting the existing service instance.
+ *
+ * This will map the serviceInstanceAAI to serviceInstance and return the serviceInstance.
+ *
+ * @throws Exception
+ * @return serviceInstance
+ */
public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI)
throws Exception {
ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 63dd72566b..41cd87e874 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -581,6 +581,6 @@ public class BBInputSetupMapperLayer {
protected ModelInfoServiceProxy mapServiceProxyCustomizationToServiceProxy(
ServiceProxyResourceCustomization serviceProxyCustomization) {
- return modelMapper.map(serviceProxyCustomization, ModelInfoServiceProxy.class);
+ return modelMapper.map(serviceProxyCustomization.getSourceService(), ModelInfoServiceProxy.class);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 787957dc38..bff13f8dbd 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -2071,7 +2071,7 @@ public class BBInputSetupTest {
ServiceProxy expected = new ServiceProxy();
expected.setType("TRANSPORT");
expected.setModelInfoServiceProxy(new ModelInfoServiceProxy());
- expected.getModelInfoServiceProxy().setModelCustomizationUuid("modelCustomizationUUID");
+ expected.getModelInfoServiceProxy().setModelUuid("modelUUID");
expected.setServiceInstance(new ServiceInstance());
expected.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
expected.getServiceInstance().getModelInfoServiceInstance().setModelUuid("modelUUID");
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
index 49f373c01e..a9f33f20c5 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java
@@ -38,9 +38,9 @@ public class BaseTaskTest {
private String anyValueString = "anyValue";
private String badValueString = "123abc";
private int anyValueInt = 123;
- private Integer anyValueInteger = new Integer(anyValueInt);
+ private Integer anyValueInteger = Integer.valueOf(anyValueInt);
private long anyValuelong = 123L;
- private Long anyValueLong = new Long(anyValuelong);
+ private Long anyValueLong = Long.valueOf(anyValuelong);
private DelegateExecution mockExecution;
private Expression mockExpression;
@@ -113,7 +113,7 @@ public class BaseTaskTest {
assertEquals(anyValueString, obj1.toString());
expectedException.expect(MissingInjectedFieldException.class);
- Object objectBoolean = new Boolean(true); // bad data
+ Object objectBoolean = Boolean.valueOf(true); // bad data
when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
obj2 = baseTask.getStringField(null, mockExecution, anyVariable);
}
@@ -134,7 +134,7 @@ public class BaseTaskTest {
@Test
public void testGetIntegerFieldAndMissingInjectedFieldException() throws Exception {
- objectInteger = new Integer(anyValueInt);
+ objectInteger = Integer.valueOf(anyValueInt);
when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger);
obj1 = baseTask.getIntegerField(mockExpression, mockExecution, anyVariable);
assertEquals(anyValueInteger, (Integer) obj1);
@@ -154,7 +154,7 @@ public class BaseTaskTest {
@Test
public void testGetOptionalIntegerField() throws Exception {
- objectInteger = new Integer(anyValueInt);
+ objectInteger = Integer.valueOf(anyValueInt);
when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger);
obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable);
assertEquals(anyValueInteger, (Integer) obj1);
@@ -163,14 +163,14 @@ public class BaseTaskTest {
@Test
public void testGetOptionalIntegerFieldAndBadInjectedFieldException() throws Exception {
expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = new Boolean(true);
+ objectBoolean = Boolean.valueOf(true);
when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable);
}
@Test
public void testGetLongFieldAndMissingInjectedFieldException() throws Exception {
- objectLong = new Long(anyValuelong);
+ objectLong = Long.valueOf(anyValuelong);
when(mockExpression.getValue(mockExecution)).thenReturn(objectLong);
obj1 = baseTask.getLongField(mockExpression, mockExecution, anyVariable);
assertEquals(anyValueLong, (Long) obj1);
@@ -189,7 +189,7 @@ public class BaseTaskTest {
@Test
public void testGetOptionalLongField() throws Exception {
- objectLong = new Long(anyValuelong);
+ objectLong = Long.valueOf(anyValuelong);
when(mockExpression.getValue(mockExecution)).thenReturn(objectLong);
obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable);
assertEquals(anyValueLong, (Long) obj1);
@@ -198,7 +198,7 @@ public class BaseTaskTest {
@Test
public void testGetOptionalLongFieldAndBadInjectedFieldException() throws Exception {
expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = new Boolean(true);
+ objectBoolean = Boolean.valueOf(true);
when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable);
}
@@ -233,7 +233,7 @@ public class BaseTaskTest {
@Test
public void testGetOptionalOutputFieldAndBadInjectedFieldException() throws Exception {
expectedException.expect(BadInjectedFieldException.class);
- objectBoolean = new Boolean(true);
+ objectBoolean = Boolean.valueOf(true);
when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean);
obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable);
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
index 39a8995607..f3527fad7d 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -60,7 +60,6 @@ public class OofHomingTestIT extends BaseIntegrationTest {
Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class);
ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
- String subscriber = "";
String subscriber2 = "";
private final CallbackSet callbacks = new CallbackSet();
@@ -208,8 +207,6 @@ public class OofHomingTestIT extends BaseIntegrationTest {
serviceDecomposition.setServiceInstance(si);
// Subscriber
- subscriber =
- "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 583e3e172a..68cfd487b3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -104,6 +104,14 @@ public class AAICreateTasks {
@Autowired
private Environment env;
+ /**
+ * This method is used for creating the service instance in A&AI.
+ *
+ * It will check the alaCarte and create the service instance in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createServiceInstance(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -115,6 +123,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating and subscribing the service in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createServiceSubscription(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -136,6 +150,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creation of the project A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createProject(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -153,6 +173,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating OwningEntity A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createOwningEntity(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -192,6 +218,16 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating Vnf in A&AI.
+ *
+ * It will check if the Vnf Name is exits in A&AI then it will throw the duplicate name exception.
+ *
+ * Otherwise it will create the vnf amd connect to the serviceinstance.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -204,6 +240,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for separating (,) from the string.
+ *
+ * @param str
+ * @throws @return
+ */
public void createPlatform(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -223,10 +265,22 @@ public class AAICreateTasks {
}
+ /**
+ * This method is used for separating (,) from the string.
+ *
+ * @param str
+ * @throws @return
+ */
public List<String> splitCDL(String str) {
return Stream.of(str.split(",")).map(String::trim).map(elem -> new String(elem)).collect(Collectors.toList());
}
+ /**
+ * This method is used for creating the type of business in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createLineOfBusiness(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -246,6 +300,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating the volume group in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -261,6 +321,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating the vfModule in A&AI.
+ *
+ * @param execution
+ * @throws @return
+ */
public void createVfModule(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -279,7 +345,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -304,7 +370,7 @@ public class AAICreateTasks {
/**
* BPMN access method to execute Create L3Network operation (PUT )in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -325,6 +391,12 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating the customer in A&AI.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void createCustomer(BuildingBlockExecution execution) throws Exception {
try {
Customer customer = execution.getGeneralBuildingBlock().getCustomer();
@@ -337,7 +409,7 @@ public class AAICreateTasks {
/**
* BPMN access method to execute NetworkCollection operation (PUT) in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -357,7 +429,7 @@ public class AAICreateTasks {
/**
* BPMN access method to execute NetworkCollectionInstanceGroup operation (PUT) in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -378,7 +450,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -393,7 +465,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -409,7 +481,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -432,7 +504,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -447,7 +519,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -464,7 +536,7 @@ public class AAICreateTasks {
/**
* BPMN access method to establish relationships in AAI
- *
+ *
* @param execution
* @throws Exception
*/
@@ -482,6 +554,11 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for configuring the service in A&AI.
+ *
+ * @param execution @throws
+ */
public void createConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
@@ -491,6 +568,11 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used for creating vnf instance group in A&AI.
+ *
+ * @param execution @throws
+ */
public void createInstanceGroupVnf(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -502,6 +584,11 @@ public class AAICreateTasks {
}
}
+ /**
+ * This method is used to put the network policy in A&AI.
+ *
+ * @param execution @throws
+ */
public void createNetworkPolicies(BuildingBlockExecution execution) {
try {
String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST);
@@ -536,10 +623,10 @@ public class AAICreateTasks {
/**
* Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index
- *
+ *
* if we have a module type A, and there are 3 instances of those, and then module type B has 2 instances, if we are
* adding a new module type A, the vf-module-index should be 3 assuming contiguous indices (not 5, or 2)
- *
+ *
*/
protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 01bdc09419..20f4443291 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -79,6 +79,11 @@ public class AAIUpdateTasks {
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ /**
+ * BPMN access method to update the status of Service to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -91,6 +96,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of Service to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance =
@@ -102,6 +112,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of Vnf to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -111,6 +126,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of Vnf to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -120,6 +140,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VolumeGroup to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -134,6 +159,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VolumeGroup to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -148,6 +178,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VolumeGroup to Created in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -162,6 +197,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update HeatStackId and VolumeGroup in AAI
+ *
+ * @param execution
+ */
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -179,6 +219,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VfModule to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -190,6 +235,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VfModule to PendingActivation in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -201,6 +251,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -222,6 +277,12 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VfModule to Created in AAI
+ *
+ * @param execution
+ *
+ */
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -232,6 +293,12 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule
+ *
+ * @param execution
+ * @throws buildAndThrowWorkflowException
+ */
public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeactivateVfModuleRollback", false);
try {
@@ -246,7 +313,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Assigned in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -256,7 +323,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Active in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -266,7 +333,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network to Created in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -302,7 +369,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of L3Network Collection to Active in AAI
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -323,6 +390,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VfModule to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiActivateVfModuleRollback", false);
try {
@@ -335,6 +407,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update HeatStackId of VfModule in AAI
+ *
+ * @param execution
+ */
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
String heatStackId = execution.getVariable("heatStackId");
@@ -352,7 +429,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was created in cloud
- *
+ *
* @param execution
* @throws Exception
*/
@@ -395,7 +472,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update L3Network after it was updated in cloud
- *
+ *
* @param execution
* @throws Exception
*/
@@ -422,6 +499,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update L3Network Object
+ *
+ * @param execution
+ */
public void updateObjectNetwork(BuildingBlockExecution execution) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
@@ -433,7 +515,7 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update ServiceInstance
- *
+ *
* @param execution
*/
public void updateServiceInstance(BuildingBlockExecution execution) {
@@ -446,6 +528,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update Vnf Object
+ *
+ * @param execution
+ */
public void updateObjectVnf(BuildingBlockExecution execution) {
try {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -455,6 +542,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of VfModuleRollback as true
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) {
execution.setVariable("aaiDeleteVfModuleRollback", false);
try {
@@ -471,6 +563,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update Model of VfModule
+ *
+ * @param execution
+ */
public void updateModelVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -481,6 +578,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of FabricConfiguration to Assigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
@@ -491,6 +593,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of FabricConfiguration to Active in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
@@ -500,6 +607,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of FabricConfiguration to deactive in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
@@ -510,6 +622,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update Ipv4OamAddress of Vnf
+ *
+ * @param execution
+ */
public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) {
try {
String ipv4OamAddress = execution.getVariable("oamManagementV4Address");
@@ -527,6 +644,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update ManagementV6Address of Vnf
+ *
+ * @param execution
+ */
public void updateManagementV6AddressVnf(BuildingBlockExecution execution) {
try {
String managementV6Address = execution.getVariable("oamManagementV6Address");
@@ -544,6 +666,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update ContrailServiceInstanceFqdn of VfModule
+ *
+ * @param execution
+ */
public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) {
try {
String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn");
@@ -558,6 +685,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of Vnf to ConfigAssigned in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -567,6 +699,11 @@ public class AAIUpdateTasks {
}
}
+ /**
+ * BPMN access method to update status of Vnf to Configure in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -578,6 +715,11 @@ public class AAIUpdateTasks {
}
+ /**
+ * BPMN access method to update status of Vnf to configured in AAI
+ *
+ * @param execution
+ */
public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index b257e91165..9396f9dbfc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -59,6 +59,12 @@ public class VnfAdapterCreateTasks {
@Autowired
private ExceptionBuilder exceptionUtil;
+ /**
+ * This method is used for creating the request for the VolumeGroup.
+ *
+ * @param execution
+ * @return
+ */
public void createVolumeGroupRequest(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -93,6 +99,12 @@ public class VnfAdapterCreateTasks {
}
+ /**
+ * This method is used for creating the request for the VfModule.
+ *
+ * @param execution
+ * @return
+ */
public void createVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index ab2647a68d..1dcdfa912c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -52,6 +52,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
+/*
+ * This class is used for creating the service instance, assigning vnf, assigning the Vfmodule & assigning the L3Network
+ * on SDNC.
+ */
@Component
public class SDNCAssignTasks extends AbstractSDNCTask {
private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class);
@@ -71,6 +75,13 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * BPMN access method to assigning the service instance in SDNC.
+ *
+ * It will assign the service instance by the service instance id.
+ *
+ * @param execution
+ */
public void assignServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -89,6 +100,13 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
}
}
+ /**
+ * BPMN access method to assigning the vnf in SDNC.
+ *
+ * It will assign the vnf according to the service instance id and vnf id.
+ *
+ * @param execution
+ */
public void assignVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -111,6 +129,13 @@ public class SDNCAssignTasks extends AbstractSDNCTask {
}
}
+ /**
+ * BPMN access method to assigning the vfModule in SDNC.
+ *
+ * It will assign the VfModule by the service instance id ,Vnf id and module id.
+ *
+ * @param execution
+ */
public void assignVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 9bbe94a077..7478479a86 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -39,6 +39,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+/**
+ * This class is used for quering the SDNC
+ */
@Component
public class SDNCQueryTasks {
private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class);
@@ -53,6 +56,14 @@ public class SDNCQueryTasks {
@Autowired
private ExtractPojosForBB extractPojosForBB;
+ /**
+ * BPMN access method to query the SDNC for fetching the vnf details.
+ *
+ * It will get the vnf details according to service instance id.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void queryVnf(BuildingBlockExecution execution) throws Exception {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -77,7 +88,14 @@ public class SDNCQueryTasks {
}
}
-
+ /**
+ * BPMN access method to query the SDNC for fetching the VfModule details.
+ *
+ * It will get the vnf details according to service instance id, vnf id & Vf module id.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void queryVfModule(BuildingBlockExecution execution) throws Exception {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -108,6 +126,13 @@ public class SDNCQueryTasks {
}
}
+ /**
+ * BPMN access method to query the SDNC for fetching the VfModuleForVolumeGroup details.
+ *
+ * It will get the vnf details according to Vf module id.
+ *
+ * @param execution @throws
+ */
public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 4fcacb3c42..7eaf011c75 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -63,6 +63,11 @@ public class OrchestrationStatusValidator {
@Autowired
private CatalogDbClient catalogDbClient;
+ /**
+ * This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType
+ *
+ * @param execution
+ */
public void validateOrchestrationStatus(BuildingBlockExecution execution) {
try {
OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 12aae1e6a6..6434bfb176 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -50,6 +50,17 @@ public class SDNCVnfResources {
@Autowired
private SDNCClient sdncClient;
+ /**
+ * This method is used for setting the SDNCSvcAction for assignVnf .
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing,
URI callbackURI) {
@@ -58,6 +69,17 @@ public class SDNCVnfResources {
cloudRegion, requestContext, homing, callbackURI);
}
+ /**
+ * This method is used for setting the SDNCSvcAction for activate vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE,
@@ -65,7 +87,17 @@ public class SDNCVnfResources {
cloudRegion, requestContext, false, callbackURI);
}
-
+ /**
+ * This method is used for setting the SDNCSvcAction for deactivate vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance,
Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
@@ -73,7 +105,17 @@ public class SDNCVnfResources {
cloudRegion, requestContext, false, callbackURI);
}
-
+ /**
+ * This method is used for setting the SDNCSvcAction for unassign vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance,
Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN,
@@ -81,6 +123,17 @@ public class SDNCVnfResources {
cloudRegion, requestContext, false, callbackURI);
}
+ /**
+ * This method is used for setting the SDNCSvcAction for delete vnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance,
Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE,
@@ -88,6 +141,17 @@ public class SDNCVnfResources {
cloudRegion, requestContext, false, callbackURI);
}
+ /**
+ * This method is used for setting the SDNCSvcAction for changeModelVnf.
+ *
+ * @param vnf
+ * @param serviceInstance
+ * @param customer
+ * @param cloudRegion
+ * @param requestContext
+ * @param homing
+ * @return
+ */
public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance,
Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) {
return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,
@@ -95,6 +159,13 @@ public class SDNCVnfResources {
cloudRegion, requestContext, false, callbackURI);
}
+ /**
+ * This method is used for querying SDNC client for getting the vnf details.
+ *
+ * @param vnf
+ * @exception MapperException & BadResponseException
+ * @return
+ */
public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException {
String queryPath = vnf.getSelflink();
return sdncClient.get(queryPath);
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
index 95ed01ee94..96844ff1cb 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
@@ -47,10 +47,12 @@ public class AAIValidatorImpl implements AAIValidator {
List<Pserver> pservers;
boolean isLocked = false;
pservers = client.getPhysicalServerByVnfId(vnfId);
- for (Pserver pserver : pservers) {
- if (pserver.isInMaint()) {
- isLocked = true;
- return isLocked;
+ if (pservers != null) {
+ for (Pserver pserver : pservers) {
+ if (pserver.isInMaint()) {
+ isLocked = true;
+ return isLocked;
+ }
}
}
return isLocked;
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
index 5fa2ff0295..b91d0e705a 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
@@ -91,6 +91,13 @@ public class AAIValidatorTest {
}
@Test
+ public void test_IsPhysicalServerLocked_NoServers_False() throws IOException {
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(null);
+ boolean locked = validator.isPhysicalServerLocked(vnfName);
+ assertEquals(false, locked);
+ }
+
+ @Test
public void test_IsVNFLocked_False() {
when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(false));
boolean locked = validator.isVNFLocked(vnfName);
diff --git a/docs/api/apis/SO_Interface.rst b/docs/api/apis/SO_Interface.rst
index b079989aff..d1586eb5d0 100644
--- a/docs/api/apis/SO_Interface.rst
+++ b/docs/api/apis/SO_Interface.rst
@@ -3,7 +3,7 @@
.. Copyright 2018 Huawei Technologies Co., Ltd.
SO Interfaces
-================================
+=============
.. image:: ../../images/SO_1.png
@@ -13,17 +13,17 @@ SO APIs
North Bound APIs
----------------
Create service instance
-++++++++++++++++++++++++
++++++++++++++++++++++++
-+--------------------+-------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================+
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6 |
-+--------------------+-------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------+
++--------------------+------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------+
Request Body:
@@ -205,17 +205,17 @@ LineOfBusiness Object
+-------------------------+------------------+-------------------------------------------------+
Delete service instance
-++++++++++++++++++++++++
++++++++++++++++++++++++
-+--------------------+---------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=========================================================+
++--------------------+--------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId} |
-+--------------------+---------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+---------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+---------------------------------------------------------+
++--------------------+--------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+--------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------------------------+
Request Body:
@@ -258,17 +258,17 @@ RequestInfo Object
+-------------------------+------------------+-------------------------------------------------+
Create Volume Group
-++++++++++++++++++++++++
++++++++++++++++++++
-+--------------------+-------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+===========================================================================================+
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+==================================================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups |
-+--------------------+-------------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------------------------------------------------------------+
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------------------------------------------------------------+
Request Body:
@@ -389,17 +389,17 @@ relatedInstance List
+-------------------------+------------------+-------------------------------------------------+
Delete Volume Group
-++++++++++++++++++++++++
++++++++++++++++++++
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================================================================================================+
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} |
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+---------------------------------------------------------------------------------------------------------------------+
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
Request Body:
@@ -450,17 +450,17 @@ RequestInfo Object
+-------------------------+------------------+-------------------------------------------------+
Create VF Module
-+++++++++++++++++
+++++++++++++++++
-+--------------------+----------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+========================================================================================+
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+===============================================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules |
-+--------------------+----------------------------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+----------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+----------------------------------------------------------------------------------------+
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+---------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+---------------------------------------------------------------------------------------------------------------+
Request Body:
@@ -545,17 +545,17 @@ relatedInstance List
+-------------------------+------------------+-------------------------------------------------+
Delete VF Module
-++++++++++++++++++++++++
+++++++++++++++++
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================================================================+
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------------------------------------------------------+
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+
Request Body:
@@ -614,17 +614,17 @@ RequestInfo Object
+-------------------------+------------------+-------------------------------------------------+
Create VNF
-+++++++++++++++
+++++++++++
-+--------------------+--------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================+
++--------------------+-------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs |
-+--------------------+--------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+--------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------+
++--------------------+-------------------------------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+-------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------+
Request Body:
@@ -761,17 +761,17 @@ UserParams Object
+-------------------------+------------------+-------------------------------------------------+
Delete VNF
-+++++++++++++++
+++++++++++
-+--------------------+------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================================+
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================================+
|URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} |
-+--------------------+------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+------------------------------------------------------------------------------+
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+-----------------------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-----------------------------------------------------------------------------------------------------+
Request Body:
@@ -842,17 +842,17 @@ UserParams Object
+-------------------------+------------------+-------------------------------------------------+
GET Orchestration Request
-++++++++++++++++++++++++++
++++++++++++++++++++++++++
-+--------------------+--------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==============================================================+
++--------------------+-------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+=====================================================================================+
|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6/{request-id} |
-+--------------------+--------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+--------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------+
++--------------------+-------------------------------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+-------------------------------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+-------------------------------------------------------------------------------------+
Response Body:
@@ -998,7 +998,7 @@ GET Orchestration Requests
+--------------------+--------------------------------------------------------------+
|Interface Definition|Description |
+====================+==============================================================+
-|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 |
+|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 |
+--------------------+--------------------------------------------------------------+
|Operation Type |GET |
+--------------------+--------------------------------------------------------------+
@@ -1152,7 +1152,7 @@ RequestStatus Object
+-------------------------+------------------+-------------------------------------------------+
SDC Client API
-------------------
+--------------
Get List of Existing Catalog Assets
+++++++++++++++++++++++++++++++++++
@@ -1291,7 +1291,7 @@ Response:
Resource Object:
+---------------------+---------+-------+-------------------------------------------------------------------------------------------------------------------+
-|Attribute |Qualifier|Content|Description | |
+|Attribute |Qualifier|Content|Description |
+=====================+=========+=======+===================================================================================================================+
|resourceInstanceName |M |String |Logical Resource Instance Name.Unique Identifier of the instance of the specific resource in the service context.|
+---------------------+---------+-------+-------------------------------------------------------------------------------------------------------------------+
@@ -1372,20 +1372,20 @@ Response:
+--------------------+---------+--------------------------------------------------------------------------------------------------------------------------+
E2E Service API
-----------------
+---------------
Create E2E service instance
-++++++++++++++++++++++++++++
++++++++++++++++++++++++++++
-+--------------------+-------------------------------------+
-|Interface Definition|Description |
-+====================+=====================================+
++--------------------+------------------------------------------------------------+
+|Interface Definition|Description |
++====================+============================================================+
|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3 |
-+--------------------+-------------------------------------+
-|Operation Type |POST |
-+--------------------+-------------------------------------+
-|Content-Type |application/json |
-+--------------------+-------------------------------------+
++--------------------+------------------------------------------------------------+
+|Operation Type |POST |
++--------------------+------------------------------------------------------------+
+|Content-Type |application/json |
++--------------------+------------------------------------------------------------+
Request Body:
@@ -1424,7 +1424,7 @@ Parameter Object
+------------------------------+-----------------+------------------------------------+
|resource |List of Resource |resource of service/resource |
+------------------------------+-----------------+------------------------------------+
-|requestInputs |key-value map |input of service/resource
+|requestInputs |key-value map |input of service/resource |
+------------------------------+-----------------+------------------------------------+
LocationConstraint Object
@@ -1472,15 +1472,15 @@ Response:
+-------------+---------+-----------+-------+------------------------------------------------------------------------+
Delete E2E service instance
-++++++++++++++++++++++++++++
++++++++++++++++++++++++++++
-+--------------------+-----------------------------------------------+
-|Interface Definition|Description |
-+====================+===============================================+
++--------------------+----------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+======================================================================+
|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}|
-+--------------------+-----------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+-----------------------------------------------+
++--------------------+----------------------------------------------------------------------+
+|Operation Type |DELETE |
++--------------------+----------------------------------------------------------------------+
Request Parameters:
@@ -1501,15 +1501,15 @@ Response:
+-------------+---------+-----------+-------+------------------------------------------------------------------------+
Query E2E service operation result
-++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++
-+--------------------+------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+========================================================================+
++--------------------+-----------------------------------------------------------------------------------------------+
+|Interface Definition|Description |
++====================+===============================================================================================+
|URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}/operations/{operationId}|
-+--------------------+------------------------------------------------------------------------+
-|Operation Type |GET |
-+--------------------+------------------------------------------------------------------------+
++--------------------+-----------------------------------------------------------------------------------------------+
+|Operation Type |GET |
++--------------------+-----------------------------------------------------------------------------------------------+
Request Parameters:
@@ -1548,7 +1548,7 @@ Response:
+------------------+---------+-----------+-------+------------------------------------------------------------------------+
Inventory APIs
-----------------
+--------------
create or update an existing service-instance
+++++++++++++++++++++++++++++++++++++++++++++
@@ -1740,10 +1740,10 @@ Response:
VFC APIs
----------
+--------
Create NS
-+++++++++++
++++++++++
+--------------------+-------------------+
|Interface Definition|Description |
@@ -1778,7 +1778,7 @@ Response:
+-----------------+---------+-----------+----------------+-------------------+
Get NS
-+++++++
+++++++
+--------------------+-------------------+
|Interface Definition|Description |
@@ -1869,7 +1869,7 @@ vnffgInfo Array:
+----------------------+---------+-----------+----------------+-------------------+
Instantiate NS
-+++++++++++++++
+++++++++++++++
+--------------------+-------------------------------------+
|Interface Definition|Description |
@@ -1898,7 +1898,7 @@ LocationConstraints Array:
+----------------------+---------+-----------+-------+-----------------------+
|Attribute |Qualifier|Cardinality|Content|Description |
+======================+=========+===========+=======+=======================+
-|vnfProfileId |M |1 |String |vnfProfileId |
+|vnfProfileId |M |1 |String |vnfProfileId |
+----------------------+---------+-----------+-------+-----------------------+
|vimid |M |1 |String |vimid |
+----------------------+---------+-----------+-------+-----------------------+
@@ -1912,7 +1912,7 @@ Response:
+--------------+---------+-----------+-------+-----------------------+
Terminate NS
-+++++++++++++++
+++++++++++++
+--------------------+-------------------------------------+
|Interface Definition|Description |
@@ -1945,7 +1945,7 @@ Response:
+--------------+---------+-----------+-------+-----------------------+
Delete NS
-+++++++++++++++
++++++++++
+--------------------+-------------------------------------+
|Interface Definition|Description |
@@ -1964,9 +1964,9 @@ Request Parameters:
+----------------------------+---------+-----------+-------+-----------------------------+
MultiVIM API
-----------------
+------------
Get token
-++++++++++
++++++++++
https://developer.openstack.org/api-ref/identity/v3/#password-authentication-with-unscoped-authorization
@@ -2051,7 +2051,7 @@ Response:
+-------------------------+------------------+--------------------------------------------------------------------------+
Create stack
-+++++++++++++
+++++++++++++
https://developer.openstack.org/api-ref/orchestration/v1/#create-stack
@@ -2108,7 +2108,7 @@ Response:
+-------------------------+------------------+--------------------------------------------------------------------------+
Get stack
-+++++++++++++
++++++++++
https://developer.openstack.org/api-ref/orchestration/v1/#show-stack-details
@@ -2187,7 +2187,7 @@ Response:
+-------------------------+------------------+------------------------------------------------------------------------------+
Delete stack
-+++++++++++++
+++++++++++++
https://developer.openstack.org/api-ref/orchestration/v1/#show-stack-details
@@ -2346,7 +2346,7 @@ Request Body:
+------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+
Create Keypair
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/compute/#create-or-import-keypair
@@ -2397,7 +2397,7 @@ Response:
+-----------------+------------------+------------------------------------------------------------------------------+
Delete Keypair
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/compute/#delete-keypair
@@ -2422,7 +2422,7 @@ Request Body:
+------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+
Create Network
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail#create-network
@@ -2543,7 +2543,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete Network
-+++++++++++++++
+++++++++++++++
https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail#delete-network
@@ -2566,7 +2566,7 @@ Request Body:
+----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+
Create Subnet
-+++++++++++++++
++++++++++++++
https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail,create-subnet-detail#create-subnet
@@ -2675,7 +2675,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete Subnet
-+++++++++++++++
++++++++++++++
https://developer.openstack.org/api-ref/networking/v2/?expanded=create-network-detail,delete-subnet-detail#delete-subnet
@@ -2698,7 +2698,7 @@ Request Body:
+----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+
Create Port
-+++++++++++++++
++++++++++++
https://developer.openstack.org/api-ref/networking/v2/#create-port
@@ -2829,7 +2829,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete Port
-+++++++++++++++
++++++++++++
https://developer.openstack.org/api-ref/network/v2/#delete-port
@@ -2852,7 +2852,7 @@ Request Body:
+----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+
Create Security Group
-++++++++++++++++++++++
++++++++++++++++++++++
https://developer.openstack.org/api-ref/network/v2/#create-security-group
@@ -2909,7 +2909,7 @@ Response:
+-----------------------------+------------------+------------------------------------------------------------------------------+
Delete security group
-++++++++++++++++++++++
++++++++++++++++++++++
https://developer.openstack.org/api-ref/network/v2/#delete-security-group
@@ -3007,7 +3007,7 @@ Response:
+-----------------------------+------------------+-------------------------------------------------------------------------------------------------+
Delete security group
-++++++++++++++++++++++
++++++++++++++++++++++
https://developer.openstack.org/api-ref/networking/v2/#delete-security-group-rule
@@ -3948,139 +3948,139 @@ Request Parameters:
+-------------------+---------+-----------+-------+-------------------------------------------------------------+
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|requestId |Y |1 |String |A unique ID to track multiple requests. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|callbackHeader |N |1 |String |The header information a client expecting in a async callback. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|sourceId |Y |1 |String |The unique ID of a client making an optimization call. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|requestType |Y |1 |String |The type of a request |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|numSolutions |N |1 |Integer|Expected number of solutions. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|optimizers |Y |1..N |List of Strings|A list of optimization services. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|timeout |N |1 |Integer|A tolerance window (in secs) for expecting solutions. Default is 600 secs.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+===============+==========================================================================+
+|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|requestId |Y |1 |String |A unique ID to track multiple requests. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|callbackHeader |N |1 |String |The header information a client expecting in a async callback. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|sourceId |Y |1 |String |The unique ID of a client making an optimization call. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|requestType |Y |1 |String |The type of a request |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|numSolutions |N |1 |Integer |Expected number of solutions. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|optimizers |Y |1..N |List of Strings|A list of optimization services. |
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
+|timeout |N |1 |Integer |A tolerance window (in secs) for expecting solutions. Default is 600 secs.|
++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+
PlacementInfo Object
-+-------------------+---------+-----------+-------+-------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=============================================================+
-|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|subscriberInfo |N |1 |Object |The information of a service subscriber. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+==============================+=======================================================================================================================================================================================================================================================================================================================================+
+|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.|
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service. |
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
+|subscriberInfo |N |1 |Object |The information of a service subscriber. |
++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
PlacementDemand Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|tenantId |N |1 |String |A tenant Id as defined in the ordering system. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+============================+=======================================================================+
+|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|tenantId |N |1 |String |A tenant Id as defined in the ordering system. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
+|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. |
++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+
SubscriberInfo Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|globalSubscriberId |Y |1 |String |An ID of a subscriber. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content|Description |
++=======================+=========+===========+=======+===================================================================================+
+|globalSubscriberId |Y |1 |String |An ID of a subscriber. |
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
+|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'. |
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
+|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. |
++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+
ModelMetaData Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelName |N |1 |String |A model name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelType |N |1 |String |A model type as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelVersion |N |1 |String |A model version as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content|Description |
++========================+=========+===========+=======+=======================================================================+
+|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelName |N |1 |String |A model name as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelType |N |1 |String |A model type as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelVersion |N |1 |String |A model version as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
+|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. |
++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+
Candidates Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|identifierType |Y |1 |String |The type of a candidate. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|identifiers |Y |1..N |List |A list of identifiers. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content|Description |
++===================+=========+===========+=======+================================================================================+
+|identifierType |Y |1 |String |The type of a candidate. |
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
+|identifiers |Y |1..N |List |A list of identifiers. |
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
+|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. |
++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+
ServiceInfo Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|serviceInstanceId |Y |1 |String |A service instance id associated with a request. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|serviceName |Y |1 |String |The name of a service |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+=====================+=======================================================================+
+|serviceInstanceId |Y |1 |String |A service instance id associated with a request. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|serviceName |Y |1 |String |The name of a service |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
LicenseInfo Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+------------------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+==============================+=======================================================================+
+|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. |
++-------------------+---------+-----------+------------------------------+-----------------------------------------------------------------------+
LicenseDemand Object
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|Attribute |Required |Cardinality|Content|Description |
-+===================+=========+===========+=======+=======================================================================+
-|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model.|
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
-|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|Attribute |Required |Cardinality|Content |Description |
++===================+=========+===========+=====================+=======================================================================+
+|resourceModuleName |Y |1 |String |A resource name as defined in a service model. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
+|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. |
++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+
LicenseModel Object
@@ -4105,4 +4105,4 @@ Response Body
|statusMessage |N |1 |String |Reasoning if a requestStatus is failed. |
+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
|requestStatus |Y |1 |String |The status of a request. |
-+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ \ No newline at end of file
++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
diff --git a/docs/architecture/architecture.rst b/docs/architecture/architecture.rst
index 52eb38cfe4..7636792c41 100644
--- a/docs/architecture/architecture.rst
+++ b/docs/architecture/architecture.rst
@@ -3,10 +3,10 @@
.. Copyright 2018 Huawei Technologies Co., Ltd.
SO - Architecture
-===============
+=================
SO Functional View
---------------------
+------------------
.. image:: ../images/SO_Architecture_1.png
@@ -21,9 +21,9 @@ SO Sub-Components
**API Handler**
RESTful interface to northbound clients
-
- * Handle service-level and infrastructure (VNF & network) requests
-
+
+* Handle service-level and infrastructure (VNF & network) requests
+
Service-agnostic APIs
* “Service Instantiation API”
@@ -31,7 +31,7 @@ SO Sub-Components
* Use SO Catalog to map input requests to BPMN flows
* Dynamic lookup based on service-model + action
* Input data forwarded to BPMN flow
-
+
Track open and completed requests via SO Request DB
Multiple API-H modules may support different APIs
@@ -49,7 +49,7 @@ SO Sub-Components
* Request and configure network resources via SDN-C
* Manage cloud resources via PO (OpenStack)
* Update inventory via A&AI
-
+
Perform error handling/rollback
**Resource Adapters**
@@ -59,7 +59,7 @@ SO Sub-Components
* Hides the details of complex interfaces (e.g. OpenStack APIs)
* Expose interfaces to BPMN flows as SOAP or REST APIs
* Support synchronous and asynchronous operations
-
+
Provided as part of SO platform for use by all BPMN flows
Use SO Catalog to map resource requests to a recipe/template
@@ -69,10 +69,10 @@ SO Sub-Components
* Merge input parameters with templates at run-time
**Data Stores**
-
+
Request DB
* Tracks open and completed requests
-
+
SO Catalog
* SO view of the SDC Catalog
* service and resource models, recipes, and templates
@@ -81,13 +81,13 @@ SO Sub-Components
Camunda DB
* Maintain state for BPMN flows
* Supports multiple active engines
-
+
**SDC Distribution Client**
Receive updated service models from SDC
* Event-bus notifications when new models available
* HTTP retrieval of models (TOSCA) and artifacts (Heat)
-
+
Receive distributions as TOSCA models
Populate SO Catalog
@@ -119,11 +119,3 @@ Third Party and Open Source
Tomcat
MySQL/MariaDB
Openstack Java SDK (“woorea”)
-
-
-
-
-
-
-
-
diff --git a/docs/installconfigure/Install_Configure_SO.rst b/docs/installconfigure/Install_Configure_SO.rst
index bdfd328fc5..1ac01cc782 100644
--- a/docs/installconfigure/Install_Configure_SO.rst
+++ b/docs/installconfigure/Install_Configure_SO.rst
@@ -3,7 +3,7 @@
.. Copyright 2017 Huawei Technologies Co., Ltd.
SO Install & Configure
-==========================================
+======================
Get Ubuntu
----------
@@ -13,6 +13,7 @@ Get VirtualBox and VirtualBox Guest Additions
---------------------------------------------
Make sure you have the VirtualBox Guest Additions ISO for your version of VirtualBox. I'm using VirtualBox 5.1.28. Save the Guest Additions ISO on your host computer along with the Ubuntu ISO. Get the Guest Additions ISO from here:
http://download.virtualbox.org/virtualbox
+
*NOTE*: Guest Additions versions prior to 5.1 will not work with Ubuntu 16.04.3. If you have an earlier version of VirtualBox, you should upgrade to the latest 5.1 version.
Create a new VM in VirtualBox for Ubuntu
@@ -73,9 +74,11 @@ Read-only: <unchecked>
Install Ubuntu in the VM
------------------------
-On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image". Select your Ubuntu ISO image.
+On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image".
+
+Select your Ubuntu ISO image:
-.. image:: images/Configure_ubuntu_SO_5.png
+.. image:: ../images/Configure_ubuntu_SO_5.png
After selecting the ISO image, start the VM.
@@ -83,14 +86,15 @@ Follow the prompts to install Ubuntu.
Proxy Configuration (optional)
------------------------------
-If you're behind a corporate firewall, configure some proxy settings. NOTE: your proxy configuration may require username and password credentials, not shown here.
+If you're behind a corporate firewall, configure some proxy settings.
+NOTE: your proxy configuration may require username and password credentials, not shown here.
**Ubuntu system proxy setting:**
System Settings → Network → Network proxy
(Replace "proxyhost" and port with your actual proxy information)
-.. image:: images/Configure_ubuntu_SO_6.png
+.. image:: ../images/Configure_ubuntu_SO_6.png
**apt proxy setting:**
Edit /etc/apt/apt.conf and add one line at the top (replace "proxyhost:port" with your actual proxy information):
@@ -117,7 +121,7 @@ Install VirtualBox Guest Additions
----------------------------------
On the "Storage" panel in VirtualBox, click on "[ optical drive ]" and then "Choose Disk Image". Select your VirtualBox Guest Additions ISO image.
-.. image:: images/Configure_ubuntu_SO_8.png
+.. image:: ../images/Configure_ubuntu_SO_8.png
In a VM terminal window, mount the cdrom:
@@ -135,7 +139,7 @@ Install necessary dependencies:
Install the guest additions. NOTE: look for errors in the command output! If you see an error that says you are missing kernel headers, the most likely cause is that you are using a VirtualBox version that is too old. The error message is misleading.
-.. code-block:: bash
+ .. code-block:: bash
cd /media/cdrom
sudo ./VBoxLinuxAdditions.run
@@ -161,4 +165,4 @@ Further Reading
Install_Docker.rst
Configure_git_and_gerrit.rst
- Workspace_and_Development_Tools.rst \ No newline at end of file
+ Workspace_and_Development_Tools.rst
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
index a1c1dd1cc4..2fd426dec2 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java
@@ -24,22 +24,27 @@ import javax.annotation.Priority;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.ext.Provider;
-import org.apache.http.HttpStatus;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestIdException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.slf4j.MDC;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Priority(2)
@Provider
@Component
public class RequestIdFilter implements ContainerRequestFilter {
- protected static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class);
+ private static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class);
@Autowired
private RequestsDbClient infraActiveRequestsClient;
@@ -48,11 +53,33 @@ public class RequestIdFilter implements ContainerRequestFilter {
public void filter(ContainerRequestContext context) throws IOException {
String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ logger.info("Checking if requestId: {} already exists in requestDb InfraActiveRequests table", requestId);
InfraActiveRequests infraActiveRequests = infraActiveRequestsClient.getInfraActiveRequestbyRequestId(requestId);
if (infraActiveRequests != null) {
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(HttpStatus.SC_BAD_REQUEST));
- logger.error("RequestID exists in RequestDB.InfraActiveRequests : {}", requestId);
+ logger.error(
+ "RequestId: {} already exists in RequestDB InfraActiveRequests table, throwing DuplicateRequestIdException",
+ requestId);
+ throw new DuplicateRequestIdException(createRequestError(requestId, "InfraActiveRequests"));
+ }
+ }
+
+ protected String createRequestError(String requestId, String requestTable) {
+ ObjectMapper mapper = new ObjectMapper();
+ RequestError error = new RequestError();
+ ServiceException serviceException = new ServiceException();
+ serviceException.setMessageId(ErrorNumbers.SVC_BAD_PARAMETER);
+ serviceException
+ .setText("RequestId: " + requestId + " already exists in the RequestDB " + requestTable + " table");
+ error.setServiceException(serviceException);
+ String errorMessage = null;
+
+ try {
+ errorMessage = mapper.writeValueAsString(error);
+ } catch (JsonProcessingException e) {
+ return "Unable to write requestError to String when requestId already exists in the RequestDb due to error: "
+ + e.getMessage();
}
+ return errorMessage;
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java
new file mode 100644
index 0000000000..f56b4218ba
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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.apihandlerinfra.exceptions;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+public class DuplicateRequestIdException extends WebApplicationException {
+
+ public DuplicateRequestIdException(String response) {
+ super(Response.status(Response.Status.BAD_REQUEST).entity(response).build());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
index 9bf83153b3..8716047603 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java
@@ -20,67 +20,85 @@
package org.onap.so.apihandler.filters;
-import static org.junit.Assert.assertEquals;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import java.io.IOException;
+import java.util.Collections;
import javax.ws.rs.container.ContainerRequestContext;
-import org.apache.http.HttpStatus;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoJUnitRunner;
-import org.mockito.junit.MockitoRule;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestIdException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.ServiceException;
import org.slf4j.MDC;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class RequestIdFilterTest {
@Mock
- ContainerRequestContext mockContext;
+ private ContainerRequestContext mockContext;
@Mock
- protected RequestsDbClient requestsDbClient;
+ private RequestsDbClient requestsDbClient;
@InjectMocks
@Spy
- RequestIdFilter requestIdFilter;
+ private RequestIdFilter requestIdFilter;
@Rule
public ExpectedException thrown = ExpectedException.none();
- @Rule
- public MockitoRule mockitoRule = MockitoJUnit.rule();
+ private static final String REQUEST_ID = "32807a28-1a14-4b88-b7b3-2950918aa769";
+ private ObjectMapper mapper = new ObjectMapper();
- @Test
- public void filterTest() throws IOException {
+ private RequestError getRequestError() throws IOException {
+ RequestError requestError = new RequestError();
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ ServiceException serviceException = new ServiceException();
+ serviceException.setMessageId("SVC0002");
+ serviceException.setText(
+ "RequestId: 32807a28-1a14-4b88-b7b3-2950918aa769 already exists in the RequestDB InfraActiveRequests table");
+ serviceException.setVariables(Collections.emptyList());
+ requestError.setServiceException(serviceException);
+ return requestError;
+ }
- String requestId = "32807a28-1a14-4b88-b7b3-2950918aa769";
+ @Test
+ public void filterTestInfra() throws IOException {
+ String error = mapper.writeValueAsString(getRequestError());
+ String requestId = REQUEST_ID;
MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
// ExpectedRecord InfraActiveRequests
InfraActiveRequests infraActiveRequests = new InfraActiveRequests();
- infraActiveRequests.setRequestStatus("FAILED");
- infraActiveRequests.setProgress(100L);
- infraActiveRequests.setLastModifiedBy("APIH");
- infraActiveRequests.setRequestScope("network");
- infraActiveRequests.setRequestAction("deleteInstance");
- infraActiveRequests.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa769");
+ infraActiveRequests.setRequestId(REQUEST_ID);
doReturn(infraActiveRequests).when(requestsDbClient).getInfraActiveRequestbyRequestId(requestId);
+ doReturn(error).when(requestIdFilter).createRequestError(REQUEST_ID, "InfraActiveRequests");
+ thrown.expect(DuplicateRequestIdException.class);
+ thrown.expectMessage("HTTP 400 Bad Request");
requestIdFilter.filter(mockContext);
+ }
- Mockito.verify(requestIdFilter, Mockito.times(1)).filter(mockContext);
- assertEquals(MDC.get(ONAPLogConstants.MDCs.RESPONSE_CODE), String.valueOf(HttpStatus.SC_BAD_REQUEST));
+ @Test
+ public void createRequestErrorTest() throws IOException {
+ RequestError requestError = getRequestError();
+ String result = requestIdFilter.createRequestError(REQUEST_ID, "InfraActiveRequests");
+ RequestError resultingError = mapper.readValue(result, RequestError.class);
+ assertThat(resultingError, sameBeanAs(requestError));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index ade13e7b57..554c794e3e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -196,7 +196,7 @@ public class InstanceManagement {
.setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
.setRequestAction(action.toString()).setServiceInstanceId(serviceInstanceId).setVnfId(vnfId)
.setServiceType(serviceInstanceType).setVnfType(vnfType)
- .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action))
+ .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action))
.setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri).build();
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
index 5306888570..e4532cd8d7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
@@ -27,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
@@ -150,6 +151,18 @@ public class RequestHandlerUtilsTest extends BaseTest {
}
+ @Test
+ public void test_mapJSONtoMSOStyleCustomWorkflowRequest() throws IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ String testRequest = inputStream("/CustomWorkflowRequest.json");
+ String resultString =
+ requestHandlerUtils.mapJSONtoMSOStyle(testRequest, null, true, Action.inPlaceSoftwareUpdate);
+ ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class);
+ assertEquals(sir.getRequestDetails().getCloudConfiguration().getTenantId(), "88a6ca3ee0394ade9403f075db23167e");
+ assertNotEquals(sir.getRequestDetails().getRequestParameters().getUserParams().size(), 0);
+ }
+
@Test
public void test_mapJSONtoMSOStyleUsePreload() throws IOException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json
new file mode 100644
index 0000000000..6c59ec5f1f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json
@@ -0,0 +1,21 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "xxxxxx",
+ "instanceName": "inPlaceSoftwareUpdateTest"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestParameters": {
+ "payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration-parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}",
+ "userParams": [{
+ "name": "vnf-id",
+ "value": "4603ad6d-dbfb-4899-a8bd-bc1dd0d74914"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 464cacb6b0..05845dd058 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -161,7 +161,7 @@ public abstract class InfraRequests implements java.io.Serializable {
private String rollbackExtSystemErrorSource;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
- @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID")
+ @JoinColumn(name = "SO_REQUEST_ID", referencedColumnName = "REQUEST_ID", updatable = false)
private List<CloudApiRequests> cloudApiRequests = new ArrayList<>();
@ResourceId
diff --git a/vnfm-simulator/vnfm-service/pom.xml b/vnfm-simulator/vnfm-service/pom.xml
index 7beccb6561..1e3244bae4 100644
--- a/vnfm-simulator/vnfm-service/pom.xml
+++ b/vnfm-simulator/vnfm-service/pom.xml
@@ -44,6 +44,11 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.springframework.security.oauth</groupId>
+ <artifactId>spring-security-oauth2</artifactId>
+ <version>2.3.6.RELEASE</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java
new file mode 100644
index 0000000000..5d2c310635
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/AuthorizationServerConfig.java
@@ -0,0 +1,28 @@
+package org.onap.svnfm.simulator.oauth;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
+
+@Configuration
+@EnableAuthorizationServer
+@Profile("oauth-authentication")
+/**
+ * Configures the authorization server for oauth token based authentication when the spring profile
+ * "oauth-authentication" is active
+ */
+public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
+
+ private static final int ONE_DAY = 60 * 60 * 24;
+
+ @Override
+ public void configure(final ClientDetailsServiceConfigurer clients) throws Exception {
+ clients.inMemory().withClient("vnfmadapter")
+ .secret("$2a$10$dHzTlqSBcm8hdO52LBvnX./zNTvUzzJy.lZrc4bCBL5gkln0wX6T6")
+ .authorizedGrantTypes("client_credentials").scopes("write").accessTokenValiditySeconds(ONE_DAY)
+ .refreshTokenValiditySeconds(ONE_DAY);
+ }
+
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java
new file mode 100644
index 0000000000..d6eda28eb6
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/JsonSerializerConfiguration.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.svnfm.simulator.oauth;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.GsonHttpMessageConverter;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+/**
+ * Configures message converter
+ */
+@Configuration
+public class JsonSerializerConfiguration {
+
+ @Bean
+ public HttpMessageConverters customConverters() {
+ final Collection<HttpMessageConverter<?>> messageConverters = new ArrayList<>();
+
+ final Gson gson = new GsonBuilder()
+ .registerTypeHierarchyAdapter(OAuth2AccessToken.class, new OAuth2AccessTokenAdapter()).create();
+ final GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter(gson);
+ messageConverters.add(gsonHttpMessageConverter);
+ return new HttpMessageConverters(true, messageConverters);
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java
new file mode 100644
index 0000000000..7bccffa2e0
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2AccessTokenAdapter.java
@@ -0,0 +1,31 @@
+package org.onap.svnfm.simulator.oauth;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import java.lang.reflect.Type;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+
+public class OAuth2AccessTokenAdapter implements JsonSerializer<OAuth2AccessToken> {
+
+ @Override
+ public JsonElement serialize(final OAuth2AccessToken src, final Type typeOfSrc,
+ final JsonSerializationContext context) {
+ final JsonObject obj = new JsonObject();
+ obj.addProperty(OAuth2AccessToken.ACCESS_TOKEN, src.getValue());
+ obj.addProperty(OAuth2AccessToken.TOKEN_TYPE, src.getTokenType());
+ if (src.getRefreshToken() != null) {
+ obj.addProperty(OAuth2AccessToken.REFRESH_TOKEN, src.getRefreshToken().getValue());
+ }
+ obj.addProperty(OAuth2AccessToken.EXPIRES_IN, src.getExpiresIn());
+ final JsonArray scopeObj = new JsonArray();
+ for (final String scope : src.getScope()) {
+ scopeObj.add(scope);
+ }
+ obj.add(OAuth2AccessToken.SCOPE, scopeObj);
+
+ return obj;
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java
new file mode 100644
index 0000000000..18fb1a9461
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/oauth/OAuth2ResourceServer.java
@@ -0,0 +1,36 @@
+/*-
+ * ============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.svnfm.simulator.oauth;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
+import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
+
+@Configuration
+@EnableResourceServer
+@Profile("oauth-authentication")
+/**
+ * Enforces oauth token based authentication when the spring profile "oauth-authentication" is active
+ */
+public class OAuth2ResourceServer extends ResourceServerConfigurerAdapter {
+
+}