diff options
310 files changed, 17784 insertions, 2245 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/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-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 8dee54701d..a7976840b7 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 @@ -31,7 +31,6 @@ import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import org.onap.so.entity.MsoRequest; -import org.onap.so.logger.MsoLogger; import org.onap.so.openstack.beans.Subnet; import com.fasterxml.jackson.annotation.JsonIgnore; 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 index 823c807c8a..efe6010f23 100644 --- 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 @@ -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.catalogdb; @@ -19,4 +39,4 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor); } -}
\ No newline at end of file +} 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 687b2f65ef..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 @@ -115,7 +115,7 @@ public class CatalogDBRestTest { ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + 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)); @@ -789,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)); @@ -798,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 fb104fcab3..db25f5c721 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -218,10 +218,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> <groupId>janino</groupId> <artifactId>janino</artifactId> <version>2.5.15</version> 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 6398d413d0..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; 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 de8aedcc47..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; } 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 c8df1fdac2..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 @@ -21,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; @@ -104,7 +104,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { @Autowired private MsoCommonUtils commonUtils; - @Autowired + @Autowired private NetworkResourceCustomizationRepository networkCustomRepo; @Autowired @@ -259,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 " @@ -766,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 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/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/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/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index 1cf65cb6fc..459ff2aeba 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.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 @@ -82,6 +84,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters"; private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq"; + private static final String CLOUDIFY_RESPONSE_SUCCESS="Successfully received response from Cloudify"; + private static final String CLOUDIFY="Cloudify"; + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); @Autowired @@ -210,7 +215,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { try { deployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vnfName); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Cloudify", "Cloudify", "QueryDeployment", vnfName); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "QueryDeployment", vnfName); } catch (MsoCloudifyManagerNotFound e) { // This site does not have a Cloudify Manager. @@ -222,8 +227,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Convert to a generic VnfException me.addContext ("QueryVNF"); String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "QueryDeployment", vnfName); - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "Cloudify", "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment", me); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment", vnfName); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, CLOUDIFY, "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment", me); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } @@ -318,14 +323,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object and use that. deployment = cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantName, vfModuleId, 5); LOGGER.debug("Rolled back deployment: " + deployment.getId()); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Cloudify", "Cloudify", "DeleteDeployment", null); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "DeleteDeployment", null); } catch (MsoException me) { // Failed to rollback the VNF due to a cloudify exception. // Convert to a generic VnfException me.addContext ("RollbackVNF"); String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me; - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "DeleteDeployment", null); - LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "Cloudify", "DeleteDeployment", MsoLogger.ErrorCode.DataError, "Exception - DeleteDeployment", me); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "DeleteDeployment", null); + LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, CLOUDIFY, "DeleteDeployment", MsoLogger.ErrorCode.DataError, "Exception - DeleteDeployment", me); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } @@ -579,7 +584,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { LOGGER.debug("Missing required input: modelCustomizationUuid"); String error = "Create vfModule error: Missing required input: modelCustomizationUuid"; LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, - "VF Module ModelCustomizationUuid", "null", "Cloudify", "", MsoLogger.ErrorCode.DataError, "Create VF Module: Missing required input: modelCustomizationUuid"); + "VF Module ModelCustomizationUuid", "null", CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Create VF Module: Missing required input: modelCustomizationUuid"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error); throw new VnfException(error, MsoExceptionCategory.USERDATA); } @@ -687,13 +692,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long subStartTime1 = System.currentTimeMillis (); try { cloudifyDeployment = cloudifyUtils.queryDeployment (cloudSiteId, tenantId, vfModuleName); - LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Cloudify", "Cloudify", "QueryDeployment", vfModuleName); + LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "QueryDeployment", vfModuleName); } catch (MsoException me) { // Failed to query the Deployment due to a cloudify exception. String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "Cloudify", "queryDeployment", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment", me); - LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "QueryDeployment", vfModuleName); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment", me); + LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment", vfModuleName); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); // Convert to a generic VnfException @@ -711,7 +716,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // fail - it exists if (failIfExists != null && failIfExists) { String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; - LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "Cloudify", "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists"); + LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); } else { @@ -728,28 +733,28 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (status == DeploymentStatus.INSTALLING || status == DeploymentStatus.UNINSTALLING) { // fail - it's in progress - return meaningful error String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "Cloudify", "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists"); + LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); } else if (status == DeploymentStatus.FAILED) { // fail - it exists and is in a FAILED state String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "Cloudify", "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in FAILED state"); + LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in FAILED state"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); } else if (status == DeploymentStatus.UNKNOWN || status == DeploymentStatus.CREATED) { // fail - it exists and is in a UNKNOWN state String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "Cloudify", "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in " + status.toString() + " state"); + LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in " + status.toString() + " state"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); } else { // Unexpected, since all known status values have been tested for String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "Cloudify", "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in an unknown state"); + LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in an unknown state"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); } @@ -766,13 +771,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { DeploymentInfo volumeDeployment = null; try { volumeDeployment = cloudifyUtils.queryDeployment (cloudSiteId, tenantId, volumeGroupId); - LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from Cloudify", "Cloudify", "QueryDeployment", volumeGroupId); + LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from Cloudify", CLOUDIFY, "QueryDeployment", volumeGroupId); } catch (MsoException me) { // Failed to query the Volume GroupDeployment due to a cloudify exception. String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, "Cloudify", "queryDeployment(volume)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(volume)", me); - LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "QueryDeployment(volume)", volumeGroupId); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(volume)", me); + LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment(volume)", volumeGroupId); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); // Convert to a generic VnfException @@ -782,7 +787,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) { String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, "Cloudify", "queryDeployment(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST"); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); LOGGER.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -814,13 +819,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { DeploymentInfo baseDeployment = null; try { baseDeployment = cloudifyUtils.queryDeployment (cloudSiteId, tenantId, baseVfModuleId); - LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from Cloudify", "Cloudify", "QueryDeployment(Base)", baseVfModuleId); + LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from Cloudify", CLOUDIFY, "QueryDeployment(Base)", baseVfModuleId); } catch (MsoException me) { // Failed to query the Volume GroupDeployment due to a cloudify exception. String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, "Cloudify", "queryDeployment(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(Base)", me); - LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "QueryDeployment(Base)", baseVfModuleId); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(Base)", me); + LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment(Base)", baseVfModuleId); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); // Convert to a generic VnfException @@ -830,7 +835,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) { String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, "Cloudify", "queryDeployment(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST"); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error); LOGGER.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -1012,7 +1017,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (checkRequiredParameters) { // Problem - missing one or more required parameters String error = "Create VFModule: Missing Required inputs: " + missingParams; - LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, "Cloudify", "", MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs"); + LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error); throw new VnfException (error, MsoExceptionCategory.USERDATA); } else { @@ -1072,7 +1077,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { catch (MsoException me) { me.addContext ("CreateVFModule"); String error = "Create VF Module: Upload blueprint failed. Blueprint=" + blueprintName + ": " + me; - LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "Cloudify", "", MsoLogger.ErrorCode.DataError, "MsoException - uploadBlueprint", me); + LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "MsoException - uploadBlueprint", me); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); @@ -1100,24 +1105,24 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { heatTemplate.getTimeoutMinutes (), backout.booleanValue()); - LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from Cloudify", "Cloudify", "CreateDeployment", vfModuleName); + LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "CreateDeployment", vfModuleName); } catch (MsoException me) { me.addContext ("CreateVFModule"); String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; - LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "CreateDeployment", vfModuleName); - LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "Cloudify", "", MsoLogger.ErrorCode.DataError, "MsoException - createDeployment", me); + LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "CreateDeployment", vfModuleName); + LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "MsoException - createDeployment", me); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } catch (NullPointerException npe) { String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; - LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "CreateDeployment", vfModuleName); - LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "Cloudify", "", MsoLogger.ErrorCode.DataError, "NullPointerException - createDeployment", npe); + LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "CreateDeployment", vfModuleName); + LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "NullPointerException - createDeployment", npe); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); LOGGER.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment"); //npe.addContext ("CreateVNF"); throw new VnfException ("NullPointerException during cloudify.createAndInstallDeployment"); } catch (Exception e) { - LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating deployment with Cloudify", "Cloudify", "CreateDeployment", vfModuleName); + LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating deployment with Cloudify", CLOUDIFY, "CreateDeployment", vfModuleName); LOGGER.debug("unhandled exception at cloudify.createAndInstallDeployment"); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating deployment with Cloudify"); throw new VnfException("Exception during cloudify.createAndInstallDeployment! " + e.getMessage()); @@ -1162,8 +1167,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the deployment. Convert to a generic VnfException me.addContext ("DeleteVFModule"); String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "Cloudify", "QueryDeployment", null); - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "Cloudify", "QueryDeployment", MsoLogger.ErrorCode.DataError, "Exception - QueryDeployment", me); + LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment", null); + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, CLOUDIFY, "QueryDeployment", MsoLogger.ErrorCode.DataError, "Exception - QueryDeployment", me); LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error); throw new VnfException (me); } @@ -1177,7 +1182,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { long subStartTime = System.currentTimeMillis (); try { cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantId, vnfName, 5); - LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from DeleteDeployment", "Cloudify", "DeleteDeployment", vnfName); + LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from DeleteDeployment", CLOUDIFY, "DeleteDeployment", vnfName); } catch (MsoException me) { me.addContext ("DeleteVfModule"); // Convert to a generic VnfException diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VfRollback.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VfRollback.java index 5dca8696ef..3736669094 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VfRollback.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VfRollback.java @@ -95,11 +95,6 @@ public class VfRollback { public void setRequestType(String requestType) { this.requestType = requestType; } - /* - private String volumeGroupHeatStackId; - private String baseGroupHeatStackId; - private boolean isBase = false; - */ public String getVolumeGroupHeatStackId() { return this.volumeGroupHeatStackId; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 143f169c84..7f3bad5b8e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.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 @@ -82,6 +84,7 @@ import io.swagger.annotations.ApiResponses; public class VnfAdapterRestV2 { private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; + private static final String RESP=", resp="; @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @@ -219,7 +222,7 @@ public class VnfAdapterRestV2 { 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()); } } @@ -467,7 +470,7 @@ public class VnfAdapterRestV2 { 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()); } } @@ -585,7 +588,7 @@ public class VnfAdapterRestV2 { 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()); } } /* @@ -698,7 +701,7 @@ public class VnfAdapterRestV2 { 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()); } } } 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/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index 3f3a312e12..a1ff139707 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.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 @@ -83,6 +85,9 @@ import io.swagger.annotations.ApiResponses; public class VolumeAdapterRestV2 { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, VolumeAdapterRestV2.class); private static final String TESTING_KEYWORD = "___TESTING___"; + private static final String RESP=", resp="; + private static final String EXCEPTION="Exception :"; + private static final String VOLUME_GROUPID_MISSING="VolumeGroupId in URL does not match content"; @Autowired private VnfAdapterRestUtils vnfAdapterRestUtils; @@ -219,7 +224,7 @@ public class VolumeAdapterRestV2 { rb, req.getMessageId()); } catch (VnfException e) { - LOGGER.debug("Exception :",e); + LOGGER.debug(EXCEPTION,e); eresp = new VolumeGroupExceptionResponse( e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); } @@ -228,7 +233,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -257,7 +262,7 @@ public class VolumeAdapterRestV2 { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_MISSING) .build(); } DeleteVNFVolumesTask task = new DeleteVNFVolumesTask(req, mode); @@ -323,7 +328,7 @@ public class VolumeAdapterRestV2 { } 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()) { @@ -331,7 +336,7 @@ public class VolumeAdapterRestV2 { 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()); } } @@ -358,7 +363,7 @@ public class VolumeAdapterRestV2 { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_MISSING) .build(); } RollbackVNFVolumesTask task = new RollbackVNFVolumesTask(req); @@ -424,7 +429,7 @@ public class VolumeAdapterRestV2 { 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()) { @@ -432,7 +437,7 @@ public class VolumeAdapterRestV2 { BpelRestClient bpelClient = bpelRestClientProvider.get(); bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); } - LOGGER.debug("RollbackVNFVolumesTask exit: code=" + getStatusCode() + ", resp="+ getResponse()); + LOGGER.debug("RollbackVNFVolumesTask exit: code=" + getStatusCode() + RESP+ getResponse()); } } @@ -462,7 +467,7 @@ public class VolumeAdapterRestV2 { return Response .status(HttpStatus.SC_BAD_REQUEST) .type(MediaType.TEXT_PLAIN) - .entity("VolumeGroupId in URL does not match content") + .entity(VOLUME_GROUPID_MISSING) .build(); } UpdateVNFVolumesTask task = new UpdateVNFVolumesTask(req, mode); @@ -550,7 +555,7 @@ public class VolumeAdapterRestV2 { 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()) { @@ -558,7 +563,7 @@ public class VolumeAdapterRestV2 { 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/main/java/org/onap/so/adapters/vnf/async/client/CreateVnfNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/CreateVnfNotification.java index 39bd3ebf61..ba301b10fe 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/CreateVnfNotification.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/CreateVnfNotification.java @@ -319,7 +319,7 @@ public class CreateVnfNotification { */ public List<CreateVnfNotification.Outputs.Entry> getEntry() { if (entry == null) { - entry = new ArrayList<CreateVnfNotification.Outputs.Entry>(); + entry = new ArrayList<>(); } return this.entry; } 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 955a4d81fa..9dff66b00d 100644 --- a/adapters/mso-requests-db-adapter/pom.xml +++ b/adapters/mso-requests-db-adapter/pom.xml @@ -67,6 +67,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.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <optional>true</optional> @@ -106,6 +111,10 @@ <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> @@ -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/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 92a9df1071..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 @@ -300,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/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java index 69cf6ccb3d..e932bb2cca 100644 --- 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 @@ -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.application; @@ -19,4 +39,4 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor); } -}
\ No newline at end of file +} 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 ade3daada3..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,6 +12,10 @@ 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 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 11f8ff0c36..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; @@ -247,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 4e00ced841..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 @@ -72,7 +72,7 @@ public class HealthCheckHandlerTest { ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + 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)); 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 9ac0cce841..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 @@ -376,7 +376,7 @@ public class MSORequestDBImplTest { ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + 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)); @@ -499,7 +499,7 @@ public class MSORequestDBImplTest { ){ Map<String,String> mdc = logEvent.getMDCPropertyMap(); assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID)); - assertNotNull(mdc.get(MsoLogger.REQUEST_ID)); + 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)); @@ -517,4 +517,4 @@ public class MSORequestDBImplTest { } -}
\ No newline at end of file +} 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 165b6675dc..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 @@ -39,6 +39,14 @@ spring: 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-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 766a48a3c4..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 @@ -48,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; 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 515f1980d4..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 @@ -22,9 +22,6 @@ package org.onap.so.adapters.sdnc.impl; - - -import org.onap.so.logger.MsoLogger; public class RequestTunables { 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-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/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 b560690e30..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 @@ -54,6 +54,7 @@ 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 ; @@ -80,7 +81,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.createNs(nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -106,7 +107,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -131,7 +132,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -156,7 +157,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -181,7 +182,7 @@ public class VfcAdapterRest { RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId); return buildResponse(rsp); } catch(ApplicationException e) { - LOGGER.debug("ApplicationException: ", e); + LOGGER.debug(APPLICATION_EXCEPTION, e); return e.buildErrorResponse(); } } @@ -207,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/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..83714ed022 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -15,7 +15,6 @@ <properties> <camunda.version>7.8.0</camunda.version> <httpclient.version>4.5.5</httpclient.version> - <jackson.version>1.1.1</jackson.version> <maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.source>1.8</maven.compiler.source> </properties> @@ -134,6 +133,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 +227,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 +253,7 @@ </dependency> <dependency> <groupId>org.onap.so</groupId> - <artifactId>mso-requests-db</artifactId> + <artifactId>mso-requests-db</artifactId> <version>${project.version}</version> </dependency> <dependency> @@ -304,10 +311,6 @@ </dependency> <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-base</artifactId> - </dependency> - <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> </dependency> 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..deb2985443 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 @@ -15,6 +15,7 @@ * 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========================================================= */ @@ -55,9 +56,9 @@ import com.google.gson.reflect.TypeToken; public class ResourceRequestBuilder { - public static String CUSTOMIZATION_UUID = "customizationUUID"; + private static String CUSTOMIZATION_UUID = "customizationUUID"; - public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid="; + private static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar"; private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class); @@ -184,7 +185,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/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/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/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 79cb33b7c4..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,12 +20,18 @@ 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.bpmn.core.WorkflowException; @@ -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/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/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/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/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/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/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/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/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/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java index edf131d538..b22b90b0b4 100644 --- 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 @@ -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-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/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..17dbe50cc5 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 * @@ -20,7 +20,6 @@ package org.onap.so.bpmn.infrastructure.scripts -import org.codehaus.jackson.map.ObjectMapper import org.onap.so.bpmn.infrastructure.properties.BPMNProperties import java.util.ArrayList 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/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-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/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java index 6fcad95144..03559afb33 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java @@ -27,6 +27,9 @@ public class Resource { private boolean generated; private boolean baseVfModule; private String virtualLinkKey; + private String vnfCustomizationId; + private String vfModuleCustomizationId; + private String cvnfModuleCustomizationId; public Resource(WorkflowType resourceType, String resourceId, boolean generated){ this.resourceId = resourceId; @@ -64,4 +67,22 @@ public class Resource { public void setVirtualLinkKey(String virtualLinkKey) { this.virtualLinkKey = virtualLinkKey; } + public String getVnfCustomizationId() { + return vnfCustomizationId; + } + public void setVnfCustomizationId(String vnfCustomizationId) { + this.vnfCustomizationId = vnfCustomizationId; + } + public String getVfModuleCustomizationId() { + return vfModuleCustomizationId; + } + public void setVfModuleCustomizationId(String vfModuleCustomizationId) { + this.vfModuleCustomizationId = vfModuleCustomizationId; + } + public String getCvnfModuleCustomizationId() { + return cvnfModuleCustomizationId; + } + public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) { + this.cvnfModuleCustomizationId = cvnfModuleCustomizationId; + } } 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..5809d16492 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,27 @@ 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.ConfigurationResourceKeys; 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 +110,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 +134,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); @@ -160,9 +168,10 @@ public class WorkflowAction { } else { key = modelInfo.getModelCustomizationId(); } + Resource resourceKey = new Resource(resourceType, key, aLaCarte); for (OrchestrationFlow orchFlow : orchFlows) { - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null); + ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false); flowsToExecute.add(ebb); } } else { @@ -212,7 +221,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 +240,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 +277,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 +287,7 @@ public class WorkflowAction { if(resource.isBaseVfModule()){ Collections.swap(vfModuleResources, 0, count); break; - } + } count++; } return vfModuleResources; @@ -294,7 +303,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 +326,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 +346,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 +400,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 +429,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 +495,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 +520,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 +534,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 +560,18 @@ 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){ + Resource configResource = new Resource(WorkflowType.CONFIGURATION,config,false); + resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId()); + resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId()); + resourceCounter.add(configResource); + } + } } if(!foundVfModuleOrVG){ buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); @@ -556,6 +600,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 +727,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."); } @@ -763,69 +825,73 @@ public class WorkflowAction { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()).collect(Collectors.toList()).size(); i++) { workflowResourceIds.setServiceInstanceId(resourceId); flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + .collect(Collectors.toList()).get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } } else if (orchFlow.getFlowName().contains(VNF)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + .collect(Collectors.toList()).get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } } else if (orchFlow.getFlowName().contains(NETWORK) && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + .collect(Collectors.toList()).get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) { Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()) .collect(Collectors.toList()).get(i); - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource.getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey())); + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false)); } } else if (orchFlow.getFlowName().contains(VFMODULE)) { List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType()) .collect(Collectors.toList())); for (int i = 0; i < vfModuleResourcesSorted.size(); i++) { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + .collect(Collectors.toList()).get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + .collect(Collectors.toList()).get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } } else if (orchFlow.getFlowName().contains(CONFIGURATION)) { for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) { flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()) - .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + .collect(Collectors.toList()).get(i), apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true)); } - } else { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId, - requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null)); + }else { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, + requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false)); } } return flowsToExecute; } - protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key, + protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, - WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey) { + WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) { ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); BuildingBlock buildingBlock = new BuildingBlock(); buildingBlock.setBpmnFlowName(orchFlow.getFlowName()); buildingBlock.setMsoId(UUID.randomUUID().toString()); - buildingBlock.setKey(key); + if(resource == null){ + buildingBlock.setKey(""); + }else{ + buildingBlock.setKey(resource.getResourceId()); + } buildingBlock.setIsVirtualLink(isVirtualLink); buildingBlock.setVirtualLinkKey(virtualLinkKey); executeBuildingBlock.setApiVersion(apiVersion); @@ -837,6 +903,13 @@ public class WorkflowAction { executeBuildingBlock.setRequestId(requestId); executeBuildingBlock.setBuildingBlock(buildingBlock); executeBuildingBlock.setRequestDetails(requestDetails); + if(isConfiguration){ + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId()); + configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId()); + configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId()); + executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys); + } return executeBuildingBlock; } @@ -852,24 +925,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..e13a765cf2 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 @@ -148,6 +148,18 @@ public class AAIConfigurationResources { AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId); injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI); } + + public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){ + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId); + injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI); + } + + public void connectConfigurationToVnfc(String configurationId, String vnfcName){ + AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId); + AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + injectionHelper.getAaiClient().connect(configurationURI, vnfcURI); + } /** * method to delete Configuration details in A&AI * @@ -157,6 +169,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 +188,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 675e8a1d95..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 @@ -663,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/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/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java index cc48c46508..3dc9a4da63 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 @@ -43,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; @@ -63,6 +64,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{ private ServiceInstance serviceInstance; private GenericVnf genericVnf; private VpnBinding vpnBinding; + private VfModule vfModule; @Mock protected AAIResourcesClient MOCK_aaiResourcesClient; @@ -82,6 +84,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{ serviceProxy = buildServiceProxy(); serviceInstance = buildServiceInstance(); genericVnf = buildGenericVnf(); + vfModule = buildVfModule(); vpnBinding = buildVpnBinding(); doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); } @@ -126,6 +129,20 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{ aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(), genericVnf.getVnfId()); verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); } + + @Test + public void connectConfigurationToVfModuleTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToVfModule(configuration.getConfigurationId(), vfModule.getVfModuleId(),genericVnf.getVnfId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToVnfcTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToVnfc(configuration.getConfigurationId(), "vnfcName"); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } @Test public void connectConfigurationToVpnBindingTest() { @@ -177,4 +194,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 6214cc5ef6..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 @@ -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/common/pom.xml b/common/pom.xml index d3f460e563..285cd5613d 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,21 +20,6 @@ <version>3.1.0</version> </dependency> <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>2.8.7</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - <version>2.8.7</version> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.module</groupId> - <artifactId>jackson-module-jaxb-annotations</artifactId> - <version>2.4.0</version> - </dependency> - <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>3.1.2.RELEASE</version> @@ -55,7 +40,6 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> - <version>4.3.6.Final</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> @@ -78,9 +62,6 @@ <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> 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 007c666ac2..631850a01f 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -71,7 +71,7 @@ public abstract class RestClient { protected Optional<URI> path; protected String accept; protected String contentType; - protected String requestId; + protected String requestId = ""; protected JaxRsClientLogging jaxRsClientLogging; protected RestProperties props; 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/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/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java index 8731ae719a..9b5acc5bee 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java @@ -27,7 +27,9 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.graphinventory.Format; +import org.onap.so.client.graphinventory.GraphInventoryObjectType; import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; import org.onap.so.client.graphinventory.entities.uri.SimpleUri; public class AAISimpleUri extends SimpleUri implements AAIResourceUri { @@ -51,6 +53,9 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri { protected AAISimpleUri(AAIObjectPlurals type, Object... values) { super(type, values); } + protected AAISimpleUri(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) { + super(parentUri, childType, childValues); + } @Override public AAISimpleUri relationshipAPI() { diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java index 192b593603..1f819ca5de 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java @@ -24,7 +24,6 @@ import java.net.URI; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.graphinventory.entities.uri.SimpleUri; public class AAIUriFactory { @@ -56,6 +55,11 @@ public class AAIUriFactory { } + public static AAIResourceUri createNodesUri(AAIObjectPlurals type) { + return new NodesUri(type); + + } + /** * This method should only be used to wrap a URI retrieved from A&AI contained within an object response * @@ -67,6 +71,20 @@ public class AAIUriFactory { return new AAISimpleUri(type, uri); } + + /** + * creates an AAIResourceUri from a parentUri + * + * @param parentUri + * @param childType + * @param childValues + * @return + */ + public static AAIResourceUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType, Object... childValues) { + + return new AAISimpleUri(parentUri, childType, childValues); + } + /** * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers * diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java index e063bf8935..091d0c9e97 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java @@ -38,8 +38,8 @@ public class AllottedResourceLookupUri extends HttpLookupUri { } @Override - public ServiceInstanceUri clone() { - return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values); + public AllottedResourceLookupUri clone() { + return new AllottedResourceLookupUri(this.internalURI.clone(), this.getCachedValue(), values); } public AAIResourcesClient getResourcesClient() { diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java index ccae0b44b7..3c9ca0ed7f 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java @@ -20,6 +20,9 @@ package org.onap.so.client.aai.entities.uri; +import javax.ws.rs.core.UriBuilder; + +import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals; import org.onap.so.client.graphinventory.GraphInventoryObjectType; @@ -30,14 +33,18 @@ public class NodesUri extends AAISimpleUri { super(type, values); } + protected NodesUri(AAIObjectPlurals type) { + super(type); + } + @Override protected String getTemplate(GraphInventoryObjectType type) { - return "/nodes" + type.partialUri(); + return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); } @Override protected String getTemplate(GraphInventoryObjectPlurals type) { - return "/nodes" + type.partialUri(); + return UriBuilder.fromUri("/nodes").path(type.partialUri()).toTemplate(); } } 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/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java index 975fa318e8..026f1c3929 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java @@ -82,6 +82,12 @@ public class SimpleUri implements GraphInventoryResourceUri { this.internalURI = UriBuilder.fromPath(this.getTemplate(type)); this.values = values; } + protected SimpleUri(GraphInventoryResourceUri parentUri, GraphInventoryObjectType childType, Object... childValues) { + this.type = childType; + this.pluralType = null; + this.internalURI = UriBuilder.fromUri(parentUri.build()).path(childType.partialUri()); + this.values = childValues; + } @Override public SimpleUri relationshipAPI() { 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 index c4be075cf0..f49cd8d8f8 100644 --- a/common/src/main/java/org/onap/so/exceptions/MSOException.java +++ b/common/src/main/java/org/onap/so/exceptions/MSOException.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.exceptions; 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 1ed18eae0f..794d02a240 100644 --- a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java +++ b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.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/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java index 3ef01f5216..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; @@ -291,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/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java index efc0aa84ef..f0a16561aa 100644 --- 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 @@ -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.logging.jaxrs.filter; import java.net.InetAddress; @@ -87,4 +107,4 @@ public class MDCSetup { } MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode); } -}
\ No newline at end of file +} 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 index 755d18b5ee..194a445ce2 100644 --- 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 @@ -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.logging.spring.interceptor; import java.util.Collections; @@ -96,4 +116,4 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter { } -}
\ No newline at end of file +} 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/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/aai/entities/uri/AAISimpleUriFromParentUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java new file mode 100644 index 0000000000..beb18a389c --- /dev/null +++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java @@ -0,0 +1,41 @@ +/*- + * ============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========================================================= + */ + +package org.onap.so.client.aai.entities.uri; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.client.aai.AAIObjectType; + +public class AAISimpleUriFromParentUriTest { + + + @Test + public void appendChildren() { + + AAIResourceUri parentUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3"); + + AAIUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4"); + + assertEquals("path appended", "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4", uri.build().toString()); + + } +} diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java new file mode 100644 index 0000000000..71ec49789e --- /dev/null +++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java @@ -0,0 +1,52 @@ +/*- + * ============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.aai.entities.uri; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import javax.ws.rs.core.UriBuilder; + +import org.junit.Test; +import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException; +import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException; + +public class AllottedResourceLookupUriTest { + + @Test + public void oneKey() throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException { + + AllottedResourceLookupUri instance = new AllottedResourceLookupUri("key1"); + AllottedResourceLookupUri spy = spy(instance); + doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4").when(spy).getObjectById(any(Object.class)); + + final URI result = spy.build(); + final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4").build(); + assertEquals("result is equal", expected, result); + + } +} 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/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 index 52d26fb09a..08499cfd22 100644 --- 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 @@ -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.logging.cxf.interceptor; 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 index 1ddf268ea8..ed4ba76268 100644 --- 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 @@ -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.logging.cxf.interceptor; 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 index 6991949dd0..ef47106fa1 100644 --- 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 @@ -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.logging.cxf.interceptor; import java.net.InetAddress; @@ -50,4 +70,4 @@ public class SOAPMDCSetup { } -}
\ No newline at end of file +} diff --git a/docs/api/SO_Interface.rst b/docs/api/SO_Interface.rst index 3ed18a5733..695cedbd48 100644 --- a/docs/api/SO_Interface.rst +++ b/docs/api/SO_Interface.rst @@ -8,7 +8,7 @@ SO Interfaces .. image:: ../images/SO_1.png SO APIs -================================= +---------------- North Bound APIs ---------------- diff --git a/docs/developer_info/BPMN_Main_Process_Flows.rst b/docs/developer_info/BPMN_Main_Process_Flows.rst index 43e08ffd9c..35f43cfa23 100644 --- a/docs/developer_info/BPMN_Main_Process_Flows.rst +++ b/docs/developer_info/BPMN_Main_Process_Flows.rst @@ -37,4 +37,4 @@ Characteristics Example: CreateVfModuleVolumeInfraV1.bpmn ------------------------------------------ -.. image:: images/BPMN_Main_Process_Flows_1.png
\ No newline at end of file +.. image:: ../images/BPMN_Main_Process_Flows_1.png
\ No newline at end of file diff --git a/docs/developer_info/BPMN_Project_Structure.rst b/docs/developer_info/BPMN_Project_Structure.rst index 209ec727c3..23916093c2 100644 --- a/docs/developer_info/BPMN_Project_Structure.rst +++ b/docs/developer_info/BPMN_Project_Structure.rst @@ -12,7 +12,7 @@ A BPMN main process flow is a top-level flow. All main process flows are under CreateVfModuleVolumeInfraV1 is a main process flow. -.. image:: images/bpmn_project_structure_1.png +.. image:: ../images/bpmn_project_structure_1.png Open BPMN files with the camunda modeler (standalone application). To launch the modeler from eclipse, right-click→open-with→Other→Browse. Select Check the boxes on the dialog so that eclipse will open all .bpmn files with the camunda-modeler executable. @@ -23,25 +23,25 @@ A BPMN subprocess flow is meant to be invoked by other flows (either main proces The CreateVfModuleVolumeInfraV1 process flow is delivered with two custom subflows: DoCreateVfModuleVolumeV2 and DoCreateVfModuleVolumeRollback. -.. image:: images/bpmn_project_structure_2.png +.. image:: ../images/bpmn_project_structure_2.png Groovy scripts --------------- There is one groovy script for each BPMN file. Groovy scripts are invoked by script tasks within the BPMN flows. -.. image:: images/bpmn_project_structure_3.png +.. image:: ../images/bpmn_project_structure_3.png Unit Tests ----------- Normally, we create a unit test class for every flow. This one is missing a unit test for its rollback flow. -.. image:: images/bpmn_project_structure_4.png +.. image:: ../images/bpmn_project_structure_4.png Unit Test Resource Files ------------------------ Any files needed by the unit tests are kept under the src/test/resources/__files folder. -.. image:: images/bpmn_project_structure_5.png
\ No newline at end of file +.. image:: ../images/bpmn_project_structure_5.png
\ No newline at end of file diff --git a/docs/developer_info/Camunda_Cockpit_Community_Edition.rst b/docs/developer_info/Camunda_Cockpit_Community_Edition.rst index a9379decc9..7597159708 100644 --- a/docs/developer_info/Camunda_Cockpit_Community_Edition.rst +++ b/docs/developer_info/Camunda_Cockpit_Community_Edition.rst @@ -26,19 +26,19 @@ If you can use a browser on the docker host system, then use a localhost address The user is "admin" and the password is the same as the jboss admin password, which is not displayed here. -.. image:: images/Camunda_Cockpit_1.png +.. image:: ../images/Camunda_Cockpit_1.png Viewing Process Definitions --------------------------- Use the drop-down menu next to the home icon and select the "Cockpit" option: -.. image:: images/Camunda_Cockpit_2.png +.. image:: ../images/Camunda_Cockpit_2.png The number of deployed process definitions should be displayed. Click on it. -.. image:: images/Camunda_Cockpit_3.png +.. image:: ../images/Camunda_Cockpit_3.png Now you should see an actual list of deployed process definitions. You can click on any of them to view them. -.. image:: images/Camunda_Cockpit_4.png +.. image:: ../images/Camunda_Cockpit_4.png diff --git a/docs/developer_info/Camunda_Cockpit_Enterprise_Edition.rst b/docs/developer_info/Camunda_Cockpit_Enterprise_Edition.rst index 3e2d15bf15..0066475db8 100644 --- a/docs/developer_info/Camunda_Cockpit_Enterprise_Edition.rst +++ b/docs/developer_info/Camunda_Cockpit_Enterprise_Edition.rst @@ -140,4 +140,4 @@ If you can use a browser on the docker host system, then use a localhost address The user is "admin" and the password is the same as the jboss admin password, which is not displayed here. -.. image:: images/Camunda_Cockpit_Enterprise_1.png +.. image:: ../images/Camunda_Cockpit_Enterprise_1.png diff --git a/docs/installconfigure/Workspace_and_Development_Tools.rst b/docs/installconfigure/Workspace_and_Development_Tools.rst index 598439f75f..2fca64e4ac 100644 --- a/docs/installconfigure/Workspace_and_Development_Tools.rst +++ b/docs/installconfigure/Workspace_and_Development_Tools.rst @@ -81,7 +81,7 @@ In the eclipse directory, edit eclipse.ini Example: -.. image:: images/Workspace_and_Development_Tools.png +.. image:: ../images/Workspace_and_Development_Tools.png Eclipse Settings ---------------- @@ -93,15 +93,15 @@ Eclipse Settings Click "Finish" -.. image:: images/Workspace_and_Development_Tools_2.png +.. image:: ../images/Workspace_and_Development_Tools_2.png Make sure the external installation is selected: -.. image:: images/Workspace_and_Development_Tools_3.png +.. image:: ../images/Workspace_and_Development_Tools_3.png **Configure eclipse to use your settings.xml** Go to Window→Preferences→Maven→User Settings Type the full path to your settings.xml file into the "User Settings" box and click "OK". -.. image:: images/Workspace_and_Development_Tools_4.png
\ No newline at end of file +.. image:: ../images/Workspace_and_Development_Tools_4.png
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index b1963f1f4c..78e8a44163 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -23,7 +23,6 @@ <reflections-version>0.9.9-RC1</reflections-version> <paranamer-version>2.5.2</paranamer-version> <scannotation-version>1.0.3</scannotation-version> - <jackson-version>1.9.2</jackson-version> <java.version>1.8</java.version> </properties> <dependencyManagement> @@ -73,18 +72,6 @@ <version>${json4s-core-version}</version> </dependency> <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </dependency> - <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> @@ -98,16 +85,6 @@ <artifactId>json</artifactId> </dependency> <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-base</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-providers</artifactId> - <version>2.9.2</version> - <type>pom</type> - </dependency> - <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> 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..49590d3460 100644 --- a/mso-api-handlers/mso-api-handler-infra/pom.xml +++ b/mso-api-handlers/mso-api-handler-infra/pom.xml @@ -23,7 +23,6 @@ <reflections-version>0.9.9-RC1</reflections-version> <paranamer-version>2.5.2</paranamer-version> <scannotation-version>1.0.3</scannotation-version> - <jackson-version>1.9.2</jackson-version> <java.version>1.8</java.version> </properties> <dependencyManagement> @@ -108,18 +107,6 @@ <version>${json4s-core-version}</version> </dependency> <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-core</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-annotations</artifactId> - </dependency> - <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> @@ -132,16 +119,6 @@ <groupId>org.json</groupId> <artifactId>json</artifactId> </dependency> - <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-base</artifactId> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.jaxrs</groupId> - <artifactId>jackson-jaxrs-providers</artifactId> - <version>2.9.2</version> - <type>pom</type> - </dependency> <!-- Dependencies on other MSO Projects --> <dependency> @@ -151,6 +128,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> @@ -319,4 +301,4 @@ </plugins> </build> <packaging>jar</packaging> -</project>
\ No newline at end of file +</project> 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/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/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/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 76f4bb08a2..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 @@ -189,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)); @@ -198,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)); @@ -1633,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))); 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/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..b7eb7642a2 --- /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 = 1482580740000l; // December 23, 2016 23:59 PM + private static final long START_TIME_IN_MILISEC = 1482282000000l; // December 21, 2016 01:00 AM + 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 8da24c928d..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; @@ -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/db/catalog/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java index 5a5dc70029..5bfa300a03 100644 --- 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 @@ -1,7 +1,31 @@ +/*- + * ============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; @@ -10,6 +34,51 @@ import org.springframework.test.context.junit4.SpringRunner; @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/ControllerSelectionReferenceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java index 016d1d61d6..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,7 +23,6 @@ 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.db.catalog.beans.ControllerSelectionReference; 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 37a43aa529..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,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.junit.Assert; @@ -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 db62759406..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,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.junit.Assert; @@ -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; @@ -30,6 +30,7 @@ <module>bpmn</module> <module>cloudify-client</module> <module>cxf-logging</module> + <module>so-monitoring</module> <module>packages</module> </modules> <properties> @@ -507,7 +508,7 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> - <version>2.8.7</version> + <version>2.8.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.module</groupId> @@ -517,12 +518,12 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.8.7</version> + <version>2.8.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.8.7</version> + <version>2.8.10</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.jaxrs</groupId> 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/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.java new file mode 100644 index 0000000000..7c5a8965b7 --- /dev/null +++ b/so-monitoring/so-monitoring-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringApplication.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.monitoring.rest.api; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author waqas.ikram@ericsson.com + */ +@SpringBootApplication(scanBasePackages = {"org.onap"}) +public class SoMonitoringApplication { + + public static void main(String[] args) { + 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 |