diff options
Diffstat (limited to 'adapters')
16 files changed, 120 insertions, 53 deletions
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java index 41aac0084c..78b5c8ede9 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2022 Samsung Electronics. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +23,7 @@ package org.onap.so.cloud.authentication; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; @@ -61,7 +62,7 @@ public class AuthenticationMethodTest { ci.setMsoId("test"); Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); - assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + assertEquals(RackspaceAuthentication.class, auth.getClass()); } @@ -73,7 +74,7 @@ public class AuthenticationMethodTest { ci.setMsoId("someuser"); Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); - assertTrue(UsernamePassword.class.equals(auth.getClass())); + assertEquals(UsernamePassword.class, auth.getClass()); } @@ -85,7 +86,7 @@ public class AuthenticationMethodTest { ci.setMsoId("test"); Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); - assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + assertEquals(RackspaceAuthentication.class, auth.getClass()); } @Test @@ -96,7 +97,7 @@ public class AuthenticationMethodTest { ci.setMsoId("someuser"); Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); - assertTrue(UsernamePassword.class.equals(auth.getClass())); + assertEquals(UsernamePassword.class, auth.getClass()); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java index 622ad4f94f..160201f442 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2022 - Samsung Electronics. 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. @@ -100,19 +101,19 @@ public class MsoCommonUtilsTest extends BaseTest { MsoException me = commonUtils.keystoneErrorToMsoException(openStackConnectException, "ContextError"); assertTrue(me instanceof MsoIOException); - assertTrue("connect".equals(me.getMessage())); + assertEquals("connect", me.getMessage()); MsoException me2 = commonUtils.keystoneErrorToMsoException(openStackResponseException, "ContextError"); assertTrue(me2 instanceof MsoOpenstackException); - assertTrue("ContextError".equals(me2.getContext())); - assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); + assertEquals("ContextError", me2.getContext()); + assertEquals(MsoExceptionCategory.OPENSTACK, me2.getCategory()); OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class); Error error = mapper.readValue(new File(RESOURCE_PATH + "Error.json"), Error.class); - doReturn(error).when(openStackResponse).getErrorEntity(eq(Error.class)); + doReturn(error).when(openStackResponse).getErrorEntity(Error.class); openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); @@ -131,19 +132,19 @@ public class MsoCommonUtilsTest extends BaseTest { MsoException me = commonUtils.heatExceptionToMsoException(openStackConnectException, "ContextError"); assertTrue(me instanceof MsoIOException); - assertTrue("connect".equals(me.getMessage())); + assertEquals("connect", me.getMessage()); MsoException me2 = commonUtils.heatExceptionToMsoException(openStackResponseException, "ContextError"); assertTrue(me2 instanceof MsoOpenstackException); - assertTrue("ContextError".equals(me2.getContext())); - assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); + assertEquals("ContextError", me2.getContext()); + assertEquals(MsoExceptionCategory.OPENSTACK, me2.getCategory()); OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class); Explanation explanation = mapper.readValue(new File(RESOURCE_PATH + "Explanation.json"), Explanation.class); - doReturn(explanation).when(openStackResponse).getErrorEntity(eq(Explanation.class)); + doReturn(explanation).when(openStackResponse).getErrorEntity(Explanation.class); openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); @@ -163,18 +164,18 @@ public class MsoCommonUtilsTest extends BaseTest { MsoException me = commonUtils.neutronExceptionToMsoException(openStackConnectException, "ContextError"); assertTrue(me instanceof MsoIOException); - assertTrue("connect".equals(me.getMessage())); + assertEquals("connect", me.getMessage()); MsoException me2 = commonUtils.neutronExceptionToMsoException(openStackResponseException, "ContextError"); assertTrue(me2 instanceof MsoOpenstackException); - assertTrue("ContextError".equals(me2.getContext())); - assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); + assertEquals("ContextError", me2.getContext()); + assertEquals(MsoExceptionCategory.OPENSTACK, me2.getCategory()); OpenStackResponse openStackResponse = Mockito.mock(OpenStackResponse.class); NeutronError explanation = mapper.readValue(new File(RESOURCE_PATH + "NeutronError.json"), NeutronError.class); - doReturn(explanation).when(openStackResponse).getErrorEntity(eq(NeutronError.class)); + doReturn(explanation).when(openStackResponse).getErrorEntity(NeutronError.class); openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); @@ -190,8 +191,8 @@ public class MsoCommonUtilsTest extends BaseTest { MsoException me = commonUtils.runtimeExceptionToMsoException(re, "ContextError"); assertTrue(me instanceof MsoAdapterException); - assertTrue("ContextError".equals(me.getContext())); - assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory())); + assertEquals("ContextError", me.getContext()); + assertEquals(MsoExceptionCategory.INTERNAL, me.getCategory()); } @Test @@ -202,6 +203,7 @@ public class MsoCommonUtilsTest extends BaseTest { assertTrue(msoException instanceof MsoAdapterException); assertEquals("ContextError", msoException.getContext()); - assertTrue(MsoExceptionCategory.INTERNAL.equals(msoException.getCategory())); + assertEquals(MsoExceptionCategory.INTERNAL, msoException.getCategory()); } } + diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java index 2c67dfd009..18372bb8ea 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java @@ -16,8 +16,7 @@ package org.onap.so.openstack.utils; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotEquals; import org.junit.Test; public class MsoHeatEnvironmentResourceTest { @@ -36,8 +35,8 @@ public class MsoHeatEnvironmentResourceTest { assertEquals("maeValue", mae.getValue()); assertEquals("\"msoHERName\": msoHERValue", msoHER.toString()); assertEquals("\"name\": maeValue", mae.toString()); - assertFalse(mae.equals(op)); - assertTrue(mae.equals(mre)); + assertNotEquals(mae, op); + assertEquals(mae, mre); assertEquals("name".hashCode(), mae.hashCode()); } } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index 5ee4987e38..85219c3b5c 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -447,7 +447,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { heatUtils.createStack(createStackParam, cloudSiteId, tenantId); Mockito.verify(stackResource, times(1)).create(createStackParam); - Mockito.verify(heatUtils, times(1)).saveStackRequest(eq(createStackParam), eq(requestId), eq("stackName")); + Mockito.verify(heatUtils, times(1)).saveStackRequest(createStackParam, requestId, "stackName"); Mockito.verify(heatClient, times(1)).getStacks(); Mockito.verify(stackResource, times(1)).create(createStackParam); } diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java index 7adfe091d3..d197550937 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2019 Samsung Intellectual Property. All rights reserved. + * Copyright (C) 2022 Samsung 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. @@ -28,7 +28,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertSame; import static org.junit.Assert.fail; import static org.mockito.Mockito.when; import static org.onap.so.openstack.utils.MsoMulticloudUtils.MULTICLOUD_QUERY_BODY_NULL; @@ -113,13 +113,13 @@ public class MsoMulticloudUtilsTest extends BaseTest { StackInfo result = multicloudUtils.deleteStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack/TEST-workload"); assertNotNull(result); - assertTrue(HeatStatus.NOTFOUND == result.getStatus()); + assertSame(HeatStatus.NOTFOUND, result.getStatus()); } @Test public void queryStack() throws MsoException { StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceId"); - assertTrue(HeatStatus.NOTFOUND == result.getStatus()); + assertSame(HeatStatus.NOTFOUND, result.getStatus()); } @Test @@ -129,7 +129,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { .withStatus(HttpStatus.SC_OK))); StackInfo result = multicloudUtils.queryStack("MTN13", "CloudOwner", "TEST-tenant", "instanceName/instanceId"); - assertTrue(HeatStatus.FAILED == result.getStatus()); + assertSame(HeatStatus.FAILED, result.getStatus()); assertEquals(MULTICLOUD_QUERY_BODY_NULL, result.getStatusMessage()); } @@ -143,7 +143,7 @@ public class MsoMulticloudUtilsTest extends BaseTest { CloudInfo cloudInfo = new CloudInfo("cloudSiteId", "cloudOwner", "tenantId", "tenantName"); VduInstance vduInstance = multicloudUtils.deleteVdu(cloudInfo, "instanceId", 3); assertNotNull(vduInstance); - assertTrue(VduStateType.DELETED == vduInstance.getStatus().getState()); + assertSame(VduStateType.DELETED, vduInstance.getStatus().getState()); } @Ignore diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql index 9b21dcd2d2..c1a67a5990 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql @@ -26,7 +26,7 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I ('VNF-Create', 'createInstance', 'Vnf', true,true, '7', '7', 'DEFAULT', '*'), ('VNF-Delete', 'deleteInstance', 'Vnf', true,true, '7', '7', 'DEFAULT', '*'), ('VNF-Macro-Delete', 'deleteInstance', 'Vnf', false,true, '7', '7', 'DEFAULT', '*'), -('VNF-Macro-Modify', 'updateInstance', 'Vnf', false,true, '7', '7','k8scloudowner4', '*'), +('VNF-Macro-Modify', 'updateInstance', 'Vnf', false,true, '7', '7','DEFAULT', '*'), ('VNF-Macro-HealthCheck', 'healthCheck', 'Vnf', false,true, '7', '7','DEFAULT', '*'), ('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true,true, '7','7', 'DEFAULT', '*'), ('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true,true, '7','7', 'DEFAULT', '*'), @@ -39,7 +39,8 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I ('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false,true, '7','7', 'DEFAULT', '*'), ('VFModule-ScaleOut', 'scaleOut', 'VfModule', true, true, '7','7', 'DEFAULT', '*'), ('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'), -('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*'); +('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*'), +('CNF-Macro-Upgrade', 'upgradeCnf', 'Vnf', false,true, '7', '7','DEFAULT', '*'); INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, SCOPE, ACTION, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES @@ -255,9 +256,22 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, SC ('VNF-Config-Update', '7', 'VNFHealthCheckActivity', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), ('VNF-Config-Update', '8', 'VNFUnsetInMaintFlagActivity', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), ('VNF-Config-Update', '9', 'VNFUnsetClosedLoopDisabledFlagActivity', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Config-Update' and CLOUD_OWNER = 'DEFAULT')), -('VNF-Macro-Modify', '1', 'ControllerExecutionBB', 'vnf', 'config-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'k8scloudowner4')), -('VNF-Macro-Modify', '2', 'ControllerExecutionBB', 'vnf', 'config-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'k8scloudowner4')), -('VNF-Macro-HealthCheck', '1', 'HealthCheckBB', 'vnf', 'status-check', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-HealthCheck' and CLOUD_OWNER = 'DEFAULT')); +('VNF-Macro-Modify', '1', 'ControllerExecutionBB', 'vnf', 'config-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Macro-Modify', '2', 'ControllerExecutionBB', 'vnf', 'config-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Modify' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Macro-HealthCheck', '1', 'HealthCheckBB', 'vnf', 'status-check', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-HealthCheck' and CLOUD_OWNER = 'DEFAULT')), +('VNF-Macro-HealthCheck', '2', 'HealthCheckBB', 'vnf', 'health-check', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-HealthCheck' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '1', 'AAICheckVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '2', 'AAISetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '3', 'DeactivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '4', 'DeactivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '5', 'ChangeModelVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '6', 'ControllerExecutionBB', 'vnf', 'config-upgrade-assign', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '7', 'UpgradeVfModuleBB', NULL , NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '8', 'ControllerExecutionBB', 'vnf', 'config-upgrade-deploy', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '9', 'ActivateVfModuleBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '10', 'ChangeModelVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '11', 'ActivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')), +('CNF-Macro-Upgrade', '12', 'AAIUnsetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')); INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE) VALUES @@ -416,7 +430,11 @@ VALUES ('VNFConfigModifyActivity', 'NO_VALIDATE', 'CUSTOM'), ('ConfigAssignVnfBB', 'NO_VALIDATE', 'CUSTOM'), ('ConfigDeployVnfBB', 'NO_VALIDATE', 'CUSTOM'), -('ControllerExecutionBB', 'NO_VALIDATE', 'CUSTOM'); +('ControllerExecutionBB', 'NO_VALIDATE', 'CUSTOM'), +('StatusCheckBB', 'NO_VALIDATE', 'CUSTOM'), +('HealthCheckBB', 'NO_VALIDATE', 'CUSTOM'), +('UpgradeVfModuleBB', 'NO_VALIDATE', 'CUSTOM'); + INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive) VALUES @@ -866,3 +884,28 @@ DELETE FROM service_recipe where ACTION = 'upgradeInstance'; INSERT INTO service_recipe (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID) VALUES ('upgradeInstance', '1.0', 'Gr api recipe to upgrade service-instance', '/mso/async/services/WorkflowActionBB', 180, 'd88da85c-d9e8-4f73-b837-3a72a431622b'); + +INSERT INTO building_block_rollback(BUILDING_BLOCK_NAME,ACTION,ROLLBACK_BUILDING_BLOCK_NAME,ROLLBACK_ACTION) +VALUES +('ActivateNetworkBB',NULL,'DeactivateNetworkBB',NULL), +('ActivatePnfBB',NULL,'DeactivatePnfBB',NULL), +('ActivateServiceInstanceBB',NULL,'DeactivateServiceInstanceBB',NULL), +('ActivateVfModuleBB',NULL,'DeactivateVfModuleBB',NULL), +('ActivateVnfBB',NULL,'DeactivateVnfBB',NULL), +('ActivateVolumeGroupBB',NULL,'DeactivateVolumeGroupBB',NULL), +('AssignNetworkBB',NULL,'UnassignNetworkBB',NULL), +('AssignServiceInstanceBB',NULL,'UnassignServiceInstanceBB',NULL), +('AssignVfModuleBB',NULL,'UnassignVfModuleBB',NULL), +('AssignVnfBB',NULL,'UnassignVnfBB',NULL), +('AssignVolumeGroupBB',NULL,'UnassignVolumeGroupBB',NULL), +('CreateNetworkBB',NULL,'DeleteNetworkBB',NULL), +('CreateNetworkCollectionBB',NULL,'DeleteNetworkCollectionBB',NULL), +('CreateVfModuleBB',NULL,'DeleteVfModuleBB',NULL), +('CreateVolumeGroupBB',NULL,'DeleteVolumeGroupBB',NULL), +('VNFSetInMaintFlagActivity',NULL,'VNFUnsetInMaintFlagActivity',NULL), +('VNFSetClosedLoopDisabledFlagActivity',NULL,'VNFUnsetClosedLoopDisabledFlagActivity',NULL), +('VNFLockActivity',NULL,'VNFUnlockActivity',NULL), +('VNFStopActivity',NULL,'VNFStartActivity',NULL), +('VNFQuiesceTrafficActivity',NULL,'VNFResumeTrafficActivity',NULL), +('EtsiVnfInstantiateBB',NULL,'EtsiVnfDeleteBB',NULL), +('AddFabricConfigurationBB',NULL,'DeleteFabricConfigurationBB',NULL); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql index e4a2d6648f..6dfc863e0b 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql @@ -35,6 +35,7 @@ INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORC INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (4,'deleteInstance','1','DEFAULT recipe to delete service-instance if no custom BPMN flow is found','/mso/async/services/DeleteGenericALaCarteServiceInstance',NULL,180,NULL,'2017-10-05 18:52:03','48cc3acd-a9fe-11e7-8b4b-0242ac120002'); insert into `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) values (500,'updateInstance','1.0','Gr api recipe to update service-instance', '/mso/async/services/WorkflowActionBB', NULL, 180, NULL, '2017-10-05 18:52:03', 'd88da85c-d9e8-4f73-b837-3a72a431622b'); insert into `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) values (501,'healthCheck','1.0','Gr api recipe to do CNF health check', '/mso/async/services/WorkflowActionBB', NULL, 180, NULL, '2021-08-20 18:52:03', 'd88da85c-d9e8-4f73-b837-3a72a431622b'); +insert into `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) values (525,'upgradeCnf','1.0','Gr api recipe to do CNF upgrade', '/mso/async/services/WorkflowActionBB', NULL, 180, NULL, '2022-01-20 18:52:03', 'd88da85c-d9e8-4f73-b837-3a72a431622b'); -- -- Custom Reciepe for the VoLTE service added temporarily @@ -106,4 +107,6 @@ INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSI INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (12,NULL,'deleteInstance',NULL,'1','NS_DEFAULT','default custom E2E recipe to delete NS if no custom BPMN flow is found','/mso/async/services/DeleteVFCNSResource',NULL,180,'2018-04-18 18:52:03'); INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (13,NULL,'inPlaceSoftwareUpdate',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to update VNF software if no custom BPMN flow is found','/mso/async/services/VnfInPlaceUpdate',NULL,180,'2018-05-23 11:00:00'); INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (14,NULL,'applyUpdatedConfig',NULL,'1','VID_DEFAULT','VID_DEFAULT recipe to apply updated VNF config if no custom BPMN flow is found','/mso/async/services/VnfConfigUpdate',NULL,180,'2018-05-23 11:00:00'); -SET FOREIGN_KEY_CHECKS=1; +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10030,NULL,'upgradeCnf',NULL,'1','GR-API-DEFAULT','Gr api recipe to do CNF-Upgrade','/mso/async/services/WorkflowActionBB',NULL,180,'2022-01-23 10:00:00'); +INSERT INTO `vnf_recipe` (`id`, `VF_MODULE_ID`, `ACTION`, `SERVICE_TYPE`, `VERSION_STR`, `VNF_TYPE`, `DESCRIPTION`, `ORCHESTRATION_URI`, `VNF_PARAM_XSD`, `RECIPE_TIMEOUT`, `CREATION_TIMESTAMP`) VALUES (10032,NULL,'healthCheck',NULL,'1','GR-API-DEFAULT','Gr api recipe to do CNF health check','/mso/async/services/WorkflowActionBB',NULL,180,'2022-01-05 18:52:03'); +SET FOREIGN_KEY_CHECKS=1;
\ 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 48ef1329b0..74ea27cc06 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 @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2022 Samsung Electronics 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. @@ -813,7 +814,7 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - JSONAssert.assertEquals(badQueryParamResponse, response.getBody().toString(), false); + JSONAssert.assertEquals(badQueryParamResponse, response.getBody(), false); } @Test @@ -850,10 +851,10 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { ObjectMapper mapper = new ObjectMapper(); ProcessingFlags processingFlagsResponse = mapper.readValue(response.getBody(), ProcessingFlags.class); - assertEquals(processingFlagsResponse.getFlag(), "TESTFLAG"); - assertEquals(processingFlagsResponse.getValue(), "NO"); - assertEquals(processingFlagsResponse.getEndpoint(), "TESTENDPOINT"); - assertEquals(processingFlagsResponse.getDescription(), "TEST FLAG"); + assertEquals("TESTFLAG", processingFlagsResponse.getFlag()); + assertEquals("NO", processingFlagsResponse.getValue()); + assertEquals("TESTENDPOINT", processingFlagsResponse.getEndpoint()); + assertEquals("TEST FLAG", processingFlagsResponse.getDescription()); } @Test @@ -876,8 +877,8 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest { boolean testFlagFound = false; for (int i = 0; i < processingFlagsResponse.size(); i++) { if (processingFlagsResponse.get(i).getFlag().equals("TESTFLAG")) { - assertEquals(processingFlagsResponse.get(i).getEndpoint(), "TESTENDPOINT"); - assertEquals(processingFlagsResponse.get(i).getDescription(), "TEST FLAG"); + assertEquals("TESTENDPOINT", processingFlagsResponse.get(i).getEndpoint()); + assertEquals("TEST FLAG", processingFlagsResponse.get(i).getDescription()); testFlagFound = true; } } diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java index 2266eafa12..d7852cfdfe 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceArtifactTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (c) 2019, CMCC Technologies Co., Ltd. + * Copyright (c) 2022, Samsung Electronics. 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. @@ -35,7 +36,7 @@ public class QueryServiceArtifactTest { QueryServiceArtifact queryServiceArtifact = new QueryServiceArtifact(createList()); String jsonResult = queryServiceArtifact.JSON2(true, false); Assertions.assertThat(JsonPathUtil.getInstance().locateResult(jsonResult, "$.serviceArtifact[0].name").get()) - .isEqualTo("eMBB.zip"); + .contains("eMBB.zip"); } private List<ServiceArtifact> createList() { diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java index e948141b89..37fd4641a1 100644 --- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java +++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceInfoTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (c) 2019, CMCC Technologies Co., Ltd. + * Copyright (c) 2022, Samsung Electronics. 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. @@ -35,7 +36,7 @@ public class QueryServiceInfoTest { QueryServiceInfo queryServiceInfo = new QueryServiceInfo(createList()); String jsonResult = queryServiceInfo.JSON2(true, false); String serviceInfo = jsonResult.substring(jsonResult.indexOf("{"), jsonResult.length()); - Assertions.assertThat(JsonPathUtil.getInstance().locateResult(serviceInfo, "$.id").get()).isEqualTo("1"); + Assertions.assertThat(JsonPathUtil.getInstance().locateResult(serviceInfo, "$.id").get()).contains("1"); } private List<ServiceInfo> createList() { 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 8ce4051b24..4e273d5a8e 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 @@ -34,6 +34,7 @@ import org.junit.Test; import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest; import org.onap.so.db.catalog.beans.AuthenticationType; import org.onap.so.db.catalog.beans.BBNameSelectionReference; +import org.onap.so.db.catalog.beans.BuildingBlockRollback; import org.onap.so.db.catalog.beans.CloudIdentity; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; @@ -780,5 +781,11 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest { assertEquals(processingFlags.getEndpoint(), "TESTENDPOINT"); } + @Test + public void testGetBuildingBlocksList() { + List<BuildingBlockRollback> rollbackEntries = client.getBuildingBlockRollbackEntries(); + assertTrue(rollbackEntries.size() > 1); + } + } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java index c281dbd9e5..17fd99482c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java @@ -35,6 +35,7 @@ package org.onap.so.heatbridge.utils; import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -71,6 +72,9 @@ public final class HeatBridgeUtils { } public static List<String> extractPciIdsFromVServer(Vserver vserver) { + if (vserver.getLInterfaces() == null) { + return Collections.emptyList(); + } return vserver.getLInterfaces().getLInterface().stream() .filter(lInterface -> lInterface.getSriovVfs() != null && CollectionUtils.isNotEmpty(lInterface.getSriovVfs().getSriovVf())) diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java index 33805f9faa..59919c67f2 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/client/RequestsDbClientTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (c) 2022, Samsung Electronics. 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. @@ -26,7 +27,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; import java.sql.Timestamp; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -339,7 +339,8 @@ public class RequestsDbClientTest extends RequestsAdapterBase { requestsDbClient.getRequestProcessingDataBySoRequestIdAndNameAndTagOrderByCreateTimeDesc( "00032ab7-na18-42e5-965d-8ea592502018", "requestAction", "pincFabricConfigRequest"); assertNotNull(requestProcessingData); - assertTrue(requestProcessingData.size() == 1); + assertEquals(1, requestProcessingData.size()); assertEquals("assign", requestProcessingData.get(0).getValue()); } } + diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java index 77821bfefd..3cf9314a8b 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2018 TechMahindra + * Copyright (c) 2022, Samsung Electronics. 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. @@ -37,7 +38,8 @@ public class MsoRequestsDbExceptionBeanTest { public void testGetMessage() { soRequestsDbExceptionBean.setMessage("message"); Assert.assertNotNull(soRequestsDbExceptionBean.getMessage()); - Assert.assertEquals(soRequestsDbExceptionBean.getMessage(), "message"); + Assert.assertEquals("message", soRequestsDbExceptionBean.getMessage()); } } + diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java index 04f597f9b2..94c6d267e4 100644 --- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java +++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2018 TechMahindra + * Copyright (c) 2022, Samsung Electronics. 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. @@ -27,7 +28,7 @@ public class MsoRequestsDbExceptionTest { public void testConstructorWithMessaqge() throws Exception { String message = "testing message"; MsoRequestsDbException msoRequestsDbException = new MsoRequestsDbException(message); - Assert.assertTrue(msoRequestsDbException.getCause() == null); + Assert.assertNull(msoRequestsDbException.getCause()); Assert.assertEquals(message, msoRequestsDbException.getLocalizedMessage()); Assert.assertEquals(message, msoRequestsDbException.getMessage()); } @@ -64,3 +65,4 @@ public class MsoRequestsDbExceptionTest { } } + diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java index c1bbb9ae9a..557a67b7cb 100644 --- a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallbackTest.java @@ -24,6 +24,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNotNull; import org.apache.http.HttpStatus; import org.junit.Test; @@ -48,7 +49,6 @@ public class BPRestCallbackTest extends BaseTest { .withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES))); boolean responseCommon = bpRestCallback.send("http://localhost:" + wireMockPort + "/sdnc", "Test"); - assertNotNull(responseCommon); - assertEquals(true, responseCommon); + assertTrue(responseCommon); } } |