diff options
404 files changed, 19735 insertions, 3610 deletions
diff --git a/.gitignore b/.gitignore index 284ea22711..51723ae248 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,10 @@ target -.settings -.classpath -.project -.buildpath -.factorypath +**/.settings +**/.classpath +**/.project +**/.buildpath +**/.factorypath +**/.springBeans .idea .checkstyle .DS_Store @@ -17,5 +18,5 @@ target *.tmp packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Catalog-schema.sql packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Requests-schema.sql -/bin/ +**/bin/ /tattletale/ diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index 566eef7b2f..b0687edc62 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -81,7 +81,7 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>mso-catalog-db</artifactId> + <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -92,7 +92,6 @@ <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> @@ -104,7 +103,6 @@ <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> - <version>1.15</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> @@ -116,5 +114,20 @@ <artifactId>h2</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>${cxf.version}</version> + </dependency> </dependencies> </project> diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java index d7b30edbe5..d688960a1c 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so; import ch.vorburger.exec.ManagedProcessException; @@ -39,4 +59,4 @@ public class EmbeddedMariaDbConfig { .driverClassName(datasourceDriver) .build(); } -}
\ No newline at end of file +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java index c9a0a1d8c6..abb0a10af5 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java @@ -25,7 +25,7 @@ import java.util.HashMap; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.cloud.Application; +import org.onap.so.TestApplication; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoIOException; @@ -46,7 +46,7 @@ import com.woorea.openstack.heat.model.CreateStackParam; * */ @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class) +@SpringBootTest(classes = TestApplication.class) @ActiveProfiles("test") @Ignore public class MsoHeatUtilsTest extends MsoCommonUtils { diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java index d676bcab3a..95e4352e05 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.BaseTest; -import org.onap.so.cloud.Application; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.cloud.authentication.models.RackspaceAuthentication; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java index f069e9f61f..1884b3243a 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java @@ -21,16 +21,10 @@ package org.onap.so.config; import static org.junit.Assert.assertEquals; - import org.junit.Test; -import org.junit.runner.RunWith; -import org.onap.so.BaseTest; -import org.onap.so.cloud.Application; import org.onap.so.config.beans.PoConfig; +import org.onap.so.BaseTest; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; public class PoConfigTest extends BaseTest { diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java index 94715f1599..ac194ccee2 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java @@ -22,7 +22,6 @@ package org.onap.so.openstack.beans; import org.junit.Test; import org.onap.so.BaseTest; - import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.impl.PojoClassFactory; import com.openpojo.validation.Validator; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index b304cba93f..6517122475 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -37,7 +37,6 @@ import com.woorea.openstack.heat.model.CreateStackParam; import org.apache.http.HttpStatus; import org.junit.Assert; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.StubOpenStack; import org.onap.so.adapters.vdu.CloudInfo; import org.onap.so.adapters.vdu.PluginAction; @@ -48,6 +47,7 @@ import org.onap.so.adapters.vdu.VduModelInfo; import org.onap.so.adapters.vdu.VduStateType; import org.onap.so.adapters.vdu.VduStatus; import org.onap.so.cloud.CloudConfig; +import org.onap.so.BaseTest; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java index 92f7738c62..5100407633 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java @@ -23,8 +23,8 @@ package org.onap.so.openstack.utils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.StubOpenStack; +import org.onap.so.BaseTest; import org.onap.so.openstack.beans.MsoTenant; import org.onap.so.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java index 0442d4d635..f679e1f776 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java @@ -23,8 +23,8 @@ package org.onap.so.openstack.utils; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.StubOpenStack; +import org.onap.so.BaseTest; import org.onap.so.openstack.beans.NetworkInfo; import org.onap.so.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java index f069bf2ed2..7c3669d7d7 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -45,7 +47,9 @@ public class DeleteNetworkRequest extends NetworkRequestCommon { private String modelCustomizationUuid; private MsoRequest msoRequest = new MsoRequest(); - public DeleteNetworkRequest() {} + public DeleteNetworkRequest() { + //empty default constructor + } public String getCloudSiteId() { return cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java index 6953dfe7e5..98b0c8ebec 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -26,7 +28,6 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.NetworkStatus; import org.onap.so.openstack.beans.RouteTarget; @@ -45,8 +46,7 @@ public class QueryNetworkResponse extends NetworkResponseCommon { private List<RouteTarget> routeTargets; private Map<String, String> subnetIdMap; private Map<String, String> networkOutputs; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryNetworkResponse.class); - + public QueryNetworkResponse() { super(); } diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java index c1c8258a6a..8dee54701d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -58,7 +60,7 @@ public class UpdateNetworkRequest extends NetworkRequestCommon { private Boolean backout = true; private Map<String,String> networkParams = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, UpdateNetworkRequest.class); + @JsonProperty private boolean contrailRequest; public UpdateNetworkRequest() { diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java index d52e714f70..1f4b872ab9 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -38,7 +40,9 @@ public class CreateTenantRequest extends TenantRequestCommon { private Map<String,String> metadata = new HashMap<>(); private MsoRequest msoRequest = new MsoRequest(); - public CreateTenantRequest() {} + public CreateTenantRequest() { + //empty constructor + } public String getCloudSiteId() { return cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java index a39b7164e2..b2d521b050 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,7 +36,9 @@ public class DeleteTenantRequest extends TenantRequestCommon { private MsoRequest msoRequest = new MsoRequest(); - public DeleteTenantRequest() {} + public DeleteTenantRequest() { + //empty constructor + } public String getCloudSiteId() { return cloudSiteId; diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java index 575853a21f..8701aa4a7d 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -20,8 +22,6 @@ package org.onap.so.adapters.vdu; -import java.util.Arrays; -import java.util.Objects; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.EqualsBuilder; diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index df5f3fac73..e8db6be2f9 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -153,20 +153,10 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>deployment-configs</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.onap.so</groupId> <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> - </dependency> - <dependency> <groupId>uk.co.blackpepper.bowman</groupId> <artifactId>bowman-client</artifactId> <version>0.3.0</version> diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java index ce98b74fab..93e396bb94 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java @@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client"}) +@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client","org.onap.so.logging.jaxrs.filter","org.onap.so.logging.spring.interceptor"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") @EntityScan("org.onap.so.db.catalog.beans") public class CatalogDBApplication { diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java index dcd668f2c8..ff162c862e 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java @@ -25,7 +25,7 @@ import javax.ws.rs.ApplicationPath; import org.glassfish.jersey.server.ResourceConfig; import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.context.annotation.Configuration; import io.swagger.jaxrs.config.BeanConfig; diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java new file mode 100644 index 0000000000..efe6010f23 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb; + + +import org.onap.so.logging.spring.interceptor.LoggingInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.handler.MappedInterceptor; + +@Configuration +public class WebMvcConfig extends WebMvcConfigurerAdapter { + + @Autowired + LoggingInterceptor loggingInterceptor; + + @Bean + public MappedInterceptor mappedLoggingInterceptor() { + return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor); + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java index 144df5fe6a..2eb4858803 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { http.csrf().disable() .authorizeRequests() .antMatchers("/manage/health","/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",")) .and() .httpBasic(); } diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql new file mode 100644 index 0000000000..985c7cd44d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql @@ -0,0 +1,4 @@ +use catalogdb; + +ALTER TABLE cvnfc_customization + MODIFY IF EXISTS VNFC_CUST_MODEL_CUSTOMIZATION_UUID varchar(200) NULL;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql new file mode 100644 index 0000000000..f0b291ed6b --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql @@ -0,0 +1,101 @@ +USE catalogdb; + +CREATE TABLE IF NOT EXISTS vnfc_customization ( +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS cvnfc_customization ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `MODEL_UUID` VARCHAR(200) NOT NULL, + `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, + `MODEL_VERSION` VARCHAR(20) NOT NULL, + `MODEL_NAME` VARCHAR(200) NOT NULL, + `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, + `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, + `NFC_FUNCTION` VARCHAR(200) NULL, + `NFC_NAMING_CODE` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_cvnfc_customization__vf_module_customization1_idx` ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnfc_customization1_idx` ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + UNIQUE INDEX `UK_cvnfc_customization` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY ( + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY ( + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC, + `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC, + `MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` ( + `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` ( + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC + ), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC + ), + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY ( + `CVNFC_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY ( + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` + ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1;
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql new file mode 100644 index 0000000000..7fd222a027 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql @@ -0,0 +1,5 @@ +use catalogdb; + +DELETE FROM catalogdb.service_recipe + where orchestration_uri = '/mso/async/services/CreateGenericMacroServiceNetworkVnf' + or orchestration_uri = '/mso/async/services/DeleteGenericMacroServiceNetworkVnf';
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java index c3159f0e3b..8ccf40eff5 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java @@ -34,6 +34,7 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.catalogdb.CatalogDBApplication; import org.onap.so.logger.MsoLogger; @@ -108,6 +109,27 @@ public class CatalogDBRestTest { HttpMethod.GET, entity, String.class); assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && + logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } } /* Service Resources Endpoint */ @@ -767,8 +789,8 @@ public class CatalogDBRestTest { logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME)); @@ -776,9 +798,9 @@ public class CatalogDBRestTest { }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(MsoLogger.ENDTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); assertEquals("500",mdc.get(MsoLogger.RESPONSECODE)); assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java index b52cf73fe5..bf69686a76 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.db.catalog.client; import org.springframework.stereotype.Component; diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java index b1c3bdb29c..4ec5839cb6 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.db.catalog.client; import org.junit.Assert; diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index 01c1df304e..fb104fcab3 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -272,5 +272,10 @@ <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>cxf-logging</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java index 0309c88dac..82139f21af 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package db.migration; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java index ee89edbda8..3ec02bfb0e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package db.migration; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java index 6530b7ba7c..6c6366904f 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package db.migration; import org.flywaydb.core.api.migration.jdbc.JdbcMigration; @@ -7,6 +27,6 @@ import java.sql.Connection; public class V4_2__DummyMigration implements JdbcMigration { @Override public void migrate(Connection connection) throws Exception { - + //does nothing } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index 500b0b32e3..2eeed777de 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -22,7 +22,7 @@ */ package org.onap.so.adapters.network; - + import java.net.MalformedURLException; import java.net.URL; @@ -196,9 +196,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { copyCreateSubnetIdMap (subnetIdMap), copyNrb (networkRollback)); } catch (Exception e) { - error = "Error sending createNetwork notification " + e.getMessage (); - LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e); - alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error); + error = CREATE_NETWORK_ERROR_MSG + e.getMessage (); + LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e); + alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error); } return; } @@ -362,7 +362,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); - LOGGER.debug ("Got a NetworkException on createNetwork: ", e); + LOGGER.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; try { @@ -449,7 +449,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { MsoLogger.setServiceName (serviceName); } catch (NetworkException e) { MsoLogger.setServiceName (serviceName); - LOGGER.debug ("Got a NetworkException on createNetwork: ", e); + LOGGER.debug (NETWORK_EXCEPTION_MSG, e); MsoExceptionCategory exCat = null; String eMsg = null; try { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index e5a8d3faa1..ac33a5269e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -19,7 +21,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.adapters.network; +package org.onap.so.adapters.network; import java.util.ArrayList; import java.util.HashMap; @@ -102,7 +104,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { @Autowired private MsoCommonUtils commonUtils; - @Autowired + @Autowired private NetworkResourceCustomizationRepository networkCustomRepo; @Autowired @@ -257,7 +259,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("CreateNetwork"); + MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT); LOGGER.debug ("*** CREATE Network: " + networkName + " of type " @@ -465,7 +467,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Map <String, Object> outputs = heatStack.getOutputs (); Map <String, String> sMap = new HashMap <> (); if (outputs != null) { - for (String key : outputs.keySet ()) { + for (Map.Entry<String, Object> entry : outputs.entrySet()) { + String key=entry.getKey(); if (key != null && key.startsWith ("subnet")) { if (aic3template) //one subnet_id output { @@ -619,7 +622,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Map <String, Object> outputs = heatStack.getOutputs (); Map <String, String> sMap = new HashMap <> (); if (outputs != null) { - for (String key : outputs.keySet ()) { + for (Map.Entry<String, Object> entry : outputs.entrySet()) { + String key = entry.getKey(); if (key != null && key.startsWith ("subnet")) { if (aic3template) //one subnet output expected { @@ -762,7 +766,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder <Map <String, String>> subnetIdMap, Holder <NetworkRollback> rollback) throws NetworkException { MsoLogger.setLogContext (msoRequest); - MsoLogger.setServiceName ("UpdateNetwork"); + MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT); LOGGER.debug ("***UPDATE Network adapter with Network: " + networkName + " of type " + networkType @@ -1067,7 +1071,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Map<String, Object> outputs = heatStack.getOutputs(); Map<String, String> sMap = new HashMap<>(); if (outputs != null) { - for (String key : outputs.keySet()) { + for (Map.Entry<String, Object> entry : outputs.entrySet()) { + String key=entry.getKey(); if (key != null && key.startsWith("subnet")) { if (aic3template) //one subnet output expected { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java index 8135088d7c..fcce165d27 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -346,7 +348,7 @@ public class CreateNetworkNotification { */ public List<CreateNetworkNotification.SubnetIdMap.Entry> getEntry() { if (entry == null) { - entry = new ArrayList<CreateNetworkNotification.SubnetIdMap.Entry>(); + entry = new ArrayList<>(); } return this.entry; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java index 4fde850a53..e7ace110ac 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -362,7 +364,7 @@ public class NetworkRollback { */ public List<Integer> getVlans() { if (vlans == null) { - vlans = new ArrayList<Integer>(); + vlans = new ArrayList<>(); } return this.vlans; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java index 55a8e3d0d1..87aa2183f1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -314,7 +316,7 @@ public class QueryNetworkNotification { */ public List<Integer> getVlans() { if (vlans == null) { - vlans = new ArrayList<Integer>(); + vlans = new ArrayList<>(); } return this.vlans; } @@ -406,7 +408,7 @@ public class QueryNetworkNotification { */ public List<QueryNetworkNotification.SubnetIdMap.Entry> getEntry() { if (entry == null) { - entry = new ArrayList<QueryNetworkNotification.SubnetIdMap.Entry>(); + entry = new ArrayList<>(); } return this.entry; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java index f61d0a8dea..daff548b45 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -292,7 +294,7 @@ public class UpdateNetworkNotification { */ public List<UpdateNetworkNotification.SubnetIdMap.Entry> getEntry() { if (entry == null) { - entry = new ArrayList<UpdateNetworkNotification.SubnetIdMap.Entry>(); + entry = new ArrayList<>(); } return this.entry; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java index d29818614d..996e2c2712 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -46,6 +48,8 @@ import org.onap.so.adapters.vnf.VolumeAdapterRest; import org.onap.so.adapters.vnf.VolumeAdapterRestV2; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.logger.MsoLogger; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -56,8 +60,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration public class CXFConfiguration { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, CXFConfiguration.class); - @Autowired private NetworkAdapterRest networkAdapterRest; @Autowired @@ -84,8 +86,7 @@ public class CXFConfiguration { private MsoVnfCloudifyAdapterImpl vnfCloudifyAdapterImpl; @Autowired private JettisonStyleMapperProvider jettisonStyleObjectMapper; - - + @Bean(name=Bus.DEFAULT_BUS_ID) public SpringBus springBus() { return new SpringBus(); @@ -107,6 +108,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterImpl); endpoint.publish("/NetworkAdapter"); endpoint.setWsdlLocation("NetworkAdapter.wsdl"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } @@ -115,6 +119,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterAsyncImpl); endpoint.publish("/NetworkAdapterAsync"); endpoint.setWsdlLocation("NetworkAdapterAsync.wsdl"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } @@ -126,6 +133,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), tenantAdapterImpl); endpoint.publish("/TenantAdapter"); endpoint.setWsdlLocation("TenantAdapter.wsdl"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } @@ -139,6 +149,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterImpl); endpoint.publish("/VnfAdapter"); endpoint.setWsdlLocation("VnfAdapter.wsdl"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } @@ -147,6 +160,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl); endpoint.publish("/VnfAsyncAdapter"); endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } @@ -155,6 +171,9 @@ public class CXFConfiguration { EndpointImpl endpoint = new EndpointImpl(springBus(), vnfCloudifyAdapterImpl); endpoint.publish("/VnfCloudifyAdapterImpl"); endpoint.setWsdlLocation("VnfCloudifyAdapterImpl.wsdl"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java index 6bbdebea52..aca16d9996 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -17,7 +19,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + package org.onap.so.adapters.openstack; import org.onap.so.security.MSOSpringFirewall; @@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig { http.csrf().disable() .authorizeRequests() .antMatchers("/manage/health","/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",")) .and() .httpBasic(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java index 37a84c1a56..d82d478a93 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -30,7 +32,6 @@ import javax.jws.WebService; import javax.xml.bind.annotation.XmlElement; import javax.xml.ws.Holder; -import org.onap.so.adapters.tenant.exceptions.TenantAlreadyExists; import org.onap.so.adapters.tenant.exceptions.TenantException; import org.onap.so.adapters.tenantrest.TenantRollback; import org.onap.so.entity.MsoRequest; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java index 2bba3f559e..41544c8104 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -72,7 +74,7 @@ import io.swagger.annotations.ApiResponses; @Component public class TenantAdapterRest { private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, TenantAdapterRest.class); - + private static final String EXCEPTION= "Exception :"; //RAA? No logging in wrappers @Autowired private MsoTenantAdapterImpl tenantImpl; @@ -140,27 +142,20 @@ public class TenantAdapterRest { hrollback); newTenantId = htenant.value; tenantRollback = hrollback.value; -// TenantAdapterCore TAImpl = new TenantAdapterCore(); -// newTenantId = TAImpl.createTenant (req.getCloudSiteId(), -// req.getTenantName(), -// req.getFailIfExists(), -// req.getBackout(), -// req.getMetadata(), -// req.getMsoRequest(), -// tenantRollback); + } catch (TenantAlreadyExists tae) { - LOGGER.debug("Exception :",tae); + LOGGER.debug(EXCEPTION,tae); CreateTenantError exc = new CreateTenantError(tae.getMessage(), tae.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_NOT_IMPLEMENTED).entity(exc).build(); } catch (TenantException te) { - LOGGER.debug("Exception :",te); + LOGGER.debug(EXCEPTION,te); CreateTenantError exc = new CreateTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); CreateTenantError exc = new CreateTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } @@ -213,12 +208,12 @@ public class TenantAdapterRest { tenantDeleted = deleted.value; } catch (TenantException te) { - LOGGER.debug("Exception :",te); + LOGGER.debug(EXCEPTION,te); DeleteTenantError exc = new DeleteTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); DeleteTenantError exc = new DeleteTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } @@ -274,17 +269,15 @@ public class TenantAdapterRest { metadata ); tenant = new MsoTenant(htenant.value, tenantName.value, metadata.value); -// TenantAdapterCore TAImpl = new TenantAdapterCore(); -// MsoRequest msoReq = new MsoRequest(); -// tenant = TAImpl.queryTenant (cloudSiteId, tenantId, msoReq); + } catch (TenantException te) { - LOGGER.debug("Exception :",te); + LOGGER.debug(EXCEPTION,te); QueryTenantError exc = new QueryTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory()); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); QueryTenantError exc = new QueryTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } @@ -319,7 +312,7 @@ public class TenantAdapterRest { @ApiResponse(code = 500, message = "rollback tenant failed") }) public Response rollbackTenant( @ApiParam(value = "rollback, command action", required = true) - @QueryParam("rollback") String action, // WTF? + @QueryParam("rollback") String action, @ApiParam(value = "RollbackTenantRequest", required = true) RollbackTenantRequest req) { @@ -328,12 +321,12 @@ public class TenantAdapterRest { impl.rollbackTenant(req.getTenantRollback()); } catch (TenantException te) { - LOGGER.debug("Exception :",te); + LOGGER.debug(EXCEPTION,te); RollbackTenantError exc = new RollbackTenantError(te.getFaultInfo().getMessage(), te.getFaultInfo().getCategory(), Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); RollbackTenantError exc = new RollbackTenantError(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE); return Response.status(HttpServletResponse.SC_INTERNAL_SERVER_ERROR).entity(exc).build(); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java index 344895f8f3..30062a0144 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java @@ -34,11 +34,7 @@ public class GenericValetResponse<T> { private String errorMessage; private T returnObject; - @Override - public String toString() { - return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage) - .append("returnObject", returnObject).toString(); - } + public GenericValetResponse(int statusCode, String errorMessage, T obj) { super(); this.statusCode = statusCode; @@ -48,6 +44,11 @@ public class GenericValetResponse<T> { public GenericValetResponse() { this(-1, "not set", null); } + @Override + public String toString() { + return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage) + .append("returnObject", returnObject).toString(); + } public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java index 3e3c6754dc..08fcdc13fe 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java @@ -112,7 +112,7 @@ public class ValetClient { String body = mapper.writeValueAsString(vcr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet create req: " + uri.toString() + HEADERS + headers.toString() + BODY + body.toString()); + LOGGER.debug("valet create req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); response = restTemplate.exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class); gvr = this.getGVRFromResponse(response); @@ -140,7 +140,7 @@ public class ValetClient { String body = mapper.writeValueAsString(vur); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet update req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body.toString()); + LOGGER.debug("valet update req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body); response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class); gvr = this.getGVRFromResponse(response); @@ -167,7 +167,7 @@ public class ValetClient { String body = mapper.writeValueAsString(vdr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet delete req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body.toString()); + LOGGER.debug("valet delete req: " + uri.toString() + HEADERS + headers.toString() + ", body=" + body); response = restTemplate.exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class); gvr = this.getGVRFromResponse(response); @@ -221,7 +221,7 @@ public class ValetClient { String body = mapper.writeValueAsString(vrr); HttpHeaders headers = generateHeaders(requestId); HttpEntity<String> entity = new HttpEntity<>(body, headers); - LOGGER.debug("valet rollback req: " + uri.toString() + HEADERS + headers.toString() + BODY + body.toString()); + LOGGER.debug("valet rollback req: " + uri.toString() + HEADERS + headers.toString() + BODY + body); response = restTemplate.exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class); gvr = this.getGVRFromResponse(response); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java index 4f7afa2d5c..5a28f65db4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java @@ -19,7 +19,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + package org.onap.so.adapters.valet.beans; import java.io.Serializable; @@ -46,9 +46,9 @@ public class HeatRequest implements Serializable { @JsonProperty("environment") private String environment; @JsonProperty("files") - private Map<String, Object> files = new HashMap<String, Object>(); + private Map<String, Object> files = new HashMap<>(); @JsonProperty("parameters") - private Map<String, Object> parameters = new HashMap<String, Object>(); + private Map<String, Object> parameters = new HashMap<>(); public HeatRequest(String stackName, boolean disableRollback, int timeoutMins, String template, String environment, Map<String, Object> files, Map<String, Object> parameters) { super(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java index 067a6727c1..cc48e95c81 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java @@ -35,11 +35,7 @@ public class ValetStatus implements Serializable { private String status; @JsonProperty("message") private String message; - - @Override - public String toString() { - return new ToStringBuilder(this).append("status", status).append("message", message).toString(); - } + public ValetStatus() { super(); @@ -51,6 +47,12 @@ public class ValetStatus implements Serializable { this.message = statusMessage; } + + @Override + public String toString() { + return new ToStringBuilder(this).append("status", status).append("message", message).toString(); + } + public String getStatus() { return this.status; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index 3e27361ed1..a941c7f083 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -82,6 +84,7 @@ import io.swagger.annotations.ApiResponses; public class VnfAdapterRest { private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; + private static final String RESP=", resp="; @Autowired private MsoVnfAdapterImpl vnfAdapter; @@ -214,7 +217,7 @@ public class VnfAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("Delete vfModule exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("Delete vfModule exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -464,7 +467,7 @@ public class VnfAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("CreateVfModuleTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("CreateVfModuleTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -576,7 +579,7 @@ public class VnfAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("Update VfModule exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("Update VfModule exit: code=" + getStatusCode() + RESP+ getResponse()); } } /* @@ -685,7 +688,7 @@ public class VnfAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("RollbackVfModulesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } }
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index b4b5894491..e7bf3f79ce 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -81,7 +83,9 @@ import io.swagger.annotations.ApiResponses; public class VolumeAdapterRest { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRest.class); private static final String TESTING_KEYWORD = "___TESTING___"; - + private static final String EXCEPTION="Exception :"; + private static final String RESP=", resp="; + private static final String VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT="VolumeGroupId in URL does not match content"; @Autowired private MsoVnfAdapterImpl vnfAdapter; @@ -225,7 +229,7 @@ public class VolumeAdapterRest { rb, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -234,7 +238,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug ("CreateVFModule VolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -261,7 +265,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req); @@ -322,7 +326,7 @@ public class VolumeAdapterRest { } response = new DeleteVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -330,7 +334,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -357,7 +361,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req); @@ -420,7 +424,7 @@ public class VolumeAdapterRest { vnfAdapter.rollbackVnf(vrb); response = new RollbackVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -428,7 +432,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("DeleteVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -456,7 +460,7 @@ public class VolumeAdapterRest { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_IN_URL_DOESNT_MATCH_CONTENT) .build(); } UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req); @@ -552,7 +556,7 @@ public class VolumeAdapterRest { req.getVolumeGroupId(), req.getVolumeGroupStackId(), outputs.value, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } if (!req.isSynchronous()) { @@ -560,7 +564,7 @@ public class VolumeAdapterRest { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("UpdateVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java index b29e1f57a7..d83e929d6e 100644 --- a/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package db.migration; import org.junit.Assert; diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml index 934e2a544f..9dff66b00d 100644 --- a/adapters/mso-requests-db-adapter/pom.xml +++ b/adapters/mso-requests-db-adapter/pom.xml @@ -67,16 +67,16 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db-repositories</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <optional>true</optional> </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> - </dependency> - <dependency> <groupId>ch.vorburger.mariaDB4j</groupId> <artifactId>mariaDB4j</artifactId> <version>2.2.3</version> @@ -110,6 +110,15 @@ <artifactId>micrometer-registry-prometheus</artifactId> <version>1.0.5</version> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-rest</artifactId> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>cxf-logging</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> <build> @@ -230,4 +239,4 @@ </plugins> </pluginManagement> </build> -</project>
\ No newline at end of file +</project> diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java index 9a7382f200..28c56b32cd 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -76,14 +78,14 @@ public class ArchiveInfraRequestsScheduler { requestsByEndTime = infraActiveRepo.findByEndTimeLessThan(archivingDate, pageRequest); logger.debug(requestsByEndTime.size() + " requests to be archived based on End Time" ); archiveInfraRequests(requestsByEndTime); - } while(requestsByEndTime.size() > 0); + } while(!requestsByEndTime.isEmpty()); List<InfraActiveRequests> requestsByStartTime = new ArrayList<>(); do { requestsByStartTime = infraActiveRepo.findByStartTimeLessThanAndEndTime(archivingDate, null, pageRequest); logger.debug(requestsByEndTime.size() + " requests to be archived based on Start Time" ); archiveInfraRequests(requestsByStartTime); - } while(requestsByStartTime.size() > 0); + } while(!requestsByStartTime.isEmpty()); logger.debug("End of archiveInfraRequestsScheduler"); } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java index 34bf9cb0f5..a476f890cc 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomController.java @@ -20,19 +20,19 @@ package org.onap.so.adapters.requestsdb; +import java.util.List; +import java.util.Map; + import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; - - -import java.util.List; -import java.util.Map; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; @RestController public class InfraActiveRequestsRepositoryCustomController { @@ -59,4 +59,11 @@ public class InfraActiveRequestsRepositoryCustomController { public InfraActiveRequests checkInstanceNameDuplicate(@RequestBody InstanceNameDuplicateCheckRequest instanceNameDuplicateCheckRequest) { return infraActiveRequestsRepository.checkInstanceNameDuplicate(instanceNameDuplicateCheckRequest.getInstanceIdMap(), instanceNameDuplicateCheckRequest.getInstanceName(), instanceNameDuplicateCheckRequest.getRequestScope()); } + + @RequestMapping(method = RequestMethod.POST, value = "/infraActiveRequests/v1/getInfraActiveRequests") + public List<InfraActiveRequests> getInfraActiveRequests(@RequestBody Map<String, String[]> filters, + @RequestParam("from") long startTime, @RequestParam("to") long endTime, + @RequestParam(value = "maxResult", required = false) Integer maxResult) { + return infraActiveRequestsRepository.getInfraActiveRequests(filters, startTime, endTime, maxResult); + } } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java index d0eae88c9e..33b1028cbb 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -23,10 +23,8 @@ package org.onap.so.adapters.requestsdb; import java.sql.Timestamp; - import javax.jws.WebService; import javax.transaction.Transactional; - import org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationStatus; @@ -37,7 +35,6 @@ import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; import org.onap.so.db.request.data.repository.SiteStatusRepository; -import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; import org.onap.so.utils.UUIDChecker; @@ -48,13 +45,7 @@ import org.springframework.stereotype.Component; @WebService(serviceName = "RequestsDbAdapter", endpointInterface = "org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter", targetNamespace = "http://org.onap.so/requestsdb") @Component @Primary -public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { - - private static final String SUCCESSFUL = "Successful"; - - private static final String GET_INFRA_REQUEST = "Get Infra request"; - - private static final String ERROR = "Error "; +public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoRequestsDbAdapterImpl.class); @@ -76,8 +67,6 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { RequestStatusType requestStatus, String progress, String vnfOutputs, String serviceInstanceId, String networkId, String vnfId, String vfModuleId, String volumeGroupId, String serviceInstanceName, String configurationId, String configurationName, String vfModuleName) throws MsoRequestsDbException { - MsoLogger.setLogContext(requestId, serviceInstanceId); - long startTime = System.currentTimeMillis(); try { InfraActiveRequests request = infraActive.findOneByRequestIdOrClientRequestId(requestId, requestId); if (request == null) { @@ -132,15 +121,11 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } request.setLastModifiedBy(lastModifiedBy); infraActive.save(request); - } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; - logger.error(ERROR + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); - throw new MsoRequestsDbException(error, e); + logger.error(error, e); + throw new MsoRequestsDbException(error, MsoLogger.ErrorCode.BusinessProcesssError, e); } - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); - } private void setProgress(String progress, InfraActiveRequests request) { @@ -153,15 +138,10 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { @Override @Transactional - public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException { - long startTime = System.currentTimeMillis(); - MsoLogger.setLogContext(requestId, null); - + public InfraActiveRequests getInfraRequest(String requestId) throws MsoRequestsDbException { logger.debug("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId); - InfraActiveRequests request = null; try { - request = infraActive.findOneByRequestIdOrClientRequestId(requestId, requestId); if (request == null) { String error = "Entity not found. Unable to retrieve MSO Infra Requests DB for Request ID " + requestId; @@ -169,11 +149,9 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { } } catch (Exception e) { String error = "Error retrieving MSO Infra Requests DB for Request ID " + requestId; - logger.error(ERROR + MsoLogger.ErrorCode.BusinessProcesssError + " for " + GET_INFRA_REQUEST + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); - throw new MsoRequestsDbException(error, e); + logger.error(error,e); + throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError , e); } - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); return request; } @@ -188,18 +166,14 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { @Transactional public boolean getSiteStatus(String siteName) { UUIDChecker.generateUUID(logger); - long startTime = System.currentTimeMillis(); SiteStatus siteStatus; logger.debug("Request database - get Site Status with Site name:" + siteName); - siteStatus = siteRepo.findOneBySiteName(siteName); if (siteStatus == null) { // if not exist in DB, it means the site is not disabled, thus // return true - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); return true; - } else { - logger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESSFUL); + } else { return siteStatus.getStatus(); } } @@ -226,9 +200,8 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { if (operStatus == null) { String error = "Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId; - MsoRequestsDbException e = new MsoRequestsDbException(error); - logger.error(ERROR+ MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_DB_REQUEST_NOT_EXIST + " - " + error, e); - throw e; + logger.error(error); + throw new MsoRequestsDbException(error,MsoLogger.ErrorCode.BusinessProcesssError); } operStatus.setUserId(userId); @@ -327,4 +300,4 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { resStatus.setStatusDescription(statusDescription); resourceOperationStatusRepository.save(resStatus); } -}
\ No newline at end of file +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java index a7e9cab6ba..23a769bc21 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java @@ -28,6 +28,8 @@ import org.apache.cxf.jaxrs.swagger.Swagger2Feature; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -43,8 +45,6 @@ public class CXFConfiguration { @Autowired private MsoRequestsDbAdapter requestDbAdapterImpl; - - @Bean public ServletRegistrationBean cxfServlet() { @@ -58,7 +58,10 @@ public class CXFConfiguration { LoggingFeature logFeature = new LoggingFeature(); logFeature.setPrettyLogging(true); logFeature.initialize(bus); - endpoint.getFeatures().add(logFeature); + endpoint.getFeatures().add(logFeature); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java new file mode 100644 index 0000000000..e932bb2cca --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.requestsdb.application; + + +import org.onap.so.logging.spring.interceptor.LoggingInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.handler.MappedInterceptor; + +@Configuration +public class WebMvcConfig extends WebMvcConfigurerAdapter { + + @Autowired + LoggingInterceptor loggingInterceptor; + + @Bean + public MappedInterceptor mappedLoggingInterceptor() { + return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor); + } + +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java index 660761143e..e6d736d2ad 100644 --- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java +++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java @@ -23,6 +23,8 @@ package org.onap.so.adapters.requestsdb.exceptions; import javax.xml.ws.WebFault; +import org.onap.so.exceptions.MSOException; +import org.onap.so.logger.MsoLogger.ErrorCode; /** * This class simply extends Exception (without addition additional functionality) @@ -31,32 +33,41 @@ import javax.xml.ws.WebFault; * */ @WebFault (name="MsoRequestsDbException", faultBean="org.onap.so.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://org.onap.so/requestsdb") -public class MsoRequestsDbException extends Exception { - - private static final long serialVersionUID = 1L; - - private MsoRequestsDbExceptionBean faultInfo; - - public MsoRequestsDbException (String msg) { - super(msg); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbException (Throwable e) { - super(e); - faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); - } - - public MsoRequestsDbException (String msg, Throwable e) { - super (msg, e); - faultInfo = new MsoRequestsDbExceptionBean (msg); - } - - public MsoRequestsDbExceptionBean getFaultInfo() { - return faultInfo; - } - - public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { - this.faultInfo = faultInfo; - } +public class MsoRequestsDbException extends MSOException { + + private static final long serialVersionUID = 1L; + + private MsoRequestsDbExceptionBean faultInfo; + + + public MsoRequestsDbException (String msg) { + super(msg); + faultInfo = new MsoRequestsDbExceptionBean (msg); + } + + public MsoRequestsDbException (Throwable e) { + super(e); + faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); + } + + public MsoRequestsDbException (String msg, Throwable e) { + super (msg, e); + faultInfo = new MsoRequestsDbExceptionBean (msg); + } + + public MsoRequestsDbException(String msg, ErrorCode errorCode) { + super(msg,errorCode.getValue()); + } + + public MsoRequestsDbException(String msg, ErrorCode errorCode, Throwable t) { + super(msg,errorCode.getValue(), t); + } + + public MsoRequestsDbExceptionBean getFaultInfo() { + return faultInfo; + } + + public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { + this.faultInfo = faultInfo; + } } diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml index 102b52985c..414c552619 100644 --- a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml +++ b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml @@ -12,11 +12,15 @@ mso: endpoint: http://localhost:8081 logPath: logs site-name: localSite + adapters: + requestDb: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + endpoint: http://localhost:8081 spring: datasource: url: jdbc:mariadb://localhost:3306/requestdb - username: mso - password: mso123 + username: catalog + password: catalog123 driver-class-name: org.mariadb.jdbc.Driver initialize: true initialization-mode: never diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql new file mode 100644 index 0000000000..394a3e5b12 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql @@ -0,0 +1,18 @@ +use requestdb; + +CREATE TABLE IF NOT EXISTS request_processing_data ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `SO_REQUEST_ID` VARCHAR(50) NOT NULL, + `GROUPING_ID` VARCHAR(100) NULL, + `NAME` VARCHAR(200) NOT NULL, + `VALUE` LONGTEXT, + `TAG` VARCHAR(200) NOT NULL, + `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE INDEX `UK_request_processing_data` ( + `SO_REQUEST_ID` ASC, + `GROUPING_ID` ASC, + `TAG` ASC, + `NAME` ASC + ) +) ENGINE = InnoDB DEFAULT CHARSET = latin1; diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java new file mode 100644 index 0000000000..c1e620ba74 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.requestdb.rest; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; + +import javax.transaction.Transactional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.db.request.client.RequestsDbClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class RequestProcessingDataRequestDbQueryTest { + @Autowired + private RequestsDbClient client; + + @LocalServerPort + private int port; + + @Before + public void setPort() { + client.removePortFromEndpoint(); + client.setPortToEndpoint(Integer.toString(port)); + } + + @Test + @Transactional + public void RequestProcessingDataBySoRequestIdTest() { + String soRequestId = "00032ab7-na18-42e5-965d-8ea592502018"; + String tag = "pincFabricConfigRequest"; + RequestProcessingData firstEntry = new RequestProcessingData(); + RequestProcessingData secondEntry = new RequestProcessingData(); + List<RequestProcessingData> expectedList = new ArrayList<>(); + firstEntry.setSoRequestId(soRequestId); + firstEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715"); + firstEntry.setName("configurationId"); + firstEntry.setValue("52234bc0-d6a6-41d4-a901-79015e4877e2"); + firstEntry.setTag(tag); + secondEntry.setSoRequestId(soRequestId); + secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714"); + secondEntry.setName("requestAction"); + secondEntry.setValue("assign"); + secondEntry.setTag(tag); + expectedList.add(firstEntry); + expectedList.add(secondEntry); + + List<RequestProcessingData> dataFound = client.getRequestProcessingDataBySoRequestId(soRequestId); + //bean comparison with shazam fails serialization: Forgot to register a type adapter? + assertEquals(dataFound.get(0).getSoRequestId(), firstEntry.getSoRequestId()); + assertEquals(dataFound.get(0).getGroupingId(), firstEntry.getGroupingId()); + assertEquals(dataFound.get(0).getName(), firstEntry.getName()); + assertEquals(dataFound.get(0).getValue(), firstEntry.getValue()); + assertEquals(dataFound.get(0).getTag(), firstEntry.getTag()); + assertEquals(dataFound.get(1).getSoRequestId(), secondEntry.getSoRequestId()); + assertEquals(dataFound.get(1).getGroupingId(), secondEntry.getGroupingId()); + assertEquals(dataFound.get(1).getName(), secondEntry.getName()); + assertEquals(dataFound.get(1).getValue(), secondEntry.getValue()); + assertEquals(dataFound.get(1).getTag(), secondEntry.getTag()); + } +} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java index 58eb0085ad..58fd517c91 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.adapters.requestsdb; @@ -8,6 +28,7 @@ import org.junit.runner.RunWith; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -39,6 +60,9 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { @LocalServerPort private int port; + + @Value("${mso.adapters.requestDb.auth}") + private String msoAdaptersAuth; private String createURLWithPort(String uri) { return "http://localhost:" + port + uri; @@ -82,6 +106,7 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); + headers.set("Authorization", msoAdaptersAuth); infraActiveRequests = new InfraActiveRequests(); @@ -181,12 +206,13 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { @Test public void checkVnfIdStatusTest() { - HttpEntity<List<String>> entityList = new HttpEntity("", headers); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort("/infraActiveRequests" + "/checkVnfIdStatus/" + infraActiveRequests.getOperationalEnvId())); + HttpEntity<String> entity = new HttpEntity(HttpEntity.EMPTY, headers); ResponseEntity<InfraActiveRequests> response = restTemplate.exchange( builder.toUriString(), - HttpMethod.GET, HttpEntity.EMPTY, InfraActiveRequests.class); + HttpMethod.GET,entity , InfraActiveRequests.class); infraActiveRequestsResponse = response.getBody(); @@ -241,4 +267,4 @@ public class InfraActiveRequestsRepositoryCustomControllerTest { verifyInfraActiveRequests(); } -}
\ No newline at end of file +} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java index 005eba0ec2..21ec8f7518 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java @@ -21,16 +21,16 @@ package org.onap.so.adapters.requestsdb.adapters; import static org.junit.Assert.*; - - - +import java.util.Map; import javax.ws.rs.core.Response; import org.json.JSONException; import org.junit.Test; import org.junit.runner.RunWith; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; - +import org.onap.so.adapters.requestsdb.application.TestAppender; +import org.onap.so.logger.MsoLogger; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -40,6 +40,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; +import ch.qos.logback.classic.spi.ILoggingEvent; @RunWith(SpringRunner.class) @@ -57,7 +58,7 @@ public class HealthCheckHandlerTest { @Test public void testHealthcheck() throws JSONException { - + TestAppender.events.clear(); HttpEntity<String> entity = new HttpEntity<String>(null, headers); ResponseEntity<String> response = restTemplate.exchange( @@ -65,6 +66,28 @@ public class HealthCheckHandlerTest { HttpMethod.GET, entity, String.class); assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value()); + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") && + logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } + TestAppender.events.clear(); } private String createURLWithPort(String uri) { diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java index 4d00421e6c..03fd0622fa 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java @@ -23,15 +23,20 @@ package org.onap.so.adapters.requestsdb.adapters; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.List; - +import java.util.Map; +import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; +import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; +import org.onap.so.adapters.requestsdb.application.TestAppender; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.adapters.requestsdb.MsoRequestsDbAdapter; import org.onap.so.adapters.requestsdb.RequestStatusType; import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication; @@ -41,12 +46,17 @@ import org.onap.so.db.request.beans.OperationStatus; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.data.repository.OperationStatusRepository; import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; +import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Bean; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import ch.qos.logback.classic.spi.ILoggingEvent; @RunWith(SpringRunner.class) @SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -55,8 +65,7 @@ public class MSORequestDBImplTest { @LocalServerPort private int port; - - @Autowired + private MsoRequestsDbAdapter dbAdapter; @Autowired @@ -71,6 +80,16 @@ public class MSORequestDBImplTest { public InfraActiveRequests setupTestEntities() { return buildTestRequest(); } + + @Before + public void before(){ + JaxWsProxyFactoryBean jaxWsProxyFactory = new JaxWsProxyFactoryBean(); + jaxWsProxyFactory.setServiceClass(MsoRequestsDbAdapter.class); + jaxWsProxyFactory.setAddress("http://localhost:" + port + "/services/RequestsDbAdapter"); + jaxWsProxyFactory.setUsername("bpel"); + jaxWsProxyFactory.setPassword("password1$"); + dbAdapter = (MsoRequestsDbAdapter) jaxWsProxyFactory.create(); + } private InfraActiveRequests buildTestRequest() { InfraActiveRequests testRequest= new InfraActiveRequests(); @@ -94,11 +113,9 @@ public class MSORequestDBImplTest { return testRequest; } - - - @Test public void getByRequestId() throws MsoRequestsDbException { + InfraActiveRequests testRequest = setupTestEntities(); // Given String requestId = "00032ab7-3fb3-42e5-965d-8ea592502017"; @@ -121,10 +138,8 @@ public class MSORequestDBImplTest { try { dbAdapter.getInfraRequest(requestId); fail("Expected MsoRequestsDbException to be thrown"); - } catch (MsoRequestsDbException e) { - assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); } catch (Exception e) { - fail("Expected MsoRequestsDbException to be thrown, unknown exception thrown"); + assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); } } @@ -230,11 +245,9 @@ public class MSORequestDBImplTest { null, null, null); - fail("Expected MsoRequestsDbException to be thrown"); - } catch (MsoRequestsDbException e) { - assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); + fail("Expected MsoRequestsDbException to be thrown"); } catch (Exception e) { - fail("Expected MsoRequestsDbException to be thrown, unknown exception thrown"); + assertEquals(e.getMessage(),"Error retrieving MSO Infra Requests DB for Request ID invalidRequestId"); } } @@ -328,6 +341,7 @@ public class MSORequestDBImplTest { @Test public void updateServiceOperation_Not_Found() throws MsoRequestsDbException{ + TestAppender.events.clear(); String serviceId = "badserviceId"; String operationId = "operationid"; String operation = "newOperationType"; @@ -349,12 +363,35 @@ public class MSORequestDBImplTest { updatedOperationStatus.setProgress(progress); updatedOperationStatus.setReason(reason); updatedOperationStatus.setOperationContent(operationContent); - - thrown.expect(MsoRequestsDbException.class); - thrown.expectMessage("Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId); - - dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId, - result, operationContent, progress, reason); + + try { + dbAdapter.updateServiceOperationStatus(serviceId, operationId, operation, userId, + result, operationContent, progress, reason); + fail("Expected MsoRequestsDbException to be thrown"); + } catch (Exception e) { + assertEquals("Entity not found. Unable to retrieve OperationStatus Object ServiceId: " + serviceId + " operationId: " + operationId,e.getMessage()); + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") && + logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("500",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("ERROR",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } + } } @@ -423,6 +460,7 @@ public class MSORequestDBImplTest { @Test public void updateResourceOperationStatus() throws MsoRequestsDbException{ + TestAppender.events.clear(); String resourceTemplateUUID = "template1"; String serviceId = "serviceId"; String operationId = "operationId"; @@ -454,7 +492,29 @@ public class MSORequestDBImplTest { ResourceOperationStatus actualResource = dbAdapter.getResourceOperationStatus(serviceId, operationId,"template1"); assertThat(actualResource, sameBeanAs(expectedResource)); + + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor") && + logEvent.getMarker().getName().equals("ENTRY") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor") && + logEvent.getMarker().getName().equals("EXIT")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals(null,mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); + assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); + assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + } } -}
\ No newline at end of file +} diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/application/TestAppender.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/application/TestAppender.java new file mode 100644 index 0000000000..0da1fd7565 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/application/TestAppender.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.requestsdb.application; + +import java.util.ArrayList; +import java.util.List; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.AppenderBase; + + + +public class TestAppender extends AppenderBase<ILoggingEvent> { + public static List<ILoggingEvent> events = new ArrayList<>(); + + @Override + public void append(ILoggingEvent loggingEvent) { + events.add(loggingEvent); + } +} diff --git a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml index 49582ec513..812fd232b4 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml @@ -1,5 +1,7 @@ # will be used as entry in DB to say SITE OFF/ON for healthcheck - +security: + basic: + enabled: false server: port: 8080 tomcat: @@ -8,7 +10,7 @@ ssl-enable: false mso: adapters: requestDb: - auth: Basic YnBlbDptc28tZGItMTUwNyE= + auth: Basic YnBlbDpwYXNzd29yZDEk endpoint: http://localhost:8081 logPath: logs site-name: localSite @@ -34,9 +36,17 @@ spring: security: usercredentials: - - username: test - password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu' + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' role: BPEL-Client + - + username: bpel + password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' + role: BPEL-Client + - + username: mso_admin + password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' + role: ACTUATOR mariaDB4j: dataDir: port: 3307 diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql index ec02ac0734..ae5f5e9124 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql +++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql @@ -29,4 +29,10 @@ insert into watchdog_service_mod_ver_id_lookup(distribution_id, service_model_ve insert into site_status(site_name, status, creation_timestamp) values -('testsite', 0, '2017-11-30 15:48:09');
\ No newline at end of file +('testsite', 0, '2017-11-30 15:48:09'); + +INSERT INTO requestdb.request_processing_data (ID, SO_REQUEST_ID, GROUPING_ID, NAME, VALUE, TAG) +VALUES +(1, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca714', 'requestAction', 'assign', 'pincFabricConfigRequest'), +(2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest'), +(3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig'); diff --git a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml index 54fa1cdd65..d1596cd374 100644 --- a/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml @@ -1,33 +1,55 @@ <configuration> - - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern> - </encoder> - </appender> - - - <logger name="com.att.ecomp.audit" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - - <logger name="com.att.eelf.metrics" level="info" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> + + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${pattern}</pattern> + </encoder> + </appender> + + <appender name="test" + class="org.onap.so.adapters.requestsdb.application.TestAppender" /> + + <logger name="com.att.ecomp.audit" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.error" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <logger name="com.att.eelf.error" level="trace" additivity="false"> - <appender-ref ref="STDOUT" /> - </logger> - <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> </logger> - <logger name="org.flywaydb" level="DEBUG" additivity="false"> + + <logger name="org.flywaydb" level="DEBUG" additivity="false"> <appender-ref ref="STDOUT" /> </logger> - <root level="WARN"> - <appender-ref ref="STDOUT" /> - </root> - + + + <logger name="ch.vorburger" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + + <root level="WARN"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </root> + + </configuration>
\ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml index 0337c2613e..7723ffa691 100644 --- a/adapters/mso-sdnc-adapter/pom.xml +++ b/adapters/mso-sdnc-adapter/pom.xml @@ -150,11 +150,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> - </dependency> - <dependency> <groupId>io.micrometer</groupId> <artifactId>micrometer-spring-legacy</artifactId> <version>1.0.5</version> @@ -164,5 +159,10 @@ <artifactId>micrometer-registry-prometheus</artifactId> <version>1.0.5</version> </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>cxf-logging</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java index 4a50fb32e3..543c8e4b00 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java @@ -33,7 +33,9 @@ import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse; import org.onap.so.logger.MsoLogger; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -46,8 +48,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration("CXFConfiguration") public class CXFConfiguration { - - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class); JAXRSServerFactoryBean endpoint; @@ -62,10 +62,10 @@ public class CXFConfiguration { @Autowired private SNIROResponse sniroResponse; - @Autowired private ObjectMapper mapper; + @Bean public Server rsServer() { endpoint = new JAXRSServerFactoryBean(); @@ -85,9 +85,12 @@ public class CXFConfiguration { @Bean public Endpoint sndcAdapter() { - EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterPortImpl); - endpoint.publish("/SDNCAdapter"); - return endpoint; + EndpointImpl wsdlEndpoint = new EndpointImpl(bus, sdncAdapterPortImpl); + wsdlEndpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + wsdlEndpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + wsdlEndpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); + wsdlEndpoint.publish("/SDNCAdapter"); + return wsdlEndpoint; } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java index b456fb2336..a5800fc73d 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -87,7 +89,7 @@ public class MapRequestTunables { } } - if (reqTunable.getSdncUrl() == null || reqTunable.getSdncUrl().equals("")) { + if (reqTunable.getSdncUrl() == null || ("").equals(reqTunable.getSdncUrl())) { error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value; } } else { diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java index 5ed9763b71..6947b870d7 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -20,14 +22,10 @@ package org.onap.so.adapters.sdnc.impl; - - -import org.onap.so.logger.MsoLogger; public class RequestTunables { - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,RequestTunables.class); - + public static final String GENERATED_KEY = "Generated key: "; //criteria diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java index 8000e3ab8e..a0e3a17496 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java @@ -77,8 +77,6 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType { sdncResp.setRespMsg(respMsg); sdncClient.sendRespToBpel(callbackUrl, sdncResp); } - - SDNCAdapterResponse wsResp = new SDNCAdapterResponse(); - return wsResp; + return (new SDNCAdapterResponse()); } } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java index 2fd39df4e9..8ca14501e5 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -149,7 +151,7 @@ public class SDNCServiceRequestConnector extends SDNCConnector { ackFinalIndicator = "Y"; } - if (!ackFinalIndicator.equals("Y") && !"N".equals(ackFinalIndicator)) { + if (!"Y".equals(ackFinalIndicator) && !"N".equals(ackFinalIndicator)) { throw new ParseException("Invalid ack-final-indicator in SDNC response: '" + ackFinalIndicator + "'", 0); } @@ -161,7 +163,7 @@ public class SDNCServiceRequestConnector extends SDNCConnector { // If the response code in the message from SDNC was not 2XX, return SDNCServiceError. - if (!responseCode.matches("2[0-9][0-9]") && !responseCode.equals("0")) { + if (!responseCode.matches("2[0-9][0-9]") && !("0").equals(responseCode)) { // Not a 2XX response. Return SDNCServiceError. return new SDNCServiceError(svcRequestId, responseCode, responseMessage, ackFinalIndicator); } diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java index 72a23282d9..4c85241f9a 100644 --- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java +++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -65,7 +67,7 @@ public class SNIROResponse { String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, ""); - if (bpUrl == null || bpUrl.equals("")) { + if (bpUrl == null || ("").equals(bpUrl)) { String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP; LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param"); diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java index 29a1db89aa..9716bb624a 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java @@ -24,7 +24,6 @@ import org.junit.After; import org.junit.Rule; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.onap.so.cloud.Application; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -33,7 +32,7 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = SDNCAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @AutoConfigureWireMock(port = 0) public abstract class BaseTest { diff --git a/adapters/mso-vfc-adapter/.springBeans b/adapters/mso-vfc-adapter/.springBeans index 1310366fc4..7f46cc45af 100644 --- a/adapters/mso-vfc-adapter/.springBeans +++ b/adapters/mso-vfc-adapter/.springBeans @@ -13,4 +13,4 @@ </autoconfigs> <configSets> </configSets> -</beansProjectDescription> +</beansProjectDescription>
\ No newline at end of file diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml index d416c8e1e2..4d1c612018 100644 --- a/adapters/mso-vfc-adapter/pom.xml +++ b/adapters/mso-vfc-adapter/pom.xml @@ -97,6 +97,11 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db-repositories</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> </dependency> diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java index 3034cbcac3..031bc2edc5 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java @@ -32,7 +32,7 @@ import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.vfc.rest.HealthCheckHandler; import org.onap.so.adapters.vfc.rest.VfcAdapterRest; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java index 5bb83a7c1b..6ff6ec9379 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/MSOVfcApplication.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -18,14 +20,11 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.adapters.vfc; +package org.onap.so.adapters.vfc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java index 9489ef14f5..0f0a14c8f5 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/rest/VfcAdapterRest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -51,7 +53,8 @@ import org.springframework.stereotype.Component; public class VfcAdapterRest { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VfcAdapterRest.class); - + private static final String REQUEST_DEBUG_MSG="body from request is {}"; + private static final String APPLICATION_EXCEPTION="ApplicationException: "; @Autowired private VfcManager driverMgr ; @@ -73,12 +76,12 @@ public class VfcAdapterRest { public Response createNfvoNs(String data) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.debug(REQUEST_DEBUG_MSG + data); NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); RestfulResponse rsp = driverMgr.createNs(nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -99,12 +102,12 @@ public class VfcAdapterRest { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.debug(REQUEST_DEBUG_MSG + data); NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -124,12 +127,12 @@ public class VfcAdapterRest { public Response queryNfvoJobStatus(String data, @PathParam("jobId") String jobId) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.debug(REQUEST_DEBUG_MSG + data); NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -149,12 +152,12 @@ public class VfcAdapterRest { public Response instantiateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.debug(REQUEST_DEBUG_MSG + data); NSResourceInputParameter nsInput = JsonUtil.unMarshal(data, NSResourceInputParameter.class); RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -174,12 +177,12 @@ public class VfcAdapterRest { public Response terminateNfvoNs(String data, @PathParam("nsInstanceId") String nsInstanceId) { try { ValidateUtil.assertObjectNotNull(data); - LOGGER.debug("body from request is {}" + data); + LOGGER.debug(REQUEST_DEBUG_MSG + data); NsOperationKey nsOperationKey = JsonUtil.unMarshal(data, NsOperationKey.class); RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -205,7 +208,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.scaleNs(nsInstanceId, nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java index c12cd7da05..64032e25f5 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -51,7 +53,7 @@ public class JsonUtil { * Mapper. */ private static final ObjectMapper MAPPER = new ObjectMapper(); - + private static final String UNMARSHAL_FAIL_MSG="fail to unMarshal json"; static { MAPPER.setConfig(MAPPER.getDeserializationConfig().without( DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)); @@ -82,8 +84,8 @@ public class JsonUtil { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, - "fail to unMarshal json", e); - throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json"); + UNMARSHAL_FAIL_MSG, e); + throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } } @@ -100,8 +102,8 @@ public class JsonUtil { return MAPPER.readValue(jsonstr, type); } catch (IOException e) { LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError, - "fail to unMarshal json", e); - throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json"); + UNMARSHAL_FAIL_MSG, e); + throw new ApplicationException(HttpCode.BAD_REQUEST, UNMARSHAL_FAIL_MSG); } } diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java index 5b8779a67d..0536dd3560 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018. + * ================================================================================ * 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 @@ -73,6 +75,8 @@ public class RestfulUtil { private static final String DEFAULT_MSB_IP = "127.0.0.1"; private static final Integer DEFAULT_MSB_PORT = 80; + + private static final String VFC_ADAPTER="VFC Adapter"; @Autowired private Environment env; @@ -95,7 +99,7 @@ public class RestfulUtil { public RestfulResponse send(String url, String methodType, String content) { String msbUrl = getMsbHost() + url; - LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.onap.so.adapters.vfc.util.RestfulUtil","VFC Adapter"); + LOGGER.info(MessageEnum.RA_NS_EXC, "Begin to sent message " + methodType +": " + msbUrl, "org.onap.so.adapters.vfc.util.RestfulUtil",VFC_ADAPTER); HttpRequestBase method = null; HttpResponse httpResponse = null; @@ -196,12 +200,12 @@ public class RestfulUtil { } private static void logError(String errMsg, Throwable t) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); + LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t); ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } private static void logError(String errMsg) { - LOGGER.error(MessageEnum.RA_NS_EXC, "VFC Adapter", "", MsoLogger.ErrorCode.AvailabilityError, errMsg); + LOGGER.error(MessageEnum.RA_NS_EXC, VFC_ADAPTER, "", MsoLogger.ErrorCode.AvailabilityError, errMsg); ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg); } diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index f9f7127d17..87b269f3f6 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -196,12 +196,12 @@ <dependency> <groupId>org.onap.sdc.sdc-tosca</groupId> <artifactId>sdc-tosca</artifactId> - <version>1.4.1</version> + <version>1.3.5</version> </dependency> <dependency> <groupId>org.onap.sdc.jtosca</groupId> <artifactId>jtosca</artifactId> - <version>1.4.1</version> + <version>1.3.5</version> </dependency> <dependency> <groupId>org.onap.so</groupId> @@ -221,11 +221,11 @@ <groupId>org.onap.so</groupId> <artifactId>mso-requests-db</artifactId> <version>${project.version}</version> - </dependency> + </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> + <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db-repositories</artifactId> + <version>${project.version}</version> </dependency> <dependency> <groupId>org.antlr</groupId> diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java index 471a08bf99..62971ecd2b 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java @@ -15,7 +15,6 @@ * 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. - * Modifications Copyright (C) 2018 IBM. * ============LICENSE_END========================================================= */ diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java index 55a437f2c0..fae3a49910 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java @@ -268,7 +268,7 @@ public class ASDCController { - private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact, + protected IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact, String distributionId) throws ASDCDownloadException { LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL () @@ -370,7 +370,7 @@ public class ASDCController { } - private void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) { + protected void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) { for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) { @@ -397,7 +397,7 @@ public class ASDCController { } } - private void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) { + protected void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) { IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact(); @@ -424,7 +424,7 @@ public class ASDCController { } } - private void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException { + protected void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException { LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC"); try { @@ -459,7 +459,7 @@ public class ASDCController { DOWNLOAD, DEPLOY } - private void sendASDCNotification (NotificationType notificationType, + protected void sendASDCNotification (NotificationType notificationType, String artifactURL, String consumerID, String distributionID, @@ -515,7 +515,7 @@ public class ASDCController { LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null); } - private void sendFinalDistributionStatus ( + protected void sendFinalDistributionStatus ( String distributionID, DistributionStatusEnum status, String errorReason) { @@ -664,7 +664,7 @@ public class ASDCController { } } - private void processResourceNotification (INotificationData iNotif) { + protected void processResourceNotification (INotificationData iNotif) { // For each artifact, create a structure describing the VFModule in a ordered flat level VfResourceStructure resourceStructure = null; ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure(); @@ -735,7 +735,7 @@ public class ASDCController { "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e); } } - private void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) { + protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) { List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts(); @@ -768,7 +768,7 @@ public class ASDCController { } private static final String UNKNOWN="Unknown"; - + /** * @return the address of the ASDC we are connected to. */ diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java index cfdff85bc3..9115ed3ef2 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import org.onap.sdc.api.notification.IResourceInstance; -final class ResourceInstance implements IResourceInstance { +public class ResourceInstance implements IResourceInstance { @Override public String getResourceInstanceName(){ diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java index adc8071454..92fc598e7d 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java @@ -44,7 +44,15 @@ public final class VfModuleArtifact { public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { artifactInfo=artifactinfo; result = new String(clientResult.getArtifactPayload(), "UTF-8"); - + } + + public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) throws UnsupportedEncodingException { + artifactInfo=artifactinfo; + if(modifiedHeatTemplate != null){ + result = modifiedHeatTemplate; + }else{ + result = new String(clientResult.getArtifactPayload(), "UTF-8"); + } } public HeatFiles getHeatFiles() { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java index a045c2bb3a..f5e45115fd 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java @@ -102,6 +102,15 @@ public class VfResourceStructure { public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException { VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult); + addArtifactByType(artifactinfo,clientResult,vfModuleArtifact); + } + + public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) throws UnsupportedEncodingException { + VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult,modifiedHeatTemplate); + addArtifactByType(artifactinfo,clientResult,vfModuleArtifact); + } + + protected void addArtifactByType(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException { switch(artifactinfo.getArtifactType()) { case ASDCConfiguration.HEAT: diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 7dfb1bae3e..f7b457c718 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -41,6 +41,7 @@ import org.onap.sdc.toscaparser.api.CapabilityAssignment; import org.onap.sdc.toscaparser.api.CapabilityAssignments; import org.onap.sdc.toscaparser.api.Group; import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.Policy; import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.utils.DistributionStatusEnum; @@ -62,6 +63,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; import org.onap.so.db.catalog.beans.HeatEnvironment; import org.onap.so.db.catalog.beans.HeatFiles; @@ -83,24 +85,30 @@ import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.VnfcCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.CollectionResourceRepository; import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository; +import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository; import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository; import org.onap.so.db.catalog.data.repository.HeatTemplateRepository; import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository; import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; import org.onap.so.db.catalog.data.repository.VFModuleRepository; import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository; import org.onap.so.db.catalog.data.repository.VnfResourceRepository; +import org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository; import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.beans.WatchdogDistributionStatus; @@ -144,6 +152,9 @@ public class ToscaResourceInstaller { protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo; @Autowired + protected ServiceProxyResourceRepository serviceProxyRepo; + + @Autowired protected CollectionResourceRepository collectionRepo; @Autowired @@ -151,6 +162,9 @@ public class ToscaResourceInstaller { @Autowired protected ConfigurationResourceCustomizationRepository configCustomizationRepo; + + @Autowired + protected ConfigurationResourceRepository configRepo; @Autowired protected VnfResourceRepository vnfRepo; @@ -166,6 +180,12 @@ public class ToscaResourceInstaller { @Autowired protected VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo; + + @Autowired + protected VnfcCustomizationRepository vnfcCustomizationRepo; + + @Autowired + protected CvnfcCustomizationRepository cvnfcCustomizationRepo; @Autowired protected AllottedResourceRepository allottedRepo; @@ -370,32 +390,48 @@ public class ToscaResourceInstaller { } } } - + protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) { List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY); List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION); + List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>(); + List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<ConfigurationResourceCustomization>(); + + ServiceProxyResourceCustomization serviceProxy = null; + if (serviceProxyResourceList != null) { for (NodeTemplate spNode : serviceProxyResourceList) { - createServiceProxy(spNode, service, toscaResourceStruct); - serviceProxyCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogServiceProxyResourceCustomization()); + serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); + + ServiceProxyResource serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getServiceProxyResource().getModelUUID()); + + if(serviceProxyResource == null){ + + serviceProxyList.add(serviceProxy); for (NodeTemplate configNode : configurationNodeTemplatesList) { - + List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll(); for (RequirementAssignment requirement : requirementsList) { if (requirement.getNodeTemplateName().equals(spNode.getName())) { - createConfiguration(configNode, toscaResourceStruct, toscaResourceStruct.getCatalogServiceProxyResourceCustomization()); - configCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogConfigurationResourceCustomization()); + ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy); + + configurationResourceList.add(configurationResource); break; } } } + + } } } + + service.setConfigurationCustomizations(configurationResourceList); + service.setServiceProxyCustomizations(serviceProxyList); } protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) { @@ -420,40 +456,57 @@ public class ToscaResourceInstaller { protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) throws Exception { - if (!vfCustomizationCategory.equalsIgnoreCase(ALLOTTED_RESOURCE)) + + logger.debug("VF Category is : " + vfCustomizationCategory); + + //if (!vfCustomizationCategory.equalsIgnoreCase(ALLOTTED_RESOURCE)) + if(vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure().isEmpty()) { String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper() .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - logger.debug("vfCustomizationUUID=" + vfCustomizationUUID); + logger.debug("VFCustomizationUUID=" + vfCustomizationUUID); - IResourceInstance vfMetaDataResource = vfResourceStructure.getResourceInstance(); + IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance(); - // Make sure the vfMetadata and tosca customizations match before comparing their VF Modules UUID's - if(vfCustomizationUUID.equals(vfMetaDataResource.getResourceCustomizationUUID())){ - - logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfMetaData CustomizationUUID"); + // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before comparing their VF Modules UUID's + logger.debug("Checking if Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() + + " matches Tosca VF Customization UUID: " + vfCustomizationUUID); + + if(vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())){ - VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); + logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfNotificationResource CustomizationUUID"); - for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { - logger.debug("vfModuleStructure ModelUUID: " + vfModuleStructure.toString()); + VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); + + Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<CvnfcCustomization>(); + Set<VnfcCustomization> vnfcCustomizations = new HashSet<VnfcCustomization>(); + + for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { + + logger.debug("vfModuleStructure:" + vfModuleStructure.toString()); List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct .getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); - IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); + IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); + + logger.debug("Comparing VFModule Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID()); + for(Group group : vfGroups){ + logger.debug("To Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID")); + } Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream(). filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())). findFirst(); if(matchingObject.isPresent()){ - VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource); + VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, + vfResourceStructure,vfMetadata, vnfResource, service, cvnfcCustomizations, vnfcCustomizations); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); }else throw new Exception("Cannot find matching VFModule Customization for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID()); } service.getVnfCustomizations().add(vnfResource); - } + } } } @@ -698,9 +751,6 @@ public class ToscaResourceInstaller { spCustomizationResource.setServiceProxyResource(spResource); serviceProxyCustomizationSet.add(spCustomizationResource); - - spResource.setServiceProxyCustomization(serviceProxyCustomizationSet); - toscaResourceStructure.setCatalogServiceProxyResource(spResource); toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource); @@ -744,7 +794,38 @@ public class ToscaResourceInstaller { return configCustomizationResource; } + + protected ConfigurationResourceCustomization createFabricConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure) { + + Metadata fabricMetadata = nodeTemplate.getMetaData(); + + ConfigurationResource configResource = new ConfigurationResource(); + + configResource.setModelName(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + configResource.setModelInvariantUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + configResource.setModelUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + configResource.setModelVersion(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + configResource.setDescription(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + configResource.setToscaNodeType(nodeTemplate.getType()); + + ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization(); + + Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>(); + + configCustomizationResource.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + configCustomizationResource.setModelInstanceName(nodeTemplate.getName()); + + configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "function")); + configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "role")); + configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "type")); + configCustomizationResource.setConfigResourceCustomization(configCustomizationResource); + configCustomizationResource.setConfigurationResource(configResource); + configResourceCustomizationSet.add(configCustomizationResource); + configResource.setConfigurationResourceCustomization(configResourceCustomizationSet); + + return configCustomizationResource; + } protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) { ToscaCsar toscaCsar = new ToscaCsar(); @@ -761,6 +842,34 @@ public class ToscaResourceInstaller { toscaResourceStructure.setCatalogToscaCsar(toscaCsar); } + + protected VnfcCustomization findExistingVfc(Set<VnfcCustomization> vnfcCustomizations, String customizationUUID) { + VnfcCustomization vnfcCustomization = null; + for(VnfcCustomization vnfcCustom : vnfcCustomizations){ + if (vnfcCustom != null && vnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) { + vnfcCustomization = vnfcCustom; + } + } + + if(vnfcCustomization==null) + vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID); + + return vnfcCustomization; + } + + protected CvnfcCustomization findExistingCvfc(Set<CvnfcCustomization> cvnfcCustomizations, String customizationUUID) { + CvnfcCustomization cvnfcCustomization = null; + for(CvnfcCustomization cvnfcCustom : cvnfcCustomizations){ + if (cvnfcCustom != null && cvnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) { + cvnfcCustomization = cvnfcCustom; + } + } + + if(cvnfcCustomization==null) + cvnfcCustomization = cvnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID); + + return cvnfcCustomization; + } protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate, ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin,Service service) { @@ -1084,7 +1193,7 @@ public class ToscaResourceInstaller { protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, - IVfModuleData vfModuleData, VnfResourceCustomization vnfResource) { + IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set<CvnfcCustomization> cvnfcCustomizations, Set<VnfcCustomization> vnfcCustomizations) { VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID()); if(vfModuleCustomization == null){ @@ -1104,9 +1213,173 @@ public class ToscaResourceInstaller { vfResourceStructure.setAlreadyDeployed(true); } + //****************************************************************************************************************** + //* Extract VFC's and CVFC's then add them to VFModule + //****************************************************************************************************************** + + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>(); + + // Extract CVFC lists + List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CVFC); + + for(NodeTemplate cvfcTemplate : cvfcList) { + + CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(cvnfcCustomizations, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + + if(existingCvnfcCustomization == null){ + + //Extract associated VFC - Should always be just one + List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC); + + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + VnfcCustomization existingVnfcCustomization = null; + + for(NodeTemplate vfcTemplate : vfcList) { + + existingVnfcCustomization = findExistingVfc(vnfcCustomizations, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + + if(existingVnfcCustomization == null){ + vnfcCustomization.setModelCustomizationUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + vnfcCustomization.setModelInstanceName(vfcTemplate.getName()); + vnfcCustomization.setModelInvariantUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vnfcCustomization.setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + vnfcCustomization.setModelUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + + vnfcCustomization.setModelVersion( + testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + vnfcCustomization.setDescription( + testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType())); + + vnfcCustomizations.add(vnfcCustomization); + } + + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName()); + cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + + cvnfcCustomization.setModelVersion( + testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + cvnfcCustomization.setDescription( + testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType())); + + if(existingVnfcCustomization != null){ + cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization); + }else{ + cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + } + + cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + cvnfcCustomization.setVnfResourceCustomization(vnfResource); + + cvnfcCustomizations.add(cvnfcCustomization); + + //***************************************************************************************************************************************** + //* Extract Fabric Configuration + //***************************************************************************************************************************************** + + List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CONFIGURATION); + + for(NodeTemplate fabricTemplate : fabricConfigList) { + + ConfigurationResource fabricConfig = null; + + ConfigurationResource existingConfig = findExistingConfiguration(service, fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + + if(existingConfig == null){ + + ConfigurationResourceCustomization fabricConfigCustomization = createFabricConfiguration(fabricTemplate, toscaResourceStructure); + + fabricConfig = fabricConfigCustomization.getConfigurationResource(); + + service.getConfigurationCustomizations().add(fabricConfigCustomization); + }else { + fabricConfig = existingConfig; + } + + + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = createVfCnvfConfigCustomization(fabricTemplate, toscaResourceStructure, + vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig); + + vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization); + } + + } + + } + + } + + vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations); + vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations); + return vfModuleCustomization; } + protected VnfVfmoduleCvnfcConfigurationCustomization createVfCnvfConfigCustomization(NodeTemplate fabricTemplate, ToscaResourceStructure toscaResourceStruct, + VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization, + ConfigurationResource configResource) { + + Metadata fabricMetadata = fabricTemplate.getMetaData(); + + + VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization(); + + vfModuleToCvnfc.setConfigurationResource(configResource); + vfModuleToCvnfc.setCvnfcCustomization(cvnfcCustomization); + vfModuleToCvnfc.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + vfModuleToCvnfc.setModelInstanceName(fabricTemplate.getName()); + vfModuleToCvnfc.setVfModuleCustomization(vfModuleCustomization); + vfModuleToCvnfc.setVnfResourceCustomization(vnfResource); + vfModuleToCvnfc.setPolicyName(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "name")); + + List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper().getPoliciesOfTarget(fabricTemplate); + + if(policyList != null){ + for(Policy policy : policyList){ + vfModuleToCvnfc.setPolicyName(policy.getName()); + } + } + + vfModuleToCvnfc.setConfigurationFunction(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + vfModuleToCvnfc.setConfigurationRole(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + vfModuleToCvnfc.setConfigurationType(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + + return vfModuleToCvnfc; + } + + protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID) { + ConfigurationResource configResource = null; + for(ConfigurationResourceCustomization configurationResourceCustom : service.getConfigurationCustomizations()){ + if (configurationResourceCustom.getConfigurationResource() != null + && configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) { + configResource = configurationResourceCustom.getConfigurationResource(); + } + } + if(configResource==null) + configResource = configRepo.findResourceByModelUUID(modelUUID); + + return configResource; + } + + protected ServiceProxyResource findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelUUID) { + ServiceProxyResource serviceProxyResource = null; + for(ServiceProxyResourceCustomization serviceProxyResourceCustom : serviceProxyList){ + if (serviceProxyResourceCustom.getServiceProxyResource() != null + && serviceProxyResourceCustom.getServiceProxyResource().getModelUUID().equals(modelUUID)) { + serviceProxyResource = serviceProxyResourceCustom.getServiceProxyResource(); + } + } + if(serviceProxyResource==null) + serviceProxyResource = serviceProxyRepo.findResourceByModelUUID(modelUUID); + + return serviceProxyResource; + } + protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource, String vfModuleModelCustomizationUUID) { VfModuleCustomization vfModuleCustomization = null; @@ -1210,6 +1483,7 @@ public class ToscaResourceInstaller { protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization, Metadata vfMetadata) { + Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream() .filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID() .equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java index fdeddf1f68..32f512b0f0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java @@ -39,9 +39,9 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam; public class YamlEditor { - private static final String REFER_PATTERN = "file:///"; - private Map <String, Object> yml; - private Yaml yaml = new Yaml (); + protected static final String REFER_PATTERN = "file:///"; + protected Map <String, Object> yml; + protected Yaml yaml = new Yaml (); public YamlEditor () { @@ -52,7 +52,7 @@ public class YamlEditor { } @SuppressWarnings("unchecked") - private synchronized void init (byte[] body) { + protected synchronized void init (byte[] body) { InputStream input = new ByteArrayInputStream (body); yml = (Map <String, Object>) yaml.load (input); } diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index f8f32b7005..0372887f15 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -771,6 +771,78 @@ FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; +CREATE TABLE IF NOT EXISTS vnfc_customization ( +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS cvnfc_customization ( +`ID` INT(11) NOT NULL AUTO_INCREMENT, +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`NFC_FUNCTION` VARCHAR(200) NULL, +`NFC_NAMING_CODE` VARCHAR(200) NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; + + +CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; + --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; @@ -1036,4 +1108,4 @@ create table if not exists model ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `catalogdb`.`vnf_recipe` -CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
\ No newline at end of file +CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index dfb6af793c..c993071969 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -134,6 +134,17 @@ </configuration> </execution> <execution> + <id>non-spring-tests</id> + <goals> + <goal>test</goal> + </goals> + <configuration> + <includes> + <include>**/NonSpringSuite.java</include> + </includes> + </configuration> + </execution> + <execution> <id>groovy-tests</id> <goals> <goal>test</goal> @@ -217,15 +228,12 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> - - <dependency> <!-- Needed for InMemoryH2Test --> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> - <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> @@ -246,7 +254,7 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>mso-requests-db</artifactId> + <artifactId>mso-requests-db</artifactId> <version>${project.version}</version> </dependency> <dependency> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java new file mode 100644 index 0000000000..9035f4d506 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/ConfigScaleOutPayload.java @@ -0,0 +1,58 @@ +/* ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.appc.payload.beans; + +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ConfigScaleOutPayload { + + @JsonProperty("request-parameters") + private RequestParametersConfigScaleOut requestParameters; + @JsonProperty("configuration-parameters") + private Map<String, String> configurationParameters = new HashMap<>(); + + public RequestParametersConfigScaleOut getRequestParameters() { + return requestParameters; + } + + public void setRequestParameters(RequestParametersConfigScaleOut requestParameters) { + this.requestParameters = requestParameters; + } + + public Map<String, String> getConfigurationParameters() { + return configurationParameters; + } + + public void setConfigurationParameters(Map<String, String> configurationParameters) { + this.configurationParameters = configurationParameters; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("ConfigScaleOutPayload{"); + sb.append("requestParameters=").append(requestParameters); + sb.append(", configurationParameters='").append(configurationParameters); + sb.append('}'); + return sb.toString(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java new file mode 100644 index 0000000000..0333fd7a78 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersConfigScaleOut.java @@ -0,0 +1,55 @@ +/* ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.appc.payload.beans; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class RequestParametersConfigScaleOut { + + @JsonProperty("vnf-host-ip-address") + private String vnfHostIpAddress; + @JsonProperty("vf-module-id") + private String vfModuleId; + + public String getVnfHostIpAddress() { + return vnfHostIpAddress; + } + + public void setVnfHostIpAddress(String vnfHostIpAddress) { + this.vnfHostIpAddress = vnfHostIpAddress; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("RequestParametersConfigScaleOut{"); + sb.append("vnf-host-ip-address=").append(vnfHostIpAddress); + sb.append(", vf-module-id='").append(vfModuleId); + sb.append('}'); + return sb.toString(); + } +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java index f1c2c8dda6..deae46ce98 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java @@ -21,8 +21,10 @@ package org.onap.so.bpmn.common; import org.onap.so.client.aai.AAICommonObjectMapperProvider; +import org.onap.so.client.aai.AAIQueryClient; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.policy.PolicyClientImpl; import org.onap.so.client.sdno.SDNOValidator; import org.onap.so.client.sdno.SDNOValidatorImpl; import org.springframework.stereotype.Component; @@ -46,6 +48,10 @@ public class InjectionHelper { return new AAIResourcesClient(); } + public AAIQueryClient getAaiQueryClient() { + return new AAIQueryClient(); + } + public SDNOValidator getSdnoValidator() { return new SDNOValidatorImpl(); } @@ -57,4 +63,8 @@ public class InjectionHelper { public AAIResultWrapper getAaiResultWrapper(String json) { return new AAIResultWrapper(json); } + + public PolicyClientImpl getPolicyClient() { + return new PolicyClientImpl(); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java index 50137cf985..c3511e69a4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.client.sdnc; +package org.onap.so.bpmn.common.baseclient; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index ca2da772fb..fe6b0f8b4e 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -57,7 +57,7 @@ public class ResourceRequestBuilder { public static String CUSTOMIZATION_UUID = "customizationUUID"; - public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; + public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); @@ -184,7 +184,7 @@ public class ResourceRequestBuilder { private static String getCsarFromUuid(String uuid) throws Exception { String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint"); - HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); + HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB); Response response = client.get(); String value = response.readEntity(String.class); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java index 17bd4f545b..ba3ab7f315 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java @@ -139,8 +139,28 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> { private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>(); @JsonProperty("call-homing") private Boolean callHoming; + @JsonProperty("nf-function") + private String nfFunction; + @JsonProperty("nf-role") + private String nfRole; + public String getNfFunction() { + return nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + public List<InstanceGroup> getInstanceGroups() { return instanceGroups; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java new file mode 100644 index 0000000000..8f0ced955c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.servicedecomposition.entities; + +import java.io.Serializable; + +public class ConfigurationResourceKeys implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 1L; + private String vfModuleCustomizationUUID; + private String vnfResourceCustomizationUUID; + private String cvnfcCustomizationUUID; + + public String getVfModuleCustomizationUUID() { + return vfModuleCustomizationUUID; + } + public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) { + this.vfModuleCustomizationUUID = vfModuleCustomizationUUID; + } + public String getVnfResourceCustomizationUUID() { + return vnfResourceCustomizationUUID; + } + public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) { + this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID; + } + public String getCvnfcCustomizationUUID() { + return cvnfcCustomizationUUID; + } + public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) { + this.cvnfcCustomizationUUID = cvnfcCustomizationUUID; + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java index 0d04b5e7a1..be73b37f85 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java @@ -39,6 +39,7 @@ public class ExecuteBuildingBlock implements Serializable{ private Boolean homing; private WorkflowResourceIds workflowResourceIds; private RequestDetails requestDetails; + private ConfigurationResourceKeys configurationResourceKeys; public BuildingBlock getBuildingBlock() { return buildingBlock; @@ -100,4 +101,10 @@ public class ExecuteBuildingBlock implements Serializable{ public void setRequestDetails(RequestDetails requestDetails) { this.requestDetails = requestDetails; } + public ConfigurationResourceKeys getConfigurationResourceKeys() { + return configurationResourceKeys; + } + public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) { + this.configurationResourceKeys = configurationResourceKeys; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java index 7715651b68..d37c8d13f3 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/RequestContext.java @@ -21,7 +21,10 @@ package org.onap.so.bpmn.servicedecomposition.generalobjects; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -51,6 +54,8 @@ public class RequestContext implements Serializable{ private String msoRequestId; @JsonProperty("requestParameters") private RequestParameters requestParameters; + @JsonProperty("configurationParameters") + private List<Map<String, String>> configurationParameters = new ArrayList<>(); public String getServiceURI() { return serviceURI; @@ -112,4 +117,10 @@ public class RequestContext implements Serializable{ public void setRequestParameters(RequestParameters requestParameters) { this.requestParameters = requestParameters; } + public List<Map<String, String>> getConfigurationParameters() { + return configurationParameters; + } + public void setConfigurationParameters(List<Map<String, String>> configurationParameters) { + this.configurationParameters = configurationParameters; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java index 9d3aa5934b..87168107e1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java @@ -34,6 +34,8 @@ public class ModelInfoConfiguration implements Serializable{ private String modelVersionId; @JsonProperty("model-customization-id") private String modelCustomizationId; + @JsonProperty("policy-name") + private String policyName; public String getModelInvariantId() { return modelInvariantId; @@ -53,4 +55,10 @@ public class ModelInfoConfiguration implements Serializable{ public void setModelCustomizationId(String modelCustomizationId) { this.modelCustomizationId = modelCustomizationId; } + public String getPolicyName() { + return policyName; + } + public void setPolicyName(String policyName) { + this.policyName = policyName; + } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index e8e1982911..fc48996b9b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -71,6 +72,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.logger.MsoLogger; @@ -267,32 +269,24 @@ public class BBInputSetup implements JavaDelegate { } protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName) { - boolean foundByName = false; - boolean foundById = false; - for (Configuration configuration : serviceInstance.getConfigurations()) { + ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) { + Configuration configuration = null; + for (Configuration configurationTemp : serviceInstance.getConfigurations()) { if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null - && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { - foundById = true; + && configurationTemp.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) { + configuration = configurationTemp; org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); if(aaiConfiguration!=null){ modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); } - this.mapCatalogConfiguration(configuration, modelInfo, service); - } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) { - foundByName = true; - lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId()); - org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId()); - if(aaiConfiguration!=null){ - modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId()); - } - this.mapCatalogConfiguration(configuration, modelInfo, service); } } - if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { - Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); + if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) { + configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId); serviceInstance.getConfigurations().add(configuration); - this.mapCatalogConfiguration(configuration, modelInfo, service); + } + if(configuration != null) { + this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys); } } @@ -306,11 +300,28 @@ public class BBInputSetup implements JavaDelegate { return configuration; } - protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service) { + protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) { ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service); - if (configurationResourceCustomization != null) { - configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization)); + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = + findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(), + configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization); + if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) { + configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization + , vnfVfmoduleCvnfcConfigurationCustomization)); + } + } + + protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID, + String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) { + for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization : + configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) { + if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID) + && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID) + && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) { + return vnfVfmoduleCvnfcConfigurationCustomization; + } } + return null; } protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) { @@ -879,7 +890,7 @@ public class BBInputSetup implements JavaDelegate { if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) { String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); ModelInfo networkModelInfo = new ModelInfo(); - if(!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink())) { + if((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) { NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); if (networkCust != null) { networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); @@ -890,18 +901,19 @@ public class BBInputSetup implements JavaDelegate { } } else { msoLogger.debug("Orchestrating on Collection Network Resource Customization"); - serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId)); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); + L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance); + NetworkResourceCustomization networkResourceCustomization = + mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); + if(l3Network != null) { + l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); + } } } else if(bbName.contains("Configuration")) { String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); ModelInfo configurationModelInfo = new ModelInfo(); configurationModelInfo.setModelCustomizationUuid(key); - ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); - if(configurationCust != null) { - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); - } else { - msoLogger.debug("Could not find a configuration customization with key: " + key); - } + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); } if (executeBB.getWorkflowResourceIds() != null) { this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, @@ -911,15 +923,18 @@ public class BBInputSetup implements JavaDelegate { } protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key, - String networkId) { - CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key); - if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) + String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) { + if(collectionNetworkResourceCust != null) { + if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - NetworkResourceCustomization networkResourceCustomization = - mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); - L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null); - l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization)); - return l3Network; + serviceInstance.getNetworks().add(createNetwork(lookupKeyMap, null, networkId, null)); + } else { + for (L3Network network : serviceInstance.getNetworks()) { + if (network.getNetworkId().equalsIgnoreCase(networkId)) { + return network; + } + } + } } return null; } @@ -1019,7 +1034,7 @@ public class BBInputSetup implements JavaDelegate { .getModelCustomizationId(); ModelInfo modelInfo = new ModelInfo(); modelInfo.setModelCustomizationUuid(configurationCustUUID); - this.mapCatalogConfiguration(configuration, modelInfo, service); + this.mapCatalogConfiguration(configuration, modelInfo, service, executeBB.getConfigurationResourceKeys()); break; } } @@ -1087,7 +1102,7 @@ public class BBInputSetup implements JavaDelegate { configurationModelInfo.setModelCustomizationUuid(key); ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); if(configurationCust != null) { - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null); + this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys()); } else { msoLogger.debug("Could not find a configuration customization with key: " + key); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index c2161a4fee..877d5bb88f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -76,6 +76,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -454,11 +455,13 @@ public class BBInputSetupMapperLayer { } protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration( - ConfigurationResourceCustomization configurationResourceCustomization) { + ConfigurationResourceCustomization configurationResourceCustomization, + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) { ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID()); modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID()); modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID()); + modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName()); return modelInfoConfiguration; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index 4b85538428..84ecfc7576 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -45,7 +45,7 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.db.request.RequestsDbClient; + import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; @@ -54,6 +54,7 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java deleted file mode 100644 index 61869ca322..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.client.db.request; - -import java.io.IOException; -import java.net.URI; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpRequest; -import org.springframework.http.client.ClientHttpRequestExecution; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.stereotype.Component; -import org.springframework.web.client.RestTemplate; - -import uk.co.blackpepper.bowman.Client; -import uk.co.blackpepper.bowman.ClientFactory; -import uk.co.blackpepper.bowman.Configuration; -import uk.co.blackpepper.bowman.RestTemplateConfigurer; - -@Component("RequestDbClient") -public class RequestsDbClient { - - private Client<InfraActiveRequests> infraActiveRequestClient; - - @Value("${mso.adapters.db.spring.endpoint}") - private String endpoint; - - @Value("${mso.db.auth}") - private String msoAdaptersAuth; - - public RequestsDbClient() { - ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { - - public void configure(RestTemplate restTemplate) { - - restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { - - public ClientHttpResponse intercept(HttpRequest request, byte[] body, - ClientHttpRequestExecution execution) throws IOException { - - request.getHeaders().add("Authorization", msoAdaptersAuth); - return execution.execute(request, body); - } - }); - } - }).build().buildClientFactory(); - infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); - - } - - public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { - return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId)); - } - - protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) { - return infraActiveRequestClient.get(uri); - } - - public void updateInfraActiveRequests(InfraActiveRequests request) { - infraActiveRequestClient.put(request); - } - - protected URI getUri(String uri) { - return URI.create(uri); - } -} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java index 768bee578c..64283d78ca 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.openecomp.mso.bpmn.common.workflow.service; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn index 31a981729b..67bd961844 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true"> <bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming> @@ -101,6 +101,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> <camunda:in variables="all" /> <camunda:out variables="all" /> + <camunda:in businessKey="#{execution.processBusinessKey}" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_81</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing> diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java index d2f1186ad0..119d3b1e2d 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java @@ -32,6 +32,7 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.model.bpmn.Bpmn; import org.camunda.bpm.model.bpmn.BpmnModelInstance; import org.junit.Before; +import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.MockLoggerDelegate; @@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.test.categories.SpringAware; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.embedded.LocalServerPort; @@ -62,6 +64,7 @@ import com.github.tomakehurst.wiremock.client.WireMock; @ActiveProfiles("test") @ContextConfiguration @AutoConfigureWireMock(port = 0) +@Category(SpringAware.class) public abstract class BaseTest extends BuildingBlockTestDataSetup { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java index a983193ca3..5be879560f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java @@ -665,4 +665,27 @@ public class BuildingBlockTestDataSetup{ return ar; } + + public Configuration setConfiguration () { + Configuration config = new Configuration(); + config.setConfigurationId("testConfigurationId"); + ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration(); + modelInfoConfig.setModelCustomizationId("modelCustomizationId"); + modelInfoConfig.setModelVersionId("modelVersionId"); + modelInfoConfig.setModelInvariantId("modelInvariantId"); + modelInfoConfig.setPolicyName("policyName"); + config.setModelInfoConfiguration(modelInfoConfig); + + List<Configuration> configurations = new ArrayList<>(); + configurations.add(config); + ServiceInstance serviceInstance = new ServiceInstance(); + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId"); + serviceInstance.setConfigurations(configurations); + return config; + } }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java new file mode 100644 index 0000000000..ee2848cf3a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import org.junit.runner.RunWith; +import org.onap.so.test.categories.SpringAware; + +import com.googlecode.junittoolbox.ExcludeCategories; +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@ExcludeCategories({SpringAware.class}) +@SuiteClasses({"**/*Test.class", "!**/bpmn/common/scripts/**/*Test.class"}) +public class NonSpringSuite { + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java index ba8caee058..d1559c2ed1 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java @@ -22,8 +22,6 @@ package org.onap.so; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @@ -35,9 +33,7 @@ import org.springframework.context.annotation.Profile; @Profile("test") @EnableProcessApplication("MSO CommonBPMN Test Application") @ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class TestApplication { public static void main(String... args) { SpringApplication.run(TestApplication.class, args); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java index 514d93bdf8..45bbe9e5d8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java @@ -29,9 +29,7 @@ import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -51,9 +49,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EnableProcessApplication("MSO Common Application") @EnableAsync @ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class MSOCommonApplication { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java index a564d8a21d..f84a76468f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java @@ -1,9 +1,28 @@ -package org.onap.so.client.sdnc; +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.common.baseclient; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; -import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertThat; @@ -11,25 +30,23 @@ import java.util.Map; import javax.ws.rs.core.UriBuilder; -import org.junit.Rule; import org.junit.Test; +import org.onap.so.BaseTest; import org.springframework.core.ParameterizedTypeReference; -import com.github.tomakehurst.wiremock.junit.WireMockRule; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import wiremock.org.apache.http.entity.ContentType; -public class BaseClientTest { - - @Rule - public WireMockRule wm = new WireMockRule(options().dynamicPort()); - + +public class BaseClientTest extends BaseTest { + @Test public void verifyString() { BaseClient<String, String> client = new BaseClient<>(); String response = "{\"hello\" : \"world\"}"; - client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString()); - wm.stubFor(get(urlEqualTo("/test")) + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString()); + stubFor(get(urlEqualTo("/test")) .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); String result = client.get("", new ParameterizedTypeReference<String>() {}); @@ -40,8 +57,8 @@ public class BaseClientTest { public void verifyMap() { BaseClient<String, Map<String, Object>> client = new BaseClient<>(); String response = "{\"hello\" : \"world\"}"; - client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString()); - wm.stubFor(get(urlEqualTo("/test")) + client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString()); + stubFor(get(urlEqualTo("/test")) .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {}); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java index 70191311b2..5da47c973e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/recipe/ResourceInputTest.java @@ -22,8 +22,8 @@ package org.onap.so.bpmn.common.recipe; import static org.junit.Assert.assertEquals; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.core.domain.ModelInfo; +import org.onap.so.BaseTest; public class ResourceInputTest extends BaseTest{ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index c7d1a7c81f..3b41ff8337 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -7,9 +7,9 @@ * 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. @@ -44,16 +44,6 @@ public class StubResponseAAI { /** - * Tunnel-XConnect Mock Stub Response - */ - public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId)) - .willReturn(aResponse() - .withStatus(200))); - } - - - /** * Allotted Resource Mock StubResponses below */ public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) { @@ -63,7 +53,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() @@ -75,13 +65,13 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(500))); } - + public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) { stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(204))); } - + public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) { stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId)) .willReturn(aResponse() @@ -183,26 +173,26 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(204))); } - + public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - + public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription)) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml"))); } - + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(statusCode))); } - + public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){ stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234)) .willReturn(aResponse() @@ -263,7 +253,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType)) .willReturn(aResponse() @@ -303,7 +293,7 @@ public class StubResponseAAI { /** * Generic-Vnf Mock StubResponses below */ - + public static void MockGetGenericVnfById(String vnfId, String responseFile){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1")) .willReturn(aResponse() @@ -311,7 +301,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .willReturn(aResponse() @@ -319,23 +309,23 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .atPriority(1) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); + .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .atPriority(priority) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "text/xml") - .withBodyFile(responseFile))); + .withBodyFile(responseFile))); } public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){ @@ -345,7 +335,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfById_404(String vnfId){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() @@ -366,7 +356,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth)) .willReturn(aResponse() @@ -404,7 +394,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) { stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId)) .withRequestBody(containing(requestBodyContaining)) @@ -417,7 +407,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(statusCode))); } - + public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId)) .willReturn(aResponse() @@ -459,7 +449,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){ stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth)) .willReturn(aResponse() @@ -505,7 +495,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) { stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth)) .willReturn(aResponse() @@ -513,7 +503,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) .willReturn(aResponse() @@ -521,7 +511,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkByName(String networkName, String responseFile) { stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName)) .willReturn(aResponse() @@ -537,7 +527,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkCloudRegion_404(String cloudRegion) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion)) .willReturn(aResponse() @@ -551,7 +541,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) { stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId)) .willReturn(aResponse() @@ -559,7 +549,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName)) .willReturn(aResponse() @@ -574,8 +564,8 @@ public class StubResponseAAI { .withStatus(200) .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); - } - + } + public static void MockGetNetworkPolicy(String responseFile, String policy) { stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all")) .willReturn(aResponse() @@ -583,7 +573,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId)) .willReturn(aResponse() @@ -591,7 +581,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy)) .willReturn(aResponse() @@ -599,7 +589,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkTableReference(String responseFile, String tableReference) { stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all")) .willReturn(aResponse() @@ -607,7 +597,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) { stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth )) .willReturn(aResponse() @@ -615,7 +605,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy)) .willReturn(aResponse() @@ -623,7 +613,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId)) .willReturn(aResponse() @@ -631,15 +621,15 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPatchVfModuleId(String vnfId, String vfModuleId) { stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(200))); } - + ///////////// - + public static void MockVNFAdapterRestVfModule() { stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool")) .willReturn(aResponse() @@ -658,7 +648,7 @@ public class StubResponseAAI { .withStatus(202) .withHeader("Content-Type", "application/xml"))); } - + public static void MockDBUpdateVfModule(){ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter")) .willReturn(aResponse() @@ -666,7 +656,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile("VfModularity/DBUpdateResponse.xml"))); } - + // start of mocks used locally and by other VF Module unit tests public static void MockSDNCAdapterVfModule() { // simplified the implementation to return "success" for all requests @@ -678,7 +668,7 @@ public class StubResponseAAI { .withBodyFile("VfModularity/StandardSDNCSynchResponse.xml"))); } - + // start of mocks used locally and by other VF Module unit tests public static void MockAAIVfModule() { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool")) @@ -686,7 +676,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "text/xml") - .withBodyFile("VfModularity/VfModule-supercool.xml"))); + .withBodyFile("VfModularity/VfModule-supercool.xml"))); stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm")) .atPriority(2) .willReturn(aResponse() @@ -758,14 +748,14 @@ public class StubResponseAAI { .withStatus(200))); } - - + + ////////////// /** * Cloud infrastructure below */ - + public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId)) .willReturn(aResponse() @@ -773,14 +763,14 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + /** * Volume Group StubResponse below */ public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) { MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200); } - + public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() @@ -788,7 +778,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) { stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId)) .willReturn(aResponse() @@ -796,7 +786,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName)) .willReturn(aResponse() @@ -804,7 +794,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) { stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() @@ -816,13 +806,13 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(404))); } - + public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) { stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion)) .willReturn(aResponse() .withStatus(200))); } - + /** * VF-Module StubResponse below * @param statusCode TODO @@ -834,7 +824,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth)) .willReturn(aResponse() @@ -842,7 +832,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName)) .willReturn(aResponse() @@ -850,7 +840,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "text/xml") .withBodyFile(responseFile))); } - + public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) { stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .withRequestBody(containing(requestContaining)) @@ -865,19 +855,19 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(200))); } - + public static void MockPutVfModuleId(String vnfId, String vfModuleId) { stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(200))); } - + public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) { stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId)) .willReturn(aResponse() .withStatus(returnCode))); } - + public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) { stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion)) .willReturn(aResponse() @@ -889,7 +879,7 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(statusCode))); } - + /* AAI Pserver Queries */ public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) { stubFor(put(urlMatching("/aai/v1[0-9]/query.*")) @@ -898,7 +888,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "application/json") .withBodyFile(responseFile))); } - + public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() @@ -906,14 +896,14 @@ public class StubResponseAAI { .withHeader("Content-Type", "application/json; charset=utf-8") .withBodyFile(responseFile))); } - + public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) { stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() - .withStatus(statusCode) + .withStatus(statusCode) )); } - + public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) { stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*")) .willReturn(aResponse() @@ -921,7 +911,7 @@ public class StubResponseAAI { .withBodyFile(responseFile) )); } - + public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) { stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegionId + ".*")) .willReturn(aResponse() @@ -929,7 +919,7 @@ public class StubResponseAAI { .withHeader("Content-Type", "application/json; charset=utf-8") .withBodyFile(responseFile))); } - + //// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above //// @Deprecated public static void MockGetVceById(){ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java index 5f90f1e827..634e0a6c9b 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java @@ -30,7 +30,6 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.onap.so.BaseTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.bpmn.servicedecomposition.bbobjects.*; @@ -38,6 +37,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.BaseTest; public class ExtractPojosForBBTest extends BaseTest{ ExtractPojosForBB extractPojos = new ExtractPojosForBB(); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index c18dcf5cfa..33e1390b9c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -65,12 +65,15 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.VnfcCustomization; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.RequestDetails; @@ -613,17 +616,23 @@ public class BBInputSetupMapperLayerTest { String modelCustUUID = "modelCustomizationUUID"; String modelInvariantUUID = "modelInvariantUUID"; String modelVersionUUID = "modelUUID"; + String policyName = "policyName"; ModelInfoConfiguration expected = new ModelInfoConfiguration(); expected.setModelCustomizationId(modelCustUUID); expected.setModelInvariantId(modelInvariantUUID); expected.setModelVersionId(modelVersionUUID); + expected.setPolicyName(policyName); ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization(); configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID); configurationResourceCustomization.setConfigurationResource(new ConfigurationResource()); configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID); configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID); + VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization(); + policyNameTable.setCvnfcCustomization(new CvnfcCustomization()); + policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization()); + policyNameTable.setPolicyName(policyName); - ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization ); + ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable); assertThat(actual, sameBeanAs(expected)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 489163b23a..9897c04ad8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -66,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -1074,28 +1075,32 @@ public class BBInputSetupTest { Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); String bbName = AssignFlows.FABRIC_CONFIGURATION.toString(); + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); - doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName); - verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service); + instanceName, configResourceKeys); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null); SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName); - verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service); + instanceName, configResourceKeys); + verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); instanceName = "configurationName2"; resourceId = "resourceId2"; lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2"); Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId); doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId); - doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys); SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName); - verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service); + instanceName, configResourceKeys); + verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys); } @Test @@ -1666,6 +1671,12 @@ public class BBInputSetupTest { String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); String requestAction = "createInstance"; + + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); + executeBB.setConfigurationResourceKeys(configResourceKeys); doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId); doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId()); @@ -1714,13 +1725,13 @@ public class BBInputSetupTest { doReturn(configurationCustList).when(service).getConfigurationCustomizations(); configurationCustList.add(configurationCust); doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class)); executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class)); + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class)); } @Test @@ -1793,6 +1804,7 @@ public class BBInputSetupTest { doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class)); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(Boolean.FALSE); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(any(ExecuteBuildingBlock.class), any(), any(String.class), any(String.class), any(GeneralBuildingBlock.class), any(Service.class)); @@ -1998,6 +2010,13 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId"); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); + executeBB.setConfigurationResourceKeys(configResourceKeys); + String resourceId = "123"; String vnfType = "vnfType"; Service service = Mockito.mock(Service.class); @@ -2029,17 +2048,20 @@ public class BBInputSetupTest { doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust); ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class); doReturn(modelInfoNetwork ).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization); + executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); executeBB.getBuildingBlock().setIsVirtualLink(true); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(2)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); - executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString()); - executeBB.getBuildingBlock().setKey("modelCustId"); + + executeBB.getBuildingBlock().setBpmnFlowName("CreateNetworkBB"); + executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); + executeBB.getBuildingBlock().setIsVirtualLink(true); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, - executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service); + executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service); } @Test @@ -2167,6 +2189,12 @@ public class BBInputSetupTest { cloudConfiguration.setLcpCloudRegionId("cloudRegionId"); String requestAction = "unassignInstance"; + ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys(); + configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID"); + configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID"); + configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID"); + executeBB.setConfigurationResourceKeys(configResourceKeys); + L3Network network = new L3Network(); network.setNetworkId("networkId"); gBB.getServiceInstance().getNetworks().add(network); @@ -2241,13 +2269,14 @@ public class BBInputSetupTest { org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration(); aaiConfiguration.setModelCustomizationId("modelCustId"); doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId()); + doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class)); executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class), - any(Service.class)); + any(Service.class), isA(ConfigurationResourceKeys.class)); } @Test diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index aa883b67a2..eb74ab804e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -64,12 +64,13 @@ import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.db.request.RequestsDbClient; + import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java index 5e2275015b..2144f1c69a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java @@ -20,21 +20,27 @@ package org.onap.so.bpmn.servicedecomposition.tasks; +import static org.hamcrest.CoreMatchers.any; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.BaseTest; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.springframework.beans.factory.annotation.Autowired; @@ -76,8 +82,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest { @Test public void setRetryTimerExceptionTest() { expectedException.expect(BpmnError.class); - - executeBuildingBlockRainyDay.setRetryTimer(null); + DelegateExecution execution = mock(DelegateExecution.class); + when(execution.getVariable(eq("retryCount"))).thenThrow(Exception.class); + executeBuildingBlockRainyDay.setRetryTimer(execution); } @Test diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java index 3a4d6a0cc9..c8e1266b90 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/ResponseExceptionMapperImplTest.java @@ -44,7 +44,6 @@ import javax.ws.rs.core.Response.Status; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.so.BaseTest; - import junitparams.JUnitParamsRunner; import junitparams.Parameters; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java index 8d33a08c7a..6fad47d8bb 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerActionTest.java @@ -38,9 +38,8 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.appc.client.lcm.model.Action; import org.onap.appc.client.lcm.model.Status; -import org.onap.so.BaseTest; import org.onap.so.bpmn.appc.payload.PayloadClient; - +import org.onap.so.BaseTest; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java index 7fabb2ac0e..0aeb3a2a04 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerClientV2Test.java @@ -33,7 +33,6 @@ import org.onap.appc.client.lcm.model.ActionIdentifiers; import org.onap.appc.client.lcm.model.CheckLockInput; import org.onap.appc.client.lcm.model.Status; import org.onap.so.BaseTest; - import java.util.Properties; import java.util.UUID; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java index 5ef26b34ee..b388d8ba0a 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/appc/ApplicationControllerSupportTest.java @@ -25,9 +25,8 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.appc.client.lcm.model.Status; -import org.onap.so.BaseTest; import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory; - +import org.onap.so.BaseTest; import junitparams.JUnitParamsRunner; import junitparams.Parameters; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java index 35586cc29e..dbf2eb75fd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/DmaapPropertiesClientTest.java @@ -32,9 +32,9 @@ import java.io.IOException; import org.apache.http.HttpStatus; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.client.avpn.dmaap.beans.AVPNDmaapBean; import org.onap.so.client.exception.MapperException; +import org.onap.so.BaseTest; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java index 0992b59267..47e05831ad 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java @@ -34,7 +34,7 @@ public class GlobalDmaapPublisherTest extends BaseTest{ @Test public void testGetters() { assertEquals("dmaapUsername", globalDmaapPublisher.getUserName()); - assertEquals("dmaapPassword", globalDmaapPublisher.getPassword()); + assertEquals("ZG1hYXBQYXNzd29yZA==", globalDmaapPublisher.getPassword()); assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic()); assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get()); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index 9ada85fa38..d1013e7541 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -24,8 +24,8 @@ import static org.junit.Assert.assertEquals; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.mock.FileUtil; +import org.onap.so.BaseTest; public class ExceptionBuilderTest extends BaseTest { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java index 8231c2f529..08c92d33f0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/restproperties/ThreadedReadTest.java @@ -36,9 +36,9 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.client.RestPropertiesLoader; import org.onap.so.client.aai.AAIProperties; +import org.onap.so.BaseTest; public class ThreadedReadTest { @Test diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java new file mode 100644 index 0000000000..21035fcd4d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.test.categories; + +public interface SpringAware { + /* category marker */ +} diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json index 8cf6f6c3ab..6035c26cb7 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ServiceInstanceAAIInput.json @@ -9,12 +9,7 @@ "modelVersionId": null, "personaModelVersion": null, "widgetModelId": null, - "widgetModelVersion": null, - "bandwidthTotal": "bandwidthTotal", - "bandwidthUpWan1": "bandwidthUpWan1", - "bandwidthDownWan1": "bandwidthDownWan1", - "bandwidthUpWan2": "bandwidthUpWan2", - "bandwidthDownWan2": "bandwidthDownWan2", + "widgetModelVersion": null, "vhnPortalUrl": "vhnPortalUrl", "serviceInstanceLocationId": "serviceInstanceLocId", "resourceVersion": null, diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml index f039441738..236d435cb7 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml +++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml @@ -162,7 +162,7 @@ mso: global: dmaap: username: dmaapUsername - password: dmaapPassword + password: ZG1hYXBQYXNzd29yZA== host: http://localhost:${wiremock.server.port} publisher: topic: com.att.mso.asyncStatusUpdate diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml index d8f6ba3930..9088d1a844 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml +++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml @@ -25,6 +25,6 @@ <appender-ref ref="STDOUT" /> </root> - <logger name="wiremock.org" level="DEBUG" /> + <logger name="wiremock.org" level="ERROR" /> </configuration>
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index 151ba2c3aa..77e2fa27d3 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -201,5 +201,10 @@ <artifactId>so-bpmn-tasks</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>cxf-logging</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index ef72149d10..9ed36e5ba9 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -36,6 +36,7 @@ import javax.ws.rs.ext.Provider; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.bpmn.common.workflow.context.WorkflowContext; import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; @@ -110,7 +111,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { @PathParam("processKey") String processKey, VariableMapImpl variableMap){ Map<String, Object> inputVariables = getInputVariables(variableMap); try { - MDC.put(MsoLogger.REQUEST_ID, getRequestId(inputVariables)); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables)); processor.startProcess(processKey, variableMap); WorkflowResponse response = waitForResponse(getRequestId(inputVariables)); return Response.status(202).entity(response).build(); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index 8fe7ebe93a..62be1330b1 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -37,7 +37,9 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; import org.onap.so.logger.MsoLogger; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; +import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -85,6 +87,9 @@ public class CXFConfiguration { public Endpoint vnfAdapterCallback() { EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl); endpoint.publish("/VNFAdaptercallback"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } @@ -92,6 +97,9 @@ public class CXFConfiguration { public Endpoint sndcAdapterCallback() { EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl); endpoint.publish("/SDNCAdapterCallbackService"); + endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); + endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); + endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); return endpoint; } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index c263fe636c..db2304d6b7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -29,9 +29,7 @@ import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -52,9 +50,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EnableProcessApplication("MSO Infrastructure Application") @EnableAsync @ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) }) public class MSOInfrastructureApplication { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java index 9843a95342..884c2ac9c6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader; import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest; diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 8ebc80c4c2..9dadb8b623 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1487,7 +1487,7 @@ public abstract class WorkflowTest { for(Resource resource:resourceList){ resourceId = resource.getResourceId(); } - String homingList = getJsonValue(content, "solutionInfo.placement"); + String homingList = getJsonValue(content, "solutionInfo.placementInfo"); JSONArray placementArr = null; try { placementArr = new JSONArray(homingList); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java index 7cb649d66e..201e791a24 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java @@ -20,38 +20,25 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; + import java.io.IOException; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; -import org.onap.aai.domain.yang.Pnf; -import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; public class AaiConnectionTestImpl implements AaiConnection { - public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp"; - public static final String ID_WITH_IP_V6 = "idWithIpV6"; public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry"; - public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp"; - public static final String DEFAULT_IP = "1.2.3.4"; - public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329"; + public static final String ID_WITH_ENTRY = "idWithEntryNoIp"; private Map<String, Pnf> created = new HashMap<>(); @Override public Optional<Pnf> getEntryFor(String correlationId) throws IOException { - if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) { - Pnf pnf = new Pnf(); - pnf.setIpaddressV4Oam(DEFAULT_IP); - return Optional.of(pnf); - } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) { - Pnf pnf = new Pnf(); - pnf.setIpaddressV6Oam(DEFAULT_IP_V6); - return Optional.of(pnf); - } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) { + if (Objects.equals(correlationId, ID_WITH_ENTRY)) { return Optional.of(new Pnf()); } else { return Optional.empty(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index b514c38d47..2348af5dec 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -7,9 +7,9 @@ * 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. @@ -18,33 +18,27 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.bpmn.infrastructure.pnf.delegate.bpmn; +package org.onap.so.bpmn.infrastructure.pnf.delegate; -import static org.assertj.core.api.Assertions.assertThat; -import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import org.assertj.core.api.Assertions; import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.history.HistoricVariableInstance; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.test.Deployment; import org.camunda.bpm.engine.test.ProcessEngineRule; +import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl; -import org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import java.util.HashMap; +import java.util.Map; + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; + @RunWith(SpringRunner.class) @ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml") public class CreateAndActivatePnfResourceTest { @@ -65,47 +59,25 @@ public class CreateAndActivatePnfResourceTest { @Test @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) - public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception { + public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() { // given aaiConnection.reset(); BpmnAwareTests.init(processEngineRule.getProcessEngine()); Map<String, Object> variables = new HashMap<>(); variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); - variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP); - // when - ProcessInstance instance = runtimeService - .startProcessInstanceByKey("CreateAndActivatePnfResource", variables); - // then - assertThat(instance).isEnded().hasPassedInOrder( - "CreateAndActivatePnf_StartEvent", - "CheckAiiForCorrelationId", - "DoesAaiContainInfoAboutPnf", - "DoesAaiContainInfoAboutIp", - "AaiEntryAlreadyUpToDate" - ); - } - - @Test - @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) - public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception { - // given - aaiConnection.reset(); - BpmnAwareTests.init(processEngineRule.getProcessEngine()); - Map<String, Object> variables = new HashMap<>(); - variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); - variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP); + variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); - assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); + BpmnAwareAssertions.assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); dmaapClientTestImpl.sendMessage(); // then - assertThat(instance).isEnded().hasPassedInOrder( + BpmnAwareAssertions.assertThat(instance).isEnded().hasPassedInOrder( "CreateAndActivatePnf_StartEvent", + "CheckInputs", "CheckAiiForCorrelationId", "DoesAaiContainInfoAboutPnf", - "DoesAaiContainInfoAboutIp", "AaiEntryExists", "InformDmaapClient", "WaitForDmaapPnfReadyNotification", @@ -115,22 +87,23 @@ public class CreateAndActivatePnfResourceTest { @Test @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"}) - public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception { + public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() { // given aaiConnection.reset(); BpmnAwareTests.init(processEngineRule.getProcessEngine()); Map<String, Object> variables = new HashMap<>(); variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S); - variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY); + variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY); // when ProcessInstance instance = runtimeService .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables); - assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); + BpmnAwareAssertions.assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage"); dmaapClientTestImpl.sendMessage(); // then - assertThat(instance).isEnded().hasPassedInOrder( + BpmnAwareAssertions.assertThat(instance).isEnded().hasPassedInOrder( "CreateAndActivatePnf_StartEvent", + "CheckInputs", "CheckAiiForCorrelationId", "DoesAaiContainInfoAboutPnf", "CreateAndActivatePnf_CreateAaiEntry", @@ -139,11 +112,6 @@ public class CreateAndActivatePnfResourceTest { "WaitForDmaapPnfReadyNotification", "AaiEntryUpdated" ); - assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY); - } - - private List<HistoricVariableInstance> getVariables(ProcessInstance instance) { - return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery() - .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list(); + Assertions.assertThat(aaiConnection.getCreated()).containsOnlyKeys(AaiConnectionTestImpl.ID_WITHOUT_ENTRY); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index f2a4205ebd..09fb2d4cd7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; + import java.util.Objects; public class DmaapClientTestImpl implements DmaapClient { diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 9f004afe89..9368be1575 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -90,6 +90,11 @@ <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <optional>true</optional> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigurationScaleOutBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigurationScaleOutBB.bpmn new file mode 100644 index 0000000000..98a604951f --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ConfigurationScaleOutBB.bpmn @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0ky0lyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="ConfigurationScaleOutBB" name="ConfigurationScaleOutBB" isExecutable="true"> + <bpmn:startEvent id="Start_ConfigScaleOutBB" name="Start"> + <bpmn:outgoing>SequenceFlow_06ab7wm</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="QueryVfModule" name="Query VF Module (SDNC)" camunda:expression="${SDNCQueryTasks.queryVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_06ab7wm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_149xlbu</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_06ab7wm" sourceRef="Start_ConfigScaleOutBB" targetRef="QueryVfModule" /> + <bpmn:endEvent id="End_ConfigScaleOutBB" name="End"> + <bpmn:incoming>SequenceFlow_12srn62</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_12srn62" sourceRef="Call-AppC-ConfigScaleOut" targetRef="End_ConfigScaleOutBB" /> + <bpmn:sequenceFlow id="SequenceFlow_149xlbu" sourceRef="QueryVfModule" targetRef="GetConfigScaleOutParams" /> + <bpmn:sequenceFlow id="SequenceFlow_1juznaa" sourceRef="GetConfigScaleOutParams" targetRef="Call-AppC-ConfigScaleOut" /> + <bpmn:serviceTask id="GetConfigScaleOutParams" name="Get Config Scale Out Params" camunda:expression="${ConfigurationScaleOut.setParamsForConfigurationScaleOut(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_149xlbu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1juznaa</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Call-AppC-ConfigScaleOut" name="Call APP-C For Configuration Scale Out " camunda:expression="${ConfigurationScaleOut.callAppcClient(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1juznaa</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_12srn62</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfigurationScaleOutBB"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ConfigScaleOutBB"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="145" width="25" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1juzqvs_di" bpmnElement="QueryVfModule"> + <dc:Bounds x="261" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_06ab7wm_di" bpmnElement="SequenceFlow_06ab7wm"> + <di:waypoint xsi:type="dc:Point" x="209" y="120" /> + <di:waypoint xsi:type="dc:Point" x="261" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_07e01q3_di" bpmnElement="End_ConfigScaleOutBB"> + <dc:Bounds x="694" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="702" y="145" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_12srn62_di" bpmnElement="SequenceFlow_12srn62"> + <di:waypoint xsi:type="dc:Point" x="653" y="120" /> + <di:waypoint xsi:type="dc:Point" x="694" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_149xlbu_di" bpmnElement="SequenceFlow_149xlbu"> + <di:waypoint xsi:type="dc:Point" x="361" y="120" /> + <di:waypoint xsi:type="dc:Point" x="406" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1juznaa_di" bpmnElement="SequenceFlow_1juznaa"> + <di:waypoint xsi:type="dc:Point" x="506" y="120" /> + <di:waypoint xsi:type="dc:Point" x="553" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1jq0gvz_di" bpmnElement="GetConfigScaleOutParams"> + <dc:Bounds x="406" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1778mx4_di" bpmnElement="Call-AppC-ConfigScaleOut"> + <dc:Bounds x="553" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java index 314cc0b2de..d1559c2ed1 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java @@ -20,14 +20,8 @@ package org.onap.so; -import java.io.IOException; - -import javax.annotation.PreDestroy; - import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @@ -35,15 +29,11 @@ import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.Profile; -import ch.vorburger.mariadb4j.MariaDB4jService; - @SpringBootApplication @Profile("test") @EnableProcessApplication("MSO CommonBPMN Test Application") @ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class TestApplication { public static void main(String... args) { SpringApplication.run(TestApplication.class, args); diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java index 21b6dd402b..e8891eeb53 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java @@ -49,6 +49,7 @@ import org.onap.so.bpmn.infrastructure.adapter.vnf.tasks.VnfAdapterImpl; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.ConfigurationScaleOut; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetwork; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollection; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.GenericVnfHealthCheck; @@ -186,6 +187,9 @@ public abstract class BaseBPMNTest { @MockBean protected GenericVnfHealthCheck genericVnfHealthCheck; + @MockBean + protected ConfigurationScaleOut configurationScaleOut; + @LocalServerPort private int port; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java index c05d42c420..d4496d3a55 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2BBTest.java @@ -28,9 +28,9 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.junit.Ignore; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.bpmn.buildingblock.SniroHomingV2; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.BaseTest; import org.springframework.boot.test.mock.mockito.MockBean; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java index bed591500a..4626615e6f 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/buildingblock/SniroHomingV2Test.java @@ -41,7 +41,6 @@ import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; -import org.onap.so.BaseTest; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -55,7 +54,7 @@ import org.onap.so.bpmn.servicedecomposition.homingobjects.Candidate; import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.sniro.beans.SniroManagerRequest; - +import org.onap.so.BaseTest; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java new file mode 100644 index 0000000000..b22b90b0b4 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.bpmn.subprocess; + +import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doThrow; + +import java.io.IOException; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.runtime.ProcessInstance; + +import org.junit.Test; +import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; + + + +public class ConfigurationScaleOutBBTest extends BaseBPMNTest { + + @Test + public void sunnyDayConfigurationScaleOutBBTest() throws InterruptedException, IOException { + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted().hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule", "GetConfigScaleOutParams", + "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); + assertThat(pi).isEnded(); + } + + @Test + public void configurationScaleOutBBExceptionTest() throws Exception { + doThrow(new BpmnError("7000", "TESTING ERRORS")).when(sdncQueryTasks).queryVfModule(any(BuildingBlockExecution.class)); + ProcessInstance pi = runtimeService.startProcessInstanceByKey("ConfigurationScaleOutBB", variables); + assertThat(pi).isNotNull(); + assertThat(pi).isStarted() + .hasPassedInOrder("Start_ConfigScaleOutBB", "QueryVfModule") + .hasNotPassed("GetConfigScaleOutParams", "Call-AppC-ConfigScaleOut", "End_ConfigScaleOutBB"); + assertThat(pi).isEnded(); + } +} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java index 1c882e85d1..9553f72644 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.bpmn.subprocess; import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 9bc9cc59a6..ad51b3f69e 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -317,5 +317,11 @@ <classifier>tests</classifier> <scope>test</scope> </dependency> + <dependency> + <groupId>org.camunda.bpm.springboot</groupId> + <artifactId>camunda-bpm-spring-boot-starter-test</artifactId> + <version>2.3.0</version> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index f11022dc08..ec8df3daa1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License") + * 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 * diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 63fd20eb2d..37c7d4d29a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License") + * 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 * diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy index d571c00f47..3d8b2571aa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License") + * 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 * diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy index df4698de9d..1585a7bb74 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -260,7 +260,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { if(resourceClient.exists(uri)){ Map<String, String> keys = uri.getURIKeys() - execution.setVariable("globalCustomer", keys.get("global-customer-id")) + execution.setVariable("globalCustomerId", keys.get("global-customer-id")) execution.setVariable("serviceType", keys.get("service-type")) execution.setVariable("GENGS_siResourceLink", uri.build().toString()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java index 63db293a2e..12ddf8465e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java @@ -67,7 +67,6 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate { AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection); execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf()); - execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp()); } catch (IOException e) { LOGGER.error("IOException",e); new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage()); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java index e4866f5334..e4866f5334 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java index fd844648fa..b13d7fc419 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java @@ -29,13 +29,10 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResour import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder; import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity; -import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity; import org.onap.so.db.request.beans.ResourceOperationStatus; import org.onap.so.db.request.beans.ResourceOperationStatusId; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; import org.onap.so.logger.MsoLogger; import org.onap.so.requestsdb.RequestsDbConstant; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java index 5bd3297c20..8bc9dce966 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java @@ -24,9 +24,6 @@ import org.apache.commons.lang3.StringUtils; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.core.BaseTask; import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.db.request.beans.ResourceOperationStatusId; -import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java new file mode 100644 index 0000000000..201e791a24 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +public class AaiConnectionTestImpl implements AaiConnection { + + public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry"; + public static final String ID_WITH_ENTRY = "idWithEntryNoIp"; + + private Map<String, Pnf> created = new HashMap<>(); + + @Override + public Optional<Pnf> getEntryFor(String correlationId) throws IOException { + if (Objects.equals(correlationId, ID_WITH_ENTRY)) { + return Optional.of(new Pnf()); + } else { + return Optional.empty(); + } + } + + @Override + public void createEntry(String correlationId, Pnf entry) throws IOException { + created.put(correlationId, entry); + } + + public Map<String, Pnf> getCreated() { + return created; + } + + public void reset() { + created.clear(); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java index 7df6757817..7df6757817 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index 4282b0f2bb..4282b0f2bb 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java index 627e57bfb8..3eb3bd8796 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java @@ -27,10 +27,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; @@ -41,9 +38,6 @@ import org.junit.Test; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; import org.onap.so.bpmn.core.WorkflowException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; @RunWith(Enclosed.class) public class CheckAaiForCorrelationIdDelegateTest { @@ -81,36 +75,14 @@ public class CheckAaiForCorrelationIdDelegateTest { } @Test - public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception { - shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP); - } - - @Test - public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception { - shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6); - } - - private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception { - // given - DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(id); - // when - delegate.execute(execution); - // then - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true); - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true); - } - - @Test public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); + when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); // when delegate.execute(execution); // then verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true); - verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false); } } @@ -128,7 +100,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP); + when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); // when, then assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java index 465dc085fc..465dc085fc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java new file mode 100644 index 0000000000..f2a4205ebd --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient; +import java.util.Objects; + +public class DmaapClientTestImpl implements DmaapClient { + + private String correlationId; + private Runnable informConsumer; + + @Override + public void registerForUpdate(String correlationId, Runnable informConsumer) { + this.correlationId = correlationId; + this.informConsumer = informConsumer; + } + + @Override + public Runnable unregister(String correlationId) { + if (Objects.equals(this.correlationId, correlationId)) { + this.correlationId = null; + Runnable informConsumer = this.informConsumer; + this.informConsumer = null; + return informConsumer; + } + return null; + } + + public String getCorrelationId() { + return correlationId; + } + + public Runnable getInformConsumer() { + return informConsumer; + } + + public void sendMessage() { + informConsumer.run(); + } + + public boolean haveRegisteredConsumer() { + return correlationId != null; + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index ddf33a1d77..ddf33a1d77 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index aab289fd90..aab289fd90 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 08ac9b6948..08ac9b6948 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn index 8f2bf67b71..89d66bfdb6 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2"> <bpmn:collaboration id="Collaboration_1d0w8lf"> <bpmn:participant id="Participant_1egg397" name="SO Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" /> <bpmn:participant id="Participant_0atuyq0" name="AAI" /> @@ -23,56 +23,50 @@ <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" /> <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckInputs" /> <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="CancelDmaapClientSubscription" targetRef="ThrowTimeoutException" /> - <bpmn:sequenceFlow id="SequenceFlow_1ls8pua" name="No" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryExists"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutIp}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="DoesAaiContainInfoAboutIp"> + <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="AaiEntryExists"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1h6yz62" name="Yes" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryAlreadyUpToDate"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutIp}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated"> - <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming> - </bpmn:endEvent> - <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception"> - <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming> - <bpmn:errorEventDefinition errorRef="Error_1" /> - </bpmn:endEvent> - <bpmn:endEvent id="AaiEntryAlreadyUpToDate" name="AAI entry already up-to-date"> - <bpmn:incoming>SequenceFlow_1h6yz62</bpmn:incoming> - </bpmn:endEvent> - <bpmn:startEvent id="CreateAndActivatePnf_StartEvent"> - <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing> - </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" /> - <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}"> - <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing> + <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}"> + <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?"> - <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing> - </bpmn:exclusiveGateway> + <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${cancelDmaapSubscription}"> + <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}"> + <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists"> + <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> + </bpmn:intermediateThrowEvent> <bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${createAaiEntryWithPnfIdDelegate}"> <bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutIp" name="Does AAI contain info about IPv4 or IPv6?"> - <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1h6yz62</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1ls8pua</bpmn:outgoing> + <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?"> + <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists, lacking IP"> - <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1ls8pua</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing> - </bpmn:intermediateThrowEvent> - <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}"> - <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing> + <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}"> + <bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:startEvent id="CreateAndActivatePnf_StartEvent"> + <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception"> + <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_1" /> + </bpmn:endEvent> + <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated"> + <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming> + </bpmn:endEvent> <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo"> <bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing> @@ -83,21 +77,13 @@ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:boundaryEvent> - <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${cancelDmaapSubscription}"> - <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}"> - <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing> - </bpmn:serviceTask> + <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" /> <bpmn:textAnnotation id="TextAnnotation_1eyzes8"> - <bpmn:text><![CDATA[Inputs: + <bpmn:text>Inputs: Â -Â timeoutForPnfEntryNotification - String - correlationId - String -]]></bpmn:text> +</bpmn:text> </bpmn:textAnnotation> - <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" /> </bpmn:process> <bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmn:message id="Message_13h1tlo" name="WorkflowMessage" /> @@ -109,19 +95,13 @@ <bpmndi:BPMNShape id="ExclusiveGateway_1cttgdo_di" bpmnElement="DoesAaiContainInfoAboutPnf" isMarkerVisible="true"> <dc:Bounds x="390" y="182" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="372" y="283" width="85" height="20" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0yamdfm_di" bpmnElement="DoesAaiContainInfoAboutIp" isMarkerVisible="true"> - <dc:Bounds x="682" y="41" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="663" y="5" width="87" height="30" /> + <dc:Bounds x="372" y="283" width="85" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated"> <dc:Bounds x="1312" y="189" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1286" y="230" width="89" height="10" /> + <dc:Bounds x="1287" y="230" width="88" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent"> @@ -137,51 +117,38 @@ <dc:Bounds x="511" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt"> - <di:waypoint xsi:type="dc:Point" x="319" y="207" /> - <di:waypoint xsi:type="dc:Point" x="390" y="207" /> + <di:waypoint x="319" y="207" /> + <di:waypoint x="390" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="309.5" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak"> - <di:waypoint xsi:type="dc:Point" x="415" y="207" /> - <di:waypoint xsi:type="dc:Point" x="415" y="66" /> - <di:waypoint xsi:type="dc:Point" x="682" y="66" /> + <di:waypoint x="415" y="207" /> + <di:waypoint x="415" y="66" /> + <di:waypoint x="707" y="66" /> + <di:waypoint x="707" y="189" /> <bpmndi:BPMNLabel> - <dc:Bounds x="430" y="180.1206896551724" width="19" height="10" /> + <dc:Bounds x="430" y="180" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe"> - <di:waypoint xsi:type="dc:Point" x="440" y="207" /> - <di:waypoint xsi:type="dc:Point" x="511" y="207" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="447.32911392405055" y="210" width="15" height="10" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1h6yz62_di" bpmnElement="SequenceFlow_1h6yz62"> - <di:waypoint xsi:type="dc:Point" x="732" y="66" /> - <di:waypoint xsi:type="dc:Point" x="1312" y="66" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="742.7435064935065" y="51" width="19" height="10" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ls8pua_di" bpmnElement="SequenceFlow_1ls8pua"> - <di:waypoint xsi:type="dc:Point" x="707" y="91" /> - <di:waypoint xsi:type="dc:Point" x="707" y="189" /> + <di:waypoint x="440" y="207" /> + <di:waypoint x="511" y="207" /> <bpmndi:BPMNLabel> - <dc:Bounds x="717" y="116.1917808219178" width="15" height="10" /> + <dc:Bounds x="448" y="210" width="14" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf"> - <di:waypoint xsi:type="dc:Point" x="611" y="207" /> - <di:waypoint xsi:type="dc:Point" x="689" y="207" /> + <di:waypoint x="611" y="207" /> + <di:waypoint x="689" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="605" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1"> - <di:waypoint xsi:type="dc:Point" x="-18" y="207" /> - <di:waypoint xsi:type="dc:Point" x="48" y="207" /> + <di:waypoint x="-18" y="207" /> + <di:waypoint x="48" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="-30" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> @@ -190,22 +157,22 @@ <dc:Bounds x="123" y="523" width="502" height="60" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88"> - <di:waypoint xsi:type="dc:Point" x="561" y="247" /> - <di:waypoint xsi:type="dc:Point" x="561" y="523" /> + <di:waypoint x="561" y="247" /> + <di:waypoint x="561" y="523" /> <bpmndi:BPMNLabel> <dc:Bounds x="531" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a"> - <di:waypoint xsi:type="dc:Point" x="250" y="247" /> - <di:waypoint xsi:type="dc:Point" x="250" y="523" /> + <di:waypoint x="250" y="247" /> + <di:waypoint x="250" y="523" /> <bpmndi:BPMNLabel> <dc:Bounds x="220" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t"> - <di:waypoint xsi:type="dc:Point" x="289" y="523" /> - <di:waypoint xsi:type="dc:Point" x="289" y="247" /> + <di:waypoint x="289" y="523" /> + <di:waypoint x="289" y="247" /> <bpmndi:BPMNLabel> <dc:Bounds x="259" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> @@ -216,76 +183,70 @@ <bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException"> <dc:Bounds x="1312" y="345" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1305" y="382" width="70" height="20" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_00cy7r0_di" bpmnElement="AaiEntryAlreadyUpToDate"> - <dc:Bounds x="1312" y="48" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1288" y="89" width="85" height="20" /> + <dc:Bounds x="1305" y="382" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0fjcdy4_di" bpmnElement="AaiEntryExists"> <dc:Bounds x="689" y="189" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="670" y="235" width="80" height="20" /> + <dc:Bounds x="672" y="235" width="77" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8"> <dc:Bounds x="-37" y="70" width="243" height="54" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz"> - <di:waypoint xsi:type="dc:Point" x="-36" y="189" /> - <di:waypoint xsi:type="dc:Point" x="-36" y="124" /> + <di:waypoint x="-36" y="189" /> + <di:waypoint x="-36" y="124" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d"> - <di:waypoint xsi:type="dc:Point" x="1026" y="523" /> - <di:waypoint xsi:type="dc:Point" x="1026" y="247" /> + <di:waypoint x="1060" y="523" /> + <di:waypoint x="1060" y="247" /> <bpmndi:BPMNLabel> <dc:Bounds x="996" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025"> - <di:waypoint xsi:type="dc:Point" x="725" y="207" /> - <di:waypoint xsi:type="dc:Point" x="803" y="207" /> + <di:waypoint x="725" y="207" /> + <di:waypoint x="803" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="719" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout"> - <dc:Bounds x="1040" y="229" width="36" height="36" /> + <dc:Bounds x="1074" y="229" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1071" y="260" width="40" height="10" /> + <dc:Bounds x="1117" y="240" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc"> - <di:waypoint xsi:type="dc:Point" x="1058" y="265" /> - <di:waypoint xsi:type="dc:Point" x="1058" y="363" /> - <di:waypoint xsi:type="dc:Point" x="1145" y="363" /> + <di:waypoint x="1092" y="265" /> + <di:waypoint x="1092" y="363" /> + <di:waypoint x="1145" y="363" /> <bpmndi:BPMNLabel> <dc:Bounds x="1028" y="309" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification"> - <dc:Bounds x="974" y="167" width="100" height="80" /> + <dc:Bounds x="1008" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm"> - <di:waypoint xsi:type="dc:Point" x="1074" y="207" /> - <di:waypoint xsi:type="dc:Point" x="1312" y="207" /> + <di:waypoint x="1108" y="207" /> + <di:waypoint x="1312" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="1148" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1o8od8e_di" bpmnElement="SequenceFlow_1o8od8e"> - <di:waypoint xsi:type="dc:Point" x="903" y="207" /> - <di:waypoint xsi:type="dc:Point" x="974" y="207" /> + <di:waypoint x="903" y="207" /> + <di:waypoint x="1008" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="893.5" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_0tg4hw9_di" bpmnElement="MessageFlow_0tg4hw9"> - <di:waypoint xsi:type="dc:Point" x="853" y="247" /> - <di:waypoint xsi:type="dc:Point" x="853" y="523" /> + <di:waypoint x="853" y="247" /> + <di:waypoint x="853" y="523" /> <bpmndi:BPMNLabel> <dc:Bounds x="823" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> @@ -294,15 +255,15 @@ <dc:Bounds x="803" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe"> - <di:waypoint xsi:type="dc:Point" x="1245" y="363" /> - <di:waypoint xsi:type="dc:Point" x="1312" y="363" /> + <di:waypoint x="1245" y="363" /> + <di:waypoint x="1312" y="363" /> <bpmndi:BPMNLabel> <dc:Bounds x="1233.5" y="343" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr"> - <di:waypoint xsi:type="dc:Point" x="1195" y="403" /> - <di:waypoint xsi:type="dc:Point" x="1195" y="523" /> + <di:waypoint x="1195" y="403" /> + <di:waypoint x="1195" y="523" /> <bpmndi:BPMNLabel> <dc:Bounds x="1165" y="458" width="90" height="10" /> </bpmndi:BPMNLabel> @@ -311,8 +272,8 @@ <dc:Bounds x="1145" y="323" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0967g8p_di" bpmnElement="SequenceFlow_0967g8p"> - <di:waypoint xsi:type="dc:Point" x="148" y="207" /> - <di:waypoint xsi:type="dc:Point" x="219" y="207" /> + <di:waypoint x="148" y="207" /> + <di:waypoint x="219" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="183.5" y="187" width="0" height="10" /> </bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn index 515a9bb85a..3b49011c3e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -98,7 +98,6 @@ ex.processJavaException(execution)]]></bpmn2:script> <camunda:out source="WorkflowException" target="WorkflowException" /> <camunda:out source="serviceInstanceName" target="serviceInstanceName" /> <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> - <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> <camunda:in source="productFamilyId" target="productFamilyId" /> <camunda:in source="sdncVersion" target="sdncVersion" /> <camunda:in source="bpmnRequest" target="requestJson" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java index 314cc0b2de..f9962c2630 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java @@ -20,14 +20,8 @@ package org.onap.so; -import java.io.IOException; - -import javax.annotation.PreDestroy; - import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @@ -35,15 +29,11 @@ import org.springframework.context.annotation.ComponentScan.Filter; import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.Profile; -import ch.vorburger.mariadb4j.MariaDB4jService; - @SpringBootApplication @Profile("test") @EnableProcessApplication("MSO CommonBPMN Test Application") @ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) }) public class TestApplication { public static void main(String... args) { SpringApplication.run(TestApplication.class, args); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index e534142471..887c51e179 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; @@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; @@ -74,6 +76,8 @@ public class AAICreateTasks { private AAINetworkResources aaiNetworkResources; @Autowired private AAIVpnBindingResources aaiVpnBindingResources; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void createServiceInstance(BuildingBlockExecution execution) { try { @@ -376,4 +380,13 @@ public class AAICreateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + + public void createConfiguration(BuildingBlockExecution execution){ + try{ + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.createConfiguration(configuration); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index cb265b6e41..a00806a19c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -31,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; @@ -56,6 +58,8 @@ public class AAIDeleteTasks { private AAINetworkResources aaiNetworkResources; @Autowired private AAIVolumeGroupResources aaiVolumeGroupResources; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void deleteVfModule(BuildingBlockExecution execution) throws Exception { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); @@ -133,4 +137,12 @@ public class AAIDeleteTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void deleteConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.deleteConfiguration(configuration); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index b059a77641..58c51f6223 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -24,6 +24,7 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -35,6 +36,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; @@ -64,6 +66,8 @@ public class AAIUpdateTasks { private AAINetworkResources aaiNetworkResources; @Autowired private AAICollectionResources aaiCollectionResources; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) { try { @@ -394,4 +398,21 @@ public class AAIUpdateTasks { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) { + try { + Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID)); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java new file mode 100644 index 0000000000..d13c5db871 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload; +import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.appc.ApplicationControllerAction; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.jayway.jsonpath.JsonPath; + +@Component +public class ConfigurationScaleOut { + + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfigurationScaleOut.class); + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private CatalogDbClient catalogDbClient; + @Autowired + private ApplicationControllerAction appCClient; + private static final String ACTION = "action"; + private static final String MSO_REQUEST_ID = "msoRequestId"; + private static final String VNF_ID = "vnfId"; + private static final String VNF_NAME = "vnfName"; + private static final String VFMODULE_ID = "vfModuleId"; + private static final String CONTROLLER_TYPE = "controllerType"; + private static final String PAYLOAD = "payload"; + + public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) { + + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + try { + List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters(); + String key = null; + String paramValue = null; + ObjectMapper mapper = new ObjectMapper(); + String configScaleOutPayloadString = null; + ControllerSelectionReference controllerSelectionReference; + ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload(); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + String vnfId = vnf.getVnfId(); + String vnfName = vnf.getVnfName(); + String vnfType = vnf.getVnfType(); + String actionCategory = Action.ConfigScaleOut.toString(); + controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory); + String controllerName = controllerSelectionReference.getControllerName(); + + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId()); + + Map<String, String> paramsMap = new HashMap<>(); + RequestParametersConfigScaleOut requestParameters = new RequestParametersConfigScaleOut(); + String configScaleOutParam = null; + if (jsonPathForCfgParams != null) { + for (Map<String, String> param : jsonPathForCfgParams) { + for (Map.Entry<String,String> entry : param.entrySet()) { + key = entry.getKey(); + paramValue = entry.getValue(); + configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue); + if(configScaleOutParam != null){ + paramsMap.put(key, configScaleOutParam); + } + } + } + } + requestParameters.setVfModuleId(vfModule.getVfModuleId()); + requestParameters.setVnfHostIpAddress(vnf.getIpv4OamAddress()); + configPayload.setConfigurationParameters(paramsMap); + configPayload.setRequestParameters(requestParameters); + configScaleOutPayloadString = mapper.writeValueAsString(configPayload); + configScaleOutPayloadString = configScaleOutPayloadString.replaceAll("\"", "\\\\\""); + + execution.setVariable(ACTION, actionCategory); + execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId()); + execution.setVariable(VNF_ID, vnfId); + execution.setVariable(VNF_NAME, vnfName); + execution.setVariable(VFMODULE_ID, vfModule.getVfModuleId()); + execution.setVariable(CONTROLLER_TYPE, controllerName); + execution.setVariable(PAYLOAD, configScaleOutPayloadString); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void callAppcClient(BuildingBlockExecution execution) { + try{ + Action commandAction = Action.valueOf(execution.getVariable(ACTION)); + String msoRequestId = execution.getVariable(MSO_REQUEST_ID); + String vnfId = execution.getVariable(VNF_ID); + Optional<String> payloadString = null; + if(execution.getVariable(PAYLOAD) != null){ + String pay = execution.getVariable(PAYLOAD); + payloadString = Optional.of(pay); + } + String controllerType = execution.getVariable(CONTROLLER_TYPE); + HashMap<String, String> payloadInfo = new HashMap<>(); + payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME)); + payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID)); + //PayloadInfo contains extra information that adds on to payload before making request to appc + appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType); + }catch(Exception ex){ + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index b2b071e1ee..57d097e87a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -27,6 +27,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import java.util.UUID; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -36,21 +37,26 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; -import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.client.CatalogDbClient; @@ -103,6 +109,8 @@ public class WorkflowAction { private ExceptionBuilder exceptionBuilder; @Autowired private CatalogDbClient catalogDbClient; + @Autowired + private AAIConfigurationResources aaiConfigurationResources; public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -125,7 +133,6 @@ public class WorkflowAction { WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); List<Resource> resourceCounter = new ArrayList<>(); - execution.setVariable("sentSyncResponse", false); execution.setVariable("homing", false); execution.setVariable("calledHoming", false); @@ -212,7 +219,8 @@ public class WorkflowAction { } else if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase("activateInstance") || requestAction.equalsIgnoreCase("unassignInstance") - || requestAction.equalsIgnoreCase("deleteInstance"))) { + || requestAction.equalsIgnoreCase("deleteInstance") + || requestAction.equalsIgnoreCase("activateFabricConfiguration"))) { // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and // SERVICE-MACRO-DELETE // Will never get user params with service, macro will have @@ -230,7 +238,7 @@ public class WorkflowAction { foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " "; } msoLogger.info("Found " + foundObjects); - + if (orchFlows == null || orchFlows.isEmpty()) { orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte); } @@ -267,7 +275,6 @@ public class WorkflowAction { execution.setVariable("flowsToExecute", flowsToExecute); } catch (Exception ex) { - msoLogger.error(ex); buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex); } } @@ -278,7 +285,7 @@ public class WorkflowAction { if(resource.isBaseVfModule()){ Collections.swap(vfModuleResources, 0, count); break; - } + } count++; } return vfModuleResources; @@ -294,7 +301,7 @@ public class WorkflowAction { List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()); for(int i = 0; i < resources.size(); i++){ updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null); - } + } }); } @@ -317,7 +324,7 @@ public class WorkflowAction { .collect(Collectors.toList()).get(i); updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); } }); - } + } protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){ String resourceId = id; @@ -337,6 +344,8 @@ public class WorkflowAction { workflowResourceIds.setNetworkId(resourceId); }else if(resource == WorkflowType.NETWORKCOLLECTION){ workflowResourceIds.setNetworkCollectionId(resourceId); + }else if(resource == WorkflowType.CONFIGURATION){ + workflowResourceIds.setConfigurationId(resourceId); } ebb.setWorkflowResourceIds(workflowResourceIds); } @@ -389,7 +398,7 @@ public class WorkflowAction { String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType(); if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) { int minNetworks = 0; - InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); + org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup(); CollectionResourceInstanceGroupCustomization collectionInstCust = null; if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) { for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) { @@ -418,14 +427,14 @@ public class WorkflowAction { } } } else { - msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType); + } + }else{ + msoLogger.debug("No Instance Group found for network collection."); } }else{ - msoLogger.debug("No Instance Group found for network collection."); + msoLogger.debug("No Network Collection found. collectionResource is null"); } - }else{ - msoLogger.debug("No Network Collection found. collectionResource is null"); - } } else { msoLogger.debug("No Network Collection Customization found"); } @@ -484,6 +493,20 @@ public class WorkflowAction { aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId())); resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false)); } + if (serviceInstanceMSO.getConfigurations() !=null) { + for(Configuration config : serviceInstanceMSO.getConfigurations()){ + Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId()); + if(aaiConfig.isPresent() && aaiConfig.get().getRelationshipList()!=null){ + for(Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()){ + if(relationship.getRelatedTo().contains("vnfc")){ + aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.getConfigurationId())); + resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config.getConfigurationId(),false)); + break; + } + } + } + } + } } catch (Exception ex) { buildAndThrowException(execution, "Could not find existing Service Instance or related Instances to execute the request on."); @@ -495,6 +518,8 @@ public class WorkflowAction { throws IOException { boolean foundRelated = false; boolean foundVfModuleOrVG = false; + String vnfCustomizationUUID = ""; + String vfModuleCustomizationUUID = ""; if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); for (Map<String, Object> params : userParams) { @@ -507,18 +532,23 @@ public class WorkflowAction { for (Vnfs vnf : validate.getResources().getVnfs()) { resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getModelInfo().getModelCustomizationId(),false)); foundRelated = true; + if(vnf.getModelInfo()!=null && vnf.getModelInfo().getModelCustomizationUuid()!=null){ + vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid(); + } if (vnf.getVfModules() != null) { for (VfModules vfModule : vnf.getVfModules()) { VfModuleCustomization vfModuleCustomization = catalogDbClient .getVfModuleCustomizationByModelCuztomizationUUID( vfModule.getModelInfo().getModelCustomizationUuid()); if (vfModuleCustomization != null) { - if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate()!=null &&vfModuleCustomization.getVolumeHeatEnv() != null) { + + if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) { resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false)); foundRelated = true; foundVfModuleOrVG = true; } - if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getModuleHeatTemplate()!=null && vfModuleCustomization.getHeatEnvironment()!=null){ + + if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null){ foundRelated = true; foundVfModuleOrVG = true; Resource resource = new Resource(WorkflowType.VFMODULE,vfModuleCustomization.getModelCustomizationUUID(),false); @@ -528,6 +558,15 @@ public class WorkflowAction { resource.setBaseVfModule(false); } resourceCounter.add(resource); + if(vfModule.getModelInfo()!=null && vfModule.getModelInfo().getModelCustomizationUuid()!=null){ + vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid(); + } + if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){ + List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID); + for(String config : configs){ + resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config,false)); + } + } } if(!foundVfModuleOrVG){ buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); @@ -556,6 +595,25 @@ public class WorkflowAction { } return foundRelated; } + + + private List<String> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) { + List<String> configurations = new ArrayList<>(); + try{ + List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID); + for(CvnfcCustomization cvnfc : cvnfcCustomizations){ + for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){ + if(customization.getConfigurationResource().getToscaNodeType().contains("FabricConfiguration")){ + configurations.add(customization.getConfigurationResource().getModelUUID()); + } + } + } + msoLogger.debug("found " + configurations.size() + " configurations"); + return configurations; + } catch (Exception ex){ + return configurations; + } + } protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, ServiceInstancesRequest sIRequest) { org.onap.so.db.catalog.beans.Service service = catalogDbClient @@ -664,7 +722,6 @@ public class WorkflowAction { } return generatedResourceId; } catch (Exception ex) { - msoLogger.error(ex); throw new IllegalStateException( "WorkflowAction was unable to verify if the instance name already exist in AAI."); } @@ -810,7 +867,7 @@ public class WorkflowAction { .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } - } else { + }else { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); } @@ -852,24 +909,24 @@ public class WorkflowAction { buildAndThrowException(execution,"The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API."); } } else { - if(northBoundRequest.getIsToplevelflow()!=null){ - execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow()); - } - List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList(); - if (flows == null) - flows = new ArrayList<>(); - for (OrchestrationFlow flow : flows) { - if (!flow.getFlowName().contains("BB")) { - List<OrchestrationFlow> macroQueryFlows = catalogDbClient - .getOrchestrationFlowByAction(flow.getFlowName()); - for (OrchestrationFlow macroFlow : macroQueryFlows) { - listToExecute.add(macroFlow); - } - } else { - listToExecute.add(flow); + if(northBoundRequest.getIsToplevelflow()!=null){ + execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow()); + } + List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList(); + if (flows == null) + flows = new ArrayList<>(); + for (OrchestrationFlow flow : flows) { + if (!flow.getFlowName().contains("BB")) { + List<OrchestrationFlow> macroQueryFlows = catalogDbClient + .getOrchestrationFlowByAction(flow.getFlowName()); + for (OrchestrationFlow macroFlow : macroQueryFlows) { + listToExecute.add(macroFlow); } + } else { + listToExecute.add(flow); } } + } return listToExecute; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index 101a355c2f..ab29e21dea 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -30,9 +30,10 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; -import org.onap.so.client.db.request.RequestsDbClient; + import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.MsoLogger; import org.onap.so.serviceinstancebeans.RequestReferences; import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index be19f25cca..4a1c3f512c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -7,15 +7,14 @@ * 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. - * Modifications Copyright (C) 2018 IBM * ============LICENSE_END========================================================= */ diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index b84f8b6459..e9dc3742f5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -157,6 +157,15 @@ public class AAIConfigurationResources { AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); injectionHelper.getAaiClient().delete(aaiResourceUri); } + /** + * method to delete Configuration details in A&AI + * + * @param configuration + */ + public void deleteConfiguration(Configuration configuration) { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + injectionHelper.getAaiClient().delete(aaiResourceUri); + } /** * Get Configuration from AAI using related Link @@ -167,4 +176,11 @@ public class AAIConfigurationResources { return injectionHelper.getAaiClient() .get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build())); } + + public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId()); + configuration.setOrchestrationStatus(orchestrationStatus); + org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration); + injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java index 9e60196426..0061f50ba8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java @@ -24,6 +24,7 @@ import java.util.LinkedHashMap; import javax.ws.rs.core.UriBuilder; +import org.onap.so.bpmn.common.baseclient.BaseClient; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.beans.SDNCProperties; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java index cee94e28bd..eb12278528 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java @@ -23,9 +23,9 @@ package org.onap.so.client.sniro; import java.util.LinkedHashMap; import org.camunda.bpm.engine.delegate.BpmnError; +import org.onap.so.bpmn.common.baseclient.BaseClient; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.client.sdnc.BaseClient; import org.onap.so.client.sniro.beans.ManagerProperties; import org.onap.so.client.sniro.beans.SniroConductorRequest; import org.onap.so.client.sniro.beans.SniroManagerRequest; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java index 6401d5516d..9244f7ee1f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java @@ -21,14 +21,8 @@ package org.onap.so; -import java.io.IOException; - -import javax.annotation.PreDestroy; - import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; -import org.onap.so.requestsdb.RequestsDBHelper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; @@ -40,9 +34,7 @@ import org.springframework.context.annotation.Profile; @Profile("test") @EnableProcessApplication("MSO CommonBPMN Test Application") @ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { - @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), - @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) public class TestApplication { public static void main(String... args) { SpringApplication.run(TestApplication.class, args); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java index 3fce15a6c4..2b25dfd9f1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java @@ -28,8 +28,8 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.appc.ApplicationControllerAction; -import org.onap.so.client.db.request.RequestsDbClient; import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIInstanceGroupResources; import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; @@ -46,6 +46,8 @@ import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.db.request.client.RequestsDbClient; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.boot.test.mock.mockito.SpyBean; @@ -111,6 +113,7 @@ public abstract class BaseTaskTest extends TestDataSetup { protected CatalogDbClient catalogDbClient; @MockBean + @Qualifier("RequestsDbClient") protected RequestsDbClient requestsDbClient; @Mock @@ -118,10 +121,13 @@ public abstract class BaseTaskTest extends TestDataSetup { @Mock protected BBInputSetup bbInputSetup; - + @SpyBean protected SDNCClient SPY_sdncClient; @MockBean protected ApplicationControllerAction appCClient; + + @MockBean + protected AAIConfigurationResources aaiConfigurationResources; } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index a20b68b147..fb9533091b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -459,6 +459,7 @@ public class TestDataSetup{ genericVnf.setVnfId("testVnfId" + genericVnfCounter); genericVnf.setVnfName("testVnfName" + genericVnfCounter); genericVnf.setVnfType("testVnfType" + genericVnfCounter); + genericVnf.setIpv4OamAddress("10.222.22.2"); Platform platform = new Platform(); platform.setPlatformName("testPlatformName"); @@ -662,4 +663,20 @@ public class TestDataSetup{ return ar; } + + public Configuration setConfiguration () { + Configuration config = new Configuration(); + config.setConfigurationId("testConfigurationId"); + List<Configuration> configurations = new ArrayList<>(); + configurations.add(config); + ServiceInstance serviceInstance = new ServiceInstance(); + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId"); + serviceInstance.setConfigurations(configurations); + return config; + } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index 51a7f1ab04..0b802a3385 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -26,6 +26,9 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.util.ArrayList; +import java.util.List; + import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Rule; @@ -33,6 +36,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -54,6 +58,7 @@ public class AAICreateTasksTest extends BaseTaskTest{ private CloudRegion cloudRegion; private VfModule vfModule; private Customer customer; + private Configuration configuration; @Rule public final ExpectedException exception = ExpectedException.none(); @@ -67,6 +72,7 @@ public class AAICreateTasksTest extends BaseTaskTest{ volumeGroup = setVolumeGroup(); cloudRegion = setCloudRegion(); vfModule = setVfModule(); + configuration = setConfiguration(); } @@ -384,4 +390,12 @@ public class AAICreateTasksTest extends BaseTaskTest{ aaiCreateTasks.connectNetworkToTenant(execution); verify(aaiNetworkResources, times(1)).connectNetworkToTenant(network, gBBInput.getCloudRegion()); } + + @Test + public void createConfigurationTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiConfigurationResources).createConfiguration(configuration); + aaiCreateTasks.createConfiguration(execution); + verify(aaiConfigurationResources, times(1)).createConfiguration(configuration); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java new file mode 100644 index 0000000000..efe5b5d971 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java @@ -0,0 +1,162 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.aai.tasks; + +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.springframework.beans.factory.annotation.Autowired; + +public class AAIDeleteTasksTest extends BaseTaskTest { + @Autowired + private AAIDeleteTasks aaiDeleteTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private GenericVnf genericVnf; + private VfModule vfModule; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + private Configuration configuration; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + network = setL3Network(); + volumeGroup = setVolumeGroup(); + cloudRegion = setCloudRegion(); + configuration = setConfiguration(); + } + + @Test + public void deleteVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf); + aaiDeleteTasks.deleteVfModule(execution); + verify(aaiVfModuleResources, times(1)).deleteVfModule(vfModule, genericVnf); + } + + @Test + public void deleteVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf); + aaiDeleteTasks.deleteVfModule(execution); + } + + @Test + public void deleteServiceInstanceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance); + + aaiDeleteTasks.deleteServiceInstance(execution); + + verify(aaiServiceInstanceResources, times(1)).deleteServiceInstance(serviceInstance); + } + + @Test + public void deleteServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance); + + aaiDeleteTasks.deleteServiceInstance(execution); + } + + @Test + public void deleteVnfTest() throws Exception { + doNothing().when(aaiVnfResources).deleteVnf(genericVnf); + aaiDeleteTasks.deleteVnf(execution); + verify(aaiVnfResources, times(1)).deleteVnf(genericVnf); + } + + @Test + public void deleteVnfTestException() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVnfResources).deleteVnf(genericVnf); + + aaiDeleteTasks.deleteVnf(execution); + verify(aaiVnfResources, times(1)).deleteVnf(genericVnf); + } + + @Test + public void deleteNetworkTest() throws Exception { + doNothing().when(aaiNetworkResources).deleteNetwork(network); + aaiDeleteTasks.deleteNetwork(execution); + verify(aaiNetworkResources, times(1)).deleteNetwork(network); + } + + @Test + public void deleteCollectionTest() throws Exception { + doNothing().when(aaiNetworkResources).deleteCollection(serviceInstance.getCollection()); + aaiDeleteTasks.deleteCollection(execution); + verify(aaiNetworkResources, times(1)).deleteCollection(serviceInstance.getCollection()); + } + + @Test + public void deleteInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + aaiDeleteTasks.deleteInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + } + + @Test + public void deleteVolumeGroupTest() { + doNothing().when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion); + + aaiDeleteTasks.deleteVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).deleteVolumeGroup(volumeGroup, cloudRegion); + } + + @Test + public void deleteVolumeGroupExceptionTest() { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion); + + aaiDeleteTasks.deleteVolumeGroup(execution); + } + + @Test + public void deleteConfigurationTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiConfigurationResources).deleteConfiguration(configuration); + aaiDeleteTasks.deleteConfiguration(execution); + verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index b45752957e..d800ae9618 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -32,6 +32,7 @@ import org.junit.Test; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -50,6 +51,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ private GenericVnf genericVnf; private VolumeGroup volumeGroup; private CloudRegion cloudRegion; + private Configuration configuration; @Before public void before() { @@ -59,6 +61,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ volumeGroup = setVolumeGroup(); cloudRegion = setCloudRegion(); network = setL3Network(); + configuration = setConfiguration(); } @Test @@ -462,4 +465,23 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf); aaiUpdateTasks.updateModelVfModule(execution); } + + @Test + public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusDeactivateFabricConfiguration(execution); + + verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); + } + @Test + public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActivateFabricConfiguration(execution); + + verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java new file mode 100644 index 0000000000..dabdc6811c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.onap.appc.client.lcm.model.Action; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.springframework.beans.factory.annotation.Autowired; + +public class ConfigurationScaleOutTest extends BaseTaskTest { + + @Autowired + private ConfigurationScaleOut configurationScaleOut; + + private GenericVnf genericVnf; + private VfModule vfModule; + private RequestContext requestContext; + private String msoRequestId; + private List<Map<String, String>> configurationParameters = new ArrayList<>(); + private Map<String, String> configParamsMap = new HashMap<>(); + + + + @Before + public void before() { + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + msoRequestId = UUID.randomUUID().toString(); + requestContext = setRequestContext(); + requestContext.setMsoRequestId(msoRequestId); + configParamsMap.put("availability-zone", "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]"); + configParamsMap.put("vnf-id", "$.vnf-topology.vnf-topology-identifier-structure.vnf-id"); + configurationParameters.add(configParamsMap); + requestContext.setConfigurationParameters(configurationParameters); + gBBInput.setRequestContext(requestContext); + } + + @Test + public void setParamsForConfigurationScaleOutTest() throws Exception { + ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference(); + controllerSelectionReference.setControllerName("testName"); + controllerSelectionReference.setActionCategory("testAction"); + controllerSelectionReference.setVnfType("testVnfType"); + String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientGetResponse.json"))); + String expectedPayload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\"," + + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\"" + + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse); + + doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString()); + + configurationScaleOut.setParamsForConfigurationScaleOut(execution); + + assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId")); + assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName")); + assertEquals("ConfigScaleOut", execution.getVariable("action")); + assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId")); + assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType")); + assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId")); + assertEquals(expectedPayload, execution.getVariable("payload")); + } + @Test + public void callAppcClientTest() throws Exception { + Action action = Action.ConfigScaleOut; + String vnfId = genericVnf.getVnfId(); + String controllerType = "testType"; + String payload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\"," + + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\"" + + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}"; + HashMap<String, String> payloadInfo = new HashMap<String, String>(); + payloadInfo.put("vnfName", "testVnfName"); + payloadInfo.put("vfModuleId", "testVfModuleId"); + + execution.setVariable("action", Action.ConfigScaleOut.toString()); + execution.setVariable("msoRequestId", msoRequestId); + execution.setVariable("controllerType", controllerType); + execution.setVariable("vnfId", "testVnfId1"); + execution.setVariable("vnfName", "testVnfName"); + execution.setVariable("vfModuleId", "testVfModuleId"); + execution.setVariable("payload", payload); + + doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + + configurationScaleOut.callAppcClient(execution); + verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 3869988c40..65d16adb40 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -36,7 +36,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; -import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Optional; @@ -74,7 +73,6 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; -import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; @@ -304,7 +302,7 @@ public class WorkflowActionTest extends BaseTaskTest { orchFlows.add(orch7); OrchestrationFlow orch8 = new OrchestrationFlow(); orch8.setFlowName("ActivateServiceInstanceBB"); - orchFlows.add(orch8); + orchFlows.add(orch8); ServiceInstance serviceInstanceAAI = new ServiceInstance(); serviceInstanceAAI.setServiceInstanceId("si0"); @@ -718,6 +716,9 @@ public class WorkflowActionTest extends BaseTaskTest { orch15.setFlowName("ActivateServiceInstanceBB"); orchFlows.add(orch15); + Service service = new Service(); + service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); HeatEnvironment volumeHeatEnv = new HeatEnvironment(); @@ -743,6 +744,7 @@ public class WorkflowActionTest extends BaseTaskTest { when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); + when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); @@ -796,48 +798,48 @@ public class WorkflowActionTest extends BaseTaskTest { NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = new LinkedList<>(); northBoundRequest.setOrchestrationFlowList(orchFlows); - OrchestrationFlow orch1 = new OrchestrationFlow(); - orch1.setFlowName("DeactivateVfModuleBB"); - orchFlows.add(orch1); - OrchestrationFlow orch2 = new OrchestrationFlow(); - orch2.setFlowName("DeleteVfModuleBB"); - orchFlows.add(orch2); OrchestrationFlow orch3 = new OrchestrationFlow(); - orch3.setFlowName("DeactivateVolumeGroupBB"); + orch3.setFlowName("DeactivateVfModuleBB"); orchFlows.add(orch3); OrchestrationFlow orch4 = new OrchestrationFlow(); - orch4.setFlowName("DeleteVolumeGroupBB"); + orch4.setFlowName("DeleteVfModuleBB"); orchFlows.add(orch4); OrchestrationFlow orch5 = new OrchestrationFlow(); - orch5.setFlowName("DeactivateVnfBB"); + orch5.setFlowName("DeactivateVolumeGroupBB"); orchFlows.add(orch5); OrchestrationFlow orch6 = new OrchestrationFlow(); - orch6.setFlowName("DeactivateNetworkBB"); + orch6.setFlowName("DeleteVolumeGroupBB"); orchFlows.add(orch6); OrchestrationFlow orch7 = new OrchestrationFlow(); - orch7.setFlowName("DeleteNetworkBB"); + orch7.setFlowName("DeactivateVnfBB"); orchFlows.add(orch7); OrchestrationFlow orch8 = new OrchestrationFlow(); - orch8.setFlowName("DeleteNetworkCollectionBB"); + orch8.setFlowName("DeactivateNetworkBB"); orchFlows.add(orch8); OrchestrationFlow orch9 = new OrchestrationFlow(); - orch9.setFlowName("DeactivateServiceInstanceBB"); + orch9.setFlowName("DeleteNetworkBB"); orchFlows.add(orch9); OrchestrationFlow orch10 = new OrchestrationFlow(); - orch10.setFlowName("UnassignVfModuleBB"); + orch10.setFlowName("DeleteNetworkCollectionBB"); orchFlows.add(orch10); OrchestrationFlow orch11 = new OrchestrationFlow(); - orch11.setFlowName("UnassignVolumeGroupBB"); + orch11.setFlowName("DeactivateServiceInstanceBB"); orchFlows.add(orch11); OrchestrationFlow orch12 = new OrchestrationFlow(); - orch12.setFlowName("UnassignVnfBB"); + orch12.setFlowName("UnassignVfModuleBB"); orchFlows.add(orch12); OrchestrationFlow orch13 = new OrchestrationFlow(); - orch13.setFlowName("UnassignNetworkBB"); + orch13.setFlowName("UnassignVolumeGroupBB"); orchFlows.add(orch13); OrchestrationFlow orch14 = new OrchestrationFlow(); - orch14.setFlowName("UnassignServiceInstanceBB"); + orch14.setFlowName("UnassignVnfBB"); orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch15); + OrchestrationFlow orch16 = new OrchestrationFlow(); + orch16.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch16); ServiceInstance serviceInstanceAAI = new ServiceInstance(); serviceInstanceAAI.setServiceInstanceId("aaisi123"); @@ -954,49 +956,49 @@ public class WorkflowActionTest extends BaseTaskTest { NorthBoundRequest northBoundRequest = new NorthBoundRequest(); List<OrchestrationFlow> orchFlows = new LinkedList<>(); - northBoundRequest.setOrchestrationFlowList(orchFlows); - OrchestrationFlow orch1 = new OrchestrationFlow(); - orch1.setFlowName("DeactivateVfModuleBB"); - orchFlows.add(orch1); - OrchestrationFlow orch2 = new OrchestrationFlow(); - orch2.setFlowName("DeleteVfModuleBB"); - orchFlows.add(orch2); + northBoundRequest.setOrchestrationFlowList(orchFlows); OrchestrationFlow orch3 = new OrchestrationFlow(); - orch3.setFlowName("DeactivateVolumeGroupBB"); + orch3.setFlowName("DeactivateVfModuleBB"); orchFlows.add(orch3); OrchestrationFlow orch4 = new OrchestrationFlow(); - orch4.setFlowName("DeleteVolumeGroupBB"); + orch4.setFlowName("DeleteVfModuleBB"); orchFlows.add(orch4); OrchestrationFlow orch5 = new OrchestrationFlow(); - orch5.setFlowName("DeactivateVnfBB"); + orch5.setFlowName("DeactivateVolumeGroupBB"); orchFlows.add(orch5); OrchestrationFlow orch6 = new OrchestrationFlow(); - orch6.setFlowName("DeactivateNetworkBB"); + orch6.setFlowName("DeleteVolumeGroupBB"); orchFlows.add(orch6); OrchestrationFlow orch7 = new OrchestrationFlow(); - orch7.setFlowName("DeleteNetworkBB"); + orch7.setFlowName("DeactivateVnfBB"); orchFlows.add(orch7); OrchestrationFlow orch8 = new OrchestrationFlow(); - orch8.setFlowName("DeleteNetworkCollectionBB"); - orchFlows.add(orch8); + orch8.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch8); OrchestrationFlow orch9 = new OrchestrationFlow(); - orch9.setFlowName("DeactivateServiceInstanceBB"); - orchFlows.add(orch9); + orch9.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch9); OrchestrationFlow orch10 = new OrchestrationFlow(); - orch10.setFlowName("UnassignVfModuleBB"); - orchFlows.add(orch10); + orch10.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch10); OrchestrationFlow orch11 = new OrchestrationFlow(); - orch11.setFlowName("UnassignVolumeGroupBB"); - orchFlows.add(orch11); + orch11.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch11); OrchestrationFlow orch12 = new OrchestrationFlow(); - orch12.setFlowName("UnassignVnfBB"); - orchFlows.add(orch12); + orch12.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch12); OrchestrationFlow orch13 = new OrchestrationFlow(); - orch13.setFlowName("UnassignNetworkBB"); - orchFlows.add(orch13); + orch13.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch13); OrchestrationFlow orch14 = new OrchestrationFlow(); - orch14.setFlowName("UnassignServiceInstanceBB"); - orchFlows.add(orch14); + orch14.setFlowName("UnassignVnfBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch15); + OrchestrationFlow orch16 = new OrchestrationFlow(); + orch16.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch16); ServiceInstance serviceInstanceAAI = new ServiceInstance(); serviceInstanceAAI.setServiceInstanceId("aaisi123"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index 0355006d15..99f1b188c9 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -562,7 +562,7 @@ public class AAIObjectMapperTest { AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); org.onap.aai.domain.yang.CtagAssignments v12CtagAssingments = aaiObjectMapper.mapToAAICtagAssignmentList(ctagAssignments); - assertEquals(ctagAssignments.get(0).getVlanIdInner().longValue(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner()); + assertEquals(new Long(ctagAssignments.get(0).getVlanIdInner().longValue()), new Long(v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner())); String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiCtagAssingmentsMapped_to_aai.json"))); ObjectMapper omapper = new ObjectMapper(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java index 207b9f3f98..352eb20630 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java @@ -30,7 +30,6 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.adapters.nwrest.CreateNetworkError; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; @@ -45,6 +44,7 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkError; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.BaseTest; import org.onap.so.openstack.beans.NetworkRollback; import com.fasterxml.jackson.core.JsonProcessingException; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java index 85f787faa7..f7ad5f5ff4 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java @@ -31,7 +31,6 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; -import org.onap.so.BaseTest; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; @@ -43,7 +42,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; - +import org.onap.so.BaseTest; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java index b356b21de4..e3d849f925 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java @@ -33,7 +33,6 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.mockito.runners.MockitoJUnitRunner; -import org.onap.so.BaseTest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; @@ -43,6 +42,7 @@ import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse; import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; import org.onap.so.client.adapter.rest.AdapterRestClient; +import org.onap.so.BaseTest; @RunWith(MockitoJUnitRunner.class) diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index cc48c46508..5948c66baa 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -177,4 +177,13 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{ aaiConfigurationResources.deleteConfiguration("configurationId"); verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri); } + + @Test + public void updateOrchestrationStatusConfigurationTest() throws Exception { + configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,OrchestrationStatus.ACTIVE); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Configuration.class)); + assertEquals(OrchestrationStatus.ACTIVE, configuration.getOrchestrationStatus()); + } }
\ No newline at end of file diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java index a10945e855..2595ddcbcd 100644 --- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java +++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java @@ -64,8 +64,8 @@ import com.fasterxml.jackson.databind.SerializationFeature; public class HttpClientConnector implements CloudifyClientConnector { - public static ObjectMapper DEFAULT_MAPPER; - public static ObjectMapper WRAPPED_MAPPER; + private static ObjectMapper DEFAULT_MAPPER; + private static ObjectMapper WRAPPED_MAPPER; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, HttpClientConnector.class); diff --git a/common/pom.xml b/common/pom.xml index dccebb216f..a3084e8174 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -55,7 +55,6 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> - <version>4.3.6.Final</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> @@ -72,11 +71,12 @@ <artifactId>spring-web</artifactId> </dependency> <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + </dependency> + <dependency> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-schema</artifactId> - <!-- TODO: replace with release a version when --> - <!-- org.onap.aai.domain.yang.Collection has --> - <!-- been released --> <version>1.3.0-SNAPSHOT</version> </dependency> <dependency> @@ -135,11 +135,6 @@ <artifactId>slf4j-api</artifactId> </dependency> <dependency> - <groupId>janino</groupId> - <artifactId>janino</artifactId> - <version>2.5.15</version> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> @@ -154,7 +149,17 @@ <artifactId>spring-security-web</artifactId> <version>5.0.5.RELEASE</version> </dependency> - + <dependency> + <groupId>org.onap.logging-analytics</groupId> + <artifactId>logging-slf4j</artifactId> + <version>1.2.2-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> <build> <resources> diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index 0f4bbea03c..631850a01f 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -36,7 +36,6 @@ import java.util.Map.Entry; import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.function.Predicate; - import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.Invocation.Builder; @@ -46,44 +45,38 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.UriBuilder; - import org.onap.so.client.policy.CommonObjectMapperProvider; -import org.onap.so.client.policy.LoggingFilter; -import org.onap.so.logger.MsoLogger; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsClientLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsClientLogging; +import org.onap.so.logging.jaxrs.filter.PayloadLoggingFilter; import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.TargetEntity; -import org.slf4j.MDC; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; - import net.jodah.failsafe.Failsafe; import net.jodah.failsafe.RetryPolicy; public abstract class RestClient { - public static final String ECOMP_COMPONENT_NAME = "MSO"; + private static final String APPLICATION_MERGE_PATCH_JSON = "application/merge-patch+json"; + + public static final String ECOMP_COMPONENT_NAME = "MSO"; private static final int MAX_PAYLOAD_SIZE = 1024 * 1024; private WebTarget webTarget; protected final Map<String, String> headerMap; - protected final MsoLogger msoLogger; + protected final Logger logger = LoggerFactory.getLogger(RestClient.class); protected URL host; protected Optional<URI> path; protected String accept; protected String contentType; - protected String requestId; + protected String requestId = ""; protected JaxRsClientLogging jaxRsClientLogging; protected RestProperties props; protected RestClient(RestProperties props, Optional<URI> path) { - msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class); - this.requestId = MDC.get(MsoLogger.REQUEST_ID); - if (requestId == null) { - requestId = ""; - } headerMap = new HashMap<>(); try { host = props.getEndpoint(); @@ -99,24 +92,14 @@ public abstract class RestClient { this(props, path); this.accept = accept; this.contentType = contentType; - this.requestId = MDC.get(MsoLogger.REQUEST_ID); - if (requestId == null) { - requestId = ""; - } this.props = props; } protected RestClient(URL host, String contentType) { headerMap = new HashMap<>(); - - msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, RestClient.class); this.path = Optional.empty(); this.host = host; this.contentType = contentType; - this.requestId = MDC.get(MsoLogger.REQUEST_ID); - if (requestId == null) { - requestId = ""; - } this.props = new DefaultProperties(host); } @@ -143,15 +126,13 @@ public abstract class RestClient { if (webTarget == null) { initializeClient(getClient()); - } - Builder builder = webTarget.request(); - initializeHeaderMap(headerMap); - - headerMap.put("X-ECOMP-RequestID", requestId); - for (Entry<String, String> entry : headerMap.entrySet()) { - builder.header(entry.getKey(), entry.getValue()); - } - return builder; + } + Builder builder = webTarget.request(); + initializeHeaderMap(headerMap); + for (Entry<String, String> entry : headerMap.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + return builder; } protected WebTarget getWebTarget() { @@ -179,7 +160,7 @@ public abstract class RestClient { String authHeaderValue = "Basic " + Base64.getEncoder().encodeToString(decryptedAuth); headerMap.put("Authorization", authHeaderValue); } catch (GeneralSecurityException e) { - msoLogger.error(e.getMessage(), e); + logger.error(e.getMessage(), e); } } @@ -192,7 +173,7 @@ public abstract class RestClient { } protected String getMergeContentType() { - return "application/merge-patch+json"; + return APPLICATION_MERGE_PATCH_JSON; } protected Client getClient() { @@ -203,11 +184,11 @@ public abstract class RestClient { protected void initializeClient(Client client) { if (this.enableLogging()) { - client.register(new LoggingFilter(this.getMaxPayloadSize())); + client.register(new PayloadLoggingFilter(this.getMaxPayloadSize())); } CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider(); client.register(new JacksonJsonProvider(provider.getMapper())); - + jaxRsClientLogging = new JaxRsClientLogging(); jaxRsClientLogging.setTargetService(getTargetEntity()); client.register(jaxRsClientLogging); diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java index 8eaeee97ee..cb2839ae1f 100644 --- a/common/src/main/java/org/onap/so/client/RestClientSSL.java +++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java @@ -32,7 +32,8 @@ import javax.ws.rs.client.ClientBuilder; public abstract class RestClientSSL extends RestClient { - public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore"; + private static final String TRUE = "true"; + public static final String SSL_KEY_STORE_KEY = "javax.net.ssl.keyStore"; public static final String SSL_KEY_STORE_PASSWORD_KEY = "javax.net.ssl.keyStorePassword"; public static final String MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY = "mso.load.ssl.client.keystore"; @@ -51,19 +52,18 @@ public abstract class RestClientSSL extends RestClient { Client client = null; try { String loadSSLKeyStore = System.getProperty(RestClientSSL.MSO_LOAD_SSL_CLIENT_KEYSTORE_KEY); - if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase("true")) { + if(loadSSLKeyStore != null && loadSSLKeyStore.equalsIgnoreCase(TRUE)) { KeyStore ks = getKeyStore(); if(ks != null) { client = ClientBuilder.newBuilder().keyStore(ks, System.getProperty(RestClientSSL.SSL_KEY_STORE_PASSWORD_KEY)).build(); - this.msoLogger.debug("RestClientSSL not using default SSL context - setting keystore here."); + logger.debug("RestClientSSL not using default SSL context - setting keystore here."); return client; } } //Use default SSL context client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault()).build(); - this.msoLogger.debug("RestClientSSL using default SSL context!"); + logger.info("RestClientSSL using default SSL context!"); } catch (NoSuchAlgorithmException e) { - //this.logger.error(MessageEnum.APIH_GENERAL_EXCEPTION, "AAI", "Client init", MsoLogger.ErrorCode.UnknownError, "could not create SSL client", e); throw new RuntimeException(e); } return client; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java index 514eab6fc4..ffc474a55a 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java @@ -29,6 +29,7 @@ import javax.ws.rs.ext.Provider; import javax.annotation.Priority; import javax.ws.rs.ext.Provider; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.aai.entities.AAIError; import org.onap.so.logger.MsoLogger; @@ -42,7 +43,7 @@ public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper { private final String requestId; public AAIClientResponseExceptionMapper() { - this.requestId = MDC.get(MsoLogger.REQUEST_ID); + this.requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); } @Override public Optional<String> extractMessage(String entity) { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index ce75b1716a..a5d8f12e83 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -20,6 +20,40 @@ package org.onap.so.client.aai; +import java.util.HashMap; +import java.util.Map; + +import org.onap.aai.annotations.Metadata; +import org.onap.aai.domain.yang.AllottedResource; +import org.onap.aai.domain.yang.CloudRegion; +import org.onap.aai.domain.yang.Collection; +import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.Customer; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.InstanceGroup; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.LineOfBusiness; +import org.onap.aai.domain.yang.ModelVer; +import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.OperationalEnvironment; +import org.onap.aai.domain.yang.OwningEntity; +import org.onap.aai.domain.yang.PInterface; +import org.onap.aai.domain.yang.PhysicalLink; +import org.onap.aai.domain.yang.Platform; +import org.onap.aai.domain.yang.Project; +import org.onap.aai.domain.yang.Pserver; +import org.onap.aai.domain.yang.RouteTableReferences; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceSubscription; +import org.onap.aai.domain.yang.Tenant; +import org.onap.aai.domain.yang.TunnelXconnect; +import org.onap.aai.domain.yang.Vce; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VlanTag; +import org.onap.aai.domain.yang.Vnfc; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aai.domain.yang.VpnBinding; +import org.onap.aai.domain.yang.Vserver; import org.onap.so.client.graphinventory.GraphInventoryObjectType; import com.google.common.base.CaseFormat; @@ -27,57 +61,82 @@ import com.google.common.base.CaseFormat; public enum AAIObjectType implements GraphInventoryObjectType { DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"), - CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"), + CUSTOMER(AAINamespaceConstants.BUSINESS, Customer.class), GENERIC_QUERY("/search", "/generic-query"), BULK_PROCESS("/bulkprocess", ""), - GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"), - VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"), - L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"), - NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"), + GENERIC_VNF(AAINamespaceConstants.NETWORK, GenericVnf.class), + VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class), + L3_NETWORK(AAINamespaceConstants.NETWORK, L3Network.class), + NETWORK_POLICY(AAINamespaceConstants.NETWORK, NetworkPolicy.class), NODES_QUERY("/search", "/nodes-query"), CUSTOM_QUERY("/query", ""), - ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"), + ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, RouteTableReferences.class), DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"), - VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"), - VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"), + VCE(AAINamespaceConstants.NETWORK, Vce.class), + VPN_BINDING(AAINamespaceConstants.NETWORK, VpnBinding.class), VPN_BINDINGS(AAINamespaceConstants.NETWORK, "/vpn-bindings"), - CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"), - PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"), - SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"), - SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"), - PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"), - LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"), - PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"), - OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"), - ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"), + CONFIGURATION(AAINamespaceConstants.NETWORK, Configuration.class), + PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class), + SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class), + SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class), + PROJECT(AAINamespaceConstants.BUSINESS, Project.class), + LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, LineOfBusiness.class), + PLATFORM(AAINamespaceConstants.BUSINESS, Platform.class), + OWNING_ENTITY(AAINamespaceConstants.BUSINESS, OwningEntity.class), + ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class), PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"), - OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"), - CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"), - TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"), - VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/volume-group/{volume-group-id}"), - VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"), - MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"), - TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{tunnel-id}"), - P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"), - PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"), - INSTANCE_GROUP(AAINamespaceConstants.NETWORK, "/instance-groups/instance-group/{id}"), - COLLECTION(AAINamespaceConstants.NETWORK, "/collections/collection/{collection-id}"), + OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class), + CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class), + TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class), + VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class), + VSERVER(AAIObjectType.TENANT.uriTemplate(), Vserver.class), + MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class), + TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class), + P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), PInterface.class), + PHYSICAL_LINK(AAINamespaceConstants.NETWORK, PhysicalLink.class), + INSTANCE_GROUP(AAINamespaceConstants.NETWORK, InstanceGroup.class), + COLLECTION(AAINamespaceConstants.NETWORK, Collection.class), + VNFC(AAINamespaceConstants.NETWORK, Vnfc.class), + VLAN_TAG(AAINamespaceConstants.NETWORK, VlanTag.class), UNKNOWN("", ""); private final String uriTemplate; private final String parentUri; private final String partialUri; + private final Class<?> aaiObjectClass; + private static Map<String, AAIObjectType> map = new HashMap<>(); private AAIObjectType(String parentUri, String partialUri) { this.parentUri = parentUri; this.partialUri = partialUri; this.uriTemplate = parentUri + partialUri; + this.aaiObjectClass = null; + } + + private AAIObjectType(String parentUri, Class<?> aaiObjectClass) { + this.parentUri = parentUri; + this.partialUri = removeParentUri(aaiObjectClass, parentUri); + this.uriTemplate = parentUri + partialUri; + this.aaiObjectClass = aaiObjectClass; } @Override public String toString() { return this.uriTemplate(); } - + + public static AAIObjectType fromTypeName(String name) { + if (map.isEmpty()) { + for (AAIObjectType type : AAIObjectType.values()) { + map.put(type.typeName(), type); + } + } + + if (map.containsKey(name)) { + return map.get(name); + } else { + return AAIObjectType.UNKNOWN; + } + } @Override public String typeName() { return this.typeName(CaseFormat.LOWER_HYPHEN); @@ -101,4 +160,8 @@ public enum AAIObjectType implements GraphInventoryObjectType { public String partialUri() { return this.partialUri; } + + protected String removeParentUri(Class<?> aaiObjectClass, String parentUri) { + return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replace(parentUri, ""); + } } diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java index 20ee5becca..de418f32c0 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java @@ -28,7 +28,8 @@ public enum AAIVersion implements GraphInventoryVersion { V10("v10"), V11("v11"), V12("v12"), - V13("v13"); + V13("v13"), + V14("v14"); public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; private final String value; diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java index 0356e86861..434dbf946b 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.aai.entities; import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java index 36e67e2e09..45621f09a6 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java @@ -26,9 +26,11 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; +import org.apache.log4j.Logger; import org.onap.so.client.aai.AAICommonObjectMapperProvider; import org.onap.so.jsonpath.JsonPathUtil; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -37,11 +39,26 @@ public class AAIResultWrapper implements Serializable { private static final long serialVersionUID = 5895841925807816737L; private final String jsonBody; private final ObjectMapper mapper; + private final transient Logger logger = Logger.getLogger(AAIResultWrapper.class); + public AAIResultWrapper(String json) { this.jsonBody = json; this.mapper = new AAICommonObjectMapperProvider().getMapper(); } + public AAIResultWrapper(Object aaiObject) { + this.mapper = new AAICommonObjectMapperProvider().getMapper(); + this.jsonBody = mapObjectToString(aaiObject); + } + + protected String mapObjectToString(Object aaiObject) { + try { + return mapper.writeValueAsString(aaiObject); + } catch (JsonProcessingException e) { + logger.warn("could not parse object into json - defaulting to {}"); + return "{}"; + } + } public Optional<Relationships> getRelationships() { final String path = "$.relationship-list"; if (isEmpty()) { diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java index 2329a5acb9..9d72fdf85b 100644 --- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java +++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java @@ -72,7 +72,7 @@ public class AdapterRestClient extends RestClient { encodedString = "Basic " + encodedString; return encodedString; } catch (GeneralSecurityException e) { - this.msoLogger.debug(e.getMessage()); + logger.error(e.getMessage(),e); return null; } } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java index 1ede2f9e1b..461920fe7f 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory.entities; public interface GraphInventoryEdgeLabel { diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java index 145959dc73..3d08c8d40c 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.graphinventory.entities.uri; import java.net.URI; diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java index 74c1e398db..6743bc2c34 100644 --- a/common/src/main/java/org/onap/so/client/policy/PolicyClient.java +++ b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java @@ -20,6 +20,7 @@ package org.onap.so.client.policy; +import org.onap.so.client.policy.entities.Config; import org.onap.so.client.policy.entities.DictionaryData; import org.onap.so.client.policy.entities.PolicyDecision; @@ -29,4 +30,6 @@ public interface PolicyClient { String errorCode); public DictionaryData getAllowedTreatments(String bbID, String workStep); + + public Config getConfigWithPolicyName(String policyName); } diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java index 1fd01e65ed..71a3227c56 100644 --- a/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java +++ b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java @@ -20,6 +20,7 @@ package org.onap.so.client.policy; +import java.io.IOException; import java.util.List; import org.onap.so.client.RestClient; @@ -27,10 +28,13 @@ import org.onap.so.client.RestPropertiesLoader; import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl; import org.onap.so.client.policy.entities.AllowedTreatments; import org.onap.so.client.policy.entities.Bbid; +import org.onap.so.client.policy.entities.Config; +import org.onap.so.client.policy.entities.ConfigRequestParameters; import org.onap.so.client.policy.entities.DecisionAttributes; import org.onap.so.client.policy.entities.DictionaryData; import org.onap.so.client.policy.entities.DictionaryItemsRequest; import org.onap.so.client.policy.entities.DictionaryJson; +import org.onap.so.client.policy.entities.PolicyConfig; import org.onap.so.client.policy.entities.PolicyDecision; import org.onap.so.client.policy.entities.PolicyDecisionRequest; import org.onap.so.client.policy.entities.PolicyServiceType; @@ -38,11 +42,19 @@ import org.onap.so.client.policy.entities.Workstep; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + public class PolicyClientImpl implements PolicyClient { private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class); private PolicyRestProperties props; + private ObjectMapper mapper = new ObjectMapper(); + public PolicyClientImpl() { props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class); if (props == null) { @@ -63,7 +75,7 @@ public class PolicyClientImpl implements PolicyClient { } protected PolicyDecision getDecision(DecisionAttributes decisionAttributes) { - PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DECISION); + PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DECISION); PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest(); decisionRequest.setDecisionAttributes(decisionAttributes); decisionRequest.setEcompcomponentName(RestClient.ECOMP_COMPONENT_NAME); @@ -73,7 +85,7 @@ public class PolicyClientImpl implements PolicyClient { public DictionaryData getAllowedTreatments(String bbID, String workStep) { - PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DICTIONARY_ITEMS); + PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DICTIONARY_ITEMS); DictionaryItemsRequest dictionaryItemsRequest = new DictionaryItemsRequest(); dictionaryItemsRequest.setDictionaryType("Decision"); dictionaryItemsRequest.setDictionary("RainyDayTreatments"); @@ -92,5 +104,35 @@ public class PolicyClientImpl implements PolicyClient { logger.error("There is no AllowedTreatments with that specified parameter set"); return null; } - + + @Override + public Config getConfigWithPolicyName(String policyName) { + PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_CONFIG); + ConfigRequestParameters configReqParameters = new ConfigRequestParameters(); + configReqParameters.setPolicyName(policyName); + PolicyConfig[] policyConfigList = client.post(configReqParameters, PolicyConfig[].class); + PolicyConfig policyConfig = null; + if(policyConfigList.length > 1) { + logger.debug("Too many configs for policyName: " + policyName); + return null; + } + try { + policyConfig = policyConfigList[0]; + return this.getConfigFromStringJson(policyConfig.getConfig()); + } catch (IOException e) { + logger.error(e.getMessage()); + return null; + } + } + + protected Config getConfigFromStringJson(String configJson) throws JsonParseException, JsonMappingException, IOException { + String unescapedJson = configJson.replaceAll("\\\\", ""); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + return mapper.readValue(unescapedJson, Config.class); + } + + protected PolicyRestClient getPolicyRestClient(PolicyServiceType policyServiceType) { + return new PolicyRestClient(this.props, policyServiceType); + } } diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Config.java b/common/src/main/java/org/onap/so/client/policy/entities/Config.java new file mode 100644 index 0000000000..6c9c0759d6 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/policy/entities/Config.java @@ -0,0 +1,217 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.policy.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "configName", + "riskLevel", + "policyName", + "policyScope", + "guard", + "description", + "priority", + "uuid", + "version", + "content", + "riskType", + "service", + "location", + "templateVersion" +}) +@JsonRootName(value = "config") +public class Config { + + @JsonProperty("configName") + private String configName; + @JsonProperty("riskLevel") + private String riskLevel; + @JsonProperty("policyName") + private String policyName; + @JsonProperty("policyScope") + private String policyScope; + @JsonProperty("guard") + private String guard; + @JsonProperty("description") + private String description; + @JsonProperty("priority") + private String priority; + @JsonProperty("uuid") + private String uuid; + @JsonProperty("version") + private String version; + @JsonProperty("content") + private Content content; + @JsonProperty("riskType") + private String riskType; + @JsonProperty("service") + private String service; + @JsonProperty("location") + private String location; + @JsonProperty("templateVersion") + private String templateVersion; + + @JsonProperty("configName") + public String getConfigName() { + return configName; + } + + @JsonProperty("configName") + public void setConfigName(String configName) { + this.configName = configName; + } + + @JsonProperty("riskLevel") + public String getRiskLevel() { + return riskLevel; + } + + @JsonProperty("riskLevel") + public void setRiskLevel(String riskLevel) { + this.riskLevel = riskLevel; + } + + @JsonProperty("policyName") + public String getPolicyName() { + return policyName; + } + + @JsonProperty("policyName") + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + @JsonProperty("policyScope") + public String getPolicyScope() { + return policyScope; + } + + @JsonProperty("policyScope") + public void setPolicyScope(String policyScope) { + this.policyScope = policyScope; + } + + @JsonProperty("guard") + public String getGuard() { + return guard; + } + + @JsonProperty("guard") + public void setGuard(String guard) { + this.guard = guard; + } + + @JsonProperty("description") + public String getDescription() { + return description; + } + + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + @JsonProperty("priority") + public String getPriority() { + return priority; + } + + @JsonProperty("priority") + public void setPriority(String priority) { + this.priority = priority; + } + + @JsonProperty("uuid") + public String getUuid() { + return uuid; + } + + @JsonProperty("uuid") + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @JsonProperty("version") + public String getVersion() { + return version; + } + + @JsonProperty("version") + public void setVersion(String version) { + this.version = version; + } + + @JsonProperty("content") + public Content getContent() { + return content; + } + + @JsonProperty("content") + public void setContent(Content content) { + this.content = content; + } + + @JsonProperty("riskType") + public String getRiskType() { + return riskType; + } + + @JsonProperty("riskType") + public void setRiskType(String riskType) { + this.riskType = riskType; + } + + @JsonProperty("service") + public String getService() { + return service; + } + + @JsonProperty("service") + public void setService(String service) { + this.service = service; + } + + @JsonProperty("location") + public String getLocation() { + return location; + } + + @JsonProperty("location") + public void setLocation(String location) { + this.location = location; + } + + @JsonProperty("templateVersion") + public String getTemplateVersion() { + return templateVersion; + } + + @JsonProperty("templateVersion") + public void setTemplateVersion(String templateVersion) { + this.templateVersion = templateVersion; + } + +} diff --git a/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java b/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java new file mode 100644 index 0000000000..8cd5b93a36 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.policy.entities; + +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "configAttributes", + "configName", + "ecompName", + "onapName", + "policyName", + "requestID", + "unique" +}) +public class ConfigRequestParameters { + + @JsonProperty("configAttributes") + private Map<String, String> configAttributes = new HashMap<>(); + @JsonProperty("configName") + private String configName; + @JsonProperty("ecompName") + private String ecompName; + @JsonProperty("onapName") + private String onapName; + @JsonProperty("policyName") + private String policyName; + @JsonProperty("requestID") + private String requestID; + @JsonProperty("unique") + private Boolean unique; + + @JsonProperty("configAttributes") + public Map<String, String> getConfigAttributes() { + return configAttributes; + } + + @JsonProperty("configAttributes") + public void setConfigAttributes(Map<String, String> configAttributes) { + this.configAttributes = configAttributes; + } + + @JsonProperty("configName") + public String getConfigName() { + return configName; + } + + @JsonProperty("configName") + public void setConfigName(String configName) { + this.configName = configName; + } + + @JsonProperty("ecompName") + public String getEcompName() { + return ecompName; + } + + @JsonProperty("ecompName") + public void setEcompName(String ecompName) { + this.ecompName = ecompName; + } + + @JsonProperty("onapName") + public String getOnapName() { + return onapName; + } + + @JsonProperty("onapName") + public void setOnapName(String onapName) { + this.onapName = onapName; + } + + @JsonProperty("policyName") + public String getPolicyName() { + return policyName; + } + + @JsonProperty("policyName") + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + @JsonProperty("requestID") + public String getRequestID() { + return requestID; + } + + @JsonProperty("requestID") + public void setRequestID(String requestID) { + this.requestID = requestID; + } + + @JsonProperty("unique") + public Boolean getUnique() { + return unique; + } + + @JsonProperty("unique") + public void setUnique(Boolean unique) { + this.unique = unique; + } + +} diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Content.java b/common/src/main/java/org/onap/so/client/policy/entities/Content.java new file mode 100644 index 0000000000..a473f6c566 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/policy/entities/Content.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.policy.entities; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "fabric-config-models" +}) +public class Content { + + @JsonProperty("fabric-config-models") + private List<FabricConfigModel> fabricConfigModels = null; + + @JsonProperty("fabric-config-models") + public List<FabricConfigModel> getFabricConfigModels() { + return fabricConfigModels; + } + + @JsonProperty("fabric-config-models") + public void setFabricConfigModels(List<FabricConfigModel> fabricConfigModels) { + this.fabricConfigModels = fabricConfigModels; + } + +} diff --git a/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java b/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java new file mode 100644 index 0000000000..d1a924cb7d --- /dev/null +++ b/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.policy.entities; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "vnfProfile", + "lagProfile" +}) +public class FabricConfigModel { + + @JsonProperty("vnfProfile") + private String vnfProfile; + @JsonProperty("lagProfile") + private String lagProfile; + + @JsonProperty("vnfProfile") + public String getVnfProfile() { + return vnfProfile; + } + + @JsonProperty("vnfProfile") + public void setVnfProfile(String vnfProfile) { + this.vnfProfile = vnfProfile; + } + + @JsonProperty("lagProfile") + public String getLagProfile() { + return lagProfile; + } + + @JsonProperty("lagProfile") + public void setLagProfile(String lagProfile) { + this.lagProfile = lagProfile; + } + +} diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java new file mode 100644 index 0000000000..807829e323 --- /dev/null +++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java @@ -0,0 +1,166 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.client.policy.entities; + +import java.util.HashMap; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "policyConfigMessage", + "policyConfigStatus", + "type", + "config", + "policyName", + "policyType", + "policyVersion", + "matchingConditions", + "responseAttributes", + "property" +}) +public class PolicyConfig { + + @JsonProperty("policyConfigMessage") + private String policyConfigMessage; + @JsonProperty("policyConfigStatus") + private String policyConfigStatus; + @JsonProperty("type") + private String type; + @JsonProperty("config") + private String config; + @JsonProperty("policyName") + private String policyName; + @JsonProperty("policyType") + private String policyType; + @JsonProperty("policyVersion") + private String policyVersion; + @JsonProperty("matchingConditions") + private Map<String, String> matchingConditions = new HashMap<>(); + @JsonProperty("responseAttributes") + private Map<String, String> responseAttributes = new HashMap<>(); + @JsonProperty("property") + private Object property; + + @JsonProperty("policyConfigMessage") + public String getPolicyConfigMessage() { + return policyConfigMessage; + } + + @JsonProperty("policyConfigMessage") + public void setPolicyConfigMessage(String policyConfigMessage) { + this.policyConfigMessage = policyConfigMessage; + } + + @JsonProperty("policyConfigStatus") + public String getPolicyConfigStatus() { + return policyConfigStatus; + } + + @JsonProperty("policyConfigStatus") + public void setPolicyConfigStatus(String policyConfigStatus) { + this.policyConfigStatus = policyConfigStatus; + } + + @JsonProperty("type") + public String getType() { + return type; + } + + @JsonProperty("type") + public void setType(String type) { + this.type = type; + } + + @JsonProperty("config") + public String getConfig() { + return config; + } + + @JsonProperty("config") + public void setConfig(String config) { + this.config = config; + } + + @JsonProperty("policyName") + public String getPolicyName() { + return policyName; + } + + @JsonProperty("policyName") + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + @JsonProperty("policyType") + public String getPolicyType() { + return policyType; + } + + @JsonProperty("policyType") + public void setPolicyType(String policyType) { + this.policyType = policyType; + } + + @JsonProperty("policyVersion") + public String getPolicyVersion() { + return policyVersion; + } + + @JsonProperty("policyVersion") + public void setPolicyVersion(String policyVersion) { + this.policyVersion = policyVersion; + } + + @JsonProperty("matchingConditions") + public Map<String, String> getMatchingConditions() { + return matchingConditions; + } + + @JsonProperty("matchingConditions") + public void setMatchingConditions(Map<String, String> matchingConditions) { + this.matchingConditions = matchingConditions; + } + + @JsonProperty("responseAttributes") + public Map<String, String> getResponseAttributes() { + return responseAttributes; + } + + @JsonProperty("responseAttributes") + public void setResponseAttributes(Map<String, String> responseAttributes) { + this.responseAttributes = responseAttributes; + } + + @JsonProperty("property") + public Object getProperty() { + return property; + } + + @JsonProperty("property") + public void setProperty(Object property) { + this.property = property; + } + +} diff --git a/common/src/main/java/org/onap/so/exceptions/MSOException.java b/common/src/main/java/org/onap/so/exceptions/MSOException.java new file mode 100644 index 0000000000..f49cd8d8f8 --- /dev/null +++ b/common/src/main/java/org/onap/so/exceptions/MSOException.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.exceptions; + + +public class MSOException extends Exception{ + /** + * + */ + private static final long serialVersionUID = 4563920496855255206L; + private Integer errorCode; + + public MSOException(String msg){ + super(msg); + } + + public MSOException (Throwable e) { + super(e); + } + + public MSOException (String msg, Throwable e) { + super (msg, e); + } + + public MSOException(String msg, int errorCode){ + super(msg); + this.errorCode=errorCode; + } + + public MSOException(String msg, int errorCode, Throwable t){ + super(msg,t); + this.errorCode=errorCode; + } + + public Integer getErrorCode(){ + return errorCode; + } +} diff --git a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java index 0d20dd8bf9..794d02a240 100644 --- a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java +++ b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java @@ -23,6 +23,7 @@ package org.onap.so.logger; import java.net.InetAddress; import java.net.UnknownHostException; +import org.onap.so.utils.UUIDChecker; import org.springframework.stereotype.Component; import ch.qos.logback.classic.Level; @@ -37,6 +38,7 @@ import ch.qos.logback.core.spi.LifeCycle; public class LoggerStartupListener extends ContextAwareBase implements LoggerContextListener, LifeCycle { private boolean started = false; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, LoggerStartupListener.class); @Override public void start() { @@ -46,7 +48,8 @@ public class LoggerStartupListener extends ContextAwareBase implements LoggerCon try { addr = InetAddress.getLocalHost(); } catch (UnknownHostException e) { - e.printStackTrace(); + LOGGER.error("UnknownHostException",e); + } Context context = getContext(); if (addr != null) { diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java index e4cac067ba..94ffa71169 100644 --- a/common/src/main/java/org/onap/so/logger/MsoLogger.java +++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java @@ -31,6 +31,7 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; +import org.apache.commons.lang3.StringUtils; import org.onap.so.entity.MsoRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,13 +61,26 @@ public class MsoLogger { public static final String RESPONSECODE = "ResponseCode"; public static final String RESPONSEDESC = "ResponseDesc"; public static final String FQDN = "ServerFQDN"; + public static final String ENTRY_TIMESTAMP = "EntryTimestamp"; + public static final String CLIENT_IPADDRESS = "EntryTimestamp"; - public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; + //HTTP Headers + public static final String HEADER_FROM_APP_ID = "X-FromAppId"; + public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName"; + public static final String HEADER_REQUEST_ID = "X-RequestId"; + public static final String TRANSACTION_ID = "X-TransactionID"; + public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; + public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; + public static final String CLIENT_ID = "X-ClientID"; + public static final String INVOCATION_ID_HEADER = "X-InvocationID"; + //Default values for not found + public static final String UNKNOWN_PARTNER = "UnknownPartner"; + + public static final String SERVICE_INSTANCE_ID = "ServiceInstanceId"; public static final String SERVICE_NAME_IS_METHOD_NAME = "ServiceNameIsMethodName"; - public static final String SERVER_IP = "ServerIPAddress"; - + public static final String SERVER_IP = "ServerIPAddress"; public static final String REMOTE_HOST = "RemoteHost"; public static final String ALERT_SEVERITY = "AlertSeverity"; @@ -77,16 +91,15 @@ public class MsoLogger { public static final String CAT_LOG_LEVEL = "CategoryLogLevel"; public static final String AUDI_CAT_LOG_LEVEL = "AuditCategoryLogLevel"; - //For getting an identity of calling application - public static final String HEADER_FROM_APP_ID = "X-FromAppId"; - public static final String FROM_APP_ID = "FromAppId"; - public static final String HEADER_REQUEST_ID = "X-RequestId"; - public static final String TRANSACTION_ID = "X-TransactionID"; - public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; - public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID"; + + + public static final String PARTNER_NAME = "PartnerName"; + - public static final String CLIENT_ID = "X-ClientID"; - public static final String INVOCATION_ID_HEADER = "X-InvocationID"; + + + + // Audit/Metric log specific public static final String BEGINTIME = "BeginTimestamp"; @@ -279,7 +292,9 @@ public class MsoLogger { public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode, String responseDesc) { - MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN"); + if (StringUtils.isEmpty(MDC.get(MsoLogger.PARTNERNAME))) { + MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN"); + } prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc); auditLogger.info(""); MDC.remove(TIMER); diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java new file mode 100644 index 0000000000..49dc71e773 --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java @@ -0,0 +1,158 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.jaxrs.filter; + + +import org.apache.commons.io.IOUtils; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.utils.TargetEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.slf4j.MarkerFactory; +import org.springframework.stereotype.Component; +import javax.annotation.Priority; +import javax.ws.rs.client.ClientRequestContext; +import javax.ws.rs.client.ClientRequestFilter; +import javax.ws.rs.client.ClientResponseContext; +import javax.ws.rs.client.ClientResponseFilter; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Providers; +import java.io.*; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; +import java.util.UUID; + +@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") +@Component +@Priority(0) +public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFilter { + + @Context + private Providers providers; + + private static final String TRACE = "trace-#"; + private static final String SO = "SO"; + private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class); + + public void setTargetService(TargetEntity targetEntity){ + MDC.put("TargetEntity", targetEntity.toString()); + } + + @Override + public void filter(ClientRequestContext clientRequest) { + try{ + setupMDC(clientRequest); + setupHeaders(clientRequest); + logger.info(ONAPLogConstants.Markers.INVOKE, "Invoke"); + } catch (Exception e) { + logger.warn("Error in incoming JAX-RS Inteceptor", e); + } + } + + private void setupHeaders(ClientRequestContext clientRequest) { + MultivaluedMap<String, Object> headers = clientRequest.getHeaders(); + headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest)); + headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO); + } + + private void setupMDC(ClientRequestContext clientRequest) { + MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP, ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString()); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); + setInvocationId(); + MDC.put("TargetEntity",MDC.get("TargetEntity")); + } + + private String extractRequestID(ClientRequestContext clientRequest) { + String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); + if(requestId == null || requestId.isEmpty() || requestId.equals(TRACE)){ + requestId = UUID.randomUUID().toString(); + logger.warn("Could not Find Request ID Generating New One: {}",clientRequest.getUri().getPath()); + } + return requestId; + } + + private void setInvocationId() { + String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); + } + + + @Override + public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) { + + try { + String statusCode; + if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); + }else{ + statusCode=ONAPLogConstants.ResponseStatus.ERROR.toString(); + } + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus())); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,getStringFromInputStream(responseContext)); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); + logger.info(MarkerFactory.getMarker("INVOKE_RETURN"), "InvokeReturn"); + clearClientMDCs(); + } catch ( Exception e) { + logger.warn("Error in outgoing JAX-RS Inteceptor", e); + } + } + + private void clearClientMDCs() { + MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION); + MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE); + } + + private static String getStringFromInputStream(ClientResponseContext clientResponseContext) { + + InputStream is = clientResponseContext.getEntityStream(); + ByteArrayOutputStream boas = new ByteArrayOutputStream(); + + try { + IOUtils.copy(is,boas); + InputStream copiedStream = new ByteArrayInputStream(boas.toByteArray()); + clientResponseContext.setEntityStream(copiedStream); + return boas.toString(); + + } catch (IOException e) { + logger.warn("Failed to read response body", e); + } + return "Unable to read input stream"; + } + +} diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java index d278a5f761..7d02136860 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java @@ -18,19 +18,14 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.logging.jaxrs.filter.jersey; +package org.onap.so.logging.jaxrs.filter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Locale; import java.util.UUID; - import javax.annotation.Priority; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.container.ContainerRequestContext; @@ -44,7 +39,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; -import org.onap.so.logger.MsoLogger; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; @@ -56,120 +51,65 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Provider @Component public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerResponseFilter { - - protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class); + + protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class); @Context private HttpServletRequest httpServletRequest; @Context private Providers providers; - + @Autowired - ObjectMapper objectMapper; + private MDCSetup mdcSetup; @Override - public void filter(ContainerRequestContext containerRequest) { - + public void filter(ContainerRequestContext containerRequest) { try { - String clientID = null; - //check headers for request id MultivaluedMap<String, String> headers = containerRequest.getHeaders(); - String requestId = findRequestId(headers); - containerRequest.setProperty("requestId", requestId); - if(headers.containsKey(MsoLogger.CLIENT_ID)){ - clientID = headers.getFirst(MsoLogger.CLIENT_ID); - }else{ - clientID = "UNKNOWN"; - headers.add(MsoLogger.CLIENT_ID, clientID); - } - - String remoteIpAddress = ""; - if (httpServletRequest != null) { - remoteIpAddress = httpServletRequest.getRemoteAddr(); - } - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - - String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID ); - if(partnerName == null || partnerName.isEmpty()) - partnerName="UNKNOWN"; - - MDC.put(MsoLogger.REQUEST_ID,requestId); - MDC.put(MsoLogger.INVOCATION_ID,requestId); - MDC.put(MsoLogger.FROM_APP_ID,partnerName); - MDC.put(MsoLogger.SERVICE_NAME, containerRequest.getUriInfo().getPath()); - MDC.put(MsoLogger.INVOCATION_ID, findInvocationId(headers)); - MDC.put(MsoLogger.STATUSCODE, MsoLogger.INPROGRESS); - MDC.put(MsoLogger.BEGINTIME, formatter.format(instant)); - MDC.put(MsoLogger.PARTNERNAME,partnerName); - MDC.put(MsoLogger.REMOTE_HOST, String.valueOf(remoteIpAddress)); - MDC.put(MsoLogger.STARTTIME, String.valueOf(System.currentTimeMillis())); - logger.debug(MsoLogger.ENTRY, "Entering."); + setRequestId(headers); + containerRequest.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + setInvocationId(headers); + setServiceName(containerRequest); + setMDCPartnerName(headers); + mdcSetup.setServerFQDN(); + mdcSetup.setClientIPAddress(httpServletRequest); + mdcSetup.setInstanceUUID(); + mdcSetup.setEntryTimeStamp(); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); } catch (Exception e) { logger.warn("Error in incoming JAX-RS Inteceptor", e); } } - - private String findRequestId(MultivaluedMap<String, String> headers) { - String requestId = (String) headers.getFirst(MsoLogger.HEADER_REQUEST_ID ); - if(requestId == null || requestId.isEmpty()){ - if(headers.containsKey(MsoLogger.ONAP_REQUEST_ID)){ - requestId = headers.getFirst(MsoLogger.ONAP_REQUEST_ID); - }else if(headers.containsKey(MsoLogger.ECOMP_REQUEST_ID)){ - requestId = headers.getFirst(MsoLogger.ECOMP_REQUEST_ID); - }else{ - requestId = UUID.randomUUID().toString(); - } - } - return requestId; - } - - private String findInvocationId(MultivaluedMap<String, String> headers) { - String invocationId = (String) headers.getFirst(MsoLogger.INVOCATION_ID_HEADER ); - if(invocationId == null || invocationId.isEmpty()) - invocationId =UUID.randomUUID().toString(); - return invocationId; - } - @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { try { - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - String startTime= MDC.get(MsoLogger.STARTTIME); - long elapsedTime; - try { - elapsedTime = System.currentTimeMillis() - Long.parseLong(startTime); - }catch(NumberFormatException e){ - elapsedTime = 0; - } - String statusCode; - if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ - statusCode=MsoLogger.COMPLETE; - }else{ - statusCode= MsoLogger.StatusCode.ERROR.toString(); - } - - MDC.put(MsoLogger.RESPONSEDESC,payloadMessage(responseContext)); - MDC.put(MsoLogger.STATUSCODE, statusCode); - MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus())); - MDC.put(MsoLogger.TIMER, String.valueOf(elapsedTime)); - MDC.put(MsoLogger.ENDTIME,formatter.format(instant)); - logger.debug(MsoLogger.EXIT, "Exiting."); + setResponseStatusCode(responseContext); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,payloadMessage(responseContext)); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE,String.valueOf(responseContext.getStatus())); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting."); + MDC.clear(); } catch ( Exception e) { + MDC.clear(); logger.warn("Error in outgoing JAX-RS Inteceptor", e); } + } + + private void setResponseStatusCode(ContainerResponseContext responseContext) { + String statusCode; + if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); + }else{ + statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString(); + } + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); } private String payloadMessage(ContainerResponseContext responseContext) throws IOException { - String message = new String(); + String message = ""; if (responseContext.hasEntity()) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Class<?> entityClass = responseContext.getEntityClass(); @@ -192,4 +132,38 @@ public class JaxRsFilterLogging implements ContainerRequestFilter,ContainerRespo } return message; } + + + private void setRequestId(MultivaluedMap<String, String> headers){ + String requestId=headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID); + if(requestId == null || requestId.isEmpty()) + requestId = UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); + } + + private void setInvocationId(MultivaluedMap<String, String> headers){ + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, findInvocationId(headers)); + } + + private void setMDCPartnerName(MultivaluedMap<String, String> headers){ + String partnerName=headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME); + if(partnerName == null || partnerName.isEmpty()) + partnerName = ""; + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); + } + + private String findInvocationId(MultivaluedMap<String, String> headers) { + String invocationId = headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + return invocationId; + } + + private void setServiceName(ContainerRequestContext containerRequest){ + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath()); + } + + + + } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java new file mode 100644 index 0000000000..f0a16561aa --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.jaxrs.filter; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; +import java.util.UUID; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.Response; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; + +@Component +public class MDCSetup { + + protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class); + + private static final String INSTANCE_UUID = UUID.randomUUID().toString(); + + public void setInstanceUUID(){ + MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID); + } + + public void setServerFQDN(){ + String serverFQDN = ""; + InetAddress addr= null; + try { + addr = InetAddress.getLocalHost(); + serverFQDN = addr.toString(); + } catch (UnknownHostException e) { + logger.warn("Cannot Resolve Host Name"); + serverFQDN = ""; + } + MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN); + } + + public void setClientIPAddress(HttpServletRequest httpServletRequest){ + String remoteIpAddress = ""; + if (httpServletRequest != null) { + remoteIpAddress = httpServletRequest.getRemoteAddr(); + } + MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress); + } + + public void setEntryTimeStamp() { + MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + } + + public void setServiceName(HttpServletRequest request) { + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); + } + + public void setRequestId(Map<String, String> headers) { + String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID); + if(requestId == null || requestId.isEmpty()) + requestId = UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); + } + + public void setInvocationId(Map<String, String> headers) { + String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); + } + + public void setMDCPartnerName(Map<String, String> headers) { + String partnerName=headers.get(ONAPLogConstants.Headers.PARTNER_NAME); + if(partnerName == null || partnerName.isEmpty()) + partnerName = ""; + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); + } + + + public void setResponseStatusCode(HttpServletResponse response) { + String statusCode; + if(Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); + }else{ + statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString(); + } + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); + } +} diff --git a/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java index 83cf08f77f..29264f4e42 100644 --- a/common/src/main/java/org/onap/so/client/policy/LoggingFilter.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.client.policy; +package org.onap.so.logging.jaxrs.filter; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; @@ -40,22 +40,24 @@ import javax.ws.rs.ext.WriterInterceptor; import javax.ws.rs.ext.WriterInterceptorContext; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @Provider -@Priority(0) -public class LoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor { +@Priority(1) +public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor { - private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingFilter.class); + private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class); private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream"; private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; private final int maxEntitySize; - public LoggingFilter() { + public PayloadLoggingFilter() { maxEntitySize = 1024 * 1024; } - public LoggingFilter(int maxPayloadSize) { + public PayloadLoggingFilter(int maxPayloadSize) { this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024); } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java index 0477c9a429..6af7a916d0 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/SpringClientFilter.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.logging.jaxrs.filter.jersey; +package org.onap.so.logging.jaxrs.filter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java deleted file mode 100644 index 2888cbf3a1..0000000000 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/jersey/JaxRsClientLogging.java +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.logging.jaxrs.filter.jersey; - - -import org.apache.commons.io.IOUtils; -import org.onap.so.logger.MsoLogger; -import org.onap.so.utils.TargetEntity; -import org.slf4j.MDC; -import org.springframework.stereotype.Component; - -import javax.ws.rs.client.ClientRequestContext; -import javax.ws.rs.client.ClientRequestFilter; -import javax.ws.rs.client.ClientResponseContext; -import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Response; - -import java.io.*; - -import java.time.Instant; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Locale; -import java.util.UUID; - -@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") -@Component -public class JaxRsClientLogging implements ClientRequestFilter,ClientResponseFilter { - - private static MsoLogger logger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,JaxRsClientLogging.class); - - private TargetEntity targetEntity; - - public void setTargetService(TargetEntity targetEntity){ - this.targetEntity = targetEntity; - } - - @Override - public void filter(ClientRequestContext clientRequest) { - try{ - MultivaluedMap<String, Object> headers = clientRequest.getHeaders(); - - - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - - String requestId = MDC.get(MsoLogger.REQUEST_ID); - if(requestId == null || requestId.isEmpty()){ - requestId = UUID.randomUUID().toString(); - logger.warnSimple(clientRequest.getUri().getPath(),"Could not Find Request ID Generating New One"); - } - - MDC.put(MsoLogger.METRIC_BEGIN_TIME, formatter.format(instant)); - MDC.put(MsoLogger.METRIC_START_TIME, String.valueOf(System.currentTimeMillis())); - MDC.put(MsoLogger.REQUEST_ID,requestId); - MDC.put(MsoLogger.TARGETSERVICENAME, clientRequest.getUri().toString()); - } catch (Exception e) { - logger.warnSimple("Error in incoming JAX-RS Inteceptor", e); - } - } - - - @Override - public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) { - - try { - Instant instant = Instant.now(); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ) - .withLocale( Locale.US ) - .withZone( ZoneId.systemDefault() ); - String startTime= MDC.get(MsoLogger.METRIC_START_TIME); - - long elapsedTime = System.currentTimeMillis()-Long.parseLong(startTime); - String statusCode; - if(Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ - statusCode=MsoLogger.COMPLETE; - }else{ - statusCode=MsoLogger.StatusCode.ERROR.toString(); - } - MultivaluedMap<String, String> headers = responseContext.getHeaders(); - - String partnerName = headers.getFirst(MsoLogger.HEADER_FROM_APP_ID ); - if(partnerName == null || partnerName.isEmpty()) - partnerName="UNKNOWN"; - MDC.put(MsoLogger.RESPONSEDESC,getStringFromInputStream(responseContext)); - MDC.put(MsoLogger.STATUSCODE, statusCode); - MDC.put(MsoLogger.RESPONSECODE,String.valueOf(responseContext.getStatus())); - MDC.put(MsoLogger.METRIC_TIMER, String.valueOf(elapsedTime)); - MDC.put(MsoLogger.METRIC_END_TIME,formatter.format(instant)); - MDC.put(MsoLogger.PARTNERNAME,partnerName); - MDC.put(MsoLogger.TARGETENTITY, targetEntity.toString()); - logger.recordMetricEvent(); - } catch ( Exception e) { - logger.warnSimple("Error in outgoing JAX-RS Inteceptor", e); - } - } - - private static String getStringFromInputStream(ClientResponseContext clientResponseContext) { - - InputStream is = clientResponseContext.getEntityStream(); - ByteArrayOutputStream boas = new ByteArrayOutputStream(); - - try { - IOUtils.copy(is,boas); - InputStream copiedStream = new ByteArrayInputStream(boas.toByteArray()); - clientResponseContext.setEntityStream(copiedStream); - return boas.toString(); - - } catch (IOException e) { - logger.warnSimple("Failed to read response body", e); - } - return "Unable to read input stream"; - } -} diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java new file mode 100644 index 0000000000..194a445ce2 --- /dev/null +++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.spring.interceptor; + +import java.util.Collections; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.Providers; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logging.jaxrs.filter.MDCSetup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.ModelAndView; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; + +@Component +public class LoggingInterceptor extends HandlerInterceptorAdapter { + + Logger logger = LoggerFactory.getLogger(LoggingInterceptor.class); + + @Autowired + MDCSetup mdcSetup; + + @Context + private Providers providers; + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) + throws Exception { + Map<String, String> headers = Collections.list(((HttpServletRequest) request).getHeaderNames()) + .stream() + .collect(Collectors.toMap(h -> h, request::getHeader)); + setRequestId(headers); + setInvocationId(headers); + setServiceName(request); + setMDCPartnerName(headers); + mdcSetup.setClientIPAddress(request); + mdcSetup.setEntryTimeStamp(); + mdcSetup.setInstanceUUID(); + mdcSetup.setServerFQDN(); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); + return true; + } + + @Override + public void postHandle( + HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) + throws Exception { + setResponseStatusCode(response); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION,""); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE,String.valueOf(response.getStatus())); + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting."); + MDC.clear(); + } + + private void setResponseStatusCode(HttpServletResponse response) { + String statusCode; + if(Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)){ + statusCode=ONAPLogConstants.ResponseStatus.COMPLETED.toString(); + }else{ + statusCode= ONAPLogConstants.ResponseStatus.ERROR.toString(); + } + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); + } + + private void setServiceName(HttpServletRequest request) { + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI()); + } + + private void setRequestId(Map<String, String> headers) { + String requestId=headers.get(ONAPLogConstants.Headers.REQUEST_ID); + if(requestId == null || requestId.isEmpty()) + requestId = UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); + } + + private void setInvocationId(Map<String, String> headers) { + String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID); + if(invocationId == null || invocationId.isEmpty()) + invocationId =UUID.randomUUID().toString(); + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); + } + + private void setMDCPartnerName(Map<String, String> headers) { + String partnerName=headers.get(ONAPLogConstants.Headers.PARTNER_NAME); + if(partnerName == null || partnerName.isEmpty()) + partnerName = ""; + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); + } + + +} diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java index bda3096f05..8e7e5e945e 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java @@ -20,9 +20,10 @@ package org.onap.so.serviceinstancebeans; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; -import org.apache.commons.lang3.builder.ToStringBuilder; @JsonInclude(Include.NON_DEFAULT) @@ -35,6 +36,7 @@ public class Request { protected RequestDetails requestDetails; protected InstanceReferences instanceReferences; protected RequestStatus requestStatus; + protected List<RequestProcessingData> requestProcessingData; public String getRequestId() { @@ -79,12 +81,19 @@ public class Request { public void setRequestDetails(RequestDetails requestDetails) { this.requestDetails = requestDetails; } + public List<RequestProcessingData> getRequestProcessingData() { + return requestProcessingData; + } + public void setRequestProcessingData(List<RequestProcessingData> requestProcessingData) { + this.requestProcessingData = requestProcessingData; + } @Override public String toString() { - return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime) - .append("requestScope", requestScope).append("requestType", requestType) - .append("requestDetails", requestDetails).append("instanceReferences", instanceReferences) - .append("requestStatus", requestStatus).toString(); + return "Request [requestId=" + requestId + ", startTime=" + startTime + + ", requestScope=" + requestScope + ", requestType=" + requestType + + ", requestDetails=" + requestDetails + ", instanceReferences=" + instanceReferences + + ", requestStatus=" + requestStatus + ", requestProcessingData=" + requestProcessingData + "]"; } + } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java new file mode 100644 index 0000000000..3373f78335 --- /dev/null +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java @@ -0,0 +1,62 @@ +/* ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.serviceinstancebeans; + +import java.util.HashMap; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import org.apache.commons.lang3.builder.ToStringBuilder; + + +@JsonInclude(Include.NON_DEFAULT) +public class RequestProcessingData { + + protected String groupingId; + protected String tag; + protected List<HashMap<String, String>> dataPairs; + + public String getGroupingId() { + return groupingId; + } + public void setGroupingId(String groupingId) { + this.groupingId = groupingId; + } + public String getTag() { + return tag; + } + public void setTag(String tag) { + this.tag = tag; + } + public List<HashMap<String, String>> getDataPairs() { + return dataPairs; + } + public void setDataPairs(List<HashMap<String, String>> dataPairs) { + this.dataPairs = dataPairs; + } + @Override + public String toString() { + return new ToStringBuilder(this).append("groupingId", groupingId).append("tag", tag) + .append("dataPairs", dataPairs).toString(); + } + + +} diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java index ad76e56a56..84dae957ba 100644 --- a/common/src/main/java/org/onap/so/utils/TargetEntity.java +++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java @@ -20,13 +20,22 @@ package org.onap.so.utils; +import java.util.EnumSet; public enum TargetEntity { OPENSTACK_ADAPTER, BPMN, GRM ,AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, NARAD; - private static final String PREFIX = "MSO"; + private static final String PREFIX = "SO"; + + public static EnumSet<TargetEntity> getSOInternalComponents() { + return EnumSet.of(OPENSTACK_ADAPTER, BPMN,CATALOG_DB,REQUEST_DB,VNF_ADAPTER,SDNC_ADAPTER); + } + @Override public String toString(){ - return TargetEntity.PREFIX + "." + this.name(); + if(getSOInternalComponents().contains(this)) + return TargetEntity.PREFIX + "." + this.name(); + else + return this.name(); } -} +}
\ No newline at end of file diff --git a/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java b/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java deleted file mode 100644 index 29ac91c864..0000000000 --- a/common/src/test/java/org/onap/so/adapter_utils/tests/MsoLoggerTest.java +++ /dev/null @@ -1,331 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapter_utils.tests; - -import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.MessageEnum; -import org.onap.so.logger.MsoLogger; -import org.onap.so.logger.MsoLogger.ErrorCode; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.slf4j.MDC; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintWriter; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; - -/** - * This class implements all test methods of the MsoLogger features. - * - * - */ -public class MsoLoggerTest { - - static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, MsoLoggerTest.class); - - /** - * This method is called before any test occurs. It creates a fake tree from - * scratch - */ - @BeforeClass - public static final void prepare() { - - } - - @Before - public final void cleanErrorLogFile() throws FileNotFoundException { - URL url = this.getClass().getClassLoader().getResource("logback-test.xml"); - String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) - + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log"; - PrintWriter asdcConfigFileWriter = new PrintWriter(logFile); - asdcConfigFileWriter.print(""); - asdcConfigFileWriter.flush(); - asdcConfigFileWriter.close(); - } - - @Before - public final void cleanMetricLogFile() throws FileNotFoundException { - URL url = this.getClass().getClassLoader().getResource("logback-test.xml"); - String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) - + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log"; - PrintWriter asdcConfigFileWriter = new PrintWriter(logFile); - asdcConfigFileWriter.print(""); - asdcConfigFileWriter.flush(); - asdcConfigFileWriter.close(); - } - - @Before - public final void cleanAuditLogFile() throws FileNotFoundException { - URL url = this.getClass().getClassLoader().getResource("logback-test.xml"); - String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) - + "/MSO/Test/auditjbo.server.name_IS_UNDEFINED.log"; - PrintWriter asdcConfigFileWriter = new PrintWriter(logFile); - asdcConfigFileWriter.print(""); - asdcConfigFileWriter.flush(); - asdcConfigFileWriter.close(); - } - - /** - * This method implements a test of getSeverifyLevel method. - */ - @Test - public final void testGetSeverityLevel() { - - try { - String levelInfo = (String) invokePriveMethod("getSeverityLevel", "INFO"); - Assert.assertEquals(levelInfo, "0"); - - String levelWarn = (String) invokePriveMethod("getSeverityLevel", "WARN"); - Assert.assertEquals(levelWarn, "1"); - - String levelERROR = (String) invokePriveMethod("getSeverityLevel", "ERROR"); - Assert.assertEquals(levelERROR, "2"); - - String levelDEBUG = (String) invokePriveMethod("getSeverityLevel", "DEBUG"); - Assert.assertEquals(levelDEBUG, "0"); - - String levelFATAL = (String) invokePriveMethod("getSeverityLevel", "FATAL"); - Assert.assertEquals(levelFATAL, "3"); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /** - * This method implements a test of getFinalServiceName method. - */ - @Test - public final void testGetFinalServiceName() { - try { - String serviceName1 = (String) invokePriveMethod("getFinalServiceName", "testServiceName1"); - Assert.assertEquals(serviceName1, "testServiceName1"); - - MsoLogger.setServiceName("testServiceName2"); - String serviceName2 = (String) invokePriveMethod("getFinalServiceName", "testServiceName1"); - Assert.assertEquals(serviceName2, "testServiceName1"); - - String msgNull = null; - String serviceName3 = (String) invokePriveMethod("getFinalServiceName", msgNull); - Assert.assertEquals(serviceName3, "testServiceName2"); - - MsoLogger.resetServiceName(); - String serviceName4 = (String) invokePriveMethod("getFinalServiceName", msgNull); - Assert.assertEquals(serviceName4, "invoke0"); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public final void testPrepareMsg() { - try { - String msgNull = null; - MDC.clear(); - invokePrepareMsg("INFO", null, null); - - Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("trace-#") - && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("trace-#") - && MDC.get(MsoLogger.SERVICE_NAME).equals("invoke0") && MDC.get(MsoLogger.TIMER) == null - && MDC.get(MsoLogger.ALERT_SEVERITY).equals("0")); - - MsoLogger.setLoggerParameters("testRemoteIp", "testUser"); - MsoLogger.setLogContext("testReqId", "testSvcId"); - invokePrepareMsg("ERROR", "testServiceName3", null); - Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") - && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") - && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName3") && MDC.get(MsoLogger.TIMER) == null - && MDC.get(MsoLogger.ALERT_SEVERITY).equals("2")); - - MsoLogger.setServiceName("testServiceName2"); - invokePrepareMsg("WARN", msgNull, msgNull); - Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("testReqId") - && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("testSvcId") - && MDC.get(MsoLogger.SERVICE_NAME).equals("testServiceName2") && MDC.get(MsoLogger.TIMER) == null - && MDC.get(MsoLogger.ALERT_SEVERITY).equals("1")); - - MDC.clear(); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("reqId2"); - msoRequest.setServiceInstanceId("servId2"); - MsoLogger.setLogContext(msoRequest); - invokePrepareMsg("FATAL", null, "123"); - Assert.assertTrue(MDC.get(MsoLogger.REQUEST_ID).equals("reqId2") - && MDC.get(MsoLogger.SERVICE_INSTANCE_ID).equals("servId2") - && MDC.get(MsoLogger.TIMER).equals("123") && MDC.get(MsoLogger.ALERT_SEVERITY).equals("3")); - - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /** - * This method implements a test of log methods - */ - @Test - @Ignore - public final void testLogMethods() { - try { - MDC.clear(); - MsoLogger.setLogContext("reqId2", "servId2"); - MsoLogger.setServiceName("MSO.testServiceName"); - msoLogger.info(MessageEnum.LOGGER_UPDATE_SUC, "testLogger", "INFO", "DEBUG", "target entity", - "target service"); - msoLogger.warn(MessageEnum.GENERAL_WARNING, "warning test", "", "", MsoLogger.ErrorCode.UnknownError, - "warning test"); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "target entity", "target service", - MsoLogger.ErrorCode.UnknownError, "error test"); - - // Fetch from the error log - URL url = this.getClass().getClassLoader().getResource("logback-test.xml"); - String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) - + "/MSO/Test/errorjboss.server.name_IS_UNDEFINED.log"; - - Path filePath = new File(logFile).toPath(); - Charset charset = Charset.defaultCharset(); - List<String> stringList = Files.readAllLines(filePath, charset); - String[] stringArray = stringList.toArray(new String[] {}); - int size = stringArray.length; - - Assert.assertTrue(stringArray[size - 3] - .contains("|reqId2|main|MSO.testServiceName||target entity|target service|INFO|null||") - && stringArray[size - 3].contains( - "||MSO-GENERAL-5408I Successfully update Logger: testLogger from level INFO to level DEBUG")); - Assert.assertTrue(stringArray[size - 2] - .contains("|reqId2|main|MSO.testServiceName||||WARN|UnknownError|warning test|") - && stringArray[size - 2].contains("|MSO-GENERAL-5401W WARNING: warning test")); - Assert.assertTrue(stringArray[size - 1].contains( - "|reqId2|main|MSO.testServiceName||target entity|target service|ERROR|UnknownError|error test|") - && stringArray[size - 1].contains("|MSO-GENERAL-9401E Exception encountered")); - - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - /** - * This method implements a test of recordMetricEvent method. - * - * @throws IOException - */ - @Test - @Ignore - public final void testRecordMetricEvent() throws IOException { - MDC.clear(); - MsoLogger.setLogContext("reqId", "servId"); - msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful", - "VNF", "createVNF", null); - MDC.put(MsoLogger.REMOTE_HOST, "127.0.0.1"); - MDC.put(MsoLogger.PARTNERNAME, "testUser"); - msoLogger.recordMetricEvent(123456789L, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.ServiceNotAvailable, - "Exception", "SDNC", "removeSDNC", "testVNF"); - - // Fetch from the metric log - URL url = this.getClass().getClassLoader().getResource("logback-test.xml"); - String logFile = url.getFile().substring(0, url.getFile().indexOf("test-classes")) - + "/MSO/Test/metricsjboss.server.name_IS_UNDEFINED.log"; - - Path filePath = new File(logFile).toPath(); - Charset charset = Charset.defaultCharset(); - List<String> stringList = Files.readAllLines(filePath, charset); - String[] stringArray = stringList.toArray(new String[] {}); - msoLogger.error(MessageEnum.GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.UnknownError, "test error msg"); - - Assert.assertTrue(stringArray[0] - .contains("|reqId|servId|main||testRecordMetricEvent||VNF|createVNF|COMPLETE|0|Successful|")); - // count the occurance of symbol "|" - Assert.assertTrue((stringArray[0].length() - stringArray[0].replace("|", "").length()) == 28); - Assert.assertTrue(stringArray[1] - .contains("|reqId|servId|main||testRecordMetricEvent|testUser|SDNC|removeSDNC|ERROR|501|Exception|") - && stringArray[1].contains("|127.0.0.1||||testVNF|||||")); - Assert.assertTrue((stringArray[1].length() - stringArray[1].replace("|", "").length()) == 28); - } - - /** - * This method implements a test of testRecordAuditEvent method. - */ - - // User reflection to invoke to avoid change the publicity of the method - private static String invokePrepareMsg(String arg1, String arg2, String arg3) { - Method method; - try { - method = MsoLogger.class.getDeclaredMethod("prepareMsg", String.class, String.class, String.class); - method.setAccessible(true); - return (String) method.invoke(msoLogger, arg1, arg2, arg3); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } - - // User reflection to invoke to avoid change the publicity of the method - private static Object invokePriveMethod(String methodName, String arg) { - Method method; - try { - method = MsoLogger.class.getDeclaredMethod(methodName, String.class); - method.setAccessible(true); - return method.invoke(msoLogger, arg); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return null; - } -} diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java index ce90ccdc0e..ea842719e8 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java @@ -52,4 +52,18 @@ public class AAIObjectTypeTest { AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id); assertEquals("/network/collections/collection/test1", aaiUri.build().toString()); } + + @Test + public void genericVnfTest() { + AAIObjectType type = AAIObjectType.GENERIC_VNF; + assertEquals("/network/generic-vnfs/generic-vnf/{vnf-id}", type.uriTemplate()); + assertEquals("/generic-vnfs/generic-vnf/{vnf-id}", type.partialUri()); + } + + @Test + public void pInterfaceTest() { + AAIObjectType type = AAIObjectType.P_INTERFACE; + assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}", type.uriTemplate()); + assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri()); + } } diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java index 1e2e7471f1..37188bc4bc 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java @@ -44,6 +44,7 @@ public class AAIPServerTest { List<Pserver> list = client.getListOfPservers(json); assertEquals("", list.get(0).getHostname(), "test"); + assertEquals("", list.size(), 2); } @Test diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java index efd60a36a8..3d23213ff0 100644 --- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java +++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.client.aai; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; diff --git a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java index e40c25a2e2..d4bf1b0224 100644 --- a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java +++ b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java @@ -102,8 +102,12 @@ public class AAIResultWrapperTest { assertEquals(Optional.empty(), wrapper.asBean(GenericVnf.class)); assertEquals(true, wrapper.asMap().isEmpty()); assertEquals("{}", wrapper.toString()); - - } + + @Test + public void objectConstructor() { + AAIResultWrapper wrapper = new AAIResultWrapper(new GenericVnf()); + assertEquals("{}", wrapper.getJson()); + } } diff --git a/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java index 3cce6a626b..7b783762fa 100644 --- a/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java +++ b/common/src/test/java/org/onap/so/client/grm/GRMClientTest.java @@ -24,9 +24,11 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; - +import static org.junit.Assert.fail; import java.io.File; import java.nio.file.Files; import java.util.ArrayList; @@ -43,6 +45,7 @@ import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.grm.beans.OperationalInfo; import org.onap.so.client.grm.beans.Property; import org.onap.so.client.grm.beans.ServiceEndPoint; @@ -54,8 +57,7 @@ import org.onap.so.client.grm.exceptions.GRMClientCallFailed; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.junit.WireMockRule; -import org.onap.so.logger.MsoLogger; -import org.onap.so.logger.MsoLogger.Catalog; + import org.onap.so.utils.TestAppender; public class GRMClientTest { @@ -66,6 +68,8 @@ public class GRMClientTest { @Rule public ExpectedException thrown = ExpectedException.none(); + private static final String uuidRegex = "(?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-5][0-9a-f]{3}-?[089ab][0-9a-f]{3}-?[0-9a-f]{12}$"; + @BeforeClass public static void setUp() throws Exception { System.setProperty("mso.config.path", "src/test/resources"); @@ -81,25 +85,45 @@ public class GRMClientTest { .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", MediaType.APPLICATION_JSON) - .withHeader("X-FromAppId", "GRM") .withBody(endpoints))); - MDC.put(MsoLogger.SERVICE_NAME, "my-value"); + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, "/test"); GRMClient client = new GRMClient(); ServiceEndPointList sel = client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST"); List<ServiceEndPoint> list = sel.getServiceEndPointList(); assertEquals(3, list.size()); - ILoggingEvent logEvent = TestAppender.events.get(0); - Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.METRIC_BEGIN_TIME)); - assertNotNull(mdc.get(MsoLogger.METRIC_END_TIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); - assertNotNull(mdc.get(MsoLogger.METRIC_TIMER)); - assertEquals("200",mdc.get(MsoLogger.RESPONSECODE)); - assertEquals("GRM",mdc.get(MsoLogger.PARTNERNAME)); - assertEquals("expect value to not be overwritten by jax rs client interceptor", "my-value",mdc.get(MsoLogger.SERVICE_NAME)); - assertEquals("COMPLETE",mdc.get(MsoLogger.STATUSCODE)); - assertNotNull(mdc.get(MsoLogger.RESPONSEDESC)); + + boolean foundInvoke = false; + boolean foundInvokeReturn = false; + for(ILoggingEvent logEvent : TestAppender.events) + if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") && + logEvent.getMarker().getName().equals("INVOKE") + ){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("GRM",mdc.get("TargetEntity")); + assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + foundInvoke=true; + }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging") && + logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("INVOKE_RETURN")){ + Map<String,String> mdc = logEvent.getMDCPropertyMap(); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); + assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); + assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); + foundInvokeReturn=true; + } + + if(!foundInvoke) + fail("INVOKE Marker not found"); + + if(!foundInvokeReturn) + fail("INVOKE RETURN Marker not found"); + + verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) + .withHeader(ONAPLogConstants.Headers.INVOCATION_ID.toString(), matching(uuidRegex)) + .withHeader(ONAPLogConstants.Headers.REQUEST_ID.toString(), matching(uuidRegex)) + .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO"))); + TestAppender.events.clear(); } @Test @@ -116,68 +140,6 @@ public class GRMClientTest { client.findRunningServices("TEST.ECOMP_PSL.*", 1, "TEST"); } - @Ignore - @Test - public void testAdd() throws Exception { - - wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add")) - .willReturn(aResponse() - .withStatus(202) - .withHeader("Content-Type", MediaType.APPLICATION_JSON) - .withBody("test"))); - wireMockRule.addMockServiceRequestListener((request, response) -> { - System.out.println("URL Requested => " + request.getAbsoluteUrl()); - System.out.println("Request Body => " + request.getBodyAsString()); - System.out.println("Request Headers => " + request.getHeaders().toString()); - System.out.println("Response Status => " + response.getStatus()); - System.out.println("Response Body => " + response.getBodyAsString()); - }); - - Version ver = new Version(); - ver.setMajor(1); - ver.setMinor(0); - ver.setPatch("0"); - - ServiceEndPoint sep = new ServiceEndPoint(); - sep.setName("TEST.ECOMP_PSL.Inventory"); - sep.setVersion(ver); - sep.setHostAddress("127.0.0.1"); - sep.setListenPort("8080"); - sep.setLatitude("37.7022"); - sep.setLongitude("121.9358"); - sep.setContextPath("/"); - sep.setRouteOffer("TEST"); - - OperationalInfo operInfo = new OperationalInfo(); - operInfo.setCreatedBy("edge"); - operInfo.setUpdatedBy("edge"); - - sep.setOperationalInfo(operInfo); - - Property prop1 = new Property(); - prop1.setName("Environment"); - prop1.setValue("TEST"); - - Property prop2 = new Property(); - prop2.setName("cpfrun_cluster_name"); - prop2.setValue("testcase_cluster_no_cluster"); - - List<Property> props = new ArrayList<Property>(); - props.add(prop1); - props.add(prop2); - - sep.setProperties(props); - - ServiceEndPointRequest request = new ServiceEndPointRequest(); - request.setEnv("DEV"); - request.setServiceEndPoint(sep); - - System.out.println("Request in JSON: " + mapper.writeValueAsString(request)); - - GRMClient client = new GRMClient(); - client.addServiceEndPoint(request); - } - @Test public void testAddFail() throws Exception { wireMockRule.stubFor(post(urlPathEqualTo("/GRMLWPService/v1/serviceEndPoint/add")) diff --git a/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java index 104d40f76e..4cb9bd0e16 100644 --- a/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java +++ b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java @@ -23,8 +23,12 @@ package org.onap.so.client.policy; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.isA; import static org.mockito.Mockito.doReturn; +import static org.mockito.Matchers.any; +import java.io.File; +import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -33,16 +37,28 @@ import org.junit.Ignore; import org.junit.Test; import org.mockito.Mockito; import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl; +import org.onap.so.client.policy.entities.Config; +import org.onap.so.client.policy.entities.ConfigRequestParameters; import org.onap.so.client.policy.entities.DictionaryData; +import org.onap.so.client.policy.entities.PolicyConfig; import org.onap.so.client.policy.entities.PolicyDecision; import org.onap.so.client.policy.entities.PolicyServiceType; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + public class PolicyClientImplTest { - + @BeforeClass public static void setUp() { System.setProperty("mso.config.path", "src/test/resources"); } + + private static String RESOURCE_PATH = "src/test/resources/__files/Policy/"; + @Test public void successReadProperties() { PolicyRestClient client = new PolicyRestClient(new PolicyRestPropertiesImpl(), PolicyServiceType.GET_DECISION); @@ -52,7 +68,7 @@ public class PolicyClientImplTest { assertEquals("Found expected Authorization", "Basic dGVzdHBkcDphbHBoYTEyMw==", map.get("Authorization")); assertEquals("Found expected Environment", "TEST", map.get("Environment")); } - + @Test @Ignore public void getDecisionTest() { @@ -61,10 +77,10 @@ public class PolicyClientImplTest { assertEquals("Decision is correct", decision.getDecision(), "PERMIT"); assertEquals("Decision details is correct", decision.getDetails(), "Retry"); } - + @Test @Ignore - public void getAllowedTreatmentsTest(){ + public void getAllowedTreatmentsTest() { PolicyClient client = new PolicyClientImpl(); DictionaryData dictClient = client.getAllowedTreatments("BB1", "1"); final String dictBbidString = dictClient.getBbid().getString(); @@ -72,7 +88,7 @@ public class PolicyClientImplTest { assertEquals("DictionaryData matches a response Bbid", dictBbidString, "BB1"); assertEquals("DicitonaryData matches a response WorkStep", dictWorkStepString, "1"); } - + @Test public void getDecisionMockTest() { String serviceType = "S"; @@ -80,11 +96,11 @@ public class PolicyClientImplTest { String bbID = "BB1"; String workStep = "1"; String errorCode = "123"; - + PolicyDecision expected = new PolicyDecision(); expected.setDecision("PERMIT"); expected.setDetails("Retry"); - + DecisionAttributes decisionAttributes = new DecisionAttributes(); decisionAttributes.setServiceType(serviceType); decisionAttributes.setVNFType(vnfType); @@ -92,20 +108,43 @@ public class PolicyClientImplTest { decisionAttributes.setWorkStep(workStep); decisionAttributes.setErrorCode(errorCode); PolicyClient client = Mockito.spy(PolicyClientImpl.class); - + doReturn(expected).when(client).getDecision(serviceType, vnfType, bbID, workStep, errorCode); PolicyDecision actual = client.getDecision(serviceType, vnfType, bbID, workStep, errorCode); assertThat(actual, sameBeanAs(expected)); } + + @Test + public void getConfigFromStringJsonTest() throws JsonParseException, JsonMappingException, IOException { + PolicyClientImpl client = new PolicyClientImpl(); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + Config expected = mapper.readValue(new File(RESOURCE_PATH + "configJson.json"), Config.class); + PolicyConfig[] returnedPolicyConfigList = mapper.readValue(new File(RESOURCE_PATH + "policyConfig.json"), PolicyConfig[].class); + String configJson = returnedPolicyConfigList[0].getConfig(); + Config actual = client.getConfigFromStringJson(configJson); + + assertThat(actual, sameBeanAs(expected)); + } - /* @Test - public void getAllowedTreatmentsTest() { - PolicyClient client = new PolicyClientImpl(); - AllowedTreatments allowedTreatments = client.getAllowedTreatments("BB1", "1"); - int expectedSizeOfList = 4; - int sizeOfList = allowedTreatments.getAllowedTreatments().size(); - assertEquals("Decision is correct", sizeOfList, expectedSizeOfList); - }*/ + public void getConfigWithPolicyNameTest() throws JsonParseException, JsonMappingException, IOException { + PolicyClientImpl client = Mockito.spy(PolicyClientImpl.class); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + PolicyConfig[] returnedPolicyConfigList = mapper.readValue(new File(RESOURCE_PATH + "policyConfig.json"), PolicyConfig[].class); + Config expected = mapper.readValue(new File(RESOURCE_PATH + "configJson.json"), Config.class); + + PolicyRestClient mockedClient = Mockito.mock(PolicyRestClient.class); + doReturn(mockedClient).when(client).getPolicyRestClient(PolicyServiceType.GET_CONFIG); + doReturn(returnedPolicyConfigList).when(mockedClient).post(isA(ConfigRequestParameters.class), any()); + + Config actual = client.getConfigWithPolicyName("policyName"); + + assertThat(actual, sameBeanAs(expected)); + + } } diff --git a/common/src/test/resources/__files/Policy/configJson.json b/common/src/test/resources/__files/Policy/configJson.json new file mode 100644 index 0000000000..b206998b41 --- /dev/null +++ b/common/src/test/resources/__files/Policy/configJson.json @@ -0,0 +1,23 @@ +{ + "configName": "Testing", + "riskLevel": "1", + "policyName": "fabric_configuration", + "policyScope": "resource=Test1,service=vSCP,type=configuration,closedLoopControlName=Firewall", + "guard": "False", + "description": "null", + "priority": "9", + "uuid": "1234", + "version": "1.0", + "content": { + "fabric-config-models": [ + { + "vnfProfile": "v5", + "lagProfile": "N1" + } + ] + }, + "riskType": "test", + "service": "mso-fabric-configuration-model", + "location": " Edge", + "templateVersion": "1607" +}
\ No newline at end of file diff --git a/common/src/test/resources/__files/Policy/policyConfig.json b/common/src/test/resources/__files/Policy/policyConfig.json new file mode 100644 index 0000000000..b67c9c0e48 --- /dev/null +++ b/common/src/test/resources/__files/Policy/policyConfig.json @@ -0,0 +1,20 @@ +[ + { + "policyConfigMessage": "Config Retrieved! ", + "policyConfigStatus": "CONFIG_RETRIEVED", + "type": "JSON", + "config": "{\"configName\":\"Testing\",\"riskLevel\":\"1\",\"policyName\":\"fabric_configuration\",\"policyScope\":\"resource=Test1,service=vSCP,type=configuration,closedLoopControlName=Firewall\",\"guard\":\"False\",\"description\":\"null\",\"priority\":\"9\",\"uuid\":\"1234\",\"version\":\"1.0\",\"content\":{\"fabric-config-models\":[{\"vnfProfile\":\"v5\",\"lagProfile\":\"N1\"}]},\"riskType\":\"test\",\"service\":\"mso-fabric-configuration-model\",\"location\":\" Edge\",\"templateVersion\":\"1607\"}", + "policyName": "MSO_Policy.Config_MS_fabric_configuration_vPE.2.xml", + "policyType": "MicroService", + "policyVersion": "2", + "matchingConditions": { + "ECOMPName": "MSO", + "ONAPName": "MSO", + "service": "mso-fabric-configuration-model" + }, + "responseAttributes": { + + }, + "property": null + } +]
\ No newline at end of file diff --git a/common/src/test/resources/logback-test.xml b/common/src/test/resources/logback-test.xml index c4248bf985..772eeabeb6 100644 --- a/common/src/test/resources/logback-test.xml +++ b/common/src/test/resources/logback-test.xml @@ -1,8 +1,8 @@ <!-- ============LICENSE_START======================================================= - ECOMP MSO + ONAP SO ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,159 +18,58 @@ ============LICENSE_END========================================================= --> -<configuration scan="false" debug="true"> - <!--<jmxConfigurator /> --> - <!-- directory path for all other type logs --> +<configuration> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> - <property name="logDir" value="./target" /> - - <!-- directory path for debugging type logs --> - <property name="debugDir" value="./target" /> - - <!-- specify the component name - <ECOMP-component-name>::= "MSO" | "DCAE" | "ASDC " | "AAI" |"Policy" | "SDNC" | "AC" --> - <property name="componentName" value="MSO"></property> - <property name="subComponentName" value="Test"></property> - <!-- log file names --> - <property name="errorLogName" value="error" /> - <property name="metricsLogName" value="metrics" /> - <property name="auditLogName" value="audit" /> - <property name="debugLogName" value="debug" /> - <property name="errorPattern" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> - <property name="debugPattern" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}|%X{RequestId}|%msg%n" /> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${pattern}</pattern> + </encoder> + </appender> - <property name="auditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> - <property name="metricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" /> + <appender name="test" + class="org.onap.so.utils.TestAppender" /> - <property name="logDirectory" value="${logDir}/${componentName}/${subComponentName}" /> - <property name="debugLogDirectory" value="${debugDir}/${componentName}/${subComponentName}" /> + <logger name="com.att.ecomp.audit" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <appender name="test" class="org.onap.so.utils.TestAppender"/> - <!-- ============================================================================ --> - <!-- EELF Appenders --> - <!-- ============================================================================ --> + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <!-- The EELFAppender is used to record events to the general application - log --> - - <!-- EELF Audit Appender. This appender is used to record audit engine - related logging events. The audit logger and appender are specializations - of the EELF application root logger and appender. This can be used to segregate - Policy engine events from other components, or it can be eliminated to record - these events as part of the application root log. --> - - <appender name="EELFAudit" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${auditLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/${auditLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <encoder> - <pattern>${auditPattern}</pattern> - </encoder> - </appender> - <appender name="asyncEELFAudit" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>500</queueSize> - <discardingThreshold>0</discardingThreshold> - <appender-ref ref="EELFAudit" /> - </appender> + <logger name="com.att.eelf.error" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> -<appender name="EELFMetrics" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${metricsLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/${metricsLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <encoder> - <!-- <pattern>"%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - - %msg%n"</pattern> --> - <pattern>${metricPattern}</pattern> - </encoder> - </appender> - - - <appender name="asyncEELFMetrics" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>500</queueSize> - <discardingThreshold>0</discardingThreshold> - <appender-ref ref="EELFMetrics"/> - </appender> - - <appender name="EELFError" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logDirectory}/${errorLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${logDirectory}/${errorLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> - <level>INFO</level> - </filter> - <encoder> - <pattern>${errorPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncEELFError" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>500</queueSize> - <discardingThreshold>0</discardingThreshold> - <appender-ref ref="EELFError"/> - </appender> - - <appender name="EELFDebug" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${debugLogDirectory}/${debugLogName}${jboss.server.name}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> - <fileNamePattern>${debugLogDirectory}/${debugLogName}${jboss.server.name}.log.%d</fileNamePattern> - <!--<maxHistory>30</maxHistory>--> - </rollingPolicy> - <encoder> - <pattern>${debugPattern}</pattern> - </encoder> - </appender> - - <appender name="asyncEELFDebug" class="ch.qos.logback.classic.AsyncAppender"> - <queueSize>500</queueSize> - <discardingThreshold>0</discardingThreshold> - <appender-ref ref="EELFDebug" /> - <includeCallerData>true</includeCallerData> - </appender> - - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level - %logger{1024} - %msg%n - </pattern> - </encoder> - </appender> + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </logger> + + <logger name="org.flywaydb" level="DEBUG" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> - <!-- ============================================================================ --> - <!-- EELF loggers --> - <!-- ============================================================================ --> - <logger name="com.att.eelf.audit" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="asyncEELFAudit" /> - </logger> - - <logger name="METRIC" level="${so.log.level:-DEBUG}" additivity="true"> - <appender-ref ref="asyncEELFMetrics" /> - <appender-ref ref="test" /> - </logger> + <logger name="ch.vorburger" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + - <logger name="com.att.eelf.error" level="${so.log.level:-DEBUG}" additivity="false"> - <appender-ref ref="asyncEELFError" /> - </logger> - - <root level="${so.log.level:-DEBUG}"> - <appender-ref ref="asyncEELFDebug" /> - <appender-ref ref="STDOUT" /> - </root> + <root level="WARN"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </root> </configuration>
\ No newline at end of file diff --git a/common/src/test/resources/mso-bad.json b/common/src/test/resources/mso-bad.json deleted file mode 100644 index 1aaea50042..0000000000 --- a/common/src/test/resources/mso-bad.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "asdc-connections": { - "asdc-controller1": { - "asdcUser": "user1", - "asdcConsumerGroup": "consumer1", - "asdcConsumerId": "consumer1", - "asdcEnvironmentName": "PROD", - "asdcAddress": "localhost:8443", - "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199" - }, - "asdc-controller2": { - "asdcUser": "user2", - "asdcConsumerGroup": "consumer2", - "asdcConsumerId": "consumer2", - "asdcEnvironmentName": "E2E", - "asdcAddress": "localhost:8443", - "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199" - } - } -}
\ No newline at end of file diff --git a/common/src/test/resources/mso.json b/common/src/test/resources/mso.json deleted file mode 100644 index e8ee4a9185..0000000000 --- a/common/src/test/resources/mso.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "asdc-connections":{ - "asdc-controller1":{ - "asdcUser": "user1", - "asdcConsumerGroup": "consumer1", - "asdcConsumerId": "consumer1", - "asdcEnvironmentName": "PROD", - "asdcAddress": "localhost:8443", - "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199" - }, - "asdc-controller2":{ - "asdcUser": "user2", - "asdcConsumerGroup": "consumer2", - "asdcConsumerId": "consumer2", - "asdcEnvironmentName": "E2E", - "asdcAddress": "localhost:8443", - "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199" - } - }, - "mso.properties.reload.time.minutes":2 -} diff --git a/common/src/test/resources/mso.properties b/common/src/test/resources/mso.properties deleted file mode 100644 index bb0e4ebf0d..0000000000 --- a/common/src/test/resources/mso.properties +++ /dev/null @@ -1,28 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### - -mso.properties.reload.time.minutes=2 -ecomp.mso.cloud.1.cloudId=MT -ecomp.mso.cloud.1.keystoneUrl=http://localhost:5000/v2.0 -ecomp.mso.cloud.1.msoId=John -ecomp.mso.cloud.1.publicNetId=FD205490A48D48475607C36B9AD902BF -ecomp.mso.cloud.1.test=1234 -ecomp.mso.cloud.1.boolean=true -ecomp.mso.cloud.1.enum=enum1 diff --git a/common/src/test/resources/mso2.json b/common/src/test/resources/mso2.json deleted file mode 100644 index bac30c495c..0000000000 --- a/common/src/test/resources/mso2.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "asdc-connections": { - "asdc-controller1": { - "asdcUser": "user1B", - "asdcConsumerGroup": "consumer1", - "asdcConsumerId": "consumer1", - "asdcEnvironmentName": "PROD", - "asdcAddress": "localhost:8443", - "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199" - }, - "asdc-controller2": { - "asdcUser": "user2B", - "asdcConsumerGroup": "consumer2", - "asdcConsumerId": "consumer2", - "asdcEnvironmentName": "E2E", - "asdcAddress": "localhost:8443", - "asdcPassword": "1c551b8b5ab91fcd5a0907b11c304199" - } - } -}
\ No newline at end of file diff --git a/common/src/test/resources/mso2.properties b/common/src/test/resources/mso2.properties deleted file mode 100644 index 423346e953..0000000000 --- a/common/src/test/resources/mso2.properties +++ /dev/null @@ -1,22 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### - -mso.properties.reload.time.minutes=1 -ecomp.mso.cloud.1.cloudId=MT2 diff --git a/cxf-logging/.gitignore b/cxf-logging/.gitignore new file mode 100644 index 0000000000..c2a96233ca --- /dev/null +++ b/cxf-logging/.gitignore @@ -0,0 +1,2 @@ +/tattletale-jar/ +/bin/ diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml new file mode 100644 index 0000000000..378d169175 --- /dev/null +++ b/cxf-logging/pom.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so</groupId> + <artifactId>so</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <name>CXFLogging</name> + <description>Common CXF Logging Classes</description> + <dependencies> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-ext</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.onap.logging-analytics</groupId> + <artifactId>logging-slf4j</artifactId> + <version>1.2.2-SNAPSHOT</version> + <exclusions> + <exclusion> + <groupId>com.att.eelf</groupId> + <artifactId>eelf-core</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <build> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + <resource> + <directory>src/main/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </resource> + </resources> + </build> + <artifactId>cxf-logging</artifactId> +</project> diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java new file mode 100644 index 0000000000..08499cfd22 --- /dev/null +++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.cxf.interceptor; + + +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.servlet.http.HttpServletRequest; +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.Phase; +import org.apache.cxf.transport.http.AbstractHTTPDestination; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + + +public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor{ + + protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingInInterceptor.class); + + public SOAPLoggingInInterceptor() { + super(Phase.READ); + } + + @Override + public void handleMessage(SoapMessage message) throws Fault { + try { + SOAPMDCSetup mdcSetup = new SOAPMDCSetup(); + Map<String, List<String>> headers = (Map<String,List<String>>) message.get(Message.PROTOCOL_HEADERS); + HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST); + request.getRemoteAddr(); + + setRequestId(headers); + setInvocationId(headers); + setServiceName(message); + setMDCPartnerName(headers); + mdcSetup.setServerFQDN(); + mdcSetup.setClientIPAddress(request); + mdcSetup.setInstanceUUID(); + mdcSetup.setEntryTimeStamp(); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, "INPROGRESS"); + logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); + } catch (Exception e) { + logger.warn("Error in incoming SOAP Message Inteceptor", e); + } + } + + private void setServiceName(SoapMessage message) { + String requestURI = (String) message.get(Message.REQUEST_URI); + MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, requestURI); + } + + //CXF Appears to flatten headers to lower case + private void setMDCPartnerName(Map<String, List<String>> headers){ + String partnerName=getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(),""); + MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME,partnerName); + } + + private void setInvocationId(Map<String, List<String>> headers) { + String invocationId=getValueOrDefault(headers, ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase(),UUID.randomUUID().toString()); + MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId); + } + + private void setRequestId(Map<String, List<String>> headers) { + String requestId=getValueOrDefault(headers, ONAPLogConstants.Headers.REQUEST_ID.toLowerCase(),UUID.randomUUID().toString()); + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID,requestId); + } + + private String getValueOrDefault(Map<String, List<String>> headers, String headerName, String defaultValue){ + String headerValue; + List<String> headerList=headers.get(headerName); + if(headerList != null && !headerList.isEmpty()){ + headerValue= headerList.get(0); + if(headerValue == null || headerValue.isEmpty()) + headerValue = defaultValue; + }else + headerValue = defaultValue; + return headerValue; + } + +} diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java new file mode 100644 index 0000000000..ed4ba76268 --- /dev/null +++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.cxf.interceptor; + + +import org.apache.cxf.binding.soap.SoapMessage; +import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.phase.Phase; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + + + +public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor{ + + private static final String _500 = "500"; + + protected static Logger logger = LoggerFactory.getLogger(SOAPLoggingOutInterceptor.class); + + + + public SOAPLoggingOutInterceptor() { + super(Phase.WRITE); + } + + @Override + public void handleMessage(SoapMessage message) throws Fault { + try { + Exception ex = message.getContent(Exception.class); + if (ex == null) { + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.COMPLETED.toString()); + }else{ + int responseCode = 0; + responseCode = (int) message.get(Message.RESPONSE_CODE); + if(responseCode != 0 ) + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseCode)); + else + MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, _500); + + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); + } + logger.info(ONAPLogConstants.Markers.EXIT, "Exiting"); + } catch (Exception e) { + logger.warn("Error in incoming SOAP Message Inteceptor", e); + } + } +} diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java new file mode 100644 index 0000000000..ef47106fa1 --- /dev/null +++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.logging.cxf.interceptor; + +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.util.UUID; +import javax.servlet.http.HttpServletRequest; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + + + +public class SOAPMDCSetup { + + protected static Logger logger = LoggerFactory.getLogger(SOAPMDCSetup.class); + + private static final String INSTANCE_UUID = UUID.randomUUID().toString(); + + public void setInstanceUUID(){ + MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID); + } + + public void setServerFQDN(){ + String serverFQDN = ""; + InetAddress addr= null; + try { + addr = InetAddress.getLocalHost(); + serverFQDN = addr.toString(); + } catch (UnknownHostException e) { + logger.warn("Cannot Resolve Host Name"); + serverFQDN = ""; + } + MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN); + } + + public void setClientIPAddress(HttpServletRequest httpServletRequest){ + String remoteIpAddress = ""; + if (httpServletRequest != null) { + remoteIpAddress = httpServletRequest.getRemoteAddr(); + } + MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress); + } + + public void setEntryTimeStamp() { + MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)); + } + + +} diff --git a/cxf-logging/src/test/resources/logback-test.xml b/cxf-logging/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..772eeabeb6 --- /dev/null +++ b/cxf-logging/src/test/resources/logback-test.xml @@ -0,0 +1,75 @@ +<!-- + ============LICENSE_START======================================================= + ONAP SO + ================================================================================ + Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<configuration> + <property name="p_tim" value="%d{"yyyy-MM-dd'T'HH:mm:ss.SSSXXX", UTC}"/> + <property name="p_lvl" value="%level"/> + <property name="p_log" value="%logger"/> + <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/> + <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/> + <property name="p_thr" value="%thread"/> + <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/> + + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${pattern}</pattern> + </encoder> + </appender> + + <appender name="test" + class="org.onap.so.utils.TestAppender" /> + + <logger name="com.att.ecomp.audit" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.error" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </logger> + + <logger name="org.flywaydb" level="DEBUG" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + + <logger name="ch.vorburger" level="WARN" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + + <root level="WARN"> + <appender-ref ref="STDOUT" /> + <appender-ref ref="test" /> + </root> + + +</configuration>
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java index 7feb1ae758..e9062effad 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -110,7 +112,7 @@ public class CamundaClient extends RequestClient{ public HttpResponse post(RequestClientParameter parameterObject) throws ClientProtocolException, IOException{ HttpPost post = new HttpPost(url); - msoLogger.debug("Camunda url is: "+ url); + msoLogger.debug(CAMUNDA_URL_MESAGE+ url); String jsonReq = wrapVIDRequest(parameterObject.getRequestId(), parameterObject.isBaseVfModule(), parameterObject.getRecipeTimeout(), parameterObject.getRequestAction(), parameterObject.getServiceInstanceId(), parameterObject.getCorrelationId(), parameterObject.getVnfId(), parameterObject.getVfModuleId(), parameterObject.getVolumeGroupId(), parameterObject.getNetworkId(), parameterObject.getConfigurationId(), parameterObject.getServiceType(), parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(), parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(), parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd()); diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml index f871e120e7..37941b83e0 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -151,6 +151,11 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db-repositories</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> </dependency> diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 8f8cf0898d..1a95aa0e09 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -58,10 +58,10 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.OperationStatus; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoAlarmLogger; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; import org.onap.so.serviceinstancebeans.RequestDetails; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java index 1700e121f0..e6bbc4de4a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java @@ -29,7 +29,7 @@ import org.onap.so.apihandler.filters.RequestUriFilter; import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration; import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration; -import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; import org.onap.so.web.exceptions.RuntimeExceptionMapper; import org.springframework.context.annotation.Configuration; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java index 1a1b45ac8e..753e712d71 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java @@ -62,10 +62,11 @@ import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType; import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs; import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.InstanceDirection; import org.onap.so.serviceinstancebeans.ModelInfo; @@ -741,4 +742,4 @@ public class MsoRequest { return vnfType; } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index 753b4c48d4..50d2639b2d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,11 +49,12 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoAlarmLogger; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse; import org.onap.so.serviceinstancebeans.GetOrchestrationResponse; import org.onap.so.serviceinstancebeans.InstanceReferences; @@ -97,10 +99,11 @@ public class OrchestrationRequests { GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse(); - InfraActiveRequests requestDB = null; - + InfraActiveRequests infraActiveRequest = null; + List<org.onap.so.db.request.beans.RequestProcessingData> requestProcessingData = null; try { - requestDB = requestsDbClient.getInfraActiveRequestbyRequestId(requestId); + infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId); + requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId); } catch (Exception e) { msoLogger.error(e); @@ -115,8 +118,8 @@ public class OrchestrationRequests { throw validateException; } - - if(requestDB == null) { + + if(infraActiveRequest == null) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build(); @@ -126,8 +129,11 @@ public class OrchestrationRequests { throw validateException; } - - Request request = mapInfraActiveRequestToRequest(requestDB); + + Request request = mapInfraActiveRequestToRequest(infraActiveRequest); + if(!requestProcessingData.isEmpty()){ + request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData)); + } request.setRequestId(requestId); orchestrationResponse.setRequest(request); @@ -171,8 +177,12 @@ public class OrchestrationRequests { List<RequestList> requestLists = new ArrayList<>(); for(InfraActiveRequests infraActive : activeRequests){ + List<RequestProcessingData> requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId()); RequestList requestList = new RequestList(); Request request = mapInfraActiveRequestToRequest(infraActive); + if(!requestProcessingData.isEmpty()){ + request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData)); + } requestList.setRequest(request); requestLists.add(requestList); } @@ -337,4 +347,46 @@ public class OrchestrationRequests { return request; } + + public List<org.onap.so.serviceinstancebeans.RequestProcessingData> mapRequestProcessingData(List<org.onap.so.db.request.beans.RequestProcessingData> processingData){ + List<org.onap.so.serviceinstancebeans.RequestProcessingData> addedRequestProcessingData = new ArrayList<>(); + org.onap.so.serviceinstancebeans.RequestProcessingData finalProcessingData = new org.onap.so.serviceinstancebeans.RequestProcessingData(); + String currentGroupingId = null; + HashMap<String, String> tempMap = new HashMap<>(); + List<HashMap<String, String>> tempList = new ArrayList<>(); + for(RequestProcessingData data : processingData){ + String groupingId = data.getGroupingId(); + String tag = data.getTag(); + if(currentGroupingId == null || !currentGroupingId.equals(groupingId)){ + if(!tempMap.isEmpty()){ + tempList.add(tempMap); + finalProcessingData.setDataPairs(tempList); + addedRequestProcessingData.add(finalProcessingData); + } + finalProcessingData = new org.onap.so.serviceinstancebeans.RequestProcessingData(); + if(groupingId != null){ + finalProcessingData.setGroupingId(groupingId); + } + if(tag != null){ + finalProcessingData.setTag(tag); + } + currentGroupingId = groupingId; + tempMap = new HashMap<>(); + tempList = new ArrayList<>(); + if(data.getName() != null && data.getValue() != null){ + tempMap.put(data.getName(), data.getValue()); + } + }else{ + if(data.getName() != null && data.getValue() != null){ + tempMap.put(data.getName(), data.getValue()); + } + } + } + if(tempMap.size() > 0){ + tempList.add(tempMap); + finalProcessingData.setDataPairs(tempList); + } + addedRequestProcessingData.add(finalProcessingData); + return addedRequestProcessingData; + } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java index a7dac34aa0..60b07fdeab 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java @@ -58,10 +58,10 @@ import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -1511,7 +1511,9 @@ public class ServiceInstances { } }else{ //ok for version < 3 and action delete - recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString()); + if(modelName != null){ + recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString()); + } } if(recipe == null){ @@ -1656,4 +1658,4 @@ public class ServiceInstances { infraActiveRequestsClient.save(aq); } } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java index 0a996dc3dc..6d61d3bb34 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/SpringContextHelper.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (C) 2018 IBM. + * ================================================================================ * 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 @@ -20,7 +22,6 @@ package org.onap.so.apihandlerinfra; -import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; @@ -31,7 +32,7 @@ public class SpringContextHelper implements ApplicationContextAware { private static ApplicationContext context; @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void setApplicationContext(ApplicationContext applicationContext) { context = applicationContext; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java index cfe32a3833..d743c440e7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java @@ -40,7 +40,6 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.Constants; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.apihandlerinfra.Status; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException; @@ -51,6 +50,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestReferences; import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; @@ -237,4 +237,4 @@ public class CloudOrchestration { private String getRequestId(ContainerRequestContext requestContext) { return requestContext.getProperty("requestId").toString(); } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 3b7a326f3e..a35f40baf6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -44,7 +44,6 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandler.common.ResponseBuilder; import org.onap.so.apihandlerinfra.Constants; import org.onap.so.apihandlerinfra.Messages; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo; @@ -56,6 +55,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Request; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails; import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoAlarmLogger; @@ -294,4 +294,4 @@ public class CloudResourcesOrchestration { return request; } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java index b13008b3d3..855a5433f3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java @@ -30,7 +30,6 @@ import javax.ws.rs.core.MultivaluedMap; import org.apache.commons.lang3.StringUtils; import org.onap.so.apihandlerinfra.Constants; -import org.onap.so.requestsdb.client.RequestsDbClient; import org.onap.so.apihandlerinfra.Status; import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest; @@ -44,6 +43,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.ResourceType; import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList; import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; @@ -384,4 +384,4 @@ public class TenantIsolationRequest { public void setOperationalEnvironmentId(String operationalEnvironmentId) { this.operationalEnvironmentId = operationalEnvironmentId; } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java index e89b5c8d42..ac9a000d3b 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java @@ -27,7 +27,7 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.json.JSONObject; import org.onap.so.apihandler.common.ErrorNumbers; -import org.onap.so.requestsdb.client.RequestsDbClient; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 6eb5157568..66cfd349df 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -28,7 +28,7 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.json.JSONObject; import org.onap.so.apihandler.common.ErrorNumbers; -import org.onap.so.requestsdb.client.RequestsDbClient; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo; diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java index c16f7bb9ef..b09bbae0ad 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironment.java @@ -76,8 +76,8 @@ public class CreateEcompOperationalEnvironment { requestDb.updateInfraFailureCompletion(e.getMessage(), requestId, request.getOperationalEnvironmentId()); throw validateException; } - //Update request database - requestDb.updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", requestId, request.getOperationalEnvironmentId()); + //Update request database + requestDb.updateInfraSuccessCompletion("SUCCESSFULLY Created ECOMP OperationalEnvironment.", requestId, request.getOperationalEnvironmentId()); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java index d2730406e6..52ed34ac3f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java @@ -28,7 +28,6 @@ import com.github.tomakehurst.wiremock.client.WireMock; import org.junit.After; import org.junit.BeforeClass; import org.junit.runner.RunWith; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.onap.so.logger.MsoLogger; import org.onap.so.logger.MsoLogger.Catalog; import org.springframework.beans.factory.annotation.Autowired; @@ -45,8 +44,7 @@ import org.springframework.test.context.jdbc.Sql.ExecutionPhase; import org.springframework.test.context.junit4.SpringRunner; import javax.transaction.Transactional; -import java.io.File; -import java.io.IOException; + import java.nio.file.Files; import java.nio.file.Paths; @@ -55,7 +53,7 @@ import java.nio.file.Paths; @ActiveProfiles("test") @ContextConfiguration @Transactional -@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql") +//@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql") @AutoConfigureWireMock(port = 0) public abstract class BaseTest { protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class); @@ -65,26 +63,16 @@ public abstract class BaseTest { @Autowired protected Environment env; - - @Autowired - protected InfraActiveRequestsRepository iar; - + @LocalServerPort private int port; - protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(new File(fileLocation)); - return jsonNode.asText(); - } - protected String createURLWithPort(String uri) { return "http://localhost:" + port + uri; } @After public void tearDown(){ - iar.deleteAll(); WireMock.reset(); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index 5d6aa43a9b..76d4b48a36 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -39,6 +39,7 @@ import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.apache.log4j.MDC; import org.junit.Test; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandlerinfra.tasksbeans.RequestDetails; import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo; import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference; @@ -110,8 +111,8 @@ public class ManualTasksTest extends BaseTest{ logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME)); @@ -119,9 +120,9 @@ public class ManualTasksTest extends BaseTest{ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(MsoLogger.ENDTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); assertEquals("202",mdc.get(MsoLogger.RESPONSECODE)); assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java index 582bc12077..0af9826020 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java @@ -20,50 +20,63 @@ package org.onap.so.apihandlerinfra; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.any; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + import org.apache.http.HttpStatus; import org.junit.Ignore; import org.junit.Test; import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.exceptions.ValidationException; -import org.onap.so.requestsdb.client.RequestsDbClient; -import org.onap.so.serviceinstancebeans.*; +import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse; +import org.onap.so.serviceinstancebeans.GetOrchestrationResponse; +import org.onap.so.serviceinstancebeans.Request; +import org.onap.so.serviceinstancebeans.RequestError; +import org.onap.so.serviceinstancebeans.RequestProcessingData; +import org.onap.so.serviceinstancebeans.ServiceException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static com.github.tomakehurst.wiremock.client.WireMock.*; -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.assertEquals; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; public class OrchestrationRequestsTest extends BaseTest { @Autowired - private InfraActiveRequestsRepository iar; - - @Autowired private RequestsDbClient requestsDbClient; + + @Autowired + private OrchestrationRequests orchReq; - private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>"; private static final GetOrchestrationListResponse ORCHESTRATION_LIST = generateOrchestrationList(); private static final String INVALID_REQUEST_ID = "invalid-request-id"; @@ -162,9 +175,14 @@ public class OrchestrationRequestsTest extends BaseTest { List<String> values = new ArrayList<>(); values.add("EQUALS"); values.add("vfModule"); + + ObjectMapper mapper = new ObjectMapper(); + GetOrchestrationListResponse testResponse = mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json"), + GetOrchestrationListResponse.class); Map<String, List<String>> orchestrationMap = new HashMap<>(); orchestrationMap.put("modelType", values); + List<GetOrchestrationResponse> testResponses = new ArrayList<>(); List<InfraActiveRequests> requests = requestsDbClient.getOrchestrationFiltersFromInfraActive(orchestrationMap); HttpEntity<Request> entity = new HttpEntity<Request>(null, headers); @@ -175,8 +193,11 @@ public class OrchestrationRequestsTest extends BaseTest { ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, GetOrchestrationListResponse.class); + assertThat(response.getBody(), + sameBeanAs(testResponse).ignoring("requestList.request.startTime").ignoring("requestList.request.requestStatus.finishTime")); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); assertEquals(requests.size(), response.getBody().getRequestList().size()); + } @Test @@ -315,7 +336,7 @@ public class OrchestrationRequestsTest extends BaseTest { requests.setRequestId("requestId"); requests.setRequestScope("service"); requests.setRequestType("createInstance"); - iar.save(requests); +// iar.save(requests); headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); @@ -334,12 +355,48 @@ public class OrchestrationRequestsTest extends BaseTest { assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0)); assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0)); } + @Test + public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException{ + RequestProcessingData entry = new RequestProcessingData(); + RequestProcessingData secondEntry = new RequestProcessingData(); + List<HashMap<String, String>> expectedList = new ArrayList<>(); + HashMap<String, String> expectedMap = new HashMap<>(); + List<HashMap<String, String>> secondExpectedList = new ArrayList<>(); + HashMap<String, String> secondExpectedMap = new HashMap<>(); + List<RequestProcessingData> expectedDataList = new ArrayList<>(); + entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714"); + entry.setTag("pincFabricConfigRequest"); + expectedMap.put("requestAction", "assign"); + expectedMap.put("pincFabricId", "testId"); + expectedList.add(expectedMap); + entry.setDataPairs(expectedList); + secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715"); + secondEntry.setTag("pincFabricConfig"); + secondExpectedMap.put("requestAction", "unassign"); + secondExpectedList.add(secondExpectedMap); + secondEntry.setDataPairs(secondExpectedList); + expectedDataList.add(entry); + expectedDataList.add(secondEntry); + + List<org.onap.so.db.request.beans.RequestProcessingData> processingData = new ArrayList<>(); + List<RequestProcessingData> actualProcessingData = new ArrayList<>(); + ObjectMapper mapper = new ObjectMapper(); + processingData = mapper.readValue(new File("src/test/resources/OrchestrationRequest/RequestProcessingData.json"), + new TypeReference<List<org.onap.so.db.request.beans.RequestProcessingData>>(){}); + actualProcessingData = orchReq.mapRequestProcessingData(processingData); + assertThat(actualProcessingData,sameBeanAs(expectedDataList)); + } public void setupTestGetOrchestrationRequest() throws Exception{ //For testGetOrchestrationRequest stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json")))) .withStatus(HttpStatus.SC_OK))); + stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/")) + .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018")) + .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json")))) + .withStatus(HttpStatus.SC_OK))); } private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{ @@ -379,4 +436,4 @@ public class OrchestrationRequestsTest extends BaseTest { .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json")))) .withStatus(HttpStatus.SC_OK))); } -}
\ No newline at end of file +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 5b37d772c6..e4ec850c4e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -29,6 +29,7 @@ import com.github.tomakehurst.wiremock.http.Fault; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceRecipe; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -188,8 +189,8 @@ public class ServiceInstancesTest extends BaseTest{ logEvent.getMarker().getName().equals("ENTRY") ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME)); @@ -197,9 +198,9 @@ public class ServiceInstancesTest extends BaseTest{ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") && logEvent.getMarker().getName().equals("EXIT")){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(MsoLogger.BEGINTIME)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); assertNotNull(mdc.get(MsoLogger.ENDTIME)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); assertNotNull(mdc.get(MsoLogger.INVOCATION_ID)); assertEquals("202",mdc.get(MsoLogger.RESPONSECODE)); assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME)); @@ -1632,7 +1633,7 @@ public class ServiceInstancesTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" + - "modelName=GR-API-DEFAULT&action=deleteInstance")) + "modelName=VNF-API-DEFAULT&action=deleteInstance")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json")) .withStatus(org.apache.http.HttpStatus.SC_OK))); @@ -1934,7 +1935,7 @@ public class ServiceInstancesTest extends BaseTest{ @Test public void invalidRequestId() throws IOException { String illegalRequestId = "1234"; - headers.set("X-ECOMP-RequestID", illegalRequestId); + headers.set(ONAPLogConstants.Headers.REQUEST_ID, illegalRequestId); uri = servInstanceuri + "v5/serviceInstances"; ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java index e759752c33..1e11b74215 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java @@ -30,7 +30,6 @@ import org.onap.so.apihandlerinfra.Status; import org.onap.so.apihandlerinfra.tenantisolationbeans.Action; import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantIsolationRequest; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java index 5f18e28ba6..8ac84d6598 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java @@ -25,9 +25,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.so.apihandlerinfra.BaseTest; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -44,15 +41,8 @@ import static org.junit.Assert.assertTrue; public class CloudResourcesOrchestrationTest extends BaseTest{ - @Autowired - private InfraActiveRequestsRepository iarRepo; private String requestJSON = "{\"requestDetails\":{\"requestInfo\":{\"source\":\"VID\",\"requestorId\":\"xxxxxx\" } } }"; private static final String path = "/onap/so/infra/cloudResourcesRequests"; - - @LocalServerPort - private int port; - - HttpHeaders headers = new HttpHeaders(); @Before @@ -275,8 +265,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ iar.setRequestStatus("COMPLETE"); iar.setRequestAction("TEST"); - iarRepo.saveAndFlush(iar); - headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<>("", headers); @@ -303,8 +291,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest{ iar.setRequestStatus("COMPLETE"); iar.setRequestAction("TEST"); - iarRepo.saveAndFlush(iar); - headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); HttpEntity<String> entity = new HttpEntity<>(null, headers); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java index eba90496ba..9a5334081f 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java @@ -30,8 +30,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.containing; import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; + import static org.junit.Assert.assertThat; import com.fasterxml.jackson.core.JsonProcessingException; @@ -39,7 +38,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.http.HttpStatus; import org.json.JSONObject; import org.junit.Rule; -import org.junit.After; import org.junit.Test; import org.junit.Ignore; import org.junit.rules.ExpectedException; @@ -47,16 +45,12 @@ import org.onap.so.apihandler.common.ErrorNumbers; import org.onap.so.apihandlerinfra.BaseTest; import org.onap.so.apihandlerinfra.exceptions.ApiException; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; -import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper; import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution; import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus; import org.onap.so.apihandlerinfra.tenantisolationbeans.Status; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; -import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository; -import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository; import org.springframework.beans.factory.annotation.Autowired; import javax.ws.rs.core.HttpHeaders; @@ -66,10 +60,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ @Autowired private ActivateVnfStatusOperationalEnvironment activateVnfStatus; - @Autowired - private InfraActiveRequestsRepository infraActiveRequestsRepository; - @Autowired - private ActivateVnfDBHelper dbHelper; @Rule public ExpectedException thrown = ExpectedException.none(); @@ -185,10 +175,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{ .withStatus(HttpStatus.SC_OK))); activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig); - - // do nothing, waiting for more - assertNull(infraActiveRequestsRepository.findOne(requestIdOrig)); - } + } @Test public void executionTest_Ok() throws Exception { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java index 0ace9d5445..585eff23c4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java @@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.tenantisolation.process; import static com.github.tomakehurst.wiremock.client.WireMock.*; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertThat; - +import java.util.UUID; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.http.HttpStatus; @@ -107,22 +107,23 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{ .errorInfo(errorLoggerInfo).build(); InfraActiveRequests iar = new InfraActiveRequests(); - iar.setRequestId("123"); + String uuid = UUID.randomUUID().toString(); + iar.setRequestId(uuid); iar.setOperationalEnvName("myOpEnv"); iar.setRequestScope("create"); iar.setRequestStatus("PENDING"); iar.setRequestAction("UNKNOWN"); - stubFor(get(urlPathEqualTo("/infraActiveRequests/123")) + stubFor(get(urlPathEqualTo("/infraActiveRequests/"+uuid)) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withBody(mapper.writeValueAsString(iar)) .withStatus(HttpStatus.SC_OK))); stubFor(post(urlPathEqualTo("/infraActiveRequests/")) - .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message: empty")) + .withRequestBody(containing("{\"requestId\":\""+uuid+ "\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message:")) .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) .withStatus(HttpStatus.SC_OK))); try { - createEcompOpEn.execute("123", getCloudOrchestrationRequest()); + createEcompOpEn.execute(uuid, getCloudOrchestrationRequest()); }catch(ApiException e){ assertThat(e, sameBeanAs((ApiException) expectedException).ignoring("cause")); } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java index 1dfafce40c..809e39c772 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java @@ -40,7 +40,6 @@ import org.onap.so.client.aai.objects.AAIOperationalEnvironment; import org.onap.so.client.grm.beans.Property; import org.onap.so.client.grm.beans.ServiceEndPointList; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.springframework.beans.factory.annotation.Autowired; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java index 5b0e1f6bfd..7c24050775 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java @@ -37,7 +37,6 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException; import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest; import org.onap.so.client.aai.AAIVersion; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository; import org.springframework.beans.factory.annotation.Autowired; import javax.ws.rs.core.HttpHeaders; diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json new file mode 100644 index 0000000000..561ed0d31f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json @@ -0,0 +1,189 @@ +{ + "requestList": [ + { + "request": { + "requestId": "001619d2-a297-4a4b-a9f5-e2823c88458f", + "startTime": "Fri, 01 Jul 2016 04:41:42 GMT", + "requestScope": "vfModule", + "requestType": "createInstance", + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "test::base::module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false + }, + "cloudConfiguration": { + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId": "n6" + }, + "instanceName": [] + }, + "instanceReferences": { + "vnfInstanceName": "test-vscp", + "vfModuleInstanceName": "MODULENAME1" + }, + "requestStatus": { + "requestState": "COMPLETE", + "statusMessage": "COMPLETED", + "percentProgress": 100, + "finishTime": "Tue, 02 May 2017 06:33:34 GMT" + } + } + }, + { + "request": { + "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017", + "startTime": "Thu, 22 Dec 2016 08:29:54 GMT", + "requestScope": "vfModule", + "requestType": "deleteInstance", + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "test::base::module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false + }, + "cloudConfiguration": { + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId": "n6" + }, + "instanceName": [] + }, + "instanceReferences": { + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "vnfInstanceId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vfModuleInstanceId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992" + }, + "requestStatus": { + "requestState": "COMPLETE", + "statusMessage": "Vf Module has been deleted successfully.", + "percentProgress": 100, + "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT" + } + } + }, + { + "request": { + "requestId": "00032ab7-na18-42e5-965d-8ea592502018", + "startTime": "Thu, 22 Dec 2016 08:29:54 GMT", + "requestScope": "vfModule", + "requestType": "deleteInstance", + "requestDetails": { + "modelInfo": { + "modelType": "vfModule", + "modelName": "test::base::module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false + }, + "cloudConfiguration": { + "tenantId": "6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId": "n6" + }, + "instanceName": [] + }, + "instanceReferences": { + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "vnfInstanceId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vfModuleInstanceId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992" + }, + "requestStatus": { + "requestState": "PENDING", + "statusMessage": "Vf Module deletion pending.", + "percentProgress": 0, + "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT" + } + } + }, + { + "request": { + "requestId": "5ffbabd6-b793-4377-a1ab-082670fbc7ac", + "startTime": "Thu, 22 Dec 2016 08:29:54 GMT", + "requestScope": "vfModule", + "requestType": "deleteInstance", + "requestDetails": { + "modelInfo": { + "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671", + "modelType": "vfModule", + "modelId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelName": "test::base::module-0", + "modelVersion": "2", + "modelCustomizationUuid": "cb82ffd8-252a-11e7-93ae-92361f002671", + "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671", + "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671", + "modelUuid": "20c4431c-246d-11e7-93ae-92361f002671", + "modelInvariantUuid": "78ca26d0-246d-11e7-93ae-92361f002671" + }, + "requestInfo": { + "source": "VID", + "instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1", + "suppressRollback": false, + "requestorId": "xxxxxx" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "76fa8849-4c98-473f-b431-2590b192a653", + "modelInfo": { + "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671", + "modelType": "service", + "modelId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelName": "Infra_v10_Service", + "modelVersion": "1.0", + "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671", + "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671" + } + } + }, + { + "relatedInstance": { + "instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c", + "modelInfo": { + "modelCustomizationName": "v10 1", + "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelType": "vnf", + "modelId": "ff2ae348-214a-11e7-93ae-92361f002671", + "modelName": "v10", + "modelVersion": "1.0", + "modelCustomizationUuid": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671", + "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671", + "modelUuid": "ff2ae348-214a-11e7-93ae-92361f002671", + "modelInvariantUuid": "2fff5b20-214b-11e7-93ae-92361f002671", + "modelInstanceName": "v10 1" + } + } + } + ], + "cloudConfiguration": { + "tenantId": "0422ffb57ba042c0800a29dc85ca70f8", + "lcpCloudRegionId": "n6" + }, + "requestParameters": { + "userParams": [], + "usePreload": true + }, + "instanceName": [] + }, + "instanceReferences": { + "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "vnfInstanceId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vfModuleInstanceId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992" + }, + "requestStatus": { + "requestState": "UNLOCKED", + "statusMessage": "Vf Module deletion pending.", + "percentProgress": 0, + "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT" + } + } + } + ] +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json index 124513de0d..1b1530d3a6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json @@ -1 +1,298 @@ -{"requestList":[{"request":{"requestId":"00032ab7-3fb3-42e5-965d-8ea592502017","requestScope":"vfModule","requestType":"deleteInstance","requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID","suppressRollback":false},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}},"instanceReferences":{"serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc","vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005","vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"},"requestStatus":{"requestState":"COMPLETE","statusMessage":"Vf Module has been deleted successfully.","percentProgress":100}}},{"request":{"requestId":"00032ab7-na18-42e5-965d-8ea592502018","requestScope":"vfModule","requestType":"deleteInstance","requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID","suppressRollback":false},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}},"instanceReferences":{"serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc","vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005","vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"},"requestStatus":{"requestState":"PENDING","statusMessage":"Vf Module deletion pending.","percentProgress":0}}},{"request":{"requestId":"00093944-bf16-4373-ab9a-3adfe730ff2d","requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}},"instanceReferences":{},"requestStatus":{"requestState":"FAILED","statusMessage":"Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.","percentProgress":100}}},{"request":{"requestId":"001619d2-a297-4a4b-a9f5-e2823c88458f","requestScope":"vfModule","requestType":"createInstance","instanceReferences":{},"requestStatus":{"requestState":"COMPLETE","statusMessage":"COMPLETED","percentProgress":100}}},{"request":{"requestId":"00164b9e-784d-48a8-8973-bbad6ef818ed","requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelName":"MSO Test Network","modelVersion":"1.0","modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e"},"requestInfo":{"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}},"instanceReferences":{"serviceInstanceId":"b2f59173-b7e5-4e0f-8440-232fd601b865"},"requestStatus":{"requestState":"COMPLETE","statusMessage":"Service Instance was created successfully.","percentProgress":100}}},{"request":{"requestId":"00173cc9-5ce2-4673-a810-f87fefb2829e","requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}},"instanceReferences":{},"requestStatus":{"requestState":"FAILED","statusMessage":"Error parsing request. No valid instanceName is specified","percentProgress":100}}},{"request":{"requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc349","requestScope":"configuration","requestType":"activateInstance","requestDetails":{"modelInfo":{"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a"}}}],"cloudConfiguration":{"lcpCloudRegionId":"n6"},"requestParameters":{"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}},"instanceReferences":{"serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d"},"requestStatus":{"requestState":"UNLOCKED","percentProgress":20}}},{"request": {"requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc350","requestScope":"service","requestType":"createInstance","requestStatus": {"requestState": "IN_PROGRESS", "statusMessage": "Error parsing request.\n\tNo valid instanceName is specified"}}}]}
\ No newline at end of file +{ + "requestList":[ + { + "request":{ + "requestId":"00032ab7-3fb3-42e5-965d-8ea592502017", + "requestScope":"vfModule", + "requestType":"deleteInstance", + "requestDetails":{ + "modelInfo":{ + "modelType":"vfModule", + "modelName":"test::base::module-0" + }, + "requestInfo":{ + "source":"VID", + "suppressRollback":false + }, + "cloudConfiguration":{ + "tenantId":"6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId":"n6" + } + }, + "instanceReferences":{ + "serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992" + }, + "requestStatus":{ + "requestState":"COMPLETE", + "statusMessage":"Vf Module has been deleted successfully.", + "percentProgress":100 + } + } + }, + { + "request":{ + "requestId":"00032ab7-na18-42e5-965d-8ea592502018", + "requestScope":"vfModule", + "requestType":"deleteInstance", + "requestDetails":{ + "modelInfo":{ + "modelType":"vfModule", + "modelName":"test::base::module-0" + }, + "requestInfo":{ + "source":"VID", + "suppressRollback":false + }, + "cloudConfiguration":{ + "tenantId":"6accefef3cb442ff9e644d589fb04107", + "lcpCloudRegionId":"n6" + } + }, + "instanceReferences":{ + "serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc", + "vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005", + "vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992" + }, + "requestStatus":{ + "requestState":"PENDING", + "statusMessage":"Vf Module deletion pending.", + "percentProgress":0 + } + } + }, + { + "request":{ + "requestId":"00093944-bf16-4373-ab9a-3adfe730ff2d", + "requestScope":"service", + "requestType":"createInstance", + "requestDetails":{ + "modelInfo":{ + "modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671", + "modelType":"service", + "modelName":"MSOTADevInfra_v10_Service", + "modelVersion":"1.0", + "modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671" + }, + "requestInfo":{ + "source":"VID", + "instanceName":"MSODEV_1707_SI_v10_011-4", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "subscriberInfo":{ + "globalSubscriberId":"MSO_1610_dev", + "subscriberName":"MSO_1610_dev" + }, + "cloudConfiguration":{ + "tenantId":"19123c2924c648eb8e42a3c1f14b7682", + "lcpCloudRegionId":"n6" + }, + "requestParameters":{ + "subscriptionServiceType":"MSO-dev-service-type", + "userParams":[ + { + "name":"someUserParam", + "value":"someValue" + } + ], + "aLaCarte":true, + "autoBuildVfModules":false, + "cascadeDelete":false, + "usePreload":true + } + }, + "instanceReferences":{ + + }, + "requestStatus":{ + "requestState":"FAILED", + "statusMessage":"Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.", + "percentProgress":100 + } + } + }, + { + "request":{ + "requestId":"001619d2-a297-4a4b-a9f5-e2823c88458f", + "requestScope":"vfModule", + "requestType":"createInstance", + "instanceReferences":{ + + }, + "requestStatus":{ + "requestState":"COMPLETE", + "statusMessage":"COMPLETED", + "percentProgress":100 + } + } + }, + { + "request":{ + "requestId":"00164b9e-784d-48a8-8973-bbad6ef818ed", + "requestScope":"service", + "requestType":"createInstance", + "requestDetails":{ + "modelInfo":{ + "modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f", + "modelType":"service", + "modelName":"MSO Test Network", + "modelVersion":"1.0", + "modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e" + }, + "requestInfo":{ + "source":"VID", + "instanceName":"DEV-n6-3100-0927-1", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "subscriberInfo":{ + "globalSubscriberId":"MSO_1610_dev", + "subscriberName":"MSO_1610_dev" + }, + "cloudConfiguration":{ + "tenantId":"19123c2924c648eb8e42a3c1f14b7682", + "lcpCloudRegionId":"n6" + }, + "requestParameters":{ + "subscriptionServiceType":"MSO-dev-service-type", + "userParams":[ + { + "name":"someUserParam", + "value":"someValue" + } + ], + "aLaCarte":true, + "autoBuildVfModules":false, + "cascadeDelete":false, + "usePreload":true + } + }, + "instanceReferences":{ + "serviceInstanceId":"b2f59173-b7e5-4e0f-8440-232fd601b865" + }, + "requestStatus":{ + "requestState":"COMPLETE", + "statusMessage":"Service Instance was created successfully.", + "percentProgress":100 + } + } + }, + { + "request":{ + "requestId":"00173cc9-5ce2-4673-a810-f87fefb2829e", + "requestScope":"service", + "requestType":"createInstance", + "requestDetails":{ + "modelInfo":{ + "modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51", + "modelType":"service", + "modelName":"ConstraintsSrvcVID", + "modelVersion":"2.0", + "modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656" + }, + "requestInfo":{ + "productFamilyId":"LRSI-OSPF", + "source":"VID", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "subscriberInfo":{ + "globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + "cloudConfiguration":{ + "tenantId":"a259ae7b7c3f493cb3d91f95a7c18149", + "lcpCloudRegionId":"mtn16" + }, + "requestParameters":{ + "subscriptionServiceType":"Mobility", + "userParams":[ + { + "name":"neutronport6_name", + "value":"8" + }, + { + "name":"neutronnet5_network_name", + "value":"8" + }, + { + "name":"contrailv2vlansubinterface3_name", + "value":"false" + } + ] + } + }, + "instanceReferences":{ + + }, + "requestStatus":{ + "requestState":"FAILED", + "statusMessage":"Error parsing request. No valid instanceName is specified", + "percentProgress":100 + } + } + }, + { + "request":{ + "requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc349", + "requestScope":"configuration", + "requestType":"activateInstance", + "requestDetails":{ + "modelInfo":{ + "modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39", + "modelType":"configuration", + "modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455", + "modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671" + }, + "requestInfo":{ + "source":"VID", + "suppressRollback":false, + "requestorId":"xxxxxx" + }, + "relatedInstanceList":[ + { + "relatedInstance":{ + "instanceId":"9e15a443-af65-4f05-9000-47ae495e937d", + "modelInfo":{ + "modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a", + "modelType":"service", + "modelName":"MSOTADevInfra_Configuration_Service", + "modelVersion":"1.0", + "modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a" + } + } + } + ], + "cloudConfiguration":{ + "lcpCloudRegionId":"n6" + }, + "requestParameters":{ + "aLaCarte":false, + "autoBuildVfModules":false, + "cascadeDelete":false, + "usePreload":true + } + }, + "instanceReferences":{ + "serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d" + }, + "requestStatus":{ + "requestState":"UNLOCKED", + "percentProgress":20 + } + } + }, + { + "request":{ + "requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc350", + "requestScope":"service", + "requestType":"createInstance", + "requestStatus":{ + "requestState":"IN_PROGRESS", + "statusMessage":"Error parsing request.\n\tNo valid instanceName is specified" + } + } + } + ] +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json new file mode 100644 index 0000000000..79caa33419 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json @@ -0,0 +1,24 @@ +[ + { + "id": 1, + "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018", + "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714", + "name": "requestAction", + "value": "assign", + "tag": "pincFabricConfigRequest" + },{ + "id": 2, + "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018", + "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714", + "name": "pincFabricId", + "value": "testId", + "tag": "pincFabricConfigRequest" + },{ + "id": 3, + "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018", + "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca715", + "name": "requestAction", + "value": "unassign", + "tag": "pincFabricConfig" + } +]
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json new file mode 100644 index 0000000000..af28007900 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json @@ -0,0 +1,8 @@ +{ + "id": 1, + "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018", + "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714", + "name": "requestAction", + "value": "assign", + "tag": "pincFabricConfigRequest" +} diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json index 993310d48f..a37fe050eb 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json @@ -1,45 +1,18 @@ { - "requestDetails": { - "cloudConfiguration": { - "lcpCloudRegionId": "mtn6", - "tenantId": "19123c2924c648eb8e42a3c1f14b7682" - }, - "modelInfo": { - "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21", - "modelName": "TestNetworkType", - "modelType": "network", - "modelVersion": "2.0", - "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb", - "modelCustomizationId": "3bdbb104-476c-483e-9f8b-c095b3d308ac" - }, - "requestInfo": { - "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", - "requestorId": "xxxxxx", - "source": "VID", - "suppressRollback": false, - "instanceName": "tested" - }, - "requestParameters": { - "aLaCarte" : true, - "autoBuildVfModules": false, - "subscriptionServiceType": "MSO-dev-service-type", - "userParams": [ - { - "name": "aic_zone", - "value": "mtn6" - } - ] - }, - "subscriberInfo": { - "globalSubscriberId": "MSO_1610_dev", - "subscriberName": "MSO_1610_dev" - }, - "project": { - "projectName": "projectName" - }, - "owningEntity": { - "owningEntityId": "oeId", - "owningEntityName": "oeName" - } - } + "requestDetails":{ + "modelInfo":{ + "modelType":"network" + }, + "requestInfo":{ + "source":"VID", + "requestorId":"xxxxxx" + }, + "requestParameters":{ + "testApi":"VNF_API" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"cloudRegionId", + "tenantId":"821553e85fd2461ab205bcd45cc3eeda" + } + } }
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql index 3540110351..381330b928 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql @@ -770,6 +770,77 @@ FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` ON DELETE CASCADE ON UPDATE CASCADE) ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; +CREATE TABLE IF NOT EXISTS vnfc_customization ( +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS cvnfc_customization ( +`ID` INT(11) NOT NULL AUTO_INCREMENT, +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`NFC_FUNCTION` VARCHAR(200) NULL, +`NFC_NAMING_CODE` VARCHAR(200) NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; + --------START Request DB SCHEMA -------- CREATE DATABASE requestdb; USE requestdb; diff --git a/mso-api-handlers/mso-requests-db-repositories/pom.xml b/mso-api-handlers/mso-requests-db-repositories/pom.xml new file mode 100644 index 0000000000..a46111bf96 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/pom.xml @@ -0,0 +1,55 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.so</groupId> + <artifactId>mso-api-handlers</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + + <artifactId>mso-requests-db-repositories</artifactId> + + <name>mso-requests-db-repositories</name> + <description>SO Request Database JPA Respositories</description> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + <dependencies> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>mso-requests-db</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-rest</artifactId> + <optional>true</optional> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mariadb.jdbc</groupId> + <artifactId>mariadb-java-client</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <packaging>jar</packaging> + <build> + <finalName>${project.artifactId}</finalName> + </build> +</project>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java index 603f9bb494..603f9bb494 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java index cd25b122be..cd25b122be 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepository.java diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java new file mode 100644 index 0000000000..570861dfa1 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.request.data.repository; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.stereotype.Repository; + +@Repository +public interface InfraActiveRequestsRepositoryCustom { + + public boolean healthCheck(); + + public InfraActiveRequests getRequestFromInfraActive(String requestId); + + public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, + String requestScope); + + public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap); + + // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB + // (infra_active_requests table) for operationalEnvId and OperationalEnvName + public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap); + + public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, String queryValue, + String requestType); + + public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType); + + public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType); + + public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType); + + public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId); + + List<InfraActiveRequests> getInfraActiveRequests(final Map<String, String[]> filters, final long startTime, + final long endTime, final Integer maxResult); + +} diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java new file mode 100644 index 0000000000..d66e378146 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java @@ -0,0 +1,618 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.request.data.repository; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.concurrent.TimeUnit; + +import javax.persistence.EntityManager; +import javax.persistence.NonUniqueResultException; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Order; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + + +@Repository +@Transactional(readOnly = true) +public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRepositoryCustom { + + + @Qualifier("requestEntityManagerFactory") + @Autowired + private EntityManager entityManager; + + protected static MsoLogger msoLogger = + MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, InfraActiveRequestsRepositoryImpl.class); + + protected static final String REQUEST_STATUS = "requestStatus"; + protected static final String SOURCE = "source"; + protected static final String START_TIME = "startTime"; + protected static final String END_TIME = "endTime"; + protected static final String REQUEST_TYPE = "requestType"; + protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; + protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName"; + protected static final String VNF_INSTANCE_NAME = "vnfName"; + protected static final String VNF_INSTANCE_ID = "vnfId"; + protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName"; + protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId"; + protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName"; + protected static final String VFMODULE_INSTANCE_ID = "vfModuleId"; + protected static final String NETWORK_INSTANCE_NAME = "networkName"; + protected static final String CONFIGURATION_INSTANCE_ID = "configurationId"; + protected static final String CONFIGURATION_INSTANCE_NAME = "configurationName"; + protected static final String OPERATIONAL_ENV_ID = "operationalEnvId"; + protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName"; + protected static final String NETWORK_INSTANCE_ID = "networkId"; + protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId"; + protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId"; + protected static final String SERVICE_ID = "serviceId"; + protected static final String SERVICE_VERSION = "serviceVersion"; + protected static final String REQUEST_ID = "requestId"; + protected static final String REQUESTOR_ID = "requestorId"; + protected static final String ACTION = "action"; + + private static final List<String> VALID_COLUMNS = + Arrays.asList(REQUEST_ID, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, ACTION, REQUEST_STATUS); + + + /* + * (non-Javadoc) + * + * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#healthCheck() + */ + @Override + public boolean healthCheck() { + + final Query query = entityManager.createNativeQuery(" show tables "); + + final List<?> list = query.getResultList(); + + return true; + } + + private List<InfraActiveRequests> executeInfraQuery(final CriteriaQuery<InfraActiveRequests> crit, + final List<Predicate> predicates, final Order order) { + + final long startTime = System.currentTimeMillis(); + msoLogger.debug("Execute query on infra active request table"); + + List<InfraActiveRequests> results = new ArrayList<InfraActiveRequests>(); + + try { + final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + crit.where(cb.and(predicates.toArray(new Predicate[0]))); + crit.orderBy(order); + results = entityManager.createQuery(crit).getResultList(); + + } finally { + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "getInfraActiveRequest", null); + } + return results; + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java. + * lang.String) + */ + @Override + public InfraActiveRequests getRequestFromInfraActive(final String requestId) { + final long startTime = System.currentTimeMillis(); + msoLogger.debug("Get request " + requestId + " from InfraActiveRequests DB"); + + InfraActiveRequests ar = null; + try { + final Query query = entityManager.createQuery( + "from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId"); + query.setParameter(REQUEST_ID, requestId); + ar = this.getSingleResult(query); + } finally { + + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null); + } + return ar; + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java. + * util.HashMap, java.lang.String, java.lang.String) + */ + @Override + public InfraActiveRequests checkInstanceNameDuplicate(final HashMap<String, String> instanceIdMap, + final String instanceName, final String requestScope) { + + final List<Predicate> predicates = new LinkedList<>(); + final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); + final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); + + if (instanceName != null && !instanceName.equals("")) { + + if ("service".equals(requestScope)) { + predicates.add(cb.equal(tableRoot.get(SERVICE_INSTANCE_NAME), instanceName)); + } else if ("vnf".equals(requestScope)) { + predicates.add(cb.equal(tableRoot.get(VNF_INSTANCE_NAME), instanceName)); + } else if ("volumeGroup".equals(requestScope)) { + predicates.add(cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_NAME), instanceName)); + } else if ("vfModule".equals(requestScope)) { + predicates.add(cb.equal(tableRoot.get(VFMODULE_INSTANCE_NAME), instanceName)); + } else if ("network".equals(requestScope)) { + predicates.add(cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName)); + } else if (requestScope.equals("configuration")) { + predicates.add(cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName)); + } else if (requestScope.equals("operationalEnvironment")) { + predicates.add(cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName)); + } + + } else { + if (instanceIdMap != null) { + if ("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null) { + predicates + .add(cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId"))); + } + + if ("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null) { + predicates.add(cb.equal(tableRoot.get(VNF_INSTANCE_ID), instanceIdMap.get("vnfInstanceId"))); + } + + if ("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null) { + predicates.add( + cb.equal(tableRoot.get(VFMODULE_INSTANCE_ID), instanceIdMap.get("vfModuleInstanceId"))); + } + + if ("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null) { + predicates.add(cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_ID), + instanceIdMap.get("volumeGroupInstanceId"))); + } + + if ("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null) { + predicates + .add(cb.equal(tableRoot.get(NETWORK_INSTANCE_ID), instanceIdMap.get("networkInstanceId"))); + } + + if (requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null) { + predicates.add(cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_ID), + instanceIdMap.get("configurationInstanceId"))); + } + + if (requestScope.equals("operationalEnvironment") + && instanceIdMap.get("operationalEnvironmentId") != null) { + predicates.add( + cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId"))); + } + } + } + + predicates.add(tableRoot.get(REQUEST_STATUS) + .in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK"))); + + final Order order = cb.desc(tableRoot.get(START_TIME)); + + final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order); + + InfraActiveRequests infraActiveRequests = null; + + if (dupList != null && !dupList.isEmpty()) { + infraActiveRequests = dupList.get(0); + } + + return infraActiveRequests; + } + + /* + * (non-Javadoc) + * + * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom# + * getOrchestrationFiltersFromInfraActive(java.util.Map) + */ + @Override + public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive( + final Map<String, List<String>> orchestrationMap) { + + + final List<Predicate> predicates = new LinkedList<>(); + final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); + final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); + for (final Map.Entry<String, List<String>> entry : orchestrationMap.entrySet()) { + String mapKey = entry.getKey(); + if ("serviceInstanceId".equalsIgnoreCase(mapKey)) { + mapKey = "serviceInstanceId"; + } else if ("serviceInstanceName".equalsIgnoreCase(mapKey)) { + mapKey = "serviceInstanceName"; + } else if ("vnfInstanceId".equalsIgnoreCase(mapKey)) { + mapKey = "vnfId"; + } else if ("vnfInstanceName".equalsIgnoreCase(mapKey)) { + mapKey = "vnfName"; + } else if ("vfModuleInstanceId".equalsIgnoreCase(mapKey)) { + mapKey = "vfModuleId"; + } else if ("vfModuleInstanceName".equalsIgnoreCase(mapKey)) { + mapKey = "vfModuleName"; + } else if ("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) { + mapKey = "volumeGroupId"; + } else if ("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) { + mapKey = "volumeGroupName"; + } else if ("networkInstanceId".equalsIgnoreCase(mapKey)) { + mapKey = "networkId"; + } else if ("networkInstanceName".equalsIgnoreCase(mapKey)) { + mapKey = "networkName"; + } else if (mapKey.equalsIgnoreCase("configurationInstanceId")) { + mapKey = "configurationId"; + } else if (mapKey.equalsIgnoreCase("configurationInstanceName")) { + mapKey = "configurationName"; + } else if ("lcpCloudRegionId".equalsIgnoreCase(mapKey)) { + mapKey = "aicCloudRegion"; + } else if ("tenantId".equalsIgnoreCase(mapKey)) { + mapKey = "tenantId"; + } else if ("modelType".equalsIgnoreCase(mapKey)) { + mapKey = "requestScope"; + } else if ("requestorId".equalsIgnoreCase(mapKey)) { + mapKey = "requestorId"; + } else if ("requestExecutionDate".equalsIgnoreCase(mapKey)) { + mapKey = "startTime"; + } + + final String propertyValue = entry.getValue().get(1); + if ("startTime".equals(mapKey)) { + final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); + try { + final Date thisDate = format.parse(propertyValue); + final Timestamp minTime = new Timestamp(thisDate.getTime()); + final Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); + + if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { + predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime), + cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime))); + } else { + predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime)); + } + } catch (final Exception e) { + msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e); + return null; + } + } else if ("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { + predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue)); + } else { + predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue)); + } + + } + + final Order order = cb.asc(tableRoot.get(START_TIME)); + + return executeInfraQuery(crit, predicates, order); + } + + // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB + // (infra_active_requests table) for operationalEnvId and OperationalEnvName + /* + * (non-Javadoc) + * + * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom# + * getCloudOrchestrationFiltersFromInfraActive(java.util.Map) + */ + @Override + public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive( + final Map<String, String> orchestrationMap) { + final List<Predicate> predicates = new LinkedList<>(); + final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); + final Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); + + // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in + // the filter + // as the same requestorId can also match on different API methods + final String resourceType = orchestrationMap.get("resourceType"); + if (resourceType == null) { + predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment")); + } + + for (final Map.Entry<String, String> entry : orchestrationMap.entrySet()) { + String mapKey = entry.getKey(); + if (mapKey.equalsIgnoreCase("requestorId")) { + mapKey = "requestorId"; + } else if (mapKey.equalsIgnoreCase("requestExecutionDate")) { + mapKey = "startTime"; + } else if (mapKey.equalsIgnoreCase("operationalEnvironmentId")) { + mapKey = "operationalEnvId"; + } else if (mapKey.equalsIgnoreCase("operationalEnvironmentName")) { + mapKey = "operationalEnvName"; + } else if (mapKey.equalsIgnoreCase("resourceType")) { + mapKey = "requestScope"; + } + + final String propertyValue = entry.getValue(); + if (mapKey.equals("startTime")) { + final SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); + try { + final Date thisDate = format.parse(propertyValue); + final Timestamp minTime = new Timestamp(thisDate.getTime()); + final Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); + + predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime)); + } catch (final Exception e) { + msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage()); + return null; + } + } else { + predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue)); + } + } + + final Order order = cb.asc(tableRoot.get(START_TIME)); + return executeInfraQuery(crit, predicates, order); + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java + * .lang.String, java.lang.String, java.lang.String) + */ + @Override + public List<InfraActiveRequests> getRequestListFromInfraActive(final String queryAttributeName, + final String queryValue, final String requestType) { + msoLogger.debug("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue); + + + try { + final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); + final Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class); + final Predicate isEqual = cb.equal(candidateRoot.get(queryAttributeName), queryValue); + final Predicate equalRequestType = cb.equal(candidateRoot.get(REQUEST_TYPE), requestType); + final Predicate isNull = cb.isNull(candidateRoot.get(REQUEST_TYPE)); + final Predicate orClause = cb.or(equalRequestType, isNull); + final Order orderDesc = cb.desc(candidateRoot.get(START_TIME)); + final Order orderAsc = cb.asc(candidateRoot.get(SOURCE)); + crit.where(cb.and(isEqual, orClause)).orderBy(orderDesc, orderAsc); + + final List<InfraActiveRequests> arList = entityManager.createQuery(crit).getResultList(); + if (arList != null && !arList.isEmpty()) { + return arList; + } + } catch (final Exception exception) { + msoLogger.error("Unable to execute query", exception); + } + return Collections.emptyList(); + } + + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java. + * lang.String, java.lang.String) + */ + @Override + public InfraActiveRequests getRequestFromInfraActive(final String requestId, final String requestType) { + final long startTime = System.currentTimeMillis(); + msoLogger.debug("Get infra request from DB with id " + requestId); + + InfraActiveRequests ar = null; + try { + final Query query = entityManager.createQuery( + "from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); + query.setParameter(REQUEST_ID, requestId); + query.setParameter(REQUEST_TYPE, requestType); + ar = this.getSingleResult(query); + } finally { + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "getRequestFromInfraActive", null); + } + return ar; + } + + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang. + * String, java.lang.String, java.lang.String) + */ + @Override + public InfraActiveRequests checkDuplicateByVnfName(final String vnfName, final String action, + final String requestType) { + + final long startTime = System.currentTimeMillis(); + msoLogger.debug("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + + requestType); + + InfraActiveRequests ar = null; + try { + final Query query = entityManager.createQuery( + "from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC"); + query.setParameter("vnfName", vnfName); + query.setParameter("action", action); + query.setParameter(REQUEST_TYPE, requestType); + @SuppressWarnings("unchecked") + final List<InfraActiveRequests> results = query.getResultList(); + if (!results.isEmpty()) { + ar = results.get(0); + } + } finally { + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "checkDuplicateByVnfName", null); + } + + return ar; + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang. + * String, java.lang.String, java.lang.String) + */ + @Override + public InfraActiveRequests checkDuplicateByVnfId(final String vnfId, final String action, + final String requestType) { + + final long startTime = System.currentTimeMillis(); + msoLogger.debug("Get list of infra requests from DB for VNF " + vnfId + " and action " + action); + + InfraActiveRequests ar = null; + try { + final Query query = entityManager.createQuery( + "from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC"); + query.setParameter("vnfId", vnfId); + query.setParameter("action", action); + query.setParameter(REQUEST_TYPE, requestType); + @SuppressWarnings("unchecked") + final List<InfraActiveRequests> results = query.getResultList(); + if (!results.isEmpty()) { + ar = results.get(0); + } + } finally { + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "checkDuplicateByVnfId", null); + } + + return ar; + } + + /* + * (non-Javadoc) + * + * @see + * org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String) + */ + @Override + public InfraActiveRequests checkVnfIdStatus(final String operationalEnvironmentId) { + final long startTime = System.currentTimeMillis(); + msoLogger.debug("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId); + + InfraActiveRequests ar = null; + try { + final CriteriaBuilder cb = entityManager.getCriteriaBuilder(); + final CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); + final Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class); + final Predicate operationalEnvEq = + cb.equal(candidateRoot.get("operationalEnvId"), operationalEnvironmentId); + final Predicate requestStatusNotEq = cb.notEqual(candidateRoot.get(REQUEST_STATUS), "COMPLETE"); + final Predicate actionEq = cb.equal(candidateRoot.get("action"), "create"); + final Order startTimeOrder = cb.desc(candidateRoot.get("startTime")); + crit.select(candidateRoot); + crit.where(cb.and(operationalEnvEq, requestStatusNotEq, actionEq)); + crit.orderBy(startTimeOrder); + final TypedQuery<InfraActiveRequests> query = entityManager.createQuery(crit); + final List<InfraActiveRequests> results = query.getResultList(); + if (!results.isEmpty()) { + ar = results.get(0); + } + } finally { + msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, + "Successfully", "RequestDB", "checkDuplicateByVnfName", null); + } + + return ar; + } + + protected <T> T getSingleResult(final Query query) { + query.setMaxResults(1); + final List<T> list = query.getResultList(); + if (list == null || list.isEmpty()) { + return null; + } else if (list.size() == 1) { + return list.get(0); + } else { + throw new NonUniqueResultException(); + } + + } + + @Override + public List<InfraActiveRequests> getInfraActiveRequests(final Map<String, String[]> filters, final long startTime, + final long endTime, final Integer maxResult) { + if (filters == null) { + return Collections.emptyList(); + } + try { + final CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); + final CriteriaQuery<InfraActiveRequests> criteriaQuery = + criteriaBuilder.createQuery(InfraActiveRequests.class); + final Root<InfraActiveRequests> tableRoot = criteriaQuery.from(InfraActiveRequests.class); + final List<Predicate> predicates = getPredicates(filters, criteriaBuilder, tableRoot); + + final Timestamp minTime = new Timestamp(startTime); + final Timestamp maxTime = new Timestamp(endTime); + predicates.add(criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime)); + predicates.add(criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime)); + + criteriaQuery.where(criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]))); + if (maxResult != null) { + return entityManager.createQuery(criteriaQuery).setMaxResults(maxResult).getResultList(); + } + return entityManager.createQuery(criteriaQuery).getResultList(); + } catch (final Exception exception) { + msoLogger.error("Unable to execute query using filters: " + filters, exception); + return Collections.emptyList(); + } + } + + private List<Predicate> getPredicates(final Map<String, String[]> filters, final CriteriaBuilder criteriaBuilder, + final Root<InfraActiveRequests> tableRoot) { + final List<Predicate> predicates = new LinkedList<>(); + for (final Entry<String, String[]> entry : filters.entrySet()) { + final String[] params = entry.getValue(); + if (VALID_COLUMNS.contains(entry.getKey()) && params.length == 2) { + final QueryOperationType operationType = QueryOperationType.getQueryOperationType(params[0]); + final Predicate predicate = + operationType.getPredicate(criteriaBuilder, tableRoot, entry.getKey(), params[1]); + predicates.add(predicate); + } + } + return predicates; + } +} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java index 16e10e3d5b..16e10e3d5b 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java index e89755d565..e89755d565 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java index bcad9ce6d5..bcad9ce6d5 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java new file mode 100644 index 0000000000..f80be0525c --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.request.data.repository; + +import java.util.List; + +import org.onap.so.db.request.beans.RequestProcessingData; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "requestProcessingData", path = "requestProcessingData") +public interface RequestProcessingDataRepository extends JpaRepository<RequestProcessingData, Integer> { + RequestProcessingData findOneBySoRequestIdAndGroupingIdAndNameAndTag( + @Param("SO_REQUEST_ID") String soRequestId, @Param("GROUPING_ID") String groupingId, + @Param("NAME") String name, @Param("TAG") String tag); + + List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId); +} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java index b93bf7840b..b93bf7840b 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java index 179d40ad23..179d40ad23 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java index 138ec0fb4d..138ec0fb4d 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java index fde8485e6d..fde8485e6d 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java index b9585d495e..b9585d495e 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/BaseTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..5a8df1d556 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public abstract class BaseTest { + +} diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java index ec2c41bf8c..00d212a23e 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/TestApplication.java @@ -24,7 +24,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Profile; -@SpringBootApplication(scanBasePackages = { "org.onap" }) +@SpringBootApplication(scanBasePackages = { "org.onap.so.db" }) @Profile("test") public class TestApplication { public static void main(String... args) { diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java index a10d948b8f..a10d948b8f 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationStatusTest.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationStatusTest.java diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java index c12d3cbb7b..c12d3cbb7b 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/OperationalEnvServiceModelStatusTest.java diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java index 9bcff13699..9bcff13699 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/RequestDBConfig.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/RequestDBConfig.java diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java index 917f52d4ad..917f52d4ad 100644 --- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/SiteStatusTest.java +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/SiteStatusTest.java diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java new file mode 100644 index 0000000000..d889a15fc4 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java @@ -0,0 +1,184 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.db.request.data.repository; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertTrue; +import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.ACTION; +import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.REQUEST_ID; +import static org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl.SERVICE_INSTANCE_ID; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.TestApplication; +import org.onap.so.db.request.beans.InfraActiveRequests; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class InfraActiveRequestsRepositoryImplTest { + + private static final int MAX_LIMIT = 1; + private static final long END_TIME_IN_MILISEC = 1482436800000l; + private static final long START_TIME_IN_MILISEC = 1482429600000l; + private static final String REQUEST_ID_VALUE = "00032ab7-3fb3-42e5-965d-8ea592502017"; + private static final String SERVICE_INSTANCE_ID_VALUE = "e3b5744d-2ad1-4cdd-8390-c999a38829bc"; + + @Autowired + private InfraActiveRequestsRepository objUnderTest; + + @Test + public void test_GetInfraActiveRequests_emptyFiltersMap() { + final List<InfraActiveRequests> actualRequests = objUnderTest.getInfraActiveRequests(Collections.emptyMap(), + START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); + assertFalse(actualRequests.isEmpty()); + } + + @Test + public void test_GetInfraActiveRequests_invalidFiltersMap() { + final Map<String, String[]> filters = new HashMap<>(); + filters.put("OverTheMoon", new String[] {"Humpty Dumpty Sat On The Wall"}); + final long startTime = START_TIME_IN_MILISEC - TimeUnit.DAYS.toMillis(20); + final long endTime = END_TIME_IN_MILISEC - TimeUnit.DAYS.toMillis(20); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(filters, startTime, endTime, null); + assertTrue(actualRequests.isEmpty()); + } + + @Test + public void test_GetInfraActiveRequests_invalidFiltersMapWithInvalidKey() { + final Map<String, String[]> filters = new HashMap<>(); + filters.put("OverTheMoon", new String[] {"Avengers", "Humpty Dumpty Sat On The Wall"}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(filters, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); + assertFalse(actualRequests.isEmpty()); + } + + @Test + public void test_GetInfraActiveRequestsData_withEqualServiceInstanceId() { + final Map<String, String[]> values = new HashMap<>(); + values.put(SERVICE_INSTANCE_ID, new String[] {QueryOperationType.EQ.name(), SERVICE_INSTANCE_ID_VALUE}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, 1); + assertFalse(actualRequests.isEmpty()); + + assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); + } + + + @Test + public void test_GetInfraActiveRequestsData_withLikeRequestID() { + final Map<String, String[]> values = new HashMap<>(); + values.put(REQUEST_ID, new String[] {QueryOperationType.LIKE.name(), "00032ab7"}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, 1); + assertFalse(actualRequests.isEmpty()); + + assertEquals(REQUEST_ID_VALUE, actualRequests.get(0).getRequestId()); + assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); + } + + + @Test + public void test_GetInfraActiveRequestsData_withLikeRequestIDAndEqualToServiceInstanceId() { + final Map<String, String[]> values = new HashMap<>(); + values.put(REQUEST_ID, new String[] {QueryOperationType.LIKE.name(), "00032ab7"}); + values.put(SERVICE_INSTANCE_ID, new String[] {QueryOperationType.EQ.name(), SERVICE_INSTANCE_ID_VALUE}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, 1); + assertFalse(actualRequests.isEmpty()); + + assertEquals(REQUEST_ID_VALUE, actualRequests.get(0).getRequestId()); + assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId()); + } + + + @Test + public void test_GetInfraActiveRequestsData_withNotEqualAction() { + final Map<String, String[]> values = new HashMap<>(); + values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); + assertFalse(actualRequests.isEmpty()); + for (final InfraActiveRequests actualActiveRequests : actualRequests) { + assertNotEquals("createInstance", actualActiveRequests.getAction()); + } + } + + + @Test + public void test_GetInfraActiveRequestsData_withNotEqualToServiceInstanceNameAndServiceInstanceIdNul() { + final Map<String, String[]> values = new HashMap<>(); + values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); + values.put(SERVICE_INSTANCE_ID, new String[] {QueryOperationType.EQ.name(), SERVICE_INSTANCE_ID_VALUE}); + + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); + assertFalse(actualRequests.isEmpty()); + for (final InfraActiveRequests actualActiveRequests : actualRequests) { + assertNotEquals("createInstance", actualActiveRequests.getAction()); + assertEquals(SERVICE_INSTANCE_ID_VALUE, actualActiveRequests.getServiceInstanceId()); + } + } + + @Test + public void test_GetInfraActiveRequestsData_withStartEndDateTimeNotEqualAction() { + final Map<String, String[]> values = new HashMap<>(); + values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, null); + assertFalse(actualRequests.isEmpty()); + for (final InfraActiveRequests actualActiveRequests : actualRequests) { + assertNotEquals("createInstance", actualActiveRequests.getAction()); + } + } + + @Test + public void test_GetInfraActiveRequestsData_withLimitNotEqualAction() { + final Map<String, String[]> values = new HashMap<>(); + values.put(ACTION, new String[] {QueryOperationType.NEQ.name(), "createInstance"}); + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(values, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT); + assertFalse(actualRequests.isEmpty()); + for (final InfraActiveRequests actualActiveRequests : actualRequests) { + assertNotEquals("createInstance", actualActiveRequests.getAction()); + } + } + + @Test + public void test_GetInfraActiveRequestsData_withNullFilters() { + final List<InfraActiveRequests> actualRequests = + objUnderTest.getInfraActiveRequests(null, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT); + assertTrue(actualRequests.isEmpty()); + } +} diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql new file mode 100644 index 0000000000..897dd3faca --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql @@ -0,0 +1,35 @@ +use requestdb; + +insert into operation_status(service_id, operation_id, service_name, user_id, result, operation_content, progress, reason, operate_at, finished_at) values +('serviceid', 'operationid', 'servicename', 'userid', 'result', 'operationcontent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10'); + + +insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, aic_cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name) values +('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null), +('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null), +('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null), +('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-MTN6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}}}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-MTN6-3100-0927-1', 'xxxxxx', null, null, null, null), +('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null), +('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, null, null, null, null, '{"requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null); + +insert into watchdog_distributionid_status(distribution_id, distribution_id_status, create_time, modify_time) values +('1533c4bd-a3e3-493f-a16d-28c20614415e', '', '2017-11-30 15:48:09', '2017-11-30 15:48:09'), +('55429711-809b-4a3b-9ee5-5120d46d9de0', '', '2017-11-30 16:35:36', '2017-11-30 16:35:36'), +('67f0b2d1-9013-4b2b-9914-bbe2288284fb', '', '2017-11-30 15:54:39', '2017-11-30 15:54:39'); + +insert into watchdog_per_component_distribution_status(distribution_id, component_name, component_distribution_status, create_time, modify_time) values +('1533c4bd-a3e3-493f-a16d-28c20614415e', 'MSO', 'COMPONENT_DONE_OK', '2017-11-30 15:48:09', '2017-11-30 15:48:09'), +('55429711-809b-4a3b-9ee5-5120d46d9de0', 'MSO', 'COMPONENT_DONE_ERROR', '2017-11-30 16:35:36', '2017-11-30 16:35:36'), +('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'MSO', 'COMPONENT_DONE_OK', '2017-11-30 15:54:39', '2017-11-30 15:54:39'); + +insert into watchdog_service_mod_ver_id_lookup(distribution_id, service_model_version_id, create_time, modify_time) values +('1533c4bd-a3e3-493f-a16d-28c20614415e', '7e813ab5-88d3-4fcb-86c0-498c5d7eef9a', '2017-11-30 15:48:08', '2017-11-30 15:48:08'), +('55429711-809b-4a3b-9ee5-5120d46d9de0', 'cc031e75-4442-4d1a-b774-8a2b434e0a50', '2017-11-30 16:35:36', '2017-11-30 16:35:36'), +('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'eade1e9d-c1ec-4ef3-bc31-60570fba1573', '2017-11-30 15:54:39', '2017-11-30 15:54:39'); + + +insert into site_status(site_name, status, creation_timestamp) values +('testsite', 0, '2017-11-30 15:48:09'); + +INSERT INTO requestdb.request_processing_data (ID, SO_REQUEST_ID, GROUPING_ID, NAME, VALUE, TAG) VALUES +(1, 'fbb8df64-9be5-11e8-98d0-529269fb1459', '12b84dc6-9be6-11e8-98d0-529269fb1459', 'test-name', 'test-value', 'test-tag');
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/application-test.yaml b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..c4dd60356b --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/application-test.yaml @@ -0,0 +1,45 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck + +server: + port: 8080 + tomcat: + max-threads: 50 +ssl-enable: false +mso: + adapters: + requestDb: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + endpoint: http://localhost:8081 + site-name: localDevEnv + logPath: logs + +# H2 +spring: + datasource: + url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1; + username: sa + password: sa + driver-class-name: org.h2.Driver + h2: + console: + enabled: true + path: /h2 + + jpa: + show-sql: true + hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + + +#Actuator +management: + security: + enabled: false + basic: + enabled: false + + + diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..1951484752 --- /dev/null +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/logback-test.xml @@ -0,0 +1,46 @@ +<configuration > + + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{1024} - %msg%n</pattern> + </encoder> + </appender> + + + <logger name="com.att.ecomp.audit" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.metrics" level="info" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="com.att.eelf.error" level="trace" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + + <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false"> + <appender-ref ref="STDOUT" /> + </logger> + <root level="debug"> + <appender-ref ref="STDOUT" /> + </root> + + <!-- Spring related loggers --> + <logger name="org.springframework" level="WARN" /> + <logger name="org.springframework.beans" level="WARN" /> + <logger name="org.springframework.web" level="WARN" /> + <logger name="com.blog.spring.jms" level="WARN" /> + + <logger name="org.hibernate" level="WARN" /> + + + <!-- Tomcat related loggers --> + <logger name="org.apache.tomcat.util.digester.Digester" level="WARN" /> + <logger name="org.apache.tomcat.util.modeler.modules.*" level="WARN" /> + <logger name="org.apache.tomcat.util.IntrospectionUtils" level="WARN" /> + <logger name="org.apache.catalina.loader.WebappClassLoaderBase" level="WARN" /> + <logger name="wiremock.org.eclipse.jetty" level="WARN" /> + +</configuration>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql index a01153a43c..ab554d440b 100644 --- a/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql +++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql @@ -207,6 +207,4 @@ ALTER TABLE PUBLIC.SITE_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_C PRIMARY KEY(SI ALTER TABLE PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_7 PRIMARY KEY(DISTRIBUTION_ID); ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_D PRIMARY KEY(DISTRIBUTION_ID, COMPONENT_NAME); ALTER TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP ADD CONSTRAINT PUBLIC.CONSTRAINT_6 PRIMARY KEY(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID); -ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK; - - +ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK;
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/hibernate.properties b/mso-api-handlers/mso-requests-db/hibernate.properties deleted file mode 100644 index cf56960f4b..0000000000 --- a/mso-api-handlers/mso-requests-db/hibernate.properties +++ /dev/null @@ -1,2 +0,0 @@ -hibernate.show_sql=true -hibernate.format_sql=true diff --git a/mso-api-handlers/mso-requests-db/hibernate.reveng.xml b/mso-api-handlers/mso-requests-db/hibernate.reveng.xml deleted file mode 100644 index cb1e8c6669..0000000000 --- a/mso-api-handlers/mso-requests-db/hibernate.reveng.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" > - -<hibernate-reverse-engineering> - - <schema-selection match-schema="MSO"/> - <type-mapping> - <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" /> - </type-mapping> - <table-filter match-schema="MSO" match-name=".*"/> -</hibernate-reverse-engineering>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml index 006058e98d..5ef683b444 100644 --- a/mso-api-handlers/mso-requests-db/pom.xml +++ b/mso-api-handlers/mso-requests-db/pom.xml @@ -9,7 +9,6 @@ </parent> <artifactId>mso-requests-db</artifactId> - <name>mso-requests-db</name> <description>MSO Requests Database definition and Hibernate objects</description> <properties> @@ -21,84 +20,20 @@ <groupId>uk.co.blackpepper.bowman</groupId> <artifactId>bowman-client</artifactId> <version>0.3.0</version> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.hibernate.javax.persistence</groupId> - <artifactId>hibernate-jpa-2.1-api</artifactId> - <version>1.0.0.Final</version> - <optional>true</optional> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - </dependency> + </dependency> <dependency> <groupId>org.onap.so</groupId> <artifactId>common</artifactId> <version>${project.version}</version> - </dependency> - <dependency> - <groupId>javax.annotation</groupId> - <artifactId>javax.annotation-api</artifactId> - <version>1.2</version> - </dependency> + </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>com.h2database</groupId> - <artifactId>h2</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mariadb.jdbc</groupId> - <artifactId>mariadb-java-client</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-rest</artifactId> - </dependency> </dependencies> <packaging>jar</packaging> <build> - <finalName>${project.artifactId}</finalName> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>jar</goal> - </goals> - <configuration> - <classifier>beans</classifier> - <includes> - <include>**/beans/**</include> - </includes> - </configuration> - </execution> - </executions> - </plugin> - </plugins> + <finalName>${project.artifactId}</finalName> </build> - </project>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml b/mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml deleted file mode 100644 index d62640525b..0000000000 --- a/mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================= - ECOMP MSO - ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - ================================================================================ - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - --> - -<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://www.hibernate.org/dtd//hibernate-reverse-engineering-3.0.dtd" > - -<hibernate-reverse-engineering> - <schema-selection match-schema="MSO" /> - <type-mapping> - <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" /> - </type-mapping> - <table-filter match-schema="MSO" match-name=".*" /> -</hibernate-reverse-engineering> diff --git a/mso-api-handlers/mso-requests-db/src/main/java/META-INF/MANIFEST.MF b/mso-api-handlers/mso-requests-db/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 5e9495128c..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0
-Class-Path:
-
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java index 924f8870d3..348fc524ef 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java @@ -36,60 +36,59 @@ import org.apache.commons.lang3.builder.ToStringBuilder; @Table(name = "infra_active_requests") public class InfraActiveRequests extends InfraRequests { - private static final long serialVersionUID = -6818265918910035170L; + private static final long serialVersionUID = -6818265918910035170L; - public InfraActiveRequests() { - } + public InfraActiveRequests() {} - public InfraActiveRequests(String requestId, String action) { - setRequestId(requestId); - setAction(action); - } + public InfraActiveRequests(final String requestId, final String action) { + setRequestId(requestId); + setAction(action); + } - public InfraActiveRequests(String requestId) { - setRequestId(requestId); - } - - @Override - public boolean equals(final Object other) { - if (this == other) { - return true; - } - if (!(other instanceof InfraActiveRequests)) { - return false; - } - InfraActiveRequests castOther = (InfraActiveRequests) other; - return Objects.equals(getRequestId(), castOther.getRequestId()); - } + public InfraActiveRequests(final String requestId) { + setRequestId(requestId); + } - @Override - public int hashCode() { - return Objects.hash(getRequestId()); - } + @Override + public boolean equals(final Object other) { + if (this == other) { + return true; + } + if (!(other instanceof InfraActiveRequests)) { + return false; + } + final InfraActiveRequests castOther = (InfraActiveRequests) other; + return Objects.equals(getRequestId(), castOther.getRequestId()); + } - @Override - public String toString() { - return new ToStringBuilder(this).append("requestId", getRequestId()) - .append("clientRequestId", getClientRequestId()).append("action", getAction()) - .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage()) - .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime()) - .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName()) - .append("vnfType", getVnfType()).append("serviceType", getServiceType()) - .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId()) - .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams()) - .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody()) - .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy()) - .append("modifyTime", getModifyTime()).append("requestType", getRequestType()) - .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName()) - .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName()) - .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId()) - .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl()) - .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId()) - .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope()) - .append("requestAction", getRequestAction()).append("networkId", getNetworkId()) - .append("networkName", getNetworkName()).append("networkType", getNetworkType()) - .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId()) - .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId()) - .append("operationalEnvName", getOperationalEnvName()).toString(); - } + @Override + public int hashCode() { + return Objects.hash(getRequestId()); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("requestId", getRequestId()) + .append("clientRequestId", getClientRequestId()).append("action", getAction()) + .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage()) + .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime()) + .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName()) + .append("vnfType", getVnfType()).append("serviceType", getServiceType()) + .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId()) + .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams()) + .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody()) + .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy()) + .append("modifyTime", getModifyTime()).append("requestType", getRequestType()) + .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName()) + .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName()) + .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId()) + .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl()) + .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId()) + .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope()) + .append("requestAction", getRequestAction()).append("networkId", getNetworkId()) + .append("networkName", getNetworkName()).append("networkType", getNetworkType()) + .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId()) + .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId()) + .append("operationalEnvName", getOperationalEnvName()).toString(); + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java index 48a6cf3ff0..4a46a0d00d 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java @@ -35,522 +35,522 @@ import javax.persistence.TemporalType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.onap.so.requestsdb.adapter.TimestampXMLAdapter; +import org.onap.so.requestsdb.TimestampXMLAdapter; import uk.co.blackpepper.bowman.annotation.ResourceId; @MappedSuperclass public abstract class InfraRequests implements java.io.Serializable { - private static final long serialVersionUID = -5497583682393936143L; - private static final String UNKNOWN = "unknown"; - - - @Id - @Column(name = "REQUEST_ID", length=45) + private static final long serialVersionUID = -5497583682393936143L; + private static final String UNKNOWN = "unknown"; + + + @Id + @Column(name = "REQUEST_ID", length = 45) private String requestId; - @Column(name = "CLIENT_REQUEST_ID", length=45, unique=true) - private String clientRequestId; - @Column(name = "ACTION", length=45) - private String action; - @Column(name = "REQUEST_STATUS", length=20) - private String requestStatus; - @Column(name = "STATUS_MESSAGE", length=2000) - private String statusMessage; - @Column(name = "PROGRESS", precision=11) - private Long progress; - - @Column(name = "START_TIME") - private Timestamp startTime; - @Column(name = "END_TIME") - private Timestamp endTime; - @Column(name = "SOURCE", length=45) - private String source; - @Column(name = "VNF_ID", length=45) - private String vnfId; - @Column(name = "VNF_NAME", length=80) - private String vnfName; - @Column(name = "VNF_TYPE", length=200) - private String vnfType; - @Column(name = "SERVICE_TYPE", length=45) - private String serviceType; - @Column(name = "AIC_NODE_CLLI", length=11) - private String aicNodeClli; - @Column(name = "TENANT_ID", length=45) - private String tenantId; - @Column(name = "PROV_STATUS", length=20) - private String provStatus; - @Column(name = "VNF_PARAMS") - private String vnfParams; - @Column(name = "VNF_OUTPUTS") - private String vnfOutputs; - @Column(name = "REQUEST_BODY") - private String requestBody; - @Column(name = "RESPONSE_BODY") - private String responseBody; - @Column(name = "LAST_MODIFIED_BY", length=50) - private String lastModifiedBy; - @Column(name = "MODIFY_TIME") - @Temporal(TemporalType.TIMESTAMP) - private Date modifyTime; - @Column(name = "REQUEST_TYPE", length=20) - private String requestType; - @Column(name = "VOLUME_GROUP_ID", length=45) - private String volumeGroupId; - @Column(name = "VOLUME_GROUP_NAME", length=45) - private String volumeGroupName; - @Column(name = "VF_MODULE_ID", length=45) - private String vfModuleId; - @Column(name = "VF_MODULE_NAME", length=200) - private String vfModuleName; - @Column(name = "VF_MODULE_MODEL_NAME", length=200) - private String vfModuleModelName; - @Column(name = "AAI_SERVICE_ID", length=50) - private String aaiServiceId; - @Column(name = "AIC_CLOUD_REGION", length=11) - private String aicCloudRegion; - @Column(name = "CALLBACK_URL", length=200) - private String callBackUrl; - @Column(name = "CORRELATOR", length=80) - private String correlator; - @Column(name = "SERVICE_INSTANCE_ID", length=45) - private String serviceInstanceId; - @Column(name = "SERVICE_INSTANCE_NAME", length=80) - private String serviceInstanceName; - @Column(name = "REQUEST_SCOPE", length=45) - private String requestScope; - @Column(name = "REQUEST_ACTION", length=45) - private String requestAction; - @Column(name = "NETWORK_ID", length=45) - private String networkId; - @Column(name = "NETWORK_NAME", length=80) - private String networkName; - @Column(name = "NETWORK_TYPE", length=80) - private String networkType; - @Column(name = "REQUESTOR_ID", length=80) - private String requestorId; - @Column(name = "CONFIGURATION_ID", length=45) - private String configurationId; - @Column(name = "CONFIGURATION_NAME", length=200) - private String configurationName; - @Column(name = "OPERATIONAL_ENV_ID", length=45) - private String operationalEnvId; - @Column(name = "OPERATIONAL_ENV_NAME", length=200) - private String operationalEnvName; - - @ResourceId - public URI getRequestURI() { - return URI.create(this.requestId); - } - - public String getRequestId() { - return this.requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getClientRequestId() { - return clientRequestId; - } - - public void setClientRequestId(String clientRequestId) { - this.clientRequestId = clientRequestId; - } - - public String getAction() { - return this.action; - } - - public void setAction(String action) { - this.action = action; - } - - public String getRequestStatus() { - return this.requestStatus; - } - - public void setRequestStatus(String requestStatus) { - this.requestStatus = requestStatus; - } - - public String getStatusMessage() { - return this.statusMessage; - } - - public void setStatusMessage(String statusMessage) { - this.statusMessage = statusMessage; - } - - public Long getProgress() { - return this.progress; - } - - public void setProgress(Long progress) { - this.progress = progress; - } + @Column(name = "CLIENT_REQUEST_ID", length = 45, unique = true) + private String clientRequestId; + @Column(name = "ACTION", length = 45) + private String action; + @Column(name = "REQUEST_STATUS", length = 20) + private String requestStatus; + @Column(name = "STATUS_MESSAGE", length = 2000) + private String statusMessage; + @Column(name = "PROGRESS", precision = 11) + private Long progress; + + @Column(name = "START_TIME") + private Timestamp startTime; + @Column(name = "END_TIME") + private Timestamp endTime; + @Column(name = "SOURCE", length = 45) + private String source; + @Column(name = "VNF_ID", length = 45) + private String vnfId; + @Column(name = "VNF_NAME", length = 80) + private String vnfName; + @Column(name = "VNF_TYPE", length = 200) + private String vnfType; + @Column(name = "SERVICE_TYPE", length = 45) + private String serviceType; + @Column(name = "AIC_NODE_CLLI", length = 11) + private String aicNodeClli; + @Column(name = "TENANT_ID", length = 45) + private String tenantId; + @Column(name = "PROV_STATUS", length = 20) + private String provStatus; + @Column(name = "VNF_PARAMS") + private String vnfParams; + @Column(name = "VNF_OUTPUTS") + private String vnfOutputs; + @Column(name = "REQUEST_BODY") + private String requestBody; + @Column(name = "RESPONSE_BODY") + private String responseBody; + @Column(name = "LAST_MODIFIED_BY", length = 50) + private String lastModifiedBy; + @Column(name = "MODIFY_TIME") + @Temporal(TemporalType.TIMESTAMP) + private Date modifyTime; + @Column(name = "REQUEST_TYPE", length = 20) + private String requestType; + @Column(name = "VOLUME_GROUP_ID", length = 45) + private String volumeGroupId; + @Column(name = "VOLUME_GROUP_NAME", length = 45) + private String volumeGroupName; + @Column(name = "VF_MODULE_ID", length = 45) + private String vfModuleId; + @Column(name = "VF_MODULE_NAME", length = 200) + private String vfModuleName; + @Column(name = "VF_MODULE_MODEL_NAME", length = 200) + private String vfModuleModelName; + @Column(name = "AAI_SERVICE_ID", length = 50) + private String aaiServiceId; + @Column(name = "AIC_CLOUD_REGION", length = 11) + private String aicCloudRegion; + @Column(name = "CALLBACK_URL", length = 200) + private String callBackUrl; + @Column(name = "CORRELATOR", length = 80) + private String correlator; + @Column(name = "SERVICE_INSTANCE_ID", length = 45) + private String serviceInstanceId; + @Column(name = "SERVICE_INSTANCE_NAME", length = 80) + private String serviceInstanceName; + @Column(name = "REQUEST_SCOPE", length = 45) + private String requestScope; + @Column(name = "REQUEST_ACTION", length = 45) + private String requestAction; + @Column(name = "NETWORK_ID", length = 45) + private String networkId; + @Column(name = "NETWORK_NAME", length = 80) + private String networkName; + @Column(name = "NETWORK_TYPE", length = 80) + private String networkType; + @Column(name = "REQUESTOR_ID", length = 80) + private String requestorId; + @Column(name = "CONFIGURATION_ID", length = 45) + private String configurationId; + @Column(name = "CONFIGURATION_NAME", length = 200) + private String configurationName; + @Column(name = "OPERATIONAL_ENV_ID", length = 45) + private String operationalEnvId; + @Column(name = "OPERATIONAL_ENV_NAME", length = 200) + private String operationalEnvName; + + @ResourceId + public URI getRequestURI() { + return URI.create(this.requestId); + } + + public String getRequestId() { + return this.requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getClientRequestId() { + return clientRequestId; + } + + public void setClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + } + + public String getAction() { + return this.action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getRequestStatus() { + return this.requestStatus; + } + + public void setRequestStatus(String requestStatus) { + this.requestStatus = requestStatus; + } + + public String getStatusMessage() { + return this.statusMessage; + } + + public void setStatusMessage(String statusMessage) { + this.statusMessage = statusMessage; + } + + public Long getProgress() { + return this.progress; + } + + public void setProgress(Long progress) { + this.progress = progress; + } @XmlJavaTypeAdapter(TimestampXMLAdapter.class) - public Timestamp getStartTime() { - return this.startTime; - } + public Timestamp getStartTime() { + return this.startTime; + } - public void setStartTime(Timestamp startTime) { - this.startTime = startTime; - } + public void setStartTime(Timestamp startTime) { + this.startTime = startTime; + } @XmlJavaTypeAdapter(TimestampXMLAdapter.class) - public Timestamp getEndTime() { - return this.endTime; - } + public Timestamp getEndTime() { + return this.endTime; + } + + public void setEndTime(Timestamp endTime) { + this.endTime = endTime; + } + + public String getSource() { + return this.source; + } + + public void setSource(String source) { + this.source = source; + } + + public String getVnfId() { + return this.vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVnfName() { + return this.vnfName; + } + + public void setVnfName(String vnfName) { + this.vnfName = vnfName; + } + + public String getVnfType() { + return this.vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getServiceType() { + return this.serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getAicNodeClli() { + return this.aicNodeClli; + } + + public void setAicNodeClli(String aicNodeClli) { + this.aicNodeClli = aicNodeClli; + } + + public String getTenantId() { + return this.tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getProvStatus() { + return this.provStatus; + } + + public void setProvStatus(String provStatus) { + this.provStatus = provStatus; + } + + public String getVnfParams() { + return this.vnfParams; + } + + public void setVnfParams(String vnfParams) { + this.vnfParams = vnfParams; + } + + public String getVnfOutputs() { + return this.vnfOutputs; + } + + public void setVnfOutputs(String vnfOutputs) { + this.vnfOutputs = vnfOutputs; + } + + public String getRequestBody() { + return this.requestBody; + } + + public void setRequestBody(String requestBody) { + this.requestBody = requestBody; + } + + public String getResponseBody() { + return this.responseBody; + } + + public void setResponseBody(String responseBody) { + this.responseBody = responseBody; + } - public void setEndTime(Timestamp endTime) { - this.endTime = endTime; - } + public String getLastModifiedBy() { + return this.lastModifiedBy; + } - public String getSource() { - return this.source; - } + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } - public void setSource(String source) { - this.source = source; - } - - public String getVnfId() { - return this.vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVnfName() { - return this.vnfName; - } - - public void setVnfName(String vnfName) { - this.vnfName = vnfName; - } - - public String getVnfType() { - return this.vnfType; - } - - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public String getServiceType() { - return this.serviceType; - } - - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - public String getAicNodeClli() { - return this.aicNodeClli; - } - - public void setAicNodeClli(String aicNodeClli) { - this.aicNodeClli = aicNodeClli; - } - - public String getTenantId() { - return this.tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getProvStatus() { - return this.provStatus; - } - - public void setProvStatus(String provStatus) { - this.provStatus = provStatus; - } - - public String getVnfParams() { - return this.vnfParams; - } - - public void setVnfParams(String vnfParams) { - this.vnfParams = vnfParams; - } - - public String getVnfOutputs() { - return this.vnfOutputs; - } - - public void setVnfOutputs(String vnfOutputs) { - this.vnfOutputs = vnfOutputs; - } - - public String getRequestBody() { - return this.requestBody; - } - - public void setRequestBody(String requestBody) { - this.requestBody = requestBody; - } - - public String getResponseBody() { - return this.responseBody; - } - - public void setResponseBody(String responseBody) { - this.responseBody = responseBody; - } + public Date getModifyTime() { + return this.modifyTime; + } - public String getLastModifiedBy() { - return this.lastModifiedBy; - } + public String getRequestType() { + return this.requestType; + } - public void setLastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - } + public void setRequestType(String requestType) { + this.requestType = requestType; + } - public Date getModifyTime() { - return this.modifyTime; - } - - public String getRequestType() { - return this.requestType; - } + public String getVolumeGroupId() { + return this.volumeGroupId; + } - public void setRequestType(String requestType) { - this.requestType = requestType; - } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } - public String getVolumeGroupId() { - return this.volumeGroupId; - } + public String getVolumeGroupName() { + return this.volumeGroupName; + } - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } - public String getVolumeGroupName() { - return this.volumeGroupName; - } + public String getVfModuleId() { + return this.vfModuleId; + } - public void setVolumeGroupName(String volumeGroupName) { - this.volumeGroupName = volumeGroupName; - } + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } - public String getVfModuleId() { - return this.vfModuleId; - } + public String getVfModuleName() { + return this.vfModuleName; + } - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } - public String getVfModuleName() { - return this.vfModuleName; - } + public String getVfModuleModelName() { + return this.vfModuleModelName; + } - public void setVfModuleName(String vfModuleName) { - this.vfModuleName = vfModuleName; - } + public void setVfModuleModelName(String vfModuleModelName) { + this.vfModuleModelName = vfModuleModelName; + } - public String getVfModuleModelName() { - return this.vfModuleModelName; - } + public String getAaiServiceId() { + return this.aaiServiceId; + } - public void setVfModuleModelName(String vfModuleModelName) { - this.vfModuleModelName = vfModuleModelName; - } + public void setAaiServiceId(String aaiServiceId) { + this.aaiServiceId = aaiServiceId; + } - public String getAaiServiceId() { - return this.aaiServiceId; - } + public String getAicCloudRegion() { + return this.aicCloudRegion; + } - public void setAaiServiceId(String aaiServiceId) { - this.aaiServiceId = aaiServiceId; - } + public void setAicCloudRegion(String aicCloudRegion) { + this.aicCloudRegion = aicCloudRegion; + } - public String getAicCloudRegion() { - return this.aicCloudRegion; - } + public String getCallBackUrl() { + return callBackUrl; + } - public void setAicCloudRegion(String aicCloudRegion) { - this.aicCloudRegion = aicCloudRegion; - } + public void setCallBackUrl(String callBackUrl) { + this.callBackUrl = callBackUrl; + } - public String getCallBackUrl() { - return callBackUrl; - } + public String getCorrelator() { + return correlator; + } - public void setCallBackUrl(String callBackUrl) { - this.callBackUrl = callBackUrl; - } + public void setCorrelator(String correlator) { + this.correlator = correlator; + } - public String getCorrelator() { - return correlator; - } - - public void setCorrelator(String correlator) { - this.correlator = correlator; - } - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getServiceInstanceName() { - return serviceInstanceName; - } - - public void setServiceInstanceName(String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - - public String getRequestScope() { - return requestScope; - } - - public void setRequestScope(String requestScope) { - this.requestScope = requestScope; - } - - public String getRequestAction() { - return requestAction; - } - - public void setRequestAction(String requestAction) { - this.requestAction = requestAction; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNetworkName() { - return networkName; - } - - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - public String getNetworkType() { - return networkType; - } - - public void setNetworkType(String networkType) { - this.networkType = networkType; - } - - public String getRequestorId() { - return requestorId; - } - - public void setRequestorId(String requestorId) { - this.requestorId = requestorId; - } - - public String getConfigurationId() { - return configurationId; - } - - public void setConfigurationId(String configurationId) { - this.configurationId = configurationId; - } - - public String getConfigurationName() { - return configurationName; - } - - public void setConfigurationName(String configurationName) { - this.configurationName = configurationName; - } - - public String getOperationalEnvId() { - return operationalEnvId; - } - - public void setOperationalEnvId(String operationalEnvId) { - this.operationalEnvId = operationalEnvId; - } - - public String getOperationalEnvName() { - return operationalEnvName; - } - - public void setOperationalEnvName(String operationalEnvName) { - this.operationalEnvName = operationalEnvName; - } - - @PrePersist - protected void onCreate() { - if(requestScope==null) - requestScope=UNKNOWN; - if(requestAction==null) - requestAction=UNKNOWN; - this.modifyTime = new Date(); - } - - @PreUpdate - protected void onUpdate() { - if(requestScope==null) - requestScope=UNKNOWN; - if(requestAction==null) - requestAction=UNKNOWN; - this.modifyTime = new Date(); - } - - @Override - public boolean equals(final Object other) { - if (this == other) { - return true; - } - if (!(other instanceof InfraRequests)) { - return false; - } - InfraRequests castOther = (InfraRequests) other; - return Objects.equals(getRequestId(), castOther.getRequestId()); - } - - @Override - public int hashCode() { - return Objects.hash(getRequestId()); - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("requestId", getRequestId()) - .append("clientRequestId", getClientRequestId()).append("action", getAction()) - .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage()) - .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime()) - .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName()) - .append("vnfType", getVnfType()).append("serviceType", getServiceType()) - .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId()) - .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams()) - .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody()) - .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy()) - .append("modifyTime", getModifyTime()).append("requestType", getRequestType()) - .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName()) - .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName()) - .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId()) - .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl()) - .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId()) - .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope()) - .append("requestAction", getRequestAction()).append("networkId", getNetworkId()) - .append("networkName", getNetworkName()).append("networkType", getNetworkType()) - .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId()) - .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId()) - .append("operationalEnvName", getOperationalEnvName()).toString(); - } + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + public String getRequestScope() { + return requestScope; + } + + public void setRequestScope(String requestScope) { + this.requestScope = requestScope; + } + + public String getRequestAction() { + return requestAction; + } + + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkName() { + return networkName; + } + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getNetworkType() { + return networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getRequestorId() { + return requestorId; + } + + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + + public String getConfigurationId() { + return configurationId; + } + + public void setConfigurationId(String configurationId) { + this.configurationId = configurationId; + } + + public String getConfigurationName() { + return configurationName; + } + + public void setConfigurationName(String configurationName) { + this.configurationName = configurationName; + } + + public String getOperationalEnvId() { + return operationalEnvId; + } + + public void setOperationalEnvId(String operationalEnvId) { + this.operationalEnvId = operationalEnvId; + } + + public String getOperationalEnvName() { + return operationalEnvName; + } + + public void setOperationalEnvName(String operationalEnvName) { + this.operationalEnvName = operationalEnvName; + } + + @PrePersist + protected void onCreate() { + if (requestScope == null) + requestScope = UNKNOWN; + if (requestAction == null) + requestAction = UNKNOWN; + this.modifyTime = new Date(); + } + + @PreUpdate + protected void onUpdate() { + if (requestScope == null) + requestScope = UNKNOWN; + if (requestAction == null) + requestAction = UNKNOWN; + this.modifyTime = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (this == other) { + return true; + } + if (!(other instanceof InfraRequests)) { + return false; + } + InfraRequests castOther = (InfraRequests) other; + return Objects.equals(getRequestId(), castOther.getRequestId()); + } + + @Override + public int hashCode() { + return Objects.hash(getRequestId()); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("requestId", getRequestId()) + .append("clientRequestId", getClientRequestId()).append("action", getAction()) + .append("requestStatus", getRequestStatus()).append("statusMessage", getStatusMessage()) + .append("progress", getProgress()).append("startTime", getStartTime()).append("endTime", getEndTime()) + .append("source", getSource()).append("vnfId", getVnfId()).append("vnfName", getVnfName()) + .append("vnfType", getVnfType()).append("serviceType", getServiceType()) + .append("aicNodeClli", getAicNodeClli()).append("tenantId", getTenantId()) + .append("provStatus", getProvStatus()).append("vnfParams", getVnfParams()) + .append("vnfOutputs", getVnfOutputs()).append("requestBody", getRequestBody()) + .append("responseBody", getResponseBody()).append("lastModifiedBy", getLastModifiedBy()) + .append("modifyTime", getModifyTime()).append("requestType", getRequestType()) + .append("volumeGroupId", getVolumeGroupId()).append("volumeGroupName", getVolumeGroupName()) + .append("vfModuleId", getVfModuleId()).append("vfModuleName", getVfModuleName()) + .append("vfModuleModelName", getVfModuleModelName()).append("aaiServiceId", getAaiServiceId()) + .append("aicCloudRegion", getAicCloudRegion()).append("callBackUrl", getCallBackUrl()) + .append("correlator", getCorrelator()).append("serviceInstanceId", getServiceInstanceId()) + .append("serviceInstanceName", getServiceInstanceName()).append("requestScope", getRequestScope()) + .append("requestAction", getRequestAction()).append("networkId", getNetworkId()) + .append("networkName", getNetworkName()).append("networkType", getNetworkType()) + .append("requestorId", getRequestorId()).append("configurationId", getConfigurationId()) + .append("configurationName", getConfigurationName()).append("operationalEnvId", getOperationalEnvId()) + .append("operationalEnvName", getOperationalEnvName()).toString(); + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java new file mode 100644 index 0000000000..34832b9917 --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java @@ -0,0 +1,167 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.request.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.openpojo.business.annotation.BusinessKey; + +/** + * persist the request identifiers created when MSO POSTs a request to PINC + * <br> + * <p> + * </p> + * + * @author + * @version + */ + +@Entity +@Table(name = "request_processing_data") +public class RequestProcessingData implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -3497593687393936143L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "ID") + private Integer id; + + @BusinessKey + @Column(name = "SO_REQUEST_ID", length=50, unique=true) + private String soRequestId; + + @BusinessKey + @Column(name = "GROUPING_ID", length=100, unique=true) + private String groupingId; + + @BusinessKey + @Column(name = "NAME", length=200) + private String name; + + @Column(name = "VALUE", columnDefinition = "LONGTEXT") + private String value; + + @BusinessKey + @Column(name = "TAG", length=200) + private String tag; + + @Column(name = "CREATE_TIME", insertable = false, updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created = null; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof RequestProcessingData)) { + return false; + } + RequestProcessingData castOther = (RequestProcessingData) other; + return new EqualsBuilder().append(soRequestId, castOther.soRequestId).append(groupingId, castOther.groupingId) + .append(name, castOther.name).append(tag, castOther.tag).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(soRequestId).append(groupingId).append(name).append(tag).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("soRequestId", soRequestId) + .append("groupingId", groupingId).append("name", name).append("value", value).append("tag", tag) + .toString(); + } + + @PrePersist + protected void createdAt() { + this.created = new Date(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getSoRequestId() { + return soRequestId; + } + + public void setSoRequestId(String soRequestId) { + this.soRequestId = soRequestId; + } + + public String getGroupingId() { + return groupingId; + } + + public void setGroupingId(String groupingId) { + this.groupingId = groupingId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public Date getCreated() { + return created; + } +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 8e291aa15b..54fec3ad4d 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -18,60 +18,77 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.requestsdb.client; +package org.onap.so.db.request.client; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpStatus; +import org.onap.so.db.request.beans.ArchivedInfraRequests; import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationStatus; +import org.onap.so.db.request.beans.OperationalEnvDistributionStatus; import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus; -import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; -import org.onap.so.db.request.beans.ArchivedInfraRequests; +import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.beans.ResourceOperationStatus; +import org.onap.so.db.request.beans.SiteStatus; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.beans.WatchdogDistributionStatus; -import org.onap.so.db.request.beans.SiteStatus; +import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; + import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; +import uk.co.blackpepper.bowman.RestTemplateConfigurer; -import javax.annotation.PostConstruct; -import javax.ws.rs.core.UriBuilder; -import java.net.URI; -import java.util.List; -import java.util.Map; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; - -@Component +@Component("RequestsDbClient") +@Primary public class RequestsDbClient { private static final String SERVICE_ID = "SERVICE_ID"; private static final String OPERATION_ID = "OPERATION_ID"; + private static final String SO_REQUEST_ID = "SO_REQUEST_ID"; + private static final String GROUPING_ID = "GROUPING_ID"; + private static final String REQUEST_ID = "REQUEST_ID"; private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENVIRONMENT_ID"; private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID"; - private static final String REQUEST_ID = "REQUEST_ID"; - - private final Client<InfraActiveRequests> infraActiveRequestClient; - private final Client<OperationStatus> operationStatusClient; + private static final String NAME = "NAME"; + private static final String VALUE = "VALUE"; + private static final String TAG = "TAG"; + + private Client<InfraActiveRequests> infraActiveRequestClient; + private Client<OperationStatus> operationStatusClient; + private Client<RequestProcessingData> requestProcessingDataClient; private final Client<OperationalEnvDistributionStatus> distributionStatusClient; private final Client<OperationalEnvServiceModelStatus> serviceModelStatusClient; @Value("${mso.adapters.requestDb.endpoint}") - private String endpoint; + protected String endpoint; @Value("${mso.adapters.requestDb.auth}") private String msoAdaptersAuth; @@ -80,29 +97,38 @@ public class RequestsDbClient { private static final String OPERATION_STATUS_SEARCH = "/operationStatus/search"; private static final String OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH = "/operationalEnvServiceModelStatus/search"; + private String checkVnfIdStatus = "/infraActiveRequests/checkVnfIdStatus/"; private String infraActiveRequestURI = "/infraActiveRequests/"; private String checkInstanceNameDuplicate = "/infraActiveRequests/checkInstanceNameDuplicate"; + private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/"; + private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId"; - private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/"; - - private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive"; - private String findOneByOperationalEnvIdAndServiceModelVersionIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionId"; private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId"; - private HttpHeaders headers; + private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive"; + + private String requestProcessingDataURI = "/requestProcessingData"; + + private String findOneBySoRequestIdAndGroupingIdAndNameAndTagURI = "/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndNameAndTag/"; + + private String findBySoRequestIdOrderByGroupingIdDesc = "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"; + protected HttpHeaders headers; + + protected ClientFactory clientFactory; + @Autowired - private RestTemplate restTemplate; + protected RestTemplate restTemplate; + @Autowired ClassURLMapper classURLMapper; - @PostConstruct public void init() { @@ -112,6 +138,7 @@ public class RequestsDbClient { checkInstanceNameDuplicate = endpoint + checkInstanceNameDuplicate; cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive; findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI; + requestProcessingDataURI = endpoint + requestProcessingDataURI; operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI; findOneByOperationalEnvIdAndServiceModelVersionIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdURI; findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI; @@ -120,15 +147,28 @@ public class RequestsDbClient { } public RequestsDbClient() { - ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(restTemplate -> restTemplate.getInterceptors().add((request, body, execution) -> { - request.getHeaders().add("Authorization", msoAdaptersAuth); - return execution.execute(request, body); - })).build().buildClientFactory(); + ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() { + + public void configure(RestTemplate restTemplate) { + + restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() { + + public ClientHttpResponse intercept(HttpRequest request, byte[] body, + ClientHttpRequestExecution execution) throws IOException { + + request.getHeaders().add("Authorization", msoAdaptersAuth); + return execution.execute(request, body); + } + }); + } + }).build().buildClientFactory(); infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); operationStatusClient = clientFactory.create(OperationStatus.class); + requestProcessingDataClient = clientFactory.create(RequestProcessingData.class); distributionStatusClient = clientFactory.create(OperationalEnvDistributionStatus.class); serviceModelStatusClient = clientFactory.create(OperationalEnvServiceModelStatus.class); } + public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){ URI uri = getUri(cloudOrchestrationFiltersFromInfraActive); HttpEntity<Map> entity = new HttpEntity<>(orchestrationMap, headers); @@ -175,7 +215,7 @@ public class RequestsDbClient { .queryParam(OPERATION_ID,operationId) .build()); } - + public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvironmentId, String serviceModelVersionId) { return this.getSingleOperationalEnvServiceModelStatus(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI) .queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId) @@ -211,7 +251,7 @@ public class RequestsDbClient { HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(infraActiveRequests, headers); restTemplate.postForLocation(uri, entity); } - + public <T> void save(T object){ URI uri = getUri(endpoint+classURLMapper.getURI(object.getClass())); HttpEntity<T> entity = new HttpEntity<>(object, headers); @@ -221,8 +261,8 @@ public class RequestsDbClient { private OperationalEnvDistributionStatus getSingleOperationalEnvDistributionStatus(URI uri){ return distributionStatusClient.get(uri); } - - private InfraActiveRequests getSingleInfraActiveRequests(URI uri) { + + protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) { return infraActiveRequestClient.get(uri); } @@ -230,12 +270,56 @@ public class RequestsDbClient { infraActiveRequestClient.put(request); } - private OperationStatus getSingleOperationStatus(URI uri){ + protected URI getUri(String uri) { + return URI.create(uri); + } + + + + public OperationStatus getSingleOperationStatus(URI uri){ return operationStatusClient.get(uri); } - private URI getUri(String uri) { - return URI.create(uri); + public void saveRequestProcessingData(RequestProcessingData requestProcessingData) { + URI uri = getUri(endpoint + requestProcessingDataURI); + HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers); + restTemplate.postForLocation(uri, entity); + } + + public RequestProcessingData getRequestProcessingDataBySoRequestIdAndGroupingIdAndNameAndTag(String soRequestId, + String groupingId, String name, String tag) { + return this.getSingleRequestProcessingData(UriBuilder.fromUri(endpoint + findOneBySoRequestIdAndGroupingIdAndNameAndTagURI) + .queryParam(SO_REQUEST_ID,soRequestId) + .queryParam(GROUPING_ID,groupingId) + .queryParam(NAME,name) + .queryParam(TAG,tag) + .build()); + } + public List<RequestProcessingData> getRequestProcessingDataBySoRequestId(String soRequestId) { + return this.getRequestProcessingData(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc) + .queryParam(SO_REQUEST_ID,soRequestId) + .build()); + } + + public RequestProcessingData getSingleRequestProcessingData(URI uri){ + return requestProcessingDataClient.get(uri); + } + + private List<RequestProcessingData> getRequestProcessingData(URI uri) { + Iterable<RequestProcessingData> requestProcessingDataIterator = requestProcessingDataClient.getAll(uri); + List<RequestProcessingData> requestProcessingDataList = new ArrayList<>(); + Iterator<RequestProcessingData> it = requestProcessingDataIterator.iterator(); + it.forEachRemaining(requestProcessingDataList::add); + return requestProcessingDataList; + } + + public List<RequestProcessingData> getAllRequestProcessingData() { + + return (List<RequestProcessingData>) this.getAllRequestProcessingData(UriBuilder.fromUri(endpoint + "/requestProcessingData").build()); + } + + private Iterable<RequestProcessingData> getAllRequestProcessingData(URI uri) { + return requestProcessingDataClient.getAll(uri); } @Bean @@ -269,4 +353,14 @@ public class RequestsDbClient { return classURLMap.get(actualClass); } } + + //USED FOR TEST ONLY + public void setPortToEndpoint(String port) { + endpoint = endpoint + port; + } + + //USED FOR TEST ONLY + public void removePortFromEndpoint() { + endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1); + } } diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java deleted file mode 100644 index ba237bfa35..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryCustom.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.springframework.stereotype.Repository; - -@Repository -public interface InfraActiveRequestsRepositoryCustom { - - public boolean healthCheck(); - - public InfraActiveRequests getRequestFromInfraActive(String requestId); - - public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, - String requestScope); - - public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive(Map<String, List<String>> orchestrationMap); - - // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB - // (infra_active_requests table) for operationalEnvId and OperationalEnvName - public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap); - - public List<InfraActiveRequests> getRequestListFromInfraActive(String queryAttributeName, String queryValue, - String requestType); - - public InfraActiveRequests getRequestFromInfraActive(String requestId, String requestType); - - public InfraActiveRequests checkDuplicateByVnfName(String vnfName, String action, String requestType); - - public InfraActiveRequests checkDuplicateByVnfId(String vnfId, String action, String requestType); - - public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId); - -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java deleted file mode 100644 index 3240972a58..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java +++ /dev/null @@ -1,566 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.db.request.data.repository; - -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import javax.persistence.EntityManager; -import javax.persistence.NonUniqueResultException; -import javax.persistence.Query; -import javax.persistence.TypedQuery; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Order; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; - -import org.onap.so.db.request.beans.InfraActiveRequests; -import org.onap.so.db.request.beans.OperationStatus; -import org.onap.so.db.request.beans.ResourceOperationStatus; -import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.RequestsDbConstant; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.data.domain.Example; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - - -@Repository -@Transactional(readOnly = true) -public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRepositoryCustom { - - @Qualifier("requestEntityManagerFactory") - @Autowired - private EntityManager entityManager; - - protected static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL, InfraActiveRequestsRepositoryImpl.class); - - protected static final String SOURCE = "source"; - protected static final String START_TIME = "startTime"; - protected static final String REQUEST_TYPE = "requestType"; - protected static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; - protected static final String SERVICE_INSTANCE_NAME = "serviceInstanceName"; - protected static final String VNF_INSTANCE_NAME = "vnfName"; - protected static final String VNF_INSTANCE_ID = "vnfId"; - protected static final String VOLUME_GROUP_INSTANCE_NAME = "volumeGroupName"; - protected static final String VOLUME_GROUP_INSTANCE_ID = "volumeGroupId"; - protected static final String VFMODULE_INSTANCE_NAME = "vfModuleName"; - protected static final String VFMODULE_INSTANCE_ID = "vfModuleId"; - protected static final String NETWORK_INSTANCE_NAME = "networkName"; - protected static final String CONFIGURATION_INSTANCE_ID = "configurationId"; - protected static final String CONFIGURATION_INSTANCE_NAME= "configurationName"; - protected static final String OPERATIONAL_ENV_ID = "operationalEnvId"; - protected static final String OPERATIONAL_ENV_NAME = "operationalEnvName"; - protected static final String NETWORK_INSTANCE_ID = "networkId"; - protected static final String GLOBAL_SUBSCRIBER_ID = "globalSubscriberId"; - protected static final String SERVICE_NAME_VERSION_ID = "serviceNameVersionId"; - protected static final String SERVICE_ID = "serviceId"; - protected static final String SERVICE_VERSION = "serviceVersion"; - protected static final String REQUEST_ID = "requestId"; - protected static final String REQUESTOR_ID = "requestorId"; - - @Autowired - private OperationStatusRepository operationStatusRepository; - - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#healthCheck() - */ - @Override - public boolean healthCheck () { - - Query query = entityManager.createNativeQuery(" show tables "); - - List<?> list = query.getResultList(); - - return true; - } - - private List<InfraActiveRequests> executeInfraQuery (CriteriaQuery<InfraActiveRequests> crit, List <Predicate> predicates, Order order) { - - long startTime = System.currentTimeMillis (); - msoLogger.debug ("Execute query on infra active request table"); - - List <InfraActiveRequests> results = new ArrayList<InfraActiveRequests>(); - - try { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - crit.where(cb.and(predicates.toArray(new Predicate[0]))); - crit.orderBy(order); - results = entityManager.createQuery(crit).getResultList(); - - } finally { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getInfraActiveRequest", null); - } - return results; - } - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.lang.String) - */ - @Override - public InfraActiveRequests getRequestFromInfraActive (String requestId) { - long startTime = System.currentTimeMillis (); - msoLogger.debug ("Get request " + requestId + " from InfraActiveRequests DB"); - - InfraActiveRequests ar = null; - try { - Query query = entityManager.createQuery ("from InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId"); - query.setParameter (REQUEST_ID, requestId); - ar = this.getSingleResult(query); - } finally { - - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "InfraRequestDB", "getRequestFromInfraActive", null); - } - return ar; - } - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkInstanceNameDuplicate(java.util.HashMap, java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests checkInstanceNameDuplicate (HashMap<String,String> instanceIdMap, String instanceName, String requestScope) { - - List <Predicate> predicates = new LinkedList <> (); - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); - - if(instanceName != null && !instanceName.equals("")) { - - if("service".equals(requestScope)){ - predicates.add (cb.equal(tableRoot.get(SERVICE_INSTANCE_NAME), instanceName)); - } else if("vnf".equals(requestScope)){ - predicates.add (cb.equal(tableRoot.get(VNF_INSTANCE_NAME), instanceName)); - } else if("volumeGroup".equals(requestScope)){ - predicates.add (cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_NAME), instanceName)); - } else if("vfModule".equals(requestScope)){ - predicates.add (cb.equal(tableRoot.get(VFMODULE_INSTANCE_NAME), instanceName)); - } else if("network".equals(requestScope)){ - predicates.add (cb.equal(tableRoot.get(NETWORK_INSTANCE_NAME), instanceName)); - } else if(requestScope.equals("configuration")) { - predicates.add (cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_NAME), instanceName)); - } else if(requestScope.equals("operationalEnvironment")) { - predicates.add (cb.equal(tableRoot.get(OPERATIONAL_ENV_NAME), instanceName)); - } - - } else { - if(instanceIdMap != null){ - if("service".equals(requestScope) && instanceIdMap.get("serviceInstanceId") != null){ - predicates.add (cb.equal(tableRoot.get(SERVICE_INSTANCE_ID), instanceIdMap.get("serviceInstanceId"))); - } - - if("vnf".equals(requestScope) && instanceIdMap.get("vnfInstanceId") != null){ - predicates.add (cb.equal(tableRoot.get(VNF_INSTANCE_ID), instanceIdMap.get("vnfInstanceId" ))); - } - - if("vfModule".equals(requestScope) && instanceIdMap.get("vfModuleInstanceId") != null){ - predicates.add (cb.equal(tableRoot.get(VFMODULE_INSTANCE_ID), instanceIdMap.get("vfModuleInstanceId"))); - } - - if("volumeGroup".equals(requestScope) && instanceIdMap.get("volumeGroupInstanceId") != null){ - predicates.add (cb.equal(tableRoot.get(VOLUME_GROUP_INSTANCE_ID), instanceIdMap.get("volumeGroupInstanceId"))); - } - - if("network".equals(requestScope) && instanceIdMap.get("networkInstanceId") != null){ - predicates.add (cb.equal(tableRoot.get(NETWORK_INSTANCE_ID), instanceIdMap.get("networkInstanceId"))); - } - - if(requestScope.equals("configuration") && instanceIdMap.get("configurationInstanceId") != null){ - predicates.add (cb.equal(tableRoot.get(CONFIGURATION_INSTANCE_ID), instanceIdMap.get("configurationInstanceId"))); - } - - if(requestScope.equals("operationalEnvironment") && instanceIdMap.get("operationalEnvironmentId") != null) { - predicates.add (cb.equal(tableRoot.get(OPERATIONAL_ENV_ID), instanceIdMap.get("operationalEnvironmentId"))); - } - } - } - - predicates.add (tableRoot.get("requestStatus").in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK"))); - - Order order = cb.desc(tableRoot.get(START_TIME)); - - List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order); - - InfraActiveRequests infraActiveRequests = null; - - if(dupList != null && !dupList.isEmpty()){ - infraActiveRequests = dupList.get(0); - } - - return infraActiveRequests; - } - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getOrchestrationFiltersFromInfraActive(java.util.Map) - */ - @Override - public List<InfraActiveRequests> getOrchestrationFiltersFromInfraActive (Map<String, List<String>> orchestrationMap) { - - - List <Predicate> predicates = new LinkedList <> (); - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); - for (Map.Entry<String, List<String>> entry : orchestrationMap.entrySet()) - { - String mapKey = entry.getKey(); - if("serviceInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "serviceInstanceId"; - } else if("serviceInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "serviceInstanceName"; - } else if("vnfInstanceId".equalsIgnoreCase(mapKey)){ - mapKey = "vnfId"; - } else if("vnfInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "vnfName"; - } else if("vfModuleInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "vfModuleId"; - } else if("vfModuleInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "vfModuleName"; - } else if("volumeGroupInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "volumeGroupId"; - } else if("volumeGroupInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "volumeGroupName"; - } else if("networkInstanceId".equalsIgnoreCase(mapKey)) { - mapKey = "networkId"; - } else if("networkInstanceName".equalsIgnoreCase(mapKey)) { - mapKey = "networkName"; - } else if(mapKey.equalsIgnoreCase("configurationInstanceId")) { - mapKey = "configurationId"; - } else if(mapKey.equalsIgnoreCase("configurationInstanceName")) { - mapKey = "configurationName"; - } else if("lcpCloudRegionId".equalsIgnoreCase(mapKey)) { - mapKey = "aicCloudRegion"; - } else if("tenantId".equalsIgnoreCase(mapKey)) { - mapKey = "tenantId"; - } else if("modelType".equalsIgnoreCase(mapKey)) { - mapKey = "requestScope"; - } else if("requestorId".equalsIgnoreCase(mapKey)) { - mapKey = "requestorId"; - } else if("requestExecutionDate".equalsIgnoreCase(mapKey)) { - mapKey = "startTime"; - } - - String propertyValue = entry.getValue().get(1); - if ("startTime".equals(mapKey)) { - SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); - try { - Date thisDate = format.parse(propertyValue); - Timestamp minTime = new Timestamp(thisDate.getTime()); - Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); - - if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { - predicates.add(cb.or(cb.lessThan(tableRoot.get(mapKey), minTime), cb.greaterThanOrEqualTo(tableRoot.get(mapKey), maxTime))); - } else { - predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime)); - } - } - catch (Exception e){ - msoLogger.debug("Exception in getOrchestrationFiltersFromInfraActive(): + " + e.getMessage(), e); - return null; - } - } - else if("DOES_NOT_EQUAL".equalsIgnoreCase(entry.getValue().get(0))) { - predicates.add(cb.notEqual(tableRoot.get(mapKey), propertyValue)); - } else { - predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue)); - } - - } - - Order order = cb.asc(tableRoot.get(START_TIME)); - - return executeInfraQuery (crit, predicates, order); - } - - // Added this method for Tenant Isolation project ( 1802-295491a) to query the mso_requests DB - // (infra_active_requests table) for operationalEnvId and OperationalEnvName - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getCloudOrchestrationFiltersFromInfraActive(java.util.Map) - */ - @Override - public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive (Map<String, String> orchestrationMap) { - List <Predicate> predicates = new LinkedList <> (); - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - Root<InfraActiveRequests> tableRoot = crit.from(InfraActiveRequests.class); - - // Add criteria on OperationalEnvironment RequestScope when requestorId is only specified in the filter - // as the same requestorId can also match on different API methods - String resourceType = orchestrationMap.get("resourceType"); - if(resourceType == null) { - predicates.add(cb.equal(tableRoot.get("requestScope"), "operationalEnvironment")); - } - - for (Map.Entry<String, String> entry : orchestrationMap.entrySet()) { - String mapKey = entry.getKey(); - if(mapKey.equalsIgnoreCase("requestorId")) { - mapKey = "requestorId"; - } else if(mapKey.equalsIgnoreCase("requestExecutionDate")) { - mapKey = "startTime"; - } else if(mapKey.equalsIgnoreCase("operationalEnvironmentId")) { - mapKey = "operationalEnvId"; - } else if(mapKey.equalsIgnoreCase("operationalEnvironmentName")) { - mapKey = "operationalEnvName"; - } else if(mapKey.equalsIgnoreCase("resourceType")) { - mapKey = "requestScope"; - } - - String propertyValue = entry.getValue(); - if (mapKey.equals("startTime")) { - SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy"); - try { - Date thisDate = format.parse(propertyValue); - Timestamp minTime = new Timestamp(thisDate.getTime()); - Timestamp maxTime = new Timestamp(thisDate.getTime() + TimeUnit.DAYS.toMillis(1)); - - predicates.add(cb.between(tableRoot.get(mapKey), minTime, maxTime)); - } - catch (Exception e){ - msoLogger.debug("Exception in getCloudOrchestrationFiltersFromInfraActive(): + " + e.getMessage()); - return null; - } - } else { - predicates.add(cb.equal(tableRoot.get(mapKey), propertyValue)); - } - } - - Order order = cb.asc(tableRoot.get(START_TIME)); - return executeInfraQuery (crit, predicates, order); - } - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestListFromInfraActive(java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public List <InfraActiveRequests> getRequestListFromInfraActive (String queryAttributeName, - String queryValue, - String requestType) { - msoLogger.debug ("Get list of infra requests from DB with " + queryAttributeName + " = " + queryValue); - - - try { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class); - Predicate isEqual = cb.equal(candidateRoot.get(queryAttributeName), queryValue); - Predicate equalRequestType = cb.equal(candidateRoot.get(REQUEST_TYPE), requestType); - Predicate isNull = cb.isNull(candidateRoot.get(REQUEST_TYPE)); - Predicate orClause = cb.or(equalRequestType, isNull); - Order orderDesc = cb.desc(candidateRoot.get(START_TIME)); - Order orderAsc = cb.asc(candidateRoot.get(SOURCE)); - crit.where(cb.and(isEqual, orClause)).orderBy(orderDesc, orderAsc); - - @SuppressWarnings("unchecked") - List <InfraActiveRequests> arList = entityManager.createQuery(crit).getResultList(); - if (arList != null && !arList.isEmpty ()) { - return arList; - } - } finally { - // msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestListFromInfraActive", null); - } - return null; - } - - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#getRequestFromInfraActive(java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests getRequestFromInfraActive (String requestId, String requestType) { - long startTime = System.currentTimeMillis (); - msoLogger.debug ("Get infra request from DB with id " + requestId); - - InfraActiveRequests ar = null; - try { - Query query = entityManager.createQuery ("from InfraActiveRequests where (requestId = :requestId OR clientRequestId = :requestId) and requestType = :requestType"); - query.setParameter (REQUEST_ID, requestId); - query.setParameter (REQUEST_TYPE, requestType); - ar = this.getSingleResult(query); - } finally { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "getRequestFromInfraActive", null); - } - return ar; - } - - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfName(java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests checkDuplicateByVnfName (String vnfName, String action, String requestType) { - - long startTime = System.currentTimeMillis (); - msoLogger.debug ("Get infra request from DB for VNF " + vnfName + " and action " + action + " and requestType " + requestType); - - InfraActiveRequests ar = null; - try { - Query query = entityManager.createQuery ("from InfraActiveRequests where vnfName = :vnfName and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC"); - query.setParameter ("vnfName", vnfName); - query.setParameter ("action", action); - query.setParameter (REQUEST_TYPE, requestType); - @SuppressWarnings("unchecked") - List <InfraActiveRequests> results = query.getResultList(); - if (!results.isEmpty ()) { - ar = results.get (0); - } - } finally { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null); - } - - return ar; - } - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkDuplicateByVnfId(java.lang.String, java.lang.String, java.lang.String) - */ - @Override - public InfraActiveRequests checkDuplicateByVnfId (String vnfId, String action, String requestType) { - - long startTime = System.currentTimeMillis (); - msoLogger.debug ("Get list of infra requests from DB for VNF " + vnfId + " and action " + action); - - InfraActiveRequests ar = null; - try { - Query query = entityManager.createQuery ("from InfraActiveRequests where vnfId = :vnfId and action = :action and (requestStatus = 'PENDING' or requestStatus = 'IN_PROGRESS' or requestStatus = 'TIMEOUT' or requestStatus = 'PENDING_MANUAL_TASK') and requestType = :requestType ORDER BY startTime DESC"); - query.setParameter ("vnfId", vnfId); - query.setParameter ("action", action); - query.setParameter (REQUEST_TYPE, requestType); - @SuppressWarnings("unchecked") - List <InfraActiveRequests> results = query.getResultList(); - if (!results.isEmpty ()) { - ar = results.get (0); - } - } finally { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfId", null); - } - - return ar; - } - - /** - * update service operation status when a operation resource status updated - * <br> - * - * @param operStatus the resource operation status - * @since ONAP Amsterdam Release - */ - private void updateOperationStatusBasedOnResourceStatus(ResourceOperationStatus operStatus) { - long startTime = System.currentTimeMillis(); - msoLogger.debug("Request database - query Resource Operation Status with service Id:" - + operStatus.getServiceId() + ", operationId:" + operStatus.getOperationId()); - try { - // query all resources of the service - String hql = "FROM ResourceOperationStatus WHERE SERVICE_ID = :service_id and OPERATION_ID = :operation_id"; - Query query = entityManager.createQuery(hql); - query.setParameter("service_id", operStatus.getServiceId()); - query.setParameter("operation_id", operStatus.getOperationId()); - @SuppressWarnings("unchecked") - List<ResourceOperationStatus> lstResourceStatus = (List<ResourceOperationStatus>)query.getResultList(); - // count the total progress - int resourceCount = lstResourceStatus.size(); - int progress = 0; - boolean isFinished = true; - for(int i = 0; i < resourceCount; i++) { - progress = progress + Integer.valueOf(lstResourceStatus.get(i).getProgress()) / resourceCount; - if(RequestsDbConstant.Status.PROCESSING.equals(lstResourceStatus.get(i).getStatus())) { - isFinished = false; - } - } - - OperationStatus serviceOperStatus = new OperationStatus(operStatus.getServiceId(), operStatus.getOperationId()); - serviceOperStatus = operationStatusRepository.findOne(Example.of(serviceOperStatus)); - progress = progress > 100 ? 100 : progress; - serviceOperStatus.setProgress(String.valueOf(progress)); - serviceOperStatus.setOperationContent(operStatus.getStatusDescription()); - // if current resource failed. service failed. - if(RequestsDbConstant.Status.ERROR.equals(operStatus.getStatus())) { - serviceOperStatus.setResult(RequestsDbConstant.Status.ERROR); - serviceOperStatus.setReason(operStatus.getStatusDescription()); - } else if(isFinished) { - // if finished - serviceOperStatus.setResult(RequestsDbConstant.Status.FINISHED); - serviceOperStatus.setProgress(RequestsDbConstant.Progress.ONE_HUNDRED); - } - operationStatusRepository.save(serviceOperStatus); - } finally { - msoLogger.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully", "RequestDB", "updateResOperStatus", null); - } - } - - /* (non-Javadoc) - * @see org.onap.so.requestsdb.InfraActiveRequestsRepositoryCustom#checkVnfIdStatus(java.lang.String) - */ - @Override - public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) { - long startTime = System.currentTimeMillis (); - msoLogger.debug ("Get Infra request from DB for OperationalEnvironmentId " + operationalEnvironmentId); - - InfraActiveRequests ar = null; - try { - CriteriaBuilder cb = entityManager.getCriteriaBuilder(); - CriteriaQuery<InfraActiveRequests> crit = cb.createQuery(InfraActiveRequests.class); - Root<InfraActiveRequests> candidateRoot = crit.from(InfraActiveRequests.class); - Predicate operationalEnvEq = cb.equal(candidateRoot.get("operationalEnvId"), operationalEnvironmentId); - Predicate requestStatusNotEq = cb.notEqual(candidateRoot.get("requestStatus"), "COMPLETE"); - Predicate actionEq = cb.equal(candidateRoot.get("action"), "create"); - Order startTimeOrder = cb.desc(candidateRoot.get("startTime")); - crit.select(candidateRoot); - crit.where(cb.and(operationalEnvEq, requestStatusNotEq, actionEq)); - crit.orderBy(startTimeOrder); - TypedQuery<InfraActiveRequests> query = entityManager.createQuery(crit); - @SuppressWarnings("unchecked") - List <InfraActiveRequests> results = query.getResultList(); - if (!results.isEmpty ()) { - ar = results.get (0); - } - } finally { - msoLogger.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "RequestDB", "checkDuplicateByVnfName", null); - } - - return ar; - } - - protected <T> T getSingleResult(Query query) { - query.setMaxResults(1); - List<T> list = query.getResultList(); - if (list == null || list.isEmpty()) { - return null; - } else if (list.size() == 1) { - return list.get(0); - } else { - throw new NonUniqueResultException(); - } - - } -} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/QueryOperationType.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/QueryOperationType.java new file mode 100644 index 0000000000..4aaa8d2cbe --- /dev/null +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/QueryOperationType.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.db.request.data.repository; + +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; + +/** + * @author waqas.ikram@ericsson.com + */ +public enum QueryOperationType { + + EQ { + @Override + public <T> Predicate getPredicate(final CriteriaBuilder criteriaBuilder, final Root<T> tableRoot, + final String key, final String value) { + return criteriaBuilder.equal(tableRoot.get(key), value); + } + + }, + NEQ { + + @Override + public <T> Predicate getPredicate(final CriteriaBuilder criteriaBuilder, final Root<T> tableRoot, + final String key, final String value) { + return criteriaBuilder.notEqual(tableRoot.get(key), value); + } + + }, + LIKE { + + @Override + public <T> Predicate getPredicate(final CriteriaBuilder criteriaBuilder, final Root<T> tableRoot, + final String key, final String value) { + return criteriaBuilder.like(tableRoot.get(key), "%" + value + "%"); + } + }; + + public static QueryOperationType getQueryOperationType(final String type) { + for (final QueryOperationType queryOperationType : QueryOperationType.values()) { + if (queryOperationType.name().equalsIgnoreCase(type)) { + return queryOperationType; + } + } + return QueryOperationType.EQ; + } + + public abstract <T> Predicate getPredicate(final CriteriaBuilder criteriaBuilder, final Root<T> tableRoot, + final String key, final String value); + +} diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java index 562e54ca6e..ea3ef30827 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java @@ -24,8 +24,9 @@ import java.sql.Timestamp; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.logger.MsoLogger; -import org.onap.so.requestsdb.client.RequestsDbClient; +import org.onap.so.db.request.client.RequestsDbClient; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Component; @Component @@ -37,6 +38,7 @@ public class RequestsDBHelper { private String methodName = ""; private String classMethodMessage = ""; @Autowired + @Qualifier("RequestsDbClient") private RequestsDbClient requestsDbClient; /** * This util method is to update the InfraRequest table to Complete diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java index 1cde1aac51..3a326598a7 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.requestsdb.adapter; +package org.onap.so.requestsdb; import java.sql.Timestamp; diff --git a/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml b/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml deleted file mode 100644 index cd1bc8b7d7..0000000000 --- a/mso-api-handlers/mso-requests-db/src/main/resources/beans.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:jpa="http://www.springframework.org/schema/data/jpa" - xsi:schemaLocation="http://www.springframework.org/schema/beans - http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/data/jpa - http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> - - <jpa:repositories base-package="org.onap.so.db.request.data.repository" /> - -</beans>
\ No newline at end of file diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml b/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml index 62ae4794f5..c4dd60356b 100644 --- a/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml +++ b/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml @@ -12,6 +12,7 @@ mso: endpoint: http://localhost:8081 site-name: localDevEnv logPath: logs + # H2 spring: datasource: diff --git a/mso-api-handlers/pom.xml b/mso-api-handlers/pom.xml index aed05209cb..078971ec29 100644 --- a/mso-api-handlers/pom.xml +++ b/mso-api-handlers/pom.xml @@ -14,6 +14,7 @@ <modules> <module>mso-requests-db</module> + <module>mso-requests-db-repositories</module> <module>mso-api-handler-common</module> <module>mso-api-handler-infra</module> </modules> diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java index 173480172d..7c6fb04079 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java @@ -79,6 +79,9 @@ public class ConfigurationResource implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource") private Set<ConfigurationResourceCustomization> configurationResourceCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; @PrePersist protected void onCreate() { @@ -147,6 +150,16 @@ public class ConfigurationResource implements Serializable { this.configurationResourceCustomization = configurationResourceCustomization; } + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + @Override public String toString() { return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java new file mode 100644 index 0000000000..c02b1e3030 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java @@ -0,0 +1,275 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.Set; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +import uk.co.blackpepper.bowman.annotation.LinkedResource; + +@Entity +@Table(name = "cvnfc_customization") +public class CvnfcCustomization implements Serializable { + + private static final long serialVersionUID = -3772469944364616486L; + + @Id + @Column(name = "ID") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "NFC_FUNCTION") + private String nfcFunction; + + @Column(name = "NFC_NAMING_CODE") + private String nfcNamingCode; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") + private VfModuleCustomization vfModuleCustomization; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID") + private VnfcCustomization vnfcCustomization; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") + private VnfResourceCustomization vnfResourceCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof CvnfcCustomization)) { + return false; + } + CvnfcCustomization castOther = (CvnfcCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID) + .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion) + .append("modelName", modelName).append("toscaNodeType", toscaNodeType) + .append("description", description).append("nfcFunction", nfcFunction) + .append("nfcNamingCode", nfcNamingCode).append("created", created) + .append("vfModuleCustomization", vfModuleCustomization).append("vnfcCustomization", vnfcCustomization) + .append("vnfResourceCustomization", vnfResourceCustomization) + .append("vnfVfmoduleCvnfcConfigurationCustomization", vnfVfmoduleCvnfcConfigurationCustomization) + .toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getNfcFunction() { + return nfcFunction; + } + + public void setNfcFunction(String nfcFunction) { + this.nfcFunction = nfcFunction; + } + + public String getNfcNamingCode() { + return nfcNamingCode; + } + + public void setNfcNamingCode(String nfcNamingCode) { + this.nfcNamingCode = nfcNamingCode; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public VfModuleCustomization getVfModuleCustomization() { + return vfModuleCustomization; + } + + public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) { + this.vfModuleCustomization = vfModuleCustomization; + } + + public VnfcCustomization getVnfcCustomization() { + return vnfcCustomization; + } + + public void setVnfcCustomization(VnfcCustomization vnfcCustomization) { + this.vnfcCustomization = vnfcCustomization; + } + + public VnfResourceCustomization getVnfResourceCustomization() { + return vnfResourceCustomization; + } + + public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) { + this.vnfResourceCustomization = vnfResourceCustomization; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java index 47d82bff06..7d53a0b843 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java @@ -28,6 +28,7 @@ import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; @@ -94,7 +95,7 @@ public class VfModule implements Serializable { @OneToMany(mappedBy = "vfModule") private List<VfModuleCustomization> vfModuleCustomization; - @ManyToOne + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID") private VnfResource vnfResources; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java index 4a9b3bbbb5..5a7d0d5425 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java @@ -22,6 +22,9 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -29,6 +32,7 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; @@ -37,6 +41,7 @@ import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import com.fasterxml.jackson.annotation.JsonFormat; import com.openpojo.business.annotation.BusinessKey; @@ -85,7 +90,16 @@ public class VfModuleCustomization implements Serializable { @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "VF_MODULE_MODEL_UUID") private VfModule vfModule; - + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfcCustomization> vnfcCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<CvnfcCustomization> cvnfcCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; + @PrePersist protected void onCreate() { this.created = new Date(); @@ -196,4 +210,37 @@ public class VfModuleCustomization implements Serializable { public void setVfModule(VfModule vfModule) { this.vfModule = vfModule; } + + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + if (vnfVfmoduleCvnfcConfigurationCustomization == null) + vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>(); + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + + @LinkedResource + public Set<VnfcCustomization> getVnfcCustomization() { + return vnfcCustomization; + } + + public void setVnfcCustomization( + Set<VnfcCustomization> vnfcCustomization) { + this.vnfcCustomization = vnfcCustomization; + } + + @LinkedResource + public Set<CvnfcCustomization> getCvnfcCustomization() { + if (cvnfcCustomization == null) + cvnfcCustomization = new HashSet<>(); + return cvnfcCustomization; + } + + public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java index fa0fe5636e..d286bc0727 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -23,7 +23,9 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.ArrayList; import java.util.Date; +import java.util.HashSet; import java.util.List; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -67,6 +69,10 @@ public class VnfResourceCustomization implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date created; + public void setCreated(Date created) { + this.created = created; + } + @Column(name = "MIN_INSTANCES") private Integer minInstances; @@ -101,6 +107,12 @@ public class VnfResourceCustomization implements Serializable { @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust") private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID") + private List<CvnfcCustomization> cvnfcCustomization; @Override public String toString() { @@ -250,4 +262,25 @@ public class VnfResourceCustomization implements Serializable { List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) { this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations; } + + @LinkedResource + public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() { + if (vnfVfmoduleCvnfcConfigurationCustomization == null) + vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>(); + return vnfVfmoduleCvnfcConfigurationCustomization; + } + + public void setVnfVfmoduleCvnfcConfigurationCustomization( + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) { + this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization; + } + + @LinkedResource + public List<CvnfcCustomization> getCvnfcCustomization() { + return cvnfcCustomization; + } + + public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java new file mode 100644 index 0000000000..8ef797f8fa --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java @@ -0,0 +1,236 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "vnf_vfmodule_cvnfc_configuration_customization") +public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable { + + private static final long serialVersionUID = -3153216266280581103L; + + @Id + @Column(name = "ID") + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "CONFIGURATION_TYPE") + private String configurationType; + + @Column(name = "CONFIGURATION_ROLE") + private String configurationRole; + + @Column(name = "CONFIGURATION_FUNCTION") + private String configurationFunction; + + @Column(name = "POLICY_NAME") + private String policyName; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CONFIGURATION_MODEL_UUID") + private ConfigurationResource configurationResource; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "CVNFC_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID") + private CvnfcCustomization cvnfcCustomization; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VF_MODULE_MODEL_CUSTOMIZATION_UUID") + private VfModuleCustomization vfModuleCustomization; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") + private VnfResourceCustomization vnfResourceCustomization; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfVfmoduleCvnfcConfigurationCustomization)) { + return false; + } + VnfVfmoduleCvnfcConfigurationCustomization castOther = (VnfVfmoduleCvnfcConfigurationCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID) + .append(cvnfcCustomization, castOther.cvnfcCustomization) + .append(vfModuleCustomization, castOther.vfModuleCustomization) + .append(vnfResourceCustomization, castOther.vnfResourceCustomization).isEquals(); + } + + + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).append(cvnfcCustomization) + .append(vfModuleCustomization).append(vnfResourceCustomization).toHashCode(); + } + + + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("configurationType", configurationType) + .append("configurationRole", configurationRole).append("configurationFunction", configurationFunction) + .append("policyName", policyName).append("created", created) + .append("configurationResource", configurationResource).append("cvnfcCustomization", cvnfcCustomization) + .append("vfModuleCustomization", vfModuleCustomization) + .append("vnfResourceCustomization", vnfResourceCustomization).toString(); + } + + + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getConfigurationType() { + return configurationType; + } + + public void setConfigurationType(String configurationType) { + this.configurationType = configurationType; + } + + public String getConfigurationRole() { + return configurationRole; + } + + public void setConfigurationRole(String configurationRole) { + this.configurationRole = configurationRole; + } + + public String getConfigurationFunction() { + return configurationFunction; + } + + public void setConfigurationFunction(String configurationFunction) { + this.configurationFunction = configurationFunction; + } + + public String getPolicyName() { + return policyName; + } + + public void setPolicyName(String policyName) { + this.policyName = policyName; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public ConfigurationResource getConfigurationResource() { + return configurationResource; + } + + public void setConfigurationResource(ConfigurationResource configurationResource) { + this.configurationResource = configurationResource; + } + + public CvnfcCustomization getCvnfcCustomization() { + return cvnfcCustomization; + } + + public void setCvnfcCustomization(CvnfcCustomization cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } + + public VfModuleCustomization getVfModuleCustomization() { + return vfModuleCustomization; + } + + public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) { + this.vfModuleCustomization = vfModuleCustomization; + } + + public VnfResourceCustomization getVnfResourceCustomization() { + return vnfResourceCustomization; + } + + public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) { + this.vnfResourceCustomization = vnfResourceCustomization; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java new file mode 100644 index 0000000000..8534242a58 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java @@ -0,0 +1,191 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; + +@Entity +@Table(name = "vnfc_customization") +public class VnfcCustomization implements Serializable { + + private static final long serialVersionUID = -3772469944364616486L; + + @BusinessKey + @Id + @Column(name = "MODEL_CUSTOMIZATION_UUID") + private String modelCustomizationUUID; + + @Column(name = "MODEL_INSTANCE_NAME") + private String modelInstanceName; + + @Column(name = "MODEL_UUID") + private String modelUUID; + + @Column(name = "MODEL_INVARIANT_UUID") + private String modelInvariantUUID; + + @Column(name = "MODEL_VERSION") + private String modelVersion; + + @Column(name = "MODEL_NAME") + private String modelName; + + @Column(name = "TOSCA_NODE_TYPE") + private String toscaNodeType; + + @Column(name = "DESCRIPTION") + private String description; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization") + private List<CvnfcCustomization> cvnfcCustomization; + + @Override + public boolean equals(final Object other) { + if (!(other instanceof VnfcCustomization)) { + return false; + } + VnfcCustomization castOther = (VnfcCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID) + .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion) + .append("modelName", modelName).append("toscaNodeType", toscaNodeType) + .append("description", description).append("created", created) + .append("cvnfcCustomization", cvnfcCustomization).toString(); + } + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getModelUUID() { + return modelUUID; + } + + public void setModelUUID(String modelUUID) { + this.modelUUID = modelUUID; + } + + public String getModelInvariantUUID() { + return modelInvariantUUID; + } + + public void setModelInvariantUUID(String modelInvariantUUID) { + this.modelInvariantUUID = modelInvariantUUID; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public List<CvnfcCustomization> getCvnfcCustomization() { + return cvnfcCustomization; + } + + public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) { + this.cvnfcCustomization = cvnfcCustomization; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index dbe69d9d08..e29d88cb89 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -26,6 +26,7 @@ import org.onap.so.db.catalog.beans.CloudifyManager; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; import org.onap.so.db.catalog.beans.ControllerSelectionReference; +import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkRecipe; @@ -46,7 +47,7 @@ import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; -import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter; +import org.onap.so.logging.jaxrs.filter.SpringClientFilter; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.client.BufferingClientHttpRequestFactory; @@ -195,6 +196,8 @@ public class CatalogDbClient { private final Client<CloudSite> cloudSiteClient; private final Client<CloudifyManager> cloudifyManagerClient; + + private Client<CvnfcCustomization> cvnfcCustomizationClient; private final Client<ControllerSelectionReference> controllerSelectionReferenceClient; @@ -240,6 +243,7 @@ public class CatalogDbClient { instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR; cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR; cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR; + } public CatalogDbClient() { @@ -278,6 +282,7 @@ public class CatalogDbClient { cloudSiteClient = clientFactory.create(CloudSite.class); cloudifyManagerClient = clientFactory.create(CloudifyManager.class); serviceRecipeClient = clientFactory.create(ServiceRecipe.class); + cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); } @@ -537,5 +542,20 @@ public class CatalogDbClient { it.forEachRemaining(list::add); return list; } + + public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){ + return this.getMultipleVnfcCustomizations( + UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID") + .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID) + .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build()); + } + + private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) { + Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri); + List<CvnfcCustomization> vnfcList = new ArrayList<>(); + Iterator<CvnfcCustomization> it = vnfcIterator.iterator(); + it.forEachRemaining(vnfcList::add); + return vnfcList; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java index ba40a9c506..fc5a95769d 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.db.catalog.data.repository; import org.onap.so.db.catalog.beans.CloudSite; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java index dfa677b402..3d2ecea2d6 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.db.catalog.data.repository; import org.onap.so.db.catalog.beans.CloudifyManager; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java new file mode 100644 index 0000000000..3eeef07c97 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.data.projections.InlineVnf; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "cvnfcCustomization", path = "cvnfcCustomization", excerptProjection = InlineVnf.class) +public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> { + CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid); + List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID); + List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization, + @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization); +}
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java new file mode 100644 index 0000000000..f936933485 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import java.util.List; + +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization") +public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository<VnfVfmoduleCvnfcConfigurationCustomization, Integer> { + List<VnfVfmoduleCvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID); +}
\ No newline at end of file diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java new file mode 100644 index 0000000000..4ccbf5831f --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import org.onap.so.db.catalog.beans.VnfcCustomization; +import org.onap.so.db.catalog.data.projections.InlineVnf; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + +@RepositoryRestResource(collectionResourceRel = "vnfcCustomization", path = "vnfcCustomization") +public interface VnfcCustomizationRepository extends JpaRepository<VnfcCustomization, String> { + VnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid); +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java deleted file mode 100644 index 6e6db11c45..0000000000 --- a/mso-catalog-db/src/test/java/org/onap/so/BaseTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.onap.so; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@ActiveProfiles("test") -public class BaseTest { - @Test - public void testNothing(){} -} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java new file mode 100644 index 0000000000..5bfa300a03 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfcCustomization; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class BaseTest { + + protected VnfcCustomization setUpVnfcCustomization(){ + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + vnfcCustomization.setModelInstanceName("testVnfcCustomizationModelInstanceName"); + vnfcCustomization.setModelUUID("321228a4-9f15-11e8-98d0-529269fb1459"); + vnfcCustomization.setModelInvariantUUID("c0659136-9f15-11e8-98d0-529269fb1459"); + vnfcCustomization.setModelVersion("testModelVersion"); + vnfcCustomization.setModelName("testModelName"); + vnfcCustomization.setToscaNodeType("testToscaModelType"); + vnfcCustomization.setDescription("testVnfcCustomizationDescription"); + return vnfcCustomization; + } + + protected CvnfcCustomization setUpCvnfcCustomization(){ + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization.setModelInstanceName("cvfncCustomizationTestModelInstanceName"); + cvnfcCustomization.setModelUUID("321228a4-9f15-11e8-98d0-529269fb1459"); + cvnfcCustomization.setModelInvariantUUID("c0659136-9f15-11e8-98d0-529269fb1459"); + cvnfcCustomization.setModelVersion("testModelVersion"); + cvnfcCustomization.setModelName("testModelName"); + cvnfcCustomization.setToscaNodeType("testToscaNodeType"); + cvnfcCustomization.setDescription("description"); + cvnfcCustomization.setNfcFunction("testNfcFunction"); + cvnfcCustomization.setNfcNamingCode("testNfcNamingCode"); + return cvnfcCustomization; + } + + protected VfModule setUpVfModule(){ + VfModule vFModule = new VfModule(); + vFModule.setModelUUID("cb82ffd8-252a-11e7-93ae-92361f002671"); + vFModule.setModelVersion("testModelVersion"); + vFModule.setModelName("testModelName"); + vFModule.setIsBase(false); + return vFModule; + } + + protected VnfResource setUpVnfResource(){ + VnfResource vnfResource = new VnfResource(); + vnfResource.setModelUUID("cb82ffd8-252a-11e7-93ae-92361f002671"); + vnfResource.setModelInvariantUUID("az82ffd8-252a-11e7-93ae-92361f002677"); + vnfResource.setModelVersion("testModelVersion"); + vnfResource.setOrchestrationMode("HEAT"); + return vnfResource; + } + + @Test + public void testNothing(){} +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java index 7a9fc19fcb..73f1ef49fa 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BuildingBlockDetailTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.OrchestrationAction; import org.onap.so.db.catalog.beans.ResourceType; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java index 9aa2ca0c73..489f8a0a3d 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java @@ -23,10 +23,8 @@ package org.onap.so.db.catalog; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import org.onap.so.db.catalog.data.repository.ControllerSelectionReferenceRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java index 60f8de6c2e..147de51c67 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/EmbeddedMariaDbConfig.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so; +package org.onap.so.db.catalog; import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java index 55c5c8351b..456c826d19 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/NetworkTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java index 52cac88402..b6aa408185 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/OrchestrationStatusStateTransitionDirectiveTest.java @@ -24,7 +24,6 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.OrchestrationAction; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java index 0ecaa5fbba..ffa56a9ce3 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java @@ -26,7 +26,6 @@ import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java index 6ee88e407d..0226b86739 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/TestApplication.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/TestApplication.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.onap.so; +package org.onap.so.db.catalog; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -26,9 +26,9 @@ import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Profile; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = { "org.onap"}) +@SpringBootApplication(scanBasePackages = { "org.onap.so.db.catalog"}) @EnableJpaRepositories("org.onap.so.db.catalog.data.repository") -@EntityScan("org.onap.so.db.catalog.beans") +@EntityScan("org.onap.so.db.catalog") @Profile("test") public class TestApplication { private static final String LOGS_DIR = "logs_dir"; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java index 44e7a03855..1f13bd946a 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/VFModuleTest.java @@ -26,7 +26,6 @@ import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; -import org.onap.so.TestApplication; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.data.repository.VFModuleRepository; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java new file mode 100644 index 0000000000..7ec28205d6 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import static org.junit.Assert.assertTrue; + +import java.util.HashSet; +import java.util.Set; + +import org.junit.Test; + +public class CvnfcCustomizationTest { + + private static final Integer ID = new Integer(1); + private static final String DESCRIPTION = "testDescription"; + private static final String MODEL_CUSTOMIZATION_UUID = "testModelCustomizationUUID"; + private static final String MODEL_INSTANCE_NAME = "testModelInstanceName"; + private static final String MODEL_INVARIANT_UUID = "testModelInvariantUUID"; + private static final String MODEL_NAME = "testModelName"; + private static final String MODEL_UUID = "testModelUUID"; + private static final String MODEL_VERSION = "testModelVersion"; + private static final String TOSCA_NODE_TYPE = "testToscaNodeType"; + private static final String NFC_FUNCTION = "testNfcFunction"; + private static final String NFC_NAMING_CODE = "testNfcNamingCode"; + + @Test + public final void testCvnfcCustomization () { + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization.setDescription(DESCRIPTION); + cvnfcCustomization.setId(ID); + cvnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + cvnfcCustomization.setModelInstanceName(MODEL_INSTANCE_NAME); + cvnfcCustomization.setModelInvariantUUID(MODEL_INVARIANT_UUID); + cvnfcCustomization.setModelName(MODEL_NAME); + cvnfcCustomization.setModelUUID(MODEL_UUID); + cvnfcCustomization.setModelVersion(MODEL_VERSION); + cvnfcCustomization.setNfcFunction(NFC_FUNCTION); + cvnfcCustomization.setNfcNamingCode(NFC_NAMING_CODE); + cvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE); + cvnfcCustomization.setVfModuleCustomization(setupVfModuleCustomization()); + cvnfcCustomization.setVnfcCustomization(setupVnfcCustomization()); + cvnfcCustomization.setVnfResourceCustomization(setupVnfResourceCustomization()); + Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet(); + vnfVfmoduleCvnfcConfigurationCustomizationSet.add(setupVnfVfmoduleCvnfcConfigurationCustomization()); + cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet); + + assertTrue (cvnfcCustomization.getId().equals (new Integer(1))); + assertTrue (cvnfcCustomization.getDescription().equals (DESCRIPTION)); + assertTrue (cvnfcCustomization.getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + assertTrue (cvnfcCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME)); + assertTrue (cvnfcCustomization.getModelInvariantUUID().equals (MODEL_INVARIANT_UUID)); + assertTrue (cvnfcCustomization.getModelName().equals (MODEL_NAME)); + assertTrue (cvnfcCustomization.getModelUUID().equals (MODEL_UUID)); + assertTrue (cvnfcCustomization.getModelVersion().equals (MODEL_VERSION)); + assertTrue (cvnfcCustomization.getNfcFunction().equals (NFC_FUNCTION)); + assertTrue (cvnfcCustomization.getNfcNamingCode().equals (NFC_NAMING_CODE)); + assertTrue (cvnfcCustomization.getToscaNodeType().equals (TOSCA_NODE_TYPE)); + assertTrue (cvnfcCustomization.getVnfcCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + assertTrue (cvnfcCustomization.getVfModuleCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + } + + private VfModuleCustomization setupVfModuleCustomization(){ + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vfModuleCustomization; + } + + private VnfcCustomization setupVnfcCustomization(){ + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + vnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vnfcCustomization; + } + + private VnfResourceCustomization setupVnfResourceCustomization(){ + VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); + vnfResourceCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vnfResourceCustomization; + } + + private VnfVfmoduleCvnfcConfigurationCustomization setupVnfVfmoduleCvnfcConfigurationCustomization(){ + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); + vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vnfVfmoduleCvnfcConfigurationCustomization; + } +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java new file mode 100644 index 0000000000..b3ad06cca4 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class VnfVfmoduleCvnfcConfigurationCustomizationTest { + + private static final String CONFIGURATION_FUNCTION = "testconfigurationFunction"; + private static final String CONFIGURATION_ROLE = "testconfigurationRole"; + private static final String CONFIGURATION_TYPE = "testconfigurationType"; + private static final Integer ID = new Integer(1); + private static final String MODEL_CUSTOMIZATION_UUID = "testModelCustomizationUUID"; + private static final String MODEL_INSTANCE_NAME = "testModelInstanceName"; + private static final String MODEL_UUID = "testModelUUID"; + private static final String POLICY_NAME = "testPolicyName"; + + @Test + public final void testVnfVfmoduleCvnfcConfigurationCustomization () { + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction(CONFIGURATION_FUNCTION); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(setupConfigurationResource()); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole(CONFIGURATION_ROLE); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationType(CONFIGURATION_TYPE); + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + cvnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization); + vnfVfmoduleCvnfcConfigurationCustomization.setId(ID); + vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName(MODEL_INSTANCE_NAME); + vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName(POLICY_NAME); + + vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(setupVfModuleCustomization()); + vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(setupVnfResourceCustomization()); + + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getId().equals (new Integer(1))); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equals (CONFIGURATION_FUNCTION)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationRole().equals (CONFIGURATION_ROLE)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationType().equals (CONFIGURATION_TYPE)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName().equals (POLICY_NAME)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + } + + private VfModuleCustomization setupVfModuleCustomization(){ + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vfModuleCustomization; + } + + private VnfResourceCustomization setupVnfResourceCustomization(){ + VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); + vnfResourceCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + return vnfResourceCustomization; + } + + private ConfigurationResource setupConfigurationResource(){ + ConfigurationResource configurationResource = new ConfigurationResource(); + configurationResource.setModelUUID(MODEL_UUID); + return configurationResource; + } +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java new file mode 100644 index 0000000000..2a315d83b6 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.beans; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class VnfcCustomizationTest { + + private static final String DESCRIPTION = "testDescription"; + private static final String MODEL_CUSTOMIZATION_UUID = "testModelCustomizationUUID"; + private static final String MODEL_INSTANCE_NAME = "testModelInstanceName"; + private static final String MODEL_INVARIANT_UUID = "testModelInvariantUUID"; + private static final String MODEL_NAME = "testModelName"; + private static final String MODEL_UUID = "testModelUUID"; + private static final String MODEL_VERSION = "testModelVersion"; + private static final String TOSCA_NODE_TYPE = "testToscaNodeType"; + + @Test + public final void testVnfcCustomization () { + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + vnfcCustomization.setCvnfcCustomization(setupCvnfcCustomizationList()); + vnfcCustomization.setDescription(DESCRIPTION); + vnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + vnfcCustomization.setModelInstanceName(MODEL_INSTANCE_NAME); + vnfcCustomization.setModelInvariantUUID(MODEL_INVARIANT_UUID); + vnfcCustomization.setModelName(MODEL_NAME); + vnfcCustomization.setModelUUID(MODEL_UUID); + vnfcCustomization.setModelVersion(MODEL_VERSION); + vnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE); + + assertTrue (vnfcCustomization.getDescription().equals (DESCRIPTION)); + assertTrue (vnfcCustomization.getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + assertTrue (vnfcCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME)); + assertTrue (vnfcCustomization.getModelInvariantUUID().equals (MODEL_INVARIANT_UUID)); + assertTrue (vnfcCustomization.getModelName().equals (MODEL_NAME)); + assertTrue (vnfcCustomization.getModelUUID().equals (MODEL_UUID)); + assertTrue (vnfcCustomization.getModelVersion().equals (MODEL_VERSION)); + assertTrue (vnfcCustomization.getToscaNodeType().equals (TOSCA_NODE_TYPE)); + assertTrue (vnfcCustomization.getCvnfcCustomization().get(0).getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID)); + } + + private List<CvnfcCustomization> setupCvnfcCustomizationList(){ + CvnfcCustomization testCvnfcCustomization = new CvnfcCustomization(); + testCvnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID); + testCvnfcCustomization.setDescription(DESCRIPTION); + testCvnfcCustomization.setModelVersion(MODEL_VERSION); + testCvnfcCustomization.setModelInstanceName(MODEL_INSTANCE_NAME); + testCvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE); + List<CvnfcCustomization> testCvnfcCustomizationList = new ArrayList(); + testCvnfcCustomizationList.add(testCvnfcCustomization); + return testCvnfcCustomizationList; + } + +}
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java index 5a0770ead6..c5ae3cc83c 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java @@ -1,8 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.db.catalog.data.repository; import org.junit.Assert; import org.junit.Test; -import org.onap.so.BaseTest; +import org.onap.so.db.catalog.BaseTest; import org.onap.so.db.catalog.beans.CloudSite; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -34,4 +54,4 @@ public class CloudSiteRepositoryTest extends BaseTest { Assert.assertFalse(CollectionUtils.isEmpty(cloudSiteList)); } -}
\ No newline at end of file +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java index 21f95a7727..34c22b07b2 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java @@ -1,8 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.db.catalog.data.repository; import org.junit.Assert; import org.junit.Test; -import org.onap.so.BaseTest; +import org.onap.so.db.catalog.BaseTest; import org.onap.so.db.catalog.beans.CloudifyManager; import org.springframework.beans.factory.annotation.Autowired; @@ -18,4 +38,4 @@ public class CloudifyManagerRepositoryTest extends BaseTest { Assert.assertEquals("mtn13", cloudifyManager.getId()); } -}
\ No newline at end of file +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java new file mode 100644 index 0000000000..ae3c49ec7d --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.db.catalog.BaseTest; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfcCustomization; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +public class CvnfcCustomizationRepositoryTest extends BaseTest { + @Autowired + private CvnfcCustomizationRepository cvnfcCustomizationRepository; + + @Test + public void findAllTest() throws Exception { + List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll(); + Assert.assertFalse(CollectionUtils.isEmpty(cvnfcCustomizationList)); + } + + @Test + @Transactional + public void createAndGetTest() throws Exception { + + CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization(); + cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + + VfModule vFModule = setUpVfModule(); + VnfResource vnfResource = setUpVnfResource(); + + vFModule.setVnfResources(vnfResource); + vfModuleCustomization.setVfModule(vFModule); + cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + + VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); + vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); + + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + vnfResourceCustomizations.add(vnfResourceCustomization); + vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); + vnfResourceCustomization.setVnfResources(vnfResource); + + cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); + + VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); + vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459"); + cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + + cvnfcCustomizationRepository.save(cvnfcCustomization); + + List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll(); + boolean matchFound = false; + for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) { + if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) { + + assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization) + .ignoring("id") + .ignoring("created") + .ignoring("vnfVfmoduleCvnfcConfigurationCustomization") + .ignoring("vnfResourceCusteModelCustomizationUUID")); + + matchFound = true; + break; + } + } + Assert.assertTrue(matchFound); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java new file mode 100644 index 0000000000..52cb46f391 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.db.catalog.BaseTest; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.VfModule; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.VnfcCustomization; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends BaseTest { + @Autowired + private VnfVfmoduleCvnfcConfigurationCustomizationRepository vnfVfmoduleCvnfcConfigurationCustomizationRepository; + @Autowired + private CvnfcCustomizationRepository cvnfcCustomizationRepository; + + @Test + public void findAllTest() throws Exception { + List<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationList = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findAll(); + Assert.assertFalse(CollectionUtils.isEmpty(vnfVfmoduleCvnfcConfigurationCustomizationList)); + + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOne(1); + Assert.assertTrue(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction")); + } + + @Test + @Transactional + public void createAndGetTest() throws Exception { + + VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); + vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("testModelInstanceName"); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationType("testConfigurationType"); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole("testConfigurationRole"); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("testConfigurationFunction"); + vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName("testPolicyName"); + + ConfigurationResource configurationResource = new ConfigurationResource(); + configurationResource.setModelUUID("98b42780-9f13-11e8-98d0-529269fb1459"); + configurationResource.setModelInvariantUUID("c9338d1a-9f13-11e8-98d0-529269fb1459"); + configurationResource.setModelVersion("testModelVertsion"); + configurationResource.setModelName("testModelName"); + configurationResource.setToscaNodeType("testToscaNodeType"); + configurationResource.setDescription("testConfigurationDescription"); + vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource); + + CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization(); + cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + + VfModule vFModule = setUpVfModule(); + VnfResource vnfResource = setUpVnfResource(); + + vFModule.setVnfResources(vnfResource); + vfModuleCustomization.setVfModule(vFModule); + cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + + VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); + vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + vnfResourceCustomization.setModelInstanceName("testModelInstanceName"); + + List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); + vnfResourceCustomizations.add(vnfResourceCustomization); + vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); + vnfResourceCustomization.setVnfResources(vnfResource); + + cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization); + + VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); + vnfcCustomization.setModelCustomizationUUID("0aa015ea-9ff3-11e8-98d0-529269fb1459"); + cvnfcCustomization.setVnfcCustomization(vnfcCustomization); + + cvnfcCustomizationRepository.save(cvnfcCustomization); + + vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization); + vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization); + vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization); + + vnfVfmoduleCvnfcConfigurationCustomizationRepository.save(vnfVfmoduleCvnfcConfigurationCustomization); + + VnfVfmoduleCvnfcConfigurationCustomization foundVnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOne(1); + + + if(foundVnfVfmoduleCvnfcConfigurationCustomization == null) + fail("should not be null"); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java new file mode 100644 index 0000000000..0f82c8abf0 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.db.catalog.data.repository; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.db.catalog.BaseTest; +import org.onap.so.db.catalog.beans.VnfcCustomization; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +public class VnfcCustomizationRepositoryTest extends BaseTest { + @Autowired + private VnfcCustomizationRepository vnfcCustomizationRepository; + + @Test + public void findAllTest() throws Exception { + List<VnfcCustomization> vnfcCustomizationList = vnfcCustomizationRepository.findAll(); + Assert.assertFalse(CollectionUtils.isEmpty(vnfcCustomizationList)); + + VnfcCustomization vnfcCustomization = vnfcCustomizationRepository.findOne("9bcce658-9b37-11e8-98d0-529269fb1459"); + Assert.assertTrue(vnfcCustomization.getDescription().equalsIgnoreCase("testVnfcCustomizationDescription")); + } + + @Test + @Transactional + public void createAndGetTest() throws Exception { + + VnfcCustomization vnfcCustomization = setUpVnfcCustomization(); + vnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + vnfcCustomizationRepository.save(vnfcCustomization); + + VnfcCustomization foundVnfcCustomization = vnfcCustomizationRepository.findOne("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + + assertThat(vnfcCustomization, sameBeanAs(foundVnfcCustomization) + .ignoring("created")); + } +} diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql index 9da6d13e49..097cd1ecd0 100644 --- a/mso-catalog-db/src/test/resources/data.sql +++ b/mso-catalog-db/src/test/resources/data.sql @@ -651,3 +651,98 @@ INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERS INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES ('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'), ('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'HealthCheck'); + +INSERT INTO `configuration` + (`model_uuid`, + `model_invariant_uuid`, + `model_version`, + `model_name`, + `tosca_node_type`, + `description`, + `creation_timestamp`) +VALUES ( 'c59a41ca-9b3b-11e8-98d0-529269fb1459', + '15881e64-9b3c-11e8-98d0-529269fb1459', + 'testModelVersion', + 'testModelName', + 'testToscaModelType', + 'testConfigurationDescription', + '2018-07-17 14:05:08' ); + + +INSERT INTO `vnfc_customization` + (`model_customization_uuid`, + `model_instance_name`, + `model_uuid`, + `model_invariant_uuid`, + `model_version`, + `model_name`, + `tosca_node_type`, + `description`, + `creation_timestamp`) +VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459', + 'testModelInstanceName', + 'b25735fe-9b37-11e8-98d0-529269fb1459', + 'ba7e6ef0-9b37-11e8-98d0-529269fb1459', + 'testModelVersion', + 'testModelName', + 'toscaNodeType', + 'testVnfcCustomizationDescription', + '2018-07-17 14:05:08'); + +INSERT INTO `cvnfc_customization` + (`id`, + `model_customization_uuid`, + `model_instance_name`, + `model_uuid`, + `model_invariant_uuid`, + `model_version`, + `model_name`, + `tosca_node_type`, + `description`, + `nfc_function`, + `nfc_naming_code`, + `creation_timestamp`, + `vnf_resource_cust_model_customization_uuid`, + `vf_module_cust_model_customization_uuid`, + `vnfc_cust_model_customization_uuid`) +VALUES ( '1', + '9bcce658-9b37-11e8-98d0-529269fb1459', + 'testModelInstanceName', + 'b25735fe-9b37-11e8-98d0-529269fb1459', + 'ba7e6ef0-9b37-11e8-98d0-529269fb1459', + 'testModelVersion', + 'testModelName', + 'testToscaNodeType', + 'testCvnfcCustomzationDescription', + 'testNfcFunction', + 'testNfcNamingCode', + '2018-07-17 14:05:08', + '68dc9a92-214c-11e7-93ae-92361f002671', + 'cb82ffd8-252a-11e7-93ae-92361f002671', + '9bcce658-9b37-11e8-98d0-529269fb1459'); + +INSERT INTO vnf_vfmodule_cvnfc_configuration_customization + (id, + model_customization_uuid, + vnf_resource_cust_model_customization_uuid, + vf_module_model_customization_uuid, + cvnfc_model_customization_uuid, + model_instance_name, + configuration_type, + configuration_role, + configuration_function, + policy_name, + creation_timestamp, + configuration_model_uuid) +VALUES ( '1', + '7bcce658-9b37-11e8-98d0-529269fb1450', + '68dc9a92-214c-11e7-93ae-92361f002671', + 'cb82ffd8-252a-11e7-93ae-92361f002671', + '9bcce658-9b37-11e8-98d0-529269fb1459', + 'testModelInstanceName', + 'testConfigurationType', + 'testConfigurationRole', + 'testConfigurationFunction', + 'testPolicyName', + '2018-07-17 14:05:08', + 'c59a41ca-9b3b-11e8-98d0-529269fb1459'); diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index 8a4b1f2103..6eaad260ea 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -876,3 +876,75 @@ CREATE TABLE IF NOT EXISTS `cloud_sites` ( KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) ) ; + +CREATE TABLE IF NOT EXISTS vnfc_customization ( +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`)) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS cvnfc_customization ( +`ID` INT(11) NOT NULL AUTO_INCREMENT, +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`MODEL_UUID` VARCHAR(200) NOT NULL, +`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, +`MODEL_VERSION` VARCHAR(20) NOT NULL, +`MODEL_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL, +`NFC_FUNCTION` VARCHAR(200) NULL, +`NFC_NAMING_CODE` VARCHAR(200) NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON +DELETE CASCADE ON +UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1; + + +CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, + `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, + `CONFIGURATION_TYPE` VARCHAR(200) NULL, + `CONFIGURATION_ROLE` VARCHAR(200) NULL, + `CONFIGURATION_FUNCTION` VARCHAR(200) NULL, + `POLICY_NAME` VARCHAR(200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, + PRIMARY KEY (`ID`), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), + UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC), + INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) + REFERENCES `configuration` (`MODEL_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) + REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1; diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml index df6d92163b..5c8894300f 100644 --- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml +++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml @@ -28,9 +28,6 @@ <property name="errorPattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" /> - <property name="debugPattern" - value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg%n" /> - <property name="auditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" /> @@ -48,24 +45,6 @@ \t%thread \t%n" /> - <appender name="SANE" - class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${logs_dir:-.}/${saneLogName}.log</file> - <rollingPolicy - class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> - <fileNamePattern>${logs_dir:-.}/${saneLogName}.%d{yyyy-MM-dd}.%i.log.zip - </fileNamePattern> - - - <maxFileSize>${maxFileSize}</maxFileSize> - <maxHistory>${maxHistory}</maxHistory> - <totalSizeCap>${totalSizeCap}</totalSizeCap> - </rollingPolicy> - <encoder> - <pattern>${defaultPattern}</pattern> - </encoder> - </appender> - <appender name="Audit" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${logs_dir:-.}/${auditLogName}.log</file> @@ -147,7 +126,7 @@ <totalSizeCap>${totalSizeCap}</totalSizeCap> </rollingPolicy> <encoder> - <pattern>${debugPattern}</pattern> + <pattern>${defaultPattern}</pattern> </encoder> </appender> @@ -170,7 +149,7 @@ <logger name="org.apache.wire" level="DEBUG" /> <logger name="org.onap" level="DEBUG" /> <logger name="com.att.ecomp" level="DEBUG" /> - <logger name="org.apache.cxf.interceptor" level="DEBUG" /> + <logger name="org.apache.cxf" level="INFO" /> <logger name="AUDIT" level="INFO" additivity="false"> <appender-ref ref="asyncAudit" /> @@ -182,7 +161,6 @@ <root level="WARN"> <appender-ref ref="asyncDebug" /> - <appender-ref ref="SANE" /> <appender-ref ref="asyncError" /> </root> @@ -29,6 +29,8 @@ <module>asdc-controller</module> <module>bpmn</module> <module>cloudify-client</module> + <module>cxf-logging</module> + <module>so-monitoring</module> <module>packages</module> </modules> <properties> @@ -427,7 +429,7 @@ <version>2.20</version> <configuration> <systemPropertyVariables> - <so.log.level>${so.log.level}</so.log.level> + <so.log.level>DEBUG</so.log.level> </systemPropertyVariables> <rerunFailingTestsCount>2</rerunFailingTestsCount> </configuration> @@ -439,7 +441,7 @@ <configuration> <skip>true</skip> <systemPropertyVariables> - <so.log.level>${so.log.level}</so.log.level> + <so.log.level>DEBUG</so.log.level> </systemPropertyVariables> <rerunFailingTestsCount>2</rerunFailingTestsCount> </configuration> diff --git a/so-monitoring/pom.xml b/so-monitoring/pom.xml new file mode 100644 index 0000000000..cf1f481b96 --- /dev/null +++ b/so-monitoring/pom.xml @@ -0,0 +1,65 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 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========================================================= +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so</groupId> + <artifactId>so</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + + <groupId>org.onap.so.monitoring</groupId> + <artifactId>so-monitoring</artifactId> + + <packaging>pom</packaging> + <name>${project.artifactId}</name> + + <properties> + <java.version>1.8</java.version> + <version.java.compiler>1.8</version.java.compiler> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>${version.java.compiler}</source> + <target>${version.java.compiler}</target> + </configuration> + </plugin> + </plugins> + </build> + + <modules> + <module>so-monitoring-handler</module> + <module>so-monitoring-service</module> + </modules> +</project>
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-handler/pom.xml b/so-monitoring/so-monitoring-handler/pom.xml new file mode 100644 index 0000000000..a535d408f7 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/pom.xml @@ -0,0 +1,95 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 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========================================================= +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.monitoring</groupId> + <artifactId>so-monitoring</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>so-monitoring-handler</artifactId> + <name>${project.artifactId}</name> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <java.version>1.8</java.version> + <guava.version>22.0</guava.version> + <openpojo.version>0.8.6</openpojo.version> + </properties> + + + <dependencies> + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>${guava.version}</version> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + <exclusions> + <exclusion> + <groupId>org.apache.tomcat</groupId> + <artifactId>tomcat-jdbc</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-ext</artifactId> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpcore</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>nl.jqno.equalsverifier</groupId> + <artifactId>equalsverifier</artifactId> + <version>2.5.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>common</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project>
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ActivityInstance.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ActivityInstance.java new file mode 100644 index 0000000000..10ca6c9ac3 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ActivityInstance.java @@ -0,0 +1,188 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.camunda.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ActivityInstance { + + private String activityId; + private String activityName; + private String activityType; + private String processInstanceId; + private String calledProcessInstanceId; + private String startTime; + private String endTime; + private String durationInMillis; + + public ActivityInstance() {} + + + /** + * @return the activityId + */ + public String getActivityId() { + return activityId; + } + + /** + * @param activityId the activityId to set + */ + public void setActivityId(final String activityId) { + this.activityId = activityId; + } + + /** + * @return the activityName + */ + public String getActivityName() { + return activityName; + } + + /** + * @param activityName the activityName to set + */ + public void setActivityName(final String activityName) { + this.activityName = activityName; + } + + /** + * @return the activityType + */ + public String getActivityType() { + return activityType; + } + + /** + * @param activityType the activityType to set + */ + public void setActivityType(final String activityType) { + this.activityType = activityType; + } + + /** + * @return the processInstanceId + */ + public String getProcessInstanceId() { + return processInstanceId; + } + + /** + * @param processInstanceId the processInstanceId to set + */ + public void setProcessInstanceId(final String processInstanceId) { + this.processInstanceId = processInstanceId; + } + + /** + * @return the calledProcessInstanceId + */ + public String getCalledProcessInstanceId() { + return calledProcessInstanceId; + } + + /** + * @param calledProcessInstanceId the calledProcessInstanceId to set + */ + public void setCalledProcessInstanceId(final String calledProcessInstanceId) { + this.calledProcessInstanceId = calledProcessInstanceId; + } + + /** + * @return the startTime + */ + public String getStartTime() { + return startTime; + } + + /** + * @param startTime the startTime to set + */ + public void setStartTime(final String startTime) { + this.startTime = startTime; + } + + /** + * @return the endTime + */ + public String getEndTime() { + return endTime; + } + + /** + * @param endTime the endTime to set + */ + public void setEndTime(final String endTime) { + this.endTime = endTime; + } + + /** + * @return the durationInMillis + */ + public String getDurationInMillis() { + return durationInMillis; + } + + /** + * @param durationInMillis the durationInMillis to set + */ + public void setDurationInMillis(final String durationInMillis) { + this.durationInMillis = durationInMillis; + } + + @JsonIgnore + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activityId == null) ? 0 : activityId.hashCode()); + result = prime * result + ((activityName == null) ? 0 : activityName.hashCode()); + result = prime * result + ((activityType == null) ? 0 : activityType.hashCode()); + result = prime * result + ((calledProcessInstanceId == null) ? 0 : calledProcessInstanceId.hashCode()); + result = prime * result + ((durationInMillis == null) ? 0 : durationInMillis.hashCode()); + result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); + result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); + result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); + return result; + } + + @JsonIgnore + @Override + public boolean equals(final Object obj) { + if (obj instanceof ActivityInstance) { + final ActivityInstance other = (ActivityInstance) obj; + return isEqual(activityId, other.activityId) && isEqual(activityName, other.activityName) + && isEqual(activityType, other.activityType) && isEqual(processInstanceId, other.processInstanceId) + && isEqual(calledProcessInstanceId, other.calledProcessInstanceId) + && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime) + && isEqual(durationInMillis, other.durationInMillis); + } + return false; + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessDefinition.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessDefinition.java new file mode 100644 index 0000000000..ccddf0cd95 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessDefinition.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.camunda.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProcessDefinition { + + private String id; + private String bpmn20Xml; + + public ProcessDefinition() {} + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(final String id) { + this.id = id; + } + + /** + * @return the bpmn20Xml + */ + public String getBpmn20Xml() { + return bpmn20Xml; + } + + /** + * @param bpmn20Xml the bpmn20Xml to set + */ + public void setBpmn20Xml(final String bpmn20Xml) { + this.bpmn20Xml = bpmn20Xml; + } + + @JsonIgnore + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((bpmn20Xml == null) ? 0 : bpmn20Xml.hashCode()); + return result; + } + + @JsonIgnore + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessDefinition) { + final ProcessDefinition other = (ProcessDefinition) obj; + return isEqual(id, other.id) && isEqual(bpmn20Xml, other.bpmn20Xml); + } + return false; + } + + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessInstance.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessInstance.java new file mode 100644 index 0000000000..faea7b3bf9 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessInstance.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.camunda.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author waqas.ikram@ericsson.com + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProcessInstance { + + private String id; + private String processDefinitionId; + private String processDefinitionName; + private String superProcessInstanceId; + + public ProcessInstance() {} + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(final String id) { + this.id = id; + } + + + /** + * @return the processDefinitionId + */ + public String getProcessDefinitionId() { + return processDefinitionId; + } + + /** + * @param processDefinitionId the processDefinitionId to set + */ + public void setProcessDefinitionId(final String processDefinitionId) { + this.processDefinitionId = processDefinitionId; + } + + /** + * @return the processDefinitionName + */ + public String getProcessDefinitionName() { + return processDefinitionName; + } + + /** + * @param processDefinitionName the processDefinitionName to set + */ + public void setProcessDefinitionName(final String processDefinitionName) { + this.processDefinitionName = processDefinitionName; + } + + /** + * @return the superProcessInstanceId + */ + public String getSuperProcessInstanceId() { + return superProcessInstanceId; + } + + /** + * @param superProcessInstanceId the superProcessInstanceId to set + */ + public void setSuperProcessInstanceId(final String superProcessInstanceId) { + this.superProcessInstanceId = superProcessInstanceId; + } + + + @JsonIgnore + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((processDefinitionId == null) ? 0 : processDefinitionId.hashCode()); + result = prime * result + ((processDefinitionName == null) ? 0 : processDefinitionName.hashCode()); + result = prime * result + ((superProcessInstanceId == null) ? 0 : superProcessInstanceId.hashCode()); + return result; + } + + @JsonIgnore + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessInstance) { + final ProcessInstance other = (ProcessInstance) obj; + return isEqual(id, other.id) && isEqual(processDefinitionId, other.processDefinitionId) + && isEqual(processDefinitionName, other.processDefinitionName) + && isEqual(superProcessInstanceId, other.superProcessInstanceId); + } + + return false; + } + + @JsonIgnore + @Override + public String toString() { + return "ProcessInstance [id=" + id + ", processDefinitionId=" + processDefinitionId + ", processDefinitionName=" + + processDefinitionName + "]"; + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessInstanceVariable.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessInstanceVariable.java new file mode 100644 index 0000000000..14a01b96bb --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/ProcessInstanceVariable.java @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.camunda.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * @author waqas.ikram@ericsson.com + */ +public class ProcessInstanceVariable { + + private String name; + private Object value; + private String type; + + public ProcessInstanceVariable() {} + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(final String name) { + this.name = name; + } + + /** + * @return the value + */ + public Object getValue() { + return value; + } + + /** + * @param value the value to set + */ + public void setValue(final Object value) { + this.value = value; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + /** + * @param type the type to set + */ + public void setType(final String type) { + this.type = type; + } + + @JsonIgnore + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((value == null) ? 0 : value.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @JsonIgnore + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessInstanceVariable) { + final ProcessInstanceVariable other = (ProcessInstanceVariable) obj; + return isEqual(name, other.name) && isEqual(value, other.value) && isEqual(type, other.type); + } + + return false; + } + + @JsonIgnore + @Override + public String toString() { + return "ProcessInstance [name=" + name + ", value=" + value + ", type=" + type + "]"; + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/SoActiveInfraRequests.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/SoActiveInfraRequests.java new file mode 100644 index 0000000000..b17cad23b5 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/camunda/model/SoActiveInfraRequests.java @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.camunda.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class SoActiveInfraRequests { + + private String requestId; + private String serviceInstanceId; + private String networkId; + private String startTime; + private String endTime; + private String requestStatus; + private String serviceInstanceName; + private String serviceType; + + /** + * @return the requestId + */ + public String getRequestId() { + return requestId; + } + + /** + * @param requestId the requestId to set + */ + public void setRequestId(final String requestId) { + this.requestId = requestId; + } + + /** + * @return the serviceInstanceId + */ + public String getServiceInstanceId() { + return serviceInstanceId; + } + + /** + * @param serviceInstanceId the serviceInstanceId to set + */ + public void setServiceInstanceId(final String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @param networkId the networkId to set + */ + public void setNetworkId(final String networkId) { + this.networkId = networkId; + } + + /** + * @return the startTime + */ + public String getStartTime() { + return startTime; + } + + /** + * @param startTime the startTime to set + */ + public void setStartTime(final String startTime) { + this.startTime = startTime; + } + + /** + * @return the endTime + */ + public String getEndTime() { + return endTime; + } + + /** + * @param endTime the endTime to set + */ + public void setEndTime(final String endTime) { + this.endTime = endTime; + } + + /** + * @return the requestStatus + */ + public String getRequestStatus() { + return requestStatus; + } + + /** + * @param requestStatus the requestStatus to set + */ + public void setRequestStatus(final String requestStatus) { + this.requestStatus = requestStatus; + } + + /** + * @return the serviceInstanceName + */ + public String getServiceInstanceName() { + return serviceInstanceName; + } + + /** + * @param serviceInstanceName the serviceInstanceName to set + */ + public void setServiceInstanceName(final String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + + /** + * @return the serviceType + */ + public String getServiceType() { + return serviceType; + } + + /** + * @param serviceType the serviceType to set + */ + public void setServiceType(final String serviceType) { + this.serviceType = serviceType; + } + + @JsonIgnore + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); + result = prime * result + ((networkId == null) ? 0 : networkId.hashCode()); + result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); + result = prime * result + ((requestStatus == null) ? 0 : requestStatus.hashCode()); + result = prime * result + ((serviceInstanceId == null) ? 0 : serviceInstanceId.hashCode()); + result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode()); + result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); + result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); + return result; + } + + @JsonIgnore + @Override + public boolean equals(final Object obj) { + if (obj instanceof SoActiveInfraRequests) { + SoActiveInfraRequests other = (SoActiveInfraRequests) obj; + return isEqual(requestId, other.requestId) && isEqual(serviceInstanceId, other.serviceInstanceId) + && isEqual(networkId, other.networkId) && isEqual(startTime, other.startTime) + && isEqual(endTime, other.endTime) && isEqual(requestStatus, other.requestStatus) + && isEqual(serviceInstanceName, other.serviceInstanceName) + && isEqual(serviceType, other.serviceType); + } + + return false; + } + + @JsonIgnore + @Override + public String toString() { + return "SoActiveInfraRequests [requestId=" + requestId + ", serviceInstanceId=" + serviceInstanceId + + ", networkId=" + networkId + ", startTime=" + startTime + ", endTime=" + endTime + ", requestStatus=" + + requestStatus + ", serviceInstanceName=" + serviceInstanceName + ", serviceType=" + serviceType + "]"; + } + + + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/camunda/CamundaConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/camunda/CamundaConfiguration.java new file mode 100644 index 0000000000..2540eda04b --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/camunda/CamundaConfiguration.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.camunda; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @author waqas.ikram@ericsson.com + */ + +@Configuration +public class CamundaConfiguration { + + @Bean + public CamundaRestUrlProvider camundaRestUrlProvider(@Value(value = "${camunda.rest.api.url}") final String httpURL, + @Value(value = "${camunda.rest.api.engine:default}") final String engineName) { + return new CamundaRestUrlProvider(httpURL, engineName); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/camunda/CamundaRestUrlProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/camunda/CamundaRestUrlProvider.java new file mode 100644 index 0000000000..9a509f037b --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/camunda/CamundaRestUrlProvider.java @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.camunda; + +import java.net.URI; + +import org.springframework.stereotype.Service; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * @author waqas.ikram@ericsson.com + */ +@Service +public class CamundaRestUrlProvider { + + private static final String HISTORY_PATH = "history"; + private final URI baseUri; + + public CamundaRestUrlProvider(final String httpUrl, final String engineName) { + this.baseUri = UriComponentsBuilder.fromHttpUrl(httpUrl).path(engineName).build().toUri(); + } + + /** + * see {@link <a href= + * "https://docs.camunda.org/manual/7.5/reference/rest/history/process-instance/get-process-instance-query/">Get + * Process Instances</a>}. + * + * @param requestId the request ID + * @return URL + */ + public String getHistoryProcessInstanceUrl(final String requestId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("process-instance") + .query("variables=requestId_eq_{requestID}").buildAndExpand(requestId).toString(); + } + + /** + * see {@link <a href= + * "https://docs.camunda.org/manual/7.5/reference/rest/history/process-instance/get-process-instance/">Get + * Single Process Instance</a>}. + * + * @param processInstanceId the process instance id. + * @return URL + */ + public String getSingleProcessInstanceUrl(final String processInstanceId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("process-instance") + .pathSegment(processInstanceId).build().toString(); + } + + /** + * see {@link <a href= + * "https://docs.camunda.org/manual/7.5/reference/rest/process-definition/get-xml/">Get BPMN 2.0 + * XML</a>}. + * + * @param processDefinitionId the process definition id. + * @return URL + */ + public String getProcessDefinitionUrl(final String processDefinitionId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment("process-definition").pathSegment(processDefinitionId) + .pathSegment("xml").build().toString(); + } + + /** + * see {@link <a href= + * "https://docs.camunda.org/manual/7.5/reference/rest/history/activity-instance/get-activity-instance/">Get + * Single Activity Instance (Historic)</a>}. + * + * @param processInstanceId the process instance id. + * @return URL + */ + public String getActivityInstanceUrl(final String processInstanceId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("activity-instance") + .query("processInstanceId={processInstanceId}").queryParam("sortBy", "startTime") + .queryParam("sortOrder", "asc").buildAndExpand(processInstanceId).toString(); + } + + /** + * see {@link <a href= + * "https://docs.camunda.org/manual/7.5/reference/rest/history/variable-instance/get-variable-instance/">Get + * Single Variable Instance</a>}. + * + * @param processInstanceId the process instance id. + * @return URL + */ + public String getProcessInstanceVariablesUrl(final String processInstanceId) { + return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("variable-instance") + .query("processInstanceId={processInstanceId}").buildAndExpand(processInstanceId).toString(); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/database/DatabaseConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/database/DatabaseConfiguration.java new file mode 100644 index 0000000000..3d2b529d9a --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/database/DatabaseConfiguration.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.montoring.configuration.database; + + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class DatabaseConfiguration { + + @Bean + public DatabaseUrlProvider databaseUrlProvider( + @Value(value = "${mso.database.rest.api.url}") final String baseUrl) { + return new DatabaseUrlProvider(baseUrl); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/database/DatabaseUrlProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/database/DatabaseUrlProvider.java new file mode 100644 index 0000000000..8235b9272b --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/database/DatabaseUrlProvider.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.database; + +import java.net.URI; + +import org.springframework.web.util.UriComponentsBuilder; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class DatabaseUrlProvider { + + private final URI baseUri; + + public DatabaseUrlProvider(final String baseUrl) { + this.baseUri = UriComponentsBuilder.fromHttpUrl(baseUrl).build().toUri(); + } + + public String getSearchUrl(final long from, final long to, final Integer maxResult) { + final UriComponentsBuilder builder = UriComponentsBuilder.fromUri(baseUri).pathSegment("v1") + .pathSegment("getInfraActiveRequests").queryParam("from", from).queryParam("to", to); + if (maxResult != null) { + return builder.queryParam("maxResult", maxResult).build().toString(); + } + + return builder.build().toString(); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java new file mode 100644 index 0000000000..0db1e51ce2 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/BasicAuthorizationHttpRequestInterceptor.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.rest; + +import java.io.IOException; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpRequest; +import org.springframework.http.client.ClientHttpRequestExecution; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.http.client.ClientHttpResponse; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class BasicAuthorizationHttpRequestInterceptor implements ClientHttpRequestInterceptor { + + private final String authorization; + + public BasicAuthorizationHttpRequestInterceptor(final String authorization) { + this.authorization = authorization; + } + + @Override + public ClientHttpResponse intercept(final HttpRequest request, final byte[] body, + final ClientHttpRequestExecution execution) throws IOException { + final HttpHeaders headers = request.getHeaders(); + headers.add("Authorization", authorization); + return execution.execute(request, body); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/HttpClientConnectionConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/HttpClientConnectionConfiguration.java new file mode 100644 index 0000000000..a465b53c71 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/HttpClientConnectionConfiguration.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.rest; + +import java.util.concurrent.TimeUnit; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +public class HttpClientConnectionConfiguration { + + @Value(value = "${rest.http.client.configuration.connTimeOutInSec:10}") + private int connectionTimeOutInSeconds; + + @Value(value = "${rest.http.client.configuration.socketTimeOutInSec:180}") + private int socketTimeOutInSeconds; + + @Value(value = "${rest.http.client.configuration.socketTimeOutInSec:600}") + private int timeToLiveInSeconds; + + @Value(value = "${rest.http.client.configuration.maxConnections:10}") + private int maxConnections; + + @Value(value = "${rest.http.client.configuration.maxConnectionsPerRoute:2}") + private int maxConnectionsPerRoute; + + /** + * @return the socketTimeOut + */ + public int getSocketTimeOutInMiliSeconds() { + return (int) TimeUnit.SECONDS.toMillis(socketTimeOutInSeconds); + } + + /** + * @return the maxConnections + */ + public int getMaxConnections() { + return maxConnections; + } + + /** + * @return the maxConnectionsPerRoute + */ + public int getMaxConnectionsPerRoute() { + return maxConnectionsPerRoute; + } + + /** + * @return the connectionTimeOut + */ + public int getConnectionTimeOutInMilliSeconds() { + return (int) TimeUnit.SECONDS.toMillis(connectionTimeOutInSeconds); + } + + /** + * @return the timeToLive + */ + public int getTimeToLiveInMins() { + return (int) TimeUnit.SECONDS.toMinutes(timeToLiveInSeconds); + } + + @Override + public String toString() { + return "HttpClientConnectionConfiguration [connectionTimeOutInSeconds=" + connectionTimeOutInSeconds + + ", socketTimeOutInSeconds=" + socketTimeOutInSeconds + ", timeToLiveInSeconds=" + timeToLiveInSeconds + + ", maxConnections=" + maxConnections + ", maxConnectionsPerRoute=" + maxConnectionsPerRoute + "]"; + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/HttpServiceProviderConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/HttpServiceProviderConfiguration.java new file mode 100644 index 0000000000..31cd12bebc --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/HttpServiceProviderConfiguration.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.rest; + +import static org.onap.so.montoring.configuration.rest.RestTemplateConfigration.CAMUNDA_REST_TEMPLATE; +import static org.onap.so.montoring.configuration.rest.RestTemplateConfigration.DATABASE_REST_TEMPLATE; + +import org.onap.so.montoring.rest.service.HttpRestServiceProvider; +import org.onap.so.montoring.rest.service.HttpRestServiceProviderImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestInterceptor; +import org.springframework.web.client.RestTemplate; + +/** + * @author waqas.ikram@ericsson.com + * + */ +@Configuration +public class HttpServiceProviderConfiguration { + + public static final String DATABASE_HTTP_REST_SERVICE_PROVIDER = "databaseHttpRestServiceProvider"; + public static final String CAMUNDA_HTTP_REST_SERVICE_PROVIDER = "camundaHttpRestServiceProvider"; + + @Bean + @Qualifier(CAMUNDA_HTTP_REST_SERVICE_PROVIDER) + public HttpRestServiceProvider camundaHttpRestServiceProvider( + @Qualifier(CAMUNDA_REST_TEMPLATE) @Autowired final RestTemplate restTemplate, + @Value(value = "${camunda.rest.api.auth:#{null}}") final String authorization) { + return getHttpRestServiceProvider(restTemplate, authorization); + } + + @Bean + @Qualifier(DATABASE_HTTP_REST_SERVICE_PROVIDER) + public HttpRestServiceProvider databaseHttpRestServiceProvider( + @Qualifier(DATABASE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate, + @Value(value = "${mso.database.rest.api.auth:#{null}}") final String authorization) { + + return getHttpRestServiceProvider(restTemplate, authorization); + } + + private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate, + final String authorization) { + if (authorization != null && !authorization.isEmpty()) { + final ClientHttpRequestInterceptor authorizationInterceptor = + new BasicAuthorizationHttpRequestInterceptor(authorization); + restTemplate.getInterceptors().add(authorizationInterceptor); + } + return new HttpRestServiceProviderImpl(restTemplate); + } + + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/RestTemplateConfigration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/RestTemplateConfigration.java new file mode 100644 index 0000000000..914e5d676e --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/configuration/rest/RestTemplateConfigration.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.rest; + +import java.util.concurrent.TimeUnit; + +import org.apache.http.client.config.RequestConfig; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +/** + * @author waqas.ikram@ericsson.com + */ +@Configuration +public class RestTemplateConfigration { + + public static final String DATABASE_REST_TEMPLATE = "databaseRestTemplate"; + + public static final String CAMUNDA_REST_TEMPLATE = "camundaRestTemplate"; + + @Autowired + private HttpClientConnectionConfiguration clientConnectionConfiguration; + + @Bean + @Qualifier(CAMUNDA_REST_TEMPLATE) + public RestTemplate camundaRestTemplate() { + return new RestTemplate(httpComponentsClientHttpRequestFactory()); + } + + @Bean + @Qualifier(DATABASE_REST_TEMPLATE) + public RestTemplate dataBasecamundaRestTemplate() { + return new RestTemplate(httpComponentsClientHttpRequestFactory()); + } + + @Bean + public HttpComponentsClientHttpRequestFactory httpComponentsClientHttpRequestFactory() { + return new HttpComponentsClientHttpRequestFactory(httpClient()); + } + + @Bean + public CloseableHttpClient httpClient() { + return HttpClientBuilder.create().setConnectionManager(poolingHttpClientConnectionManager()) + .setMaxConnPerRoute(clientConnectionConfiguration.getMaxConnectionsPerRoute()) + .setMaxConnTotal(clientConnectionConfiguration.getMaxConnections()) + .setDefaultRequestConfig(requestConfig()).build(); + } + + @Bean + public PoolingHttpClientConnectionManager poolingHttpClientConnectionManager() { + return new PoolingHttpClientConnectionManager(clientConnectionConfiguration.getTimeToLiveInMins(), + TimeUnit.MINUTES); + } + + @Bean + public RequestConfig requestConfig() { + return RequestConfig.custom().setSocketTimeout(clientConnectionConfiguration.getSocketTimeOutInMiliSeconds()) + .setConnectTimeout(clientConnectionConfiguration.getConnectionTimeOutInMilliSeconds()).build(); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/db/service/DatabaseServiceProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/db/service/DatabaseServiceProvider.java new file mode 100644 index 0000000000..b8481803e2 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/db/service/DatabaseServiceProvider.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.db.service; + +import java.util.List; +import java.util.Map; + +import org.onap.so.montoring.model.SoInfraRequest; + + +/** + * @author waqas.ikram@ericsson.com + */ +public interface DatabaseServiceProvider { + + List<SoInfraRequest> getSoInfraRequest(final Map<String, String[]> filters, final long startTime, + final long endTime, final Integer maxResult); + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/db/service/DatabaseServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/db/service/DatabaseServiceProviderImpl.java new file mode 100644 index 0000000000..f6cbc3c297 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/db/service/DatabaseServiceProviderImpl.java @@ -0,0 +1,89 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.db.service; + +import static org.onap.so.montoring.configuration.rest.HttpServiceProviderConfiguration.DATABASE_HTTP_REST_SERVICE_PROVIDER; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.onap.so.montoring.camunda.model.SoActiveInfraRequests; +import org.onap.so.montoring.configuration.database.DatabaseUrlProvider; +import org.onap.so.montoring.model.SoInfraRequest; +import org.onap.so.montoring.model.SoInfraRequestBuilder; +import org.onap.so.montoring.rest.service.HttpRestServiceProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import com.google.common.base.Optional; + +/** + * @author waqas.ikram@ericsson.com + */ +@Service +public class DatabaseServiceProviderImpl implements DatabaseServiceProvider { + + private final DatabaseUrlProvider urlProvider; + + private final HttpRestServiceProvider httpRestServiceProvider; + + @Autowired + public DatabaseServiceProviderImpl(final DatabaseUrlProvider urlProvider, + @Qualifier(DATABASE_HTTP_REST_SERVICE_PROVIDER) @Autowired final HttpRestServiceProvider httpRestServiceProvider) { + this.urlProvider = urlProvider; + this.httpRestServiceProvider = httpRestServiceProvider; + } + + @Override + public List<SoInfraRequest> getSoInfraRequest(final Map<String, String[]> filters, final long startTime, + final long endTime, final Integer maxResult) { + final String url = urlProvider.getSearchUrl(startTime, endTime, maxResult); + + final Optional<SoActiveInfraRequests[]> optionalRequests = + httpRestServiceProvider.postHttpRequest(filters, url, SoActiveInfraRequests[].class); + if (optionalRequests.isPresent()) { + return getSoInfraRequest(optionalRequests.get()); + } + return Collections.emptyList(); + } + + + private List<SoInfraRequest> getSoInfraRequest(final SoActiveInfraRequests[] requests) { + final List<SoInfraRequest> result = new ArrayList<>(requests.length); + for (final SoActiveInfraRequests activeRequests : requests) { + final SoInfraRequest soInfraRequest = + new SoInfraRequestBuilder().setRequestId(activeRequests.getRequestId()) + .setServiceInstanceId(activeRequests.getServiceInstanceId()) + .setNetworkId(activeRequests.getNetworkId()).setEndTime(activeRequests.getEndTime()) + .setRequestStatus(activeRequests.getRequestStatus()) + .setServiceIstanceName(activeRequests.getServiceInstanceName()) + .setServiceType(activeRequests.getServiceType()).setStartTime(activeRequests.getStartTime()) + .build(); + result.add(soInfraRequest); + + } + return result; + } + + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/exception/InvalidRestRequestException.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/exception/InvalidRestRequestException.java new file mode 100644 index 0000000000..8e4c751c8e --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/exception/InvalidRestRequestException.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.exception; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class InvalidRestRequestException extends RuntimeException { + private static final long serialVersionUID = -1158414939006977465L; + + public InvalidRestRequestException(final String message) { + super(message); + } + + public InvalidRestRequestException(final String message, final Throwable cause) { + super(message, cause); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/exception/RestProcessingException.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/exception/RestProcessingException.java new file mode 100644 index 0000000000..2d3544ed66 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/exception/RestProcessingException.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.exception; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class RestProcessingException extends RuntimeException { + + private static final long serialVersionUID = 16862313537198441L; + + public RestProcessingException(final String message) { + super(message); + } + + public RestProcessingException(final String message, final Throwable cause) { + super(message, cause); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ActivityInstanceDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ActivityInstanceDetail.java new file mode 100644 index 0000000000..5691f23622 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ActivityInstanceDetail.java @@ -0,0 +1,192 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class ActivityInstanceDetail { + private final String activityId; + private final String activityName; + private final String activityType; + private final String processInstanceId; + private final String calledProcessInstanceId; + private final String startTime; + private final String endTime; + private final String durationInMilliseconds; + + public ActivityInstanceDetail(final ActivityInstanceDetailBuilder builder) { + this.activityId = builder.activityId; + this.activityName = builder.activityName; + this.activityType = builder.activityType; + this.processInstanceId = builder.processInstanceId; + this.calledProcessInstanceId = builder.calledProcessInstanceId; + this.startTime = builder.startTime; + this.endTime = builder.endTime; + this.durationInMilliseconds = builder.durationInMilliseconds; + } + + /** + * @return the activityId + */ + public String getActivityId() { + return activityId; + } + + /** + * @return the activityName + */ + public String getActivityName() { + return activityName; + } + + /** + * @return the activityType + */ + public String getActivityType() { + return activityType; + } + + /** + * @return the processInstanceId + */ + public String getProcessInstanceId() { + return processInstanceId; + } + + /** + * @return the calledProcessInstanceId + */ + public String getCalledProcessInstanceId() { + return calledProcessInstanceId; + } + + /** + * @return the startTime + */ + public String getStartTime() { + return startTime; + } + + /** + * @return the endTime + */ + public String getEndTime() { + return endTime; + } + + /** + * @return the durationInMillis + */ + public String getDurationInMillis() { + return durationInMilliseconds; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activityId == null) ? 0 : activityId.hashCode()); + result = prime * result + ((activityName == null) ? 0 : activityName.hashCode()); + result = prime * result + ((activityType == null) ? 0 : activityType.hashCode()); + result = prime * result + ((calledProcessInstanceId == null) ? 0 : calledProcessInstanceId.hashCode()); + result = prime * result + ((durationInMilliseconds == null) ? 0 : durationInMilliseconds.hashCode()); + result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); + result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); + result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + + if (obj instanceof ActivityInstanceDetail) { + final ActivityInstanceDetail other = (ActivityInstanceDetail) obj; + return isEqual(activityId, other.activityId) && isEqual(activityName, other.activityName) + && isEqual(activityType, other.activityType) && isEqual(processInstanceId, other.processInstanceId) + && isEqual(calledProcessInstanceId, other.calledProcessInstanceId) + && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime) + && isEqual(durationInMilliseconds, other.durationInMilliseconds); + } + + return false; + } + + + public static final class ActivityInstanceDetailBuilder { + + private String activityId; + private String activityName; + private String activityType; + private String processInstanceId; + private String calledProcessInstanceId; + private String startTime; + private String endTime; + private String durationInMilliseconds; + + public ActivityInstanceDetailBuilder activityId(final String activityId) { + this.activityId = activityId; + return this; + } + + public ActivityInstanceDetailBuilder activityName(final String activityName) { + this.activityName = activityName; + return this; + } + + public ActivityInstanceDetailBuilder activityType(final String activityType) { + this.activityType = activityType; + return this; + } + + public ActivityInstanceDetailBuilder processInstanceId(final String processInstanceId) { + this.processInstanceId = processInstanceId; + return this; + } + + public ActivityInstanceDetailBuilder calledProcessInstanceId(final String calledProcessInstanceId) { + this.calledProcessInstanceId = calledProcessInstanceId; + return this; + } + + public ActivityInstanceDetailBuilder startTime(final String startTime) { + this.startTime = startTime; + return this; + } + + public ActivityInstanceDetailBuilder endTime(final String endTime) { + this.endTime = endTime; + return this; + } + + public ActivityInstanceDetailBuilder durationInMilliseconds(final String durationInMilliseconds) { + this.durationInMilliseconds = durationInMilliseconds; + return this; + } + + public ActivityInstanceDetail build() { + return new ActivityInstanceDetail(this); + } + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessDefinitionDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessDefinitionDetail.java new file mode 100644 index 0000000000..164a3921c0 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessDefinitionDetail.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class ProcessDefinitionDetail { + + private final String processDefinitionId; + private final String processDefinitionXml; + + public ProcessDefinitionDetail(final String processDefinitionId, final String processDefinitionXml) { + this.processDefinitionId = processDefinitionId; + this.processDefinitionXml = processDefinitionXml; + } + + /** + * @return the processDefinitionId + */ + public String getProcessDefinitionId() { + return processDefinitionId; + } + + /** + * @return the processDefinitionXml + */ + public String getProcessDefinitionXml() { + return processDefinitionXml; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((processDefinitionId == null) ? 0 : processDefinitionId.hashCode()); + result = prime * result + ((processDefinitionXml == null) ? 0 : processDefinitionXml.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessDefinitionDetail) { + final ProcessDefinitionDetail other = (ProcessDefinitionDetail) obj; + return isEqual(processDefinitionId, other.processDefinitionId) + && isEqual(processDefinitionXml, other.processDefinitionXml); + } + return false; + } + + @Override + public String toString() { + return "ProcessDefinitionDetail [processDefinitionId=" + processDefinitionId + ", processDefinitionXml=" + + processDefinitionXml + "]"; + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceDetail.java new file mode 100644 index 0000000000..a96b6c3a0f --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceDetail.java @@ -0,0 +1,103 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +/** + * @author waqas.ikram@ericsson.com + */ +public class ProcessInstanceDetail { + + private final String processInstanceId; + private final String processDefinitionId; + private final String processDefinitionName; + private final String superProcessInstanceId; + + + public ProcessInstanceDetail(final String processInstanceId, final String processDefinitionId, + final String processDefinitionName, final String superProcessInstanceId) { + this.processInstanceId = processInstanceId; + this.processDefinitionId = processDefinitionId; + this.processDefinitionName = processDefinitionName; + this.superProcessInstanceId = superProcessInstanceId; + } + + /** + * @return the processInstanceId + */ + public String getProcessInstanceId() { + return processInstanceId; + } + + /** + * @return the processDefinitionId + */ + public String getProcessDefinitionId() { + return processDefinitionId; + } + + /** + * @return the processDefinitionName + */ + public String getProcessDefinitionName() { + return processDefinitionName; + } + + /** + * @return the superProcessInstanceId + */ + public String getSuperProcessInstanceId() { + return superProcessInstanceId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); + result = prime * result + ((processDefinitionId == null) ? 0 : processDefinitionId.hashCode()); + result = prime * result + ((processDefinitionName == null) ? 0 : processDefinitionName.hashCode()); + result = prime * result + ((superProcessInstanceId == null) ? 0 : superProcessInstanceId.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessInstanceDetail) { + final ProcessInstanceDetail other = (ProcessInstanceDetail) obj; + + return isEqual(processInstanceId, other.processInstanceId) + && isEqual(processDefinitionId, other.processDefinitionId) + && isEqual(processDefinitionName, other.processDefinitionName) + && isEqual(superProcessInstanceId, other.superProcessInstanceId); + } + return false; + } + + @Override + public String toString() { + return "ProcessInstanceDetail [processInstanceId=" + processInstanceId + ", processDefinitionId=" + + processDefinitionId + ", processDefinitionName=" + processDefinitionName + ", superProcessInstanceId=" + + superProcessInstanceId + "]"; + } + + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceIdDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceIdDetail.java new file mode 100644 index 0000000000..b0bb7acc75 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceIdDetail.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +/** + * @author waqas.ikram@ericsson.com + */ +public class ProcessInstanceIdDetail { + + private final String processInstanceId; + + + public ProcessInstanceIdDetail(final String processInstanceId) { + this.processInstanceId = processInstanceId; + } + + /** + * @return the processInstancId + */ + public String getProcessInstanceId() { + return processInstanceId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessInstanceIdDetail) { + final ProcessInstanceIdDetail other = (ProcessInstanceIdDetail) obj; + + return isEqual(processInstanceId, other.processInstanceId); + } + return false; + } + + @Override + public String toString() { + return "ProcessInstanceIdDetail [processInstanceId=" + processInstanceId + "]"; + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceVariableDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceVariableDetail.java new file mode 100644 index 0000000000..9674dfea4d --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/ProcessInstanceVariableDetail.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +/** + * @author waqas.ikram@ericsson.com + */ +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +public class ProcessInstanceVariableDetail { + + private final String name; + private final Object value; + private final String type; + + public ProcessInstanceVariableDetail(final String name, final Object value, final String type) { + this.name = name; + this.value = value; + this.type = type; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @return the value + */ + public Object getValue() { + return value; + } + + /** + * @return the type + */ + public String getType() { + return type; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((value == null) ? 0 : value.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof ProcessInstanceVariableDetail) { + final ProcessInstanceVariableDetail other = (ProcessInstanceVariableDetail) obj; + + return isEqual(name, other.name) && isEqual(value, other.value) && isEqual(type, other.type); + } + return false; + } + + @Override + public String toString() { + return "ProcessInstanceVariableDetail [name=" + name + ", value=" + value + ", type=" + type + "]"; + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/SoInfraRequest.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/SoInfraRequest.java new file mode 100644 index 0000000000..ca392496eb --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/SoInfraRequest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +import static org.onap.so.montoring.utils.ObjectEqualsUtils.isEqual; + +/** + * @author waqas.ikram@ericsson.com + */ +public class SoInfraRequest { + + private final String requestId; + private final String serviceInstanceId; + private final String serviceIstanceName; + private final String networkId; + private final String requestStatus; + private final String serviceType; + private final String startTime; + private final String endTime; + + public SoInfraRequest(final SoInfraRequestBuilder requestBuilder) { + this.requestId = requestBuilder.getRequestId(); + this.serviceInstanceId = requestBuilder.getServiceInstanceId(); + this.serviceIstanceName = requestBuilder.getServiceIstanceName(); + this.networkId = requestBuilder.getNetworkId(); + this.requestStatus = requestBuilder.getRequestStatus(); + this.serviceType = requestBuilder.getServiceType(); + this.startTime = requestBuilder.getStartTime(); + this.endTime = requestBuilder.getEndTime(); + } + + /** + * @return the requestId + */ + public String getRequestId() { + return requestId; + } + + /** + * @return the serviceInstanceId + */ + public String getServiceInstanceId() { + return serviceInstanceId; + } + + /** + * @return the serviceIstanceName + */ + public String getServiceIstanceName() { + return serviceIstanceName; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @return the requestStatus + */ + public String getRequestStatus() { + return requestStatus; + } + + /** + * @return the serviceType + */ + public String getServiceType() { + return serviceType; + } + + /** + * @return the startTime + */ + public String getStartTime() { + return startTime; + } + + /** + * @return the endTime + */ + public String getEndTime() { + return endTime; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); + result = prime * result + ((networkId == null) ? 0 : networkId.hashCode()); + result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); + result = prime * result + ((requestStatus == null) ? 0 : requestStatus.hashCode()); + result = prime * result + ((serviceInstanceId == null) ? 0 : serviceInstanceId.hashCode()); + result = prime * result + ((serviceIstanceName == null) ? 0 : serviceIstanceName.hashCode()); + result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); + result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof SoInfraRequest) { + final SoInfraRequest other = (SoInfraRequest) obj; + return isEqual(requestId, other.requestId) && isEqual(serviceInstanceId, other.serviceInstanceId) + && isEqual(serviceIstanceName, other.serviceIstanceName) && isEqual(networkId, other.networkId) + && isEqual(requestStatus, other.requestStatus) && isEqual(serviceType, other.serviceType) + && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime); + } + return false; + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/SoInfraRequestBuilder.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/SoInfraRequestBuilder.java new file mode 100644 index 0000000000..3b996f758e --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/model/SoInfraRequestBuilder.java @@ -0,0 +1,148 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.model; + +import java.sql.Timestamp; + +/** + * @author waqas.ikram@ericsson.com + */ +public class SoInfraRequestBuilder { + + private String requestId; + private String serviceInstanceId; + private String serviceIstanceName; + private String networkId; + private String requestStatus; + private String serviceType; + private String startTime; + private String endTime; + + public SoInfraRequestBuilder setRequestId(final String requestId) { + this.requestId = requestId; + return this; + } + + public SoInfraRequestBuilder setServiceInstanceId(final String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + return this; + } + + public SoInfraRequestBuilder setServiceIstanceName(final String serviceIstanceName) { + this.serviceIstanceName = serviceIstanceName; + return this; + } + + public SoInfraRequestBuilder setNetworkId(final String networkId) { + this.networkId = networkId; + return this; + } + + public SoInfraRequestBuilder setRequestStatus(final String requestStatus) { + this.requestStatus = requestStatus; + return this; + } + + public SoInfraRequestBuilder setServiceType(final String serviceType) { + this.serviceType = serviceType; + return this; + } + + public SoInfraRequestBuilder setEndTime(final String endTime) { + this.endTime = endTime; + return this; + } + + public SoInfraRequestBuilder setEndTime(final Timestamp endTime) { + this.endTime = endTime != null ? endTime.toString() : null; + return this; + } + + + public SoInfraRequestBuilder setStartTime(final String startTime) { + this.startTime = startTime; + return this; + } + + public SoInfraRequestBuilder setStartTime(final Timestamp startTime) { + this.startTime = startTime != null ? startTime.toString() : null; + return this; + } + + public SoInfraRequest build() { + return new SoInfraRequest(this); + } + + /** + * @return the requestId + */ + public String getRequestId() { + return requestId; + } + + /** + * @return the serviceInstanceId + */ + public String getServiceInstanceId() { + return serviceInstanceId; + } + + /** + * @return the serviceIstanceName + */ + public String getServiceIstanceName() { + return serviceIstanceName; + } + + /** + * @return the networkId + */ + public String getNetworkId() { + return networkId; + } + + /** + * @return the requestStatus + */ + public String getRequestStatus() { + return requestStatus; + } + + /** + * @return the serviceType + */ + public String getServiceType() { + return serviceType; + } + + /** + * @return the startTime + */ + public String getStartTime() { + return startTime; + } + + /** + * @return the endTime + */ + public String getEndTime() { + return endTime; + } +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProvider.java new file mode 100644 index 0000000000..81e30f1176 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProvider.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.rest.service; + +import java.util.List; + +import org.onap.so.montoring.model.ActivityInstanceDetail; +import org.onap.so.montoring.model.ProcessDefinitionDetail; +import org.onap.so.montoring.model.ProcessInstanceDetail; +import org.onap.so.montoring.model.ProcessInstanceIdDetail; +import org.onap.so.montoring.model.ProcessInstanceVariableDetail; + +import com.google.common.base.Optional; + +/** + * @author waqas.ikram@ericsson.com + */ +public interface CamundaProcessDataServiceProvider { + + Optional<ProcessInstanceIdDetail> getProcessInstanceIdDetail(final String requestId); + + Optional<ProcessInstanceDetail> getSingleProcessInstanceDetail(final String processInstanceId); + + Optional<ProcessDefinitionDetail> getProcessDefinition(final String processDefinitionId); + + List<ActivityInstanceDetail> getActivityInstance(final String processInstanceId); + + List<ProcessInstanceVariableDetail> getProcessInstanceVariable(final String processInstanceId); + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java new file mode 100644 index 0000000000..b1815b5350 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderImpl.java @@ -0,0 +1,174 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.rest.service; + +import static org.onap.so.montoring.configuration.rest.HttpServiceProviderConfiguration.CAMUNDA_HTTP_REST_SERVICE_PROVIDER; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.onap.so.montoring.camunda.model.ActivityInstance; +import org.onap.so.montoring.camunda.model.ProcessDefinition; +import org.onap.so.montoring.camunda.model.ProcessInstance; +import org.onap.so.montoring.camunda.model.ProcessInstanceVariable; +import org.onap.so.montoring.configuration.camunda.CamundaRestUrlProvider; +import org.onap.so.montoring.model.ActivityInstanceDetail; +import org.onap.so.montoring.model.ProcessDefinitionDetail; +import org.onap.so.montoring.model.ProcessInstanceDetail; +import org.onap.so.montoring.model.ProcessInstanceIdDetail; +import org.onap.so.montoring.model.ProcessInstanceVariableDetail; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; + +import com.google.common.base.Optional; + +/** + * @author waqas.ikram@ericsson.com + */ +@Service +public class CamundaProcessDataServiceProviderImpl implements CamundaProcessDataServiceProvider { + private static final XLogger LOGGER = XLoggerFactory.getXLogger(CamundaProcessDataServiceProviderImpl.class); + + private final CamundaRestUrlProvider urlProvider; + + private final HttpRestServiceProvider httpRestServiceProvider; + + @Autowired + public CamundaProcessDataServiceProviderImpl(final CamundaRestUrlProvider urlProvider, + @Qualifier(CAMUNDA_HTTP_REST_SERVICE_PROVIDER) @Autowired final HttpRestServiceProvider httpRestServiceProvider) { + this.urlProvider = urlProvider; + this.httpRestServiceProvider = httpRestServiceProvider; + } + + @Override + public Optional<ProcessInstanceIdDetail> getProcessInstanceIdDetail(final String requestId) { + final String url = urlProvider.getHistoryProcessInstanceUrl(requestId); + final Optional<ProcessInstance[]> processInstances = + httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class); + + if (processInstances.isPresent()) { + final ProcessInstance[] instances = processInstances.get(); + LOGGER.debug("found process instance for request id: {}, result size: {}", requestId, instances.length); + + if (instances.length > 0) { + for (int index = 0; index < instances.length; index++) { + final ProcessInstance processInstance = instances[index]; + if (processInstance.getSuperProcessInstanceId() == null) { + return Optional.of(new ProcessInstanceIdDetail(processInstance.getId())); + } + LOGGER.debug("found sub process instance id with super process instanceId: {}", + processInstance.getSuperProcessInstanceId()); + } + } + } + LOGGER.error("Unable to find process intance for request id: {}", requestId); + return Optional.absent(); + } + + @Override + public Optional<ProcessInstanceDetail> getSingleProcessInstanceDetail(final String processInstanceId) { + final String url = urlProvider.getSingleProcessInstanceUrl(processInstanceId); + final Optional<ProcessInstance> processInstances = + httpRestServiceProvider.getHttpResponse(url, ProcessInstance.class); + + if (processInstances.isPresent()) { + final ProcessInstance processInstance = processInstances.get(); + + final ProcessInstanceDetail instanceDetail = + new ProcessInstanceDetail(processInstance.getId(), processInstance.getProcessDefinitionId(), + processInstance.getProcessDefinitionName(), processInstance.getSuperProcessInstanceId()); + return Optional.of(instanceDetail); + + } + LOGGER.error("Unable to find process intance for id: {}", processInstanceId); + return Optional.absent(); + } + + + @Override + public Optional<ProcessDefinitionDetail> getProcessDefinition(final String processDefinitionId) { + final String url = urlProvider.getProcessDefinitionUrl(processDefinitionId); + final Optional<ProcessDefinition> response = + httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class); + if (response.isPresent()) { + final ProcessDefinition processDefinition = response.get(); + final String xmlDefinition = processDefinition.getBpmn20Xml(); + if (xmlDefinition != null) { + return Optional.of(new ProcessDefinitionDetail(processDefinitionId, xmlDefinition)); + } + } + LOGGER.error("Unable to find process definition for processDefinitionId: {}", processDefinitionId); + return Optional.absent(); + } + + @Override + public List<ActivityInstanceDetail> getActivityInstance(final String processInstanceId) { + final String url = urlProvider.getActivityInstanceUrl(processInstanceId); + final Optional<ActivityInstance[]> response = + httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class); + if (response.isPresent()) { + final ActivityInstance[] activityInstances = response.get(); + final List<ActivityInstanceDetail> activityInstanceDetails = new ArrayList<>(activityInstances.length); + for (int index = 0; index < activityInstances.length; index++) { + + final ActivityInstance activityInstance = activityInstances[index]; + + activityInstanceDetails.add(new ActivityInstanceDetail.ActivityInstanceDetailBuilder() + .activityId(activityInstance.getActivityId()).activityName(activityInstance.getActivityName()) + .activityType(activityInstance.getActivityType()) + .calledProcessInstanceId(activityInstance.getCalledProcessInstanceId()) + .startTime(activityInstance.getStartTime()).endTime(activityInstance.getEndTime()) + .durationInMilliseconds(activityInstance.getDurationInMillis()) + .processInstanceId(activityInstance.getProcessInstanceId()).build()); + + } + return activityInstanceDetails; + } + LOGGER.error("Unable to find activity intance detail for process instance id: {}", processInstanceId); + return Collections.emptyList(); + } + + @Override + public List<ProcessInstanceVariableDetail> getProcessInstanceVariable(final String processInstanceId) { + final String url = urlProvider.getProcessInstanceVariablesUrl(processInstanceId); + final Optional<ProcessInstanceVariable[]> response = + httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class); + if (response.isPresent()) { + final ProcessInstanceVariable[] instanceVariables = response.get(); + final List<ProcessInstanceVariableDetail> instanceVariableDetails = + new ArrayList<>(instanceVariables.length); + for (int index = 0; index < instanceVariables.length; index++) { + final ProcessInstanceVariable processInstanceVariable = instanceVariables[index]; + final ProcessInstanceVariableDetail instanceVariableDetail = + new ProcessInstanceVariableDetail(processInstanceVariable.getName(), + processInstanceVariable.getValue(), processInstanceVariable.getType()); + instanceVariableDetails.add(instanceVariableDetail); + } + return instanceVariableDetails; + } + LOGGER.error("Unable to find process intance variable details for process instance id: {}", processInstanceId); + return Collections.emptyList(); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProvider.java new file mode 100644 index 0000000000..eb80ddcd78 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProvider.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.rest.service; + +import com.google.common.base.Optional; + +/** + * @author waqas.ikram@ericsson.com + */ +public interface HttpRestServiceProvider { + + public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz); + + public <T> Optional<T> postHttpRequest(final Object object, final String url, final Class<T> clazz); + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java new file mode 100644 index 0000000000..35e6038a86 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/rest/service/HttpRestServiceProviderImpl.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.rest.service; + +import org.onap.so.montoring.exception.InvalidRestRequestException; +import org.onap.so.montoring.exception.RestProcessingException; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.HttpClientErrorException; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; + +import com.google.common.base.Optional; + +/** + * @author waqas.ikram@ericsson.com + */ +public class HttpRestServiceProviderImpl implements HttpRestServiceProvider { + + private static final XLogger LOGGER = XLoggerFactory.getXLogger(HttpRestServiceProviderImpl.class); + + private final RestTemplate restTemplate; + + public HttpRestServiceProviderImpl(final RestTemplate restTemplate) { + this.restTemplate = restTemplate; + } + + @Override + public <T> Optional<T> getHttpResponse(final String url, final Class<T> clazz) { + LOGGER.trace("Will invoke HTTP GET using URL: {}", url); + try { + final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.GET, null, clazz); + if (!response.getStatusCode().equals(HttpStatus.OK)) { + LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: {}", url, + response.getStatusCode()); + return Optional.absent(); + } + + if (response.hasBody()) { + return Optional.of(response.getBody()); + } + } catch (final HttpClientErrorException httpClientErrorException) { + LOGGER.error("Unable to invoke HTTP GET using url: {}, Response: {}", url, + httpClientErrorException.getRawStatusCode(), httpClientErrorException); + final int rawStatusCode = httpClientErrorException.getRawStatusCode(); + if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) { + throw new InvalidRestRequestException("No result found for given url: " + url); + } + throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url); + + } catch (final RestClientException restClientException) { + LOGGER.error("Unable to invoke HTTP GET using url: {}", url, restClientException); + throw new RestProcessingException("Unable to invoke HTTP GET using URL: " + url, restClientException); + } + + return Optional.absent(); + } + + @Override + public <T> Optional<T> postHttpRequest(final Object object, final String url, final Class<T> clazz) { + try { + final HttpEntity<?> request = new HttpEntity<>(object); + final ResponseEntity<T> response = restTemplate.exchange(url, HttpMethod.POST, request, clazz); + if (!response.getStatusCode().equals(HttpStatus.OK)) { + LOGGER.error("Unable to invoke HTTP GET using URL: {}, Response Code: {}", url, + response.getStatusCode()); + return Optional.absent(); + } + + if (response.hasBody()) { + return Optional.of(response.getBody()); + } + + } catch (final HttpClientErrorException httpClientErrorException) { + LOGGER.error("Unable to invoke HTTP POST using url: {}, Response: {}", url, + httpClientErrorException.getRawStatusCode(), httpClientErrorException); + final int rawStatusCode = httpClientErrorException.getRawStatusCode(); + if (rawStatusCode == HttpStatus.BAD_REQUEST.value() || rawStatusCode == HttpStatus.NOT_FOUND.value()) { + throw new InvalidRestRequestException("No result found for given url: " + url); + } + throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url); + + } catch (final RestClientException restClientException) { + LOGGER.error("Unable to invoke HTTP POST using url: {}", url, restClientException); + throw new RestProcessingException("Unable to invoke HTTP POST using URL: " + url, restClientException); + } + + return Optional.absent(); + } + + +} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/utils/ObjectEqualsUtils.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/utils/ObjectEqualsUtils.java new file mode 100644 index 0000000000..496ad26bea --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/montoring/utils/ObjectEqualsUtils.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.utils; + +/** + * @author waqas.ikram@ericsson.com + */ +public class ObjectEqualsUtils { + + private ObjectEqualsUtils() {} + + public static boolean isEqual(final Object objectA, final Object objectB) { + if (objectA == null) { + return objectB == null; + } + return objectA.equals(objectB); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaConfigurationTest.java new file mode 100644 index 0000000000..de891dd01b --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaConfigurationTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.montoring.configuration.camunda.CamundaConfiguration; +import org.onap.so.montoring.configuration.camunda.CamundaRestUrlProvider; + + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class CamundaConfigurationTest { + + @Test + public void test_CamundaRestURIConfiguration_ValidUrl() { + final CamundaConfiguration objUnderTest = new CamundaConfiguration(); + final CamundaRestUrlProvider provider = objUnderTest.camundaRestUrlProvider("http://localhost:8080", "default"); + assertEquals( + "http://localhost:8080/default/history/activity-instance?processInstanceId=Deadpool&sortBy=startTime&sortOrder=asc", + provider.getActivityInstanceUrl("Deadpool")); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaRestUrlProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaRestUrlProviderTest.java new file mode 100644 index 0000000000..5fa9b447e6 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/CamundaRestUrlProviderTest.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration; + +import static org.junit.Assert.assertEquals; + +import java.util.UUID; + +import org.junit.Test; +import org.onap.so.montoring.configuration.camunda.CamundaRestUrlProvider; + +/** + * @author waqas.ikram@ericsson.com + */ +public class CamundaRestUrlProviderTest { + private static final String DEFAULT = "default"; + private static final String CAMUNDA_REST_API_URL = "http://localhost:9080/engine-rest/engine/"; + private static final String BASE_URL = CAMUNDA_REST_API_URL + DEFAULT; + private final CamundaRestUrlProvider objUnderTest = new CamundaRestUrlProvider(CAMUNDA_REST_API_URL, DEFAULT); + private static final String ID = UUID.randomUUID().toString(); + + + @Test + public void test_GetHistoryProcessInstanceUrl() { + final String expectedUrl = BASE_URL + "/history/process-instance?variables=requestId_eq_" + ID; + final String actualUrl = objUnderTest.getHistoryProcessInstanceUrl(ID); + assertEquals(expectedUrl, actualUrl); + } + + @Test + public void test_GetProcessInstanceUrl() { + final String expectedUrl = BASE_URL + "/history/process-instance/" + ID; + final String actualUrl = objUnderTest.getSingleProcessInstanceUrl(ID); + assertEquals(expectedUrl, actualUrl); + } + + + @Test + public void test_GetProcessDefinitionUrl() { + final String expectedUrl = BASE_URL + "/process-definition/" + ID + "/xml"; + final String actualUrl = objUnderTest.getProcessDefinitionUrl(ID); + assertEquals(expectedUrl, actualUrl); + + } + + @Test + public void test_GetActivityIntanceUrl() { + final String expectedUrl = + BASE_URL + "/history/activity-instance?processInstanceId=" + ID + "&sortBy=startTime&sortOrder=asc"; + final String actualUrl = objUnderTest.getActivityInstanceUrl(ID); + assertEquals(expectedUrl, actualUrl); + + } + + @Test + public void test_GetProcessInstanceVariablesUrl() { + final String expectedUrl = BASE_URL + "/history/variable-instance?processInstanceId=" + ID; + final String actualUrl = objUnderTest.getProcessInstanceVariablesUrl(ID); + assertEquals(expectedUrl, actualUrl); + + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/HttpServiceProviderConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/HttpServiceProviderConfigurationTest.java new file mode 100644 index 0000000000..13a2f98d57 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/HttpServiceProviderConfigurationTest.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.onap.so.montoring.configuration.rest.HttpServiceProviderConfiguration; +import org.onap.so.montoring.rest.service.HttpRestServiceProvider; +import org.springframework.web.client.RestTemplate; + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class HttpServiceProviderConfigurationTest { + + private final HttpServiceProviderConfiguration objUnderTest = new HttpServiceProviderConfiguration(); + private static final String AUTHORIZATION = + "Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=="; + + @Test + public void test_CamundaHttpRestServiceProvider_NotNull() { + + final HttpRestServiceProvider serviceProvider = + objUnderTest.camundaHttpRestServiceProvider(new RestTemplate(), AUTHORIZATION); + + assertNotNull(serviceProvider); + } + + @Test + public void test_DatabaseHttpRestServiceProvider_NotNull() { + + final HttpRestServiceProvider serviceProvider = + objUnderTest.databaseHttpRestServiceProvider(new RestTemplate(), AUTHORIZATION); + + assertNotNull(serviceProvider); + } + + @Test + public void test_DatabaseHttpRestServiceProviderWithAuthorizationNullOrEmpty_NotNull() { + + HttpRestServiceProvider serviceProvider = + objUnderTest.databaseHttpRestServiceProvider(new RestTemplate(), null); + + assertNotNull(serviceProvider); + + serviceProvider = objUnderTest.databaseHttpRestServiceProvider(new RestTemplate(), ""); + + assertNotNull(serviceProvider); + } + +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/PojoClassesTests.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/PojoClassesTests.java new file mode 100644 index 0000000000..93dfa79990 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/PojoClassesTests.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration; + +import static org.junit.Assert.assertFalse; + +import java.util.Set; +import java.util.regex.Pattern; + +import org.junit.Test; +import org.onap.so.openpojo.rules.ToStringTester; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; +import org.springframework.core.type.filter.RegexPatternTypeFilter; + +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +import nl.jqno.equalsverifier.EqualsVerifier; +import nl.jqno.equalsverifier.Warning; + +/** + * @author waqas.ikram@ericsson.com + */ +public class PojoClassesTests { + + @Test + public void test_camunda_module_pojo_classes() throws ClassNotFoundException { + test("org.onap.so.montoring.camunda.model"); + assertEqualMethod("org.onap.so.montoring.camunda.model"); + } + + @Test + public void test_so_monitoring_pojo_classes() throws ClassNotFoundException { + test("org.onap.so.montoring.model"); + assertEqualMethod("org.onap.so.montoring.model"); + } + + public void assertEqualMethod(final String pojoPackage) throws ClassNotFoundException { + final Set<BeanDefinition> classes = getBeanDefinition(pojoPackage); + assertFalse(classes.isEmpty()); + for (final BeanDefinition bean : classes) { + final Class<?> clazz = Class.forName(bean.getBeanClassName()); + if (!clazz.getName().endsWith("Builder")) { + EqualsVerifier.forClass(clazz).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS).verify(); + } + } + } + + private Set<BeanDefinition> getBeanDefinition(final String pojoPackage) { + final ClassPathScanningCandidateComponentProvider provider = + new ClassPathScanningCandidateComponentProvider(false); + provider.addIncludeFilter(new RegexPatternTypeFilter(Pattern.compile(pojoPackage + ".*"))); + return provider.findCandidateComponents(pojoPackage); + } + + private void test(final String pojoPackage) { + final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()) + .with(new ToStringTester()).build(); + validator.validate(pojoPackage, new FilterPackageInfo()); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/database/DatabaseUrlProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/database/DatabaseUrlProviderTest.java new file mode 100644 index 0000000000..d9d260992d --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/configuration/database/DatabaseUrlProviderTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.configuration.database; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + + +/** + * @author waqas.ikram@ericsson.com + */ +public class DatabaseUrlProviderTest { + + private static final int MAX_RESULT = 1; + private static final String URL = "http://localhost:8081/infraActiveRequests/"; + private final DatabaseUrlProvider objUnderTest = new DatabaseUrlProvider(URL); + + @Test + public void test_maxResultNull() { + final long from = System.currentTimeMillis(); + final long to = System.currentTimeMillis(); + final String actualUrl = objUnderTest.getSearchUrl(from, to, null); + assertEquals(URL + "v1/getInfraActiveRequests?from=" + from + "&to=" + to, actualUrl); + } + + @Test + public void test_maxResultNotNull() { + final long from = System.currentTimeMillis(); + final long to = System.currentTimeMillis(); + final String actualUrl = objUnderTest.getSearchUrl(from, to, MAX_RESULT); + assertEquals(URL + "v1/getInfraActiveRequests?from=" + from + "&to=" + to + "&maxResult=" + MAX_RESULT, + actualUrl); + } +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java new file mode 100644 index 0000000000..3bb7b289e4 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.db.api; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.junit.Test; +import org.onap.so.montoring.camunda.model.SoActiveInfraRequests; +import org.onap.so.montoring.configuration.database.DatabaseUrlProvider; +import org.onap.so.montoring.db.service.DatabaseServiceProvider; +import org.onap.so.montoring.db.service.DatabaseServiceProviderImpl; +import org.onap.so.montoring.model.SoInfraRequest; +import org.onap.so.montoring.rest.service.HttpRestServiceProvider; + +import com.google.common.base.Optional; + + +/** + * @author waqas.ikram@ericsson.com + */ +public class DatabaseServiceProviderTest { + + private final static DatabaseUrlProvider URL_PROVIDER = + new DatabaseUrlProvider("http://localhost:8081/infraActiveRequests/"); + + @Test + public void test_GetSoInfraRequest_WithEmptyFilters_EmptyList() { + final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class); + final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null); + final Optional<SoActiveInfraRequests[]> response = Optional.of(new SoActiveInfraRequests[] {}); + + when(mockServiceProvider.postHttpRequest(eq(Collections.emptyMap()), eq(searchUrl), + eq(SoActiveInfraRequests[].class))).thenReturn(response); + + final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider); + + assertTrue(objUnderTest.getSoInfraRequest(Collections.emptyMap(), 0, 0, null).isEmpty()); + } + + @Test + public void test_GetSoInfraRequest_OptionalAbsent_EmptyList() { + final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class); + final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null); + final Optional<SoActiveInfraRequests[]> response = Optional.absent(); + + when(mockServiceProvider.postHttpRequest(eq(Collections.emptyMap()), eq(searchUrl), + eq(SoActiveInfraRequests[].class))).thenReturn(response); + + final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider); + + assertTrue(objUnderTest.getSoInfraRequest(Collections.emptyMap(), 0, 0, null).isEmpty()); + } + + + @Test + public void test_GetSoInfraRequest_WithFilters_InfraActiveRequestsList() { + final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null); + final String requestID = UUID.randomUUID().toString(); + final Map<String, String[]> filters = new HashMap<>(); + filters.put("requestId", new String[] {"EQ", requestID}); + + SoActiveInfraRequests soActiveInfraRequests = new SoActiveInfraRequests(); + soActiveInfraRequests.setRequestId(requestID); + + final Optional<SoActiveInfraRequests[]> response = + Optional.of(new SoActiveInfraRequests[] {soActiveInfraRequests}); + + final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class); + + when(mockServiceProvider.postHttpRequest(eq(filters), eq(searchUrl), eq(SoActiveInfraRequests[].class))) + .thenReturn(response); + + final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider); + + final List<SoInfraRequest> actualList = objUnderTest.getSoInfraRequest(filters, 0, 0, null); + assertFalse(actualList.isEmpty()); + assertEquals(requestID, actualList.get(0).getRequestId()); + + } +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderTest.java new file mode 100644 index 0000000000..351c476ca1 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/rest/service/CamundaProcessDataServiceProviderTest.java @@ -0,0 +1,232 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.rest.service; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.List; +import java.util.UUID; + +import org.junit.Test; +import org.onap.so.montoring.camunda.model.ActivityInstance; +import org.onap.so.montoring.camunda.model.ProcessDefinition; +import org.onap.so.montoring.camunda.model.ProcessInstance; +import org.onap.so.montoring.camunda.model.ProcessInstanceVariable; +import org.onap.so.montoring.configuration.camunda.CamundaRestUrlProvider; +import org.onap.so.montoring.model.ActivityInstanceDetail; +import org.onap.so.montoring.model.ProcessDefinitionDetail; +import org.onap.so.montoring.model.ProcessInstanceIdDetail; +import org.onap.so.montoring.model.ProcessInstanceVariableDetail; + +import com.google.common.base.Optional; + + +/** + * @author waqas.ikram@ericsson.com + */ +public class CamundaProcessDataServiceProviderTest { + private static final String DURATION = "1"; + private static final String FLOW_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; + private static final String NAME = "Test"; + private static final String DEFAULT = "default"; + private static final String CAMUNDA_REST_API_URL = "http://localhost:9080/engine-rest/engine/"; + + private static final String ID = UUID.randomUUID().toString(); + private static final String PROCESS_ID = UUID.randomUUID().toString(); + private static final String DEF_ID = UUID.randomUUID().toString(); + private static final String SUPER_PROCESS_ID = UUID.randomUUID().toString(); + private final HttpRestServiceProvider httpRestServiceProvider = mock(HttpRestServiceProvider.class); + private final CamundaRestUrlProvider camundaRestUrlProvider = + new CamundaRestUrlProvider(CAMUNDA_REST_API_URL, DEFAULT); + + + @Test + public void test_GetProcessInstanceDetail_EmptyResponse() { + final Optional<ProcessInstance[]> response = Optional.<ProcessInstance[]>absent(); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID; + when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final Optional<ProcessInstanceIdDetail> actualResponse = objUnderTest.getProcessInstanceIdDetail(ID); + assertFalse(actualResponse.isPresent()); + } + + @Test + public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNull() { + final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance()); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID; + when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final Optional<ProcessInstanceIdDetail> actualResponse = objUnderTest.getProcessInstanceIdDetail(ID); + assertTrue(actualResponse.isPresent()); + + final ProcessInstanceIdDetail actualProcessInstanceDetail = actualResponse.get(); + assertEquals(PROCESS_ID, actualProcessInstanceDetail.getProcessInstanceId()); + } + + @Test + public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNotNull() { + final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance(SUPER_PROCESS_ID)); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID; + when(httpRestServiceProvider.getHttpResponse(url, ProcessInstance[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final Optional<ProcessInstanceIdDetail> actualResponse = objUnderTest.getProcessInstanceIdDetail(ID); + assertFalse(actualResponse.isPresent()); + + } + + @Test + public void test_GetProcessDefinition_EmptyResponse() { + final Optional<ProcessDefinition> response = Optional.<ProcessDefinition>absent(); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + ID + "/xml"; + when(httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final Optional<ProcessDefinitionDetail> actualResponse = objUnderTest.getProcessDefinition(ID); + assertFalse(actualResponse.isPresent()); + } + + @Test + public void test_GetProcessDefinition_NonEmptyResponse() { + final Optional<ProcessDefinition> response = getProcessDefinition(); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + PROCESS_ID + "/xml"; + when(httpRestServiceProvider.getHttpResponse(url, ProcessDefinition.class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final Optional<ProcessDefinitionDetail> actualResponse = objUnderTest.getProcessDefinition(PROCESS_ID); + assertTrue(actualResponse.isPresent()); + assertEquals(PROCESS_ID, actualResponse.get().getProcessDefinitionId()); + assertEquals(FLOW_XML, actualResponse.get().getProcessDefinitionXml()); + } + + @Test + public void test_GetActivityInstance_EmptyResponse() { + final Optional<ActivityInstance[]> response = Optional.<ActivityInstance[]>absent(); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID + + "&sortBy=startTime&sortOrder=asc"; + when(httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final List<ActivityInstanceDetail> actualResponse = objUnderTest.getActivityInstance(PROCESS_ID); + assertTrue(actualResponse.isEmpty()); + + } + + @Test + public void test_GetActivityInstance_NonEmptyResponse() { + final Optional<ActivityInstance[]> response = getActivityInstance(); + final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID + + "&sortBy=startTime&sortOrder=asc"; + when(httpRestServiceProvider.getHttpResponse(url, ActivityInstance[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final List<ActivityInstanceDetail> actualResponse = objUnderTest.getActivityInstance(PROCESS_ID); + assertFalse(actualResponse.isEmpty()); + final ActivityInstanceDetail actualActivityInstanceDetail = actualResponse.get(0); + assertEquals(ID, actualActivityInstanceDetail.getActivityId()); + assertEquals(NAME, actualActivityInstanceDetail.getActivityName()); + assertEquals(NAME, actualActivityInstanceDetail.getActivityType()); + + } + + @Test + public void test_GetProcessInstanceVariable_EmptyResponse() { + final Optional<ProcessInstanceVariable[]> response = Optional.<ProcessInstanceVariable[]>absent(); + final String url = + CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID; + when(httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final List<ProcessInstanceVariableDetail> actualResponse = objUnderTest.getProcessInstanceVariable(PROCESS_ID); + assertTrue(actualResponse.isEmpty()); + + } + + @Test + public void test_GetProcessInstanceVariable_NonEmptyResponse() { + final Optional<ProcessInstanceVariable[]> response = getProcessInstanceVariable(); + final String url = + CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID; + when(httpRestServiceProvider.getHttpResponse(url, ProcessInstanceVariable[].class)).thenReturn(response); + final CamundaProcessDataServiceProvider objUnderTest = + new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); + + final List<ProcessInstanceVariableDetail> actualResponse = objUnderTest.getProcessInstanceVariable(PROCESS_ID); + assertFalse(actualResponse.isEmpty()); + final ProcessInstanceVariableDetail variableDetail = actualResponse.get(0); + assertEquals(NAME, variableDetail.getName()); + assertEquals(NAME, variableDetail.getType()); + assertEquals(NAME, variableDetail.getValue()); + + } + + private Optional<ProcessInstanceVariable[]> getProcessInstanceVariable() { + final ProcessInstanceVariable instanceVariable = new ProcessInstanceVariable(); + instanceVariable.setName(NAME); + instanceVariable.setType(NAME); + instanceVariable.setValue(NAME); + return Optional.of(new ProcessInstanceVariable[] {instanceVariable}); + } + + private Optional<ActivityInstance[]> getActivityInstance() { + final ActivityInstance activityInstance = new ActivityInstance(); + activityInstance.setActivityId(ID); + activityInstance.setActivityName(NAME); + activityInstance.setActivityType(NAME); + activityInstance.setDurationInMillis(DURATION); + return Optional.of(new ActivityInstance[] {activityInstance}); + } + + private Optional<ProcessDefinition> getProcessDefinition() { + final ProcessDefinition processDefinition = new ProcessDefinition(); + processDefinition.setId(PROCESS_ID); + processDefinition.setBpmn20Xml(FLOW_XML); + return Optional.of(processDefinition); + } + + private ProcessInstance[] getProcessInstance() { + return getProcessInstance(null); + } + + private ProcessInstance[] getProcessInstance(final String superProcessInstanceId) { + final ProcessInstance instance = new ProcessInstance(); + instance.setId(PROCESS_ID); + instance.setProcessDefinitionId(DEF_ID); + instance.setProcessDefinitionName(NAME); + instance.setSuperProcessInstanceId(superProcessInstanceId); + return new ProcessInstance[] {instance}; + } + + +} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/utils/ObjectEqualsUtilsTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/utils/ObjectEqualsUtilsTest.java new file mode 100644 index 0000000000..b1ad4eae12 --- /dev/null +++ b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/utils/ObjectEqualsUtilsTest.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.montoring.utils; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Test; + + +/** + * @author waqas.ikram@ericsson.com + * + */ +public class ObjectEqualsUtilsTest { + + private static final String VALUE = "Humpty Dumpty Sat On The Wall"; + + @Test + public void test_ObjectEqualsUtils_isEqual_NullValues() { + assertTrue(ObjectEqualsUtils.isEqual(null, null)); + } + + @Test + public void test_ObjectEqualsUtils_isEqual_FirstValueNullSecondNotNull() { + assertFalse(ObjectEqualsUtils.isEqual(null, VALUE)); + } + + @Test + public void test_ObjectEqualsUtils_isEqual_FirstValueNotNullSecondNull() { + assertFalse(ObjectEqualsUtils.isEqual(VALUE, null)); + } + + @Test + public void test_ObjectEqualsUtils_isEqual_NotNullValues() { + assertTrue(ObjectEqualsUtils.isEqual(VALUE, VALUE)); + } + + @Test + public void test_ObjectEqualsUtils_isEqual_CollectionValues() { + final List<Object> firstObject = Arrays.asList(VALUE); + final List<Object> secondObject = Arrays.asList(VALUE); + assertTrue(ObjectEqualsUtils.isEqual(firstObject, secondObject)); + } + + @Test + public void test_ObjectEqualsUtils_isEqual_CollectionAndStringValues() { + final List<Object> firstObject = Arrays.asList(VALUE); + assertFalse(ObjectEqualsUtils.isEqual(firstObject, VALUE)); + } +} diff --git a/so-monitoring/so-monitoring-service/pom.xml b/so-monitoring/so-monitoring-service/pom.xml new file mode 100644 index 0000000000..3aeed23291 --- /dev/null +++ b/so-monitoring/so-monitoring-service/pom.xml @@ -0,0 +1,93 @@ +<!-- + ============LICENSE_START======================================================= + Copyright (C) 2018 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========================================================= +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.onap.so.monitoring</groupId> + <artifactId>so-monitoring</artifactId> + <version>1.3.0-SNAPSHOT</version> + </parent> + <artifactId>so-monitoring-service</artifactId> + <name>${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>org.onap.so.monitoring</groupId> + <artifactId>so-monitoring-handler</artifactId> + <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jersey</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + <scope>compile</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${springboot.version}</version> + <configuration> + <mainClass>org.onap.so.monitoring.rest.api.SoMonitoringApplication</mainClass> + </configuration> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project>
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/JerseyConfiguration.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/JerseyConfiguration.java new file mode 100644 index 0000000000..0f03f23898 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/JerseyConfiguration.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.monitoring.rest.api; + +import javax.annotation.PostConstruct; +import javax.ws.rs.ApplicationPath; + +import org.glassfish.jersey.server.ResourceConfig; +import org.springframework.context.annotation.Configuration; + +/** + * @author waqas.ikram@ericsson.com + */ +@Configuration +@ApplicationPath("/so/monitoring") +public class JerseyConfiguration extends ResourceConfig { + + @PostConstruct + public void setUp() { + register(SoMonitoringController.class); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java index bc04b09588..7c5a8965b7 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java +++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java @@ -18,21 +18,20 @@ * ============LICENSE_END========================================================= */ -package org.onap.so.cloud; +package org.onap.so.monitoring.rest.api; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.domain.EntityScan; -import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -@SpringBootApplication(scanBasePackages = { "org.onap"}) -@EnableJpaRepositories({"org.onap.so.db.catalog.data.repository", "org.onap.so.db.request.data.repository"}) -@EntityScan({"org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans"}) -public class Application { +/** + * @author waqas.ikram@ericsson.com + */ +@SpringBootApplication(scanBasePackages = {"org.onap"}) +public class SoMonitoringApplication { public static void main(String[] args) { - SpringApplication.run(Application.class, args); - System.getProperties().setProperty("mso.db", "MARIADB"); - System.getProperties().setProperty("server.name", "Springboot"); - } + SpringApplication.run(SoMonitoringApplication.class, args); + + } + } diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java new file mode 100644 index 0000000000..913fb3f934 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java @@ -0,0 +1,236 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.monitoring.rest.api; + +import java.util.List; +import java.util.Map; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.onap.so.montoring.db.service.DatabaseServiceProvider; +import org.onap.so.montoring.exception.InvalidRestRequestException; +import org.onap.so.montoring.exception.RestProcessingException; +import org.onap.so.montoring.model.ActivityInstanceDetail; +import org.onap.so.montoring.model.ProcessDefinitionDetail; +import org.onap.so.montoring.model.ProcessInstanceDetail; +import org.onap.so.montoring.model.ProcessInstanceIdDetail; +import org.onap.so.montoring.model.ProcessInstanceVariableDetail; +import org.onap.so.montoring.model.SoInfraRequest; +import org.onap.so.montoring.rest.service.CamundaProcessDataServiceProvider; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.google.common.base.Optional; + +/** + * @author waqas.ikram@ericsson.com + */ +@Component +@Path("/") +public class SoMonitoringController { + + private static final String INVALID_PROCESS_INSTANCE_ERROR_MESSAGE = "Invalid process instance id: "; + + private static final XLogger LOGGER = XLoggerFactory.getXLogger(SoMonitoringController.class); + + private final DatabaseServiceProvider databaseServiceProvider; + + private final CamundaProcessDataServiceProvider camundaProcessDataServiceProvider; + + @Autowired + public SoMonitoringController(final DatabaseServiceProvider databaseServiceProvider, + final CamundaProcessDataServiceProvider camundaProcessDataServiceProvider) { + this.databaseServiceProvider = databaseServiceProvider; + this.camundaProcessDataServiceProvider = camundaProcessDataServiceProvider; + } + + @GET + @Path("/process-instance-id/{requestId}") + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public Response getProcessInstanceId(final @PathParam("requestId") String requestId) { + if (requestId == null || requestId.isEmpty()) { + return Response.status(Status.BAD_REQUEST).entity("Invalid Request id: " + requestId).build(); + } + try { + final Optional<ProcessInstanceIdDetail> processInstanceId = + camundaProcessDataServiceProvider.getProcessInstanceIdDetail(requestId); + if (processInstanceId.isPresent()) { + return Response.status(Status.OK).entity(processInstanceId.get()).build(); + } + + LOGGER.error("Unable to find process instance id for : {}", requestId); + return Response.status(Status.NO_CONTENT).build(); + + } catch (final InvalidRestRequestException extensions) { + final String message = "Unable to find process instance id for : " + requestId; + LOGGER.error(message); + return Response.status(Status.BAD_REQUEST).entity(message).build(); + } catch (final RestProcessingException restProcessingException) { + final String message = "Unable to process request for id: " + requestId; + LOGGER.error(message); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); + } + } + + @GET + @Path("/process-instance/{processInstanceId}") + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public Response getSingleProcessInstance(final @PathParam("processInstanceId") String processInstanceId) { + if (processInstanceId == null || processInstanceId.isEmpty()) { + return Response.status(Status.BAD_REQUEST) + .entity(INVALID_PROCESS_INSTANCE_ERROR_MESSAGE + processInstanceId).build(); + } + try { + final Optional<ProcessInstanceDetail> processInstanceDetail = + camundaProcessDataServiceProvider.getSingleProcessInstanceDetail(processInstanceId); + if (processInstanceDetail.isPresent()) { + return Response.status(Status.OK).entity(processInstanceDetail.get()).build(); + } + + LOGGER.error("Unable to find process instance id for : {}", processInstanceId); + return Response.status(Status.NO_CONTENT).build(); + + } catch (final InvalidRestRequestException extensions) { + final String message = "Unable to find process instance id for : " + processInstanceId; + LOGGER.error(message); + return Response.status(Status.BAD_REQUEST).entity(message).build(); + } catch (final RestProcessingException restProcessingException) { + final String message = "Unable to process request for id: " + processInstanceId; + LOGGER.error(message); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); + } + } + + @GET + @Path("/process-definition/{processDefinitionId}") + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public Response getProcessDefinitionXml(final @PathParam("processDefinitionId") String processDefinitionId) { + if (processDefinitionId == null || processDefinitionId.isEmpty()) { + return Response.status(Status.BAD_REQUEST).entity("Invalid process definition id: " + processDefinitionId) + .build(); + } + try { + final Optional<ProcessDefinitionDetail> response = + camundaProcessDataServiceProvider.getProcessDefinition(processDefinitionId); + if (response.isPresent()) { + final ProcessDefinitionDetail definitionDetail = response.get(); + return Response.status(Status.OK).entity(definitionDetail).build(); + } + LOGGER.error("Unable to find process definition xml for processDefinitionId: {}", processDefinitionId); + return Response.status(Status.NO_CONTENT).build(); + + } catch (final InvalidRestRequestException extensions) { + final String message = + "Unable to find process definition xml for processDefinitionId: {}" + processDefinitionId; + return Response.status(Status.BAD_REQUEST).entity(message).build(); + } catch (final RestProcessingException restProcessingException) { + final String message = "Unable to get process definition xml for id: " + processDefinitionId; + LOGGER.error(message); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); + } + } + + @GET + @Path("/activity-instance/{processInstanceId}") + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public Response getActivityInstanceDetail(final @PathParam("processInstanceId") String processInstanceId) { + if (processInstanceId == null || processInstanceId.isEmpty()) { + return Response.status(Status.BAD_REQUEST) + .entity(INVALID_PROCESS_INSTANCE_ERROR_MESSAGE + processInstanceId).build(); + } + try { + final List<ActivityInstanceDetail> activityInstanceDetails = + camundaProcessDataServiceProvider.getActivityInstance(processInstanceId); + return Response.status(Status.OK).entity(activityInstanceDetails).build(); + } catch (final InvalidRestRequestException extensions) { + final String message = "Unable to find activity instance for processInstanceId: " + processInstanceId; + LOGGER.error(message); + return Response.status(Status.BAD_REQUEST).entity(message).build(); + } catch (final RestProcessingException restProcessingException) { + final String message = "Unable to get activity instance detail for id: " + processInstanceId; + LOGGER.error(message); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); + } + } + + @GET + @Path("/variable-instance/{processInstanceId}") + @Produces(MediaType.APPLICATION_JSON) + public Response getProcessInstanceVariables(final @PathParam("processInstanceId") String processInstanceId) { + if (processInstanceId == null || processInstanceId.isEmpty()) { + return Response.status(Status.BAD_REQUEST) + .entity(INVALID_PROCESS_INSTANCE_ERROR_MESSAGE + processInstanceId).build(); + } + try { + final List<ProcessInstanceVariableDetail> processInstanceVariable = + camundaProcessDataServiceProvider.getProcessInstanceVariable(processInstanceId); + return Response.status(Status.OK).entity(processInstanceVariable).build(); + } catch (final InvalidRestRequestException extensions) { + final String message = + "Unable to find process instance variables for processInstanceId: " + processInstanceId; + LOGGER.error(message); + return Response.status(Status.BAD_REQUEST).entity(message).build(); + } catch (final RestProcessingException restProcessingException) { + final String message = "Unable to get process instance variables for id: " + processInstanceId; + LOGGER.error(message); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); + } + } + + @POST + @Path("/v1/search") + @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public Response getInfraActiveRequests(final Map<String, String[]> filters, + @QueryParam("from") final long startTime, @QueryParam("to") final long endTime, + @QueryParam("maxResult") final Integer maxResult) { + + if (filters == null) { + return Response.status(Status.BAD_REQUEST).entity("Invalid filters: " + filters).build(); + } + try { + final List<SoInfraRequest> requests = + databaseServiceProvider.getSoInfraRequest(filters, startTime, endTime, maxResult); + LOGGER.info("result size: {}", requests.size()); + return Response.status(Status.OK).entity(requests).build(); + + } catch (final InvalidRestRequestException extensions) { + final String message = "Unable to search request for filters: " + filters + ", from: " + startTime + + ", to: " + endTime + ", maxResult: " + maxResult; + LOGGER.error(message); + return Response.status(Status.BAD_REQUEST).entity(message).build(); + } catch (final RestProcessingException restProcessingException) { + final String message = "Unable to search request for filters: " + filters + ", from: " + startTime + + ", to: " + endTime + ", maxResult: " + maxResult; + LOGGER.error(message); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity(message).build(); + } + } + +} diff --git a/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java new file mode 100644 index 0000000000..cadd60b0d9 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/WebApplicationConfig.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.monitoring.rest.api; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +/** + * @author waqas.ikram@ericsson.com + */ +@Configuration +public class WebApplicationConfig extends WebMvcConfigurerAdapter { + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + super.addViewControllers(registry); + registry.addViewController("/details/**").setViewName("forward:/"); + } +} diff --git a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml new file mode 100644 index 0000000000..f21207474a --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml @@ -0,0 +1,17 @@ +server: + port: 9091 + tomcat: + max-threads: 50 +ssl-enable: false +camunda: + rest: + api: + url: http://bpmn-infra:8081/engine-rest/engine/ + engine: default + auth: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== +mso: + database: + rest: + api: + url: http://request-db-adapter:8083/infraActiveRequests/ + auth: Basic YnBlbDpwYXNzd29yZDEk
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java new file mode 100644 index 0000000000..13953b0331 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java @@ -0,0 +1,400 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2018 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.monitoring.rest.api; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.onap.so.montoring.configuration.rest.RestTemplateConfigration.CAMUNDA_REST_TEMPLATE; +import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess; +import static org.springframework.test.web.client.response.MockRestResponseCreators.withUnauthorizedRequest; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.UUID; + +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.montoring.configuration.camunda.CamundaRestUrlProvider; +import org.onap.so.montoring.model.ActivityInstanceDetail; +import org.onap.so.montoring.model.ProcessDefinitionDetail; +import org.onap.so.montoring.model.ProcessInstanceDetail; +import org.onap.so.montoring.model.ProcessInstanceIdDetail; +import org.onap.so.montoring.model.ProcessInstanceVariableDetail; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.web.client.MockRestServiceServer; +import org.springframework.web.client.RestTemplate; + + + +/** + * @author waqas.ikram@ericsson.com + */ +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("test") +@SpringBootTest +public class SoMonitoringControllerTest { + + private static final String PROCRESS_DEF_ID = "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb"; + + private static final String EMPTY_ARRAY_RESPONSE = "[]"; + + private static final String PROCESS_INSTACE_ID = "5956a99d-9736-11e8-8caf-022ac9304eeb"; + + private static final String EMPTY_STRING = ""; + + private static final String SOURCE_TEST_FOLDER = "src/test/resources/camundaResponses/"; + + private static final Path PROCESS_DEF_RESPONSE_JSON_FILE = Paths.get(SOURCE_TEST_FOLDER + "processDefinition.json"); + + private static final Path ACTIVITY_INSTANCE_RESPONSE_JSON_FILE = + Paths.get(SOURCE_TEST_FOLDER + "activityInstance.json"); + + private static final Path PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE = + Paths.get(SOURCE_TEST_FOLDER + "processInstanceVariables.json"); + + private static final Path PROCCESS_INSTANCE_RESPONSE_JSON_FILE = + Paths.get(SOURCE_TEST_FOLDER + "processInstance.json"); + + private static final Path SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE = + Paths.get(SOURCE_TEST_FOLDER + "singleprocessInstance.json"); + + private static final String ID = UUID.randomUUID().toString(); + + @Autowired + @Qualifier(CAMUNDA_REST_TEMPLATE) + private RestTemplate restTemplate; + + @Autowired + private CamundaRestUrlProvider urlProvider; + + private MockRestServiceServer camundaMockServer; + + @Autowired + private SoMonitoringController objUnderTest; + + @Before + public void setUp() throws Exception { + camundaMockServer = MockRestServiceServer.bindTo(restTemplate).build(); + } + + @Test + public void test_GetProcessInstance_SuccessResponseWithDataFromCamunda() throws Exception { + final String jsonString = getJsonResponse(PROCCESS_INSTANCE_RESPONSE_JSON_FILE); + this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID))) + .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getProcessInstanceId(ID); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + final ProcessInstanceIdDetail actualProcessInstance = (ProcessInstanceIdDetail) response.getEntity(); + assertEquals("dba707b6-8c02-11e8-a6ba-022a5dba5402", actualProcessInstance.getProcessInstanceId()); + } + + @Test + public void test_GetProcessInstance_SuccessResponseWithEmptyDataFromCamunda() throws Exception { + final String jsonString = EMPTY_ARRAY_RESPONSE; + this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID))) + .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getProcessInstanceId(ID); + assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus()); + assertNull(response.getEntity()); + } + + @Test + public void test_GetProcessInstance_FailureResponseWithEmptyDataFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID))) + .andRespond(withBadRequest()); + + final Response response = objUnderTest.getProcessInstanceId(ID); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + } + + @Test + public void test_GetProcessInstance_UnauthorizedRequestFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getHistoryProcessInstanceUrl(ID))) + .andRespond(withUnauthorizedRequest()); + + final Response response = objUnderTest.getProcessInstanceId(ID); + assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetSinlgeProcessInstance_SuccessResponseWithDataFromCamunda() throws Exception { + final String jsonString = getJsonResponse(SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE); + this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + final ProcessInstanceDetail actualProcessInstance = (ProcessInstanceDetail) response.getEntity(); + assertEquals(PROCESS_INSTACE_ID, actualProcessInstance.getProcessInstanceId()); + assertEquals("EricssonNetworkSliceV1:3:28f9e0fc-9b00-11e8-a57a-022ac90273ed", + actualProcessInstance.getProcessDefinitionId()); + assertEquals("EricssonNetworkSliceV1", actualProcessInstance.getProcessDefinitionName()); + assertNull(actualProcessInstance.getSuperProcessInstanceId()); + } + + @Test + public void test_GetSingleProcessInstance_WithBadRequestResponseFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withBadRequest()); + + final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetSingleProcessInstance_WithUnauthorizedRequestResponseFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getSingleProcessInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withUnauthorizedRequest()); + + final Response response = objUnderTest.getSingleProcessInstance(PROCESS_INSTACE_ID); + assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetSingleProcessInstance_NullAndEmptyProcessInstanceIdFromCamunda() throws Exception { + + Response response = objUnderTest.getSingleProcessInstance(null); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + + response = objUnderTest.getSingleProcessInstance(""); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + + @Test + public void test_GetProcessInstance_EmptyRequestID() throws Exception { + + Response response = objUnderTest.getProcessInstanceId(EMPTY_STRING); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + + response = objUnderTest.getProcessInstanceId(null); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + } + + + @Test + public void test_GetProcessDefinitionXml_SuccessResponseWithDataFromCamunda() throws Exception { + final String jsonString = getJsonResponse(PROCESS_DEF_RESPONSE_JSON_FILE); + this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID))) + .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID); + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + + final ProcessDefinitionDetail actual = (ProcessDefinitionDetail) response.getEntity(); + assertEquals(PROCRESS_DEF_ID, actual.getProcessDefinitionId()); + } + + @Test + public void test_GetProcessDefinitionXml_BadRequestResponseFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID))) + .andRespond(withBadRequest()); + + final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetProcessDefinitionXml_UnauthorizedRequestFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getProcessDefinitionUrl(PROCRESS_DEF_ID))) + .andRespond(withUnauthorizedRequest()); + + final Response response = objUnderTest.getProcessDefinitionXml(PROCRESS_DEF_ID); + assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetProcessDefinitionXml_NullValues() throws Exception { + Response response = objUnderTest.getProcessDefinitionXml(EMPTY_STRING); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + + response = objUnderTest.getProcessDefinitionXml(null); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetActivityInstanceDetail_SuccessResponseWithDataFromCamunda() throws Exception { + final String jsonString = getJsonResponse(ACTIVITY_INSTANCE_RESPONSE_JSON_FILE); + this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID); + @SuppressWarnings("unchecked") + final List<ActivityInstanceDetail> actual = (List<ActivityInstanceDetail>) response.getEntity(); + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + assertEquals(12, actual.size()); + final ActivityInstanceDetail activityInstanceDetail = actual.get(0); + assertEquals("createVCPE_startEvent", activityInstanceDetail.getActivityId()); + assertEquals("Start Flow", activityInstanceDetail.getActivityName()); + assertEquals("startEvent", activityInstanceDetail.getActivityType()); + assertEquals(PROCESS_INSTACE_ID, activityInstanceDetail.getProcessInstanceId()); + assertNull(activityInstanceDetail.getCalledProcessInstanceId()); + assertEquals("26", activityInstanceDetail.getDurationInMillis()); + assertEquals("2018-08-03T16:00:31.815+0000", activityInstanceDetail.getStartTime()); + assertEquals("2018-08-03T16:00:31.841+0000", activityInstanceDetail.getEndTime()); + + final ActivityInstanceDetail callActivityInstanceDetail = actual.get(4); + assertEquals("DecomposeService", callActivityInstanceDetail.getActivityId()); + assertEquals("Call Decompose Service", callActivityInstanceDetail.getActivityName()); + assertEquals("callActivity", callActivityInstanceDetail.getActivityType()); + assertEquals("59d99609-9736-11e8-8caf-022ac9304eeb", callActivityInstanceDetail.getCalledProcessInstanceId()); + } + + @Test + public void test_GetActivityInstanceDetail_SuccessResponseWithEmptyDataFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withSuccess(EMPTY_ARRAY_RESPONSE, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID); + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetActivityInstanceDetail_UnauthorizedRequestFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withUnauthorizedRequest()); + + final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID); + assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetActivityInstanceDetail_BadRequestFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getActivityInstanceUrl(PROCESS_INSTACE_ID))) + .andRespond(withBadRequest()); + + final Response response = objUnderTest.getActivityInstanceDetail(PROCESS_INSTACE_ID); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetActivityInstanceDetail_NullValues() throws Exception { + Response response = objUnderTest.getActivityInstanceDetail(EMPTY_STRING); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + + response = objUnderTest.getActivityInstanceDetail(null); + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetProcessInstanceVariables_SuccessResponseWithDataFromCamunda() throws Exception { + final String jsonString = getJsonResponse(PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE); + this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID))) + .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + @SuppressWarnings("unchecked") + final List<ProcessInstanceVariableDetail> actual = (List<ProcessInstanceVariableDetail>) response.getEntity(); + assertEquals(230, actual.size()); + + ProcessInstanceVariableDetail variableDetail = actual.get(0); + assertEquals("serviceType", variableDetail.getName()); + assertEquals("String", variableDetail.getType()); + assertEquals("PNFSERVICE", variableDetail.getValue()); + } + + @Test + public void test_GetProcessInstanceVariables_SuccessResponseWithEmptyDataFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID))) + .andRespond(withSuccess(EMPTY_ARRAY_RESPONSE, MediaType.APPLICATION_JSON)); + + final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID); + + assertEquals(Status.OK.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetProcessInstanceVariables_BadRequestFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID))) + .andRespond(withBadRequest()); + + final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID); + + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetProcessInstanceVariables_UnauthorizedRequestFromCamunda() throws Exception { + this.camundaMockServer.expect(requestTo(urlProvider.getProcessInstanceVariablesUrl(PROCESS_INSTACE_ID))) + .andRespond(withUnauthorizedRequest()); + + final Response response = objUnderTest.getProcessInstanceVariables(PROCESS_INSTACE_ID); + + assertEquals(Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + } + + @Test + public void test_GetProcessInstanceVariables_NullAndEmptyValues() throws Exception { + + Response response = objUnderTest.getProcessInstanceVariables(EMPTY_STRING); + + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + + response = objUnderTest.getProcessInstanceVariables(null); + + assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus()); + assertNotNull(response.getEntity()); + + } + + private String getJsonResponse(final Path path) throws IOException { + return new String(Files.readAllBytes(path)); + } + +} diff --git a/so-monitoring/so-monitoring-service/src/test/resources/application-test.yaml b/so-monitoring/so-monitoring-service/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..be39294c66 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/resources/application-test.yaml @@ -0,0 +1,11 @@ +server: + port: 8080 + tomcat: + max-threads: 50 +ssl-enable: false +camunda: + rest: + api: + url: http://localhost:8080/engine-rest/engine/ + engine: default + auth: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/activityInstance.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/activityInstance.json new file mode 100644 index 0000000000..a4f9e5b8d4 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/activityInstance.json @@ -0,0 +1,254 @@ +[ + { + "id": "createVCPE_startEvent:595dae93-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "createVCPE_startEvent", + "activityName": "Start Flow", + "activityType": "startEvent", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:31.815+0000", + "endTime": "2018-08-03T16:00:31.841+0000", + "durationInMillis": 26, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "5961f4bb-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "preProcessRequest_ScriptTask", + "activityName": "PreProcess Incoming Request", + "activityType": "scriptTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:31.842+0000", + "endTime": "2018-08-03T16:00:32.532+0000", + "durationInMillis": 690, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "59cb3e17-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "sendSyncAckResponse_ScriptTask", + "activityName": "Send Sync Ack Response", + "activityType": "scriptTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:32.532+0000", + "endTime": "2018-08-03T16:00:32.588+0000", + "durationInMillis": 56, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "ScriptTask_0cdtchu:59d465e4-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "ScriptTask_0cdtchu", + "activityName": "Prepare\nDecompose\nService\n", + "activityType": "scriptTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:32.592+0000", + "endTime": "2018-08-03T16:00:32.609+0000", + "durationInMillis": 17, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "DecomposeService:59d6fdf8-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "DecomposeService", + "activityName": "Call Decompose Service", + "activityType": "callActivity", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "59d6fdf7-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": "59d99609-9736-11e8-8caf-022ac9304eeb", + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:32.609+0000", + "endTime": "2018-08-03T16:00:34.418+0000", + "durationInMillis": 1809, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "ScriptTask_0lpv2da:5aeb53a2-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "ScriptTask_0lpv2da", + "activityName": "PostProcess\nDecompose\nService\n", + "activityType": "scriptTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:34.420+0000", + "endTime": "2018-08-03T16:00:34.437+0000", + "durationInMillis": 17, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "5aee12d2-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "prepareCreateService_scriptTask", + "activityName": "Prepare\nCreate\nService\n", + "activityType": "scriptTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:34.438+0000", + "endTime": "2018-08-03T16:00:34.454+0000", + "durationInMillis": 16, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "5af083d7-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "doCreateServiceInstance_CallActivity", + "activityName": "Call Create \nServiceInstance\n", + "activityType": "callActivity", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5af083d6-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": "5af12018-9736-11e8-8caf-022ac9304eeb", + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:34.454+0000", + "endTime": "2018-08-03T16:00:40.424+0000", + "durationInMillis": 5970, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "ScriptTask_1qd3uwb:5e7f9de7-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "ScriptTask_1qd3uwb", + "activityName": "Post Process\nCreate\nService\n", + "activityType": "scriptTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:40.425+0000", + "endTime": "2018-08-03T16:00:40.443+0000", + "durationInMillis": 18, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "updateInfraRequest:5e825d0a-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "updateInfraRequest", + "activityName": "Update DB status to SUCCESS", + "activityType": "serviceTask", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:40.443+0000", + "endTime": "2018-08-03T16:00:40.503+0000", + "durationInMillis": 60, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "5e8b84cc-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "IntermediateCatchEvent_1x88t9v", + "activityName": "Await AAI Distribution\n\n", + "activityType": "intermediateTimer", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5e8b84cb-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": null, + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:00:40.505+0000", + "endTime": "2018-08-03T16:01:14.309+0000", + "durationInMillis": 33804, + "canceled": false, + "completeScope": false, + "tenantId": null + }, + { + "id": "Task_14l19kv:72b2d216-9736-11e8-8caf-022ac9304eeb", + "parentActivityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityId": "Task_14l19kv", + "activityName": "Create And Activate Pnf Resource", + "activityType": "callActivity", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "72b2d215-9736-11e8-8caf-022ac9304eeb", + "taskId": null, + "calledProcessInstanceId": "72b4cde7-9736-11e8-8caf-022ac9304eeb", + "calledCaseInstanceId": null, + "assignee": null, + "startTime": "2018-08-03T16:01:14.315+0000", + "endTime": null, + "durationInMillis": null, + "canceled": false, + "completeScope": false, + "tenantId": null + } +]
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processDefinition.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processDefinition.json new file mode 100644 index 0000000000..c4d9c7dcfa --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processDefinition.json @@ -0,0 +1,4 @@ +{ + "id": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "bpmn20Xml": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<bpmn2:definitions xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:bpmn2=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:camunda=\"http://camunda.org/schema/1.0/bpmn\" xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:di=\"http://www.omg.org/spec/DD/20100524/DI\" id=\"_MagIIMOUEeW8asg-vCEgWQ\" targetNamespace=\"http://camunda.org/schema/1.0/bpmn\" exporter=\"Camunda Modeler\" exporterVersion=\"1.6.0\" xsi:schemaLocation=\"http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd\"></bpmn2:definitions>" +}
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstance.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstance.json new file mode 100644 index 0000000000..d9e75e9b11 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstance.json @@ -0,0 +1,59 @@ +[ + { + "id": "dba707b6-8c02-11e8-a6ba-022a5dba5402", + "businessKey": "0a8b32d2-7281-423b-81a1-a44ebf8e489e", + "processDefinitionId": "b76aaeb6-8993-11e8-9f7c-022a5d7b2d2d", + "processDefinitionKey": "CreateGenericALaCarteServiceInstance", + "processDefinitionName": "CreateGenericALaCarteServiceInstance", + "processDefinitionVersion": 5, + "startTime": "2018-07-20T09:54:13.779+0000", + "endTime": "2018-07-20T09:54:15.344+0000", + "durationInMillis": 1565, + "startUserId": null, + "startActivityId": "createSI_startEvent", + "deleteReason": null, + "superProcessInstanceId": null, + "superCaseInstanceId": null, + "caseInstanceId": null, + "tenantId": null, + "state": "COMPLETED" + }, + { + "id": "dbbcd94a-8c02-11e8-a6ba-022a5dba5402", + "businessKey": null, + "processDefinitionId": "DecomposeService:1:78e994ec-7fa7-11e8-816b-022a5d533d2a", + "processDefinitionKey": "DecomposeService", + "processDefinitionName": "DecomposeService", + "processDefinitionVersion": 1, + "startTime": "2018-07-20T09:54:13.921+0000", + "endTime": "2018-07-20T09:54:14.124+0000", + "durationInMillis": 203, + "startUserId": null, + "startActivityId": "createSI_startEvent", + "deleteReason": null, + "superProcessInstanceId": "dba707b6-8c02-11e8-a6ba-022a5dba5402", + "superCaseInstanceId": null, + "caseInstanceId": null, + "tenantId": null, + "state": "COMPLETED" + }, + { + "id": "dbe0404f-8c02-11e8-a6ba-022a5dba5402", + "businessKey": null, + "processDefinitionId": "DoCreateServiceInstance:5:b7750f0d-8993-11e8-9f7c-022a5d7b2d2d", + "processDefinitionKey": "DoCreateServiceInstance", + "processDefinitionName": "DoCreateServiceInstance", + "processDefinitionVersion": 5, + "startTime": "2018-07-20T09:54:14.155+0000", + "endTime": "2018-07-20T09:54:15.169+0000", + "durationInMillis": 1014, + "startUserId": null, + "startActivityId": "createSI_startEvent", + "deleteReason": null, + "superProcessInstanceId": "dba707b6-8c02-11e8-a6ba-022a5dba5402", + "superCaseInstanceId": null, + "caseInstanceId": null, + "tenantId": null, + "state": "COMPLETED" + } +]
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json new file mode 100644 index 0000000000..15c87ea1e9 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/processInstanceVariables.json @@ -0,0 +1,5062 @@ +[ + { + "type": "String", + "value": "PNFSERVICE", + "valueInfo": { + + }, + "id": "59571ece-9736-11e8-8caf-022ac9304eeb", + "name": "serviceType", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Boolean", + "value": false, + "valueInfo": { + + }, + "id": "595745df-9736-11e8-8caf-022ac9304eeb", + "name": "isBaseVfModule", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745e0-9736-11e8-8caf-022ac9304eeb", + "name": "vfModuleId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745e1-9736-11e8-8caf-022ac9304eeb", + "name": "vfModuleType", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Null", + "value": null, + "valueInfo": { + + }, + "id": "595745e2-9736-11e8-8caf-022ac9304eeb", + "name": "recipeParams", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "createInstance", + "valueInfo": { + + }, + "id": "595745e3-9736-11e8-8caf-022ac9304eeb", + "name": "requestAction", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "8383cec3-a39d-4037-aa23-e82891f178a7", + "valueInfo": { + + }, + "id": "595745e4-9736-11e8-8caf-022ac9304eeb", + "name": "mso-business-key", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "55b3f0ea-70c5-4965-9e00-df77ed1552a3", + "valueInfo": { + + }, + "id": "595745e5-9736-11e8-8caf-022ac9304eeb", + "name": "mso-request-id", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745e6-9736-11e8-8caf-022ac9304eeb", + "name": "volumeGroupId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "744fee42-8e20-4152-ad75-17fb1ebfc5b2", + "valueInfo": { + + }, + "id": "595745e7-9736-11e8-8caf-022ac9304eeb", + "name": "serviceInstanceId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745e8-9736-11e8-8caf-022ac9304eeb", + "name": "vnfType", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "55b3f0ea-70c5-4965-9e00-df77ed1552a3", + "valueInfo": { + + }, + "id": "595745e9-9736-11e8-8caf-022ac9304eeb", + "name": "requestId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "so", + "valueInfo": { + + }, + "id": "595745ea-9736-11e8-8caf-022ac9304eeb", + "name": "host", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}", + "valueInfo": { + + }, + "id": "595745eb-9736-11e8-8caf-022ac9304eeb", + "name": "bpmnRequest", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "afr", + "valueInfo": { + + }, + "id": "595745ec-9736-11e8-8caf-022ac9304eeb", + "name": "correlationId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745ed-9736-11e8-8caf-022ac9304eeb", + "name": "networkId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745ee-9736-11e8-8caf-022ac9304eeb", + "name": "vnfId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745ef-9736-11e8-8caf-022ac9304eeb", + "name": "configurationId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595745f0-9736-11e8-8caf-022ac9304eeb", + "name": "networkType", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Integer", + "value": 180, + "valueInfo": { + + }, + "id": "595745f1-9736-11e8-8caf-022ac9304eeb", + "name": "recipeTimeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595745f2-9736-11e8-8caf-022ac9304eeb", + "name": "isAsyncProcess", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/mso/vnfAdapterNotify", + "valueInfo": { + + }, + "id": "595ee714-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_vnfadapter_create_callback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee715-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateResourcesV3", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee716-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoUpdateNetworkInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/networks/rest/v1/networks", + "valueInfo": { + + }, + "id": "595ee717-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_network_rest_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee718-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteViprAtmService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner", + "valueInfo": { + + }, + "id": "595ee719-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_cloud_region_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee71a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DisconnectLayer3Service", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee71b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_updateCinderVolumeV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://com/att/svc/mis/firewall-lite-gui", + "valueInfo": { + + }, + "id": "595ee71c-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sdnc_firewall_yang_model", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "message-router:3904", + "valueInfo": { + + }, + "id": "595ee71d-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_poolMembers", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee71e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateE2EServiceInstanceV3", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee71f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_Layer3ServiceActivateV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee720-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_UpdateNetworkInstanceInfra", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee721-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteNetworkInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee722-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateNetworkInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee723-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoScaleE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595ee724-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_OofAdapter", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "1533303618885", + "valueInfo": { + + }, + "id": "595ee725-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_properties_timestamp", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "6B0E6863FB8EE010AB6F191B3C0489437601E81DC7C86305CB92DB98AFC53D74", + "valueInfo": { + + }, + "id": "595ee726-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_po_auth", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e37-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_vnfAdapterDeleteV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e38-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCompareModelVersions", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT30M", + "valueInfo": { + + }, + "id": "595f0e39-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_oof_timeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "595f0e3a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_default_cloud_owner_id", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e3b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DelServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e3c-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteVFCNSResource", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e3d-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_commonCompletion", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "VIlbtVl6YLhNUrtU", + "valueInfo": { + + }, + "id": "595f0e3e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_key", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/tenants/TenantAdapter", + "valueInfo": { + + }, + "id": "595f0e3f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_tenant_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/network/route-table-references/route-table-reference", + "valueInfo": { + + }, + "id": "595f0e40-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_route_table_reference_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e41-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e42-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_deleteVCEV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/ecomp/mso/catalog", + "valueInfo": { + + }, + "id": "595f0e43-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_catalog_db_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e44-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_ChangeFeatureActivateV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e45-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CustomE2EPutService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e46-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_l3ToHigherLayerAddBonding", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e47-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DHVActivateService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e48-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_deleteGenericVNFV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e49-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_RollbackServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "message-router.onap", + "valueInfo": { + + }, + "id": "595f0e4a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_dmaap_host", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e4b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateViprAtmService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e4c-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_l3ToHigherLayerDeleteBonding", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f0e4d-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CustomE2EGetService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f355e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_ChangeLayer3ServiceActivateV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "APPC-LCM-READ", + "valueInfo": { + + }, + "id": "595f355f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_topic_write", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://org.openecomp.mso", + "valueInfo": { + + }, + "id": "595f3560-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_namespace", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f3561-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateCustomerV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "SDNC-LCM-READ", + "valueInfo": { + + }, + "id": "595f3562-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_topic_sdnc_write", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f3563-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_UpdateCustomE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "360000", + "valueInfo": { + + }, + "id": "595f3564-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_response_timeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/dbadapters/RequestsDbAdapter", + "valueInfo": { + + }, + "id": "595f3565-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_openecomp_db_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/mso/vnfAdapterNotify", + "valueInfo": { + + }, + "id": "595f3566-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_vnfadapter_delete_callback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "20", + "valueInfo": { + + }, + "id": "595f3567-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sdnc_timeout_firewall_minutes", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "1000", + "valueInfo": { + + }, + "id": "595f3568-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_callbackRetrySleepTime", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "30", + "valueInfo": { + + }, + "id": "595f3569-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_callbackRetryAttempts", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f356a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CompleteMsoProcess", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/mso/SDNCAdapterCallbackService", + "valueInfo": { + + }, + "id": "595f356b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_sdncadapter_callback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://sniro-emulator:80/sniro/api/v2/placement", + "valueInfo": { + + }, + "id": "595f356c-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sniro_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "2630606608347B7124C244AB0FE34F6F", + "valueInfo": { + + }, + "id": "595f356d-9736-11e8-8caf-022ac9304eeb", + "name": "URN_aai_auth", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f356e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_createCinderVolumeV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f356f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_GenericPutService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f3570-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateVFCNSResource", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/adapters/rest/v1/sdnc", + "valueInfo": { + + }, + "id": "595f3571-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_sdnc_rest_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f3572-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_RemoveLayer3Service", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f3573-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_GenericDeleteService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "ueb", + "valueInfo": { + + }, + "id": "595f3574-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_service", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/networks/NetworkAdapter", + "valueInfo": { + + }, + "id": "595f3575-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_network_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "test:testpwd", + "valueInfo": { + + }, + "id": "595f3576-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_oof_auth", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c87-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_QueryTenantInfo", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "false", + "valueInfo": { + + }, + "id": "595f5c88-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_use_qualified_host", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c89-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_deleteCinderVolumeV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/search/nodes-query", + "valueInfo": { + + }, + "id": "595f5c8a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_nodes_query_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://org.openecomp.aai.inventory/", + "valueInfo": { + + }, + "id": "595f5c8b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_global_default_aai_namespace", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "SDNC-LCM-WRITE", + "valueInfo": { + + }, + "id": "595f5c8c-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_topic_sdnc_read", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c8d-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://sniro-emulator:80", + "valueInfo": { + + }, + "id": "595f5c8e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_service_agnostic_sniro_host", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c8f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_vnfAdapterQueryV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/network/vpn-bindings/vpn-binding", + "valueInfo": { + + }, + "id": "595f5c90-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_vpn_binding_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c91-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateVfModuleVolumeV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c92-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c93-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_UpdateVfModuleVolume", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c94-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateNetworkV2", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c95-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DecomposeService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c96-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteNetworkInstanceRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c97-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteVfModuleVolume", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c98-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DHVCreateService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "WAN Bonding", + "valueInfo": { + + }, + "id": "595f5c99-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_l3ToHigherLayerAddBonding_model_name", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/search/generic-query", + "valueInfo": { + + }, + "id": "595f5c9a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_generic_query_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c9b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoUpdateE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "21014aa2-526b-11e6-beb8-9e71128cae77", + "valueInfo": { + + }, + "id": "595f5c9c-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_infra_customer_id", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c9d-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteSDNCNetworkResource", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c9e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_sdncAdapter", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5c9f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_asyncQueryAAICustomer", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/sniro/api/v2/placement", + "valueInfo": { + + }, + "id": "595f5ca0-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_service_agnostic_sniro_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5ca1-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_sendAOTSTicket", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f5ca2-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteServiceInstanceInfra", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83b3-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteTenantV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "07a7159d3bf51a0e53be7a8f89699be7", + "valueInfo": { + + }, + "id": "595f83b4-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_msoKey", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83b5-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_GenericGetService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83b6-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteVfModuleVolumeInfraV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "360000", + "valueInfo": { + + }, + "id": "595f83b7-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_topic_read_timeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83b8-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoScaleVFCServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83b9-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateVfModuleVolumeRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/network/generic-vnfs/generic-vnf", + "valueInfo": { + + }, + "id": "595f83ba-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_generic_vnf_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT5S", + "valueInfo": { + + }, + "id": "595f83bb-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_sdnc_replication_delay", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/vnfs/VnfAdapterAsync", + "valueInfo": { + + }, + "id": "595f83bc-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_vnf_async_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83bd-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_rollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT30M", + "valueInfo": { + + }, + "id": "595f83be-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sniro_timeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PORT-MIRROR,PPROBE", + "valueInfo": { + + }, + "id": "595f83bf-9736-11e8-8caf-022ac9304eeb", + "name": "URN_sdnc_si_svc_types", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "2015-05-15", + "valueInfo": { + + }, + "id": "595f83c0-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sdnc_firewall_yang_model_version", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83c1-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteNetworkInstanceInfra", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83c2-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteNetworkInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83c3-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_vnfAdapterCreateV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "11", + "valueInfo": { + + }, + "id": "595f83c4-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_global_default_aai_version", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://oof-has-api:8091/api/oof/v1/placement", + "valueInfo": { + + }, + "id": "595f83c5-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_oof_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83c6-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_VPECreateVfModule", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/DFW/tenants/tenant", + "valueInfo": { + + }, + "id": "595f83c7-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_tenant_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83c8-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateVfModuleVolumeInfraV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT5M", + "valueInfo": { + + }, + "id": "595f83c9-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_po_timeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83ca-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateServiceInstanceInfra", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83cb-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_UpdateNetworkInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "52dbec20-47aa-42e4-936c-331d8e350d44", + "valueInfo": { + + }, + "id": "595f83cc-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_l3ToHigherLayerAddBonding_model_versionid", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "https://aai.onap:8443", + "valueInfo": { + + }, + "id": "595f83cd-9736-11e8-8caf-022ac9304eeb", + "name": "URN_aai_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595f83ce-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateTenantV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/workflows/messages/message", + "valueInfo": { + + }, + "id": "595faadf-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_workflow_message_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT30S", + "valueInfo": { + + }, + "id": "595faae0-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_aai_distribution_delay", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "2.0", + "valueInfo": { + + }, + "id": "595faae1-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_l3ToHigherLayerAddBonding_model_version", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faae2-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_ScaleCustomE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/business/customers/customer", + "valueInfo": { + + }, + "id": "595faae3-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_customer_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/network/vces/vce", + "valueInfo": { + + }, + "id": "595faae4-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_vce_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://oof-has-api:8091", + "valueInfo": { + + }, + "id": "595faae5-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_service_agnostic_oof_host", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/adapters/SDNCAdapter", + "valueInfo": { + + }, + "id": "595faae6-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_sdnc_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "test:testpwd", + "valueInfo": { + + }, + "id": "595faae7-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sniro_auth", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "APPC-LCM-WRITE", + "valueInfo": { + + }, + "id": "595faae8-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_topic_read", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faae9-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoUpdateNetworkInstanceRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaea-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteNetworkV2", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaeb-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCompareModelofE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "3904", + "valueInfo": { + + }, + "id": "595faaec-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_dmaap_port", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaed-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateNetworkInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/api/oof/v1/placement", + "valueInfo": { + + }, + "id": "595faaee-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_service_agnostic_oof_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaef-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_SNIROAdapter", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaf0-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteResourcesV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaf1-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DeleteCustomE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT5M", + "valueInfo": { + + }, + "id": "595faaf2-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sdnc_timeout", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "mso-docker", + "valueInfo": { + + }, + "id": "595faaf3-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_sitename", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/CompleteMsoProcess", + "valueInfo": { + + }, + "id": "595faaf4-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_completemsoprocess_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaf5-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateNetworkInstanceRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/network/network-policies/network-policy", + "valueInfo": { + + }, + "id": "595faaf6-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_network_policy_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaf7-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateCustomE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "6B0E6863FB8EE010AB6F191B3C0489437601E81DC7C86305CB92DB98AFC53D74", + "valueInfo": { + + }, + "id": "595faaf8-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_db_auth", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faaf9-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_Layer3TestAndTurnUpV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faafa-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_QueryAAICustomer", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faafb-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_UpdateNetworkV2", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faafc-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_getLayer3ServiceDetailsV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595faafd-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_UpdateVfModuleVolumeInfraV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd20e-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateNetworkInstanceInfra", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "/aai/v11/network/l3-networks/l3-network", + "valueInfo": { + + }, + "id": "595fd20f-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_default_aai_v11_l3_network_uri", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd210-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateSDNCNetworkResource", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/vnfs/rest/v1/vnfs", + "valueInfo": { + + }, + "id": "595fd211-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_vnf_rest_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "64AG2hF4pYeG2pq7CT6XwUOT", + "valueInfo": { + + }, + "id": "595fd212-9736-11e8-8caf-022ac9304eeb", + "name": "URN_appc_client_secret", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd213-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CompareModelofE2EServiceInstance", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd214-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteVfModuleVolumeV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd215-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoDeleteVfModuleVolumeRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/mso/WorkflowMessage", + "valueInfo": { + + }, + "id": "595fd216-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_message_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd217-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_CreateVfModuleVolume", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "50359538-066f-4a8d-807f-f2bc8eaa79dc", + "valueInfo": { + + }, + "id": "595fd218-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_workflow_l3ToHigherLayerAddBonding_model_invariantid", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd219-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_vnfAdapterRollbackV1", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "http://so:8080/dbadapters/MsoRequestsDbAdapter", + "valueInfo": { + + }, + "id": "595fd21a-9736-11e8-8caf-022ac9304eeb", + "name": "URN_mso_adapters_db_endpoint", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "595fd21b-9736-11e8-8caf-022ac9304eeb", + "name": "URN_log_debug_DoCreateServiceInstanceRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "false", + "valueInfo": { + + }, + "id": "595fd21c-9736-11e8-8caf-022ac9304eeb", + "name": "isDebugLogEnabled", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "CVRCS_", + "valueInfo": { + + }, + "id": "59bb113c-9736-11e8-8caf-022ac9304eeb", + "name": "prefix", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\"requestDetails\":{\"modelInfo\":{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelType\":\"service\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"},\"requestInfo\":{\"productFamilyId\":\"c8d92bf2-2c2e-4802-94e0-3f9e0825cc08\",\"source\":\"UUI\",\"instanceName\":\"AFRPOSTMAN51\",\"suppressRollback\":false,\"requestorId\":\"demo\"},\"subscriberInfo\":{\"globalSubscriberId\":\"Demonstration\"},\"cloudConfiguration\":{\"tenantId\":\"3e001881bcb342418ab5f2788a73255d\",\"lcpCloudRegionId\":\"regionOne_aaa_bbb\"},\"requestParameters\":{\"alaCarte\":false,\"subscriptionServiceType\":\"vCPE\",\"userParams\":[{\"name\":\"Homing_Solution\",\"value\":\"dummy\"}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-Demonstration\"},\"owningEntity\":{\"owningEntityId\":\"c77274d4-4881-493a-ad46-368ea0996eb3\",\"owningEntityName\":\"OE-Demonstration\"}},\"correlationId\":\"afr\"}", + "valueInfo": { + + }, + "id": "59bbfb9e-9736-11e8-8caf-022ac9304eeb", + "name": "createVcpeServiceRequest", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "Demonstration", + "valueInfo": { + + }, + "id": "59bbfba0-9736-11e8-8caf-022ac9304eeb", + "name": "globalSubscriberId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "AFRPOSTMAN51", + "valueInfo": { + + }, + "id": "59bbfba2-9736-11e8-8caf-022ac9304eeb", + "name": "serviceInstanceName", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "55b3f0ea-70c5-4965-9e00-df77ed1552a3", + "valueInfo": { + + }, + "id": "59bbfba4-9736-11e8-8caf-022ac9304eeb", + "name": "msoRequestId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Integer", + "value": 0, + "valueInfo": { + + }, + "id": "59bcbef6-9736-11e8-8caf-022ac9304eeb", + "name": "CVRCS_VnfsCreatedCount", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "c8d92bf2-2c2e-4802-94e0-3f9e0825cc08", + "valueInfo": { + + }, + "id": "59bcbef8-9736-11e8-8caf-022ac9304eeb", + "name": "productFamilyId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "59bcbefa-9736-11e8-8caf-022ac9304eeb", + "name": "brgWanMacAddress", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "59bcbefc-9736-11e8-8caf-022ac9304eeb", + "name": "customerLocation", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "dummy", + "valueInfo": { + + }, + "id": "59bcbefe-9736-11e8-8caf-022ac9304eeb", + "name": "homingService", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "regionOne", + "valueInfo": { + + }, + "id": "59bcbf00-9736-11e8-8caf-022ac9304eeb", + "name": "cloudOwner", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "aaa", + "valueInfo": { + + }, + "id": "59bcbf02-9736-11e8-8caf-022ac9304eeb", + "name": "cloudRegionId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "59bcbf04-9736-11e8-8caf-022ac9304eeb", + "name": "homingModelIds", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "1707", + "valueInfo": { + + }, + "id": "59bcbf06-9736-11e8-8caf-022ac9304eeb", + "name": "sdncVersion", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "PT30S", + "valueInfo": { + + }, + "id": "59bdf788-9736-11e8-8caf-022ac9304eeb", + "name": "aaiDistDelay", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "Basic QlBFTENsaWVudDpwYXNzd29yZDEk", + "valueInfo": { + + }, + "id": "59c34ebf-9736-11e8-8caf-022ac9304eeb", + "name": "BasicAuthHeaderValueDB", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "UUI", + "valueInfo": { + + }, + "id": "59c375d1-9736-11e8-8caf-022ac9304eeb", + "name": "source", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "Demonstration", + "valueInfo": { + + }, + "id": "59c39ce4-9736-11e8-8caf-022ac9304eeb", + "name": "globalCustomerId", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "vCPE", + "valueInfo": { + + }, + "id": "59c39ce6-9736-11e8-8caf-022ac9304eeb", + "name": "subscriptionServiceType", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "false", + "valueInfo": { + + }, + "id": "59c3c3f8-9736-11e8-8caf-022ac9304eeb", + "name": "disableRollback", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\"globalSubscriberId\":\"Demonstration\"}", + "valueInfo": { + + }, + "id": "59c3eb0b-9736-11e8-8caf-022ac9304eeb", + "name": "subscriberInfo", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Object", + "value": { + "Homing_Solution": "dummy" + }, + "valueInfo": { + "objectTypeName": "java.util.LinkedHashMap", + "serializationDataFormat": "application/x-java-serialized-object" + }, + "id": "59ca7ac1-9736-11e8-8caf-022ac9304eeb", + "name": "serviceInputParams", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "<request-info xmlns=\"http://org.openecomp/mso/infra/vnf-request/v1\">\n <request-id>55b3f0ea-70c5-4965-9e00-df77ed1552a3</request-id>\n <action>CREATE</action>\n <source>UUI</source>\n </request-info>", + "valueInfo": { + + }, + "id": "59cb3e15-9736-11e8-8caf-022ac9304eeb", + "name": "CVRCS_requestInfo", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "202", + "valueInfo": { + + }, + "id": "59d1f4d8-9736-11e8-8caf-022ac9304eeb", + "name": "AFRFLOWResponseCode", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\"requestReferences\":{\"instanceId\":\"744fee42-8e20-4152-ad75-17fb1ebfc5b2\",\"requestId\":\"55b3f0ea-70c5-4965-9e00-df77ed1552a3\"}}", + "valueInfo": { + + }, + "id": "59d1f4da-9736-11e8-8caf-022ac9304eeb", + "name": "AFRFLOWResponse", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "Success", + "valueInfo": { + + }, + "id": "59d1f4dc-9736-11e8-8caf-022ac9304eeb", + "name": "AFRFLOWStatus", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\"requestReferences\":{\"instanceId\":\"744fee42-8e20-4152-ad75-17fb1ebfc5b2\",\"requestId\":\"55b3f0ea-70c5-4965-9e00-df77ed1552a3\"}}", + "valueInfo": { + + }, + "id": "59d1f4de-9736-11e8-8caf-022ac9304eeb", + "name": "WorkflowResponse", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "true", + "valueInfo": { + + }, + "id": "59d3c9a0-9736-11e8-8caf-022ac9304eeb", + "name": "AFRFLOWWorkflowResponseSent", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\"modelInvariantUuid\":\"8e2be9fa-fffb-4e23-89a5-65497709f507\",\"modelName\":\"PNFSERVICE\",\"modelVersion\":\"1.0\",\"modelType\":\"service\",\"modelUuid\":\"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\"}", + "valueInfo": { + + }, + "id": "59d6d6e5-9736-11e8-8caf-022ac9304eeb", + "name": "serviceModelInfo", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Object", + "value": null, + "valueInfo": null, + "id": "5aea904b-9736-11e8-8caf-022ac9304eeb", + "name": "serviceDecomposition", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": "Cannot deserialize object in variable 'serviceDecomposition': ENGINE-09017 Cannot load class 'org.openecomp.mso.bpmn.core.domain.ServiceDecomposition': org.openecomp.mso.bpmn.core.domain.ServiceDecomposition from [Module \"deployment.camunda-rest-api-1.2.0-SNAPSHOT.war:main\" from Service Module Loader]", + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Null", + "value": null, + "valueInfo": { + + }, + "id": "5aea904f-9736-11e8-8caf-022ac9304eeb", + "name": "WorkflowException", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Object", + "value": [], + "valueInfo": { + "objectTypeName": "java.util.ArrayList", + "serializationDataFormat": "application/x-java-serialized-object" + }, + "id": "5aedc4a4-9736-11e8-8caf-022ac9304eeb", + "name": "vnfList", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "[]", + "valueInfo": { + + }, + "id": "5aedc4a8-9736-11e8-8caf-022ac9304eeb", + "name": "vnfListString", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Integer", + "value": 0, + "valueInfo": { + + }, + "id": "5aedebba-9736-11e8-8caf-022ac9304eeb", + "name": "CVRCS_VNFsCount", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "5aedebbc-9736-11e8-8caf-022ac9304eeb", + "name": "vnfModelInfo", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "", + "valueInfo": { + + }, + "id": "5aedebbe-9736-11e8-8caf-022ac9304eeb", + "name": "vnfModelInfoString", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "{\n \"serviceInstance\" : {\n \"instanceId\" : \"744fee42-8e20-4152-ad75-17fb1ebfc5b2\"\n },\n \"serviceNetworks\" : [ ],\n \"serviceVnfs\" : [ ],\n \"serviceAllottedResources\" : [ ],\n \"modelInfo\" : {\n \"modelName\" : \"PNFSERVIVE\",\n \"modelUuid\" : \"4f7afc34-e475-41ca-be73-40f9a0f7ffa4\",\n \"modelInvariantUuid\" : \"8e2be9fa-fffb-4e23-89a5-65497709f507\",\n \"modelVersion\" : \"1.0\",\n \"modelCustomizationUuid\" : \"\",\n \"modelCustomizationName\" : \"\",\n \"modelInstanceName\" : \"\",\n \"modelType\" : \"\"\n },\n \"serviceType\" : \"aaa\",\n \"serviceRole\" : \"aaa\",\n \"vnfResource\" : [ ],\n \"networkResource\" : [ ],\n \"allottedResource\" : [ ]\n}", + "valueInfo": { + + }, + "id": "5af083d4-9736-11e8-8caf-022ac9304eeb", + "name": "serviceDecompositionString", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Null", + "value": null, + "valueInfo": { + + }, + "id": "5e7eb37e-9736-11e8-8caf-022ac9304eeb", + "name": "rolledBack", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + }, + { + "type": "Object", + "value": null, + "valueInfo": null, + "id": "5e7eda91-9736-11e8-8caf-022ac9304eeb", + "name": "DCRESI_rollbackData", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": "Cannot deserialize object in variable 'DCRESI_rollbackData': ENGINE-09017 Cannot load class 'org.openecomp.mso.bpmn.core.RollbackData': org.openecomp.mso.bpmn.core.RollbackData from [Module \"deployment.camunda-rest-api-1.2.0-SNAPSHOT.war:main\" from Service Module Loader]", + "tenantId": null, + "state": "CREATED" + }, + { + "type": "String", + "value": "\n <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:req=\"http://org.openecomp.mso/requestsdb\">\n <soapenv:Header/>\n <soapenv:Body>\n <req:updateInfraRequest>\n <requestId>55b3f0ea-70c5-4965-9e00-df77ed1552a3</requestId>\n <lastModifiedBy>BPEL</lastModifiedBy>\n <serviceInstanceId>744fee42-8e20-4152-ad75-17fb1ebfc5b2</serviceInstanceId>\n <serviceInstanceName>AFRPOSTMAN51</serviceInstanceName>\n </req:updateInfraRequest>\n </soapenv:Body>\n </soapenv:Envelope>\n ", + "valueInfo": { + + }, + "id": "5e825d08-9736-11e8-8caf-022ac9304eeb", + "name": "CVRCS_setUpdateDbInstancePayload", + "processDefinitionKey": "AFRFLOW", + "processDefinitionId": "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb", + "processInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "executionId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "activityInstanceId": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "caseDefinitionKey": null, + "caseDefinitionId": null, + "caseInstanceId": null, + "caseExecutionId": null, + "taskId": null, + "errorMessage": null, + "tenantId": null, + "state": "CREATED" + } +]
\ No newline at end of file diff --git a/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/singleprocessInstance.json b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/singleprocessInstance.json new file mode 100644 index 0000000000..d1e70e1957 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/test/resources/camundaResponses/singleprocessInstance.json @@ -0,0 +1,19 @@ +{ + "id": "5956a99d-9736-11e8-8caf-022ac9304eeb", + "businessKey": "203b9171-c113-435e-aaa6-f47cb836e3cb", + "processDefinitionId": "EricssonNetworkSliceV1:3:28f9e0fc-9b00-11e8-a57a-022ac90273ed", + "processDefinitionKey": "EricssonNetworkSliceV1", + "processDefinitionName": "EricssonNetworkSliceV1", + "processDefinitionVersion": 3, + "startTime": "2018-08-14T09:52:46.105+0000", + "endTime": "2018-08-14T09:53:50.499+0000", + "durationInMillis": 64394, + "startUserId": null, + "startActivityId": "createVCPE_startEvent", + "deleteReason": null, + "superProcessInstanceId": null, + "superCaseInstanceId": null, + "caseInstanceId": null, + "tenantId": null, + "state": "COMPLETED" +}
\ No newline at end of file |