aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/configuration/AbstractServiceProviderConfiguration.java (renamed from adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/AbstractServiceProviderConfiguration.java)19
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml2
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java9
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java56
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java19
-rw-r--r--adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java17
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java1
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java2
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml3
-rw-r--r--adapters/mso-openstack-adapters/pom.xml11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java22
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java10
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java51
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java7
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml7
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml7
-rw-r--r--adapters/so-appc-orchestrator/pom.xml3
-rw-r--r--asdc-controller/pom.xml7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java115
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json9
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java110
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java123
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java3
-rw-r--r--docs/conf.py2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java54
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java122
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java24
-rw-r--r--packages/docker/pom.xml4
-rw-r--r--pom.xml4
-rw-r--r--so-simulator/pom.xml10
51 files changed, 780 insertions, 205 deletions
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/AbstractServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/configuration/AbstractServiceProviderConfiguration.java
index b9ce641096..6161fa60f9 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/AbstractServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-adapter-common/src/main/java/org/onap/so/adapters/etsi/sol003/adapter/common/configuration/AbstractServiceProviderConfiguration.java
@@ -1,27 +1,25 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2020 Ericsson. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-
-package org.onap.so.adapters.etsisol003adapter.lcm.extclients;
+package org.onap.so.adapters.etsi.sol003.adapter.common.configuration;
import java.util.Iterator;
-import org.onap.so.adapters.etsisol003adapter.lcm.v1.JSON;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@@ -33,6 +31,7 @@ import com.google.gson.Gson;
* that will be useful to some such classes.
*
* @author gareth.roper@est.tech
+ * @author Waqas Ikram (waqas.ikram@est.tech)
*/
public abstract class AbstractServiceProviderConfiguration {
@@ -43,7 +42,9 @@ public abstract class AbstractServiceProviderConfiguration {
iterator.remove();
}
}
- final Gson gson = new JSON().getGson();
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
+ restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(getGson()));
}
+
+ protected abstract Gson getGson();
+
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml
index 560cd87bee..a64dbc6eed 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/pom.xml
@@ -106,4 +106,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java
index e35dafb4ea..da727b395a 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-lcm/etsi-sol003-lcm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/lcm/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -39,7 +39,8 @@ 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.etsisol003adapter.lcm.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsi.sol003.adapter.common.configuration.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.lcm.v1.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
@@ -55,6 +56,7 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.token.grant.client.ClientCredentialsResourceDetails;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
/**
* Configures the HttpRestServiceProvider for REST call to a VNFM.
@@ -151,4 +153,9 @@ public class VnfmServiceProviderConfiguration extends AbstractServiceProviderCon
}
}
+ @Override
+ protected Gson getGson() {
+ return new JSON().getGson();
+ }
+
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java
deleted file mode 100644
index f9da6981c8..0000000000
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/AbstractServiceProviderConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.adapters.etsisol003adapter.pkgm.extclients;
-
-import java.time.LocalDateTime;
-import java.util.Iterator;
-import org.onap.so.adapters.etsisol003adapter.pkgm.JSON;
-import org.onap.so.adapters.etsisol003adapter.pkgm.rest.EtsiSubscriptionNotificationController;
-import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.json.GsonHttpMessageConverter;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.web.client.RestTemplate;
-import org.threeten.bp.OffsetDateTime;
-import com.google.gson.Gson;
-
-/**
- * A base class that can be extended by classes for configuring HttpRestServiceProvider classes. Provides common methods
- * that will be useful to some such classes.
- *
- * @author gareth.roper@est.tech
- */
-public abstract class AbstractServiceProviderConfiguration {
- private final JSON.OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new JSON.OffsetDateTimeTypeAdapter();
-
- public void setGsonMessageConverter(final RestTemplate restTemplate) {
- final Iterator<HttpMessageConverter<?>> iterator = restTemplate.getMessageConverters().iterator();
- while (iterator.hasNext()) {
- if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
- iterator.remove();
- }
- }
- final Gson gson = JSON.createGson().registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
- .registerTypeAdapter(LocalDateTime.class,
- new EtsiSubscriptionNotificationController.LocalDateTimeTypeAdapter())
- .create();
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
- }
-}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
index 5caeebe53d..1ff3672df9 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/etsicatalog/EtsiCatalogServiceProviderConfiguration.java
@@ -25,7 +25,6 @@ import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
-import java.util.Iterator;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
@@ -40,7 +39,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
-import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsi.sol003.adapter.common.configuration.AbstractServiceProviderConfiguration;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.configuration.rest.HttpClientConnectionConfiguration;
import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
@@ -56,12 +55,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
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.web.client.RestTemplate;
import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
/**
* Configures the HttpRestServiceProvider to make REST calls to the ETSI Catalog Manager
@@ -173,15 +168,9 @@ public class EtsiCatalogServiceProviderConfiguration extends AbstractServiceProv
}
- public void setGsonMessageConverter(final RestTemplate restTemplate) {
- final Iterator<HttpMessageConverter<?>> iterator = restTemplate.getMessageConverters().iterator();
- while (iterator.hasNext()) {
- if (iterator.next() instanceof MappingJackson2HttpMessageConverter) {
- iterator.remove();
- }
- }
- final Gson gson = new GsonBuilder().create();
- restTemplate.getMessageConverters().add(new GsonHttpMessageConverter(gson));
+ @Override
+ protected Gson getGson() {
+ return new JSON().getGson();
}
}
diff --git a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
index 568c3df48b..22bbef9c01 100644
--- a/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
+++ b/adapters/etsi-sol003-adapter/etsi-sol003-pkgm/etsi-sol003-pkgm-adapter/src/main/java/org/onap/so/adapters/etsisol003adapter/pkgm/extclients/vnfm/VnfmHttpServiceProviderConfiguration.java
@@ -20,7 +20,11 @@
package org.onap.so.adapters.etsisol003adapter.pkgm.extclients.vnfm;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
-import org.onap.so.adapters.etsisol003adapter.pkgm.extclients.AbstractServiceProviderConfiguration;
+import java.time.LocalDateTime;
+import java.time.OffsetDateTime;
+import org.onap.so.adapters.etsi.sol003.adapter.common.configuration.AbstractServiceProviderConfiguration;
+import org.onap.so.adapters.etsisol003adapter.pkgm.JSON;
+import org.onap.so.adapters.etsisol003adapter.pkgm.rest.EtsiSubscriptionNotificationController;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
@@ -29,6 +33,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
+import com.google.gson.Gson;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
@@ -36,6 +41,8 @@ import org.springframework.web.client.RestTemplate;
*/
@Configuration
public class VnfmHttpServiceProviderConfiguration extends AbstractServiceProviderConfiguration {
+ private final JSON.OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new JSON.OffsetDateTimeTypeAdapter();
+
public static final String VNFM_ADAPTER_HTTP_SERVICE_PROVIDER_BEAN = "vnfmAdapterHttpServiceProvider";
@Bean
@@ -46,4 +53,12 @@ public class VnfmHttpServiceProviderConfiguration extends AbstractServiceProvide
return new HttpRestServiceProviderImpl(restTemplate, new BasicHttpHeadersProvider().getHttpHeaders());
}
+ @Override
+ protected Gson getGson() {
+ return JSON.createGson().registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter)
+ .registerTypeAdapter(LocalDateTime.class,
+ new EtsiSubscriptionNotificationController.LocalDateTimeTypeAdapter())
+ .create();
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java
index d45f685795..1506fda817 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java
@@ -28,6 +28,7 @@ public class MsoCloudifyExceptionTest {
MsoCloudifyException mcl = new MsoCloudifyException(200, "message", "detail", e);
mce.setPendingWorkflow(pendingWorkflow);
assert (mcl.toString() != null);
+ assertNotNull(mce);
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java
index 08b2356fdc..25dcae3c2c 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java
@@ -24,6 +24,7 @@ public class MsoCloudifyTest {
MsoBlueprintAlreadyExists mbae = new MsoBlueprintAlreadyExists("blueprintId", "cloud");
MsoCloudifyManagerNotFound mcm = new MsoCloudifyManagerNotFound("cloudSiteId");
MsoDeploymentAlreadyExists mdae = new MsoDeploymentAlreadyExists("deploymentId", "cloud");
+ assertNotNull((mbae));
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java
index 48c5c877a5..dc74d83d04 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java
@@ -27,6 +27,7 @@ public class MsoCloudifyTimeoutTest {
MsoCloudifyTimeout mct = new MsoCloudifyTimeout(execution);
mct.getExecution();
assert (mct.toString() != null);
+ assertNotNull(mct);
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java
index ece5b21f19..3f2a6263d3 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java
@@ -15,6 +15,7 @@
package org.onap.so.openstack.beans;
+import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
@@ -32,5 +33,6 @@ public class MsoTenantTest {
assert (ms.getMetadata().equals(map));
assert (ms.getTenantId().equals("tenantId"));
assert (ms.getTenantName().equals("tenantName"));
+ assertNotNull(map);
}
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java
index 954f237ffe..de39df7b35 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java
@@ -17,6 +17,7 @@ package org.onap.so.openstack.utils;
import static org.mockito.Mockito.mock;
import org.junit.Test;
+import static org.junit.Assert.*;
public class MsoHeatEnvironmentParameterTest {
@@ -35,6 +36,7 @@ public class MsoHeatEnvironmentParameterTest {
// assertTrue(op.equals(hep));
meo.equals(op);
meo.hashCode();
+ assertNotNull(mea);
}
}
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 8735f98804..5b3038fac7 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -39,6 +39,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 53af40ca4b..933077b59a 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -18,10 +18,6 @@
<plugins>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- </plugin>
- <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
@@ -135,6 +131,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -153,9 +152,7 @@
<executions>
<execution>
<id>original</id>
- <configuration>
- <skip>false</skip>
- </configuration>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
index 2f7155bffc..8cdd37d43f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AbstractAuditService.java
@@ -21,7 +21,6 @@
package org.onap.so.adapters.tasks.audit;
-import java.util.Optional;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.onap.so.utils.ExternalTaskUtils;
@@ -37,8 +36,6 @@ public abstract class AbstractAuditService extends ExternalTaskUtils {
private static final Logger logger = LoggerFactory.getLogger(AbstractAuditService.class);
-
-
protected static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI =
"Unable to find all VServers and L-Interaces in A&AI";
@@ -52,29 +49,27 @@ public abstract class AbstractAuditService extends ExternalTaskUtils {
}
/**
- * @param auditHeatStackFailed
* @param auditList
* @return
*/
- protected boolean didCreateAuditFail(Optional<AAIObjectAuditList> auditList) {
- if (auditList.get().getAuditList() != null && !auditList.get().getAuditList().isEmpty()) {
+ protected boolean didCreateAuditFail(AAIObjectAuditList auditList) {
+ if (isAuditListNotNullAndNotEmpty(auditList)) {
if (logger.isInfoEnabled()) {
- logger.info("Audit Results: {}", auditList.get().toString());
+ logger.info("Audit Results: {}", auditList.toString());
}
- return auditList.get().getAuditList().stream().filter(auditObject -> !auditObject.isDoesObjectExist())
- .findFirst().map(v -> true).orElse(false);
+ return auditList.getAuditList().stream().filter(auditObject -> !auditObject.isDoesObjectExist()).findFirst()
+ .map(v -> true).orElse(false);
} else {
return false;
}
}
/**
- * @param auditHeatStackFailed
* @param auditList
* @return
*/
protected boolean didDeleteAuditFail(AAIObjectAuditList auditList) {
- if (auditList.getAuditList() != null && !auditList.getAuditList().isEmpty()) {
+ if (isAuditListNotNullAndNotEmpty(auditList)) {
if (logger.isInfoEnabled()) {
logger.info("Audit Results: {}", auditList.toString());
}
@@ -84,4 +79,9 @@ public abstract class AbstractAuditService extends ExternalTaskUtils {
return false;
}
}
+
+ private boolean isAuditListNotNullAndNotEmpty(AAIObjectAuditList auditList) {
+ return auditList != null && auditList.getAuditList() != null && !auditList.getAuditList().isEmpty();
+ }
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
index 010475c87a..c06460c386 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditCreateStackService.java
@@ -67,7 +67,7 @@ public class AuditCreateStackService extends AbstractAuditService {
auditListOpt.get().setHeatStackName(auditInventory.getHeatStackName());
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
variables.put("auditInventoryResult", objectMapper.getMapper().writeValueAsString(auditListOpt.get()));
- success = !didCreateAuditFail(auditListOpt);
+ success = !didCreateAuditFail(auditListOpt.get());
}
} catch (Exception e) {
logger.error("Error during audit of stack", e);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index a00b9f9002..32cd92d70e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -59,7 +59,6 @@ import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.Vlan;
import org.onap.aai.domain.yang.Vlans;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
@@ -69,6 +68,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.ServerType;
import org.onap.so.heatbridge.constants.HeatBridgeConstants;
@@ -263,7 +263,9 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lIf.setInterfaceId(port.getId());
lIf.setInterfaceName(port.getName());
lIf.setMacaddr(port.getMacAddress());
- lIf.setNetworkName((String) port.getProfile().get("physical_network"));
+ if (port.getProfile() != null && port.getProfile().get("physical_network") != null) {
+ lIf.setNetworkName((String) port.getProfile().get("physical_network"));
+ }
lIf.setIsPortMirrored(false);
lIf.setIsIpUnnumbered(false);
lIf.setInMaint(false);
@@ -338,7 +340,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
private void updateLInterfaceVlan(final Port port, final LInterface lIf) {
Vlan vlan = new Vlan();
Network network = osClient.getNetworkById(port.getNetworkId());
- if (network.getNetworkType().equals(NetworkType.VLAN)) {
+ if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) {
vlan.setVlanInterface(network.getName() + network.getProviderSegID());
vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID()));
@@ -352,7 +354,7 @@ public class HeatBridgeImpl implements HeatBridgeApi {
lIf.setVlans(vlans);
}
// Build sriov-vf to the l-interface
- if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
+ if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
SriovVfs sriovVfs = new SriovVfs();
// JAXB does not generate setters for list, however getter ensures its creation.
// Thus, all list manipulations must be made on live list.
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java
new file mode 100644
index 0000000000..c70e60e9d3
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AbstractAuditServiceTest.java
@@ -0,0 +1,51 @@
+package org.onap.so.adapters.tasks.audit;
+
+import org.junit.Test;
+import org.onap.so.objects.audit.AAIObjectAudit;
+import org.onap.so.objects.audit.AAIObjectAuditList;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class AbstractAuditServiceTest extends AbstractAuditService {
+
+ private AAIObjectAuditList getAuditListWithObjectWithExistenceStateOf(boolean existenceState) {
+ AAIObjectAudit auditObject = new AAIObjectAudit();
+ AAIObjectAuditList auditList = new AAIObjectAuditList();
+
+ auditObject.setDoesObjectExist(existenceState);
+ auditList.getAuditList().add(auditObject);
+
+ return auditList;
+ }
+
+ @Test
+ public void didCreateAuditFail_shouldReturnFalse_whenGivenNull() {
+ assertFalse(didCreateAuditFail(null));
+ }
+
+ @Test
+ public void didCreateAuditFail_shouldReturnTrue_whenGivenNotExistingObject() {
+ assertTrue(didCreateAuditFail(getAuditListWithObjectWithExistenceStateOf(false)));
+ }
+
+ @Test
+ public void didCreateAuditFail_shouldReturnFalse_whenGivenExistingObject() {
+ assertFalse(didCreateAuditFail(getAuditListWithObjectWithExistenceStateOf(true)));
+ }
+
+ @Test
+ public void didDeleteAuditFail_shouldReturnFalse_whenGivenNull() {
+ assertFalse(didDeleteAuditFail(null));
+ }
+
+ @Test
+ public void didDeleteAuditFail_shouldReturnTrue_whenGivenExistingObject() {
+ assertTrue(didDeleteAuditFail(getAuditListWithObjectWithExistenceStateOf(true)));
+ }
+
+ @Test
+ public void didDeleteAuditFail_shouldReturnFalse_whenGivenNotExistingObject() {
+ assertFalse(didDeleteAuditFail(getAuditListWithObjectWithExistenceStateOf(false)));
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
index a10ab4b7df..78dbcd94c2 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditStackServiceDataTest.java
@@ -179,13 +179,13 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@Test
public void determineAuditResult_Test() throws Exception {
- boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess);
+ boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess.get());
assertEquals(false, actual);
}
@Test
public void determineAuditResult_Failure_Test() throws Exception {
- boolean actual = auditStackService.didCreateAuditFail(auditListOptFailure);
+ boolean actual = auditStackService.didCreateAuditFail(auditListOptFailure.get());
assertEquals(true, actual);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
index 6e3312b1d3..106a96a091 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java
@@ -16,6 +16,7 @@
package org.onap.so.adapters.tenant.exceptions;
import org.junit.Test;
+import static org.junit.Assert.*;
public class TenantAlreadyExistsTest {
@@ -23,5 +24,6 @@ public class TenantAlreadyExistsTest {
public void test() {
TenantAlreadyExists tar = new TenantAlreadyExists("name", "cloudId", "tenantId");
assert (tar != null);
+ assertNotNull(tar);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
index 7314a9f1e2..ece92b4ac0 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java
@@ -19,6 +19,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import static org.junit.Assert.*;
public class TenantExceptionBeanTest {
@@ -38,5 +39,6 @@ public class TenantExceptionBeanTest {
teb.setCategory(MsoExceptionCategory.USERDATA);
assert (teb.getMessage().equals("message"));
assert (teb.getCategory() != null);
+ assertNotNull(teb);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
index 83eb1f1bdc..1ce4c664ac 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java
@@ -19,6 +19,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import static org.junit.Assert.*;
public class TenantExceptionTest {
@@ -40,5 +41,6 @@ public class TenantExceptionTest {
te.setFaultInfo(teb);
assert (te.getFaultInfo() != null);
assert (te.getFaultInfo().equals(teb));
+ assertNotNull(teb);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
index 1a308b7c4c..92761c8453 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java
@@ -36,6 +36,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.entity.MsoRequest;
import org.springframework.beans.factory.annotation.Autowired;
+import static org.junit.Assert.assertNotNull;
public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
@@ -90,6 +91,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils {
msoRequest.setServiceInstanceId("12345");
instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId",
msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest");
+ assertNotNull(msoRequest);
}
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index 9fc2aba948..909a558cff 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -57,6 +57,7 @@ import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.stubbing.Scenario;
+import static org.junit.Assert.assertNotNull;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
@@ -86,6 +87,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE,
Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(map);
}
@Test
@@ -101,6 +103,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, null, Boolean.TRUE, Boolean.FALSE,
msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>());
+ assertNotNull(map);
}
@Test
@@ -132,6 +135,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.FALSE, Boolean.TRUE,
Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(map);
}
@@ -149,6 +153,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
"VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE,
Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(map);
}
@@ -479,6 +484,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
"volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId",
"b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(),
new Holder<VnfRollback>());
+ assertNotNull(msoRequest);
}
@Test
@@ -499,6 +505,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
} catch (Exception e) {
}
+ assertNotNull(outputs);
}
private VfModuleCustomization getVfModuleCustomization() {
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index f9026d82c8..3463642382 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -169,9 +169,7 @@
<executions>
<execution>
<id>original</id>
- <configuration>
- <skip>false</skip>
- </configuration>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
@@ -181,6 +179,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index f54c2ec568..3b76c23ae6 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -70,9 +70,7 @@
<executions>
<execution>
<id>original</id>
- <configuration>
- <skip>false</skip>
- </configuration>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
@@ -86,6 +84,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/adapters/so-appc-orchestrator/pom.xml b/adapters/so-appc-orchestrator/pom.xml
index f8d8fabcf7..f7fc0bca4e 100644
--- a/adapters/so-appc-orchestrator/pom.xml
+++ b/adapters/so-appc-orchestrator/pom.xml
@@ -40,6 +40,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index e7e95481aa..e4c50d36f9 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -148,6 +148,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -166,9 +169,7 @@
<executions>
<execution>
<id>original</id>
- <configuration>
- <skip>false</skip>
- </configuration>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
index 3a4df68f02..963210b993 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
@@ -109,16 +109,20 @@ public class InstanceResourceList {
}
// check if the resource contains vf-module
- if (vnfResource != null && vnfResource.getVfModules() != null) {
+ if (isVnfResourceWithVfModule(vnfResource)) {
sequencedResourceList.addAll(vnfResource.getVfModules());
}
return sequencedResourceList;
}
+ private static boolean isVnfResourceWithVfModule(VnfResource vnfResource) {
+ return vnfResource != null && vnfResource.getVfModules() != null;
+ }
+
private static List<Resource> getGroupResourceInstanceList(VnfResource vnfResource, JsonObject vfObj) {
List<Resource> sequencedResourceList = new ArrayList<>();
- if (vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder())) {
+ if (isVnfGroupOrderFilled(vnfResource)) {
String[] grpSequence = vnfResource.getGroupOrder().split(",");
for (String grpType : grpSequence) {
for (GroupResource gResource : vnfResource.getGroups()) {
@@ -150,4 +154,8 @@ public class InstanceResourceList {
}
return sequencedResourceList;
}
+
+ private static boolean isVnfGroupOrderFilled(VnfResource vnfResource) {
+ return vnfResource.getGroupOrder() != null && !StringUtils.isEmpty(vnfResource.getGroupOrder());
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
index f3233f2350..19e678d6b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
@@ -8,6 +8,7 @@ import org.onap.so.bpmn.core.domain.Resource;
import org.onap.so.bpmn.core.domain.ResourceType;
import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.core.domain.VnfcResource;
+import org.onap.so.bpmn.core.domain.ModuleResource;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -24,7 +25,7 @@ public class InstnaceResourceListTest {
String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
List<Resource> instanceResourceList =
InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest);
- Assert.assertEquals(7, instanceResourceList.size());
+ Assert.assertEquals(9, instanceResourceList.size());
Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
Assert.assertEquals("device", instanceResourceList.get(1).getModelInfo().getModelName());
@@ -32,9 +33,12 @@ public class InstnaceResourceListTest {
Assert.assertEquals("sitewan", instanceResourceList.get(2).getModelInfo().getModelName());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType());
Assert.assertEquals("sitewan", instanceResourceList.get(3).getModelInfo().getModelName());
- Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(4).getResourceType());
- Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(5).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(4).getResourceType());
+ Assert.assertEquals("dummy", instanceResourceList.get(4).getModelInfo().getModelName());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(5).getResourceType());
Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(6).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(7).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(8).getResourceType());
}
// Test when PK is empty
@@ -48,6 +52,63 @@ public class InstnaceResourceListTest {
Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
}
+ @Test
+ public void testSimpleVFResourceWithGroup() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
+
+ createGroupKeyResource(vnfResource);
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(2, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
+ Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
+ }
+
+ @Test
+ public void testVFResourceWithEmptyGroup() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[emptygroup_list2,INDEX,name]\"}");
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(1, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ }
+
+ @Test
+ public void testVFResourceWithModule() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"ipaddress|127.0.0.1\"}");
+
+ // Come from package org.onap.so.bpmn.core.domain.VnfResourceTest
+ List<ModuleResource> moduleResources;
+ moduleResources = new ArrayList<>();
+ ModuleResource moduleresource = getModuleResource();
+ moduleResources.add(moduleresource);
+ vnfResource.setModules(moduleResources);
+
+ List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
+ Assert.assertEquals(2, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.MODULE, instanceResourceList.get(1).getResourceType());
+ }
+
+ private ModuleResource getModuleResource() {
+ ModuleResource moduleresource = new ModuleResource();
+ moduleresource.setVfModuleName("vfModuleName");
+ moduleresource.setHeatStackId("heatStackId");
+ moduleresource.setIsBase(true);
+ moduleresource.setVfModuleLabel("vfModuleLabel");
+ moduleresource.setInitialCount(0);
+ moduleresource.setVfModuleType("vfModuleType");
+ moduleresource.setHasVolumeGroup(true);
+ return moduleresource;
+ }
+
// Test when PK is not empty and PK does not contain any groups
@Test
public void testVFWithEmptyGroupResource() throws IOException {
@@ -66,16 +127,7 @@ public class InstnaceResourceListTest {
VnfResource vnfResource = new VnfResource();
vnfResource.setResourceInput("{\"a\":\"[emptygroup_list,INDEX,name]\"}");
- VnfcResource vnfcResource = new VnfcResource();
- vnfcResource.setResourceInput("{\"a\":\"test|default_value\"}");
- GroupResource groupResource = new GroupResource();
- groupResource.setVnfcs(Arrays.asList(vnfcResource));
- ModelInfo wanModel = new ModelInfo();
- wanModel.setModelName("wan");
- groupResource.setModelInfo(wanModel);
-
- vnfResource.setGroupOrder("wan");
- vnfResource.setGroups(Arrays.asList(groupResource));
+ createGroupKeyResource(vnfResource);
List<Resource> instanceResourceList = InstanceResourceList.getInstanceResourceList(vnfResource, uuiRequest);
Assert.assertEquals(2, instanceResourceList.size());
@@ -84,29 +136,34 @@ public class InstnaceResourceListTest {
Assert.assertEquals("wan", instanceResourceList.get(1).getModelInfo().getModelName());
}
+ private void createGroupKeyResource(VnfResource vnfResource) {
+ GroupResource groupResource = prepareGroupResource("{\"a\":\"test|default_value\"}", "wan");
+
+ vnfResource.setGroupOrder("wan");
+ vnfResource.setGroups(Arrays.asList(groupResource));
+ }
+
private VnfResource createResourceSequence() {
VnfResource vnfResource = new VnfResource();
vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}");
- VnfcResource vnfcResource = new VnfcResource();
- vnfcResource.setResourceInput("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}");
+ GroupResource groupResource = prepareGroupResource("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}", "sitewan");
+ GroupResource groupResource2 = prepareGroupResource("{\"a\":\"[sdwandevice_list,INDEX,test]\"}", "device");
+ GroupResource groupDummyResource = prepareGroupResource("{\"a\":\"[dummy,INDEX,test]\"}", "dummy");
- GroupResource groupResource = new GroupResource();
- groupResource.setVnfcs(Arrays.asList(vnfcResource));
- ModelInfo wanModel = new ModelInfo();
- wanModel.setModelName("sitewan");
- groupResource.setModelInfo(wanModel);
+ vnfResource.setGroupOrder("device,sitewan,dummy");
+ vnfResource.setGroups(Arrays.asList(groupResource, groupResource2, groupDummyResource));
+ return vnfResource;
+ }
+ private GroupResource prepareGroupResource(String sourceInput, String modelName) {
VnfcResource vnfcDeviceResource = new VnfcResource();
- vnfcDeviceResource.setResourceInput("{\"a\":\"[sdwandevice_list,INDEX,test]\"}");
- GroupResource groupResource2 = new GroupResource();
- groupResource2.setVnfcs(Arrays.asList(vnfcDeviceResource));
+ vnfcDeviceResource.setResourceInput(sourceInput);
+ GroupResource groupResource = new GroupResource();
+ groupResource.setVnfcs(Arrays.asList(vnfcDeviceResource));
ModelInfo deviceModel = new ModelInfo();
- deviceModel.setModelName("device");
- groupResource2.setModelInfo(deviceModel);
-
- vnfResource.setGroupOrder("device,sitewan");
- vnfResource.setGroups(Arrays.asList(groupResource, groupResource2));
- return vnfResource;
+ deviceModel.setModelName(modelName);
+ groupResource.setModelInfo(deviceModel);
+ return groupResource;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
index a111ae2646..cf0f2d1933 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
@@ -80,6 +80,9 @@
"portNumer":"0/0/1"
}
],
+ "emptygroup_list2": [
+
+ ],
"sdwanvpnresource_list":[
{
"sdwanvpn_topology":"hub_spoke",
@@ -155,7 +158,8 @@
"class":"VNF",
"systemIp":"20.20.20.1"
}
- ]
+ ],
+ "dummy":""
},
{
"sdwansite_emails":"chenchuanyu@huawei.com",
@@ -192,7 +196,8 @@
"class":"PNF",
"systemIp":"20.20.20.2"
}
- ]
+ ],
+ "dummy":""
}
]
}
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index a3d0dd50b3..7d88271343 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -131,9 +131,7 @@
</execution>
<execution>
<id>original</id>
- <configuration>
- <skip>false</skip>
- </configuration>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
@@ -158,6 +156,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java
new file mode 100644
index 0000000000..fd7498f468
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java
@@ -0,0 +1,110 @@
+package org.onap.so.bpmn.common.workflow.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.migration.MigrationInstruction;
+import org.camunda.bpm.engine.migration.MigrationPlan;
+import org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder;
+import org.camunda.bpm.engine.repository.ProcessDefinition;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstanceQuery;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.event.EventListener;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Service;
+
+@Service
+public class AutoProcessInstanceMigrationService {
+
+ private static Logger logger = LoggerFactory.getLogger(AutoProcessInstanceMigrationService.class);
+
+ @Autowired
+ private Environment env;
+ @Autowired
+ protected ProcessEngine processEngine;
+
+ @Value("${migration.autoMigrationEnabled:false}")
+ private boolean autoMigrationEnabled;
+
+ private RuntimeService runtimeService;
+ private RepositoryService repositoryService;
+ private List<String> processDefinitionKeys;
+
+ @EventListener(ApplicationReadyEvent.class)
+ protected void executeAutoProcessInstanceMigrations() {
+ if (autoMigrationEnabled) {
+ runtimeService = processEngine.getRuntimeService();
+ repositoryService = processEngine.getRepositoryService();
+ for (ProcessDefinition definition : getProcessDefinitions()) {
+ for (ProcessDefinition procDefOld : getOldProcessDefinitions(definition.getKey(),
+ definition.getVersion())) {
+ migrate(procDefOld.getId(), definition.getId());
+ }
+ }
+ }
+ }
+
+ protected List<ProcessDefinition> getProcessDefinitions() {
+ List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
+ processDefinitionKeys = env.getProperty("migration.processDefinitionKeys", List.class, new ArrayList<String>());
+ for (String key : processDefinitionKeys) {
+ processDefinitions.add(repositoryService.createProcessDefinitionQuery().processDefinitionKey(key)
+ .latestVersion().singleResult());
+ }
+ return processDefinitions;
+ }
+
+ private void migrate(String sourceProcessDefinitionId, String targetProcessDefinitionId) {
+ MigrationPlan migrationPlan =
+ runtimeService.createMigrationPlan(sourceProcessDefinitionId, targetProcessDefinitionId)
+ .mapEqualActivities().updateEventTriggers().build();
+ List<String> activityIds = new ArrayList<>();
+
+ for (MigrationInstruction instruction : migrationPlan.getInstructions()) {
+ activityIds.add(instruction.getSourceActivityId());
+ }
+ for (String activityId : activityIds) {
+ ProcessInstanceQuery activeProcessInstancesQuery = runtimeService.createProcessInstanceQuery()
+ .processDefinitionId(sourceProcessDefinitionId).activityIdIn(activityId).active();
+ if (!activeProcessInstancesQuery.list().isEmpty()) {
+ logger.info("Migrating {} process instance(s) from {} to {}",
+ Long.valueOf(activeProcessInstancesQuery.count()), sourceProcessDefinitionId,
+ targetProcessDefinitionId);
+ MigrationPlanExecutionBuilder migration =
+ runtimeService.newMigration(migrationPlan).processInstanceQuery(activeProcessInstancesQuery);
+ migration.executeAsync();
+ }
+ }
+ suspendEmptyProcessDefinition(sourceProcessDefinitionId);
+ }
+
+ private void suspendEmptyProcessDefinition(String sourceProcessDefinitionId) {
+ List<ProcessInstance> activeProcessInstances = runtimeService.createProcessInstanceQuery()
+ .processDefinitionId(sourceProcessDefinitionId).active().list();
+ if (activeProcessInstances.isEmpty()) {
+ repositoryService.suspendProcessDefinitionById(sourceProcessDefinitionId);
+ } else {
+ logger.info("Unable to migrate {} process instance(s) from {}",
+ Integer.valueOf(activeProcessInstances.size()), sourceProcessDefinitionId);
+ }
+ }
+
+ protected List<ProcessDefinition> getOldProcessDefinitions(String key, int version) {
+ List<ProcessDefinition> processDefinitions =
+ repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).list();
+ List<ProcessDefinition> oldProcessDefinitions = new ArrayList<>();
+ for (ProcessDefinition processDef : processDefinitions) {
+ if (!processDef.isSuspended() && (processDef.getVersion() != version)) {
+ oldProcessDefinitions.add(processDef);
+ }
+ }
+ return oldProcessDefinitions;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
index 1ad95b3ab9..e08cf0f578 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
@@ -5,6 +5,7 @@ server:
mso:
infra:
auditInventory: false
+ camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A
spring:
datasource:
hikari:
@@ -42,3 +43,9 @@ management:
prometheus:
enabled: true # Whether exporting of metrics to Prometheus is enabled.
step: 1m # Step size (i.e. reporting frequency) to use.
+org:
+ onap:
+ so:
+ adapters:
+ network:
+ encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java
new file mode 100644
index 0000000000..77b3535ce1
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.common.workflow.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.repository.ProcessDefinition;
+import org.camunda.bpm.engine.repository.ProcessDefinitionQuery;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AutoProcessInstanceMigrationServiceTest {
+
+ @Mock
+ private ProcessEngine processEngine;
+
+ @Mock
+ private ProcessDefinition outdated;
+
+ @Mock
+ private ProcessDefinition newDef;
+
+ @Mock
+ private ProcessDefinition key;
+
+ @Mock
+ private ProcessDefinition testKey;
+
+ @Mock
+ private ProcessDefinition suspendedDef;
+
+ @Mock
+ private RepositoryService repositoryService;
+
+ @Mock
+ private ProcessDefinitionQuery query;
+
+ @Mock
+ private ProcessDefinitionQuery keyQuery;
+
+ @Mock
+ private Environment env;
+
+ @Spy
+ @InjectMocks
+ private AutoProcessInstanceMigrationService migrationService;
+
+
+ @Test
+ public void getOldProcessDefinitionsTest() {
+ List<ProcessDefinition> expectedList = new ArrayList<>();
+ expectedList.add(outdated);
+
+ List<ProcessDefinition> defList = new ArrayList<>();
+ defList.add(outdated);
+ defList.add(newDef);
+ defList.add(suspendedDef);
+
+ doReturn(query).when(repositoryService).createProcessDefinitionQuery();
+ doReturn(query).when(query).processDefinitionKey("test");
+ doReturn(defList).when(query).list();
+ doReturn(3).when(outdated).getVersion();
+ doReturn(4).when(newDef).getVersion();
+ doReturn(true).when(suspendedDef).isSuspended();
+ List<ProcessDefinition> outdatedList = migrationService.getOldProcessDefinitions("test", 4);
+
+ assertEquals(expectedList, outdatedList);
+ }
+
+ @Test
+ public void getProcessDefinitionsTest() {
+ List<ProcessDefinition> expected = new ArrayList<ProcessDefinition>();
+ expected.add(testKey);
+ expected.add(key);
+
+ List<String> processDefinitionKeys = new ArrayList<String>();
+ processDefinitionKeys.add("testKey");
+ processDefinitionKeys.add("key");
+
+ doReturn(processDefinitionKeys).when(env).getProperty("migration.processDefinitionKeys", List.class,
+ new ArrayList<String>());
+
+ doReturn(query).when(repositoryService).createProcessDefinitionQuery();
+ doReturn(query).when(query).processDefinitionKey("testKey");
+ doReturn(query).when(query).latestVersion();
+ doReturn(testKey).when(query).singleResult();
+
+ doReturn(keyQuery).when(query).processDefinitionKey("key");
+ doReturn(keyQuery).when(keyQuery).latestVersion();
+ doReturn(key).when(keyQuery).singleResult();
+
+ List<ProcessDefinition> actualProcessDefinitions = migrationService.getProcessDefinitions();
+
+ assertEquals(expected, actualProcessDefinitions);
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
index 84da1e4ec9..26936bfd71 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy
@@ -199,7 +199,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
* 再次调用deleteE2EServiceInstance接口,然后获取到operationid,
*/
void sendRequest2NSMFWF(DelegateExecution execution) {
- LOGGER.trace("begin preRequestSend2NSMF")
+ LOGGER.debug("begin preRequestSend2NSMF")
try {
//url:/onap/so/infra/e2eServiceInstances/v3/{serviceInstanceId}"
def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
@@ -213,9 +213,13 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
"""
requestBody.replaceAll("\\s+", "")
- String basicAuthValue = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+ String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+ String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution)
+ String basicAuthValue = utils.encrypt(basicAuth, msoKey)
+ String encodeString = utils.getBasicAuth(basicAuthValue, msoKey)
+
HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
- httpClient.addAdditionalHeader("Authorization", basicAuthValue)
+ httpClient.addAdditionalHeader("Authorization", encodeString)
httpClient.addAdditionalHeader("Accept", "application/json")
Response httpResponse = httpClient.delete(requestBody)
handleNSSMFWFResponse(httpResponse, execution)
@@ -228,7 +232,7 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- LOGGER.trace("exit preRequestSend2NSMF")
+ LOGGER.debug("exit preRequestSend2NSMF")
}
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy
index f5e90000b3..d22ee5e82f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy
@@ -77,7 +77,7 @@ class DeleteSliceService extends AbstractServiceTaskProcessor {
checkAndSetRequestParam(siRequest,"globalSubscriberId",false, execution)
checkAndSetRequestParam(siRequest,"serviceType",false, execution)
checkAndSetRequestParam(siRequest,"operationId",false, execution)
-
+ checkAndSetRequestParam(siRequest,"scriptName",false, execution)
//prepare init operation status
execution.setVariable("progress", "0")
execution.setVariable("result", "processing")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
index 4be6ca7e49..547cb6cad7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -139,12 +139,14 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String profileId = currentNSSI['profileId']
String nssiId = currentNSSI['nssiServiceInstanceId']
String nsiId = currentNSSI['nsiServiceInstanceId']
+ String scriptName = execution.getVariable("scriptName")
DeAllocateNssi deAllocateNssi = new DeAllocateNssi()
deAllocateNssi.setNsiId(nsiId)
deAllocateNssi.setNssiId(nssiId)
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
+ deAllocateNssi.setScriptName(scriptName)
NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest()
deAllocateRequest.setDeAllocateNssi(deAllocateNssi)
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn
index 3024e39c4e..8dd326aa16 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSliceService.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0prw6yo" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3">
<bpmn:process id="DeleteSliceService" name="DeleteSliceService" isExecutable="true">
<bpmn:startEvent id="StartEvent_1" name="start">
<bpmn:outgoing>SequenceFlow_1ti9sxe</bpmn:outgoing>
@@ -102,6 +102,7 @@ dss.deleteSliceServiceInstance(execution)</bpmn:script>
<camunda:in source="operationId" target="operationId" />
<camunda:in source="operationType" target="operationType" />
<camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="scriptName" target="scriptName" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_16lh6o6</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0nl4kfh</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
index ce0f2c7417..6831a656a8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
@@ -24,7 +24,6 @@ import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.EXT_V
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.FORWARD_SLASH;
import static org.onap.so.bpmn.infrastructure.adapter.vnfm.tasks.Constants.PRELOAD_VNFS_URL;
import java.io.IOException;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -32,14 +31,14 @@ import java.util.stream.Collectors;
import org.onap.so.adapters.etsisol003adapter.lcm.v1.model.ExternalVirtualLink;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.client.sdnc.SDNCClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.jayway.jsonpath.JsonPath;
-import net.minidev.json.JSONArray;
/**
* This class retrieve pre-load data from SDNC using <br/>
@@ -56,9 +55,12 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider
private final SDNCClient sdncClient;
+ private final ObjectMapper mapper;
+
@Autowired
public SdncInputParametersProvider(final SDNCClient sdncClient) {
this.sdncClient = sdncClient;
+ this.mapper = new ObjectMapper();
}
@Override
@@ -70,21 +72,23 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider
try {
LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
final String jsonResponse = sdncClient.get(url);
-
- final JSONArray vnfParametersArray = JsonPath.read(jsonResponse, VNF_PARAMETERS_PATH);
- if (vnfParametersArray != null) {
- for (int index = 0; index < vnfParametersArray.size(); index++) {
- final Object vnfParametersObject = vnfParametersArray.get(index);
- if (vnfParametersObject instanceof JSONArray) {
- final JSONArray vnfParameters = (JSONArray) vnfParametersObject;
- final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParameters);
- final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
- final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
- final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
- LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
- return inputParameter;
- }
+ final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null);
+
+ try {
+
+ if (json != null) {
+ final List<VnfParameter> vnfParametersArray =
+ mapper.readValue(json, new TypeReference<List<VnfParameter>>() {});
+ final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray);
+ final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
+ final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
+ final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
+ LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
+ return inputParameter;
}
+
+ } catch (final IOException exception) {
+ LOGGER.error("Unable to parse vnf parameters : {}", json, exception);
}
} catch (final Exception exception) {
LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
@@ -112,19 +116,12 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider
}
- private Map<String, String> getVnfParameterMap(final JSONArray array) {
- try {
- if (array != null) {
- final ObjectMapper mapper = new ObjectMapper();
- final VnfParameter[] readValue = mapper.readValue(array.toJSONString(), VnfParameter[].class);
- LOGGER.debug("Vnf parameters: {}", Arrays.asList(readValue));
- return Arrays.asList(readValue).stream()
- .filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
- .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
- }
- } catch (final IOException exception) {
- LOGGER.error("Unable to parse vnf parameters : {}", array, exception);
+ private Map<String, String> getVnfParameterMap(final List<VnfParameter> array) {
+ if (array != null) {
+ return array.stream().filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
+ .collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
}
+
return Collections.emptyMap();
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
index 7184bba377..3b22cd9d81 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
@@ -98,7 +98,8 @@ public class AAIPnfResources {
pnfFromAai.getPnfName());
} else {
String errorMessage = String.format(
- "pnf with name %s already exists with orchestration status %s, only status Inventoried allows to use existing pnf",
+ "pnf with name %s already exists with orchestration status %s, existing pnf can be used only "
+ + "if status is not set or set as Inventoried",
pnfFromAai.getPnfName(), pnfFromAai.getOrchestrationStatus());
logger.error(errorMessage);
throw new Exception(errorMessage);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
index 5e9b4c7592..59cd53edd5 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
@@ -149,7 +149,8 @@ public class AAIPnfResourcesTest extends TestDataSetup {
} catch (Exception e) {
// then
assertThat(e.getMessage()).isEqualTo(String.format(
- "pnf with name %s already exists with orchestration status Active, only status Inventoried allows to use existing pnf",
+ "pnf with name %s already exists with orchestration status Active, existing pnf can be used only "
+ + "if status is not set or set as Inventoried",
PNF_NAME));
}
}
diff --git a/docs/conf.py b/docs/conf.py
index 8f40e8b817..5371015c66 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -12,4 +12,4 @@ intersphinx_mapping = {}
html_last_updated_fmt = '%d-%b-%y %H:%M'
def setup(app):
- app.add_stylesheet("css/ribbon_onap.css")
+ app.add_stylesheet("css/ribbon.css")
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 7d6bbc4fc4..7e891f1e33 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -311,6 +311,9 @@
<executions>
<execution>
<id>extract-docker-file</id>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
</execution>
</executions>
</plugin>
@@ -320,9 +323,7 @@
<executions>
<execution>
<id>original</id>
- <configuration>
- <skip>false</skip>
- </configuration>
+ <phase>package</phase>
</execution>
</executions>
</plugin>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java
index 3335410658..21aa89be05 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/e2eserviceinstancebeans/E2EServiceInstanceDeleteRequest.java
@@ -21,12 +21,17 @@
package org.onap.so.apihandlerinfra.e2eserviceinstancebeans;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
public class E2EServiceInstanceDeleteRequest {
private String globalSubscriberId;
private String serviceType;
+ @JsonIgnore
+ private String scriptName;
+
public String getGlobalSubscriberId() {
return globalSubscriberId;
}
@@ -43,4 +48,11 @@ public class E2EServiceInstanceDeleteRequest {
this.serviceType = serviceType;
}
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public void setScriptName(String scriptName) {
+ this.scriptName = scriptName;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index a87e94a6e0..fc0048bacf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -1,7 +1,10 @@
package org.onap.so.apihandlerinfra.infra.rest;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.LInterface;
@@ -9,13 +12,16 @@ import org.onap.aai.domain.yang.Service;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.VolumeGroups;
import org.onap.so.apihandlerinfra.infra.rest.exception.AAIEntityNotFound;
import org.onap.aaiclient.client.aai.AAIDSLQueryClient;
import org.onap.aaiclient.client.aai.AAIObjectPlurals;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.entities.DSLQuery;
import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder;
@@ -164,4 +170,52 @@ public class AAIDataRetrieval {
return aaiResourcesClient;
}
+ public boolean isVnfRelatedToVFModule(String vnfId) {
+ return !getVfModulesOfVnf(vnfId).isEmpty();
+ }
+
+ public List<VfModule> getVfModulesOfVnf(String vnfId) {
+ List<VfModule> vfModuleList = new ArrayList<VfModule>();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId);
+ Optional<VfModules> vfModules = getAaiResourcesClient().get(VfModules.class, uri);
+ if (!vfModules.isPresent() || vfModules.get().getVfModule().isEmpty()) {
+ logger.debug("No VfModules attached to Vnf in AAI : {}", vnfId);
+ } else {
+ vfModuleList = vfModules.get().getVfModule();
+ }
+ return vfModuleList;
+ }
+
+ public Optional<String> getVfModuleIdsByVnfId(String vnfId) {
+ List<VfModule> vfModulesList = getVfModulesOfVnf(vnfId);
+ if (!vfModulesList.isEmpty()) {
+ return Optional.of(vfModulesList.stream().map(item -> item.getVfModuleId()).collect(Collectors.toList())
+ .stream().sorted().collect(Collectors.joining(",")));
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ public List<VolumeGroup> getVolumeGroupsOfVnf(String vnfId) {
+ List<VolumeGroup> volumeGroupList = new ArrayList<VolumeGroup>();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ Optional<VolumeGroups> volumeGroups = getAaiResourcesClient().get(VolumeGroups.class, uri);
+ if (!volumeGroups.isPresent() || volumeGroups.get().getVolumeGroup().isEmpty()) {
+ logger.debug("No VolumeGroups attached to Vnf in AAI : {}", vnfId);
+ } else {
+ volumeGroupList = volumeGroups.get().getVolumeGroup();
+ }
+ return volumeGroupList;
+ }
+
+ public Optional<String> getVolumeGroupIdsByVnfId(String vnfId) {
+ List<VolumeGroup> volumeGroupList = getVolumeGroupsOfVnf(vnfId);
+ if (!volumeGroupList.isEmpty()) {
+ return Optional.of(volumeGroupList.stream().map(item -> item.getVolumeGroupId())
+ .collect(Collectors.toList()).stream().sorted().collect(Collectors.joining(",")));
+ } else {
+ return Optional.empty();
+ }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
index 37e3f0cb2e..a48fca8d0f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/validators/VnfDeleteValidator.java
@@ -25,8 +25,16 @@ public class VnfDeleteValidator implements RequestValidator {
@Override
public Optional<String> validate(Map<String, String> instanceIdMap, ServiceInstancesRequest request,
Map<String, String> queryParams) {
- if (aaiDataRetrieval.isVnfRelatedToVolumes(instanceIdMap.get("vnfInstanceId"))) {
- return Optional.of("Cannot delete vnf it is still related to existing volume groups");
+ final Optional<String> volumeGroupIds =
+ aaiDataRetrieval.getVolumeGroupIdsByVnfId(instanceIdMap.get("vnfInstanceId"));
+ final Optional<String> vfModuleIds = aaiDataRetrieval.getVfModuleIdsByVnfId(instanceIdMap.get("vnfInstanceId"));
+
+ if (volumeGroupIds.isPresent()) {
+ return Optional.of(String.format("Cannot delete vnf it is still related to existing volume group Ids - %s",
+ volumeGroupIds.get()));
+ } else if (vfModuleIds.isPresent()) {
+ return Optional.of(String.format("Cannot delete vnf it is still related to existing vfModule Ids - %s",
+ vfModuleIds.get()));
} else {
return Optional.empty();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java
new file mode 100644
index 0000000000..9d5d80592d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrievalTest.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.infra.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import java.util.List;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VfModules;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.VolumeGroups;
+import org.onap.aaiclient.client.aai.AAIObjectPlurals;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri;
+import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AAIDataRetrievalTest {
+ @Mock
+ private AAIResourcesClient aaiResourcesClient;
+
+ @InjectMocks
+ private AAIDataRetrieval aaiDataRetrieval = new AAIDataRetrieval();
+
+ @Test
+ public void getVfModulesOfVnfTest() {
+ VfModules vfModules = getVfModules();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "vnfId");
+ doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
+ List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
+ assertEquals("vfm1", vfModulesList.get(0).getVfModuleId());
+
+ Optional<String> vfModuleIds = aaiDataRetrieval.getVfModuleIdsByVnfId("vnfId");
+ assertEquals(Optional.of("vfm1,vfm2"), vfModuleIds);
+ }
+
+ @Test
+ public void getVfModulesOfVnfWhenNoneTest() {
+ VfModules vfModules = new VfModules();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, "vnfId");
+ doReturn(Optional.of(vfModules)).when(aaiResourcesClient).get(VfModules.class, uri);
+ List<VfModule> vfModulesList = aaiDataRetrieval.getVfModulesOfVnf("vnfId");
+ assertEquals(true, vfModulesList.isEmpty());
+
+ Optional<String> vfModuleIds = aaiDataRetrieval.getVfModuleIdsByVnfId("vnfId");
+ assertEquals(false, vfModuleIds.isPresent());
+ }
+
+ @Test
+ public void getVolumeGroupsOfVnfTest() throws Exception {
+ VolumeGroups volumeGroups = getVolumeGroups();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
+ List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
+ assertEquals("vg1", volumeGroupList.get(0).getVolumeGroupId());
+ Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
+ assertEquals(Optional.of("vg1,vg2"), volumeGroupIds);
+ }
+
+ @Test
+ public void getVolumeGroupsOfVnfWhenNoneTest() throws Exception {
+ VolumeGroups volumeGroups = new VolumeGroups();
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "vnfId")
+ .relatedTo(AAIObjectPlurals.VOLUME_GROUP);
+ doReturn(Optional.of(volumeGroups)).when(aaiResourcesClient).get(VolumeGroups.class, uri);
+ List<VolumeGroup> volumeGroupList = aaiDataRetrieval.getVolumeGroupsOfVnf("vnfId");
+ assertEquals(true, volumeGroupList.isEmpty());
+ Optional<String> volumeGroupIds = aaiDataRetrieval.getVolumeGroupIdsByVnfId("vnfId");
+ assertEquals(false, volumeGroupIds.isPresent());
+ }
+
+
+ private VfModules getVfModules() {
+ VfModule vfModule1 = new VfModule();
+ VfModule vfModule2 = new VfModule();
+ vfModule1.setVfModuleId("vfm1");
+ vfModule2.setVfModuleId("vfm2");
+ VfModules vfModules = new VfModules();
+ vfModules.getVfModule().add(vfModule1);
+ vfModules.getVfModule().add(vfModule2);
+ return vfModules;
+ }
+
+ private VolumeGroups getVolumeGroups() {
+ VolumeGroup volumeGroup1 = new VolumeGroup();
+ volumeGroup1.setVolumeGroupId("vg1");
+ VolumeGroup volumeGroup2 = new VolumeGroup();
+ volumeGroup2.setVolumeGroupId("vg2");
+ VolumeGroups volumeGroups = new VolumeGroups();
+ volumeGroups.getVolumeGroup().add(volumeGroup1);
+ volumeGroups.getVolumeGroup().add(volumeGroup2);
+ return volumeGroups;
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
index d4f57d3146..65ce355ad1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/validator/VnfDeleteValidatorTest.java
@@ -2,6 +2,7 @@ package org.onap.so.apihandlerinfra.infra.rest.validator;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.doReturn;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
@@ -49,19 +50,34 @@ public class VnfDeleteValidatorTest {
}
@Test
- public void validateSuccessTest() {
+ public void validateFailureVfModuleVnfTest() {
instanceIdMap.put("vnfInstanceId", "1");
- when(aaiDataRetrieval.isVnfRelatedToVolumes("1")).thenReturn(false);
+ doReturn(Optional.of("test")).when(aaiDataRetrieval).getVfModuleIdsByVnfId("1");
+ Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
+ assertEquals(true, result.isPresent());
+ }
+
+ @Test
+ public void validateSuccessVfModuleVnfTest() {
+ instanceIdMap.put("vnfInstanceId", "1");
+ doReturn(Optional.empty()).when(aaiDataRetrieval).getVfModuleIdsByVnfId("1");
Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
assertEquals(false, result.isPresent());
}
@Test
- public void validateFailureVnfTest() {
+ public void validateFailureVolumeGroupVnfTest() {
instanceIdMap.put("vnfInstanceId", "1");
- when(aaiDataRetrieval.isVnfRelatedToVolumes("1")).thenReturn(true);
+ doReturn(Optional.of("test")).when(aaiDataRetrieval).getVolumeGroupIdsByVnfId("1");
Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
assertEquals(true, result.isPresent());
}
+ @Test
+ public void validateSuccessVolumeGroupVnfTest() {
+ instanceIdMap.put("vnfInstanceId", "1");
+ doReturn(Optional.empty()).when(aaiDataRetrieval).getVolumeGroupIdsByVnfId("1");
+ Optional<String> result = vnfValidator.validate(instanceIdMap, null, null);
+ assertEquals(false, result.isPresent());
+ }
}
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index 217a5fdb5c..1862bd15ff 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -65,13 +65,11 @@
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.31.0</version>
-
- <configuration>
+ <configuration combine.self="override">
<verbose>true</verbose>
<apiVersion>1.23</apiVersion>
<pullRegistry>${docker.pull.registry}</pullRegistry>
<pushRegistry>${docker.push.registry}</pushRegistry>
-
<images>
<image>
<name>${docker.image.prefix}/base-image:1.0</name>
diff --git a/pom.xml b/pom.xml
index 5e4cadc241..f19e3f2f1c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -644,6 +644,7 @@
<goal>unpack</goal>
</goals>
<configuration>
+ <skip>true</skip>
<artifactItems>
<artifactItem>
<groupId>org.onap.so</groupId>
@@ -665,12 +666,11 @@
<executions>
<execution>
<id>original</id>
- <phase>package</phase>
+ <phase>none</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
- <skip>true</skip>
<classifier>${originalClassifier}</classifier>
<includes>
<include>**</include>
diff --git a/so-simulator/pom.xml b/so-simulator/pom.xml
index a92664afb8..006a6fae1a 100644
--- a/so-simulator/pom.xml
+++ b/so-simulator/pom.xml
@@ -105,6 +105,16 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>original</id>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>