From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../exceptions/MsoCloudifyExceptionTest.class | Bin 1468 -> 0 bytes .../exceptions/MsoCloudifyTimeoutTest.class | Bin 1517 -> 0 bytes adapters/mso-adapter-utils/pom.xml | 81 +- .../java/org/onap/so/adapters/vdu/VduPlugin.java | 186 ++ .../main/java/org/onap/so/cloud/Application.java | 38 + .../java/org/onap/so/cloud/AuthenticationType.java | 25 + .../main/java/org/onap/so/cloud/CloudConfig.java | 216 ++ .../onap/so/cloud/CloudConfigIdentityMapper.java | 30 + .../main/java/org/onap/so/cloud/CloudIdentity.java | 203 ++ .../src/main/java/org/onap/so/cloud/CloudSite.java | 196 ++ .../java/org/onap/so/cloud/CloudifyManager.java | 153 ++ .../main/java/org/onap/so/cloud/ServerType.java | 25 + .../AuthenticationMethodFactory.java | 53 + .../models/RackspaceAuthentication.java | 102 + .../org/onap/so/cloudify/beans/DeploymentInfo.java | 186 ++ .../onap/so/cloudify/beans/DeploymentStatus.java | 31 + .../exceptions/MsoBlueprintAlreadyExists.java | 33 + .../cloudify/exceptions/MsoCloudifyException.java | 86 + .../exceptions/MsoCloudifyManagerNotFound.java | 33 + .../so/cloudify/exceptions/MsoCloudifyTimeout.java | 64 + .../exceptions/MsoCloudifyWorkflowException.java | 54 + .../exceptions/MsoDeploymentAlreadyExists.java | 33 + .../onap/so/cloudify/utils/MsoCloudifyUtils.java | 1408 ++++++++++++ .../java/org/onap/so/config/beans/PoConfig.java | 53 + .../onap/so/openstack/beans/HeatCacheEntry.java | 60 + .../onap/so/openstack/beans/NeutronCacheEntry.java | 67 + .../org/onap/so/openstack/beans/VnfRollback.java | 216 ++ .../onap/so/openstack/utils/MsoCommonUtils.java | 303 +++ .../openstack/utils/MsoHeatEnvironmentEntry.java | 257 +++ .../utils/MsoHeatEnvironmentParameter.java | 77 + .../utils/MsoHeatEnvironmentResource.java | 96 + .../org/onap/so/openstack/utils/MsoHeatUtils.java | 1790 +++++++++++++++ .../so/openstack/utils/MsoHeatUtilsWithUpdate.java | 438 ++++ .../onap/so/openstack/utils/MsoKeystoneUtils.java | 669 ++++++ .../onap/so/openstack/utils/MsoNeutronUtils.java | 550 +++++ .../onap/so/openstack/utils/MsoTenantUtils.java | 58 + .../so/openstack/utils/MsoTenantUtilsFactory.java | 56 + .../so/openstack/utils/MsoYamlEditorWithEnvt.java | 163 ++ .../org/openecomp/mso/adapters/vdu/CloudInfo.java | 69 - .../openecomp/mso/adapters/vdu/PluginAction.java | 63 - .../openecomp/mso/adapters/vdu/VduArtifact.java | 80 - .../openecomp/mso/adapters/vdu/VduException.java | 60 - .../openecomp/mso/adapters/vdu/VduInstance.java | 80 - .../openecomp/mso/adapters/vdu/VduModelInfo.java | 50 - .../org/openecomp/mso/adapters/vdu/VduPlugin.java | 186 -- .../openecomp/mso/adapters/vdu/VduStateType.java | 36 - .../org/openecomp/mso/adapters/vdu/VduStatus.java | 58 - .../java/org/openecomp/mso/aria/AriaVduPlugin.java | 340 --- .../src/main/java/org/openecomp/mso/aria/CSAR.java | 188 -- .../java/org/openecomp/mso/cloud/CloudConfig.java | 308 --- .../openecomp/mso/cloud/CloudConfigFactory.java | 209 -- .../mso/cloud/CloudConfigIdentityMapper.java | 30 - .../org/openecomp/mso/cloud/CloudIdentity.java | 343 --- .../java/org/openecomp/mso/cloud/CloudSite.java | 208 -- .../org/openecomp/mso/cloud/CloudifyManager.java | 169 -- .../cloud/IdentityAuthenticationTypeAbstract.java | 86 - ...IdentityAuthenticationTypeJsonDeserializer.java | 42 - .../IdentityAuthenticationTypeJsonSerializer.java | 36 - .../mso/cloud/IdentityServerTypeAbstract.java | 85 - .../cloud/IdentityServerTypeJsonDeserializer.java | 45 - .../cloud/IdentityServerTypeJsonSerializer.java | 37 - .../AuthenticationMethodFactory.java | 71 - .../authentication/AuthenticationWrapper.java | 58 - .../models/RackspaceAuthentication.java | 90 - .../wrappers/RackspaceAPIKeyWrapper.java | 45 - .../wrappers/UsernamePasswordWrapper.java | 45 - .../mso/cloudify/beans/DeploymentInfo.java | 186 -- .../mso/cloudify/beans/DeploymentStatus.java | 31 - .../exceptions/MsoBlueprintAlreadyExists.java | 33 - .../cloudify/exceptions/MsoCloudifyException.java | 86 - .../exceptions/MsoCloudifyManagerNotFound.java | 33 - .../cloudify/exceptions/MsoCloudifyTimeout.java | 64 - .../exceptions/MsoCloudifyWorkflowException.java | 54 - .../exceptions/MsoDeploymentAlreadyExists.java | 33 - .../mso/cloudify/utils/MsoCloudifyUtils.java | 1483 ------------- .../openecomp/mso/openstack/beans/VnfRollback.java | 214 -- .../openstack/utils/CloudConfigInitializer.java | 97 - .../mso/openstack/utils/MsoCommonUtils.java | 313 --- .../openstack/utils/MsoHeatEnvironmentEntry.java | 263 --- .../utils/MsoHeatEnvironmentParameter.java | 77 - .../utils/MsoHeatEnvironmentResource.java | 96 - .../mso/openstack/utils/MsoHeatUtils.java | 1860 ---------------- .../openstack/utils/MsoHeatUtilsWithUpdate.java | 437 ---- .../mso/openstack/utils/MsoKeystoneUtils.java | 604 ----- .../mso/openstack/utils/MsoNeutronUtils.java | 588 ----- .../mso/openstack/utils/MsoTenantUtils.java | 75 - .../mso/openstack/utils/MsoTenantUtilsFactory.java | 75 - .../mso/openstack/utils/MsoYamlEditorWithEnvt.java | 163 -- .../src/main/resources/application-local.yaml | 64 + .../src/test/java/org/onap/so/BaseTest.java | 46 + .../src/test/java/org/onap/so/StubOpenStack.java | 148 ++ .../src/test/java/org/onap/so/TestApplication.java | 39 + .../src/test/java/org/onap/so/TestDataSetup.java | 40 + .../tests/MsoHeatUtilsRefactorTest.java | 59 + .../so/adapter_utils/tests/MsoHeatUtilsTest.java | 140 ++ .../tests/MsoHeatUtilsWithUpdateTest.java | 134 ++ .../java/org/onap/so/cloud/CloudConfigTest.java | 107 + .../java/org/onap/so/cloud/CloudIdentityTest.java | 100 + .../test/java/org/onap/so/cloud/CloudPojoTest.java | 58 + .../org/onap/so/cloud/CloudifyManagerTest.java | 46 + .../authentication/AuthenticationMethodTest.java | 106 + .../onap/so/cloudify/beans/DeploymentInfoTest.java | 76 + .../exceptions/MsoCloudifyExceptionTest.java | 39 + .../so/cloudify/exceptions/MsoCloudifyTest.java | 35 + .../exceptions/MsoCloudifyTimeoutTest.java | 38 + .../MsoCloudifyWorkflowExceptionTest.java | 36 + .../so/cloudify/utils/MsoCloudifyUtilsTest2.java | 231 ++ .../test/java/org/onap/so/config/PoConfigTest.java | 50 + .../so/openstack/beans/HeatCacheEntryTest.java | 65 + .../org/onap/so/openstack/beans/MsoTenantTest.java | 42 + .../so/openstack/beans/NetworkRollbackTest.java | 69 + .../so/openstack/beans/NeutronCacheEntryTest.java | 57 + .../so/openstack/beans/OpenstackBeansPojoTest.java | 48 + .../onap/so/openstack/beans/VnfRollbackTest.java | 90 + .../so/openstack/utils/MsoCommonUtilsTest.java | 207 ++ .../utils/MsoHeatEnvironmentEntryTest.java | 110 + .../utils/MsoHeatEnvironmentParameterTest.java | 46 + .../utils/MsoHeatEnvironmentResourceTest.java | 49 + .../onap/so/openstack/utils/MsoHeatUtilsTest.java | 188 ++ .../utils/MsoHeatUtilsWithUpdateTest.java | 170 ++ .../so/openstack/utils/MsoKeystoneUtilsTest.java | 111 + .../so/openstack/utils/MsoNeutronUtilsTest.java | 125 ++ .../openstack/utils/MsoYamlEditorWithEnvtTest.java | 95 + .../mso/adapter_utils/tests/AdapterBeansTest.java | 159 -- .../adapter_utils/tests/MsoCommonUtilsTest.java | 130 -- .../mso/adapter_utils/tests/MsoHeatUtilsTest.java | 365 --- .../tests/MsoHeatUtilsWithUpdateTest.java | 136 -- .../org/openecomp/mso/adapters/vdu/BeansTest.java | 56 - .../mso/cloud/CloudConfigFactoryTest.java | 162 -- .../org/openecomp/mso/cloud/CloudConfigTest.java | 244 -- .../org/openecomp/mso/cloud/CloudIdentityTest.java | 64 - .../org/openecomp/mso/cloud/CloudSiteTest.java | 67 - .../AuthenticationMethodFactoryTest.java | 103 - .../authentication/AuthenticationMethodTest.java | 68 - .../wrappers/RackspaceAPIKeyWrapperTest.java | 55 - .../wrappers/UsernamePasswordWrapperTest.java | 55 - .../wrappers/WrapperTestUtility.java | 44 - .../mso/cloud/servertype/NewServerTypeUtils.java | 71 - .../mso/cloud/servertype/ServerTypeTest.java | 92 - .../mso/cloudify/beans/DeploymentInfoTest.java | 76 - .../exceptions/MsoCloudifyExceptionTest.java | 39 - .../mso/cloudify/exceptions/MsoCloudifyTest.java | 35 - .../exceptions/MsoCloudifyTimeoutTest.java | 38 - .../MsoCloudifyWorkflowExceptionTest.java | 36 - .../mso/cloudify/utils/MsoCloudifyUtilsTest.java | 144 -- .../mso/cloudify/utils/MsoCloudifyUtilsTest2.java | 254 --- .../mso/openstack/beans/MsoTenantTest.java | 42 - .../mso/openstack/beans/NetworkInfoTest.java | 158 -- .../mso/openstack/beans/NetworkRollbackTest.java | 69 - .../mso/openstack/beans/StackInfoTest.java | 98 - .../utils/MsoHeatEnvironmentEntryTest.java | 73 - .../utils/MsoHeatEnvironmentParameterTest.java | 46 - .../utils/MsoHeatEnvironmentResourceTest.java | 47 - .../mso/openstack/utils/MsoHeatUtilsTest.java | 216 -- .../mso/openstack/utils/MsoHeatUtilsTest2.java | 172 -- .../mso/openstack/utils/MsoKeystoneUtilsTest.java | 143 -- .../mso/openstack/utils/MsoNeutronUtilsTest.java | 124 -- .../openstack/utils/MsoTenantUtilsFactoryTest.java | 44 - .../mso/openstack/utils/MsoTenantUtilsTest.java | 55 - .../openstack/utils/MsoYamlEditorWithEnvtTest.java | 70 - .../src/test/resources/__files/CloudSite.json | 9 + .../src/test/resources/__files/Error.json | 5 + .../src/test/resources/__files/Explanation.json | 6 + .../test/resources/__files/GetNeutronNetwork.json | 45 + .../__files/HeatEnvironmentParameter.json | 4 + .../src/test/resources/__files/HeatStack.json | 11 + .../test/resources/__files/HeatTemplateParam.json | 7 + .../__files/HeatTemplateParamExpected.json | 5 + .../src/test/resources/__files/NeutronError.json | 5 + .../OpenstackCreateNeutronNetworkResponse.json | 11 + .../__files/OpenstackResponse_Access.json | 53 + .../resources/__files/OpenstackResponse_Roles.json | 10 + .../__files/OpenstackResponse_StackId.json | 14 + .../__files/OpenstackResponse_Stack_Created.json | 17 + .../OpenstackResponse_Stack_DeleteComplete.json | 17 + .../__files/OpenstackResponse_Tenant.json | 8 + .../resources/__files/OpenstackResponse_User.json | 11 + .../src/test/resources/__files/UpdateStack.json | 11 + .../src/test/resources/application-test.yaml | 50 + .../src/test/resources/cloud_config.json | 87 - .../src/test/resources/cloud_config_bad.json | 31 - .../src/test/resources/logback-test.xml | 6 +- adapters/mso-adapters-rest-interface/pom.xml | 12 +- .../adapters/network/beans/ContrailPolicyRef.java | 45 + .../network/beans/ContrailPolicyRefSeq.java | 65 + .../so/adapters/network/beans/ContrailSubnet.java | 128 ++ .../network/beans/ContrailSubnetHostRoute.java | 54 + .../network/beans/ContrailSubnetHostRoutes.java | 53 + .../adapters/network/beans/ContrailSubnetIp.java | 55 + .../adapters/network/beans/ContrailSubnetPool.java | 55 + .../mappers/ContrailSubnetHostRouteMapper.java | 44 + .../network/mappers/ContrailSubnetMapper.java | 135 ++ .../network/mappers/ContrailSubnetPoolMapper.java | 43 + .../onap/so/adapters/nwrest/ContrailNetwork.java | 98 + .../so/adapters/nwrest/CreateNetworkError.java | 45 + .../so/adapters/nwrest/CreateNetworkRequest.java | 206 ++ .../so/adapters/nwrest/CreateNetworkResponse.java | 127 ++ .../so/adapters/nwrest/DeleteNetworkError.java | 45 + .../so/adapters/nwrest/DeleteNetworkRequest.java | 105 + .../so/adapters/nwrest/DeleteNetworkResponse.java | 65 + .../adapters/nwrest/NetworkExceptionResponse.java | 73 + .../so/adapters/nwrest/NetworkRequestCommon.java | 109 + .../so/adapters/nwrest/NetworkResponseCommon.java | 86 + .../onap/so/adapters/nwrest/NetworkTechnology.java | 26 + .../so/adapters/nwrest/ProviderVlanNetwork.java | 61 + .../onap/so/adapters/nwrest/QueryNetworkError.java | 31 + .../so/adapters/nwrest/QueryNetworkResponse.java | 135 ++ .../so/adapters/nwrest/RollbackNetworkError.java | 45 + .../so/adapters/nwrest/RollbackNetworkRequest.java | 51 + .../adapters/nwrest/RollbackNetworkResponse.java | 56 + .../so/adapters/nwrest/UpdateNetworkError.java | 45 + .../so/adapters/nwrest/UpdateNetworkRequest.java | 201 ++ .../so/adapters/nwrest/UpdateNetworkResponse.java | 78 + .../so/adapters/sdncrest/RequestInformation.java | 143 ++ .../onap/so/adapters/sdncrest/SDNCErrorCommon.java | 38 + .../org/onap/so/adapters/sdncrest/SDNCEvent.java | 142 ++ .../so/adapters/sdncrest/SDNCRequestCommon.java | 115 + .../so/adapters/sdncrest/SDNCResponseCommon.java | 124 ++ .../so/adapters/sdncrest/SDNCServiceError.java | 51 + .../so/adapters/sdncrest/SDNCServiceRequest.java | 150 ++ .../so/adapters/sdncrest/SDNCServiceResponse.java | 78 + .../so/adapters/sdncrest/ServiceInformation.java | 104 + .../so/adapters/tenantrest/CreateTenantError.java | 73 + .../adapters/tenantrest/CreateTenantRequest.java | 98 + .../adapters/tenantrest/CreateTenantResponse.java | 85 + .../so/adapters/tenantrest/DeleteTenantError.java | 73 + .../adapters/tenantrest/DeleteTenantRequest.java | 62 + .../adapters/tenantrest/DeleteTenantResponse.java | 41 + .../so/adapters/tenantrest/QueryTenantError.java | 63 + .../adapters/tenantrest/QueryTenantResponse.java | 63 + .../adapters/tenantrest/RollbackTenantError.java | 69 + .../adapters/tenantrest/RollbackTenantRequest.java | 41 + .../tenantrest/RollbackTenantResponse.java | 41 + .../tenantrest/TenantExceptionResponse.java | 72 + .../adapters/tenantrest/TenantRequestCommon.java | 66 + .../so/adapters/tenantrest/TenantRollback.java | 80 + .../java/org/onap/so/adapters/vdu/CloudInfo.java | 69 + .../org/onap/so/adapters/vdu/PluginAction.java | 63 + .../java/org/onap/so/adapters/vdu/VduArtifact.java | 80 + .../org/onap/so/adapters/vdu/VduException.java | 60 + .../java/org/onap/so/adapters/vdu/VduInstance.java | 80 + .../org/onap/so/adapters/vdu/VduModelInfo.java | 50 + .../org/onap/so/adapters/vdu/VduStateType.java | 36 + .../java/org/onap/so/adapters/vdu/VduStatus.java | 58 + .../so/adapters/vnfrest/CreateVfModuleRequest.java | 215 ++ .../adapters/vnfrest/CreateVfModuleResponse.java | 105 + .../adapters/vnfrest/CreateVolumeGroupRequest.java | 157 ++ .../vnfrest/CreateVolumeGroupResponse.java | 100 + .../so/adapters/vnfrest/DeleteVfModuleRequest.java | 98 + .../adapters/vnfrest/DeleteVfModuleResponse.java | 80 + .../adapters/vnfrest/DeleteVolumeGroupRequest.java | 90 + .../vnfrest/DeleteVolumeGroupResponse.java | 49 + .../so/adapters/vnfrest/QueryVfModuleResponse.java | 97 + .../adapters/vnfrest/QueryVolumeGroupResponse.java | 103 + .../adapters/vnfrest/RollbackVfModuleRequest.java | 45 + .../adapters/vnfrest/RollbackVfModuleResponse.java | 49 + .../vnfrest/RollbackVolumeGroupRequest.java | 44 + .../vnfrest/RollbackVolumeGroupResponse.java | 49 + .../so/adapters/vnfrest/UpdateVfModuleRequest.java | 215 ++ .../adapters/vnfrest/UpdateVfModuleResponse.java | 85 + .../adapters/vnfrest/UpdateVolumeGroupRequest.java | 130 ++ .../vnfrest/UpdateVolumeGroupResponse.java | 79 + .../vnfrest/VfModuleExceptionResponse.java | 75 + .../onap/so/adapters/vnfrest/VfModuleRollback.java | 130 ++ .../onap/so/adapters/vnfrest/VfRequestCommon.java | 61 + .../onap/so/adapters/vnfrest/VfResponseCommon.java | 85 + .../vnfrest/VolumeGroupExceptionResponse.java | 45 + .../so/adapters/vnfrest/VolumeGroupRollback.java | 128 ++ .../org/onap/so/openstack/beans/HeatStatus.java | 30 + .../org/onap/so/openstack/beans/HostRoute.java | 69 + .../org/onap/so/openstack/beans/MsoTenant.java | 66 + .../org/onap/so/openstack/beans/NetworkInfo.java | 120 + .../onap/so/openstack/beans/NetworkRollback.java | 157 ++ .../org/onap/so/openstack/beans/NetworkStatus.java | 31 + .../java/org/onap/so/openstack/beans/Pool.java | 62 + .../org/onap/so/openstack/beans/RouteTarget.java | 62 + .../org/onap/so/openstack/beans/StackInfo.java | 109 + .../java/org/onap/so/openstack/beans/Subnet.java | 213 ++ .../org/onap/so/openstack/beans/VnfRollback.java | 213 ++ .../org/onap/so/openstack/beans/VnfStatus.java | 30 + .../openstack/exceptions/MsoAdapterException.java | 45 + .../exceptions/MsoCloudIdentityNotFound.java | 56 + .../openstack/exceptions/MsoCloudSiteNotFound.java | 56 + .../onap/so/openstack/exceptions/MsoException.java | 66 + .../openstack/exceptions/MsoExceptionCategory.java | 27 + .../exceptions/MsoHeatNotFoundException.java | 54 + .../so/openstack/exceptions/MsoIOException.java | 53 + .../exceptions/MsoNetworkAlreadyExists.java | 35 + .../openstack/exceptions/MsoNetworkNotFound.java | 35 + .../exceptions/MsoOpenstackException.java | 80 + .../exceptions/MsoStackAlreadyExists.java | 35 + .../so/openstack/exceptions/MsoStackNotFound.java | 44 + .../exceptions/MsoTenantAlreadyExists.java | 35 + .../so/openstack/exceptions/MsoTenantNotFound.java | 43 + .../so/openstack/mappers/NetworkInfoMapper.java | 107 + .../onap/so/openstack/mappers/StackInfoMapper.java | 99 + .../mso/adapters/json/MapDeserializer.java | 67 - .../openecomp/mso/adapters/json/MapSerializer.java | 63 - .../mso/adapters/nwrest/ContrailNetwork.java | 90 - .../mso/adapters/nwrest/CreateNetworkError.java | 45 - .../mso/adapters/nwrest/CreateNetworkRequest.java | 196 -- .../mso/adapters/nwrest/CreateNetworkResponse.java | 122 - .../mso/adapters/nwrest/DeleteNetworkError.java | 45 - .../mso/adapters/nwrest/DeleteNetworkRequest.java | 101 - .../mso/adapters/nwrest/DeleteNetworkResponse.java | 61 - .../adapters/nwrest/NetworkExceptionResponse.java | 69 - .../mso/adapters/nwrest/NetworkRequestCommon.java | 106 - .../mso/adapters/nwrest/NetworkResponseCommon.java | 82 - .../mso/adapters/nwrest/NetworkTechnology.java | 26 - .../mso/adapters/nwrest/ProviderVlanNetwork.java | 56 - .../mso/adapters/nwrest/QueryNetworkError.java | 31 - .../mso/adapters/nwrest/QueryNetworkResponse.java | 131 -- .../mso/adapters/nwrest/RollbackNetworkError.java | 45 - .../adapters/nwrest/RollbackNetworkRequest.java | 46 - .../adapters/nwrest/RollbackNetworkResponse.java | 52 - .../mso/adapters/nwrest/UpdateNetworkError.java | 45 - .../mso/adapters/nwrest/UpdateNetworkRequest.java | 196 -- .../mso/adapters/nwrest/UpdateNetworkResponse.java | 74 - .../providers/JettisonStyleMapperProvider.java | 53 - .../mso/adapters/sdncrest/RequestInformation.java | 115 - .../mso/adapters/sdncrest/SDNCErrorCommon.java | 37 - .../openecomp/mso/adapters/sdncrest/SDNCEvent.java | 141 -- .../mso/adapters/sdncrest/SDNCRequestCommon.java | 114 - .../mso/adapters/sdncrest/SDNCResponseCommon.java | 123 - .../mso/adapters/sdncrest/SDNCServiceError.java | 50 - .../mso/adapters/sdncrest/SDNCServiceRequest.java | 146 -- .../mso/adapters/sdncrest/SDNCServiceResponse.java | 77 - .../mso/adapters/sdncrest/ServiceInformation.java | 102 - .../mso/adapters/tenantrest/CreateTenantError.java | 71 - .../adapters/tenantrest/CreateTenantRequest.java | 96 - .../adapters/tenantrest/CreateTenantResponse.java | 84 - .../mso/adapters/tenantrest/DeleteTenantError.java | 71 - .../adapters/tenantrest/DeleteTenantRequest.java | 61 - .../adapters/tenantrest/DeleteTenantResponse.java | 41 - .../adapters/tenantrest/HealthCheckHandler.java | 51 - .../mso/adapters/tenantrest/QueryTenantError.java | 61 - .../adapters/tenantrest/QueryTenantResponse.java | 62 - .../adapters/tenantrest/RollbackTenantError.java | 67 - .../adapters/tenantrest/RollbackTenantRequest.java | 41 - .../tenantrest/RollbackTenantResponse.java | 41 - .../tenantrest/TenantExceptionResponse.java | 68 - .../adapters/tenantrest/TenantRequestCommon.java | 63 - .../mso/adapters/tenantrest/TenantRollback.java | 79 - .../adapters/vnfrest/CreateVfModuleRequest.java | 208 -- .../adapters/vnfrest/CreateVfModuleResponse.java | 105 - .../adapters/vnfrest/CreateVolumeGroupRequest.java | 148 -- .../vnfrest/CreateVolumeGroupResponse.java | 100 - .../adapters/vnfrest/DeleteVfModuleRequest.java | 92 - .../adapters/vnfrest/DeleteVfModuleResponse.java | 80 - .../adapters/vnfrest/DeleteVolumeGroupRequest.java | 82 - .../vnfrest/DeleteVolumeGroupResponse.java | 49 - .../adapters/vnfrest/QueryVfModuleResponse.java | 97 - .../adapters/vnfrest/QueryVolumeGroupResponse.java | 103 - .../adapters/vnfrest/RollbackVfModuleRequest.java | 45 - .../adapters/vnfrest/RollbackVfModuleResponse.java | 49 - .../vnfrest/RollbackVolumeGroupRequest.java | 44 - .../vnfrest/RollbackVolumeGroupResponse.java | 49 - .../adapters/vnfrest/UpdateVfModuleRequest.java | 215 -- .../adapters/vnfrest/UpdateVfModuleResponse.java | 85 - .../adapters/vnfrest/UpdateVolumeGroupRequest.java | 130 -- .../vnfrest/UpdateVolumeGroupResponse.java | 79 - .../vnfrest/VfModuleExceptionResponse.java | 75 - .../mso/adapters/vnfrest/VfModuleRollback.java | 130 -- .../mso/adapters/vnfrest/VfRequestCommon.java | 53 - .../mso/adapters/vnfrest/VfResponseCommon.java | 85 - .../vnfrest/VolumeGroupExceptionResponse.java | 45 - .../mso/adapters/vnfrest/VolumeGroupRollback.java | 128 -- .../openecomp/mso/openstack/beans/HeatStatus.java | 30 - .../openecomp/mso/openstack/beans/HostRoute.java | 69 - .../openecomp/mso/openstack/beans/MsoTenant.java | 66 - .../openecomp/mso/openstack/beans/NetworkInfo.java | 151 -- .../mso/openstack/beans/NetworkRollback.java | 152 -- .../mso/openstack/beans/NetworkStatus.java | 31 - .../org/openecomp/mso/openstack/beans/Pool.java | 69 - .../openecomp/mso/openstack/beans/RouteTarget.java | 56 - .../openecomp/mso/openstack/beans/StackInfo.java | 155 -- .../org/openecomp/mso/openstack/beans/Subnet.java | 207 -- .../openecomp/mso/openstack/beans/VnfRollback.java | 214 -- .../openecomp/mso/openstack/beans/VnfStatus.java | 30 - .../openstack/exceptions/MsoAdapterException.java | 45 - .../exceptions/MsoCloudIdentityNotFound.java | 49 - .../openstack/exceptions/MsoCloudSiteNotFound.java | 48 - .../mso/openstack/exceptions/MsoException.java | 66 - .../openstack/exceptions/MsoExceptionCategory.java | 27 - .../mso/openstack/exceptions/MsoIOException.java | 53 - .../exceptions/MsoNetworkAlreadyExists.java | 35 - .../openstack/exceptions/MsoNetworkNotFound.java | 35 - .../exceptions/MsoOpenstackException.java | 80 - .../exceptions/MsoStackAlreadyExists.java | 35 - .../mso/openstack/exceptions/MsoStackNotFound.java | 44 - .../exceptions/MsoTenantAlreadyExists.java | 32 - .../openstack/exceptions/MsoTenantNotFound.java | 43 - .../test/java/org/onap/so/adapters/BeansTest.java | 65 + .../network/mappers/ContrailSubnetMappersTest.java | 236 ++ .../so/adapters/nwrest/NetworkRequestTest.java | 50 + .../java/org/onap/so/adapters/vdu/BeansTest.java | 56 + .../exceptions/MsoAdapterExceptionTest.java | 43 + .../exceptions/MsoCloudIdentityNotFoundTest.java | 43 + .../exceptions/MsoCloudSiteNotFoundTest.java | 43 + .../openstack/exceptions/MsoIOExceptionTest.java | 42 + .../exceptions/MsoNetworkAlreadyExistsTest.java | 35 + .../exceptions/MsoNetworkNotFoundTest.java | 35 + .../exceptions/MsoOpenstackExceptionTest.java | 46 + .../exceptions/MsoStackAlreadyExistsTest.java | 34 + .../openstack/exceptions/MsoStackNotFoundTest.java | 34 + .../exceptions/MsoTenantAlreadyExistsTest.java | 34 + .../exceptions/MsoTenantNotFoundTest.java | 35 + .../openstack/mappers/NetworkInfoMapperTest.java | 124 ++ .../so/openstack/mappers/StackInfoMapperTest.java | 94 + .../java/org/openecomp/mso/adapters/BeanTest.java | 452 ---- .../mso/adapters/json/MapDeserializerTest.java | 57 - .../mso/adapters/json/MapSerializerTest.java | 56 - .../adapters/sdncrest/RequestInformationTest.java | 57 - .../mso/adapters/sdncrest/SDNCEventTest.java | 81 - .../adapters/sdncrest/SDNCServiceErrorTest.java | 51 - .../adapters/sdncrest/SDNCServiceRequestTest.java | 79 - .../adapters/sdncrest/SDNCServiceResponseTest.java | 58 - .../adapters/sdncrest/ServiceInformationTest.java | 42 - .../mso/openstack/beans/HostRouteTest.java | 48 - .../mso/openstack/beans/MsoTenantTest.java | 60 - .../mso/openstack/beans/NetworkInfoTest.java | 86 - .../mso/openstack/beans/NetworkRollbackTest.java | 151 -- .../openecomp/mso/openstack/beans/PoolTest.java | 48 - .../mso/openstack/beans/RouteTargetTest.java | 48 - .../mso/openstack/beans/StackInfoTest.java | 90 - .../openecomp/mso/openstack/beans/SubnetTest.java | 141 -- .../mso/openstack/beans/VnfRollbackTest.java | 179 -- .../exceptions/MsoAdapterExceptionTest.java | 26 - .../exceptions/MsoCloudIdentityNotFoundTest.java | 26 - .../exceptions/MsoCloudSiteNotFoundTest.java | 27 - .../openstack/exceptions/MsoIOExceptionTest.java | 26 - .../exceptions/MsoNetworkAlreadyExistsTest.java | 25 - .../exceptions/MsoNetworkNotFoundTest.java | 25 - .../exceptions/MsoOpenstackExceptionTest.java | 28 - .../exceptions/MsoStackAlreadyExistsTest.java | 25 - .../openstack/exceptions/MsoStackNotFoundTest.java | 25 - .../exceptions/MsoTenantAlreadyExistsTest.java | 25 - .../exceptions/MsoTenantNotFoundTest.java | 25 - .../src/test/resources/stack-example.json | 13 + adapters/mso-catalog-db-adapter/.gitignore | 1 + .../mso-catalog-db-adapter/.maven-dockerignore | 1 + .../WEB-INF/jboss-deployment-structure.xml | 22 - .../WebContent/WEB-INF/jboss-web.xml | 3 - .../WebContent/WEB-INF/web.xml | 64 - .../mso-catalog-db-adapter-dpl.yaml | 28 + .../mso-catalog-db-adapter-srv.yaml | 16 + adapters/mso-catalog-db-adapter/pom.xml | 174 +- .../adapters/catalogdb/CatalogDBApplication.java | 47 + .../CatalogDbRepositoryConfiguration.java | 43 + .../so/adapters/catalogdb/JerseyConfiguration.java | 55 + .../adapters/catalogdb/WebSecurityConfigImpl.java | 51 + .../catalogdb/catalogrest/CatalogQuery.java | 99 + .../catalogrest/CatalogQueryException.java | 58 + .../catalogrest/CatalogQueryExceptionCategory.java | 23 + .../catalogrest/CatalogQueryExceptionCommon.java | 75 + .../QueryAllottedResourceCustomization.java | 123 + .../catalogdb/catalogrest/QueryResourceRecipe.java | 75 + .../catalogdb/catalogrest/QueryServiceCsar.java | 72 + .../catalogrest/QueryServiceMacroHolder.java | 97 + .../catalogrest/QueryServiceNetworks.java | 117 + .../catalogdb/catalogrest/QueryServiceVnfs.java | 122 + .../catalogdb/catalogrest/QueryVfModule.java | 121 + .../catalogdb/rest/CatalogDbAdapterRest.java | 600 +++++ .../so/adapters/catalogdb/rest/package-info.java | 28 + .../adapters/catalogdb/CatalogDbAdapterRest.java | 573 ----- .../catalogdb/catalogrest/CatalogQuery.java | 92 - .../catalogrest/CatalogQueryException.java | 54 - .../catalogrest/CatalogQueryExceptionCategory.java | 22 - .../catalogrest/CatalogQueryExceptionCommon.java | 67 - .../QueryAllottedResourceCustomization.java | 119 - .../catalogdb/catalogrest/QueryResourceRecipe.java | 75 - .../catalogdb/catalogrest/QueryServiceCsar.java | 72 - .../catalogrest/QueryServiceMacroHolder.java | 95 - .../catalogrest/QueryServiceNetworks.java | 113 - .../catalogdb/catalogrest/QueryServiceVnfs.java | 121 - .../catalogdb/catalogrest/QueryVfModule.java | 119 - .../src/main/resources/application-local.yaml | 51 + .../src/main/resources/application.yaml | 55 + .../migration/V1810.1__AddModelAndModelRecipe.sql | 31 + .../resources/db/migration/V1__Base_version.sql | 343 +++ .../V2.0.0__Modify_Resource_Relationships.sql | 247 ++ ...2.0.1__Modify_Resource_Relationships_Alters.sql | 208 ++ .../migration/V2.10__VNFCInstanceGroupChanges.sql | 7 + .../db/migration/V2.11__Modify_IS_Base_Type.sql | 4 + .../V2.12__UpdateMacroReferenceData_Homing.sql | 4 + ..._external_service_to_internal_model_mapping.sql | 4 + .../migration/V2.14__DeactivateAndCloudDelete.sql | 10 + ...Valid_Action_State_Transition_Table_Updates.sql | 93 + ...K_To_Building_Block_Detail_Pre_New_Solution.sql | 4 + .../V2.17__DeactivateAndCloudDeleteChanges.sql | 8 + .../V2.18__AlterVNFRecipeVnfTypeColumnName.sql | 9 + .../migration/V2.1__Update_Recipe_For_API_Flag.sql | 34 + .../db/migration/V2.2__ONAP_TABLE_CHANGES.sql | 30 + .../db/migration/V2.3__MacroTableChanges.sql | 24 + .../db/migration/V2.4__MacroReferenceData1806.sql | 130 ++ .../migration/V2.5__RainyDayHandlerMacroData.sql | 45 + .../migration/V2.6__NorthboundAddTopLevelFlow.sql | 28 + .../db/migration/V2.7__VNFCInstanceGroup1806.sql | 57 + ...hestrationStatus_ValidActionStateTransition.sql | 398 ++++ .../migration/V2.9__UpdateIsTopLevelFlowColumn.sql | 4 + ...3.1__AddServiceMacroDeactivateToMacroTables.sql | 7 + .../V3.2__ChangeMINApiVersionInNorthbound.sql | 5 + ...__ChangeMINApiVersionServiceMacroDeactivate.sql | 3 + .../migration/V3.4__AddUpdateNetworkALaCarte.sql | 20 + ...GrApiDefault_To_UpdateVfModuleVolumeInfraV1.sql | 4 + .../V3.6__UpdateNetworkCollectionCatalogDB.sql | 38 + .../V3.7__FixDeactivateNetworkCollection.sql | 5 + .../V3.8__UnassignFabricConfigurationData.sql | 31 + .../db/migration/V3.9__DropCRModelUUID_FK.sql | 3 + .../src/main/resources/static/index.html | 41 + .../src/main/resources/static/readme/index.html | 53 + .../src/main/resources/static/readme/install.html | 34 + .../src/main/resources/static/readme/jars.html | 34 + .../src/main/resources/static/readme/layout.html | 34 + .../src/main/resources/static/readme/logging.html | 34 + .../src/main/resources/static/readme/onaplogo.png | Bin 0 -> 21360 bytes .../main/resources/static/readme/packaging.html | 34 + .../src/main/resources/static/readme/page.html | 67 + .../src/main/resources/static/readme/readme.css | 114 + .../src/main/resources/static/readme/spring.html | 34 + .../src/main/resources/static/readme/tools.html | 34 + .../resources/static/swagger/favicon-16x16.png | Bin 0 -> 445 bytes .../resources/static/swagger/favicon-32x32.png | Bin 0 -> 1141 bytes .../src/main/resources/static/swagger/index.html | 95 + .../resources/static/swagger/oauth2-redirect.html | 60 + .../resources/static/swagger/swagger-ui-bundle.js | 99 + .../static/swagger/swagger-ui-standalone-preset.js | 13 + .../main/resources/static/swagger/swagger-ui.css | 2 + .../resources/static/swagger/swagger-ui.css.map | 1 + .../main/resources/static/swagger/swagger-ui.js | 8 + .../adapters/catalogdb/EmbeddedMariaDbConfig.java | 60 + .../catalogdb/catalogrest/CatalogDBRestTest.java | 782 +++++++ .../catalogrest/CatalogQueryExceptionTest.java | 55 + .../NetworkCollectionCatalogDbQueryTest.java | 153 ++ .../catalogrest/QueryResourceRecipeTest.java | 70 + .../catalogrest/QueryServiceCsarTest.java | 69 + .../catalogdb/catalogrest/QueryVfModuleTest.java | 100 + .../catalogdb/catalogrest/TestAppender.java | 37 + .../catalogdb/CatalogDbAdapterRestClassTest.java | 380 ---- .../catalogdb/CatalogDbAdapterRestHttpTest.java | 490 ---- .../catalogdb/CatalogDbAdapterRestTest.java | 103 - .../catalogrest/CatalogQueryExceptionTest.java | 55 - .../catalogdb/catalogrest/CatalogQueryTest.java | 155 -- .../QueryAllottedResourceCustomizationTest.java | 67 - .../catalogrest/QueryResourceRecipeTest.java | 74 - .../catalogrest/QueryServiceCsarTest.java | 75 - .../catalogrest/QueryServiceMarcoHolderTest.java | 74 - .../catalogrest/QueryServiceNetworksTest.java | 72 - .../catalogrest/QueryServiceVnfsTest.java | 73 - .../catalogdb/catalogrest/QueryVfModuleTest.java | 96 - .../src/test/resources/application-test.yaml | 70 + .../test/resources/db/migration/afterMigrate.sql | 198 ++ .../src/test/resources/logback-test.xml | 50 + .../response/expectedServiceResponse.json | 78 + .../response/expectedServiceResponseV2.json | 78 + .../test/resources/response/serviceResponse.json | 78 + .../mso-network-adapter-async-client/README.md | 0 .../WebContent/META-INF/MANIFEST.MF | 3 - adapters/mso-network-adapter-async-client/pom.xml | 91 - .../src/main/resources/NetworkAdapterNotify.wsdl | 295 --- adapters/mso-network-adapter/README | 0 .../WebContent/META-INF/MANIFEST.MF | 3 - ....openstack.base.client.OpenStackClientConnector | 1 - .../WEB-INF/jboss-deployment-structure.xml | 21 - .../WebContent/WEB-INF/jboss-web.xml | 3 - .../mso-network-adapter/WebContent/WEB-INF/web.xml | 122 - adapters/mso-network-adapter/WebContent/check.html | 10 - adapters/mso-network-adapter/pom.xml | 178 -- .../mso/adapters/network/BpelRestClient.java | 283 --- .../mso/adapters/network/ContrailPolicyRef.java | 75 - .../mso/adapters/network/ContrailPolicyRefSeq.java | 66 - .../mso/adapters/network/ContrailSubnet.java | 212 -- .../adapters/network/ContrailSubnetHostRoute.java | 67 - .../adapters/network/ContrailSubnetHostRoutes.java | 58 - .../mso/adapters/network/ContrailSubnetIp.java | 59 - .../mso/adapters/network/ContrailSubnetPool.java | 68 - .../mso/adapters/network/HealthCheckHandler.java | 67 - .../mso/adapters/network/MsoNetworkAdapter.java | 222 -- .../adapters/network/MsoNetworkAdapterAsync.java | 106 - .../network/MsoNetworkAdapterAsyncImpl.java | 686 ------ .../adapters/network/MsoNetworkAdapterImpl.java | 2243 ------------------- .../mso/adapters/network/NetworkAdapterRest.java | 606 ----- .../network/exceptions/NetworkException.java | 81 - .../network/exceptions/NetworkExceptionBean.java | 73 - .../mso/adapters/network/BpelRestClientTest.java | 97 - .../adapters/network/ContrailPolicyRefSeqTest.java | 36 - .../adapters/network/ContrailPolicyRefTest.java | 39 - .../network/ContrailSubnetHostRouteTest.java | 40 - .../network/ContrailSubnetHostRoutesTest.java | 40 - .../network/MsoNetworkAdapterAsyncImplTest.java | 92 - .../network/MsoNetworkAdapterImplTest.java | 1193 ---------- .../adapters/network/NetworkAdapterRestTest.java | 657 ------ .../mso/adapters/network/NetworkAdapterTest.java | 298 --- .../mso/adapters/network/NetworkBeansTest.java | 111 - .../exceptions/NetworkExceptionBeanTest.java | 41 - .../network/exceptions/NetworkExceptionTest.java | 48 - .../src/test/resources/logback-test.xml | 48 - adapters/mso-openstack-adapters/.gitignore | 24 + .../.mvn/wrapper/maven-wrapper.jar | Bin 0 -> 47610 bytes .../.mvn/wrapper/maven-wrapper.properties | 1 + .../Deployment/Dockerfile.adapters | 40 + .../mso-openstack-adapters/Deployment/pod_rc.yaml | 21 + .../mso-openstack-adapters/Deployment/pod_svc.yaml | 14 + adapters/mso-openstack-adapters/mvnw | 225 ++ adapters/mso-openstack-adapters/mvnw.cmd | 143 ++ adapters/mso-openstack-adapters/pom.xml | 268 +++ .../onap/so/adapters/network/BpelRestClient.java | 298 +++ .../so/adapters/network/ContrailPolicyRef.java | 75 + .../so/adapters/network/ContrailPolicyRefSeq.java | 66 + .../onap/so/adapters/network/ContrailSubnet.java | 214 ++ .../adapters/network/ContrailSubnetHostRoute.java | 67 + .../adapters/network/ContrailSubnetHostRoutes.java | 58 + .../onap/so/adapters/network/ContrailSubnetIp.java | 59 + .../so/adapters/network/ContrailSubnetPool.java | 68 + .../so/adapters/network/MsoNetworkAdapter.java | 222 ++ .../adapters/network/MsoNetworkAdapterAsync.java | 106 + .../network/MsoNetworkAdapterAsyncImpl.java | 698 ++++++ .../so/adapters/network/MsoNetworkAdapterImpl.java | 2125 ++++++++++++++++++ .../so/adapters/network/NetworkAdapterRest.java | 671 ++++++ .../async/client/CreateNetworkNotification.java | 437 ++++ .../client/CreateNetworkNotificationResponse.java | 51 + .../async/client/DeleteNetworkNotification.java | 181 ++ .../client/DeleteNetworkNotificationResponse.java | 51 + .../network/async/client/MsoExceptionCategory.java | 61 + .../adapters/network/async/client/MsoRequest.java | 106 + .../network/async/client/NetworkAdapterNotify.java | 191 ++ .../async/client/NetworkAdapterNotify_Service.java | 110 + .../network/async/client/NetworkRollback.java | 370 +++ .../network/async/client/NetworkStatus.java | 65 + .../network/async/client/ObjectFactory.java | 298 +++ .../async/client/QueryNetworkNotification.java | 497 +++++ .../client/QueryNetworkNotificationResponse.java | 51 + .../async/client/RollbackNetworkNotification.java | 154 ++ .../RollbackNetworkNotificationResponse.java | 51 + .../async/client/UpdateNetworkNotification.java | 383 ++++ .../client/UpdateNetworkNotificationResponse.java | 51 + .../network/async/client/package-info.java | 21 + .../network/exceptions/NetworkException.java | 80 + .../network/exceptions/NetworkExceptionBean.java | 73 + .../so/adapters/openstack/CXFConfiguration.java | 190 ++ .../openstack/MsoOpenstackAdaptersApplication.java | 73 + .../adapters/openstack/WebSecurityConfigImpl.java | 51 + .../onap/so/adapters/tenant/MsoTenantAdapter.java | 77 + .../so/adapters/tenant/MsoTenantAdapterImpl.java | 295 +++ .../onap/so/adapters/tenant/TenantAdapterRest.java | 345 +++ .../tenant/exceptions/TenantAlreadyExists.java | 45 + .../tenant/exceptions/TenantException.java | 75 + .../tenant/exceptions/TenantExceptionBean.java | 64 + .../so/adapters/valet/GenericValetResponse.java | 71 + .../org/onap/so/adapters/valet/ValetClient.java | 326 +++ .../onap/so/adapters/valet/beans/HeatRequest.java | 125 ++ .../adapters/valet/beans/ValetConfirmRequest.java | 65 + .../adapters/valet/beans/ValetConfirmResponse.java | 30 + .../adapters/valet/beans/ValetCreateRequest.java | 134 ++ .../adapters/valet/beans/ValetCreateResponse.java | 70 + .../adapters/valet/beans/ValetDeleteRequest.java | 84 + .../adapters/valet/beans/ValetDeleteResponse.java | 66 + .../adapters/valet/beans/ValetRollbackRequest.java | 81 + .../valet/beans/ValetRollbackResponse.java | 29 + .../onap/so/adapters/valet/beans/ValetStatus.java | 81 + .../adapters/valet/beans/ValetUpdateRequest.java | 134 ++ .../adapters/valet/beans/ValetUpdateResponse.java | 71 + .../mapper/VfModuleCustomizationToVduMapper.java | 127 ++ .../org/onap/so/adapters/vnf/BpelRestClient.java | 296 +++ .../main/java/org/onap/so/adapters/vnf/CSAR.java | 192 ++ .../org/onap/so/adapters/vnf/MsoVnfAdapter.java | 147 ++ .../onap/so/adapters/vnf/MsoVnfAdapterAsync.java | 105 + .../so/adapters/vnf/MsoVnfAdapterAsyncImpl.java | 666 ++++++ .../onap/so/adapters/vnf/MsoVnfAdapterImpl.java | 2347 ++++++++++++++++++++ .../so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java | 1218 ++++++++++ .../so/adapters/vnf/MsoVnfPluginAdapterImpl.java | 1229 ++++++++++ .../java/org/onap/so/adapters/vnf/VfRollback.java | 137 ++ .../org/onap/so/adapters/vnf/VnfAdapterRest.java | 691 ++++++ .../onap/so/adapters/vnf/VnfAdapterRestUtils.java | 94 + .../org/onap/so/adapters/vnf/VnfAdapterRestV2.java | 704 ++++++ .../onap/so/adapters/vnf/VolumeAdapterRest.java | 646 ++++++ .../onap/so/adapters/vnf/VolumeAdapterRestV2.java | 648 ++++++ .../vnf/async/client/CreateVnfNotification.java | 410 ++++ .../vnf/async/client/DeleteVnfNotification.java | 154 ++ .../vnf/async/client/MsoExceptionCategory.java | 61 + .../so/adapters/vnf/async/client/MsoRequest.java | 106 + .../adapters/vnf/async/client/ObjectFactory.java | 208 ++ .../vnf/async/client/QueryVnfNotification.java | 437 ++++ .../vnf/async/client/RollbackVnfNotification.java | 154 ++ .../vnf/async/client/UpdateVnfNotification.java | 383 ++++ .../vnf/async/client/VnfAdapterNotify.java | 177 ++ .../vnf/async/client/VnfAdapterNotify_Service.java | 110 + .../so/adapters/vnf/async/client/VnfRollback.java | 198 ++ .../so/adapters/vnf/async/client/VnfStatus.java | 61 + .../so/adapters/vnf/async/client/package-info.java | 21 + .../adapters/vnf/exceptions/VnfAlreadyExists.java | 42 + .../so/adapters/vnf/exceptions/VnfException.java | 80 + .../adapters/vnf/exceptions/VnfExceptionBean.java | 74 + .../so/adapters/vnf/exceptions/VnfNotFound.java | 41 + .../java/org/onap/so/vdu/utils/VduBlueprint.java | 90 + .../main/java/org/onap/so/vdu/utils/VduInfo.java | 130 ++ .../main/java/org/onap/so/vdu/utils/VduPlugin.java | 248 +++ .../main/java/org/onap/so/vdu/utils/VduStatus.java | 37 + .../src/main/resources/NetworkAdapterNotify.wsdl | 295 +++ .../src/main/resources/VnfAdapterNotify.wsdl | 218 ++ .../src/main/resources/application-local.yaml | 134 ++ .../src/main/resources/application.yaml | 40 + .../src/main/resources/static/index.html | 35 + .../resources/static/swagger/favicon-16x16.png | Bin 0 -> 445 bytes .../resources/static/swagger/favicon-32x32.png | Bin 0 -> 1141 bytes .../src/main/resources/static/swagger/index.html | 110 + .../resources/static/swagger/oauth2-redirect.html | 60 + .../resources/static/swagger/swagger-ui-bundle.js | 99 + .../static/swagger/swagger-ui-standalone-preset.js | 13 + .../main/resources/static/swagger/swagger-ui.css | 2 + .../resources/static/swagger/swagger-ui.css.map | 1 + .../main/resources/static/swagger/swagger-ui.js | 8 + .../src/main/resources/static/swagger/welcome.html | 1 + .../main/resources/wsdl/NetworkAdapterNotify.wsdl | 295 +++ .../src/main/resources/wsdl/VnfAdapterNotify.wsdl | 218 ++ .../src/test/java/org/onap/so/BeansTest.java | 90 + .../EmbeddedMariaDbConfig.java | 60 + .../HealthCheckHandlerTest.java | 47 + .../TestRestTemplateFactory.java | 50 + .../so/adapters/network/BpelRestClientTest.java | 55 + .../adapters/network/ContrailPolicyRefSeqTest.java | 36 + .../so/adapters/network/ContrailPolicyRefTest.java | 39 + .../network/ContrailSubnetHostRouteTest.java | 41 + .../network/ContrailSubnetHostRoutesTest.java | 40 + .../network/MSONetworkAdapterImplTest.java | 533 +++++ .../network/MsoNetworkAdapterAsyncImplTest.java | 265 +++ .../adapters/network/NetworkAdapterRestTest.java | 282 +++ .../exceptions/NetworkExceptionBeanTest.java | 41 + .../network/exceptions/NetworkExceptionTest.java | 50 + .../adapters/tenant/MsoTenantAdapterImplTest.java | 73 + .../so/adapters/tenant/TenantAdapterRestTest.java | 254 +++ .../tenant/exceptions/TenantAlreadyExistsTest.java | 32 + .../tenant/exceptions/TenantExceptionBeanTest.java | 47 + .../tenant/exceptions/TenantExceptionTest.java | 49 + .../onap/so/adapters/valet/ValetClientTest.java | 116 + .../onap/so/adapters/vnf/BaseRestTestUtils.java | 101 + .../onap/so/adapters/vnf/BpelRestClientTest.java | 54 + .../adapters/vnf/MsoVnfAdapterAsyncImplTest.java | 158 ++ .../so/adapters/vnf/MsoVnfAdapterImplTest.java | 562 +++++ .../vnf/MsoVnfCloudifyAdapterImplTest.java | 319 +++ .../adapters/vnf/MsoVnfPluginAdapterImplTest.java | 167 ++ .../java/org/onap/so/adapters/vnf/QueryTest.java | 108 + .../org/onap/so/adapters/vnf/VfRollbackTest.java | 70 + .../onap/so/adapters/vnf/VnfAdapterRestTest.java | 560 +++++ .../so/adapters/vnf/VolumeAdapterRestTest.java | 189 ++ .../so/adapters/vnf/VolumeAdapterRestV2Test.java | 184 ++ .../so/adapters/vnf/VolumeGroupAdapterCommon.java | 134 ++ .../java/org/onap/so/bpmn/mock/StubOpenStack.java | 485 ++++ .../org/onap/so/vdu/utils/VduBlueprintTest.java | 77 + .../java/org/onap/so/vdu/utils/VduInfoTest.java | 89 + .../src/test/resources/CreateNetwork.json | 42 + .../src/test/resources/CreateNetwork.xml | 17 + .../resources/CreateNetwork_Fail_If_Exist_True.xml | 17 + .../resources/CreateNetwork_InvalidCloudSiteId.xml | 17 + .../test/resources/CreateNetwork_NEUTRON_Mode.xml | 17 + ...eateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml | 17 + .../src/test/resources/DeleteNetwork.xml | 15 + ....openstack.base.client.OpenStackClientConnector | 1 + .../src/test/resources/QueryNetwork.xml | 13 + .../src/test/resources/UpdateNetwork.xml | 23 + .../resources/__files/CreateNetworkRequest.xml | 49 + .../resources/__files/CreateNetworkResponse.json | 25 + .../resources/__files/CreateNetworkResponse2.json | 25 + .../__files/CreateTenantResponse_Created.json | 16 + .../__files/CreateTenantResponse_Exists.json | 15 + .../resources/__files/CreateVfModuleResponse.json | 26 + .../resources/__files/DeleteNetworkResponse.json | 6 + .../__files/DeleteTenantResponse_Failed.json | 5 + .../__files/DeleteTenantResponse_Success.json | 5 + .../resources/__files/DeleteVfModuleResponse.json | 7 + .../test/resources/__files/GetNeutronNetwork.json | 45 + .../OpenstackCreateNeutronNetworkResponse.json | 11 + .../__files/OpenstackGetNeutronNetworks.json | 22 + .../resources/__files/OpenstackRequest_Tenant.json | 7 + .../__files/OpenstackResponse_Access.json | 40 + .../__files/OpenstackResponse_Access_Admin.json | 27 + .../OpenstackResponse_Access_queryNetwork.json | 27 + .../__files/OpenstackResponse_Metadata.json | 5 + .../resources/__files/OpenstackResponse_Roles.json | 10 + .../resources/__files/OpenstackResponse_Stack.json | 17 + .../__files/OpenstackResponse_StackId.json | 14 + .../__files/OpenstackResponse_Stack_Created.json | 17 + .../OpenstackResponse_Stack_Created_VfModule.json | 17 + .../OpenstackResponse_Stack_DeleteComplete.json | 17 + .../OpenstackResponse_Stack_Failed_VfModule.json | 17 + .../OpenstackResponse_Stack_UpdateComplete.json | 17 + .../OpenstackResponse_Stack_Updating_VfModule.json | 17 + .../__files/OpenstackResponse_Tenant.json | 8 + .../resources/__files/OpenstackResponse_User.json | 11 + .../__files/OpenstackResponse_VnfBaseStackId.json | 12 + .../__files/OpenstackResponse_VnfStackId.json | 20 + .../__files/RollbackVfModuleResponse.json | 5 + .../resources/__files/UpdateNetworkResponse.json | 8 + .../resources/__files/UpdateVfModuleResponse.json | 5 + .../test/resources/__files/ValetCreateRequest.json | 9 + .../test/resources/__files/ValetDeleteRequest.json | 6 + .../src/test/resources/application-test.yaml | 137 ++ .../src/test/resources/cloud_config.json | 258 +++ .../src/test/resources/data.sql | 145 ++ .../src/test/resources/logback-test.xml | 52 + .../src/test/resources/mso.properties | 27 + .../src/test/resources/schema.sql | 784 +++++++ .../WebContent/META-INF/MANIFEST.MF | 3 - .../WebContent/WEB-INF/beans.xml | 0 .../WEB-INF/jboss-deployment-structure.xml | 22 - .../WebContent/WEB-INF/jboss-web.xml | 3 - .../WebContent/WEB-INF/web.xml | 104 - .../mso-requests-db-adapter/WebContent/index.xhtml | 19 - adapters/mso-requests-db-adapter/pom.xml | 249 ++- .../requestsdb/ArchiveInfraRequestsScheduler.java | 156 ++ .../adapters/requestsdb/MsoRequestsDbAdapter.java | 102 + .../requestsdb/MsoRequestsDbAdapterImpl.java | 326 +++ .../so/adapters/requestsdb/RequestStatusType.java | 70 + .../so/adapters/requestsdb/ResponseStatus.java | 28 + .../adapters/requestsdb/WebSecurityConfigImpl.java | 51 + .../requestsdb/application/CXFConfiguration.java | 78 + .../application/MSORequestDBApplication.java | 70 + .../requestsdb/application/RequestDBConfig.java | 80 + .../exceptions/MsoRequestsDbException.java | 62 + .../exceptions/MsoRequestsDbExceptionBean.java | 50 + .../adapters/requestsdb/HealthCheckHandler.java | 60 - .../adapters/requestsdb/MsoRequestsDbAdapter.java | 94 - .../requestsdb/MsoRequestsDbAdapterImpl.java | 400 ---- .../mso/adapters/requestsdb/RequestStatusType.java | 70 - .../mso/adapters/requestsdb/ResponseStatus.java | 33 - .../openecomp/mso/adapters/requestsdb/Status.java | 40 - .../exceptions/MsoRequestsDbException.java | 62 - .../exceptions/MsoRequestsDbExceptionBean.java | 50 - .../src/main/java/resources/application.properties | 28 - .../src/main/resources/application-local.yaml | 47 + .../src/main/resources/application.yaml | 47 + .../resources/db/migration/V1__Base_version.sql | 155 ++ .../V2.1__Add_Identifiers_Active_Requests.sql | 9 + .../db/migration/V2.2__Add_Operation_Status.sql | 30 + .../V2.3__Remove_Invalid_requestdb_data.sql | 5 + .../V2.4__Activate_Requests_Nullable_Coulmns.sql | 6 + .../db/migration/V2.5__Archived_Infra_Requests.sql | 51 + .../main/resources/db/migration/V2.6__shedlock.sql | 9 + .../V2.7__Update_Status_Message_ColumnTypes.sql | 8 + .../ArchiveInfraRequestsSchedulerTest.java | 106 + .../adapters/HealthCheckHandlerTest.java | 73 + .../requestsdb/adapters/MSORequestDBImplTest.java | 460 ++++ .../application/EmbeddedMariaDbConfig.java | 102 + .../exceptions/MsoRequestsDbExceptionBeanTest.java | 43 + .../exceptions/MsoRequestsDbExceptionTest.java | 66 + .../requestsdb/HealthCheckHandlerTest.java | 67 - .../requestsdb/MsoRequestsDbAdapterImplTest.java | 74 - .../exceptions/MsoRequestsDbExceptionBeanTest.java | 43 - .../exceptions/MsoRequestsDbExceptionTest.java | 66 - .../src/test/resources/application-test.yaml | 52 + .../test/resources/db/migration/afterMigrate.sql | 32 + .../src/test/resources/logback-test.xml | 33 + .../resources/wsdl/MsoRequestsDbAdapterImpl.wsdl | 295 +++ adapters/mso-sdnc-adapter/.maven-dockerignore | 1 + adapters/mso-sdnc-adapter/.tern-project | 17 + .../WebContent/META-INF/MANIFEST.MF | 4 - .../WEB-INF/jboss-deployment-structure.xml | 22 - .../WebContent/WEB-INF/jboss-web.xml | 4 - .../mso-sdnc-adapter/WebContent/WEB-INF/web.xml | 132 -- adapters/mso-sdnc-adapter/WebContent/check.html | 10 - adapters/mso-sdnc-adapter/pom.xml | 206 +- adapters/mso-sdnc-adapter/readme | 56 +- .../onap/so/adapters/sdnc/AsyncConfiguration.java | 31 + .../onap/so/adapters/sdnc/CXFConfiguration.java | 107 + .../org/onap/so/adapters/sdnc/ObjectFactory.java | 77 + .../org/onap/so/adapters/sdnc/RequestHeader.java | 219 ++ .../so/adapters/sdnc/SDNCAdapterApplication.java | 73 + .../onap/so/adapters/sdnc/SDNCAdapterPortType.java | 53 + .../onap/so/adapters/sdnc/SDNCAdapterRequest.java | 128 ++ .../onap/so/adapters/sdnc/SDNCAdapterResponse.java | 53 + .../onap/so/adapters/sdnc/SDNCAdapterService.java | 126 ++ .../onap/so/adapters/sdnc/SyncConfiguration.java | 28 + .../so/adapters/sdnc/WebSecurityConfigImpl.java | 51 + .../so/adapters/sdnc/client/CallbackHeader.java | 155 ++ .../so/adapters/sdnc/client/ObjectFactory.java | 68 + .../sdnc/client/SDNCAdapterCallbackRequest.java | 137 ++ .../sdnc/client/SDNCCallbackAdapterPortType.java | 53 + .../sdnc/client/SDNCCallbackAdapterService.java | 126 ++ .../onap/so/adapters/sdnc/client/package-info.java | 23 + .../sdnc/exception/SDNCAdapterException.java | 30 + .../org/onap/so/adapters/sdnc/impl/Constants.java | 48 + .../so/adapters/sdnc/impl/MapRequestTunables.java | 102 + .../so/adapters/sdnc/impl/RequestTunables.java | 161 ++ .../sdnc/impl/SDNCAdapterPortTypeImpl.java | 84 + .../onap/so/adapters/sdnc/impl/SDNCResponse.java | 73 + .../onap/so/adapters/sdnc/impl/SDNCRestClient.java | 333 +++ .../java/org/onap/so/adapters/sdnc/impl/Utils.java | 199 ++ .../org/onap/so/adapters/sdnc/package-info.java | 23 + .../so/adapters/sdnc/sdncrest/BPRestCallback.java | 174 ++ .../sdnc/sdncrest/MapTypedRequestTunablesData.java | 109 + .../adapters/sdnc/sdncrest/SDNCAdapterUtils.java | 75 + .../so/adapters/sdnc/sdncrest/SDNCConnector.java | 329 +++ .../sdnc/sdncrest/SDNCServiceRequestConnector.java | 207 ++ .../sdnc/sdncrest/SDNCServiceRequestTask.java | 230 ++ .../so/adapters/sdnc/sdncrest/SNIROResponse.java | 92 + .../sdnc/sdncrest/TypedRequestTunables.java | 180 ++ .../so/adapters/sdnc/util/SDNCRequestIdUtil.java | 39 + .../openecomp/mso/adapters/sdnc/ObjectFactory.java | 77 - .../openecomp/mso/adapters/sdnc/RequestHeader.java | 219 -- .../mso/adapters/sdnc/SDNCAdapterPortType.java | 53 - .../mso/adapters/sdnc/SDNCAdapterRequest.java | 129 -- .../mso/adapters/sdnc/SDNCAdapterResponse.java | 53 - .../mso/adapters/sdnc/SDNCAdapterService.java | 127 -- .../mso/adapters/sdnc/client/CallbackHeader.java | 155 -- .../mso/adapters/sdnc/client/ObjectFactory.java | 68 - .../sdnc/client/SDNCAdapterCallbackRequest.java | 136 -- .../sdnc/client/SDNCCallbackAdapterPortType.java | 52 - .../sdnc/client/SDNCCallbackAdapterService.java | 125 -- .../mso/adapters/sdnc/client/package-info.java | 23 - .../mso/adapters/sdnc/impl/Constants.java | 48 - .../mso/adapters/sdnc/impl/RequestTunables.java | 223 -- .../sdnc/impl/SDNCAdapterPortTypeImpl.java | 102 - .../adapters/sdnc/impl/SDNCAdapterRestImpl.java | 191 -- .../mso/adapters/sdnc/impl/SDNCResponse.java | 73 - .../mso/adapters/sdnc/impl/SDNCRestClient.java | 347 --- .../openecomp/mso/adapters/sdnc/impl/Utils.java | 198 -- .../adapters/sdnc/notify/SDNCNotifyResource.java | 192 -- .../openecomp/mso/adapters/sdnc/package-info.java | 23 - .../mso/adapters/sdnc/sdncrest/BPRestCallback.java | 170 -- .../sdnc/sdncrest/SDNCAdapterProperties.java | 85 - .../adapters/sdnc/sdncrest/SDNCAdapterRest.java | 239 -- .../adapters/sdnc/sdncrest/SDNCAdapterUtils.java | 74 - .../mso/adapters/sdnc/sdncrest/SDNCConnector.java | 317 --- .../adapters/sdnc/sdncrest/SDNCEventParser.java | 161 -- .../sdnc/sdncrest/SDNCServiceRequestConnector.java | 199 -- .../sdnc/sdncrest/SDNCServiceRequestTask.java | 213 -- .../mso/adapters/sdnc/sdncrest/SNIROResponse.java | 78 - .../sdnc/sdncrest/TypedRequestTunables.java | 224 -- .../mso/adapters/sdnc/util/SDNCRequestIdUtil.java | 39 - .../src/main/resources/SDNCAdapter.wsdl | 10 +- .../src/main/resources/SDNCAdapterSchema.xsd | 6 +- .../src/main/resources/SDNCCallbackAdapter.wsdl | 10 +- .../src/main/resources/application-local.yaml | 131 ++ .../src/main/resources/application.yaml | 22 + .../src/main/resources/static/index.html | 41 + .../src/main/resources/static/readme/index.html | 53 + .../src/main/resources/static/readme/install.html | 34 + .../src/main/resources/static/readme/jars.html | 34 + .../src/main/resources/static/readme/layout.html | 34 + .../src/main/resources/static/readme/logging.html | 34 + .../src/main/resources/static/readme/onaplogo.png | Bin 0 -> 21360 bytes .../main/resources/static/readme/packaging.html | 34 + .../src/main/resources/static/readme/page.html | 67 + .../src/main/resources/static/readme/readme.css | 114 + .../src/main/resources/static/readme/spring.html | 34 + .../src/main/resources/static/readme/tools.html | 34 + .../resources/static/swagger/favicon-16x16.png | Bin 0 -> 445 bytes .../resources/static/swagger/favicon-32x32.png | Bin 0 -> 1141 bytes .../src/main/resources/static/swagger/index.html | 95 + .../resources/static/swagger/oauth2-redirect.html | 60 + .../resources/static/swagger/swagger-ui-bundle.js | 99 + .../static/swagger/swagger-ui-standalone-preset.js | 13 + .../main/resources/static/swagger/swagger-ui.css | 2 + .../resources/static/swagger/swagger-ui.css.map | 1 + .../main/resources/static/swagger/swagger-ui.js | 8 + .../java/org/onap/so/adapters/sdnc/BaseTest.java | 52 + .../java/org/onap/so/adapters/sdnc/FileUtil.java | 76 + .../onap/so/adapters/sdnc/ObjectFactoryTest.java | 113 + .../so/adapters/sdnc/SDNCAdapterRequestTest.java | 57 + .../adapters/sdnc/client/CallbackHeaderTest.java | 49 + .../client/SDNCAdapterCallbackRequestTest.java | 57 + .../adapters/sdnc/impl/MapRequestTunablesTest.java | 128 ++ .../sdnc/impl/SDNCAdapterPortTypeImplTest.java | 111 + .../so/adapters/sdnc/impl/SDNCResponseTest.java | 49 + .../so/adapters/sdnc/impl/SDNCRestClientTest.java | 54 + .../org/onap/so/adapters/sdnc/impl/UtilsTest.java | 64 + .../adapters/sdnc/sdncrest/ObjectMappingTest.java | 479 ++++ .../adapters/sdnc/sdncrest/SDNCConnectorTest.java | 63 + .../sdncrest/SDNCServiceRequestConnectorTest.java | 39 + .../adapters/sdnc/util/SDNCRequestIdUtilTest.java | 46 + .../mso/adapters/sdnc/ObjectFactoryTest.java | 113 - .../mso/adapters/sdnc/SDNCAdapterRequestTest.java | 57 - .../adapters/sdnc/client/CallbackHeaderTest.java | 49 - .../client/SDNCAdapterCallbackRequestTest.java | 57 - .../mso/adapters/sdnc/impl/InvestigationTest.java | 114 - .../adapters/sdnc/impl/RequestTunablesTest.java | 86 - .../sdnc/impl/SDNCAdapterRestImplTest.java | 79 - .../mso/adapters/sdnc/impl/SDNCResponseTest.java | 49 - .../sdnc/notify/SDNCNotifyResourceTest.java | 52 - .../adapters/sdnc/sdncrest/BPRestCallbackTest.java | 38 - .../adapters/sdnc/sdncrest/ObjectMappingTest.java | 478 ---- .../sdnc/sdncrest/TypedRequestTunablesTest.java | 48 - .../adapters/sdnc/util/SDNCRequestIdUtilTest.java | 45 - .../src/test/resources/SdncServiceResponse.xml | 12 + .../src/test/resources/application-test.properties | 102 + .../src/test/resources/logback-test.xml | 25 +- .../src/test/resources/mso.properties | 42 - .../src/test/resources/mso.sdnc.properties | 152 -- .../src/test/resources/sdncTestPayload.xml | 34 + .../src/test/resources/sdnc_adapter_request.xml | 10 +- adapters/mso-tenant-adapter/README.md | 0 .../WebContent/META-INF/MANIFEST.MF | 3 - ....openstack.base.client.OpenStackClientConnector | 1 - .../WEB-INF/jboss-deployment-structure.xml | 21 - .../WebContent/WEB-INF/jboss-web.xml | 3 - .../mso-tenant-adapter/WebContent/WEB-INF/web.xml | 123 - adapters/mso-tenant-adapter/WebContent/check.html | 10 - adapters/mso-tenant-adapter/pom.xml | 155 -- .../mso/adapters/tenant/HealthCheckHandler.java | 59 - .../mso/adapters/tenant/MsoTenantAdapter.java | 77 - .../mso/adapters/tenant/MsoTenantAdapterImpl.java | 290 --- .../mso/adapters/tenant/TenantAdapterRest.java | 307 --- .../tenant/exceptions/TenantAlreadyExists.java | 45 - .../tenant/exceptions/TenantException.java | 76 - .../tenant/exceptions/TenantExceptionBean.java | 64 - .../adapters/tenant/MsoTenantAdapterImplTest.java | 82 - .../mso/adapters/tenant/TenantAdapterRestTest.java | 60 - .../tenant/exceptions/TenantAlreadyExistsTest.java | 32 - .../tenant/exceptions/TenantExceptionBeanTest.java | 47 - .../tenant/exceptions/TenantExceptionTest.java | 49 - .../mso/adapters/tenant/test/TenantTest.java | 132 -- .../src/test/resources/logback-test.xml | 47 - .../WEB-INF/jboss-deployment-structure.xml | 42 +- .../WebContent/WEB-INF/jboss-web.xml | 3 - .../mso-vfc-adapter/WebContent/WEB-INF/web.xml | 109 - adapters/mso-vfc-adapter/pom.xml | 97 +- .../java/org/onap/so/adapters/vfc/AaiUtil.java | 47 + .../onap/so/adapters/vfc/HealthCheckHandler.java | 65 + .../org/onap/so/adapters/vfc/VfcAdapterRest.java | 225 ++ .../java/org/onap/so/adapters/vfc/VfcManager.java | 496 +++++ .../vfc/application/JerseyConfiguration.java | 60 + .../vfc/application/MSOVfcApplication.java | 40 + .../so/adapters/vfc/constant/CommonConstant.java | 140 ++ .../adapters/vfc/constant/DriverExceptionID.java | 64 + .../onap/so/adapters/vfc/constant/HttpCode.java | 92 + .../vfc/exceptions/ApplicationException.java | 76 + .../onap/so/adapters/vfc/model/CustomerModel.java | 70 + .../so/adapters/vfc/model/LocationConstraint.java | 73 + .../vfc/model/NSResourceInputParameter.java | 154 ++ .../onap/so/adapters/vfc/model/NsCreateReq.java | 102 + .../so/adapters/vfc/model/NsInstantiateReq.java | 50 + .../onap/so/adapters/vfc/model/NsOperationKey.java | 141 ++ .../onap/so/adapters/vfc/model/NsParameters.java | 69 + .../so/adapters/vfc/model/NsProgressStatus.java | 84 + .../so/adapters/vfc/model/NsScaleParameters.java | 66 + .../org/onap/so/adapters/vfc/model/NsScaleReq.java | 49 + .../so/adapters/vfc/model/ResponseDescriptor.java | 113 + .../so/adapters/vfc/model/RestfulResponse.java | 101 + .../so/adapters/vfc/model/ScaleNsByStepsData.java | 88 + .../onap/so/adapters/vfc/model/ScaleNsData.java | 49 + .../onap/so/adapters/vfc/model/VFCScaleData.java | 82 + .../onap/so/adapters/vfc/model/VimLocation.java | 51 + .../org/onap/so/adapters/vfc/util/JsonUtil.java | 134 ++ .../org/onap/so/adapters/vfc/util/RestfulUtil.java | 215 ++ .../onap/so/adapters/vfc/util/ValidateUtil.java | 87 + .../org/openecomp/mso/adapters/vfc/AaiUtil.java | 46 - .../mso/adapters/vfc/HealthCheckHandler.java | 74 - .../openecomp/mso/adapters/vfc/VfcAdapterRest.java | 220 -- .../org/openecomp/mso/adapters/vfc/VfcManager.java | 493 ---- .../mso/adapters/vfc/constant/CommonConstant.java | 139 -- .../adapters/vfc/constant/DriverExceptionID.java | 64 - .../mso/adapters/vfc/constant/HttpCode.java | 91 - .../vfc/exceptions/ApplicationException.java | 76 - .../mso/adapters/vfc/model/CustomerModel.java | 69 - .../mso/adapters/vfc/model/LocationConstraint.java | 72 - .../vfc/model/NSResourceInputParameter.java | 152 -- .../mso/adapters/vfc/model/NsCreateReq.java | 101 - .../mso/adapters/vfc/model/NsInstantiateReq.java | 49 - .../mso/adapters/vfc/model/NsOperationKey.java | 141 -- .../mso/adapters/vfc/model/NsParameters.java | 68 - .../mso/adapters/vfc/model/NsProgressStatus.java | 83 - .../mso/adapters/vfc/model/NsScaleParameters.java | 66 - .../mso/adapters/vfc/model/NsScaleReq.java | 49 - .../mso/adapters/vfc/model/ResponseDescriptor.java | 112 - .../mso/adapters/vfc/model/RestfulResponse.java | 100 - .../mso/adapters/vfc/model/ScaleNsByStepsData.java | 88 - .../mso/adapters/vfc/model/ScaleNsData.java | 49 - .../mso/adapters/vfc/model/VFCScaleData.java | 82 - .../mso/adapters/vfc/model/VimLocation.java | 50 - .../openecomp/mso/adapters/vfc/util/JsonUtil.java | 134 -- .../mso/adapters/vfc/util/RestfulUtil.java | 214 -- .../mso/adapters/vfc/util/ValidateUtil.java | 87 - .../src/main/resources/application.yaml | 37 + .../vfc/exceptions/ApplicationExceptionTest.java | 42 + .../so/adapters/vfc/model/CustomerModelTest.java | 49 + .../adapters/vfc/model/LocationConstraintTest.java | 49 + .../vfc/model/NSResourceInputParameterTest.java | 69 + .../so/adapters/vfc/model/NsCreateReqTest.java | 69 + .../adapters/vfc/model/NsInstantiateReqTest.java | 39 + .../so/adapters/vfc/model/NsOperationKeyTest.java | 79 + .../so/adapters/vfc/model/NsParametersTest.java | 52 + .../adapters/vfc/model/NsProgressStatusTest.java | 61 + .../adapters/vfc/model/ResponseDescriptorTest.java | 79 + .../so/adapters/vfc/model/RestfulResponseTest.java | 76 + .../so/adapters/vfc/model/VimLocationTest.java | 39 + .../openecomp/mso/adapters/vfc/VfcAdapterTest.java | 239 -- .../vfc/exceptions/ApplicationExceptionTest.java | 42 - .../mso/adapters/vfc/model/CustomerModelTest.java | 49 - .../adapters/vfc/model/LocationConstraintTest.java | 49 - .../vfc/model/NSResourceInputParameterTest.java | 69 - .../mso/adapters/vfc/model/NsCreateReqTest.java | 69 - .../adapters/vfc/model/NsInstantiateReqTest.java | 39 - .../mso/adapters/vfc/model/NsOperationKeyTest.java | 79 - .../mso/adapters/vfc/model/NsParametersTest.java | 52 - .../adapters/vfc/model/NsProgressStatusTest.java | 61 - .../adapters/vfc/model/ResponseDescriptorTest.java | 79 - .../adapters/vfc/model/RestfulResponseTest.java | 76 - .../mso/adapters/vfc/model/VimLocationTest.java | 39 - .../src/test/resources/application-test.yaml | 6 + .../src/test/resources/json/createNsReq.json | 2 +- .../src/test/resources/json/instantiateNsReq.json | 2 +- .../src/test/resources/logback-test.xml | 5 +- adapters/mso-vnf-adapter-async-client/README.md | 0 .../WebContent/META-INF/MANIFEST.MF | 3 - adapters/mso-vnf-adapter-async-client/pom.xml | 91 - .../src/main/resources/VnfAdapterNotify.wsdl | 218 -- adapters/mso-vnf-adapter/README.md | 11 - .../WebContent/META-INF/MANIFEST.MF | 3 - ....openstack.base.client.OpenStackClientConnector | 1 - .../WEB-INF/jboss-deployment-structure.xml | 21 - .../WebContent/WEB-INF/jboss-web.xml | 3 - .../mso-vnf-adapter/WebContent/WEB-INF/web.xml | 122 - adapters/mso-vnf-adapter/WebContent/check.html | 10 - adapters/mso-vnf-adapter/pom.xml | 169 -- .../mapper/VfModuleCustomizationToVduMapper.java | 145 -- .../openecomp/mso/adapters/vnf/BpelRestClient.java | 281 --- .../mso/adapters/vnf/HealthCheckHandler.java | 66 - .../openecomp/mso/adapters/vnf/MsoVnfAdapter.java | 145 -- .../mso/adapters/vnf/MsoVnfAdapterAsync.java | 103 - .../mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java | 652 ------ .../mso/adapters/vnf/MsoVnfAdapterImpl.java | 2176 ------------------ .../adapters/vnf/MsoVnfCloudifyAdapterImpl.java | 1254 ----------- .../mso/adapters/vnf/MsoVnfPluginAdapterImpl.java | 1243 ----------- .../org/openecomp/mso/adapters/vnf/VfRollback.java | 137 -- .../openecomp/mso/adapters/vnf/VnfAdapterRest.java | 621 ------ .../mso/adapters/vnf/VnfAdapterRestUtils.java | 85 - .../mso/adapters/vnf/VnfAdapterRestV2.java | 629 ------ .../mso/adapters/vnf/VolumeAdapterRest.java | 583 ----- .../mso/adapters/vnf/VolumeAdapterRestV2.java | 578 ----- .../adapters/vnf/exceptions/VnfAlreadyExists.java | 42 - .../mso/adapters/vnf/exceptions/VnfException.java | 80 - .../adapters/vnf/exceptions/VnfExceptionBean.java | 74 - .../mso/adapters/vnf/exceptions/VnfNotFound.java | 43 - .../org/openecomp/mso/vdu/utils/VduBlueprint.java | 90 - .../java/org/openecomp/mso/vdu/utils/VduInfo.java | 130 -- .../org/openecomp/mso/vdu/utils/VduPlugin.java | 248 --- .../org/openecomp/mso/vdu/utils/VduStatus.java | 37 - .../VfModuleCustomizationToVduMapperTest.java | 158 ++ .../VfModuleCustomizationToVduMapperTest.java | 158 -- .../mso/adapters/vnf/BpelRestClientTest.java | 52 - .../mso/adapters/vnf/HealthCheckHandlerTest.java | 33 - .../adapters/vnf/MsoVnfAdapterAsyncImplTest.java | 114 - .../mso/adapters/vnf/MsoVnfAdapterImplTest.java | 542 ----- .../vnf/MsoVnfCloudifyAdapterImplTest.java | 151 -- .../adapters/vnf/MsoVnfPluginAdapterImplTest.java | 151 -- .../org/openecomp/mso/adapters/vnf/QueryTest.java | 121 - .../openecomp/mso/adapters/vnf/VfRollbackTest.java | 69 - .../vnf/VnfAdapterRestV2ExceptionTest.java | 109 - .../openecomp/mso/adapters/vnf/VnfCreateTest.java | 87 - .../openecomp/mso/adapters/vnf/VnfDeleteTest.java | 52 - .../openecomp/mso/adapters/vnf/VnfQueryTest.java | 64 - .../vnf/VolumeAdapterRestV2ExceptionTest.java | 97 - .../openecomp/mso/vdu/utils/VduBlueprintTest.java | 81 - .../org/openecomp/mso/vdu/utils/VduInfoTest.java | 89 - ....openstack.base.client.OpenStackClientConnector | 1 - .../src/test/resources/cloud_config.json | 94 - .../src/test/resources/logback-test.xml | 48 - .../src/test/resources/mso.properties | 27 - .../WebContent/META-INF/MANIFEST.MF | 4 - .../WEB-INF/jboss-deployment-structure.xml | 22 - .../WebContent/WEB-INF/jboss-web.xml | 3 - .../WebContent/WEB-INF/web.xml | 84 - .../WebContent/check.html | 10 - adapters/mso-workflow-message-adapter/pom.xml | 72 - .../adapters/workflowmessage/BPRestCallback.java | 178 -- .../workflowmessage/WMAdapterConstants.java | 30 - .../workflowmessage/WMAdapterProperties.java | 89 - .../adapters/workflowmessage/WMAdapterRest.java | 140 -- .../adapters/workflowmessage/WMAdapterUtils.java | 49 - .../workflowmessage/BPRestCallbackTest.java | 42 + .../workflowmessage/WMAdapterRestTest.java | 45 + .../workflowmessage/BPRestCallbackTest.java | 42 - .../workflowmessage/WMAdapterRestTest.java | 45 - .../src/test/resources/logback-test.xml | 25 - adapters/pom.xml | 32 +- 1175 files changed, 74902 insertions(+), 61931 deletions(-) delete mode 100644 adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.class delete mode 100644 adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.class create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/adapters/vdu/VduPlugin.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfigIdentityMapper.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/models/RackspaceAuthentication.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfo.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentStatus.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoBlueprintAlreadyExists.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyException.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyManagerNotFound.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeout.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoDeploymentAlreadyExists.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/HeatCacheEntry.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/NeutronCacheEntry.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameter.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResource.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java create mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/CloudInfo.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/PluginAction.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduException.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduInstance.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduModelInfo.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduPlugin.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStateType.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStatus.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/AriaVduPlugin.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/CSAR.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudifyManager.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentInfo.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentStatus.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoBlueprintAlreadyExists.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyException.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyManagerNotFound.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeout.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowException.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoDeploymentAlreadyExists.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtils.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java create mode 100644 adapters/mso-adapter-utils/src/main/resources/application-local.yaml create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/TestApplication.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/TestDataSetup.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NetworkRollbackTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntryTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java create mode 100644 adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvtTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapters/vdu/BeansTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigFactoryTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactoryTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapperTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapperTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/WrapperTestUtility.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest2.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java delete mode 100644 adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/CloudSite.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/Error.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/Explanation.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/GetNeutronNetwork.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/HeatEnvironmentParameter.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParam.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParamExpected.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/NeutronError.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Roles.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_StackId.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Tenant.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_User.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json create mode 100644 adapters/mso-adapter-utils/src/test/resources/application-test.yaml delete mode 100644 adapters/mso-adapter-utils/src/test/resources/cloud_config.json delete mode 100644 adapters/mso-adapter-utils/src/test/resources/cloud_config_bad.json create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRef.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRefSeq.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetIp.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetPool.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetHostRouteMapper.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetPoolMapper.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ContrailNetwork.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkExceptionResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkRequestCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkResponseCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkTechnology.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ProviderVlanNetwork.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/RequestInformation.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCErrorCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCEvent.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCRequestCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCResponseCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/ServiceInformation.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantError.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantExceptionResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRequestCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRollback.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVfModuleResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleExceptionResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfRequestCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupExceptionResponse.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java create mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkExceptionResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkTechnology.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ProviderVlanNetwork.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java delete mode 100644 adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFoundTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoIOExceptionTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExistsTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkNotFoundTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExistsTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackNotFoundTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExistsTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantNotFoundTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java delete mode 100644 adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java create mode 100644 adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json create mode 100644 adapters/mso-catalog-db-adapter/.gitignore create mode 100644 adapters/mso-catalog-db-adapter/.maven-dockerignore delete mode 100644 adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml create mode 100644 adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-dpl.yaml create mode 100644 adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-srv.yaml create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryException.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java delete mode 100644 adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/application.yaml create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1__Base_version.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.0__Modify_Resource_Relationships.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.1__Modify_Resource_Relationships_Alters.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.10__VNFCInstanceGroupChanges.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.11__Modify_IS_Base_Type.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.12__UpdateMacroReferenceData_Homing.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.13__Alter_external_service_to_internal_model_mapping.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.14__DeactivateAndCloudDelete.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.15__Orchestration_Status_Valid_Action_State_Transition_Table_Updates.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.16__Remove_Orchestration_Flow_Reference_FK_To_Building_Block_Detail_Pre_New_Solution.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.17__DeactivateAndCloudDeleteChanges.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.18__AlterVNFRecipeVnfTypeColumnName.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.1__Update_Recipe_For_API_Flag.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.2__ONAP_TABLE_CHANGES.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.3__MacroTableChanges.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.4__MacroReferenceData1806.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.5__RainyDayHandlerMacroData.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.6__NorthboundAddTopLevelFlow.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.7__VNFCInstanceGroup1806.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.8__OrchestrationStatus_ValidActionStateTransition.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.9__UpdateIsTopLevelFlowColumn.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.1__AddServiceMacroDeactivateToMacroTables.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.2__ChangeMINApiVersionInNorthbound.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.3__ChangeMINApiVersionServiceMacroDeactivate.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.4__AddUpdateNetworkALaCarte.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.5__PointGrApiDefault_To_UpdateVfModuleVolumeInfraV1.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.6__UpdateNetworkCollectionCatalogDB.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.7__FixDeactivateNetworkCollection.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.8__UnassignFabricConfigurationData.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.9__DropCRModelUUID_FK.sql create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/index.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/index.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/install.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/jars.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/layout.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/logging.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/onaplogo.png create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/packaging.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/page.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/readme.css create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/spring.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/readme/tools.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-16x16.png create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-32x32.png create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/index.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/oauth2-redirect.html create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui-standalone-preset.js create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui.css create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui.css.map create mode 100644 adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui.js create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/EmbeddedMariaDbConfig.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModuleTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/TestAppender.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestClassTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestHttpTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRestTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomizationTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipeTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsarTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMarcoHolderTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworksTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfsTest.java delete mode 100644 adapters/mso-catalog-db-adapter/src/test/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModuleTest.java create mode 100644 adapters/mso-catalog-db-adapter/src/test/resources/application-test.yaml create mode 100644 adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql create mode 100644 adapters/mso-catalog-db-adapter/src/test/resources/logback-test.xml create mode 100644 adapters/mso-catalog-db-adapter/src/test/resources/response/expectedServiceResponse.json create mode 100644 adapters/mso-catalog-db-adapter/src/test/resources/response/expectedServiceResponseV2.json create mode 100644 adapters/mso-catalog-db-adapter/src/test/resources/response/serviceResponse.json delete mode 100644 adapters/mso-network-adapter-async-client/README.md delete mode 100644 adapters/mso-network-adapter-async-client/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-network-adapter-async-client/pom.xml delete mode 100644 adapters/mso-network-adapter-async-client/src/main/resources/NetworkAdapterNotify.wsdl delete mode 100644 adapters/mso-network-adapter/README delete mode 100644 adapters/mso-network-adapter/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-network-adapter/WebContent/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector delete mode 100644 adapters/mso-network-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-network-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-network-adapter/WebContent/WEB-INF/web.xml delete mode 100644 adapters/mso-network-adapter/WebContent/check.html delete mode 100644 adapters/mso-network-adapter/pom.xml delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/BpelRestClient.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRef.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeq.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnet.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetHostRoute.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetHostRoutes.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetIp.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/ContrailSubnetPool.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/HealthCheckHandler.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapter.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsync.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImpl.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/NetworkAdapterRest.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/exceptions/NetworkException.java delete mode 100644 adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/exceptions/NetworkExceptionBean.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/BpelRestClientTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/ContrailPolicyRefSeqTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/ContrailPolicyRefTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/ContrailSubnetHostRouteTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/ContrailSubnetHostRoutesTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImplTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterImplTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterRestTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkAdapterTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/NetworkBeansTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/exceptions/NetworkExceptionBeanTest.java delete mode 100644 adapters/mso-network-adapter/src/test/java/org/openecomp/mso/adapters/network/exceptions/NetworkExceptionTest.java delete mode 100644 adapters/mso-network-adapter/src/test/resources/logback-test.xml create mode 100644 adapters/mso-openstack-adapters/.gitignore create mode 100644 adapters/mso-openstack-adapters/.mvn/wrapper/maven-wrapper.jar create mode 100644 adapters/mso-openstack-adapters/.mvn/wrapper/maven-wrapper.properties create mode 100644 adapters/mso-openstack-adapters/Deployment/Dockerfile.adapters create mode 100644 adapters/mso-openstack-adapters/Deployment/pod_rc.yaml create mode 100644 adapters/mso-openstack-adapters/Deployment/pod_svc.yaml create mode 100644 adapters/mso-openstack-adapters/mvnw create mode 100644 adapters/mso-openstack-adapters/mvnw.cmd create mode 100644 adapters/mso-openstack-adapters/pom.xml create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRef.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailPolicyRefSeq.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnet.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoute.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetHostRoutes.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetIp.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/ContrailSubnetPool.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/exceptions/NetworkException.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBean.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/WebSecurityConfigImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapter.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/MsoTenantAdapterImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExists.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/exceptions/TenantException.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBean.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/CSAR.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VfRollback.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/CreateVnfNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/DeleteVnfNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/MsoExceptionCategory.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/MsoRequest.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/ObjectFactory.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/QueryVnfNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/RollbackVnfNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/UpdateVnfNotification.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfAdapterNotify_Service.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfRollback.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/VnfStatus.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/async/client/package-info.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfException.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfExceptionBean.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduBlueprint.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduInfo.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduPlugin.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/org/onap/so/vdu/utils/VduStatus.java create mode 100644 adapters/mso-openstack-adapters/src/main/resources/NetworkAdapterNotify.wsdl create mode 100644 adapters/mso-openstack-adapters/src/main/resources/VnfAdapterNotify.wsdl create mode 100644 adapters/mso-openstack-adapters/src/main/resources/application-local.yaml create mode 100644 adapters/mso-openstack-adapters/src/main/resources/application.yaml create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/index.html create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/favicon-16x16.png create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/favicon-32x32.png create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/index.html create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/oauth2-redirect.html create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui-bundle.js create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui-standalone-preset.js create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui.css create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui.css.map create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui.js create mode 100644 adapters/mso-openstack-adapters/src/main/resources/static/swagger/welcome.html create mode 100644 adapters/mso-openstack-adapters/src/main/resources/wsdl/NetworkAdapterNotify.wsdl create mode 100644 adapters/mso-openstack-adapters/src/main/resources/wsdl/VnfAdapterNotify.wsdl create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java create mode 100644 adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/CreateNetwork.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_Fail_If_Exist_True.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_InvalidCloudSiteId.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/DeleteNetwork.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector create mode 100644 adapters/mso-openstack-adapters/src/test/resources/QueryNetwork.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/UpdateNetwork.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkRequest.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse2.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Created.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/CreateTenantResponse_Exists.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/CreateVfModuleResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/DeleteNetworkResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Failed.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/DeleteTenantResponse_Success.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/DeleteVfModuleResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/GetNeutronNetwork.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackGetNeutronNetworks.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackRequest_Tenant.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_Admin.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Access_queryNetwork.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Metadata.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Roles.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_StackId.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Failed_VfModule.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_UpdateComplete.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Stack_Updating_VfModule.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_Tenant.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_User.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfBaseStackId.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/OpenstackResponse_VnfStackId.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/RollbackVfModuleResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/UpdateNetworkResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/UpdateVfModuleResponse.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/ValetCreateRequest.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/__files/ValetDeleteRequest.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/application-test.yaml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/cloud_config.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/data.sql create mode 100644 adapters/mso-openstack-adapters/src/test/resources/logback-test.xml create mode 100644 adapters/mso-openstack-adapters/src/test/resources/mso.properties create mode 100644 adapters/mso-openstack-adapters/src/test/resources/schema.sql delete mode 100644 adapters/mso-requests-db-adapter/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-requests-db-adapter/WebContent/WEB-INF/beans.xml delete mode 100644 adapters/mso-requests-db-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-requests-db-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-requests-db-adapter/WebContent/WEB-INF/web.xml delete mode 100644 adapters/mso-requests-db-adapter/WebContent/index.xhtml create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsScheduler.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapter.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/RequestStatusType.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/ResponseStatus.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/WebSecurityConfigImpl.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/CXFConfiguration.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/RequestDBConfig.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbException.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/RequestStatusType.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/ResponseStatus.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/Status.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java delete mode 100644 adapters/mso-requests-db-adapter/src/main/java/resources/application.properties create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/application.yaml create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V1__Base_version.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.1__Add_Identifiers_Active_Requests.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.2__Add_Operation_Status.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.3__Remove_Invalid_requestdb_data.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.4__Activate_Requests_Nullable_Coulmns.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.5__Archived_Infra_Requests.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.6__shedlock.sql create mode 100644 adapters/mso-requests-db-adapter/src/main/resources/db/migration/V2.7__Update_Status_Message_ColumnTypes.sql create mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/ArchiveInfraRequestsSchedulerTest.java create mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java create mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java create mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/application/EmbeddedMariaDbConfig.java create mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java create mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java delete mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandlerTest.java delete mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImplTest.java delete mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBeanTest.java delete mode 100644 adapters/mso-requests-db-adapter/src/test/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionTest.java create mode 100644 adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml create mode 100644 adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql create mode 100644 adapters/mso-requests-db-adapter/src/test/resources/logback-test.xml create mode 100644 adapters/mso-requests-db-adapter/src/test/resources/wsdl/MsoRequestsDbAdapterImpl.wsdl create mode 100644 adapters/mso-sdnc-adapter/.maven-dockerignore create mode 100644 adapters/mso-sdnc-adapter/.tern-project delete mode 100644 adapters/mso-sdnc-adapter/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-sdnc-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-sdnc-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-sdnc-adapter/WebContent/WEB-INF/web.xml delete mode 100644 adapters/mso-sdnc-adapter/WebContent/check.html create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java create mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java delete mode 100644 adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/application-local.yaml create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/application.yaml create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/index.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/index.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-standalone-preset.js create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui.css create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui.css.map create mode 100644 adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui.js create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/ObjectFactoryTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/SDNCAdapterRequestTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/CallbackHeaderTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/MapRequestTunablesTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImplTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCResponseTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/UtilsTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/ObjectMappingTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtilTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/InvestigationTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImplTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResourceTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallbackTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunablesTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/resources/SdncServiceResponse.xml create mode 100644 adapters/mso-sdnc-adapter/src/test/resources/application-test.properties delete mode 100644 adapters/mso-sdnc-adapter/src/test/resources/mso.properties delete mode 100644 adapters/mso-sdnc-adapter/src/test/resources/mso.sdnc.properties create mode 100644 adapters/mso-sdnc-adapter/src/test/resources/sdncTestPayload.xml delete mode 100644 adapters/mso-tenant-adapter/README.md delete mode 100644 adapters/mso-tenant-adapter/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-tenant-adapter/WebContent/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector delete mode 100644 adapters/mso-tenant-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-tenant-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-tenant-adapter/WebContent/WEB-INF/web.xml delete mode 100644 adapters/mso-tenant-adapter/WebContent/check.html delete mode 100644 adapters/mso-tenant-adapter/pom.xml delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/HealthCheckHandler.java delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapter.java delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImpl.java delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/TenantAdapterRest.java delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExists.java delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantException.java delete mode 100644 adapters/mso-tenant-adapter/src/main/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBean.java delete mode 100644 adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/MsoTenantAdapterImplTest.java delete mode 100644 adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/TenantAdapterRestTest.java delete mode 100644 adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantAlreadyExistsTest.java delete mode 100644 adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionBeanTest.java delete mode 100644 adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/exceptions/TenantExceptionTest.java delete mode 100644 adapters/mso-tenant-adapter/src/test/java/org/openecomp/mso/adapters/tenant/test/TenantTest.java delete mode 100644 adapters/mso-tenant-adapter/src/test/resources/logback-test.xml delete mode 100644 adapters/mso-vfc-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/AaiUtil.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/HealthCheckHandler.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/VfcAdapterRest.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/VfcManager.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/JerseyConfiguration.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/application/MSOVfcApplication.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/CommonConstant.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/DriverExceptionID.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/constant/HttpCode.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/exceptions/ApplicationException.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/CustomerModel.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/LocationConstraint.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NSResourceInputParameter.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsCreateReq.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsInstantiateReq.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsOperationKey.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsParameters.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsProgressStatus.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleParameters.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/NsScaleReq.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ResponseDescriptor.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/RestfulResponse.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsByStepsData.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/ScaleNsData.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VFCScaleData.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/model/VimLocation.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/JsonUtil.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/RestfulUtil.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/util/ValidateUtil.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/HealthCheckHandler.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/CustomerModel.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameter.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsCreateReq.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsOperationKey.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleParameters.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsScaleReq.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptor.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsByStepsData.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/ScaleNsData.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VFCScaleData.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/VimLocation.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java create mode 100644 adapters/mso-vfc-adapter/src/main/resources/application.yaml create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/exceptions/ApplicationExceptionTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/CustomerModelTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/LocationConstraintTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NSResourceInputParameterTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsCreateReqTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsInstantiateReqTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsOperationKeyTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsParametersTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/NsProgressStatusTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/ResponseDescriptorTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/RestfulResponseTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/model/VimLocationTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationExceptionTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/CustomerModelTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/LocationConstraintTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NSResourceInputParameterTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsCreateReqTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReqTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsOperationKeyTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsParametersTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatusTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/ResponseDescriptorTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/RestfulResponseTest.java delete mode 100644 adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/model/VimLocationTest.java create mode 100644 adapters/mso-vfc-adapter/src/test/resources/application-test.yaml delete mode 100644 adapters/mso-vnf-adapter-async-client/README.md delete mode 100644 adapters/mso-vnf-adapter-async-client/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-vnf-adapter-async-client/pom.xml delete mode 100644 adapters/mso-vnf-adapter-async-client/src/main/resources/VnfAdapterNotify.wsdl delete mode 100644 adapters/mso-vnf-adapter/README.md delete mode 100644 adapters/mso-vnf-adapter/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-vnf-adapter/WebContent/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector delete mode 100644 adapters/mso-vnf-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-vnf-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-vnf-adapter/WebContent/WEB-INF/web.xml delete mode 100644 adapters/mso-vnf-adapter/WebContent/check.html delete mode 100644 adapters/mso-vnf-adapter/pom.xml delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/BpelRestClient.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/HealthCheckHandler.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapter.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsync.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImpl.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImpl.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImpl.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VfRollback.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRest.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestUtils.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRest.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfAlreadyExists.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfException.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfExceptionBean.java delete mode 100644 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/exceptions/VnfNotFound.java delete mode 100755 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduBlueprint.java delete mode 100755 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduInfo.java delete mode 100755 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduPlugin.java delete mode 100755 adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/vdu/utils/VduStatus.java create mode 100644 adapters/mso-vnf-adapter/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/BpelRestClientTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/HealthCheckHandlerTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterAsyncImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/MsoVnfPluginAdapterImplTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/QueryTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VfRollbackTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfAdapterRestV2ExceptionTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfCreateTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfDeleteTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VnfQueryTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vnf/VolumeAdapterRestV2ExceptionTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduBlueprintTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/vdu/utils/VduInfoTest.java delete mode 100644 adapters/mso-vnf-adapter/src/test/resources/META-INF/services/com.woorea.openstack.base.client.OpenStackClientConnector delete mode 100644 adapters/mso-vnf-adapter/src/test/resources/cloud_config.json delete mode 100644 adapters/mso-vnf-adapter/src/test/resources/logback-test.xml delete mode 100644 adapters/mso-vnf-adapter/src/test/resources/mso.properties delete mode 100644 adapters/mso-workflow-message-adapter/WebContent/META-INF/MANIFEST.MF delete mode 100644 adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml delete mode 100644 adapters/mso-workflow-message-adapter/WebContent/WEB-INF/jboss-web.xml delete mode 100644 adapters/mso-workflow-message-adapter/WebContent/WEB-INF/web.xml delete mode 100644 adapters/mso-workflow-message-adapter/WebContent/check.html delete mode 100644 adapters/mso-workflow-message-adapter/pom.xml delete mode 100644 adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallback.java delete mode 100644 adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterConstants.java delete mode 100644 adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterProperties.java delete mode 100644 adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRest.java delete mode 100644 adapters/mso-workflow-message-adapter/src/main/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterUtils.java create mode 100644 adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java create mode 100644 adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java delete mode 100644 adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/BPRestCallbackTest.java delete mode 100644 adapters/mso-workflow-message-adapter/src/test/java/org/openecomp/mso/adapters/workflowmessage/WMAdapterRestTest.java delete mode 100644 adapters/mso-workflow-message-adapter/src/test/resources/logback-test.xml (limited to 'adapters') diff --git a/adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.class b/adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.class deleted file mode 100644 index 463cbda625..0000000000 Binary files a/adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.class and /dev/null differ diff --git a/adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.class b/adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.class deleted file mode 100644 index 483d76f78c..0000000000 Binary files a/adapters/mso-adapter-utils/bin/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.class and /dev/null differ diff --git a/adapters/mso-adapter-utils/pom.xml b/adapters/mso-adapter-utils/pom.xml index c78b7f7ca1..093dbb731c 100644 --- a/adapters/mso-adapter-utils/pom.xml +++ b/adapters/mso-adapter-utils/pom.xml @@ -4,13 +4,25 @@ org.onap.so adapters - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT org.onap.so.adapters mso-adapter-utils mso-adapter-utils Common MSO utilities, including Openstack client wrappers. + + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + ${project.artifactId} src/main/java @@ -39,6 +51,10 @@ + + org.jacoco + jacoco-maven-plugin + @@ -49,33 +65,13 @@ ${project.version} - org.onap.so - mso-catalog-db - ${project.version} - - - org.onap.so.libs.openstack-java-sdk - keystone-client - ${openstack.version} - - - org.onap.so.libs.openstack-java-sdk - heat-client - ${openstack.version} - - - org.onap.so.libs.openstack-java-sdk - quantum-client - ${openstack.version} - - - org.onap.so.libs.openstack-java-sdk.client-connectors - http-connector - ${openstack.version} + org.springframework.boot + spring-boot-starter-data-jpa + true org.onap.so - common + mso-catalog-db ${project.version} @@ -95,43 +91,20 @@ 1.8 test - - org.jboss.spec.javax.ejb - jboss-ejb-api_3.2_spec - 1.0.0.Final - provided - - - org.jboss.ejb3 - jboss-ejb3-ext-api - 2.2.0.Final - provided - org.yaml snakeyaml 1.15 - org.onap.so - aria-client - ${project.version} + org.springframework.boot + spring-boot-starter-test + test - - com.shazam - shazamcrest - 0.11 + + com.h2database + h2 test - - - com.google.guava - guava - - - org.apache.commons - commons-lang3 - - diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/adapters/vdu/VduPlugin.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/adapters/vdu/VduPlugin.java new file mode 100644 index 0000000000..ff30c0ee70 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/adapters/vdu/VduPlugin.java @@ -0,0 +1,186 @@ +/*- + * ============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.adapters.vdu; + +/** + * This interface defines a common API for template-based cloud deployments. + * The methods here should be adaptable for Openstack (Heat), Cloudify (TOSCA), + * Aria (TOSCA), Multi-VIM (TBD), and others (e.g. Azure Resource Manager). + * + * The deployed instances are referred to here as Virtual Deployment Units (VDUs). + * The package of templates that define a give VDU is referred to as its blueprint. + * + * Template-based orchestrators all follow a similar template/blueprint model. + * - One main template that is the top level definition + * - Optional nested templates referenced/included by the main template + * - Optional files attached to the template package, typically containing + * configuration files, install scripts, orchestration scripts, etc. + * + * The main template also defines the required inputs for creating a new instance, + * and output values exposed by successfully deployed instances. Inputs and outputs + * may include simple or complex (JSON) data types. + * + * Each implementation of this interface is expected to understand the MSO CloudConfig + * to obtain the credentials for its sub-orchestrator and the targeted cloud. + * The sub-orchestrator may have different credentials from the cloud (e.g. an Aria + * instance in front of an Openstack cloud) or they may be the same (e.g. Heat) + */ +import java.util.Map; + +public interface VduPlugin { + + /** + * The instantiateVdu interface deploys a new VDU instance from a vdu model package. + * + * For some VIMs, this may be a single command (e.g. Heat -> create stack) or may + * require a series of API calls (e.g. Cloudify -> upload blueprint, create deployment, + * execute install workflow). These details are hidden within the plug-in implementation. + * The instantiation should be fully completed before returning. On failures, this + * method is expected to back out the attempt, leaving the cloud in its previous state. + * + * It is expected that parameters have been validated and contain at minimum the + * required parameters for the given template with no extra parameters. + * + * The VDU name supplied by the caller will be globally unique, and identify the artifact + * in A&AI. Inventory is managed by the higher levels invoking this function. + * + * @param cloudInfo The target cloud + tenant identifiers for the VDU. + * @param instanceName A unique name for the VDU instance to update. + * @param inputs A map of key/value inputs. Values may be strings, numbers, or JSON objects. + * Will completely replace any inputs provided on the original instantiation. + * @param vduModel Object containing the collection of templates and files that comprise + * the blueprint for this VDU. + * @param rollbackOnFailure Flag to preserve or roll back the update on Failure. Should normally + * be True except in troubleshooting/debug cases. Might not be supported in all plug-ins. + * + * @return A VduInstance object + * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs. + * Various subclasses of VduException may be thrown. + */ + public VduInstance instantiateVdu ( + CloudInfo cloudInfo, + String instanceName, + Map inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException; + + /** + * Query a deployed VDU instance. This call will return a VduInstance object, or null + * if the deployment does not exist. + * + * Some VIM orchestrators identify deployment instances by string UUIDs, and others + * by integers. In the latter case, the ID will be passed in as a numeric string. + * + * The returned VduInstance object contains the input and output parameter maps, + * as well as other properties of the deployment (name, status, last action, etc.). + * + * @param cloudInfo The target cloud + tenant identifiers for the VDU. + * @param vduInstanceId The ID of the deployment to query + * + * @return A VduInstance object + * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs. + * Various subclasses of VduException may be thrown. + */ + public VduInstance queryVdu ( + CloudInfo cloudInfo, + String vduInstanceId) + throws VduException; + + + /** + * Delete a VDU instance by ID. If the VIM sub-orchestrator supports pre-installation + * of blueprints/models, the blueprint itself may remain installed. This is recommended, + * since other VDU instances may be using it. + * + * Some VIM orchestrators identify deployment instances by string UUIDs, and others + * by integers. In the latter case, the ID will be passed in as a numeric string. + * + * For some VIMs, deletion may be a single command (e.g. Heat -> delete stack) or a + * series of API calls (e.g. Cloudify -> execute uninstall workflow, delete deployment). + * These details are hidden within the plug-in implementation. The deletion should be + * fully completed before returning. + * + * The successful return is a VduInstance object which contains the state of the VDU + * just prior to deletion, with a status of DELETED. If the deployment was not found, + * the VduInstance object should be empty (with a status of NOTFOUND). + * There is no rollback from a successful deletion. + * + * A deletion failure will result in an undefined deployment state - the components may + * or may not have been all or partially uninstalled, so the resulting deployment must + * be considered invalid. + * + * @param cloudInfo The target cloud + tenant identifiers for the VDU. + * @param instanceId The unique id of the deployment to delete. + * @param timeoutMinutes Timeout after which the delete action will be cancelled. + * Consider sending the entire model here, if it may be of use to the plug-in? + * + * @return A VduInstance object, representing its state just prior to deletion. + * + * @throws VduException Thrown if the API calls fail or if a timeout occurs. + * Various subclasses of VduException may be thrown. + */ + public VduInstance deleteVdu ( + CloudInfo cloudInfo, + String instanceId, + int timeoutMinutes) + throws VduException; + + + /** + * The updateVdu interface attempts to update a VDU in-place, using either new inputs or + * a new model definition (i.e. updated templates/blueprints). This depends on the + * capabilities of the targeted sub-orchestrator, as not all implementations are expected + * to support this ability. It is primary included initially only for Heat. + * + * It is expected that parameters have been validated and contain at minimum the required + * parameters for the given template with no extra parameters. The VDU instance name cannot + * be updated. + * + * The update should be fully completed before returning. The successful return is a + * VduInstance object containing the updated VDU state. + * + * An update failure will result in an undefined deployment state - the components may + * or may not have been all or partially modified, deleted, recreated, etc. So the resulting + * VDU must be considered invalid. + * + * @param cloudInfo The target cloud + tenant identifiers for the VDU. + * @param instanceId The unique ID for the VDU instance to update. + * @param inputs A map of key/value inputs. Values may be strings, numbers, or JSON objects. + * Will completely replace any inputs provided on the original instantiation. + * @param vduModel Object containing the collection of templates and files that comprise + * the blueprint for this VDU. + * @param rollbackOnFailure Flag to preserve or roll back the update on Failure. Should normally + * be True except in troubleshooting/debug cases. Might not be supported in all plug-ins. + * + * @return A VduInfo object + * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs. + * Various subclasses of VduException may be thrown. + */ + public VduInstance updateVdu ( + CloudInfo cloudInfo, + String instanceId, + Map inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException; + +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java new file mode 100644 index 0000000000..bc04b09588 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/Application.java @@ -0,0 +1,38 @@ +/*- + * ============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.cloud; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication(scanBasePackages = { "org.onap"}) +@EnableJpaRepositories({"org.onap.so.db.catalog.data.repository", "org.onap.so.db.request.data.repository"}) +@EntityScan({"org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans"}) +public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java new file mode 100644 index 0000000000..7cb2222525 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/AuthenticationType.java @@ -0,0 +1,25 @@ +/*- + * ============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.cloud; + +public enum AuthenticationType { + USERNAME_PASSWORD, RACKSPACE_APIKEY; +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java new file mode 100644 index 0000000000..ef5f8232e0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java @@ -0,0 +1,216 @@ +/*- + * ============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.cloud; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; + +import javax.annotation.PostConstruct; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; + +/** + * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud + * configuration file to Java. The CloudConfig contains information about + * Openstack cloud configurations. It includes: + * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service) + * - CloudSite objects, representing LCP nodes (Openstack Compute & other services) + * + * Note that this is only used to access Cloud Configurations loaded from a JSON + * config file, so there are no explicit property setters. + * + * This class also contains methods to query cloud sites and/or identity + * services by ID. + * + */ + +@Configuration +@JsonRootName("cloud_config") +@ConfigurationProperties(prefix="cloud_config") +public class CloudConfig { + + private static final String CLOUD_SITE_VERSION = "2.5"; + private static final String DEFAULT_CLOUD_SITE_ID = "default"; + + @JsonProperty("identity_services") + private Map identityServices = new HashMap<>(); + + @JsonProperty("cloud_sites") + private Map cloudSites = new HashMap<>(); + + @JsonProperty("cloudify_managers") + private Map cloudifyManagers = new HashMap<>(); + + @PostConstruct + private void init() { + for (Entry entry : identityServices.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + + for (Entry entry : cloudSites.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + + for (Entry entry : cloudifyManagers.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + } + + /** + * Get a map of all identity services that have been loaded. + */ + public Map getIdentityServices() { + return identityServices; + } + + /** + * Get a map of all cloud sites that have been loaded. + */ + public Map getCloudSites() { + return cloudSites; + } + + /** + * Get a Map of all CloudifyManagers that have been loaded. + * @return the Map + */ + public Map getCloudifyManagers() { + return cloudifyManagers; + } + + /** + * Get a specific CloudSites, based on an ID. The ID is first checked + * against the regions, and if no match is found there, then against + * individual entries to try and find one with a CLLI that matches the ID + * and an AIC version of 2.5. + * + * @param id the ID to match + * @return an Optional of CloudSite object. + */ + public synchronized Optional getCloudSite(String id) { + if (id == null) { + return Optional.empty(); + } + if (cloudSites.containsKey(id)) { + return Optional.ofNullable(cloudSites.get(id)); + } else { + return getCloudSiteWithClli(id); + } + } + + public String getCloudSiteId(CloudSite cloudSite) { + for(Entry entry : this.getCloudSites().entrySet()){ + if(entry.getValue().equals(cloudSite)) + return entry.getKey(); + } + return null; + } + + /** + * Get a specific CloudSites, based on a CLLI and (optional) version, which + * will be matched against the aic_version field of the CloudSite. + * + * @param clli + * the CLLI to match + * @param version + * the version to match; may be null in which case any version + * matches + * @return a CloudSite, or null of no match found + */ + private Optional getCloudSiteWithClli(String clli) { + Optional cloudSiteOptional = cloudSites.values().stream().filter(cs -> + cs.getClli() != null && clli.equals(cs.getClli()) && (CLOUD_SITE_VERSION.equals(cs.getAicVersion()))) + .findAny(); + if (cloudSiteOptional.isPresent()) { + return cloudSiteOptional; + } else { + return getDefaultCloudSite(clli); + } + } + + private Optional getDefaultCloudSite(String clli) { + Optional cloudSiteOpt = cloudSites.values().stream() + .filter(cs -> cs.getId().equalsIgnoreCase(DEFAULT_CLOUD_SITE_ID)).findAny(); + if (cloudSiteOpt.isPresent()) { + CloudSite defaultCloudSite = cloudSiteOpt.get(); + CloudSite clone = new CloudSite(defaultCloudSite); + clone.setRegionId(clli); + clone.setId(clli); + return Optional.of(clone); + } else { + return Optional.empty(); + } + } + + /** + * Get a specific CloudIdentity, based on an ID. + * + * @param id + * the ID to match + * @return a CloudIdentity, or null of no match found + */ + public CloudIdentity getIdentityService(String id) { + return identityServices.get(id); + } + + /** + * Get a specific CloudifyManager, based on an ID. + * @param id the ID to match + * @return a CloudifyManager, or null of no match found + */ + public CloudifyManager getCloudifyManager (String id) { + return cloudifyManagers.get(id); + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) + .append("identityServices", getIdentityServices()).append("cloudSites", getCloudSites()).toString(); + } + + @Override + public boolean equals(final Object other) { + if (other == null) { + return false; + } + if (!getClass().equals(other.getClass())) { + return false; + } + CloudConfig castOther = (CloudConfig) other; + return new EqualsBuilder().append(getIdentityServices(), castOther.getIdentityServices()) + .append(getCloudSites(), castOther.getCloudSites()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(1, 31).append(getIdentityServices()).append(getCloudSites()).toHashCode(); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfigIdentityMapper.java new file mode 100644 index 0000000000..f554aa46cd --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfigIdentityMapper.java @@ -0,0 +1,30 @@ +/*- + * ============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.cloud; + +/** + * This interface provides the method signature for mapping registration. + * All mappings should be registered by the implementing class. + */ +@FunctionalInterface +public interface CloudConfigIdentityMapper { + + public void registerAllMappings(); +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java new file mode 100644 index 0000000000..188a93025e --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudIdentity.java @@ -0,0 +1,203 @@ +/*- + * ============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.cloud; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +import java.util.Comparator; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity + * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via + * CloudConfig object, of which it is a component (a CloudConfig JSON configuration + * file may contain multiple CloudIdentity definitions). + * + * Note that this is only used to access Cloud Configurations loaded from a + * JSON config file, so there are no explicit setters. + * + */ +public class CloudIdentity { + + @JsonProperty + @BusinessKey + private String id; + @JsonProperty("identity_url") + @BusinessKey + private String identityUrl; + @JsonProperty("mso_id") + @BusinessKey + private String msoId; + @JsonProperty("mso_pass") + @BusinessKey + private String msoPass; + @JsonProperty("admin_tenant") + @BusinessKey + private String adminTenant; + @JsonProperty("member_role") + @BusinessKey + private String memberRole; + @JsonProperty("tenant_metadata") + @BusinessKey + private Boolean tenantMetadata; + @JsonProperty("identity_server_type") + @BusinessKey + private ServerType identityServerType; + @JsonProperty("identity_authentication_type") + @BusinessKey + private AuthenticationType identityAuthenticationType; + + public CloudIdentity() {} + + public String getId () { + return id; + } + + public void setId (String id) { + this.id = id; + } + + public String getIdentityUrl() { + return this.identityUrl; + } + public void setIdentityUrl(String url) { + this.identityUrl = url; + } + + public String getMsoId () { + return msoId; + } + + public void setMsoId (String id) { + this.msoId = id; + } + + public String getMsoPass () { + return msoPass; + } + + public void setMsoPass (String pwd) { + this.msoPass = pwd; + } + + public String getAdminTenant () { + return adminTenant; + } + + public void setAdminTenant (String tenant) { + this.adminTenant = tenant; + } + + public String getMemberRole () { + return memberRole; + } + + public void setMemberRole (String role) { + this.memberRole = role; + } + + public Boolean hasTenantMetadata () { + return tenantMetadata; + } + + public void setTenantMetadata (Boolean meta) { + this.tenantMetadata = meta; + } + + public ServerType getIdentityServerType() { + return this.identityServerType; + } + public void setIdentityServerType(ServerType ist) { + this.identityServerType = ist; + } + public String getIdentityServerTypeAsString() { + return this.identityServerType.toString(); + } + /** + * @return the identityAuthenticationType + */ + public AuthenticationType getIdentityAuthenticationType() { + return identityAuthenticationType; + } + + /** + * @param identityAuthenticationType the identityAuthenticationType to set + */ + public void setIdentityAuthenticationType(AuthenticationType identityAuthenticationType) { + this.identityAuthenticationType = identityAuthenticationType; + } + + @Override + public CloudIdentity clone() { + CloudIdentity cloudIdentityCopy = new CloudIdentity(); + + cloudIdentityCopy.id = this.id; + cloudIdentityCopy.identityUrl = this.identityUrl; + cloudIdentityCopy.msoId = this.msoId; + cloudIdentityCopy.msoPass = this.msoPass; + cloudIdentityCopy.adminTenant = this.adminTenant; + cloudIdentityCopy.memberRole = this.memberRole; + cloudIdentityCopy.tenantMetadata = this.tenantMetadata; + cloudIdentityCopy.identityServerType = this.identityServerType; + cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType; + + return cloudIdentityCopy; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId()) + .append("identityUrl", getIdentityUrl()).append("msoId", getMsoId()) + .append("adminTenant", getAdminTenant()).append("memberRole", getMemberRole()) + .append("tenantMetadata", hasTenantMetadata()).append("identityServerType", getIdentityServerType()) + .append("identityAuthenticationType", getIdentityAuthenticationType()).toString(); + } + + @Override + public boolean equals(final Object other) { + if (other == null) { + return false; + } + if (!getClass().equals(other.getClass())) { + return false; + } + CloudIdentity castOther = (CloudIdentity) other; + return new EqualsBuilder().append(getId(), castOther.getId()) + .append(getIdentityUrl(), castOther.getIdentityUrl()).append(getMsoId(), castOther.getMsoId()) + .append(getMsoPass(), castOther.getMsoPass()).append(getAdminTenant(), castOther.getAdminTenant()) + .append(getMemberRole(), castOther.getMemberRole()) + .append(hasTenantMetadata(), castOther.hasTenantMetadata()) + .append(getIdentityServerType(), castOther.getIdentityServerType()) + .append(getIdentityAuthenticationType(), castOther.getIdentityAuthenticationType()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(1, 31).append(getId()).append(getIdentityUrl()).append(getMsoId()) + .append(getMsoPass()).append(getAdminTenant()).append(getMemberRole()).append(hasTenantMetadata()) + .append(getIdentityServerType()).append(getIdentityAuthenticationType()).toHashCode(); + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java new file mode 100644 index 0000000000..f38403d0cd --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudSite.java @@ -0,0 +1,196 @@ +/*- + * ============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.cloud; + + +import java.util.Comparator; + +import com.fasterxml.jackson.annotation.JsonProperty; +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; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * JavaBean JSON class for a CloudSite. This bean represents a cloud location + * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig + * object, of which it is a component (a CloudConfig JSON configuration file + * will contain multiple CloudSite definitions). + * + * Note that this is only used to access Cloud Configurations loaded from a + * JSON config file, so there are no explicit setters. + * + */ +public class CloudSite { + @JsonProperty + @BusinessKey + private String id; + @JsonProperty("region_id") + @BusinessKey + private String regionId; + @JsonProperty("identity_service_id") + @BusinessKey + private String identityServiceId; + @JsonProperty("aic_version") + @BusinessKey + private String aicVersion; + @JsonProperty("clli") + @BusinessKey + private String clli; + @JsonProperty("cloudify_id") + @BusinessKey + private String cloudifyId; + @JsonProperty("platform") + @BusinessKey + private String platform; + @JsonProperty("orchestrator") + @BusinessKey + private String orchestrator; + + // Derived property (set by CloudConfig loader based on identityServiceId) + private CloudIdentity identityService; + // Derived property (set by CloudConfig loader based on cloudifyId) + private CloudifyManager cloudifyManager; + + public CloudSite() { + + } + + public CloudSite(CloudSite site) { + this.aicVersion = site.getAicVersion(); + this.clli = site.getClli(); + this.cloudifyId = this.getCloudifyId(); + this.cloudifyManager = this.getCloudifyManager(); + this.id = site.getId(); + this.identityService = site.getIdentityService(); + this.identityServiceId = site.getIdentityServiceId(); + this.orchestrator = site.getOrchestrator(); + this.platform = site.getPlatform(); + this.regionId = this.getRegionId(); + } + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + } + + public String getRegionId() { + return regionId; + } + + public void setRegionId(String regionId) { + this.regionId = regionId; + } + + public String getIdentityServiceId() { + return identityServiceId; + } + + public void setIdentityServiceId(String identityServiceId) { + this.identityServiceId = identityServiceId; + } + public String getAicVersion() { + return aicVersion; + } + + public void setAicVersion(String aicVersion) { + this.aicVersion = aicVersion; + } + + public String getClli() { + return clli; + } + + public void setClli(String clli) { + this.clli = clli; + } + + public String getCloudifyId() { + return cloudifyId; + } + + public void setCloudifyId (String id) { + this.cloudifyId = id; + } + + public String getPlatform() { + return platform; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getOrchestrator() { + return orchestrator; + } + + public void setOrchestrator(String orchestrator) { + this.orchestrator = orchestrator; + } + + public CloudIdentity getIdentityService () { + return identityService; + } + + public void setIdentityService (CloudIdentity identity) { + this.identityService = identity; + } + + public CloudifyManager getCloudifyManager () { + return cloudifyManager; + } + + public void setCloudifyManager (CloudifyManager cloudify) { + this.cloudifyManager = cloudify; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId()) + .append("identityServiceId", getIdentityServiceId()).append("aicVersion", getAicVersion()) + .append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform()) + .append("orchestrator", getOrchestrator()).toString(); + } + + @Override + public boolean equals(final Object other) { + if (other == null) { + return false; + } + if (!getClass().equals(other.getClass())) { + return false; + } + CloudSite castOther = (CloudSite) other; + return new EqualsBuilder().append(getRegionId(), castOther.getRegionId()) + .append(getIdentityServiceId(), castOther.getIdentityServiceId()) + .append(getAicVersion(), castOther.getAicVersion()).append(getClli(), castOther.getClli()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(1, 31).append(getRegionId()).append(getIdentityServiceId()).append(getAicVersion()) + .append(getClli()).toHashCode(); + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java new file mode 100644 index 0000000000..1bf3f136b0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudifyManager.java @@ -0,0 +1,153 @@ +/*- + * ============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.cloud; + +import java.security.GeneralSecurityException; +import java.util.Comparator; + +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.utils.CryptoUtils; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; + +/** + * JavaBean JSON class for a Cloudify Manager. This bean represents a Cloudify + * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the + * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints. + * Cloudify Managers may support multiple Cloud Sites, but each site will have + * at most one Cloudify Manager. + * + * This does not replace the ability to use the CloudSite directly via Openstack. + * + * Note that this is only used to access Cloud Configurations loaded from a + * JSON config file, so there are no explicit setters. + * + * @author JC1348 + */ +public class CloudifyManager { + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, CloudifyManager.class); + + @BusinessKey + @JsonProperty + private String id; + + @BusinessKey + @JsonProperty ("cloudify_url") + private String cloudifyUrl; + + @BusinessKey + @JsonProperty("username") + private String username; + + @BusinessKey + @JsonProperty("password") + private String password; + + @BusinessKey + @JsonProperty("version") + private String version; + + public CloudifyManager() {} + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + + public String getCloudifyUrl() { + return cloudifyUrl; + } + + public void setCloudifyUrl(String cloudifyUrl) { + this.cloudifyUrl = cloudifyUrl; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public CloudifyManager clone() { + CloudifyManager cloudifyManagerCopy = new CloudifyManager(); + cloudifyManagerCopy.id = this.id; + cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl; + cloudifyManagerCopy.username = this.username; + cloudifyManagerCopy.password = this.password; + cloudifyManagerCopy.version = this.version; + return cloudifyManagerCopy; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId()) + .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername()) + .append("password", getPassword()).append("version", getVersion()).toString(); + } + + @Override + public boolean equals(final Object other) { + if (other == null) { + return false; + } + if (!getClass().equals(other.getClass())) { + return false; + } + CloudifyManager castOther = (CloudifyManager) other; + return new EqualsBuilder().append(getId(), castOther.getId()) + .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername()) + .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername()) + .append(getPassword()).append(getVersion()).toHashCode(); + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java new file mode 100644 index 0000000000..ac59018c6b --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/ServerType.java @@ -0,0 +1,25 @@ +/*- + * ============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.cloud; + +public enum ServerType { + KEYSTONE, ORM; +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java new file mode 100644 index 0000000000..5c648eb5e3 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/AuthenticationMethodFactory.java @@ -0,0 +1,53 @@ +/*- + * ============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.cloud.authentication; + +import org.onap.so.cloud.AuthenticationType; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.authentication.models.RackspaceAuthentication; +import org.onap.so.utils.CryptoUtils; +import org.springframework.stereotype.Component; + +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +/** + * This factory manages all the wrappers associated to authentication types. + * + */ +@Component +public final class AuthenticationMethodFactory { + + public final Authentication getAuthenticationFor(CloudIdentity cloudIdentity) { + if (cloudIdentity == null) { + throw new IllegalArgumentException("Cloud identity cannot be null"); + } + if ((cloudIdentity.getIdentityAuthenticationType() == null)|| ("".equals(cloudIdentity.getIdentityAuthenticationType().toString()))) { + throw new IllegalArgumentException("Cloud identity authentication type cannot be null or empty, provided value is " + cloudIdentity.getIdentityAuthenticationType() + "."); + } + AuthenticationType authenticationType = cloudIdentity.getIdentityAuthenticationType(); + if (AuthenticationType.RACKSPACE_APIKEY.equals(authenticationType)) { + return new RackspaceAuthentication (cloudIdentity.getMsoId (), CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ())); + } else { + return new UsernamePassword (cloudIdentity.getMsoId (), CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ())); + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/models/RackspaceAuthentication.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/models/RackspaceAuthentication.java new file mode 100644 index 0000000000..009c9a4c6c --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/models/RackspaceAuthentication.java @@ -0,0 +1,102 @@ +/*- + * ============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.cloud.authentication.models; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.woorea.openstack.keystone.model.Authentication; + +@JsonRootName("auth") +public class RackspaceAuthentication extends Authentication { + + /** + * + */ + private static final long serialVersionUID = 5451283386875662918L; + + @JsonIgnore + private String tenantId; + + @JsonIgnore + private String tenantName; + + public static final class Token implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -4448875265818207908L; + private String username; + private String apiKey; + + /** + * @return the username + */ + public String getUsername() { + return username; + } + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + /** + * @return the apiKey + */ + public String getApiKey() { + return apiKey; + } + /** + * @param apiKey the apiKey to set + */ + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + } + + @JsonProperty("RAX-KSKEY:apiKeyCredentials") + private Token token = new Token(); + + public RackspaceAuthentication (String username, String apiKey) { + this.token.username = username; + this.token.apiKey = apiKey; + + } + + /** + * @return the token + */ + public Token getToken() { + return token; + } + + /** + * @param token the token to set + */ + public void setToken(Token token) { + this.token = token; + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfo.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfo.java new file mode 100644 index 0000000000..c6e29d05d7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentInfo.java @@ -0,0 +1,186 @@ +/*- + * ============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.cloudify.beans; + +import java.util.HashMap; +import java.util.Map; + +import org.onap.so.cloudify.v3.model.Deployment; +import org.onap.so.cloudify.v3.model.DeploymentOutputs; +import org.onap.so.cloudify.v3.model.Execution; + +/* + * This Java bean class relays Heat stack status information to ActiveVOS processes. + * + * This bean is returned by all Heat-specific adapter operations (create, query, delete) + */ + +public class DeploymentInfo { + // Set defaults for everything + private String id = ""; + private DeploymentStatus status = DeploymentStatus.NOTFOUND; + private Map outputs = new HashMap(); + private Map inputs = new HashMap(); + private String lastAction; + private String actionStatus; + private String errorMessage; + + public DeploymentInfo () { + } + + public DeploymentInfo (String id, Map outputs) { + this.id = id; + if (outputs != null) this.outputs = outputs; + } + + public DeploymentInfo (String id) { + this.id = id; + } + + public DeploymentInfo (String id, DeploymentStatus status) { + this.id = id; + this.status = status; + } + + public DeploymentInfo (Deployment deployment) { + this(deployment, null, null); + } + + /** + * Construct a DeploymentInfo object from a deployment and the latest Execution action + * @param deployment + * @param execution + */ + public DeploymentInfo (Deployment deployment, DeploymentOutputs outputs, Execution execution) + { + if (deployment == null) { + this.id = null; + return; + } + + this.id = deployment.getId(); + + if (outputs != null) + this.outputs = outputs.getOutputs(); + + if (deployment.getInputs() != null) + this.inputs = deployment.getInputs(); + + if (execution != null) { + this.lastAction = execution.getWorkflowId(); + this.actionStatus = execution.getStatus(); + this.errorMessage = execution.getError(); + + // Compute the status based on the last workflow + if (lastAction.equals("install")) { + if (actionStatus.equals("terminated")) + this.status = DeploymentStatus.INSTALLED; + else if (actionStatus.equals("failed")) + this.status = DeploymentStatus.FAILED; + else if (actionStatus.equals("started") || actionStatus.equals("pending")) + this.status = DeploymentStatus.INSTALLING; + else + this.status = DeploymentStatus.UNKNOWN; + } + else if (lastAction.equals("uninstall")) { + if (actionStatus.equals("terminated")) + this.status = DeploymentStatus.CREATED; + else if (actionStatus.equals("failed")) + this.status = DeploymentStatus.FAILED; + else if (actionStatus.equals("started") || actionStatus.equals("pending")) + this.status = DeploymentStatus.UNINSTALLING; + else + this.status = DeploymentStatus.UNKNOWN; + } + else { + // Could have more cases in the future for different actions. + this.status = DeploymentStatus.UNKNOWN; + } + } + else { + this.status = DeploymentStatus.CREATED; + } + } + + public String getId() { + return id; + } + + public void setId (String id) { + this.id = id; + } + + public DeploymentStatus getStatus() { + return status; + } + + public void setStatus (DeploymentStatus status) { + this.status = status; + } + + public Map getOutputs () { + return outputs; + } + + public void setOutputs (Map outputs) { + this.outputs = outputs; + } + + public Map getInputs () { + return inputs; + } + + public void setInputs (Map inputs) { + this.inputs = inputs; + } + + public String getLastAction() { + return lastAction; + } + + public String getActionStatus() { + return actionStatus; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void saveExecutionStatus (Execution execution) { + this.lastAction = execution.getWorkflowId(); + this.actionStatus = execution.getStatus(); + this.errorMessage = execution.getError(); + } + + @Override + public String toString() { + return "DeploymentInfo {" + + "id='" + id + '\'' + + ", inputs='" + inputs + '\'' + + ", outputs='" + outputs + '\'' + + ", lastAction='" + lastAction + '\'' + + ", status='" + status + '\'' + + ", errorMessage='" + errorMessage + '\'' + + '}'; + } + +} + diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentStatus.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentStatus.java new file mode 100644 index 0000000000..5aa47e9d6b --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/beans/DeploymentStatus.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.cloudify.beans; + + +/* + * Enum status values to capture the state of a deployment, based on last known workflow + * (assume only INSTALL and UNINSTALL at this point). + */ +public enum DeploymentStatus { + NOTFOUND, CREATED, INSTALLED, FAILED, INSTALLING, UNINSTALLING, UNKNOWN +} + diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoBlueprintAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoBlueprintAlreadyExists.java new file mode 100644 index 0000000000..d5d5684b0f --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoBlueprintAlreadyExists.java @@ -0,0 +1,33 @@ +/*- + * ============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.cloudify.exceptions; + +public class MsoBlueprintAlreadyExists extends MsoCloudifyException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoCloudifyException instance + public MsoBlueprintAlreadyExists (String blueprintId, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Blueprint " + blueprintId + " already exists in Cloudify Manager supporting cloud site + " + cloud); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyException.java new file mode 100644 index 0000000000..992df5fd6a --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyException.java @@ -0,0 +1,86 @@ +/*- + * ============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.cloudify.exceptions; + +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +/** + * OpenStack exception. + */ +public class MsoCloudifyException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 3313636124141766495L; + + private int statusCode; + private String statusMessage; + private String errorDetail; + private boolean pendingWorkflow; + + /** + * Constructor to create a new MsoOpenstackException instance + * @param code the error code + * @param message the error message + * @param detail error details + */ + public MsoCloudifyException (int code, String message, String detail) { + // Set the detailed error as the Exception 'message' + super(detail); + super.category = MsoExceptionCategory.OPENSTACK; + + this.statusCode = code; + this.statusMessage = message; + this.errorDetail = detail; + this.pendingWorkflow = false; + } + + /** + * Constructor to propagate the caught exception (mostly for stack trace) + * @param code the error code + * @param message the error message + * @param detail error details + * @param e the cause + */ + public MsoCloudifyException (int code, String message, String detail, Exception e) { + // Set the detailed error as the Exception 'message' + super(detail, e); + super.category = MsoExceptionCategory.OPENSTACK; + + this.statusCode = code; + this.statusMessage = message; + this.errorDetail = detail; + this.pendingWorkflow = false; + } + + public void setPendingWorkflow (boolean pendingWorkflow) { + this.pendingWorkflow = pendingWorkflow; + } + + @Override + public String toString () { + String error = "" + statusCode + " " + statusMessage + ": " + errorDetail + (pendingWorkflow ? " [workflow pending]" : ""); + return error; + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyManagerNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyManagerNotFound.java new file mode 100644 index 0000000000..0c795478cd --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyManagerNotFound.java @@ -0,0 +1,33 @@ +/*- + * ============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.cloudify.exceptions; + +public class MsoCloudifyManagerNotFound extends MsoCloudifyException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoCloudifyException instance + public MsoCloudifyManagerNotFound (String cloudSiteId) { + // Set the detailed error as the Exception 'message' + super(0, "Cloudify Manager Not Found", "No Cloudify Manager configured for cloud site " + cloudSiteId); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeout.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeout.java new file mode 100644 index 0000000000..7dcd69d0a4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeout.java @@ -0,0 +1,64 @@ +/*- + * ============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.cloudify.exceptions; + +import org.onap.so.cloudify.v3.model.Execution; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +/** + * MSO Exception when a Cloudify workflow execution times out waiting for completion. + * Exception includes the last known state of the workflow execution. + */ +public class MsoCloudifyTimeout extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 3313636124141766495L; + + private Execution execution; + + /** + * Constructor to create a new MsoOpenstackException instance + * @param code the error code + * @param message the error message + * @param detail error details + */ + public MsoCloudifyTimeout (Execution execution) { + // Set the detailed error as the Exception 'message' + super("Cloudify Workflow Timeout for workflow " + execution.getWorkflowId() + " on deployment " + execution.getDeploymentId()); + super.category = MsoExceptionCategory.OPENSTACK; + + this.execution = execution; + } + + public Execution getExecution() { + return this.execution; + } + + @Override + public String toString () { + String error = "Workflow timeout: workflow=" + execution.getWorkflowId() + ",deployment=" + execution.getDeploymentId(); + return error; + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java new file mode 100644 index 0000000000..a84da50dc4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowException.java @@ -0,0 +1,54 @@ +/*- + * ============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.cloudify.exceptions; + +/** + * Reports an error with a Cloudify Workflow execution. + * @author JC1348 + * + */ +public class MsoCloudifyWorkflowException extends MsoCloudifyException { + + private static final long serialVersionUID = 1L; + + private String workflowStatus; + private boolean workflowStillRunning = false; + + // Constructor to create a new MsoCloudifyException instance + public MsoCloudifyWorkflowException (String message, String deploymentId, String workflowId, String workflowStatus) + { + super(0, "Workflow Exception", "Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message); + this.workflowStatus = workflowStatus; + if (workflowStatus.equals("pending") || workflowStatus.equals("started") || + workflowStatus.equals("cancelling") || workflowStatus.equals("force_cancelling")) + { + workflowStillRunning = true; + } + } + + public String getWorkflowStatus() { + return workflowStatus; + } + + public boolean isWorkflowStillRunning () { + return workflowStillRunning; + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoDeploymentAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoDeploymentAlreadyExists.java new file mode 100644 index 0000000000..4f5685efb3 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/exceptions/MsoDeploymentAlreadyExists.java @@ -0,0 +1,33 @@ +/*- + * ============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.cloudify.exceptions; + +public class MsoDeploymentAlreadyExists extends MsoCloudifyException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoCloudifyException instance + public MsoDeploymentAlreadyExists (String deploymentId, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Deployment " + deploymentId + " already exists in Cloudify Manager suppporting cloud " + cloud); + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java new file mode 100644 index 0000000000..aa8e37f12b --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java @@ -0,0 +1,1408 @@ +/*- + * ============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.cloudify.utils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import org.onap.so.adapters.vdu.CloudInfo; +import org.onap.so.adapters.vdu.PluginAction; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduException; +import org.onap.so.adapters.vdu.VduInstance; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.adapters.vdu.VduPlugin; +import org.onap.so.adapters.vdu.VduStateType; +import org.onap.so.adapters.vdu.VduStatus; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloud.CloudifyManager; +import org.onap.so.cloudify.base.client.CloudifyBaseException; +import org.onap.so.cloudify.base.client.CloudifyClientTokenProvider; +import org.onap.so.cloudify.base.client.CloudifyConnectException; +import org.onap.so.cloudify.base.client.CloudifyRequest; +import org.onap.so.cloudify.base.client.CloudifyResponseException; +import org.onap.so.cloudify.beans.DeploymentInfo; +import org.onap.so.cloudify.beans.DeploymentStatus; +import org.onap.so.cloudify.exceptions.MsoCloudifyException; +import org.onap.so.cloudify.exceptions.MsoCloudifyManagerNotFound; +import org.onap.so.cloudify.exceptions.MsoDeploymentAlreadyExists; +import org.onap.so.cloudify.v3.client.BlueprintsResource.GetBlueprint; +import org.onap.so.cloudify.v3.client.BlueprintsResource.UploadBlueprint; +import org.onap.so.cloudify.v3.client.Cloudify; +import org.onap.so.cloudify.v3.client.DeploymentsResource.CreateDeployment; +import org.onap.so.cloudify.v3.client.DeploymentsResource.DeleteDeployment; +import org.onap.so.cloudify.v3.client.DeploymentsResource.GetDeployment; +import org.onap.so.cloudify.v3.client.DeploymentsResource.GetDeploymentOutputs; +import org.onap.so.cloudify.v3.client.ExecutionsResource.CancelExecution; +import org.onap.so.cloudify.v3.client.ExecutionsResource.GetExecution; +import org.onap.so.cloudify.v3.client.ExecutionsResource.ListExecutions; +import org.onap.so.cloudify.v3.client.ExecutionsResource.StartExecution; +import org.onap.so.cloudify.v3.model.AzureConfig; +import org.onap.so.cloudify.v3.model.Blueprint; +import org.onap.so.cloudify.v3.model.CancelExecutionParams; +import org.onap.so.cloudify.v3.model.CloudifyError; +import org.onap.so.cloudify.v3.model.CreateDeploymentParams; +import org.onap.so.cloudify.v3.model.Deployment; +import org.onap.so.cloudify.v3.model.DeploymentOutputs; +import org.onap.so.cloudify.v3.model.Execution; +import org.onap.so.cloudify.v3.model.Executions; +import org.onap.so.cloudify.v3.model.OpenstackConfig; +import org.onap.so.cloudify.v3.model.StartExecutionParams; +import org.onap.so.config.beans.PoConfig; +import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.exceptions.MsoAdapterException; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.onap.so.openstack.utils.MsoCommonUtils; +import org.onap.so.utils.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ + + private static final String CLOUDIFY_ERROR = "CloudifyError"; + private static final String CLOUDIFY = "Cloudify"; + private static final String CREATE_DEPLOYMENT = "CreateDeployment"; + private static final String DELETE_DEPLOYMENT = "DeleteDeployment"; + private static final String TERMINATED = "terminated"; + private static final String CANCELLED = "cancelled"; + + // Fetch cloud configuration each time (may be cached in CloudConfig class) + @Autowired + protected CloudConfig cloudConfig; + + @Autowired + private Environment environment; + + @Autowired + private PoConfig poConfig; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoCloudifyUtils.class); + + // Properties names and variables (with default values) + protected String createPollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; + private String deletePollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; + + protected String createPollIntervalDefault = "15"; + private String deletePollIntervalDefault = "15"; + + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + + /** + * Create a new Deployment from a specified blueprint, and install it in the specified + * cloud location and tenant. The blueprint identifier and parameter map are passed in + * as arguments, along with the cloud access credentials. The blueprint should have been + * previously uploaded to Cloudify. + * + * It is expected that parameters have been validated and contain at minimum the required + * parameters for the given template with no extra (undefined) parameters.. + * + * The deployment ID supplied by the caller must be unique in the scope of the Cloudify + * tenant (not the Openstack tenant). However, it should also be globally unique, as it + * will be the identifier for the resource going forward in Inventory. This latter is + * managed by the higher levels invoking this function. + * + * This function executes the "install" workflow on the newly created workflow. Cloudify + * will be polled for completion unless the client requests otherwise. + * + * An error will be thrown if the requested Deployment already exists in the specified + * Cloudify instance. + * + * @param cloudSiteId The cloud (may be a region) in which to create the stack. + * @param tenantId The Openstack ID of the tenant in which to create the Stack + * @param deploymentId The identifier (name) of the deployment to create + * @param blueprintId The blueprint from which to create the deployment. + * @param inputs A map of key/value inputs + * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client + * @param timeoutMinutes Timeout after which the "install" will be cancelled + * @param environment An optional yaml-format string to specify environmental parameters + * @param backout Flag to delete deployment on install Failure - defaulted to True + * @return A DeploymentInfo object + * @throws MsoCloudifyException Thrown if the Cloudify API call returns an exception. + * @throws MsoIOException Thrown on Cloudify connection errors. + */ + + public DeploymentInfo createAndInstallDeployment (String cloudSiteId, + String tenantId, + String deploymentId, + String blueprintId, + Map inputs, + boolean pollForCompletion, + int timeoutMinutes, + boolean backout) throws MsoException + { + // Obtain the cloud site information where we will create the stack + Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); + if (!cloudSite.isPresent()) { + throw new MsoCloudSiteNotFound (cloudSiteId); + } + + Cloudify cloudify = getCloudifyClient (cloudSite.get()); + + LOGGER.debug ("Ready to Create Deployment (" + deploymentId + ") with input params: " + inputs); + + // Build up the inputs, including: + // - from provided "environment" file + // - passed in by caller + // - special input for cloud-specific Credentials + Map expandedInputs = new HashMap<> (inputs); + + String platform = cloudSite.get().getPlatform(); + if (platform == null || platform.equals("") || platform.equalsIgnoreCase("OPENSTACK")) { + // Create the Cloudify OpenstackConfig with the credentials + OpenstackConfig openstackConfig = getOpenstackConfig (cloudSite.get(), tenantId); + expandedInputs.put("openstack_config", openstackConfig); + } else if (platform.equalsIgnoreCase("AZURE")) { + // Create Cloudify AzureConfig with the credentials + AzureConfig azureConfig = getAzureConfig (cloudSite.get(), tenantId); + expandedInputs.put("azure_config", azureConfig); + } + + // Build up the parameters to create a new deployment + CreateDeploymentParams deploymentParams = new CreateDeploymentParams(); + deploymentParams.setBlueprintId(blueprintId); + deploymentParams.setInputs(expandedInputs); + + Deployment deployment = null; + try { + CreateDeployment createDeploymentRequest = cloudify.deployments().create(deploymentId, deploymentParams); + LOGGER.debug (createDeploymentRequest.toString()); + + deployment = executeAndRecordCloudifyRequest (createDeploymentRequest); + } + catch (CloudifyResponseException e) { + // Since this came on the 'Create Deployment' command, nothing was changed + // in the cloud. Return the error as an exception. + if (e.getStatus () == 409) { + // Deployment already exists. Return a specific error for this case + MsoException me = new MsoDeploymentAlreadyExists (deploymentId, cloudSiteId); + me.addContext (CREATE_DEPLOYMENT); + throw me; + } else { + // Convert the CloudifyResponseException to an MsoException + LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); + MsoException me = cloudifyExceptionToMsoException (e, CREATE_DEPLOYMENT); + me.setCategory (MsoExceptionCategory.OPENSTACK); + throw me; + } + } catch (CloudifyConnectException e) { + // Error connecting to Cloudify instance. Convert to an MsoException + throw cloudifyExceptionToMsoException (e, CREATE_DEPLOYMENT); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, CREATE_DEPLOYMENT); + } + + /* + * It can take some time for Cloudify to be ready to execute a workflow + * on the deployment. Sleep 30 seconds based on observation of behavior + * in a Cloudify VM instance (delay due to "create_deployment_environment"). + */ + sleep(30000); + + /* + * Next execute the "install" workflow. + * Note - this assumes there are no additional parameters required for the workflow. + */ + int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); + int pollTimeout = (timeoutMinutes * 60) + createPollInterval; + + Execution installWorkflow = null; + + try { + installWorkflow = executeWorkflow (cloudify, deploymentId, "install", null, pollForCompletion, pollTimeout, createPollInterval); + + if (installWorkflow.getStatus().equals(TERMINATED)) { + // Success! + // Create and return a DeploymentInfo structure. Include the Runtime outputs + DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId); + return new DeploymentInfo (deployment, outputs, installWorkflow); + } + else { + // The workflow completed with errors. Must try to back it out. + if (!backout) + { + LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Deployment installation failed, backout deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Deployment Installation, backout suppressed"); + } + else { + // Poll on delete if we rollback - use same values for now + int deletePollInterval = createPollInterval; + int deletePollTimeout = pollTimeout; + + try { + // Run the uninstall to undo the install + Execution uninstallWorkflow = executeWorkflow (cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout, deletePollInterval); + + if (uninstallWorkflow.getStatus().equals(TERMINATED)) + { + // The uninstall completed. Delete the deployment itself + DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId); + executeAndRecordCloudifyRequest (deleteRequest); + } + else { + // Didn't uninstall successfully. Log this error + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Deployment: Cloudify error rolling back deployment install: " + installWorkflow.getError(), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Cloudify error rolling back deployment installation"); + } + } + catch (Exception e) { + // Catch-all for backout errors trying to uninstall/delete + // Log this error, and return the original exception + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back deployment install: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back deployment installation"); + } + } + + MsoCloudifyException me = new MsoCloudifyException (0, "Workflow Execution Failed", installWorkflow.getError()); + me.addContext (CREATE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + } + catch (MsoException me) { + // Install failed. Unless requested otherwise, back out the deployment + + if (!backout) + { + LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Deployment installation failed, backout deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Deployment Installation, backout suppressed"); + } + else { + // Poll on delete if we rollback - use same values for now + int deletePollInterval = createPollInterval; + int deletePollTimeout = pollTimeout; + + try { + // Run the uninstall to undo the install. + // Always try to run it, as it should be idempotent + executeWorkflow (cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout, deletePollInterval); + + // Delete the deployment itself + DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId); + executeAndRecordCloudifyRequest (deleteRequest); + } + catch (Exception e) { + // Catch-all for backout errors trying to uninstall/delete + // Log this error, and return the original exception + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back deployment install: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back deployment installation"); + + } + } + + // Propagate the original exception from Stack Query. + me.addContext (CREATE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + } + + + /* + * Get the runtime Outputs of a deployment. + * Return the Map of tag/value outputs. + */ + private DeploymentOutputs getDeploymentOutputs (Cloudify cloudify, String deploymentId) + throws MsoException + { + // Build and send the Cloudify request + DeploymentOutputs deploymentOutputs = null; + try { + GetDeploymentOutputs queryDeploymentOutputs = cloudify.deployments().outputsById(deploymentId); + LOGGER.debug (queryDeploymentOutputs.toString()); + + deploymentOutputs = executeAndRecordCloudifyRequest(queryDeploymentOutputs); + } + catch (CloudifyConnectException ce) { + // Couldn't connect to Cloudify + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "QueryDeploymentOutputs: Cloudify connection failure: " + ce, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "QueryDeploymentOutputs: Cloudify connection failure"); + throw new MsoIOException (ce.getMessage(), ce); + } + catch (CloudifyResponseException re) { + if (re.getStatus () == 404) { + // No Outputs + return null; + } + throw new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getLocalizedMessage(), re); + } + catch (Exception e) { + // Catch-all + throw new MsoAdapterException (e.getMessage(), e); + } + + return deploymentOutputs; + } + + /* + * Execute a workflow on a deployment. Handle polling for completion with timeout. + * Return the final Execution object with status. + * Throw an exception on Errors. + * Question - how does the client know whether rollback needs to be done? + */ + private Execution executeWorkflow (Cloudify cloudify, String deploymentId, String workflowId, Map workflowParams, boolean pollForCompletion, int timeout, int pollInterval) + throws MsoCloudifyException + { + LOGGER.debug("Executing '" + workflowId + "' workflow on deployment '" + deploymentId + "'"); + + StartExecutionParams executeParams = new StartExecutionParams(); + executeParams.setWorkflowId(workflowId); + executeParams.setDeploymentId(deploymentId); + executeParams.setParameters(workflowParams); + + Execution execution = null; + String executionId = null; + String command = "start"; + Exception savedException = null; + + try { + StartExecution executionRequest = cloudify.executions().start(executeParams); + LOGGER.debug (executionRequest.toString()); + execution = executeAndRecordCloudifyRequest (executionRequest); + executionId = execution.getId(); + + if (!pollForCompletion) { + // Client did not request polling, so just return the Execution object + return execution; + } + + // Enter polling loop + boolean timedOut = false; + int pollTimeout = timeout; + + String status = execution.getStatus(); + + // Create a reusable cloudify query request + GetExecution queryExecution = cloudify.executions().byId(executionId); + command = "query"; + + while (!timedOut && !(status.equals(TERMINATED) || status.equals("failed") || status.equals(CANCELLED))) + { + // workflow is still running; check for timeout + if (pollTimeout <= 0) { + LOGGER.debug ("workflow " + execution.getWorkflowId() + " timed out on deployment " + execution.getDeploymentId()); + timedOut = true; + continue; + } + + sleep(pollInterval * 1000L); + + pollTimeout -= pollInterval; + LOGGER.debug("pollTimeout remaining: " + pollTimeout); + + execution = queryExecution.execute(); + status = execution.getStatus(); + } + + // Broke the loop. Check again for a terminal state + if (status.equals(TERMINATED)){ + // Success! + LOGGER.debug ("Workflow '" + workflowId + "' completed successfully on deployment '" + deploymentId + "'"); + return execution; + } + else if (status.equals("failed")){ + // Workflow failed. Log it and return the execution object (don't throw exception here) + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Cloudify workflow failure: " + execution.getError(), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow: Failed: " + execution.getError()); + return execution; + } + else if (status.equals(CANCELLED)){ + // Workflow was cancelled, leaving the deployment in an indeterminate state. Log it and return the execution object (don't throw exception here) + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Cloudify workflow cancelled. Deployment is in an indeterminate state", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow cancelled: " + workflowId); + return execution; + } + else { + // Can only get here after a timeout + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Cloudify workflow timeout", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow: Timed Out"); + } + } + catch (CloudifyConnectException ce) { + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Cloudify connection failure: " + ce, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Cloudify connection failure"); + savedException = ce; + } + catch (CloudifyResponseException re) { + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Cloudify response error: " + re, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Cloudify error" + re.getMessage()); + savedException = re; + } + catch (RuntimeException e) { + // Catch-all + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Unexpected error: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Internal error" + e.getMessage()); + savedException = e; + } + + // Get to this point ONLY on an error or timeout + // The cloudify execution is still running (we've not received a terminal status), + // so try to Cancel it. + CancelExecutionParams cancelParams = new CancelExecutionParams(); + cancelParams.setAction("cancel"); + // TODO: Use force_cancel? + + Execution cancelExecution = null; + + try { + CancelExecution cancelRequest = cloudify.executions().cancel(executionId, cancelParams); + LOGGER.debug (cancelRequest.toString()); + cancelExecution = cancelRequest.execute(); + + // Enter polling loop + boolean timedOut = false; + int cancelTimeout = timeout; // TODO: For now, just use same timeout + + String status = cancelExecution.getStatus(); + + // Poll for completion. Create a reusable cloudify query request + GetExecution queryExecution = cloudify.executions().byId(executionId); + + while (!timedOut && !status.equals(CANCELLED)) + { + // workflow is still running; check for timeout + if (cancelTimeout <= 0) { + LOGGER.debug ("Cancel timeout for workflow " + workflowId + " on deployment " + deploymentId); + timedOut = true; + continue; + } + + sleep(pollInterval * 1000L); + + cancelTimeout -= pollInterval; + LOGGER.debug("pollTimeout remaining: " + cancelTimeout); + + execution = queryExecution.execute(); + status = execution.getStatus(); + } + + // Broke the loop. Check again for a terminal state + if (status.equals(CANCELLED)){ + // Finished cancelling. Return the original exception + LOGGER.debug ("Cancel workflow " + workflowId + " completed on deployment " + deploymentId); + throw new MsoCloudifyException (-1, "", "", savedException); + } + else { + // Can only get here after a timeout + LOGGER.debug ("Cancel workflow " + workflowId + " timeout out on deployment " + deploymentId); + MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException); + exception.setPendingWorkflow(true); + throw exception; + } + } + catch (Exception e) { + // Catch-all. Log the message and throw the original exception +// LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Unexpected error: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Internal error" + e.getMessage()); + LOGGER.debug ("Cancel workflow " + workflowId + " failed for deployment " + deploymentId + ": " + e.getMessage()); + MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException); + exception.setPendingWorkflow(true); + throw exception; + } + } + + + + /** + * Query for a Cloudify Deployment (by Name). This call will always return a + * DeploymentInfo object. If the deployment does not exist, an "empty" DeploymentInfo will be + * returned - containing only the deployment ID and a special status of NOTFOUND. + * + * @param tenantId The Openstack ID of the tenant in which to query + * @param cloudSiteId The cloud identifier (may be a region) in which to query + * @param stackName The name of the stack to query (may be simple or canonical) + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + */ + public DeploymentInfo queryDeployment (String cloudSiteId, String tenantId, String deploymentId) + throws MsoException + { + LOGGER.debug ("Query Cloudify Deployment: " + deploymentId + " in tenant " + tenantId); + + // Obtain the cloud site information where we will create the stack + Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); + if (!cloudSite.isPresent()) { + throw new MsoCloudSiteNotFound (cloudSiteId); + } + + Cloudify cloudify = getCloudifyClient (cloudSite.get()); + + // Build and send the Cloudify request + Deployment deployment = null; + DeploymentOutputs outputs = null; + try { + GetDeployment queryDeployment = cloudify.deployments().byId(deploymentId); + LOGGER.debug (queryDeployment.toString()); + +// deployment = queryDeployment.execute(); + deployment = executeAndRecordCloudifyRequest(queryDeployment); + + outputs = getDeploymentOutputs (cloudify, deploymentId); + + // Next look for the latest execution + ListExecutions listExecutions = cloudify.executions().listFiltered ("deployment_id=" + deploymentId, "-created_at"); + Executions executions = listExecutions.execute(); + + // If no executions, does this give NOT_FOUND or empty set? + if (executions.getItems().isEmpty()) { + return new DeploymentInfo (deployment); + } + else { + return new DeploymentInfo (deployment, outputs, executions.getItems().get(0)); + } + } + catch (CloudifyConnectException ce) { + // Couldn't connect to Cloudify + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "QueryDeployment: Cloudify connection failure: " + ce, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "QueryDeployment: Cloudify connection failure"); + throw new MsoIOException (ce.getMessage(), ce); + } + catch (CloudifyResponseException re) { + if (re.getStatus () == 404) { + // Got a NOT FOUND error. React differently based on deployment vs. execution + if (deployment != null) { + // Got NOT_FOUND on the executions. Assume this is a valid "empty" set + return new DeploymentInfo (deployment, outputs, null); + } else { + // Deployment not found. Default status of a DeploymentInfo object is NOTFOUND + return new DeploymentInfo (deploymentId); + } + } + throw new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getLocalizedMessage(), re); + } + catch (Exception e) { + // Catch-all + throw new MsoAdapterException (e.getMessage(), e); + } + } + + + /** + * Delete a Cloudify deployment (by ID). If the deployment is not found, it will be + * considered a successful deletion. The return value is a DeploymentInfo object which + * contains the last deployment status. + * + * There is no rollback from a successful deletion. A deletion failure will + * also result in an undefined deployment state - the components may or may not have been + * all or partially deleted, so the resulting deployment must be considered invalid. + * + * @param tenantId The Openstack ID of the tenant in which to perform the delete + * @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack. + * @param stackName The name/id of the stack to delete. May be simple or canonical + * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + * @throws MsoCloudSiteNotFound + */ + public DeploymentInfo uninstallAndDeleteDeployment (String cloudSiteId, + String tenantId, + String deploymentId, + int timeoutMinutes) throws MsoException + { + // Obtain the cloud site information where we will create the stack + Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); + if (!cloudSite.isPresent()) { + throw new MsoCloudSiteNotFound (cloudSiteId); + } + + Cloudify cloudify = getCloudifyClient (cloudSite.get()); + + LOGGER.debug ("Ready to Uninstall/Delete Deployment (" + deploymentId + ")"); + + // Query first to save the trouble if deployment not found + Deployment deployment = null; + try { + GetDeployment queryDeploymentRequest = cloudify.deployments().byId(deploymentId); + LOGGER.debug (queryDeploymentRequest.toString()); + + deployment = executeAndRecordCloudifyRequest (queryDeploymentRequest); + } + catch (CloudifyResponseException e) { + // Since this came on the 'Create Deployment' command, nothing was changed + // in the cloud. Return the error as an exception. + if (e.getStatus () == 404) { + // Deployment doesn't exist. Return a "NOTFOUND" DeploymentInfo object + // TODO: Should return NULL? + LOGGER.debug("Deployment requested for deletion does not exist: " + deploymentId); + return new DeploymentInfo (deploymentId, DeploymentStatus.NOTFOUND); + } else { + // Convert the CloudifyResponseException to an MsoOpenstackException + LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); + MsoException me = cloudifyExceptionToMsoException (e, DELETE_DEPLOYMENT); + me.setCategory (MsoExceptionCategory.INTERNAL); + throw me; + } + } catch (CloudifyConnectException e) { + // Error connecting to Cloudify instance. Convert to an MsoException + throw cloudifyExceptionToMsoException (e, DELETE_DEPLOYMENT); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, DELETE_DEPLOYMENT); + } + + /* + * Query the outputs before deleting so they can be returned as well + */ + DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId); + + /* + * Next execute the "uninstall" workflow. + * Note - this assumes there are no additional parameters required for the workflow. + */ + // TODO: No deletePollInterval that I'm aware of. Use the create interval + int deletePollInterval = Integer.parseInt(this.environment.getProperty (deletePollIntervalProp, deletePollIntervalDefault)); + int pollTimeout = (timeoutMinutes * 60) + deletePollInterval; + + Execution uninstallWorkflow = null; + + try { + uninstallWorkflow = executeWorkflow (cloudify, deploymentId, "uninstall", null, true, pollTimeout, deletePollInterval); + + if (uninstallWorkflow.getStatus().equals(TERMINATED)) { + // Successful uninstall. + LOGGER.debug("Uninstall successful for deployment " + deploymentId); + } + else { + // The uninstall workflow completed with an error. Must fail the request, but will + // leave the deployment in an indeterminate state, as cloud resources may still exist. + MsoCloudifyException me = new MsoCloudifyException (0, "Uninstall Workflow Failed", uninstallWorkflow.getError()); + me.addContext (DELETE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + } + catch (MsoException me) { + // Uninstall workflow has failed. + // Must fail the deletion... may leave the deployment in an inconclusive state + me.addContext (DELETE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + + // At this point, the deployment has been successfully uninstalled. + // Next step is to delete the deployment itself + try { + DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId); + LOGGER.debug(deleteRequest.toString()); + + // The delete request returns the deleted deployment + deployment = deleteRequest.execute(); + + } + catch (CloudifyConnectException ce) { + // Failed to delete. Must fail the request, but will leave the (uninstalled) + // deployment in Cloudify DB. + MsoCloudifyException me = new MsoCloudifyException (0, "Deployment Delete Failed", ce.getMessage(), ce); + me.addContext (DELETE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + catch (CloudifyResponseException re) { + // Failed to delete. Must fail the request, but will leave the (uninstalled) + // deployment in the Cloudify DB. + MsoCloudifyException me = new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getMessage(), re); + me.addContext (DELETE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + catch (Exception e) { + // Catch-all + MsoAdapterException ae = new MsoAdapterException (e.getMessage(), e); + ae.addContext (DELETE_DEPLOYMENT); + alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, ae.getContextMessage()); + throw ae; + } + + // Return the deleted deployment info (with runtime outputs) along with the completed uninstall workflow status + return new DeploymentInfo (deployment, outputs, uninstallWorkflow); + } + + + /** + * Check if a blueprint is available for use at a targeted cloud site. + * This requires checking the Cloudify Manager which is servicing that + * cloud site to see if the specified blueprint has been loaded. + * + * @param cloudSiteId The cloud site where the blueprint is needed + * @param blueprintId The ID for the blueprint in Cloudify + */ + public boolean isBlueprintLoaded (String cloudSiteId, String blueprintId) + throws MsoException + { + // Obtain the cloud site information where we will load the blueprint + Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); + if (!cloudSite.isPresent()) { + throw new MsoCloudSiteNotFound (cloudSiteId); + } + + Cloudify cloudify = getCloudifyClient (cloudSite.get()); + + GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId); + try { + Blueprint bp = getRequest.execute(); + LOGGER.debug("Blueprint exists: " + bp.getId()); + return true; + } + catch (CloudifyResponseException ce) { + if (ce.getStatus() == 404) { + return false; + } else { + throw ce; + } + } catch (Exception e) { + throw e; + } + } + + /** + * Upload a blueprint to the Cloudify Manager that is servicing a Cloud Site. + * The blueprint currently must be structured as a single directory with all + * of the required files. One of those files is designated the "main file" + * for the blueprint. Files are provided as byte arrays, though expect only + * text files will be distributed from ASDC and stored by MSO. + * + * Cloudify requires a single root directory in its blueprint zip files. + * The requested blueprint ID will also be used as the directory. + * All of the files will be added to this directory in the zip file. + */ + public void uploadBlueprint (String cloudSiteId, + String blueprintId, + String mainFileName, + Map blueprintFiles, + boolean failIfExists) + throws MsoException + { + // Obtain the cloud site information where we will load the blueprint + Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); + if (!cloudSite.isPresent()) { + throw new MsoCloudSiteNotFound (cloudSiteId); + } + + Cloudify cloudify = getCloudifyClient (cloudSite.get()); + + boolean blueprintUploaded = uploadBlueprint (cloudify, blueprintId, mainFileName, blueprintFiles); + + if (!blueprintUploaded && failIfExists) { + throw new MsoAdapterException ("Blueprint already exists"); + } + } + + /* + * Common method to load a blueprint. May be called from + */ + protected boolean uploadBlueprint (Cloudify cloudify, String blueprintId, String mainFileName, Map blueprintFiles) + throws MsoException + { + // Check if it already exists. If so, return false. + GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId); + try { + Blueprint bp = getRequest.execute(); + LOGGER.debug("Blueprint " + bp.getId() + " already exists."); + return false; + } + catch (CloudifyResponseException ce) { + if (ce.getStatus() == 404) { + // This is the expected result. + LOGGER.debug("Verified that Blueprint doesn't exist yet"); + } else { + throw ce; + } + } catch (Exception e) { + throw e; + } + + // Create a blueprint ZIP file in memory + ByteArrayOutputStream zipBuffer = new ByteArrayOutputStream(); + ZipOutputStream zipOut = new ZipOutputStream(zipBuffer); + + try { + // Put the root directory + String rootDir = blueprintId + ((blueprintId.endsWith("/") ? "" : "/")); + zipOut.putNextEntry(new ZipEntry (rootDir)); + zipOut.closeEntry(); + + for (String fileName : blueprintFiles.keySet()) { + ZipEntry ze = new ZipEntry (rootDir + fileName); + zipOut.putNextEntry (ze); + zipOut.write (blueprintFiles.get(fileName)); + zipOut.closeEntry(); + } + zipOut.close(); + } + catch (IOException e) { + // Since we're writing to a byte array, this should never happen + } + LOGGER.debug ("Blueprint zip file size: " + zipBuffer.size()); + + // Ready to upload the blueprint zip + + try (InputStream blueprintStream = new ByteArrayInputStream (zipBuffer.toByteArray())) { + UploadBlueprint uploadRequest = cloudify.blueprints().uploadFromStream(blueprintId, mainFileName, blueprintStream); + Blueprint blueprint = uploadRequest.execute(); + System.out.println("Successfully uploaded blueprint " + blueprint.getId()); + } + catch (CloudifyResponseException | CloudifyConnectException e) { + throw cloudifyExceptionToMsoException (e, "UPLOAD_BLUEPRINT"); + } + catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, "UPLOAD_BLUEPRINT"); + } catch (IOException e) { + // for try-with-resources + throw ioExceptionToMsoException(e, "UPLOAD_BLUEPRINT"); + } + + return true; + } + + + + // --------------------------------------------------------------- + // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS + + /** + * Get a Cloudify client for the specified cloud site. + * Everything that is required can be found in the Cloud Config. + * + * @param cloudSite + * @return a Cloudify object + */ + public Cloudify getCloudifyClient (CloudSite cloudSite) throws MsoException + { + CloudifyManager cloudifyConfig = cloudConfig.getCloudifyManager(cloudSite.getCloudifyId()); + if (cloudifyConfig == null) { + throw new MsoCloudifyManagerNotFound (cloudConfig.getCloudSiteId(cloudSite)); + } + + // Get a Cloudify client + // Set a Token Provider to fetch tokens from Cloudify itself. + String cloudifyUrl = cloudifyConfig.getCloudifyUrl(); + Cloudify cloudify = new Cloudify (cloudifyUrl); + cloudify.setTokenProvider(new CloudifyClientTokenProvider(cloudifyUrl, cloudifyConfig.getUsername(), CryptoUtils.decryptCloudConfigPassword(cloudifyConfig.getPassword()))); + + return cloudify; + } + + + /* + * Query for a Cloudify Deployment. This function is needed in several places, so + * a common method is useful. This method takes an authenticated CloudifyClient + * (which internally identifies the cloud & tenant to search), and returns + * a Deployment object if found, Null if not found, or an MsoCloudifyException + * if the Cloudify API call fails. + * + * @param cloudifyClient an authenticated Cloudify client + * + * @param deploymentId the deployment to query + * + * @return a Deployment object or null if the requested deployment doesn't exist. + * + * @throws MsoCloudifyException Thrown if the Cloudify API call returns an exception + */ + protected Deployment queryDeployment (Cloudify cloudify, String deploymentId) throws MsoException { + if (deploymentId == null) { + return null; + } + try { + GetDeployment request = cloudify.deployments().byId (deploymentId); + return executeAndRecordCloudifyRequest (request); + } catch (CloudifyResponseException e) { + if (e.getStatus () == 404) { + LOGGER.debug ("queryDeployment - not found: " + deploymentId); + return null; + } else { + // Convert the CloudifyResponseException to an MsoCloudifyException + throw cloudifyExceptionToMsoException (e, "QueryDeployment"); + } + } catch (CloudifyConnectException e) { + // Connection to Openstack failed + throw cloudifyExceptionToMsoException (e, "QueryDeployment"); + } + } + + + public void copyStringOutputsToInputs(Map inputs, + Map otherStackOutputs, boolean overWrite) { + if (inputs == null || otherStackOutputs == null) + return; + + for (Map.Entry entry : otherStackOutputs.entrySet()) { + String key = entry.getKey(); + Object value = entry.getValue(); + + if (value instanceof JsonNode) { + // This is a bit of mess - but I think it's the least impacting + // let's convert it BACK to a string - then it will get converted back later + try { + inputs.put(key, this.convertNode((JsonNode) value)); + } catch (Exception e) { + LOGGER.debug("WARNING: unable to convert JsonNode output value for "+ key); + //effect here is this value will not have been copied to the inputs - and therefore will error out downstream + } + } else if (value instanceof java.util.LinkedHashMap) { + LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode"); + try { + inputs.put(key, JSON_MAPPER.writeValueAsString(value)); + } catch (Exception e) { + LOGGER.debug("WARNING: unable to convert LinkedHashMap output value for "+ key); + } + } else { + // just try to cast it - could be an integer or some such + try { + inputs.put(key, (String) value); + } catch (Exception e) { + LOGGER.debug("WARNING: unable to convert output value for "+ key); + //effect here is this value will not have been copied to the inputs - and therefore will error out downstream + } + } + } + return; + } + + /* + * Normalize an input value to an Object, based on the target parameter type. + * If the type is not recognized, it will just be returned unchanged (as a string). + */ + public Object convertInputValue (String inputValue, HeatTemplateParam templateParam) + { + String type = templateParam.getParamType(); + LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type); + + if (type.equalsIgnoreCase("number")) { + try { + return Integer.valueOf(inputValue); + } + catch (Exception e) { + LOGGER.debug("Unable to convert " + inputValue + " to an integer!"); + return null; + } + } else if (type.equalsIgnoreCase("json")) { + try { + return new ObjectMapper().readTree(inputValue); + } + catch (Exception e) { + LOGGER.debug("Unable to convert " + inputValue + " to a JsonNode!"); + return null; + } + } else if (type.equalsIgnoreCase("boolean")) { + return new Boolean(inputValue); + } + + // Nothing else matched. Return the original string + return inputValue; + } + + + private String convertNode(final JsonNode node) { + try { + final Object obj = JSON_MAPPER.treeToValue(node, Object.class); + return JSON_MAPPER.writeValueAsString(obj); + } catch (JsonParseException jpe) { + LOGGER.debug("Error converting json to string " + jpe.getMessage()); + } catch (Exception e) { + LOGGER.debug("Error converting json to string " + e.getMessage()); + } + return "[Error converting json to string]"; + } + + + /* + * Method to execute a Cloudify command and track its execution time. + * For the metrics log, a category of "Cloudify" is used along with a + * sub-category that identifies the specific call (using the real + * cloudify-client classname of the CloudifyRequest parameter). + */ + + + protected T executeAndRecordCloudifyRequest (CloudifyRequest request) { + + String requestType; + if (request.getClass ().getEnclosingClass () != null) { + requestType = request.getClass ().getEnclosingClass ().getSimpleName () + "." + + request.getClass ().getSimpleName (); + } else { + requestType = request.getClass ().getSimpleName (); + } + + int retryDelay = poConfig.getRetryDelay(); + int retryCount = poConfig.getRetryCount(); + String retryCodes = poConfig.getRetryCodes(); + + // Run the actual command. All exceptions will be propagated + while (true) + { + try { + return request.execute (); + } + catch (CloudifyResponseException e) { + boolean retry = false; + if (retryCodes != null ) { + int code = e.getStatus(); + LOGGER.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code); + for (String rCode : retryCodes.split (",")) { + try { + if (retryCount > 0 && code == Integer.parseInt (rCode)) + { + retryCount--; + retry = true; + LOGGER.debug ("CloudifyResponseException ResponseCode:" + code + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); + break; + } + } catch (NumberFormatException e1) { + LOGGER.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config"); + throw e; + } + } + } + if (retry) + { + sleep(retryDelay * 1000L); + } + else + throw e; // exceeded retryCount or code is not retryable + } + catch (CloudifyConnectException e) { + // Connection to Cloudify failed + if (retryCount > 0) + { + retryCount--; + LOGGER.debug (" request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); + sleep(retryDelay * 1000L); + } + else + throw e; + + } + } + } + /* + * Convert an Exception on a Cloudify call to an MsoCloudifyException. + * This method supports CloudifyResponseException and CloudifyConnectException. + */ + protected MsoException cloudifyExceptionToMsoException (CloudifyBaseException e, String context) { + MsoException me = null; + + if (e instanceof CloudifyResponseException) { + CloudifyResponseException re = (CloudifyResponseException) e; + + try { + // Failed Cloudify calls return an error entity body. + CloudifyError error = re.getResponse ().getErrorEntity (CloudifyError.class); + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY, "Cloudify Error on " + context + ": " + error.getErrorCode(), CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Exception - Cloudify Error on " + context); + String fullError = error.getErrorCode() + ": " + error.getMessage(); + LOGGER.debug(fullError); + me = new MsoCloudifyException (re.getStatus(), + re.getMessage(), + fullError); + } catch (Exception e2) { + // Couldn't parse the body as a "CloudifyError". Report the original HTTP error. + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY, "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2); + me = new MsoCloudifyException (re.getStatus (), re.getMessage (), ""); + } + + // Add the context of the error + me.addContext (context); + + // Generate an alarm for 5XX and higher errors. + if (re.getStatus () >= 500) { + alarmLogger.sendAlarm (CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } + } else if (e instanceof CloudifyConnectException) { + CloudifyConnectException ce = (CloudifyConnectException) e; + + me = new MsoIOException (ce.getMessage ()); + me.addContext (context); + + // Generate an alarm for all connection errors. + alarmLogger.sendAlarm ("CloudifyIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, CLOUDIFY, "Cloudify connection error on " + context + ": " + e, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Cloudify connection error on " + context); + } + + return me; + } + + + + /******************************************************************************* + * + * Methods (and associated utilities) to implement the VduPlugin interface + * + *******************************************************************************/ + + /** + * VduPlugin interface for instantiate function. + * + * This one is a bit more complex, in that it will first upload the blueprint if needed, + * then create the Cloudify deployment and execute the install workflow. + * + * This implementation also merges any parameters defined in the ENV file with the other + * other input parameters for any undefined parameters). + * The basic MsoCloudifyUtils separates blueprint management from deploument actions, + * but the VduPlugin does not declare blueprint management operations. + */ + @Override + public VduInstance instantiateVdu ( + CloudInfo cloudInfo, + String instanceName, + Map inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + // Translate the VDU ModelInformation structure to that which is needed for + // creating and uploading a blueprint. Use the model customization UUID as + // the blueprint identifier. + + String blueprintId = vduModel.getModelCustomizationUUID(); + + try { + + if (! isBlueprintLoaded (cloudSiteId, blueprintId)) { + LOGGER.debug ("Blueprint " + blueprintId + " is not loaded. Will upload it now."); + + // Prepare the blueprint inputs. Need the set of blueprint templates and files, + // plus the main blueprint name. + Map blueprintFiles = new HashMap<>(); + String mainTemplate = ""; + + // Add all of the blueprint artifacts from the VDU model + List vduArtifacts = vduModel.getArtifacts(); + for (VduArtifact vduArtifact: vduArtifacts) + { + // Add all artifacts to the blueprint, with one exception. + // ENVIRONMENT files will be processed later as additional parameters. + + ArtifactType artifactType = vduArtifact.getType(); + if (artifactType != ArtifactType.ENVIRONMENT) { + blueprintFiles.put(vduArtifact.getName(), vduArtifact.getContent()); + + if (artifactType == ArtifactType.MAIN_TEMPLATE) { + mainTemplate = vduArtifact.getName(); + } + } + } + + // Upload the blueprint package + uploadBlueprint(cloudSiteId, blueprintId, mainTemplate, blueprintFiles, false); + } + } + catch (Exception e) { + throw new VduException ("CloudifyUtils (instantiateVDU): blueprint Exception", e); + } + + + // Next, create and install a new deployment based on the blueprint. + // For Cloudify, the deploymentId is specified by the client. Just use the instance name + // as the ID. + + try { + // Query the Cloudify Deployment object and populate a VduInstance + DeploymentInfo deployment = createAndInstallDeployment (cloudSiteId, + tenantId, + instanceName, + blueprintId, + inputs, + true, // (poll for completion) + vduModel.getTimeoutMinutes(), + rollbackOnFailure); + + return deploymentInfoToVduInstance(deployment); + } + catch (Exception e) { + throw new VduException ("CloudifyUtils (instantiateVDU): Create-and-install-deployment Exception", e); + } + } + + + /** + * VduPlugin interface for query function. + */ + @Override + public VduInstance queryVdu (CloudInfo cloudInfo, String instanceId) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + try { + // Query the Cloudify Deployment object and populate a VduInstance + DeploymentInfo deployment = queryDeployment (cloudSiteId, tenantId, instanceId); + + return deploymentInfoToVduInstance(deployment); + } + catch (Exception e) { + throw new VduException ("Query VDU Exception", e); + } + } + + + /** + * VduPlugin interface for delete function. + */ + @Override + public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + try { + // Uninstall and delete the Cloudify Deployment + DeploymentInfo deployment = uninstallAndDeleteDeployment (cloudSiteId, tenantId, instanceId, timeoutMinutes); + + // Populate a VduInstance based on the deleted Cloudify Deployment object + return deploymentInfoToVduInstance(deployment); + } + catch (Exception e) { + throw new VduException ("Delete VDU Exception", e); + } + } + + + /** + * VduPlugin interface for update function. + * + * Update is currently not supported in the MsoCloudifyUtils implementation. + * Just return a VduException. + * + */ + @Override + public VduInstance updateVdu ( + CloudInfo cloudInfo, + String instanceId, + Map inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException + { + throw new VduException ("CloudifyUtils: updateVDU interface not supported"); + } + + + /* + * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object + */ + protected VduInstance deploymentInfoToVduInstance (DeploymentInfo deployment) + { + VduInstance vduInstance = new VduInstance(); + + // only one ID in Cloudify, use for both VDU name and ID + vduInstance.setVduInstanceId(deployment.getId()); + vduInstance.setVduInstanceName(deployment.getId()); + + // Copy inputs and outputs + vduInstance.setInputs(deployment.getInputs()); + vduInstance.setOutputs(deployment.getOutputs()); + + // Translate the status elements + vduInstance.setStatus(deploymentStatusToVduStatus (deployment)); + + return vduInstance; + } + + protected VduStatus deploymentStatusToVduStatus (DeploymentInfo deployment) + { + VduStatus vduStatus = new VduStatus(); + + // Determine the status based on last action & status + // DeploymentInfo object should be enhanced to report a better status internally. + DeploymentStatus status = deployment.getStatus(); + + if (status == null) { + vduStatus.setState(VduStateType.UNKNOWN); + } + else if (status == DeploymentStatus.NOTFOUND) { + vduStatus.setState(VduStateType.NOTFOUND); + } + else if (status == DeploymentStatus.INSTALLED) { + vduStatus.setState(VduStateType.INSTANTIATED); + } + else if (status == DeploymentStatus.CREATED) { + // Deployment exists but is not installed. This shouldn't really happen, + // since create + install or uninstall + delete are always done together. + // But account for it anyway, assuming the operation is still in progress. + String lastAction = deployment.getLastAction(); + if (lastAction == null) + vduStatus.setState(VduStateType.INSTANTIATING); + else + vduStatus.setState(VduStateType.DELETING); + } + else if (status == DeploymentStatus.FAILED) { + vduStatus.setState(VduStateType.FAILED); + } else { + vduStatus.setState(VduStateType.UNKNOWN); + } + + vduStatus.setErrorMessage(deployment.getErrorMessage()); + vduStatus.setLastAction(new PluginAction(deployment.getLastAction(), deployment.getActionStatus(), deployment.getErrorMessage())); + + return vduStatus; + } + + /* + * Return an OpenstackConfig object as expected by Cloudify Openstack Plug-in. + * Base the values on the CloudSite definition. + */ + protected OpenstackConfig getOpenstackConfig (CloudSite cloudSite, String tenantId) { + OpenstackConfig openstackConfig = new OpenstackConfig(); + openstackConfig.setRegion (cloudSite.getRegionId()); + openstackConfig.setAuthUrl (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getIdentityUrl()); + openstackConfig.setUsername (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getMsoId()); + openstackConfig.setPassword (CryptoUtils.decryptCloudConfigPassword(cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getMsoPass())); + openstackConfig.setTenantName (tenantId); + return openstackConfig; + } + + /* + * Return an Azure object as expected by Cloudify Azure Plug-in. + * Base the values on the CloudSite definition. + */ + protected AzureConfig getAzureConfig (CloudSite cloudSite, String tenantId) { + AzureConfig azureConfig = new AzureConfig(); + // TODO: Use adminTenant for now, instead of adding another element + azureConfig.setSubscriptionId (cloudSite.getIdentityService().getAdminTenant()); + azureConfig.setTenantId (tenantId); + azureConfig.setClientId (cloudSite.getIdentityService().getMsoId()); + azureConfig.setClientSecret (cloudSite.getIdentityService().getMsoPass()); + return azureConfig; + } + + private void sleep(long time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + LOGGER.debug("Thread interrupted while sleeping!", e); + Thread.currentThread().interrupt(); + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java new file mode 100644 index 0000000000..3098a5410a --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/config/beans/PoConfig.java @@ -0,0 +1,53 @@ +/*- + * ============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.config.beans; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix="adapters.po") +public class PoConfig { + + private String retryCodes; + private int retryDelay; + private int retryCount; + + public String getRetryCodes() { + return retryCodes; + } + public void setRetryCodes(String retryCodes) { + this.retryCodes = retryCodes; + } + public int getRetryDelay() { + return retryDelay; + } + public void setRetryDelay(int retryDelay) { + this.retryDelay = retryDelay; + } + public int getRetryCount() { + return retryCount; + } + public void setRetryCount(int retryCount) { + this.retryCount = retryCount; + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/HeatCacheEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/HeatCacheEntry.java new file mode 100644 index 0000000000..5eaca976d0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/HeatCacheEntry.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.openstack.beans; + +import java.io.Serializable; +import java.util.Calendar; + +import com.woorea.openstack.heat.Heat; + +/* + * An entry in the Heat Client Cache. It saves the Heat client object + * along with the token expiration. After this interval, this cache + * item will no longer be used. + */ +public class HeatCacheEntry implements Serializable { + + private static final long serialVersionUID = 1L; + + private String heatUrl; + private String token; + private Calendar expires; + + public HeatCacheEntry (String heatUrl, String token, Calendar expires) { + this.heatUrl = heatUrl; + this.token = token; + this.expires = expires; + } + + public Heat getHeatClient () { + Heat heatClient = new Heat (heatUrl); + heatClient.token (token); + return heatClient; + } + + public boolean isExpired () { + if (expires == null) { + return true; + } + + return System.currentTimeMillis() > expires.getTimeInMillis(); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/NeutronCacheEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/NeutronCacheEntry.java new file mode 100644 index 0000000000..d89fd1a73f --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/NeutronCacheEntry.java @@ -0,0 +1,67 @@ +/*- + * ============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.openstack.beans; + +import java.io.Serializable; +import java.util.Calendar; + +/* + * An entry in the Neutron Client Cache. It saves the Neutron client object + * along with the token expiration. After this interval, this cache + * item will no longer be used. + */ +public class NeutronCacheEntry implements Serializable { + private static final long serialVersionUID = 1L; + + private String neutronUrl; + private String token; + private Calendar expires; + + public NeutronCacheEntry (String neutronUrl, String token, Calendar expires) { + this.neutronUrl = neutronUrl; + this.token = token; + this.expires = expires; + } + + public String getNeutronUrl() { + return neutronUrl; + } + + public void setNeutronUrl(String neutronUrl) { + this.neutronUrl = neutronUrl; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public boolean isExpired() { + if (expires == null) { + return true; + } + + return System.currentTimeMillis() > expires.getTimeInMillis(); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java new file mode 100644 index 0000000000..bb8aa92281 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java @@ -0,0 +1,216 @@ +/*- + * ============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.openstack.beans; + +import org.onap.so.entity.MsoRequest; +import org.springframework.stereotype.Component; +/** + * Javabean representing the rollback criteria following a "Create VNF" + * operation. This structure can be passed back to the "Rollback VNF" + * operation to undo the effects of the create. + * + * + */ +@Component +public class VnfRollback { + private String vnfId; + private String tenantId; + private String cloudSiteId; + private boolean tenantCreated = false; + private boolean vnfCreated = false; + private MsoRequest msoRequest; + private String volumeGroupName; + private String volumeGroupId; + private String requestType; + private String volumeGroupHeatStackId; + private String baseGroupHeatStackId; + private boolean isBase = false; + private String vfModuleStackId; + private String modelCustomizationUuid; //NOTE: this is the vfModule's modelCustomizationUuid + private String mode = "HEAT"; + + public VnfRollback() {} + + /** + * For backwards compatibility... orchestration mode defaults to HEAT + * + * @param vnfId + * @param tenantId + * @param cloudSiteId + * @param tenantCreated + * @param vnfCreated + * @param msoRequest + * @param volumeGroupName + * @param volumeGroupId + * @param requestType + * @param modelCustomizationUuid + */ + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, + boolean tenantCreated, boolean vnfCreated, + MsoRequest msoRequest, + String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) { + super(); + this.vnfId = vnfId; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.tenantCreated = tenantCreated; + this.vnfCreated = vnfCreated; + this.msoRequest = msoRequest; + this.volumeGroupName = volumeGroupName; + this.volumeGroupId = volumeGroupId; + this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; + } + + /** + * For backwards compatibility... orchestration mode defaults to HEAT + * + * @param vnfId + * @param tenantId + * @param cloudSiteId + * @param tenantCreated + * @param vnfCreated + * @param msoRequest + * @param volumeGroupName + * @param volumeGroupId + * @param requestType + * @param modelCustomizationUuid + */ + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, + boolean tenantCreated, boolean vnfCreated, + MsoRequest msoRequest, String volumeGroupName, String volumeGroupId, + String requestType, String modelCustomizationUuid, String orchestrationMode) { + super(); + this.vnfId = vnfId; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.tenantCreated = tenantCreated; + this.vnfCreated = vnfCreated; + this.msoRequest = msoRequest; + this.volumeGroupName = volumeGroupName; + this.volumeGroupId = volumeGroupId; + this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; + this.mode = orchestrationMode; + } + + public String getVnfId() { + return vnfId; + } + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudId) { + this.cloudSiteId = cloudId; + } + public boolean getTenantCreated() { + return tenantCreated; + } + public void setTenantCreated(boolean tenantCreated) { + this.tenantCreated = tenantCreated; + } + public boolean getVnfCreated() { + return vnfCreated; + } + public void setVnfCreated(boolean vnfCreated) { + this.vnfCreated = vnfCreated; + } + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest (MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + public String getVolumeGroupName() { + return this.volumeGroupName; + } + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + public String getVolumeGroupId() { + return this.volumeGroupId; + } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + public String getRequestType() { + return this.requestType; + } + public void setRequestType(String requestType) { + this.requestType = requestType; + } + public String getVolumeGroupHeatStackId() { + return this.volumeGroupHeatStackId; + } + public void setVolumeGroupHeatStackId(String volumeGroupHeatStackId) { + this.volumeGroupHeatStackId = volumeGroupHeatStackId; + } + + public String getBaseGroupHeatStackId() { + return this.baseGroupHeatStackId; + } + public void setBaseGroupHeatStackId(String baseGroupHeatStackId) { + this.baseGroupHeatStackId = baseGroupHeatStackId; + } + + public boolean isBase() { + return this.isBase; + } + public void setIsBase(boolean isBase) { + this.isBase = isBase; + } + public String getVfModuleStackId() { + return this.vfModuleStackId; + } + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getMode() { + return this.mode; + } + public void setMode(String mode) { + this.mode = mode; + } + @Override + public String toString() { + return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId + + ", vnf=" + vnfId + ", tenantCreated=" + tenantCreated + + ", vnfCreated=" + vnfCreated + ", requestType = " + requestType + + ", modelCustomizationUuid=" + this.modelCustomizationUuid + + ", mode=" + mode; + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java new file mode 100644 index 0000000000..98793601d0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java @@ -0,0 +1,303 @@ +/*- + * ============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.openstack.utils; + + +import java.io.IOException; + +import org.onap.so.config.beans.PoConfig; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.exceptions.MsoAdapterException; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.woorea.openstack.base.client.OpenStackBaseException; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.heat.model.Explanation; +import com.woorea.openstack.keystone.model.Error; +import com.woorea.openstack.quantum.model.NeutronError; + +@Component("CommonUtils") +public class MsoCommonUtils { + + private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoCommonUtils.class); + protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); + + @Autowired + private PoConfig poConfig; + /* + * Method to execute an Openstack command and track its execution time. + * For the metrics log, a category of "Openstack" is used along with a + * sub-category that identifies the specific call (using the real + * openstack-java-sdk classname of the OpenStackRequest parameter). + */ + + protected T executeAndRecordOpenstackRequest (OpenStackRequest request) { + + int limit; + + long start = System.currentTimeMillis (); + String requestType; + if (request.getClass ().getEnclosingClass () != null) { + requestType = request.getClass ().getEnclosingClass ().getSimpleName () + "." + + request.getClass ().getSimpleName (); + } else { + requestType = request.getClass ().getSimpleName (); + } + + int retryDelay = poConfig.getRetryDelay(); + int retryCount = poConfig.getRetryCount(); + String retryCodes = poConfig.getRetryCodes(); + + // Run the actual command. All exceptions will be propagated + while (true) + { + try { + return request.execute (); + } + catch (OpenStackResponseException e) { + boolean retry = false; + if (retryCodes != null ) { + int code = e.getStatus(); + logger.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code); + for (String rCode : retryCodes.split (",")) { + try { + if (retryCount > 0 && code == Integer.parseInt (rCode)) + { + retryCount--; + retry = true; + logger.debug ("OpenStackResponseException ResponseCode:" + code + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); + break; + } + } catch (NumberFormatException e1) { + logger.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config"); + throw e; + } + } + } + if (retry) + { + try { + Thread.sleep (retryDelay * 1000L); + } catch (InterruptedException e1) { + logger.debug ("Thread interrupted while sleeping", e1); + Thread.currentThread().interrupt(); + } + } + else + throw e; // exceeded retryCount or code is not retryable + } + catch (OpenStackConnectException e) { + // Connection to Openstack failed + if (retryCount > 0) + { + retryCount--; + logger.debug (" request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); + try { + Thread.sleep (retryDelay * 1000L); + } catch (InterruptedException e1) { + logger.debug ("Thread interrupted while sleeping", e1); + Thread.currentThread().interrupt(); + } + } + else + throw e; + + } + } + } + + /* + * Convert an Openstack Exception on a Keystone call to an MsoException. + * This method supports both OpenstackResponseException and OpenStackConnectException. + */ + protected MsoException keystoneErrorToMsoException (OpenStackBaseException e, String context) { + MsoException me = null; + + if (e instanceof OpenStackResponseException) { + OpenStackResponseException re = (OpenStackResponseException) e; + + try { + // Failed Keystone calls return an Error entity body. + Error error = re.getResponse ().getErrorEntity (Error.class); + logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Keystone Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone Error on " + context); + me = new MsoOpenstackException (error.getCode (), error.getTitle (), error.getMessage ()); + } catch (Exception e2) { + // Can't parse the body as an "Error". Report the HTTP error + logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "HTTP Error on " + context + ": " + re.getStatus() + "," + re.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "HTTP Error on " + context, e2); + me = new MsoOpenstackException (re.getStatus (), re.getMessage (), ""); + } + + // Add the context of the error + me.addContext (context); + + // Generate an alarm for 5XX and higher errors. + if (re.getStatus () >= 500) { + alarmLogger.sendAlarm ("KeystoneError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } + } else if (e instanceof OpenStackConnectException) { + OpenStackConnectException ce = (OpenStackConnectException) e; + + me = new MsoIOException (ce.getMessage ()); + me.addContext (context); + + // Generate an alarm for all connection errors. + logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context); + alarmLogger.sendAlarm ("KeystoneIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } + + return me; + } + + /* + * Convert an Openstack Exception on a Heat call to an MsoOpenstackException. + * This method supports both OpenstackResponseException and OpenStackConnectException. + */ + protected MsoException heatExceptionToMsoException (OpenStackBaseException e, String context) { + MsoException me = null; + + if (e instanceof OpenStackResponseException) { + OpenStackResponseException re = (OpenStackResponseException) e; + + try { + // Failed Heat calls return an Explanation entity body. + Explanation explanation = re.getResponse ().getErrorEntity (Explanation.class); + logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error on " + context + ": " + explanation.toString(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Openstack Error on " + context); + String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType() + ", error.message=" + explanation.getError().getMessage(); + logger.debug(fullError); + me = new MsoOpenstackException (explanation.getCode (), + explanation.getTitle (), + //explanation.getExplanation ()); + fullError); + } catch (Exception e2) { + // Couldn't parse the body as an "Explanation". Report the original HTTP error. + logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2); + me = new MsoOpenstackException (re.getStatus (), re.getMessage (), ""); + } + + // Add the context of the error + me.addContext (context); + + // Generate an alarm for 5XX and higher errors. + if (re.getStatus () >= 500) { + alarmLogger.sendAlarm ("HeatError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } + } else if (e instanceof OpenStackConnectException) { + OpenStackConnectException ce = (OpenStackConnectException) e; + + me = new MsoIOException (ce.getMessage ()); + me.addContext (context); + + // Generate an alarm for all connection errors. + alarmLogger.sendAlarm ("HeatIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context); + } + + return me; + } + + /* + * Convert an Openstack Exception on a Neutron call to an MsoOpenstackException. + * This method supports both OpenstackResponseException and OpenStackConnectException. + */ + protected MsoException neutronExceptionToMsoException (OpenStackBaseException e, String context) { + MsoException me = null; + + if (e instanceof OpenStackResponseException) { + OpenStackResponseException re = (OpenStackResponseException) e; + + try { + // Failed Neutron calls return an NeutronError entity body + NeutronError error = re.getResponse ().getErrorEntity (NeutronError.class); + logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Error on " + context); + me = new MsoOpenstackException (re.getStatus (), error.getType (), error.getMessage ()); + } catch (Exception e2) { + // Couldn't parse body as a NeutronError. Report the HTTP error. + logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack HTTP Error on " + context, e2); + me = new MsoOpenstackException (re.getStatus (), re.getMessage (), null); + } + + // Add the context of the error + me.addContext (context); + + // Generate an alarm for 5XX and higher errors. + if (re.getStatus () >= 500) { + alarmLogger.sendAlarm ("NeutronError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + } + } else if (e instanceof OpenStackConnectException) { + OpenStackConnectException ce = (OpenStackConnectException) e; + + me = new MsoIOException (ce.getMessage ()); + me.addContext (context); + + // Generate an alarm for all connection errors. + alarmLogger.sendAlarm ("NeutronIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context); + } + + return me; + } + + /* + * Convert a Java Runtime Exception to an MsoException. + * All Runtime exceptions will be translated into an MsoAdapterException, + * which captures internal errors. + * Alarms will be generated on all such exceptions. + */ + protected MsoException runtimeExceptionToMsoException (RuntimeException e, String context) { + MsoAdapterException me = new MsoAdapterException (e.getMessage (), e); + me.addContext (context); + me.setCategory (MsoExceptionCategory.INTERNAL); + + // Always generate an alarm for internal exceptions + logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); + alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + + return me; + } + + protected MsoException ioExceptionToMsoException(IOException e, String context) { + MsoAdapterException me = new MsoAdapterException (e.getMessage (), e); + me.addContext (context); + me.setCategory (MsoExceptionCategory.INTERNAL); + + // Always generate an alarm for internal exceptions + logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); + alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + + return me; + } + + public boolean isNullOrEmpty (String s) { + return s == null || s.isEmpty(); + } + + + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java new file mode 100644 index 0000000000..c95e62dad0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntry.java @@ -0,0 +1,257 @@ +/*- + * ============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.openstack.utils; + + + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; + +import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.logger.MsoLogger; + +public class MsoHeatEnvironmentEntry { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatEnvironmentEntry.class); + + private Set parameters = null; + private Set resources = null; + private StringBuilder rawEntry = null; + private boolean valid = true; + private String errorString = null; + private StringBuilder resourceRegistryEntryRaw = null; + + public MsoHeatEnvironmentEntry() { + super(); + } + + public MsoHeatEnvironmentEntry(StringBuilder sb) { + this(); + this.rawEntry = sb; + this.processRawEntry(); + } + + private void processRawEntry() { + try { + if (this.rawEntry == null || "".equals(this.rawEntry.toString())) + return; + byte[] b = this.rawEntry.toString().getBytes(); + MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b); + this.parameters = yaml.getParameterListFromEnvt(); + //this.resources = yaml.getResourceListFromEnvt(); + StringBuilder sb = this.getResourceRegistryRawEntry(); + if (sb == null) { + this.resourceRegistryEntryRaw = new StringBuilder(""); + } else { + this.resourceRegistryEntryRaw = sb; + } + } catch (Exception e) { + LOGGER.debug("Exception:", e); + this.valid = false; + this.errorString = e.getMessage(); + //e.printStackTrace(); + } + } + + public boolean isValid() { + return this.valid; + } + public String getErrorString() { + return this.errorString; + } + + public Set getParameters() { + return this.parameters; + } + public Set getResources() { + return this.resources; + } + public void setParameters(Set paramSet) { + if (paramSet == null) { + this.parameters = null; + } else { + this.parameters = paramSet; + } + } + public void setResources(Set resourceSet) { + if (resourceSet == null) { + this.resources = null; + } else { + this.resources = resourceSet; + } + } + + public void addParameter(MsoHeatEnvironmentParameter hep) { + if (this.parameters == null) { + this.parameters = new HashSet<>(); + } + this.parameters.add(hep); + } + public void addResource(MsoHeatEnvironmentResource her) { + if (this.resources == null) { + this.resources = new HashSet<>(); + } + this.resources.add(her); + } + + public int getNumberOfParameters() { + return this.parameters.size(); + } + public int getNumberOfResources() { + return this.resources.size(); + } + + public boolean hasResources() { + if (this.resources != null && this.resources.size() > 0) { + return true; + } + return false; + } + public boolean hasParameters() { + if (this.parameters != null && this.parameters.size() > 0) { + return true; + } + return false; + } + + public boolean containsParameter(String paramName) { + boolean contains = false; + if (this.parameters == null || this.parameters.size() < 1) { + return false; + } + if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) { + contains = true; + } + return contains; + } + + public boolean containsParameter(String paramName, String paramAlias) { + if (this.containsParameter(paramName)) { + return true; + } + if (this.containsParameter(paramAlias)) { + return true; + } + return false; + } + + @Override + public String toString() { + return "MsoHeatEnvironmentEntry{" + "parameters=" + parameters + + ", resourceRegistryEntryRaw='" + resourceRegistryEntryRaw + '\'' + + '}'; + } + + public StringBuilder toFullStringExcludeNonParams(Set params) { + // Basically give back the envt - but exclude the params that aren't in the HeatTemplate + + StringBuilder sb = new StringBuilder(); + ArrayList paramNameList = new ArrayList(params.size()); + for (HeatTemplateParam htp : params) { + paramNameList.add(htp.getParamName()); + } + + if (this.hasParameters()) { + sb.append("parameters:\n"); + for (MsoHeatEnvironmentParameter hep : this.parameters) { + String paramName = hep.getName(); + if (paramNameList.contains(paramName)) { + // This parameter *is* in the Heat Template - so include it: + sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n"); + // New - 1607 - if any of the params mapped badly - JUST RETURN THE ORIGINAL ENVT! + if (hep.getValue().startsWith("_BAD")) { + return this.rawEntry; + } + } + } + sb.append("\n"); + } +// if (this.hasResources()) { +// sb.append("resource_registry:\n"); +// for (MsoHeatEnvironmentResource her : this.resources) { +// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n"); +// } +// } + sb.append("\n"); + sb.append(this.resourceRegistryEntryRaw); + return sb; + } + + public StringBuilder toFullString() { + StringBuilder sb = new StringBuilder(); + + if (this.hasParameters()) { + sb.append("parameters:\n"); + for (MsoHeatEnvironmentParameter hep : this.parameters) { + sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n"); + } + sb.append("\n"); + } +// if (this.hasResources()) { +// sb.append("resource_registry:\n"); +// for (MsoHeatEnvironmentResource her : this.resources) { +// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n"); +// } +// } + sb.append("\n"); + sb.append(this.resourceRegistryEntryRaw); + return sb; + } + + public StringBuilder getRawEntry() { + return this.rawEntry; + } + + private StringBuilder getResourceRegistryRawEntry() { + + if (this.rawEntry == null) { + return null; + } + + StringBuilder sb = new StringBuilder(); + int indexOf = this.rawEntry.indexOf("resource_registry:"); + if (indexOf < 0) { // no resource_registry: + return null; + } + sb.append(this.rawEntry.substring(indexOf)); + return sb; + } + + public void setHPAParameters(StringBuilder hpasb) { + try { + MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(hpasb.toString().getBytes()); + Set hpaParams = yaml.getParameterListFromEnvt(); + for (MsoHeatEnvironmentParameter hpaparam : hpaParams) { + for (MsoHeatEnvironmentParameter param : this.parameters) { + if (param.getName() == hpaparam.getName()) { + param.setValue(hpaparam.getValue()); + } + } + } + } catch (Exception e) { + LOGGER.debug("Exception:", e); + this.errorString = e.getMessage(); + //e.printStackTrace(); + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameter.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameter.java new file mode 100644 index 0000000000..7e4c9d00c4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameter.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.openstack.utils; + +import java.util.Objects; + +public class MsoHeatEnvironmentParameter { + + private String name; + private String value; + + public MsoHeatEnvironmentParameter(String name, String value) { + super(); + this.name = name; + this.value = value; + } + public MsoHeatEnvironmentParameter(String name) { + // Allow to initialize with a null value + this(name, null); + } + public MsoHeatEnvironmentParameter() { + this(null, null); + } + + public String getName() { + return this.name; + } + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return this.value; + } + public void setValue(String value) { + this.value = value; + } + public String toString() { + return this.name + ": " + this.value; + } + + public boolean equals(Object o) { + if (!(o instanceof MsoHeatEnvironmentParameter)) { + return false; + } + if (this == o) { + return true; + } + MsoHeatEnvironmentParameter hep = (MsoHeatEnvironmentParameter) o; + // If the name of the parameter is the same, then they're equal + return hep.getName().equals(this.getName()); + } + + public int hashCode() { + return Objects.hashCode(this.name); + } + + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResource.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResource.java new file mode 100644 index 0000000000..c174b58f95 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResource.java @@ -0,0 +1,96 @@ +/*- + * ============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.openstack.utils; + +import org.onap.so.logger.MsoLogger; + +public class MsoHeatEnvironmentResource { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatEnvironmentResource.class); + + private String name; + private String value; + + public MsoHeatEnvironmentResource(String name, String value) { + super(); + this.name = name; + this.value = value; + } + public MsoHeatEnvironmentResource(String name) { + // Allow to initialize with a null value + this(name, null); + } + public MsoHeatEnvironmentResource() { + this(null, null); + } + + public String getName() { + return this.name; + } + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return this.value; + } + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return "\"" + + this.name + + "\": " + + this.value; + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof MsoHeatEnvironmentResource)) { + return false; + } + if (this == o) { + return true; + } + MsoHeatEnvironmentResource her = (MsoHeatEnvironmentResource) o; + // If the name of the parameter is the same, then they're equal + if (her.getName().equals(this.getName())) { + return true; + } + return false; + } + + @Override + public int hashCode() { + int result = 0; + try { + result = this.name.hashCode(); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + return result; + } + + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java new file mode 100644 index 0000000000..e5ece20cb7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -0,0 +1,1790 @@ +/*- + * ============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.openstack.utils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.onap.so.adapters.vdu.CloudInfo; +import org.onap.so.adapters.vdu.PluginAction; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduException; +import org.onap.so.adapters.vdu.VduInstance; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.adapters.vdu.VduPlugin; +import org.onap.so.adapters.vdu.VduStateType; +import org.onap.so.adapters.vdu.VduStatus; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloud.authentication.AuthenticationMethodFactory; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.HeatCacheEntry; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; +import org.onap.so.openstack.exceptions.MsoAdapterException; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.onap.so.openstack.exceptions.MsoStackAlreadyExists; +import org.onap.so.openstack.exceptions.MsoTenantNotFound; +import org.onap.so.openstack.mappers.StackInfoMapper; +import org.onap.so.utils.CryptoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.model.CreateStackParam; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stack.Output; +import com.woorea.openstack.heat.model.Stacks; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.utils.KeystoneUtils; + +@Primary +@Component +public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ + + private static final String TOKEN_AUTH = "TokenAuth"; + + private static final String QUERY_ALL_STACKS = "QueryAllStacks"; + + private static final String DELETE_STACK = "DeleteStack"; + + private static final String HEAT_ERROR = "HeatError"; + + private static final String CREATE_STACK = "CreateStack"; + + // Cache Heat Clients statically. Since there is just one MSO user, there is no + // benefit to re-authentication on every request (or across different flows). The + // token will be used until it expires. + // + // The cache key is "tenantId:cloudId" + private static Map heatClientCache = new HashMap <> (); + + // Fetch cloud configuration each time (may be cached in CloudConfig class) + @Autowired + protected CloudConfig cloudConfig; + + @Autowired + private Environment environment; + + @Autowired + private AuthenticationMethodFactory authenticationMethodFactory; + + @Autowired + private MsoTenantUtilsFactory tenantUtilsFactory; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatUtils.class); + + // Properties names and variables (with default values) + protected String createPollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; + private String deletePollIntervalProp = "ecomp.mso.adapters.po.pollInterval"; + private String deletePollTimeoutProp = "ecomp.mso.adapters.po.pollTimeout"; + + protected static final String createPollIntervalDefault = "15"; + private static final String deletePollIntervalDefault = "15"; + + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + + /** + * keep this old method signature here to maintain backwards compatibility. keep others as well. + * this method does not include environment, files, or heatFiles + */ + public StackInfo createStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes) throws MsoException { + // Just call the new method with the environment & files variable set to null + return this.createStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + null, + null, + null, + true); + } + + // This method has environment, but not files or heatFiles + public StackInfo createStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment) throws MsoException { + // Just call the new method with the files/heatFiles variables set to null + return this.createStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + environment, + null, + null, + true); + } + + // This method has environment and files, but not heatFiles. + public StackInfo createStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment, + Map files) throws MsoException { + return this.createStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + environment, + files, + null, + true); + } + + // This method has environment, files, heatfiles + public StackInfo createStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment, + Map files, + Map heatFiles) throws MsoException { + return this.createStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + environment, + files, + heatFiles, + true); + } + + /** + * Create a new Stack in the specified cloud location and tenant. The Heat template + * and parameter map are passed in as arguments, along with the cloud access credentials. + * It is expected that parameters have been validated and contain at minimum the required + * parameters for the given template with no extra (undefined) parameters.. + * + * The Stack name supplied by the caller must be unique in the scope of this tenant. + * However, it should also be globally unique, as it will be the identifier for the + * resource going forward in Inventory. This latter is managed by the higher levels + * invoking this function. + * + * The caller may choose to let this function poll Openstack for completion of the + * stack creation, or may handle polling itself via separate calls to query the status. + * In either case, a StackInfo object will be returned containing the current status. + * When polling is enabled, a status of CREATED is expected. When not polling, a + * status of BUILDING is expected. + * + * An error will be thrown if the requested Stack already exists in the specified + * Tenant and Cloud. + * + * For 1510 - add "environment", "files" (nested templates), and "heatFiles" (get_files) as + * parameters for createStack. If environment is non-null, it will be added to the stack. + * The nested templates and get_file entries both end up being added to the "files" on the + * stack. We must combine them before we add them to the stack if they're both non-null. + * + * @param cloudSiteId The cloud (may be a region) in which to create the stack. + * @param tenantId The Openstack ID of the tenant in which to create the Stack + * @param stackName The name of the stack to create + * @param heatTemplate The Heat template + * @param stackInputs A map of key/value inputs + * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client + * @param environment An optional yaml-format string to specify environmental parameters + * @param files a Map that lists the child template IDs (file is the string, object is an int of + * Template id) + * @param heatFiles a Map that lists the get_file entries (fileName, fileBody) + * @param backout Donot delete stack on create Failure - defaulted to True + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + */ + + @SuppressWarnings("unchecked") + public StackInfo createStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment, + Map files, + Map heatFiles, + boolean backout) throws MsoException { + // Create local variables checking to see if we have an environment, nested, get_files + // Could later add some checks to see if it's valid. + boolean haveEnvtVariable = true; + if (environment == null || "".equalsIgnoreCase (environment.trim ())) { + haveEnvtVariable = false; + LOGGER.debug ("createStack called with no environment variable"); + } else { + LOGGER.debug ("createStack called with an environment variable: " + environment); + } + + boolean haveFiles = true; + if (files == null || files.isEmpty ()) { + haveFiles = false; + LOGGER.debug ("createStack called with no files / child template ids"); + } else { + LOGGER.debug ("createStack called with " + files.size () + " files / child template ids"); + } + + boolean haveHeatFiles = true; + if (heatFiles == null || heatFiles.isEmpty ()) { + haveHeatFiles = false; + LOGGER.debug ("createStack called with no heatFiles"); + } else { + LOGGER.debug ("createStack called with " + heatFiles.size () + " heatFiles"); + } + + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + LOGGER.debug("Found: " + cloudSite.toString()); + // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) + // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated) + Heat heatClient = getHeatClient (cloudSite, tenantId); + if (heatClient != null) { + LOGGER.debug("Found: " + heatClient.toString()); + } + + LOGGER.debug ("Ready to Create Stack (" + heatTemplate + ") with input params: " + stackInputs); + + //force entire stackInput object to generic Map for openstack compatibility + ObjectMapper mapper = new ObjectMapper(); + Map normalized = new HashMap<>(); + try { + normalized = mapper.readValue(mapper.writeValueAsString(stackInputs), new TypeReference>() {}); + } catch (IOException e1) { + LOGGER.debug("could not map json", e1); + } + + // Build up the stack to create + // Disable auto-rollback, because error reason is lost. Always rollback in the code. + CreateStackParam stack = new CreateStackParam (); + stack.setStackName (stackName); + stack.setTimeoutMinutes (timeoutMinutes); + stack.setParameters (normalized); + stack.setTemplate (heatTemplate); + stack.setDisableRollback (true); + // TJM New for PO Adapter - add envt variable + if (haveEnvtVariable) { + LOGGER.debug ("Found an environment variable - value: " + environment); + stack.setEnvironment (environment); + } + // Now handle nested templates or get_files - have to combine if we have both + // as they're both treated as "files:" on the stack. + if (haveFiles && haveHeatFiles) { + // Let's do this here - not in the bean + LOGGER.debug ("Found files AND heatFiles - combine and add!"); + Map combinedFiles = new HashMap <> (); + for (Entry entry : files.entrySet()) { + combinedFiles.put(entry.getKey(), entry.getValue()); + } + for (Entry entry : heatFiles.entrySet()) { + combinedFiles.put(entry.getKey(), entry.getValue()); + } + stack.setFiles (combinedFiles); + } else { + // Handle if we only have one or neither: + if (haveFiles) { + LOGGER.debug ("Found files - adding to stack"); + stack.setFiles (files); + } + if (haveHeatFiles) { + LOGGER.debug ("Found heatFiles - adding to stack"); + // the setFiles was modified to handle adding the entries + stack.setFiles (heatFiles); + } + } + + // 1802 - attempt to add better formatted printout of request to openstack + try { + Map inputs = new HashMap<>(); + for (Entry entry : stackInputs.entrySet()) { + if (entry.getValue() != null) { + inputs.put(entry.getKey(), entry.getValue()); + } + } + LOGGER.debug(this.printStackRequest(tenantId, heatFiles, files, environment, inputs, stackName, heatTemplate, timeoutMinutes, backout, cloudSiteId)); + } catch (Exception e) { + // that's okay - this is a nice-to-have + LOGGER.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage()); + } + + Stack heatStack = null; + try { + // Execute the actual Openstack command to create the Heat stack + OpenStackRequest request = heatClient.getStacks ().create (stack); + // Begin X-Auth-User + // Obtain an MSO token for the tenant + CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()); + // cloudIdentity.getMsoId(), cloudIdentity.getMsoPass() + //req + request.header ("X-Auth-User", cloudIdentity.getMsoId ()); + request.header ("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ())); + LOGGER.debug ("headers added, about to executeAndRecordOpenstackRequest"); + //LOGGER.debug(this.requestToStringBuilder(stack).toString()); + // END - try to fix X-Auth-User + heatStack = executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + // Since this came on the 'Create Stack' command, nothing was changed + // in the cloud. Return the error as an exception. + if (e.getStatus () == 409) { + // Stack already exists. Return a specific error for this case + MsoStackAlreadyExists me = new MsoStackAlreadyExists (stackName, tenantId, cloudSiteId); + me.addContext (CREATE_STACK); + throw me; + } else { + // Convert the OpenStackResponseException to an MsoOpenstackException + LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); + throw heatExceptionToMsoException (e, CREATE_STACK); + } + } catch (OpenStackConnectException e) { + // Error connecting to Openstack instance. Convert to an MsoException + throw heatExceptionToMsoException (e, CREATE_STACK); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, CREATE_STACK); + } + + // Subsequent access by the canonical name "/". + // Otherwise, simple query by name returns a 302 redirect. + // NOTE: This is specific to the v1 Orchestration API. + String canonicalName = stackName + "/" + heatStack.getId (); + + // If client has requested a final response, poll for stack completion + if (pollForCompletion) { + // Set a time limit on overall polling. + // Use the resource (template) timeout for Openstack (expressed in minutes) + // and add one poll interval to give Openstack a chance to fail on its own.s + + int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); + int pollTimeout = (timeoutMinutes * 60) + createPollInterval; + // New 1610 - poll on delete if we rollback - use same values for now + int deletePollInterval = createPollInterval; + int deletePollTimeout = pollTimeout; + boolean createTimedOut = false; + StringBuilder stackErrorStatusReason = new StringBuilder(""); + LOGGER.debug("createPollInterval=" + createPollInterval + ", pollTimeout=" + pollTimeout); + + while (true) { + try { + heatStack = queryHeatStack (heatClient, canonicalName); + LOGGER.debug (heatStack.getStackStatus () + " (" + canonicalName + ")"); + try { + LOGGER.debug("Current stack " + this.getOutputsAsStringBuilder(heatStack).toString()); + } catch (Exception e) { + LOGGER.debug("an error occurred trying to print out the current outputs of the stack", e); + } + + if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) { + // Stack creation is still running. + // Sleep and try again unless timeout has been reached + if (pollTimeout <= 0) { + // Note that this should not occur, since there is a timeout specified + // in the Openstack call. + LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Create stack timeout"); + createTimedOut = true; + break; + } + + sleep(createPollInterval * 1000L); + + pollTimeout -= createPollInterval; + LOGGER.debug("pollTimeout remaining: " + pollTimeout); + } else { + //save off the status & reason msg before we attempt delete + stackErrorStatusReason.append("Stack error (" + heatStack.getStackStatus() + "): " + heatStack.getStackStatusReason()); + break; + } + } catch (MsoException me) { + // Cannot query the stack status. Something is wrong. + // Try to roll back the stack + if (!backout) + { + LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack, stack deletion suppressed"); + } + else + { + try { + LOGGER.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + canonicalName + " - This will likely fail and/or we won't be able to query to see if delete worked"); + OpenStackRequest request = heatClient.getStacks ().deleteByName (canonicalName); + executeAndRecordOpenstackRequest (request); + // this may be a waste of time - if we just got an exception trying to query the stack - we'll just + // get another one, n'est-ce pas? + boolean deleted = false; + while (!deleted) { + try { + heatStack = queryHeatStack(heatClient, canonicalName); + if (heatStack != null) { + LOGGER.debug(heatStack.getStackStatus()); + if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) { + if (deletePollTimeout <= 0) { + LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, + heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, + "Rollback: DELETE stack timeout"); + break; + } else { + sleep(deletePollInterval * 1000L); + deletePollTimeout -= deletePollInterval; + } + } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())){ + LOGGER.debug("DELETE_COMPLETE for " + canonicalName); + deleted = true; + continue; + } else { + //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate + break; + } + } else { + // assume if we can't find it - it's deleted + LOGGER.debug("heatStack returned null - assume the stack " + canonicalName + " has been deleted"); + deleted = true; + continue; + } + + } catch (Exception e3) { + // Just log this one. We will report the original exception. + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack on error on query"); + + } + } + } catch (Exception e2) { + // Just log this one. We will report the original exception. + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack"); + } + } + + // Propagate the original exception from Stack Query. + me.addContext (CREATE_STACK); + throw me; + } + } + + if (!"CREATE_COMPLETE".equals (heatStack.getStackStatus ())) { + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack error: Polling complete with non-success status: " + + heatStack.getStackStatus () + ", " + heatStack.getStackStatusReason (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error"); + + // Rollback the stack creation, since it is in an indeterminate state. + if (!backout) + { + LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion suppressed"); + } + else + { + try { + LOGGER.debug("Create Stack errored - attempting to DELETE stack: " + canonicalName); + LOGGER.debug("deletePollInterval=" + deletePollInterval + ", deletePollTimeout=" + deletePollTimeout); + OpenStackRequest request = heatClient.getStacks ().deleteByName (canonicalName); + executeAndRecordOpenstackRequest (request); + boolean deleted = false; + while (!deleted) { + try { + heatStack = queryHeatStack(heatClient, canonicalName); + if (heatStack != null) { + LOGGER.debug(heatStack.getStackStatus() + " (" + canonicalName + ")"); + if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) { + if (deletePollTimeout <= 0) { + LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, + heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, + "Rollback: DELETE stack timeout"); + break; + } else { + sleep(deletePollInterval * 1000L); + deletePollTimeout -= deletePollInterval; + LOGGER.debug("deletePollTimeout remaining: " + deletePollTimeout); + } + } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())){ + LOGGER.debug("DELETE_COMPLETE for " + canonicalName); + deleted = true; + continue; + } else if ("DELETE_FAILED".equals(heatStack.getStackStatus())) { + // Warn about this (?) - but still throw the original exception + LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion FAILED", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion FAILED"); + LOGGER.debug("Stack deletion FAILED on a rollback of a create - " + canonicalName + ", status=" + heatStack.getStackStatus() + ", reason=" + heatStack.getStackStatusReason()); + break; + } else { + //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate + break; + } + } else { + // assume if we can't find it - it's deleted + LOGGER.debug("heatStack returned null - assume the stack " + canonicalName + " has been deleted"); + deleted = true; + continue; + } + + } catch (MsoException me2) { + // We got an exception on the delete - don't throw this exception - throw the original - just log. + LOGGER.debug("Exception thrown trying to delete " + canonicalName + " on a create->rollback: " + me2.getContextMessage(), me2); + LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError, me2.getContextMessage()); + } + + } // end while !deleted + StringBuilder errorContextMessage; + if (createTimedOut) { + errorContextMessage = new StringBuilder("Stack Creation Timeout"); + } else { + errorContextMessage = stackErrorStatusReason; + } + if (deleted) { + errorContextMessage.append(" - stack successfully deleted"); + } else { + errorContextMessage.append(" - encountered an error trying to delete the stack"); + } +// MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); + // me.addContext(CREATE_STACK); + // alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + // throw me; + } catch (Exception e2) { + // shouldn't happen - but handle + LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack: rolling back stack"); + } + } + MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); + me.addContext(CREATE_STACK); + alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); + throw me; + } + + } else { + // Get initial status, since it will have been null after the create. + heatStack = queryHeatStack (heatClient, canonicalName); + LOGGER.debug (heatStack.getStackStatus ()); + } + + return new StackInfoMapper(heatStack).map(); + } + + /** + * Query for a single stack (by Name) in a tenant. This call will always return a + * StackInfo object. If the stack does not exist, an "empty" StackInfo will be + * returned - containing only the stack name and a status of NOTFOUND. + * + * @param tenantId The Openstack ID of the tenant in which to query + * @param cloudSiteId The cloud identifier (may be a region) in which to query + * @param stackName The name of the stack to query (may be simple or canonical) + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + */ + public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException { + LOGGER.debug ("Query HEAT stack: " + stackName + " in tenant " + tenantId); + + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + LOGGER.debug("Found: " + cloudSite.toString()); + + // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) + Heat heatClient = null; + try { + heatClient = getHeatClient (cloudSite, tenantId); + if (heatClient != null) { + LOGGER.debug("Found: " + heatClient.toString()); + } + } catch (MsoTenantNotFound e) { + // Tenant doesn't exist, so stack doesn't either + LOGGER.debug ("Tenant with id " + tenantId + "not found.", e); + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } catch (MsoException me) { + // Got an Openstack error. Propagate it + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Exception on Token request: " + me, "Openstack", "", MsoLogger.ErrorCode.AvailabilityError, "Connection Exception"); + me.addContext ("QueryStack"); + throw me; + } + + // Query the Stack. + // An MsoException will propagate transparently to the caller. + Stack heatStack = queryHeatStack (heatClient, stackName); + + if (heatStack == null) { + // Stack does not exist. Return a StackInfo with status NOTFOUND + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } + + return new StackInfoMapper(heatStack).map(); + } + + /** + * Delete a stack (by Name/ID) in a tenant. If the stack is not found, it will be + * considered a successful deletion. The return value is a StackInfo object which + * contains the current stack status. + * + * The client may choose to let the adapter poll Openstack for completion of the + * stack deletion, or may handle polling itself via separate query calls. In either + * case, a StackInfo object will be returned. When polling is enabled, a final + * status of NOTFOUND is expected. When not polling, a status of DELETING is expected. + * + * There is no rollback from a successful stack deletion. A deletion failure will + * also result in an undefined stack state - the components may or may not have been + * all or partially deleted, so the resulting stack must be considered invalid. + * + * @param tenantId The Openstack ID of the tenant in which to perform the delete + * @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack. + * @param stackName The name/id of the stack to delete. May be simple or canonical + * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client + * @return A StackInfo object + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + * @throws MsoCloudSiteNotFound + */ + public StackInfo deleteStack (String tenantId, + String cloudSiteId, + String stackName, + boolean pollForCompletion) throws MsoException { + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + LOGGER.debug("Found: " + cloudSite.toString()); + + // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) + Heat heatClient = null; + try { + heatClient = getHeatClient (cloudSite, tenantId); + if (heatClient != null) { + LOGGER.debug("Found: " + heatClient.toString()); + } + } catch (MsoTenantNotFound e) { + // Tenant doesn't exist, so stack doesn't either + LOGGER.debug ("Tenant with id " + tenantId + "not found.", e); + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } catch (MsoException me) { + // Got an Openstack error. Propagate it + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack", "Openstack Exception on Token request: " + me, "Openstack", "", MsoLogger.ErrorCode.AvailabilityError, "Connection Exception"); + me.addContext (DELETE_STACK); + throw me; + } + + // OK if stack not found, perform a query first + Stack heatStack = queryHeatStack (heatClient, stackName); + if (heatStack == null || "DELETE_COMPLETE".equals (heatStack.getStackStatus ())) { + // Not found. Return a StackInfo with status NOTFOUND + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } + + // Delete the stack. + + // Use canonical name "/" to delete. + // Otherwise, deletion by name returns a 302 redirect. + // NOTE: This is specific to the v1 Orchestration API. + String canonicalName = heatStack.getStackName () + "/" + heatStack.getId (); + + try { + OpenStackRequest request = null; + if(null != heatClient) { + request = heatClient.getStacks ().deleteByName (canonicalName); + } + else { + LOGGER.debug ("Heat Client is NULL" ); + } + + executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + // Not found. We are OK with this. Return a StackInfo with status NOTFOUND + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } else { + // Convert the OpenStackResponseException to an MsoOpenstackException + throw heatExceptionToMsoException (e, DELETE_STACK); + } + } catch (OpenStackConnectException e) { + // Error connecting to Openstack instance. Convert to an MsoException + throw heatExceptionToMsoException (e, DELETE_STACK); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, DELETE_STACK); + } + + // Requery the stack for current status. + // It will probably still exist with "DELETE_IN_PROGRESS" status. + heatStack = queryHeatStack (heatClient, canonicalName); + + if (pollForCompletion) { + // Set a timeout on polling + + int pollInterval = Integer.parseInt(this.environment.getProperty(deletePollIntervalProp, "" + deletePollIntervalDefault)); + int pollTimeout = Integer.parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + deletePollIntervalDefault)); + + // When querying by canonical name, Openstack returns DELETE_COMPLETE status + // instead of "404" (which would result from query by stack name). + while (heatStack != null && !"DELETE_COMPLETE".equals (heatStack.getStackStatus ())) { + LOGGER.debug ("Stack status: " + heatStack.getStackStatus ()); + + if ("DELETE_FAILED".equals (heatStack.getStackStatus ())) { + // Throw a 'special case' of MsoOpenstackException to report the Heat status + String error = "Stack delete error (" + heatStack.getStackStatus () + + "): " + + heatStack.getStackStatusReason (); + MsoOpenstackException me = new MsoOpenstackException (0, "", error); + me.addContext (DELETE_STACK); + + // Alarm this condition, stack deletion failed + alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + + throw me; + } + + if (pollTimeout <= 0) { + LOGGER.error (MessageEnum.RA_DELETE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Delete Stack Timeout"); + + // Throw a 'special case' of MsoOpenstackException to report the Heat status + MsoOpenstackException me = new MsoOpenstackException (0, "", "Stack Deletion Timeout"); + me.addContext (DELETE_STACK); + + // Alarm this condition, stack deletion failed + alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); + + throw me; + } + + sleep(pollInterval * 1000L); + + pollTimeout -= pollInterval; + LOGGER.debug("pollTimeout remaining: " + pollTimeout); + + heatStack = queryHeatStack (heatClient, canonicalName); + } + + // The stack is gone when this point is reached + return new StackInfo (stackName, HeatStatus.NOTFOUND); + } + + // Return the current status (if not polling, the delete may still be in progress) + StackInfo stackInfo = new StackInfoMapper(heatStack).map(); + stackInfo.setName (stackName); + + return stackInfo; + } + + /** + * Query for all stacks in a tenant site. This call will return a List of StackInfo + * objects, one for each deployed stack. + * + * Note that this is limited to a single site. To ensure that a tenant is truly + * empty would require looping across all tenant endpoints. + * + * @param tenantId The Openstack ID of the tenant to query + * @param cloudSiteId The cloud identifier (may be a region) in which to query. + * @return A List of StackInfo objects + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. + * @throws MsoCloudSiteNotFound + */ + public List queryAllStacks (String tenantId, String cloudSiteId) throws MsoException { + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) + Heat heatClient = getHeatClient (cloudSite, tenantId); + + try { + OpenStackRequest request = heatClient.getStacks ().list (); + Stacks stacks = executeAndRecordOpenstackRequest (request); + + List stackList = new ArrayList <> (); + + // Not sure if returns an empty list or null if no stacks exist + if (stacks != null) { + for (Stack stack : stacks) { + stackList.add (new StackInfoMapper(stack).map()); + } + } + + return stackList; + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + // Not sure if this can happen, but return an empty list + LOGGER.debug ("queryAllStacks - stack not found: "); + return new ArrayList <> (); + } else { + // Convert the OpenStackResponseException to an MsoOpenstackException + throw heatExceptionToMsoException (e, QUERY_ALL_STACKS); + } + } catch (OpenStackConnectException e) { + // Error connecting to Openstack instance. Convert to an MsoException + throw heatExceptionToMsoException (e, QUERY_ALL_STACKS); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, QUERY_ALL_STACKS); + } + } + + /** + * Validate parameters to be passed to Heat template. This method performs + * three functions: + * 1. Apply default values to parameters which have them defined + * 2. Report any required parameters that are missing. This will generate an + * exception in the caller, since stack create/update operations would fail. + * 3. Report and remove any extraneous parameters. This will allow clients to + * pass supersets of parameters and not get errors. + * + * These functions depend on the HeatTemplate definition from the MSO Catalog DB, + * along with the input parameter Map. The output is an updated parameter map. + * If the parameters are invalid for the template, an IllegalArgumentException + * is thrown. + */ + public Map validateStackParams (Map inputParams, + HeatTemplate heatTemplate) { + // Check that required parameters have been supplied for this template type + StringBuilder missingParams = null; + List paramList = new ArrayList <> (); + + // TODO: Enhance DB to support defaults for Heat Template parameters + + for (HeatTemplateParam parm : heatTemplate.getParameters ()) { + if (parm.isRequired () && !inputParams.containsKey (parm.getParamName ())) { + if (missingParams == null) { + missingParams = new StringBuilder(parm.getParamName()); + } else { + missingParams.append("," + parm.getParamName()); + } + } + paramList.add (parm.getParamName ()); + } + if (missingParams != null) { + // Problem - missing one or more required parameters + String error = "Missing Required inputs for HEAT Template: " + missingParams; + LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams + " for HEAT Template", "", "", MsoLogger.ErrorCode.SchemaError, "Missing Required inputs for HEAT Template: " + missingParams); + throw new IllegalArgumentException (error); + } + + // Remove any extraneous parameters (don't throw an error) + Map updatedParams = new HashMap <> (); + List extraParams = new ArrayList <> (); + + for (Entry entry : inputParams.entrySet()) { + if (!paramList.contains(entry.getKey())) { + // This is not a valid parameter for this template + extraParams.add(entry.getKey()); + } else { + updatedParams.put(entry.getKey(), entry.getValue()); + } + } + + if (!extraParams.isEmpty ()) { + LOGGER.warn (MessageEnum.RA_GENERAL_WARNING, "Heat Stack (" + heatTemplate.getTemplateName () + + ") extra input params received: " + + extraParams, "", "", MsoLogger.ErrorCode.DataError, "Heat Stack (" + heatTemplate.getTemplateName () + ") extra input params received: "+ extraParams); + } + + return updatedParams; + } + + // --------------------------------------------------------------- + // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS + + /** + * Get a Heat client for the Openstack Identity service. + * This requires a 'member'-level userId + password, which will be retrieved from + * properties based on the specified cloud Id. The tenant in which to operate + * must also be provided. + *

+ * On successful authentication, the Heat object will be cached for the + * tenantID + cloudId so that it can be reused without reauthenticating with + * Openstack every time. + * + * @return an authenticated Heat object + */ + public Heat getHeatClient (CloudSite cloudSite, String tenantId) throws MsoException { + String cloudId = cloudConfig.getCloudSiteId(cloudSite); + + // Check first in the cache of previously authorized clients + String cacheKey = cloudId + ":" + tenantId; + if (heatClientCache.containsKey (cacheKey)) { + if (!heatClientCache.get (cacheKey).isExpired ()) { + LOGGER.debug ("Using Cached HEAT Client for " + cacheKey); + return heatClientCache.get (cacheKey).getHeatClient (); + } else { + // Token is expired. Remove it from cache. + heatClientCache.remove (cacheKey); + LOGGER.debug ("Expired Cached HEAT Client for " + cacheKey); + } + } + + // Obtain an MSO token for the tenant + CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()); + LOGGER.debug("Found: " + cloudIdentity.toString()); + MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType()); + String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity); + LOGGER.debug("keystoneUrl=" + keystoneUrl); + Keystone keystoneTenantClient = new Keystone (keystoneUrl); + Access access = null; + try { + Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); + + OpenStackRequest request = keystoneTenantClient.tokens () + .authenticate (credentials).withTenantId (tenantId); + + access = executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 401) { + // Authentication error. + String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId (); + alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error); + } else { + throw keystoneErrorToMsoException (e, TOKEN_AUTH); + } + } catch (OpenStackConnectException e) { + // Connection to Openstack failed + MsoIOException me = new MsoIOException (e.getMessage (), e); + me.addContext (TOKEN_AUTH); + throw me; + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, TOKEN_AUTH); + } + + // For DCP/LCP, the region should be the cloudId. + String region = cloudSite.getRegionId (); + String heatUrl = null; + try { + // Isolate trying to printout the region IDs + try { + LOGGER.debug("access=" + access.toString()); + for (Access.Service service : access.getServiceCatalog()) { + List endpoints = service.getEndpoints(); + for (Access.Service.Endpoint endpoint : endpoints) { + LOGGER.debug("AIC returned region=" + endpoint.getRegion()); + } + } + } catch (Exception e) { + LOGGER.debug("Encountered an error trying to printout Access object returned from AIC. " + e.getMessage()); + } + heatUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "orchestration", region, "public"); + LOGGER.debug("heatUrl=" + heatUrl + ", region=" + region); + } catch (RuntimeException e) { + // This comes back for not found (probably an incorrect region ID) + String error = "AIC did not match an orchestration service for: region=" + region + ",cloud=" + cloudIdentity.getIdentityUrl(); + alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error, e); + } + + Heat heatClient = new Heat (heatUrl); + heatClient.token (access.getToken ().getId ()); + + heatClientCache.put (cacheKey, + new HeatCacheEntry (heatUrl, + access.getToken ().getId (), + access.getToken ().getExpires ())); + LOGGER.debug ("Caching HEAT Client for " + cacheKey); + + return heatClient; + } + + /** + * Forcibly expire a HEAT client from the cache. This call is for use by + * the KeystoneClient in case where a tenant is deleted. In that case, + * all cached credentials must be purged so that fresh authentication is + * done if a similarly named tenant is re-created. + *

+ * Note: This is probably only applicable to dev/test environments where + * the same Tenant Name is repeatedly used for creation/deletion. + *

+ * + */ + public void expireHeatClient (String tenantId, String cloudId) { + String cacheKey = cloudId + ":" + tenantId; + if (heatClientCache.containsKey (cacheKey)) { + heatClientCache.remove (cacheKey); + LOGGER.debug ("Deleted Cached HEAT Client for " + cacheKey); + } + } + + /* + * Query for a Heat Stack. This function is needed in several places, so + * a common method is useful. This method takes an authenticated Heat Client + * (which internally identifies the cloud & tenant to search), and returns + * a Stack object if found, Null if not found, or an MsoOpenstackException + * if the Openstack API call fails. + * + * The stack name may be a simple name or a canonical name ("{name}/{id}"). + * When simple name is used, Openstack always returns a 302 redirect which + * results in a 2nd request (to the canonical name). Note that query by + * canonical name for a deleted stack returns a Stack object with status + * "DELETE_COMPLETE" while query by simple name for a deleted stack returns + * HTTP 404. + * + * @param heatClient an authenticated Heat client + * + * @param stackName the stack name to query + * + * @return a Stack object that describes the current stack or null if the + * requested stack doesn't exist. + * + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + */ + protected Stack queryHeatStack (Heat heatClient, String stackName) throws MsoException { + if (stackName == null) { + return null; + } + try { + OpenStackRequest request = heatClient.getStacks ().byName (stackName); + return executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + LOGGER.debug ("queryHeatStack - stack not found: " + stackName); + return null; + } else { + // Convert the OpenStackResponseException to an MsoOpenstackException + throw heatExceptionToMsoException (e, "QueryStack"); + } + } catch (OpenStackConnectException e) { + // Connection to Openstack failed + throw heatExceptionToMsoException (e, "QueryAllStack"); + } + } + + + public Map queryStackForOutputs(String cloudSiteId, + String tenantId, String stackName) throws MsoException { + LOGGER.debug("MsoHeatUtils.queryStackForOutputs)"); + StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName); + if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) { + return null; + } + return heatStack.getOutputs(); + } + + public void copyStringOutputsToInputs(Map inputs, + Map otherStackOutputs, boolean overWrite) { + if (inputs == null || otherStackOutputs == null) + return; + for (String key : otherStackOutputs.keySet()) { + if (!inputs.containsKey(key)) { + Object obj = otherStackOutputs.get(key); + if (obj instanceof String) { + inputs.put(key, (String) otherStackOutputs.get(key)); + } else if (obj instanceof JsonNode ){ + // This is a bit of mess - but I think it's the least impacting + // let's convert it BACK to a string - then it will get converted back later + try { + String str = this.convertNode((JsonNode) obj); + inputs.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key, e); + //effect here is this value will not have been copied to the inputs - and therefore will error out downstream + } + } else if (obj instanceof java.util.LinkedHashMap) { + LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode"); + try { + String str = JSON_MAPPER.writeValueAsString(obj); + inputs.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key, e); + } + } else if (obj instanceof Integer) { + try { + String str = "" + obj; + inputs.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key, e); + } + } else { + try { + String str = obj.toString(); + inputs.put(key, str); + } catch (Exception e) { + LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Other "+ key +" (" + e.getMessage() + ")", e); + //effect here is this value will not have been copied to the inputs - and therefore will error out downstream + } + } + } + } + return; + } + public StringBuilder requestToStringBuilder(CreateStackParam stack) { + StringBuilder sb = new StringBuilder(); + sb.append("Stack:\n"); + sb.append("\tStackName: " + stack.getStackName()); + sb.append("\tTemplateUrl: " + stack.getTemplateUrl()); + sb.append("\tTemplate: " + stack.getTemplate()); + sb.append("\tEnvironment: " + stack.getEnvironment()); + sb.append("\tTimeout: " + stack.getTimeoutMinutes()); + sb.append("\tParameters:\n"); + Map params = stack.getParameters(); + if (params == null || params.size() < 1) { + sb.append("\nNONE"); + } else { + for (String key : params.keySet()) { + if (params.get(key) instanceof String) { + sb.append("\n").append(key).append("=").append((String) params.get(key)); + } else if (params.get(key) instanceof JsonNode) { + String jsonStringOut = this.convertNode((JsonNode)params.get(key)); + sb.append("\n").append(key).append("=").append(jsonStringOut); + } else if (params.get(key) instanceof Integer) { + String integerOut = "" + params.get(key); + sb.append("\n").append(key).append("=").append(integerOut); + + } else { + try { + String str = params.get(key).toString(); + sb.append("\n").append(key).append("=").append(str); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + } + } + } + } + return sb; + } + + private String convertNode(final JsonNode node) { + try { + final Object obj = JSON_MAPPER.treeToValue(node, Object.class); + final String json = JSON_MAPPER.writeValueAsString(obj); + return json; + } catch (Exception e) { + LOGGER.debug("Error converting json to string " + e.getMessage(), e); + } + return "[Error converting json to string]"; + } + + + private StringBuilder getOutputsAsStringBuilder(Stack heatStack) { + // This should only be used as a utility to print out the stack outputs + // to the log + StringBuilder sb = new StringBuilder(""); + if (heatStack == null) { + sb.append("(heatStack is null)"); + return sb; + } + List outputList = heatStack.getOutputs(); + if (outputList == null || outputList.isEmpty()) { + sb.append("(outputs is empty)"); + return sb; + } + Map outputs = new HashMap<>(); + for (Output outputItem : outputList) { + outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); + } + int counter = 0; + sb.append("OUTPUTS:\n"); + for (String key : outputs.keySet()) { + sb.append("outputs[").append(counter++).append("]: ").append(key).append("="); + Object obj = outputs.get(key); + if (obj instanceof String) { + sb.append((String) obj).append(" (a string)"); + } else if (obj instanceof JsonNode) { + sb.append(this.convertNode((JsonNode) obj)).append(" (a JsonNode)"); + } else if (obj instanceof java.util.LinkedHashMap) { + try { + String str = JSON_MAPPER.writeValueAsString(obj); + sb.append(str).append(" (a java.util.LinkedHashMap)"); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + sb.append("(a LinkedHashMap value that would not convert nicely)"); + } + } else if (obj instanceof Integer) { + String str = ""; + try { + str = obj.toString() + " (an Integer)\n"; + } catch (Exception e) { + LOGGER.debug("Exception :",e); + str = "(an Integer unable to call .toString() on)"; + } + sb.append(str); + } else if (obj instanceof ArrayList) { + String str = ""; + try { + str = obj.toString() + " (an ArrayList)"; + } catch (Exception e) { + LOGGER.debug("Exception :",e); + str = "(an ArrayList unable to call .toString() on?)"; + } + sb.append(str); + } else if (obj instanceof Boolean) { + String str = ""; + try { + str = obj.toString() + " (a Boolean)"; + } catch (Exception e) { + LOGGER.debug("Exception :",e); + str = "(an Boolean unable to call .toString() on?)"; + } + sb.append(str); + } + else { + String str = ""; + try { + str = obj.toString() + " (unknown Object type)"; + } catch (Exception e) { + LOGGER.debug("Exception :",e); + str = "(a value unable to call .toString() on?)"; + } + sb.append(str); + } + sb.append("\n"); + } + sb.append("[END]"); + return sb; + } + + + public void copyBaseOutputsToInputs(Map inputs, + Map otherStackOutputs, List paramNames, Map aliases) { + if (inputs == null || otherStackOutputs == null) + return; + for (String key : otherStackOutputs.keySet()) { + if (paramNames != null) { + if (!paramNames.contains(key) && !aliases.containsKey(key)) { + LOGGER.debug("\tParameter " + key + " is NOT defined to be in the template - do not copy to inputs"); + continue; + } + if (aliases.containsKey(key)) { + LOGGER.debug("Found an alias! Will move " + key + " to " + aliases.get(key)); + Object obj = otherStackOutputs.get(key); + key = aliases.get(key); + otherStackOutputs.put(key, obj); + } + } + if (!inputs.containsKey(key)) { + Object obj = otherStackOutputs.get(key); + LOGGER.debug("\t**Adding " + key + " to inputs (.toString()=" + obj.toString()); + if (obj instanceof String) { + LOGGER.debug("\t\t**A String"); + inputs.put(key, obj); + } else if (obj instanceof Integer) { + LOGGER.debug("\t\t**An Integer"); + inputs.put(key, obj); + } else if (obj instanceof JsonNode) { + LOGGER.debug("\t\t**A JsonNode"); + inputs.put(key, obj); + } else if (obj instanceof Boolean) { + LOGGER.debug("\t\t**A Boolean"); + inputs.put(key, obj); + } else if (obj instanceof java.util.LinkedHashMap) { + LOGGER.debug("\t\t**A java.util.LinkedHashMap **"); + inputs.put(key, obj); + } else if (obj instanceof java.util.ArrayList) { + LOGGER.debug("\t\t**An ArrayList"); + inputs.put(key, obj); + } else { + LOGGER.debug("\t\t**UNKNOWN OBJECT TYPE"); + inputs.put(key, obj); + } + } else { + LOGGER.debug("key=" + key + " is already in the inputs - will not overwrite"); + } + } + return; + } + + public List convertCdlToArrayList(String cdl) { + String cdl2 = cdl.trim(); + String cdl3; + if (cdl2.startsWith("[") && cdl2.endsWith("]")) { + cdl3 = cdl2.substring(1, cdl2.lastIndexOf("]")); + } else { + cdl3 = cdl2; + } + return new ArrayList<>(Arrays.asList(cdl3.split(","))); + } + + /** + * New with 1707 - this method will convert all the String *values* of the inputs + * to their "actual" object type (based on the param type: in the db - which comes from the template): + * (heat variable type) -> java Object type + * string -> String + * number -> Integer + * json -> JsonNode XXX Removed with MSO-1475 / 1802 + * comma_delimited_list -> ArrayList + * boolean -> Boolean + * if any of the conversions should fail, we will default to adding it to the inputs + * as a string - see if Openstack can handle it. + * Also, will remove any params that are extra. + * Any aliases will be converted to their appropriate name (anyone use this feature?) + * @param inputs - the Map of the inputs received on the request + * @param template the HeatTemplate object - this is so we can also verify if the param is valid for this template + * @return HashMap of the inputs, cleaned and converted + */ + public Map convertInputMap(Map inputs, HeatTemplate template) { + HashMap newInputs = new HashMap<>(); + HashMap params = new HashMap<>(); + HashMap paramAliases = new HashMap<>(); + + if (inputs == null) { + LOGGER.debug("convertInputMap - inputs is null - nothing to do here"); + return new HashMap<>(); + } + + LOGGER.debug("convertInputMap in MsoHeatUtils called, with " + inputs.size() + " inputs, and template " + template.getArtifactUuid()); + try { + LOGGER.debug(template.toString()); + Set paramSet = template.getParameters(); + LOGGER.debug("paramSet has " + paramSet.size() + " entries"); + } catch (Exception e) { + LOGGER.debug("Exception occurred in convertInputMap:" + e.getMessage(), e); + } + + for (HeatTemplateParam htp : template.getParameters()) { + LOGGER.debug("Adding " + htp.getParamName()); + params.put(htp.getParamName(), htp); + if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) { + LOGGER.debug("\tFound ALIAS " + htp.getParamName() + "->" + htp.getParamAlias()); + paramAliases.put(htp.getParamAlias(), htp); + } + } + LOGGER.debug("Now iterate through the inputs..."); + for (String key : inputs.keySet()) { + LOGGER.debug("key=" + key); + boolean alias = false; + String realName = null; + if (!params.containsKey(key)) { + LOGGER.debug(key + " is not a parameter in the template! - check for an alias"); + // add check here for an alias + if (!paramAliases.containsKey(key)) { + LOGGER.debug("The parameter " + key + " is in the inputs, but it's not a parameter for this template - omit"); + continue; + } else { + alias = true; + realName = paramAliases.get(key).getParamName(); + LOGGER.debug("FOUND AN ALIAS! Will use " + realName + " in lieu of give key/alias " + key); + } + } + String type = params.get(key).getParamType(); + if (type == null || "".equals(type)) { + LOGGER.debug("**PARAM_TYPE is null/empty for " + key + ", will default to string"); + type = "string"; + } + LOGGER.debug("Parameter: " + key + " is of type " + type); + if ("string".equalsIgnoreCase(type)) { + // Easiest! + String str = inputs.get(key); + if (alias) + newInputs.put(realName, str); + else + newInputs.put(key, str); + } else if ("number".equalsIgnoreCase(type)) { + String integerString = inputs.get(key); + Integer anInteger = null; + try { + anInteger = Integer.parseInt(integerString); + } catch (Exception e) { + LOGGER.debug("Unable to convert " + integerString + " to an integer!!", e); + anInteger = null; + } + if (anInteger != null) { + if (alias) + newInputs.put(realName, anInteger); + else + newInputs.put(key, anInteger); + } + else { + if (alias) + newInputs.put(realName, integerString); + else + newInputs.put(key, integerString); + } + } else if ("json".equalsIgnoreCase(type)) { + // MSO-1475 - Leave this as a string now + String jsonString = inputs.get(key); + LOGGER.debug("Skipping conversion to jsonNode..."); + if (alias) + newInputs.put(realName, jsonString); + else + newInputs.put(key, jsonString); + //} + } else if ("comma_delimited_list".equalsIgnoreCase(type)) { + String commaSeparated = inputs.get(key); + try { + List anArrayList = this.convertCdlToArrayList(commaSeparated); + if (alias) + newInputs.put(realName, anArrayList); + else + newInputs.put(key, anArrayList); + } catch (Exception e) { + LOGGER.debug("Unable to convert " + commaSeparated + " to an ArrayList!!", e); + if (alias) + newInputs.put(realName, commaSeparated); + else + newInputs.put(key, commaSeparated); + } + } else if ("boolean".equalsIgnoreCase(type)) { + String booleanString = inputs.get(key); + Boolean aBool = Boolean.valueOf(booleanString); + if (alias) + newInputs.put(realName, aBool); + else + newInputs.put(key, aBool); + } else { + // it's null or something undefined - just add it back as a String + String str = inputs.get(key); + if (alias) + newInputs.put(realName, str); + else + newInputs.put(key, str); + } + } + return newInputs; + } + + /* + * This helpful method added for Valet + */ + public String getCloudSiteKeystoneUrl(String cloudSiteId) throws MsoCloudSiteNotFound { + String keystone_url = null; + try { + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId)); + CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()); + keystone_url = cloudIdentity.getIdentityUrl(); + } catch (Exception e) { + throw new MsoCloudSiteNotFound(cloudSiteId); + } + if (keystone_url == null || keystone_url.isEmpty()) { + throw new MsoCloudSiteNotFound(cloudSiteId); + } + return keystone_url; + } + + /* + * Create a string suitable for being dumped to a debug log that creates a + * pseudo-JSON request dumping what's being sent to Openstack API in the create or update request + */ + + private String printStackRequest(String tenantId, + Map heatFiles, + Map nestedTemplates, + String environment, + Map inputs, + String vfModuleName, + String template, + int timeoutMinutes, + boolean backout, + String cloudSiteId) { + StringBuilder sb = new StringBuilder(); + sb.append("CREATE STACK REQUEST (formatted for readability)\n"); + sb.append("tenant=" + tenantId + ", cloud=" + cloudSiteId); + sb.append("{\n"); + sb.append(" \"stack_name\": \"" + vfModuleName + "\",\n"); + sb.append(" \"disable_rollback\": " + backout + ",\n"); + sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n"); + sb.append(" \"template\": {\n"); + sb.append(template); + sb.append(" },\n"); + sb.append(" \"environment\": {\n"); + if (environment == null) + sb.append(""); + else + sb.append(environment); + sb.append(" },\n"); + sb.append(" \"files\": {\n"); + int filesCounter = 0; + if (heatFiles != null) { + for (String key : heatFiles.keySet()) { + filesCounter++; + if (filesCounter > 1) { + sb.append(",\n"); + } + sb.append(" \"" + key + "\": {\n"); + sb.append(heatFiles.get(key).toString() + "\n }"); + } + } + if (nestedTemplates != null) { + for (String key : nestedTemplates.keySet()) { + filesCounter++; + if (filesCounter > 1) { + sb.append(",\n"); + } + sb.append(" \"" + key + "\": {\n"); + sb.append(nestedTemplates.get(key).toString() + "\n }"); + } + } + sb.append("\n },\n"); + sb.append(" \"parameters\": {\n"); + int paramCounter = 0; + for (String name : inputs.keySet()) { + paramCounter++; + if (paramCounter > 1) { + sb.append(",\n"); + } + Object o = inputs.get(name); + if (o instanceof java.lang.String) { + sb.append(" \"" + name + "\": \"" + inputs.get(name).toString() + "\""); + } else if (o instanceof Integer) { + sb.append(" \"" + name + "\": " + inputs.get(name).toString() ); + } else if (o instanceof ArrayList) { + sb.append(" \"" + name + "\": " + inputs.get(name).toString() ); + } else if (o instanceof Boolean) { + sb.append(" \"" + name + "\": " + inputs.get(name).toString() ); + } else { + sb.append(" \"" + name + "\": " + "\"(there was an issue trying to dump this value...)\"" ); + } + } + sb.append("\n }\n}\n"); + + return sb.toString(); + } + + /******************************************************************************* + * + * Methods (and associated utilities) to implement the VduPlugin interface + * + *******************************************************************************/ + + /** + * VduPlugin interface for instantiate function. + * + * Translate the VduPlugin parameters to the corresponding 'createStack' parameters, + * and then invoke the existing function. + */ + @Override + public VduInstance instantiateVdu ( + CloudInfo cloudInfo, + String instanceName, + Map inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + // Translate the VDU ModelInformation structure to that which is needed for + // creating the Heat stack. Loop through the artifacts, looking specifically + // for MAIN_TEMPLATE and ENVIRONMENT. Any other artifact will + // be attached as a FILE. + String heatTemplate = null; + Map nestedTemplates = new HashMap<>(); + Map files = new HashMap<>(); + String heatEnvironment = null; + + for (VduArtifact vduArtifact: vduModel.getArtifacts()) { + if (vduArtifact.getType() == ArtifactType.MAIN_TEMPLATE) { + heatTemplate = new String(vduArtifact.getContent()); + } + else if (vduArtifact.getType() == ArtifactType.NESTED_TEMPLATE) { + nestedTemplates.put(vduArtifact.getName(), new String(vduArtifact.getContent())); + } + else if (vduArtifact.getType() == ArtifactType.ENVIRONMENT) { + heatEnvironment = new String(vduArtifact.getContent()); + } + } + + try { + StackInfo stackInfo = createStack (cloudSiteId, + tenantId, + instanceName, + heatTemplate, + inputs, + true, // poll for completion + vduModel.getTimeoutMinutes(), + heatEnvironment, + nestedTemplates, + files, + rollbackOnFailure); + + // Populate a vduInstance from the StackInfo + return stackInfoToVduInstance(stackInfo); + } + catch (Exception e) { + throw new VduException ("MsoHeatUtils (instantiateVDU): createStack Exception", e); + } + } + + + /** + * VduPlugin interface for query function. + */ + @Override + public VduInstance queryVdu (CloudInfo cloudInfo, String instanceId) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + try { + // Query the Cloudify Deployment object and populate a VduInstance + StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId); + + return stackInfoToVduInstance(stackInfo); + } + catch (Exception e) { + throw new VduException ("MsoHeatUtile (queryVdu): queryStack Exception ", e); + } + } + + + /** + * VduPlugin interface for delete function. + */ + @Override + public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes) + throws VduException + { + String cloudSiteId = cloudInfo.getCloudSiteId(); + String tenantId = cloudInfo.getTenantId(); + + try { + // Delete the Heat stack + StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true); + + // Populate a VduInstance based on the deleted Cloudify Deployment object + VduInstance vduInstance = stackInfoToVduInstance(stackInfo); + + // Override return state to DELETED (HeatUtils sets to NOTFOUND) + vduInstance.getStatus().setState(VduStateType.DELETED); + + return vduInstance; + } + catch (Exception e) { + throw new VduException ("Delete VDU Exception", e); + } + } + + + /** + * VduPlugin interface for update function. + * + * Update is currently not supported in the MsoHeatUtils implementation of VduPlugin. + * Just return a VduException. + * + */ + @Override + public VduInstance updateVdu ( + CloudInfo cloudInfo, + String instanceId, + Map inputs, + VduModelInfo vduModel, + boolean rollbackOnFailure) + throws VduException + { + throw new VduException ("MsoHeatUtils: updateVdu interface not supported"); + } + + + /* + * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object + */ + private VduInstance stackInfoToVduInstance (StackInfo stackInfo) + { + VduInstance vduInstance = new VduInstance(); + + // The full canonical name as the instance UUID + vduInstance.setVduInstanceId(stackInfo.getCanonicalName()); + vduInstance.setVduInstanceName(stackInfo.getName()); + + // Copy inputs and outputs + vduInstance.setInputs(stackInfo.getParameters()); + vduInstance.setOutputs(stackInfo.getOutputs()); + + // Translate the status elements + vduInstance.setStatus(stackStatusToVduStatus (stackInfo)); + + return vduInstance; + } + + private VduStatus stackStatusToVduStatus (StackInfo stackInfo) + { + VduStatus vduStatus = new VduStatus(); + + // Map the status fields to more generic VduStatus. + // There are lots of HeatStatus values, so this is a bit long... + HeatStatus heatStatus = stackInfo.getStatus(); + String statusMessage = stackInfo.getStatusMessage(); + + if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) { + vduStatus.setState(VduStateType.INSTANTIATING); + vduStatus.setLastAction((new PluginAction ("create", "in_progress", statusMessage))); + } + else if (heatStatus == HeatStatus.NOTFOUND) { + vduStatus.setState(VduStateType.NOTFOUND); + } + else if (heatStatus == HeatStatus.CREATED) { + vduStatus.setState(VduStateType.INSTANTIATED); + vduStatus.setLastAction((new PluginAction ("create", "complete", statusMessage))); + } + else if (heatStatus == HeatStatus.UPDATED) { + vduStatus.setState(VduStateType.INSTANTIATED); + vduStatus.setLastAction((new PluginAction ("update", "complete", statusMessage))); + } + else if (heatStatus == HeatStatus.UPDATING) { + vduStatus.setState(VduStateType.UPDATING); + vduStatus.setLastAction((new PluginAction ("update", "in_progress", statusMessage))); + } + else if (heatStatus == HeatStatus.DELETING) { + vduStatus.setState(VduStateType.DELETING); + vduStatus.setLastAction((new PluginAction ("delete", "in_progress", statusMessage))); + } + else if (heatStatus == HeatStatus.FAILED) { + vduStatus.setState(VduStateType.FAILED); + vduStatus.setErrorMessage(stackInfo.getStatusMessage()); + } else { + vduStatus.setState(VduStateType.UNKNOWN); + } + + return vduStatus; + } + + private void sleep(long time) { + try { + Thread.sleep(time); + } catch (InterruptedException e) { + LOGGER.debug ("Thread interrupted while sleeping", e); + Thread.currentThread().interrupt(); + } + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java new file mode 100644 index 0000000000..0b3f9dfe17 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java @@ -0,0 +1,438 @@ +/*- + * ============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.openstack.utils; + + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudSite; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.StackInfo; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.onap.so.openstack.exceptions.MsoStackNotFound; +import org.onap.so.openstack.mappers.StackInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.base.client.OpenStackBaseException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stack.Output; +import com.woorea.openstack.heat.model.UpdateStackParam; + +@Component +public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { + + private static final String UPDATE_STACK = "UpdateStack"; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoHeatUtilsWithUpdate.class); + + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + + @Autowired + private Environment environment; + /* + * Keep these methods around for backward compatibility + */ + + public StackInfo updateStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes) throws MsoException { + // Keeping this method to allow compatibility with no environment or files variable sent. In this case, + // simply return the new method with the environment variable set to null. + return this.updateStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + null, + null, + null); + } + + public StackInfo updateStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment) throws MsoException { + // Keeping this method to allow compatibility with no environment variable sent. In this case, + // simply return the new method with the files variable set to null. + return this.updateStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + environment, + null, + null); + } + + public StackInfo updateStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment, + Map files) throws MsoException { + return this.updateStack (cloudSiteId, + tenantId, + stackName, + heatTemplate, + stackInputs, + pollForCompletion, + timeoutMinutes, + environment, + files, + null); + } + + /** + * Update a Stack in the specified cloud location and tenant. The Heat template + * and parameter map are passed in as arguments, along with the cloud access credentials. + * It is expected that parameters have been validated and contain at minimum the required + * parameters for the given template with no extra (undefined) parameters.. + * + * The Stack name supplied by the caller must be unique in the scope of this tenant. + * However, it should also be globally unique, as it will be the identifier for the + * resource going forward in Inventory. This latter is managed by the higher levels + * invoking this function. + * + * The caller may choose to let this function poll Openstack for completion of the + * stack creation, or may handle polling itself via separate calls to query the status. + * In either case, a StackInfo object will be returned containing the current status. + * When polling is enabled, a status of CREATED is expected. When not polling, a + * status of BUILDING is expected. + * + * An error will be thrown if the requested Stack already exists in the specified + * Tenant and Cloud. + * + * @param tenantId The Openstack ID of the tenant in which to create the Stack + * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant. + * @param stackName The name of the stack to update + * @param heatTemplate The Heat template + * @param stackInputs A map of key/value inputs + * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client + * @param environment An optional yaml-format string to specify environmental parameters + * @param files a Map for listing child template IDs + * @param heatFiles a Map for listing get_file entries (fileName, fileBody) + * @return A StackInfo object + * @throws MsoException Thrown if the Openstack API call returns an exception. + */ + + public StackInfo updateStack (String cloudSiteId, + String tenantId, + String stackName, + String heatTemplate, + Map stackInputs, + boolean pollForCompletion, + int timeoutMinutes, + String environment, + Map files, + Map heatFiles) throws MsoException { + boolean heatEnvtVariable = true; + if (environment == null || "".equalsIgnoreCase (environment.trim ())) { + heatEnvtVariable = false; + } + boolean haveFiles = true; + if (files == null || files.isEmpty ()) { + haveFiles = false; + } + boolean haveHeatFiles = true; + if (heatFiles == null || heatFiles.isEmpty ()) { + haveHeatFiles = false; + } + + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) + // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated) + Heat heatClient = getHeatClient (cloudSite, tenantId); + + // Perform a query first to get the current status + Stack heatStack = queryHeatStack (heatClient, stackName); + if (heatStack == null || "DELETE_COMPLETE".equals (heatStack.getStackStatus ())) { + // Not found. Return a StackInfo with status NOTFOUND + throw new MsoStackNotFound (stackName, tenantId, cloudSiteId); + } + + // Use canonical name "/" to update the stack. + // Otherwise, update by name returns a 302 redirect. + // NOTE: This is specific to the v1 Orchestration API. + String canonicalName = heatStack.getStackName () + "/" + heatStack.getId (); + + LOGGER.debug ("Ready to Update Stack (" + canonicalName + ") with input params: " + stackInputs); + //force entire stackInput object to generic Map for openstack compatibility + ObjectMapper mapper = new ObjectMapper(); + Map normalized = new HashMap<>(); + try { + normalized = mapper.readValue(mapper.writeValueAsString(stackInputs), new TypeReference>() {}); + } catch (IOException e1) { + LOGGER.debug("could not map json", e1); + } + // Build up the stack update parameters + // Disable auto-rollback, because error reason is lost. Always rollback in the code. + UpdateStackParam stack = new UpdateStackParam (); + stack.setTimeoutMinutes (timeoutMinutes); + stack.setParameters (normalized); + stack.setTemplate (heatTemplate); + stack.setDisableRollback (true); + // TJM add envt to stack + if (heatEnvtVariable) { + stack.setEnvironment (environment); + } + + // Handle nested templates & get_files here. if we have both - must combine + // and then add to stack (both are part of "files:" being added to stack) + if (haveFiles && haveHeatFiles) { + // Let's do this here - not in the bean + LOGGER.debug ("Found files AND heatFiles - combine and add!"); + Map combinedFiles = new HashMap<>(); + for (String keyString : files.keySet ()) { + combinedFiles.put (keyString, files.get (keyString)); + } + for (String keyString : heatFiles.keySet ()) { + combinedFiles.put (keyString, heatFiles.get (keyString)); + } + stack.setFiles (combinedFiles); + } else { + // Handle case where we have one or neither + if (haveFiles) { + stack.setFiles (files); + } + if (haveHeatFiles) { + // setFiles method modified to handle adding a map. + stack.setFiles (heatFiles); + } + } + + try { + // Execute the actual Openstack command to update the Heat stack + OpenStackRequest request = heatClient.getStacks ().update (canonicalName, stack); + executeAndRecordOpenstackRequest (request); + } catch (OpenStackBaseException e) { + // Since this came on the 'Update Stack' command, nothing was changed + // in the cloud. Rethrow the error as an MSO exception. + throw heatExceptionToMsoException (e, UPDATE_STACK); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, UPDATE_STACK); + } + + // If client has requested a final response, poll for stack completion + Stack updateStack = null; + if (pollForCompletion) { + // Set a time limit on overall polling. + // Use the resource (template) timeout for Openstack (expressed in minutes) + // and add one poll interval to give Openstack a chance to fail on its own. + int createPollInterval = Integer.parseInt(this.environment.getProperty(createPollIntervalProp, createPollIntervalDefault)); + int pollTimeout = (timeoutMinutes * 60) + createPollInterval; + + boolean loopAgain = true; + while (loopAgain) { + try { + updateStack = queryHeatStack (heatClient, canonicalName); + LOGGER.debug (updateStack.getStackStatus () + " (" + canonicalName + ")"); + try { + LOGGER.debug("Current stack " + this.getOutputsAsStringBuilderWithUpdate(heatStack).toString()); + } catch (Exception e) { + LOGGER.debug("an error occurred trying to print out the current outputs of the stack", e); + } + + + if ("UPDATE_IN_PROGRESS".equals (updateStack.getStackStatus ())) { + // Stack update is still running. + // Sleep and try again unless timeout has been reached + if (pollTimeout <= 0) { + // Note that this should not occur, since there is a timeout specified + // in the Openstack call. + LOGGER.error (MessageEnum.RA_UPDATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, updateStack.getStackStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError, "Update stack timeout"); + loopAgain = false; + } else { + try { + Thread.sleep (createPollInterval * 1000L); + } catch (InterruptedException e) { + // If we are interrupted, we should stop ASAP. + loopAgain = false; + // Set again the interrupted flag + Thread.currentThread().interrupt(); + } + } + pollTimeout -= createPollInterval; + LOGGER.debug("pollTimeout remaining: " + pollTimeout); + } else { + loopAgain = false; + } + } catch (MsoException e) { + // Cannot query the stack. Something is wrong. + + // TODO: No way to roll back the stack at this point. What to do? + e.addContext (UPDATE_STACK); + throw e; + } + } + + if (!"UPDATE_COMPLETE".equals (updateStack.getStackStatus ())) { + LOGGER.error (MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(), "", "", MsoLogger.ErrorCode.DataError, "Update Stack error"); + + // TODO: No way to roll back the stack at this point. What to do? + // Throw a 'special case' of MsoOpenstackException to report the Heat status + MsoOpenstackException me = null; + if ("UPDATE_IN_PROGRESS".equals (updateStack.getStackStatus ())) { + me = new MsoOpenstackException (0, "", "Stack Update Timeout"); + } else { + String error = "Stack error (" + updateStack.getStackStatus () + + "): " + + updateStack.getStackStatusReason (); + me = new MsoOpenstackException (0, "", error); + } + me.addContext (UPDATE_STACK); + throw me; + } + + } else { + // Return the current status. + updateStack = queryHeatStack (heatClient, canonicalName); + if (updateStack != null) { + LOGGER.debug ("UpdateStack, status = " + updateStack.getStackStatus ()); + } else { + LOGGER.debug ("UpdateStack, stack not found"); + } + } + return new StackInfoMapper(updateStack).map(); + } + + private StringBuilder getOutputsAsStringBuilderWithUpdate(Stack heatStack) { + // This should only be used as a utility to print out the stack outputs + // to the log + StringBuilder sb = new StringBuilder(""); + if (heatStack == null) { + sb.append("(heatStack is null)"); + return sb; + } + List outputList = heatStack.getOutputs(); + if (outputList == null || outputList.isEmpty()) { + sb.append("(outputs is empty)"); + return sb; + } + Map outputs = new HashMap<>(); + for (Output outputItem : outputList) { + outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); + } + int counter = 0; + sb.append("OUTPUTS:\n"); + for (String key : outputs.keySet()) { + sb.append("outputs[").append(counter++).append("]: ").append(key).append("="); + Object obj = outputs.get(key); + if (obj instanceof String) { + sb.append((String) obj).append(" (a string)"); + } else if (obj instanceof JsonNode) { + sb.append(this.convertNodeWithUpdate((JsonNode) obj)).append(" (a JsonNode)"); + } else if (obj instanceof java.util.LinkedHashMap) { + try { + String str = JSON_MAPPER.writeValueAsString(obj); + sb.append(str).append(" (a java.util.LinkedHashMap)"); + } catch (Exception e) { + LOGGER.debug("Exception :", e); + sb.append("(a LinkedHashMap value that would not convert nicely)"); + } + } else if (obj instanceof Integer) { + String str = ""; + try { + str = obj.toString() + " (an Integer)\n"; + } catch (Exception e) { + LOGGER.debug("Exception :", e); + str = "(an Integer unable to call .toString() on)"; + } + sb.append(str); + } else if (obj instanceof ArrayList) { + String str = ""; + try { + str = obj.toString() + " (an ArrayList)"; + } catch (Exception e) { + LOGGER.debug("Exception :", e); + str = "(an ArrayList unable to call .toString() on?)"; + } + sb.append(str); + } else if (obj instanceof Boolean) { + String str = ""; + try { + str = obj.toString() + " (a Boolean)"; + } catch (Exception e) { + LOGGER.debug("Exception :", e); + str = "(an Boolean unable to call .toString() on?)"; + } + sb.append(str); + } + else { + String str = ""; + try { + str = obj.toString() + " (unknown Object type)"; + } catch (Exception e) { + LOGGER.debug("Exception :", e); + str = "(a value unable to call .toString() on?)"; + } + sb.append(str); + } + sb.append("\n"); + } + sb.append("[END]"); + return sb; + } + + private String convertNodeWithUpdate(final JsonNode node) { + try { + final Object obj = JSON_MAPPER.treeToValue(node, Object.class); + final String json = JSON_MAPPER.writeValueAsString(obj); + return json; + } catch (Exception e) { + LOGGER.debug("Error converting json to string " + e.getMessage(), e); + } + return "[Error converting json to string]"; + } + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java new file mode 100644 index 0000000000..d3ec74db8d --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java @@ -0,0 +1,669 @@ +/*- + * ============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.openstack.utils; + + +import java.io.Serializable; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloud.authentication.AuthenticationMethodFactory; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.MsoTenant; +import org.onap.so.openstack.exceptions.MsoAdapterException; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.onap.so.openstack.exceptions.MsoTenantAlreadyExists; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.woorea.openstack.base.client.OpenStackBaseException; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.Metadata; +import com.woorea.openstack.keystone.model.Role; +import com.woorea.openstack.keystone.model.Roles; +import com.woorea.openstack.keystone.model.Tenant; +import com.woorea.openstack.keystone.model.User; +import com.woorea.openstack.keystone.utils.KeystoneUtils; + +@Component +public class MsoKeystoneUtils extends MsoTenantUtils { + + // Cache the Keystone Clients statically. Since there is just one MSO user, there is no + // benefit to re-authentication on every request (or across different flows). The + // token will be used until it expires. + // + // The cache key is "cloudId" + private static Map adminClientCache = new HashMap<>(); + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoKeystoneUtils.class); + + @Autowired + private AuthenticationMethodFactory authenticationMethodFactory; + + @Autowired + private MsoHeatUtils msoHeatUtils; + + @Autowired + private MsoNeutronUtils msoNeutronUtils; + + @Autowired + private MsoTenantUtilsFactory tenantUtilsFactory; + /** + * Create a tenant with the specified name in the given cloud. If the tenant already exists, + * an Exception will be thrown. The MSO User will also be added to the "member" list of + * the new tenant to perform subsequent Nova/Heat commands in the tenant. If the MSO User + * association fails, the entire transaction will be rolled back. + *

+ * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin + * requests go to the centralized identity service in DCP. However, if some artifact + * must exist in each local LCP instance as well, then it will be needed to access the + * correct region. + *

+ * + * @param tenantName The tenant name to create + * @param cloudId The cloud identifier (may be a region) in which to create the tenant. + * @return the tenant ID of the newly created tenant + * @throws MsoTenantAlreadyExists Thrown if the requested tenant already exists + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + */ + public String createTenant (String tenantName, + String cloudSiteId, + Map metadata, + boolean backout) throws MsoException { + // Obtain the cloud site information where we will create the tenant + Optional cloudSiteOpt = cloudConfig.getCloudSite(cloudSiteId); + if (!cloudSiteOpt.isPresent()) { + LOGGER.error(MessageEnum.RA_CREATE_TENANT_ERR, "MSOCloudSite not found", "", "", MsoLogger.ErrorCode.DataError, "MSOCloudSite not found"); + throw new MsoCloudSiteNotFound (cloudSiteId); + } + Keystone keystoneAdminClient = getKeystoneAdminClient(cloudSiteOpt.get()); + Tenant tenant = null; + try { + // Check if the tenant already exists + tenant = findTenantByName (keystoneAdminClient, tenantName); + + if (tenant != null) { + // Tenant already exists. Throw an exception + LOGGER.error(MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant already exists"); + throw new MsoTenantAlreadyExists (tenantName, cloudSiteId); + } + + // Does not exist, create a new one + tenant = new Tenant (); + tenant.setName (tenantName); + tenant.setDescription ("SDN Tenant (via MSO)"); + tenant.setEnabled (true); + + OpenStackRequest request = keystoneAdminClient.tenants ().create (tenant); + tenant = executeAndRecordOpenstackRequest (request); + } catch (OpenStackBaseException e) { + // Convert Keystone OpenStackResponseException to MsoOpenstackException + throw keystoneErrorToMsoException (e, "CreateTenant"); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, "CreateTenant"); + } + + // Add MSO User to the tenant as a member and + // apply tenant metadata if supported by the cloud site + try { + CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSiteOpt.get().getIdentityServiceId()); + + User msoUser = findUserByNameOrId (keystoneAdminClient, cloudIdentity.getMsoId ()); + Role memberRole = findRoleByNameOrId (keystoneAdminClient, cloudIdentity.getMemberRole ()); + + if(msoUser != null && memberRole != null) { + OpenStackRequest request = keystoneAdminClient.tenants ().addUser (tenant.getId (), + msoUser.getId (), + memberRole.getId ()); + executeAndRecordOpenstackRequest (request); + } + + if (cloudIdentity.hasTenantMetadata () && metadata != null && !metadata.isEmpty ()) { + Metadata tenantMetadata = new Metadata (); + tenantMetadata.setMetadata (metadata); + + OpenStackRequest metaRequest = keystoneAdminClient.tenants () + .createOrUpdateMetadata (tenant.getId (), + tenantMetadata); + executeAndRecordOpenstackRequest (metaRequest); + } + } catch (Exception e) { + // Failed to attach MSO User to the new tenant. Can't operate without access, + // so roll back the tenant. + if (!backout) + { + LOGGER.warn(MessageEnum.RA_CREATE_TENANT_ERR, "Create Tenant errored, Tenant deletion suppressed", "Openstack", "", MsoLogger.ErrorCode.DataError, "Create Tenant error, Tenant deletion suppressed"); + } + else + { + try { + OpenStackRequest request = keystoneAdminClient.tenants ().delete (tenant.getId ()); + executeAndRecordOpenstackRequest (request); + } catch (Exception e2) { + // Just log this one. We will report the original exception. + LOGGER.error (MessageEnum.RA_CREATE_TENANT_ERR, "Nested exception rolling back tenant", "Openstack", "", MsoLogger.ErrorCode.DataError, "Create Tenant error, Nested exception rolling back tenant", e2); + } + } + + + // Propagate the original exception on user/role/tenant mapping + if (e instanceof OpenStackBaseException) { + // Convert Keystone Exception to MsoOpenstackException + throw keystoneErrorToMsoException ((OpenStackBaseException) e, "CreateTenantUser"); + } else { + MsoAdapterException me = new MsoAdapterException (e.getMessage (), e); + me.addContext ("CreateTenantUser"); + throw me; + } + } + return tenant.getId (); + } + + /** + * Query for a tenant by ID in the given cloud. If the tenant exists, + * return an MsoTenant object. If not, return null. + *

+ * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin + * requests go to the centralized identity service in DCP. However, if some artifact + * must exist in each local LCP instance as well, then it will be needed to access the + * correct region. + *

+ * + * @param tenantId The Openstack ID of the tenant to query + * @param cloudSiteId The cloud identifier (may be a region) in which to query the tenant. + * @return the tenant properties of the queried tenant, or null if not found + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + */ + public MsoTenant queryTenant (String tenantId, String cloudSiteId) throws MsoException { + // Obtain the cloud site information where we will query the tenant + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + + Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite); + + // Check if the tenant exists and return its Tenant Id + try { + Tenant tenant = findTenantById (keystoneAdminClient, tenantId); + if (tenant == null) { + return null; + } + + Map metadata = new HashMap (); + if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).hasTenantMetadata ()) { + OpenStackRequest request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); + Metadata tenantMetadata = executeAndRecordOpenstackRequest (request); + if (tenantMetadata != null) { + metadata = tenantMetadata.getMetadata (); + } + } + return new MsoTenant (tenant.getId (), tenant.getName (), metadata); + } catch (OpenStackBaseException e) { + // Convert Keystone OpenStackResponseException to MsoOpenstackException + throw keystoneErrorToMsoException (e, "QueryTenant"); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, "QueryTenant"); + } + } + + /** + * Query for a tenant with the specified name in the given cloud. If the tenant exists, + * return an MsoTenant object. If not, return null. This query is useful if the client + * knows it has the tenant name, skipping an initial lookup by ID that would always fail. + *

+ * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin + * requests go to the centralized identity service in DCP. However, if some artifact + * must exist in each local LCP instance as well, then it will be needed to access the + * correct region. + *

+ * + * @param tenantName The name of the tenant to query + * @param cloudSiteId The cloud identifier (may be a region) in which to query the tenant. + * @return the tenant properties of the queried tenant, or null if not found + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + */ + public MsoTenant queryTenantByName (String tenantName, String cloudSiteId) throws MsoException { + // Obtain the cloud site information where we will query the tenant + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite); + + try { + Tenant tenant = findTenantByName (keystoneAdminClient, tenantName); + if (tenant == null) { + return null; + } + + Map metadata = new HashMap (); + if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).hasTenantMetadata ()) { + OpenStackRequest request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); + Metadata tenantMetadata = executeAndRecordOpenstackRequest (request); + if (tenantMetadata != null) { + metadata = tenantMetadata.getMetadata (); + } + } + return new MsoTenant (tenant.getId (), tenant.getName (), metadata); + } catch (OpenStackBaseException e) { + // Convert Keystone OpenStackResponseException to MsoOpenstackException + throw keystoneErrorToMsoException (e, "QueryTenantName"); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, "QueryTenantName"); + } + } + + /** + * Delete the specified Tenant (by ID) in the given cloud. This method returns true or + * false, depending on whether the tenant existed and was successfully deleted, or if + * the tenant already did not exist. Both cases are treated as success (no Exceptions). + *

+ * Note for the AIC Cloud (DCP/LCP): all admin requests go to the centralized identity + * service in DCP. So deleting a tenant from one cloudSiteId will remove it from all + * sites managed by that identity service. + *

+ * + * @param tenantId The Openstack ID of the tenant to delete + * @param cloudSiteId The cloud identifier from which to delete the tenant. + * @return true if the tenant was deleted, false if the tenant did not exist. + * @throws MsoOpenstackException If the Openstack API call returns an exception. + */ + public boolean deleteTenant (String tenantId, String cloudSiteId) throws MsoException { + // Obtain the cloud site information where we will query the tenant + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite); + + try { + // Check that the tenant exists. Also, need the ID to delete + Tenant tenant = findTenantById (keystoneAdminClient, tenantId); + if (tenant == null) { + LOGGER.error(MessageEnum.RA_TENANT_NOT_FOUND, tenantId, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant not found"); + return false; + } + + OpenStackRequest request = keystoneAdminClient.tenants ().delete (tenant.getId ()); + executeAndRecordOpenstackRequest (request); + LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")"); + + // Clear any cached clients. Not really needed, ID will not be reused. + msoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId); + msoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId); + } catch (OpenStackBaseException e) { + // Convert Keystone OpenStackResponseException to MsoOpenstackException + throw keystoneErrorToMsoException (e, "Delete Tenant"); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, "DeleteTenant"); + } + + return true; + } + + /** + * Delete the specified Tenant (by Name) in the given cloud. This method returns true or + * false, depending on whether the tenant existed and was successfully deleted, or if + * the tenant already did not exist. Both cases are treated as success (no Exceptions). + *

+ * Note for the AIC Cloud (DCP/LCP): all admin requests go to the centralized identity + * service in DCP. So deleting a tenant from one cloudSiteId will remove it from all + * sites managed by that identity service. + *

+ * + * @param tenantName The name of the tenant to delete + * @param cloudSiteId The cloud identifier from which to delete the tenant. + * @return true if the tenant was deleted, false if the tenant did not exist. + * @throws MsoOpenstackException If the Openstack API call returns an exception. + */ + public boolean deleteTenantByName (String tenantName, String cloudSiteId) throws MsoException { + // Obtain the cloud site information where we will query the tenant + Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); + if (!cloudSite.isPresent()) { + throw new MsoCloudSiteNotFound (cloudSiteId); + } + Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite.get()); + + try { + // Need the Tenant ID to delete (can't directly delete by name) + Tenant tenant = findTenantByName (keystoneAdminClient, tenantName); + if (tenant == null) { + // OK if tenant already doesn't exist. + LOGGER.error(MessageEnum.RA_TENANT_NOT_FOUND, tenantName, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant not found"); + return false; + } + + // Execute the Delete. It has no return value. + OpenStackRequest request = keystoneAdminClient.tenants ().delete (tenant.getId ()); + executeAndRecordOpenstackRequest (request); + + LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")"); + + // Clear any cached clients. Not really needed, ID will not be reused. + msoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId); + msoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId); + } catch (OpenStackBaseException e) { + // Note: It doesn't seem to matter if tenant doesn't exist, no exception is thrown. + // Convert Keystone OpenStackResponseException to MsoOpenstackException + throw keystoneErrorToMsoException (e, "DeleteTenant"); + } catch (RuntimeException e) { + // Catch-all + throw runtimeExceptionToMsoException (e, "DeleteTenant"); + } + + return true; + } + + // ------------------------------------------------------------------- + // PRIVATE UTILITY FUNCTIONS FOR USE WITHIN THIS CLASS + + /* + * Get a Keystone Admin client for the Openstack Identity service. + * This requires an 'admin'-level userId + password along with an 'admin' tenant + * in the target cloud. These values will be retrieved from properties based + * on the specified cloud ID. + *

+ * On successful authentication, the Keystone object will be cached for the cloudId + * so that it can be reused without going back to Openstack every time. + * + * @param cloudId + * + * @return an authenticated Keystone object + */ + public Keystone getKeystoneAdminClient (CloudSite cloudSite) throws MsoException { + CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()); + + String cloudId = cloudIdentity.getId (); + String adminTenantName = cloudIdentity.getAdminTenant (); + String region = cloudSite.getRegionId (); + + // Check first in the cache of previously authorized clients + KeystoneCacheEntry entry = adminClientCache.get (cloudId); + if (entry != null) { + if (!entry.isExpired ()) { + return entry.getKeystoneClient (); + } else { + // Token is expired. Remove it from cache. + adminClientCache.remove (cloudId); + } + } + MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType()); + final String keystoneUrl = tenantUtils.getKeystoneUrl(region, cloudIdentity); + Keystone keystone = new Keystone(keystoneUrl); + + // Must authenticate against the 'admin' tenant to get the services endpoints + Access access = null; + String token = null; + try { + Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); + OpenStackRequest request = keystone.tokens () + .authenticate (credentials) + .withTenantName (adminTenantName); + access = executeAndRecordOpenstackRequest (request); + token = access.getToken ().getId (); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 401) { + // Authentication error. Can't access admin tenant - something is mis-configured + String error = "MSO Authentication Failed for " + cloudIdentity.getId (); + alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error); + } else { + throw keystoneErrorToMsoException (e, "TokenAuth"); + } + } catch (OpenStackConnectException e) { + // Connection to Openstack failed + throw keystoneErrorToMsoException (e, "TokenAuth"); + } + + // Get the Identity service URL. Throws runtime exception if not found per region. + String adminUrl = null; + try { + // TODO: FOR TESTING!!!! + adminUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "identity", region, "public"); + adminUrl = adminUrl.replaceFirst("5000", "35357"); + } catch (RuntimeException e) { + String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId (); + alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); + LOGGER.error(MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in findEndpointURL"); + throw new MsoAdapterException (error, e); + } + + // A new Keystone object is required for the new URL. Use the auth token from above. + // Note: this doesn't go back to Openstack, it's just a local object. + keystone = new Keystone (adminUrl); + keystone.token (token); + + // Cache to avoid re-authentication for every call. + KeystoneCacheEntry cacheEntry = new KeystoneCacheEntry (adminUrl, token, access.getToken ().getExpires ()); + adminClientCache.put (cloudId, cacheEntry); + + return keystone; + } + + /* + * Find a tenant (or query its existance) by its Name or Id. Check first against the + * ID. If that fails, then try by name. + * + * @param adminClient an authenticated Keystone object + * + * @param tenantName the tenant name or ID to query + * + * @return a Tenant object or null if not found + */ + public Tenant findTenantByNameOrId (Keystone adminClient, String tenantNameOrId) { + if (tenantNameOrId == null) { + return null; + } + + Tenant tenant = findTenantById (adminClient, tenantNameOrId); + if (tenant == null) { + tenant = findTenantByName (adminClient, tenantNameOrId); + } + + return tenant; + } + + /* + * Find a tenant (or query its existance) by its Id. + * + * @param adminClient an authenticated Keystone object + * + * @param tenantName the tenant ID to query + * + * @return a Tenant object or null if not found + */ + private Tenant findTenantById (Keystone adminClient, String tenantId) { + if (tenantId == null) { + return null; + } + + try { + OpenStackRequest request = adminClient.tenants ().show (tenantId); + return executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + return null; + } else { + LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET Tenant by Id (" + tenantId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET tenant by Id"); + throw e; + } + } + } + + /* + * Find a tenant (or query its existance) by its Name. This method avoids an + * initial lookup by ID when it's known that we have the tenant Name. + * + * @param adminClient an authenticated Keystone object + * + * @param tenantName the tenant name to query + * + * @return a Tenant object or null if not found + */ + public Tenant findTenantByName (Keystone adminClient, String tenantName) { + if (tenantName == null) { + return null; + } + + try { + OpenStackRequest request = adminClient.tenants ().show ("").queryParam ("name", tenantName); + return executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + return null; + } else { + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET Tenant By Name (" + tenantName + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET Tenant By Name"); + throw e; + } + } + } + + /* + * Look up an Openstack User by Name or Openstack ID. Check the ID first, and if that + * fails, try the Name. + * + * @param adminClient an authenticated Keystone object + * + * @param userName the user name or ID to query + * + * @return a User object or null if not found + */ + private User findUserByNameOrId (Keystone adminClient, String userNameOrId) { + if (userNameOrId == null) { + return null; + } + + try { + OpenStackRequest request = adminClient.users ().show (userNameOrId); + return executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + // Not found by ID. Search for name + return findUserByName (adminClient, userNameOrId); + } else { + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET User (" + userNameOrId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET User"); + throw e; + } + } + } + + /* + * Look up an Openstack User by Name. This avoids initial Openstack query by ID + * if we know we have the User Name. + * + * @param adminClient an authenticated Keystone object + * + * @param userName the user name to query + * + * @return a User object or null if not found + */ + public User findUserByName (Keystone adminClient, String userName) { + if (userName == null) { + return null; + } + + try { + OpenStackRequest request = adminClient.users ().show ("").queryParam ("name", userName); + return executeAndRecordOpenstackRequest (request); + } catch (OpenStackResponseException e) { + if (e.getStatus () == 404) { + return null; + } else { + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET User By Name (" + userName + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET User By Name"); + throw e; + } + } + } + + /* + * Look up an Openstack Role by Name or Id. There is no direct query for Roles, so + * need to retrieve a full list from Openstack and look for a match. By default, + * Openstack should have a "_member_" role for normal VM-level privileges and an + * "admin" role for expanded privileges (e.g. administer tenants, users, and roles). + *

+ * + * @param adminClient an authenticated Keystone object + * + * @param roleNameOrId the Role name or ID to look up + * + * @return a Role object + */ + private Role findRoleByNameOrId (Keystone adminClient, String roleNameOrId) { + if (roleNameOrId == null) { + return null; + } + + // Search by name or ID. Must search in list + OpenStackRequest request = adminClient.roles ().list (); + Roles roles = executeAndRecordOpenstackRequest (request); + + for (Role role : roles) { + if (roleNameOrId.equals (role.getName ()) || roleNameOrId.equals (role.getId ())) { + return role; + } + } + + return null; + } + + private static class KeystoneCacheEntry implements Serializable { + + private static final long serialVersionUID = 1L; + + private String keystoneUrl; + private String token; + private Calendar expires; + + public KeystoneCacheEntry (String url, String token, Calendar expires) { + this.keystoneUrl = url; + this.token = token; + this.expires = expires; + } + + public Keystone getKeystoneClient () { + Keystone keystone = new Keystone (keystoneUrl); + keystone.token (token); + return keystone; + } + + public boolean isExpired () { + // adding arbitrary guard timer of 5 minutes + return expires == null || System.currentTimeMillis() > (expires.getTimeInMillis() - 300000); + } + } + + @Override + public String getKeystoneUrl(String regionId, CloudIdentity cloudIdentity) throws MsoException { + return cloudIdentity.getIdentityUrl(); + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java new file mode 100644 index 0000000000..adeb008ad5 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java @@ -0,0 +1,550 @@ +/*- + * ============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.openstack.utils; + + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloud.authentication.AuthenticationMethodFactory; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoAlarmLogger; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.NetworkInfo; +import org.onap.so.openstack.beans.NeutronCacheEntry; +import org.onap.so.openstack.exceptions.MsoAdapterException; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.exceptions.MsoNetworkAlreadyExists; +import org.onap.so.openstack.exceptions.MsoNetworkNotFound; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.onap.so.openstack.exceptions.MsoTenantNotFound; +import org.onap.so.openstack.mappers.NetworkInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import com.woorea.openstack.base.client.OpenStackBaseException; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.keystone.Keystone; +import com.woorea.openstack.keystone.model.Access; +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.utils.KeystoneUtils; +import com.woorea.openstack.quantum.Quantum; +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Networks; +import com.woorea.openstack.quantum.model.Segment; + +@Component +public class MsoNeutronUtils extends MsoCommonUtils +{ + // Cache Neutron Clients statically. Since there is just one MSO user, there is no + // benefit to re-authentication on every request (or across different flows). The + // token will be used until it expires. + // + // The cache key is "tenantId:cloudId" + private static Map neutronClientCache = new HashMap<>(); + + // Fetch cloud configuration each time (may be cached in CloudConfig class) + @Autowired + private CloudConfig cloudConfig; + + @Autowired + private AuthenticationMethodFactory authenticationMethodFactory; + + @Autowired + private MsoTenantUtilsFactory tenantUtilsFactory; + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoNeutronUtils.class); + + public enum NetworkType { + BASIC, PROVIDER, MULTI_PROVIDER + }; + + /** + * Create a network with the specified parameters in the given cloud/tenant. + * + * If a network already exists with the same name, an exception will be thrown. Note that + * this is an MSO-imposed restriction. Openstack does not require uniqueness on network names. + *

+ * @param cloudSiteId The cloud identifier (may be a region) in which to create the network. + * @param tenantId The tenant in which to create the network + * @param type The type of network to create (Basic, Provider, Multi-Provider) + * @param networkName The network name to create + * @param provider The provider network name (for Provider or Multi-Provider networks) + * @param vlans A list of VLAN segments for the network (for Provider or Multi-Provider networks) + * @return a NetworkInfo object which describes the newly created network + * @throws MsoNetworkAlreadyExists Thrown if a network with the same name already exists + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + * @throws MsoCloudSiteNotFound Thrown if the cloudSite is invalid or unknown + */ + public NetworkInfo createNetwork (String cloudSiteId, String tenantId, NetworkType type, String networkName, String provider, List vlans) + throws MsoException + { + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + + Quantum neutronClient = getNeutronClient (cloudSite, tenantId); + + // Check if a network already exists with this name + // Openstack will allow duplicate name, so require explicit check + Network network = findNetworkByName (neutronClient, networkName); + + if (network != null) { + // Network already exists. Throw an exception + LOGGER.error(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network already exists"); + throw new MsoNetworkAlreadyExists (networkName, tenantId, cloudSiteId); + } + + // Does not exist, create a new one + network = new Network(); + network.setName(networkName); + network.setAdminStateUp(true); + + if (type == NetworkType.PROVIDER) { + if (provider != null && vlans != null && vlans.size() > 0) { + network.setProviderPhysicalNetwork (provider); + network.setProviderNetworkType("vlan"); + network.setProviderSegmentationId (vlans.get(0)); + } + } else if (type == NetworkType.MULTI_PROVIDER) { + if (provider != null && vlans != null && vlans.size() > 0) { + List segments = new ArrayList<>(vlans.size()); + for (int vlan : vlans) { + Segment segment = new Segment(); + segment.setProviderPhysicalNetwork (provider); + segment.setProviderNetworkType("vlan"); + segment.setProviderSegmentationId (vlan); + + segments.add(segment); + } + network.setSegments(segments); + } + } + + try { + OpenStackRequest request = neutronClient.networks().create(network); + Network newNetwork = executeAndRecordOpenstackRequest(request); + return new NetworkInfoMapper(newNetwork).map(); + } + catch (OpenStackBaseException e) { + // Convert Neutron exception to an MsoOpenstackException + MsoException me = neutronExceptionToMsoException (e, "CreateNetwork"); + throw me; + } + catch (RuntimeException e) { + // Catch-all + MsoException me = runtimeExceptionToMsoException(e, "CreateNetwork"); + throw me; + } + } + + + /** + * Query for a network with the specified name or ID in the given cloud. If the network exists, + * return an NetworkInfo object. If not, return null. + *

+ * Whenever possible, the network ID should be used as it is much more efficient. Query by + * name requires retrieval of all networks for the tenant and search for matching name. + *

+ * @param networkNameOrId The network to query + * @param tenantId The Openstack tenant to look in for the network + * @param cloudSiteId The cloud identifier (may be a region) in which to query the network. + * @return a NetworkInfo object describing the queried network, or null if not found + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + * @throws MsoCloudSiteNotFound + */ + public NetworkInfo queryNetwork(String networkNameOrId, String tenantId, String cloudSiteId) throws MsoException + { + LOGGER.debug("In queryNetwork"); + + // Obtain the cloud site information + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + + Quantum neutronClient = getNeutronClient (cloudSite, tenantId); + + // Check if the network exists and return its info + try { + Network network = findNetworkByNameOrId (neutronClient, networkNameOrId); + if (network == null) { + LOGGER.debug ("Query Network: " + networkNameOrId + " not found in tenant " + tenantId); + return null; + } + return new NetworkInfoMapper(network).map(); + } + catch (OpenStackBaseException e) { + // Convert Neutron exception to an MsoOpenstackException + MsoException me = neutronExceptionToMsoException (e, "QueryNetwork"); + throw me; + } + catch (RuntimeException e) { + // Catch-all + MsoException me = runtimeExceptionToMsoException(e, "QueryNetwork"); + throw me; + } + } + + /** + * Delete the specified Network (by ID) in the given cloud. + * If the network does not exist, success is returned. + *

+ * @param networkId Openstack ID of the network to delete + * @param tenantId The Openstack tenant. + * @param cloudSiteId The cloud identifier (may be a region) from which to delete the network. + * @return true if the network was deleted, false if the network did not exist + * @throws MsoOpenstackException If the Openstack API call returns an exception, this local + * exception will be thrown. + * @throws MsoCloudSiteNotFound + */ + public boolean deleteNetwork(String networkId, String tenantId, String cloudSiteId) throws MsoException + { + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + Quantum neutronClient = getNeutronClient (cloudSite, tenantId); + + try { + // Check that the network exists. + Network network = findNetworkById (neutronClient, networkId); + if (network == null) { + LOGGER.info(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", ""); + return false; + } + + OpenStackRequest request = neutronClient.networks().delete(network.getId()); + executeAndRecordOpenstackRequest(request); + + LOGGER.debug ("Deleted Network " + network.getId() + " (" + network.getName() + ")"); + } + catch (OpenStackBaseException e) { + // Convert Neutron exception to an MsoOpenstackException + MsoException me = neutronExceptionToMsoException (e, "Delete Network"); + throw me; + } + catch (RuntimeException e) { + // Catch-all + MsoException me = runtimeExceptionToMsoException(e, "DeleteNetwork"); + throw me; + } + + return true; + } + + + /** + * Update a network with the specified parameters in the given cloud/tenant. + * + * Specifically, this call is intended to update the VLAN segments on a + * multi-provider network. The provider segments will be replaced with the + * supplied list of VLANs. + *

+ * Note that updating the 'segments' array is not normally supported by Neutron. + * This method relies on a Platform Orchestration extension (using SDN controller + * to manage the virtual networking). + * + * @param cloudSiteId The cloud site ID (may be a region) in which to update the network. + * @param tenantId Openstack ID of the tenant in which to update the network + * @param networkId The unique Openstack ID of the network to be updated + * @param type The network type (Basic, Provider, Multi-Provider) + * @param provider The provider network name. This should not change. + * @param vlans The list of VLAN segments to replace + * @return a NetworkInfo object which describes the updated network + * @throws MsoNetworkNotFound Thrown if the requested network does not exist + * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception + * @throws MsoCloudSiteNotFound + */ + public NetworkInfo updateNetwork (String cloudSiteId, String tenantId, String networkId, NetworkType type, String provider, List vlans) + throws MsoException + { + // Obtain the cloud site information where we will create the stack + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + Quantum neutronClient = getNeutronClient (cloudSite, tenantId); + + // Check that the network exists + Network network = findNetworkById (neutronClient, networkId); + + if (network == null) { + // Network not found. Throw an exception + LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network not found"); + throw new MsoNetworkNotFound (networkId, tenantId, cloudSiteId); + } + + // Overwrite the properties to be updated + if (type == NetworkType.PROVIDER) { + if (provider != null && vlans != null && vlans.size() > 0) { + network.setProviderPhysicalNetwork (provider); + network.setProviderNetworkType("vlan"); + network.setProviderSegmentationId (vlans.get(0)); + } + } else if (type == NetworkType.MULTI_PROVIDER) { + if (provider != null && vlans != null && vlans.size() > 0) { + List segments = new ArrayList<>(vlans.size()); + for (int vlan : vlans) { + Segment segment = new Segment(); + segment.setProviderPhysicalNetwork (provider); + segment.setProviderNetworkType("vlan"); + segment.setProviderSegmentationId (vlan); + + segments.add(segment); + } + network.setSegments(segments); + } + } + + try { + OpenStackRequest request = neutronClient.networks().update(network); + Network newNetwork = executeAndRecordOpenstackRequest(request); + return new NetworkInfoMapper(newNetwork).map(); + } + catch (OpenStackBaseException e) { + // Convert Neutron exception to an MsoOpenstackException + MsoException me = neutronExceptionToMsoException (e, "UpdateNetwork"); + throw me; + } + catch (RuntimeException e) { + // Catch-all + MsoException me = runtimeExceptionToMsoException(e, "UpdateNetwork"); + throw me; + } + } + + + // ------------------------------------------------------------------- + // PRIVATE UTILITY FUNCTIONS FOR USE WITHIN THIS CLASS + + /** + * Get a Neutron (Quantum) client for the Openstack Network service. + * This requires a 'member'-level userId + password, which will be retrieved from + * properties based on the specified cloud Id. The tenant in which to operate + * must also be provided. + *

+ * On successful authentication, the Quantum object will be cached for the + * tenantID + cloudId so that it can be reused without reauthenticating with + * Openstack every time. + * + * @param cloudSite - a cloud site definition + * @param tenantId - Openstack tenant ID + * @return an authenticated Quantum object + */ + private Quantum getNeutronClient(CloudSite cloudSite, String tenantId) throws MsoException + { + String cloudId = cloudSite.getId(); + + // Check first in the cache of previously authorized clients + String cacheKey = cloudId + ":" + tenantId; + if (neutronClientCache.containsKey(cacheKey)) { + if (! neutronClientCache.get(cacheKey).isExpired()) { + LOGGER.debug ("Using Cached HEAT Client for " + cacheKey); + NeutronCacheEntry cacheEntry = neutronClientCache.get(cacheKey); + Quantum neutronClient = new Quantum(cacheEntry.getNeutronUrl()); + neutronClient.token(cacheEntry.getToken()); + return neutronClient; + } + else { + // Token is expired. Remove it from cache. + neutronClientCache.remove(cacheKey); + LOGGER.debug ("Expired Cached Neutron Client for " + cacheKey); + } + } + + // Obtain an MSO token for the tenant from the identity service + CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()); + MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType()); + final String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity); + Keystone keystoneTenantClient = new Keystone(keystoneUrl); + Access access = null; + try { + Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity); + OpenStackRequest request = keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId); + access = executeAndRecordOpenstackRequest(request); + } + catch (OpenStackResponseException e) { + if (e.getStatus() == 401) { + // Authentication error. + String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId(); + alarmLogger .sendAlarm("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException(error); + } + else { + MsoException me = keystoneErrorToMsoException(e, "TokenAuth"); + throw me; + } + } + catch (OpenStackConnectException e) { + // Connection to Openstack failed + MsoIOException me = new MsoIOException (e.getMessage(), e); + me.addContext("TokenAuth"); + throw me; + } + catch (RuntimeException e) { + // Catch-all + MsoException me = runtimeExceptionToMsoException(e, "TokenAuth"); + throw me; + } + + String region = cloudSite.getRegionId(); + String neutronUrl = null; + try { + neutronUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", region, "public"); + if (! neutronUrl.endsWith("/")) { + neutronUrl += "/v2.0/"; + } + } catch (RuntimeException e) { + // This comes back for not found (probably an incorrect region ID) + String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); + alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); + throw new MsoAdapterException (error, e); + } + + Quantum neutronClient = new Quantum(neutronUrl); + neutronClient.token(access.getToken().getId()); + + neutronClientCache.put(cacheKey, new NeutronCacheEntry(neutronUrl, access.getToken().getId(), access.getToken().getExpires())); + LOGGER.debug ("Caching Neutron Client for " + cacheKey); + + return neutronClient; + } + + /** + * Forcibly expire a Neutron client from the cache. This call is for use by + * the KeystoneClient in case where a tenant is deleted. In that case, + * all cached credentials must be purged so that fresh authentication is + * done on subsequent calls. + *

+ * @param tenantName + * @param cloudId + */ + public void expireNeutronClient (String tenantId, String cloudId) { + String cacheKey = cloudId + ":" + tenantId; + if (neutronClientCache.containsKey(cacheKey)) { + neutronClientCache.remove(cacheKey); + LOGGER.debug ("Deleted Cached Neutron Client for " + cacheKey); + } + } + + + /* + * Find a tenant (or query its existence) by its Name or Id. Check first against the + * ID. If that fails, then try by name. + * + * @param adminClient an authenticated Keystone object + * @param tenantName the tenant name or ID to query + * @return a Tenant object or null if not found + */ + public Network findNetworkByNameOrId (Quantum neutronClient, String networkNameOrId) + { + if (networkNameOrId == null) { + return null; + } + + Network network = findNetworkById(neutronClient, networkNameOrId); + + if (network == null) { + network = findNetworkByName(neutronClient, networkNameOrId); + } + + return network; + } + + /* + * Find a network (or query its existence) by its Id. + * + * @param neutronClient an authenticated Quantum object + * @param networkId the network ID to query + * @return a Network object or null if not found + */ + private Network findNetworkById (Quantum neutronClient, String networkId) + { + if (networkId == null) { + return null; + } + + try { + OpenStackRequest request = neutronClient.networks().show(networkId); + Network network = executeAndRecordOpenstackRequest(request); + return network; + } + catch (OpenStackResponseException e) { + if (e.getStatus() == 404) { + return null; + } else { + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error, GET Network By ID (" + networkId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack"); + throw e; + } + } + } + + /* + * Find a network (or query its existence) by its Name. This method avoids an + * initial lookup by ID when it's known that we have the network Name. + * + * Neutron does not support 'name=*' query parameter for Network query (show). + * The only way to query by name is to retrieve all networks and look for the + * match. While inefficient, this capability will be provided as it is needed + * by MSO, but should be avoided in favor of ID whenever possible. + * + * TODO: + * Network names are not required to be unique, though MSO will attempt to enforce + * uniqueness. This call probably needs to return an error (instead of returning + * the first match). + * + * @param neutronClient an authenticated Quantum object + * @param networkName the network name to query + * @return a Network object or null if not found + */ + public Network findNetworkByName (Quantum neutronClient, String networkName) + { + if (networkName == null) { + return null; + } + + try { + OpenStackRequest request = neutronClient.networks().list(); + Networks networks = executeAndRecordOpenstackRequest(request); + for (Network network : networks.getList()) { + if (network.getName().equals(networkName)) { + LOGGER.debug ("Found match on network name: " + networkName); + return network; + } + } + LOGGER.debug ("findNetworkByName - no match found for " + networkName); + return null; + } + catch (OpenStackResponseException e) { + if (e.getStatus() == 404) { + return null; + } else { + LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error, GET Network By Name (" + networkName + "): " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception in OpenStack"); + throw e; + } + } + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java new file mode 100644 index 0000000000..28911bc45c --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtils.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.openstack.utils; + + +import java.util.Map; + +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.MsoTenant; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public abstract class MsoTenantUtils extends MsoCommonUtils { + + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoTenantUtils.class); + + @Autowired + protected CloudConfig cloudConfig; + + public abstract String createTenant (String tenantName, String cloudSiteId, Map metadata, boolean backout) + throws MsoException; + + public abstract MsoTenant queryTenant (String tenantId, String cloudSiteId) + throws MsoException, MsoCloudSiteNotFound; + + public abstract MsoTenant queryTenantByName (String tenantName, String cloudSiteId) + throws MsoException, MsoCloudSiteNotFound; + + public abstract boolean deleteTenant (String tenantId, String cloudSiteId) + throws MsoException; + + public abstract String getKeystoneUrl (String regionId, CloudIdentity cloudIdentity) + throws MsoException; + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java new file mode 100644 index 0000000000..68d0ef2fad --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java @@ -0,0 +1,56 @@ +/*- + * ============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.openstack.utils; + +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloud.ServerType; +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class MsoTenantUtilsFactory { + + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, MsoTenantUtilsFactory.class); + @Autowired + protected CloudConfig cloudConfig; + @Autowired + protected MsoKeystoneUtils keystoneUtils; + + // based on Cloud IdentityServerType returns ORM or KEYSTONE Utils + public MsoTenantUtils getTenantUtils(String cloudSiteId) throws MsoCloudSiteNotFound { + CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + () -> new MsoCloudSiteNotFound(cloudSiteId)); + + return getTenantUtilsByServerType(cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getIdentityServerType()); + } + + public MsoTenantUtils getTenantUtilsByServerType(ServerType serverType) { + + MsoTenantUtils tenantU = null; + if (ServerType.KEYSTONE.equals(serverType)) { + tenantU = keystoneUtils; + } + return tenantU; + } +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java new file mode 100644 index 0000000000..649eb6b07c --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvt.java @@ -0,0 +1,163 @@ +/*- + * ============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.openstack.utils; + + + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.onap.so.db.catalog.beans.HeatTemplateParam; +import org.onap.so.logger.MsoLogger; +import org.yaml.snakeyaml.Yaml; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class MsoYamlEditorWithEnvt { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoYamlEditorWithEnvt.class); + + private Map yml; + private Yaml yaml = new Yaml (); + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + + public MsoYamlEditorWithEnvt() { + super(); + } + public MsoYamlEditorWithEnvt(byte[] b) { + init(b); + } + + @SuppressWarnings("unchecked") + private synchronized void init (byte[] body) { + InputStream input = new ByteArrayInputStream (body); + yml = (Map ) yaml.load (input); + } + + @SuppressWarnings("unchecked") + public synchronized Set getParameterListFromEnvt() { + // In an environment entry, the parameters section can only contain the name:value - + // not other attributes. + Set paramSet = new HashSet<>(); + Map resourceMap = null; + try { + resourceMap = (Map) yml.get("parameters"); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + return paramSet; + } + if (resourceMap == null) { + return paramSet; + } + + for (Entry stringObjectEntry : resourceMap.entrySet()) { + MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter(); + Entry pair = stringObjectEntry; + String value; + Object obj = pair.getValue(); + if (obj instanceof String) { + value = yaml.dump(obj); + // but this adds an extra '\n' at the end - which won't hurt - but we don't need it + value = value.substring(0, value.length() - 1); + } else if (obj instanceof LinkedHashMap) { + //Handle that it's json + try { + value = JSON_MAPPER.writeValueAsString(obj); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + value = "_BAD_JSON_MAPPING"; + } + } else { + //this handles integers/longs/floats/etc. + value = String.valueOf(obj); + } + hep.setName((String) pair.getKey()); + hep.setValue(value); + paramSet.add(hep); + } + return paramSet; + } + public synchronized Set getResourceListFromEnvt() { + try { + Set resourceList = new HashSet<>(); + @SuppressWarnings("unchecked") + Map resourceMap = (Map) yml.get("resource_registry"); + + for (Entry stringObjectEntry : resourceMap.entrySet()) { + MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource(); + Entry pair = stringObjectEntry; + her.setName((String) pair.getKey()); + her.setValue((String) pair.getValue()); + resourceList.add(her); + } + return resourceList; + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + return null; + } + public synchronized Set getParameterList () { + Set paramSet = new HashSet <> (); + @SuppressWarnings("unchecked") + Map resourceMap = (Map ) yml.get ("parameters"); + + for (Entry stringObjectEntry : resourceMap.entrySet()) { + HeatTemplateParam param = new HeatTemplateParam(); + Entry pair = stringObjectEntry; + @SuppressWarnings("unchecked") + Map resourceEntry = (Map) pair.getValue(); + String value = null; + try { + value = resourceEntry.get("default"); + } catch (ClassCastException cce) { + LOGGER.debug("Exception:", cce); + // This exception only - the value is an integer. For what we're doing + // here - we don't care - so set value to something - and it will + // get marked as not being required - which is correct. + //System.out.println("cce exception!"); + value = "300"; + // okay + } + param.setParamName((String) pair.getKey()); + if (value != null) { + param.setRequired(false); + } else { + param.setRequired(true); + } + value = resourceEntry.get("type"); + param.setParamType(value); + + paramSet.add(param); + + } + return paramSet; + + } + + +} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/CloudInfo.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/CloudInfo.java deleted file mode 100644 index 035524510e..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/CloudInfo.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -/** - * Cloud information structure for deploying/managing a VDU. Includes the cloud site - * as well as tenant information within the site. Currently this is defined as a - * cloud site ID. which would map to a CloudConfig entry. - * Perhaps the CloudConfig entry itself should be provided, instead of requiring each - * plug-in to query it. - * - * The meaning of 'tenant' may differ by cloud provider, but every cloud supports some - * sort of tenant partitioning. - * - */ -public class CloudInfo { - - private String cloudSiteId; - private String tenantId; - private String tenantName;//bpmn query and pass - - public CloudInfo() { - } - - public CloudInfo (String cloudSiteId, String tenantId, String tenantName) { - this.cloudSiteId = cloudSiteId; - this.tenantId = tenantId; - this.tenantName = tenantName; - } - - public String getCloudSiteId() { - return cloudSiteId; - } - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getTenantName() { - return tenantName; - } - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - - -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/PluginAction.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/PluginAction.java deleted file mode 100644 index 1f3cf2f113..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/PluginAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -/** - * Java beam representing a detailed action performed within a plugin during VDU - * orchestration. This allows the plugin to convey more detailed information about - * recent activities it has performed. It is primarily intended for logging and - * troubleshooting, so plugins are free to populate this as desired. - */ -public class PluginAction { - - private String action; - private String status; - private String rawMessage; - - public PluginAction () { - } - - public PluginAction (String action, String status, String rawMessage) { - this.action = action; - this.status = status; - this.rawMessage = rawMessage; - } - - public String getAction() { - return action; - } - public void setAction(String action) { - this.action = action; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public String getRawMessage() { - return rawMessage; - } - public void setRawMessage(String rawMessage) { - this.rawMessage = rawMessage; - } - -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java deleted file mode 100644 index 7696f3bc24..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -import java.util.Arrays; -import java.util.Objects; - -public class VduArtifact { - - // Enumerate the types of artifacts permitted. This may need to be a variable string - // value if arbitrary (cloud-specific) artifacts may be attached to VDUs in ASDC. - public enum ArtifactType { - MAIN_TEMPLATE, NESTED_TEMPLATE, CONFIG_FILE, SCRIPT_FILE, TEXT_FILE, ENVIRONMENT - } - - private String name; - private byte[] content; - private ArtifactType type; - - // Default constructor - public VduArtifact() {} - - // Fully specified constructor - public VduArtifact (String name, byte[] content, ArtifactType type) { - this.name = name; - this.content = content; - this.type = type; - } - - public String getName() { - return name; - } - public void setName (String name) { - this.name = name; - } - public byte[] getContent() { - return content; - } - public void setContent(byte[] content) { - this.content = content; - } - public ArtifactType getType() { - return type; - } - public void setType(ArtifactType type) { - this.type = type; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - VduArtifact that = (VduArtifact) o; - return Objects.equals(name, that.name) && - Arrays.equals(content, that.content) && - type == that.type; - } -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduException.java deleted file mode 100644 index 3fd1d2ec8a..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduException.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.adapters.vdu; - -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -/** - * OpenStack exception. - */ -public class VduException extends MsoException -{ - - /** - * Serialization id. - */ - private static final long serialVersionUID = 3313636124141766495L; - - /** - * Constructor to create a new VduException instance - * @param detail error details - */ - public VduException (String detail) { - // Set the detailed error as the Exception 'message' - super(detail); - // TODO: Need a more generic category than OPENSTACK - super.category = MsoExceptionCategory.OPENSTACK; - } - - /** - * Constructor to create a new VduException instance - * @param detail error details - * @param e the cause - */ - public VduException (String detail, Exception e) { - // Set the detailed error as the Exception 'message' - super(detail, e); - // TODO: Need a more generic category than OPENSTACK - super.category = MsoExceptionCategory.OPENSTACK; - } - -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduInstance.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduInstance.java deleted file mode 100644 index 5a5a6ab3d2..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduInstance.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.adapters.vdu; - -import java.util.Map; -import java.util.HashMap; - -/* - * This Java bean class relays VDU status information in a cloud-agnostic format. - * - * This bean is returned by all implementors of the VduPlugin interface operations - * (instantiate, query, delete). - */ - -public class VduInstance { - // Set defaults for everything - protected String vduInstanceId; - protected String vduInstanceName; - protected VduStatus status; - protected Map outputs = new HashMap<>(); - protected Map inputs = new HashMap<>(); - - public String getVduInstanceId() { - return vduInstanceId; - } - - public void setVduInstanceId(String vduInstanceId) { - this.vduInstanceId = vduInstanceId; - } - - public String getVduInstanceName() { - return vduInstanceName; - } - - public void setVduInstanceName(String vduInstanceName) { - this.vduInstanceName = vduInstanceName; - } - - public VduStatus getStatus() { - return status; - } - - public void setStatus(VduStatus status) { - this.status = status; - } - - public Map getOutputs() { - return outputs; - } - - public void setOutputs(Map outputs) { - this.outputs = outputs; - } - - public Map getInputs() { - return inputs; - } - - public void setInputs(Map inputs) { - this.inputs = inputs; - } -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduModelInfo.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduModelInfo.java deleted file mode 100644 index 3cef29255f..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduModelInfo.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -import java.util.ArrayList; -import java.util.List; - -public class VduModelInfo { - private String modelCustomizationUUID; - private int timeoutMinutes; - private List artifacts = new ArrayList<>(); - - public String getModelCustomizationUUID() { - return modelCustomizationUUID; - } - public void setModelCustomizationUUID(String modelCustomizationUUID) { - this.modelCustomizationUUID = modelCustomizationUUID; - } - public int getTimeoutMinutes() { - return timeoutMinutes; - } - public void setTimeoutMinutes(int timeoutMinutes) { - this.timeoutMinutes = timeoutMinutes; - } - public List getArtifacts() { - return artifacts; - } - public void setArtifacts(List artifacts) { - this.artifacts = artifacts; - } - -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduPlugin.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduPlugin.java deleted file mode 100644 index 3484646387..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduPlugin.java +++ /dev/null @@ -1,186 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -/** - * This interface defines a common API for template-based cloud deployments. - * The methods here should be adaptable for Openstack (Heat), Cloudify (TOSCA), - * Aria (TOSCA), Multi-VIM (TBD), and others (e.g. Azure Resource Manager). - * - * The deployed instances are referred to here as Virtual Deployment Units (VDUs). - * The package of templates that define a give VDU is referred to as its blueprint. - * - * Template-based orchestrators all follow a similar template/blueprint model. - * - One main template that is the top level definition - * - Optional nested templates referenced/included by the main template - * - Optional files attached to the template package, typically containing - * configuration files, install scripts, orchestration scripts, etc. - * - * The main template also defines the required inputs for creating a new instance, - * and output values exposed by successfully deployed instances. Inputs and outputs - * may include simple or complex (JSON) data types. - * - * Each implementation of this interface is expected to understand the MSO CloudConfig - * to obtain the credentials for its sub-orchestrator and the targeted cloud. - * The sub-orchestrator may have different credentials from the cloud (e.g. an Aria - * instance in front of an Openstack cloud) or they may be the same (e.g. Heat) - */ -import java.util.Map; - -public interface VduPlugin { - - /** - * The instantiateVdu interface deploys a new VDU instance from a vdu model package. - * - * For some VIMs, this may be a single command (e.g. Heat -> create stack) or may - * require a series of API calls (e.g. Cloudify -> upload blueprint, create deployment, - * execute install workflow). These details are hidden within the plug-in implementation. - * The instantiation should be fully completed before returning. On failures, this - * method is expected to back out the attempt, leaving the cloud in its previous state. - * - * It is expected that parameters have been validated and contain at minimum the - * required parameters for the given template with no extra parameters. - * - * The VDU name supplied by the caller will be globally unique, and identify the artifact - * in A&AI. Inventory is managed by the higher levels invoking this function. - * - * @param cloudInfo The target cloud + tenant identifiers for the VDU. - * @param instanceName A unique name for the VDU instance to update. - * @param inputs A map of key/value inputs. Values may be strings, numbers, or JSON objects. - * Will completely replace any inputs provided on the original instantiation. - * @param vduModel Object containing the collection of templates and files that comprise - * the blueprint for this VDU. - * @param rollbackOnFailure Flag to preserve or roll back the update on Failure. Should normally - * be True except in troubleshooting/debug cases. Might not be supported in all plug-ins. - * - * @return A VduInstance object - * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs. - * Various subclasses of VduException may be thrown. - */ - public VduInstance instantiateVdu ( - CloudInfo cloudInfo, - String instanceName, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException; - - /** - * Query a deployed VDU instance. This call will return a VduInstance object, or null - * if the deployment does not exist. - * - * Some VIM orchestrators identify deployment instances by string UUIDs, and others - * by integers. In the latter case, the ID will be passed in as a numeric string. - * - * The returned VduInstance object contains the input and output parameter maps, - * as well as other properties of the deployment (name, status, last action, etc.). - * - * @param cloudInfo The target cloud + tenant identifiers for the VDU. - * @param vduInstanceId The ID of the deployment to query - * - * @return A VduInstance object - * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs. - * Various subclasses of VduException may be thrown. - */ - public VduInstance queryVdu ( - CloudInfo cloudInfo, - String vduInstanceId) - throws VduException; - - - /** - * Delete a VDU instance by ID. If the VIM sub-orchestrator supports pre-installation - * of blueprints/models, the blueprint itself may remain installed. This is recommended, - * since other VDU instances may be using it. - * - * Some VIM orchestrators identify deployment instances by string UUIDs, and others - * by integers. In the latter case, the ID will be passed in as a numeric string. - * - * For some VIMs, deletion may be a single command (e.g. Heat -> delete stack) or a - * series of API calls (e.g. Cloudify -> execute uninstall workflow, delete deployment). - * These details are hidden within the plug-in implementation. The deletion should be - * fully completed before returning. - * - * The successful return is a VduInstance object which contains the state of the VDU - * just prior to deletion, with a status of DELETED. If the deployment was not found, - * the VduInstance object should be empty (with a status of NOTFOUND). - * There is no rollback from a successful deletion. - * - * A deletion failure will result in an undefined deployment state - the components may - * or may not have been all or partially uninstalled, so the resulting deployment must - * be considered invalid. - * - * @param cloudInfo The target cloud + tenant identifiers for the VDU. - * @param instanceId The unique id of the deployment to delete. - * @param timeoutMinutes Timeout after which the delete action will be cancelled. - * Consider sending the entire model here, if it may be of use to the plug-in? - * - * @return A VduInstance object, representing its state just prior to deletion. - * - * @throws VduException Thrown if the API calls fail or if a timeout occurs. - * Various subclasses of VduException may be thrown. - */ - public VduInstance deleteVdu ( - CloudInfo cloudInfo, - String instanceId, - int timeoutMinutes) - throws VduException; - - - /** - * The updateVdu interface attempts to update a VDU in-place, using either new inputs or - * a new model definition (i.e. updated templates/blueprints). This depends on the - * capabilities of the targeted sub-orchestrator, as not all implementations are expected - * to support this ability. It is primary included initially only for Heat. - * - * It is expected that parameters have been validated and contain at minimum the required - * parameters for the given template with no extra parameters. The VDU instance name cannot - * be updated. - * - * The update should be fully completed before returning. The successful return is a - * VduInstance object containing the updated VDU state. - * - * An update failure will result in an undefined deployment state - the components may - * or may not have been all or partially modified, deleted, recreated, etc. So the resulting - * VDU must be considered invalid. - * - * @param cloudInfo The target cloud + tenant identifiers for the VDU. - * @param instanceId The unique ID for the VDU instance to update. - * @param inputs A map of key/value inputs. Values may be strings, numbers, or JSON objects. - * Will completely replace any inputs provided on the original instantiation. - * @param vduModel Object containing the collection of templates and files that comprise - * the blueprint for this VDU. - * @param rollbackOnFailure Flag to preserve or roll back the update on Failure. Should normally - * be True except in troubleshooting/debug cases. Might not be supported in all plug-ins. - * - * @return A VduInfo object - * @throws VduException Thrown if the sub-orchestrator API calls fail or if a timeout occurs. - * Various subclasses of VduException may be thrown. - */ - public VduInstance updateVdu ( - CloudInfo cloudInfo, - String instanceId, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException; - -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStateType.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStateType.java deleted file mode 100644 index 92f5cdab3f..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStateType.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * OPENECOMP - 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========================================================= - */ - -package org.openecomp.mso.adapters.vdu; - - -/* - * Enum status values to capture the state of a generic (cloud-agnostic) VDU. - */ -public enum VduStateType { - NOTFOUND, - INSTANTIATING, - INSTANTIATED, - DELETING, - DELETED, // Note - only returned in success response to deleteVdu call. - UPDATING, - FAILED, - UNKNOWN -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStatus.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStatus.java deleted file mode 100644 index 4d9702f726..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduStatus.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -public class VduStatus { - - private VduStateType state; - private String errorMessage; - private PluginAction lastAction; - - public VduStatus(){} - public VduStatus( VduStateType state) { - this.state = state; - } - public VduStateType getState() { - return state; - } - public void setState(VduStateType state) { - this.state = state; - } - public String getErrorMessage() { - return errorMessage; - } - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - public PluginAction getLastAction() { - return lastAction; - } - public void setLastAction(PluginAction lastAction) { - this.lastAction = lastAction; - } - public void setLastAction (String action, String status, String rawCloudMessage) { - lastAction = new PluginAction(); - lastAction.setAction (action); - lastAction.setStatus (status); - lastAction.setRawMessage(rawCloudMessage); - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/AriaVduPlugin.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/AriaVduPlugin.java deleted file mode 100644 index 1c2057df4d..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/AriaVduPlugin.java +++ /dev/null @@ -1,340 +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.openecomp.mso.aria; - -import com.gigaspaces.aria.rest.client.AriaClient; -import com.gigaspaces.aria.rest.client.AriaClientFactory; -import com.gigaspaces.aria.rest.client.ExecutionDetails; -import com.gigaspaces.aria.rest.client.Input; -import com.gigaspaces.aria.rest.client.InputImpl; -import com.gigaspaces.aria.rest.client.Output; -import com.gigaspaces.aria.rest.client.Service; -import com.gigaspaces.aria.rest.client.ServiceTemplate; -import com.gigaspaces.aria.rest.client.ServiceTemplateImpl; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.openecomp.mso.adapters.vdu.CloudInfo; -import org.openecomp.mso.adapters.vdu.VduException; -import org.openecomp.mso.adapters.vdu.VduInstance; -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.adapters.vdu.VduPlugin; -import org.openecomp.mso.adapters.vdu.VduStateType; -import org.openecomp.mso.adapters.vdu.VduStatus; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * ARIA VDU Plugin. Pluggable interface for the ARIA REST API to support TOSCA orchestration. - * - * @author DeWayne - */ -public class AriaVduPlugin implements VduPlugin { - private static final String API_VERSION = "0.1"; - private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private AriaClient client = null; - private Map templateIds = new HashMap<>(); - private Map serviceIds = new HashMap<>(); - private Map> inputsCache = new HashMap<>(); - - public AriaVduPlugin() { - super(); - } - - public AriaVduPlugin(String host, int port) { - try { - client = new AriaClientFactory().createRestClient("http", host, port, API_VERSION); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - "aria", - MsoLogger.ErrorCode.AvailabilityError, - "Connection to ARIA REST API failed", - e); - throw e; - } - } - - /** - * Instantiate VDU in ARIA. instanceName is used for both service template name and - * service name. - */ - @SuppressWarnings("unchecked") - @Override - public VduInstance instantiateVdu( - CloudInfo cloudInfo, - String instanceName, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException { - - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - // Currently only support simple CSAR with single main template - byte[] csar = new CSAR(vduModel).create(); - - ServiceTemplate template = new ServiceTemplateImpl(instanceName, csar); - try { - client.install_service_template(template); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceName, - MsoLogger.ErrorCode.BusinessProcesssError, - "instantiate vdu via csar failed", - e); - throw new VduException(e.getMessage()); - } - - /** Create a service */ - try { - int templateId = -1; - for (ServiceTemplate stemplate : - (List) client.list_service_templates()) { - if (stemplate.getName().equals(instanceName)) { - templateId = stemplate.getId(); - } - } - List sinputs = new ArrayList<>(); - for (Map.Entry entry : inputs.entrySet()) { - Input inp = new InputImpl(entry.getKey(), entry.getValue().toString(), ""); - sinputs.add(inp); - } - client.create_service(templateId, instanceName, sinputs); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceName, - MsoLogger.ErrorCode.BusinessProcesssError, - "aria service creation failed", - e); - throw new VduException(e.getMessage()); - } - - // Get the service ID and cache it - int sid = getServiceId(instanceName); - serviceIds.put(instanceName, sid); - - /** Run install */ - try { - client.start_execution(sid, "install", new ExecutionDetails()); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceName, - MsoLogger.ErrorCode.BusinessProcesssError, - "aria install workflow failed", - e); - throw new VduException(e.getMessage()); - } - - /** Get the outputs and return */ - try { - Map voutputs = getOutputs(sid); - - VduInstance vi = new VduInstance(); - vi.setVduInstanceName(instanceName); - vi.setInputs((Map) inputs); - inputsCache.put(instanceName, vi.getInputs()); - vi.setOutputs(voutputs); - vi.setStatus(new VduStatus(VduStateType.INSTANTIATED)); - return vi; - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceName, - MsoLogger.ErrorCode.BusinessProcesssError, - "aria service output fetch failed", - e); - throw new VduException(e.getMessage()); - } - } - - /** - * Queries ARIA for VDU status. instanceId used as template and service name in ARIA (by - * convention). - */ - @Override - public VduInstance queryVdu(CloudInfo cloudInfo, String instanceId) throws VduException { - if (client == null) { - throw new VduException("Internal error: no ARIA connection found"); - } - - VduInstance vif = new VduInstance(); - vif.setVduInstanceId(instanceId); - Integer sid = serviceIds.get(instanceId); - if (sid == null) { - // service doesn't exist - vif.setStatus(new VduStatus(VduStateType.NOTFOUND)); - return vif; - } - Service service = client.get_service(sid); - if (service == null) { - throw new VduException( - String.format("Internal error: cached service id %s not found in ARIA", sid)); - } - Map voutputs = getOutputs(sid); - vif.setOutputs(voutputs); - vif.setInputs(inputsCache.get(instanceId)); - vif.setStatus(new VduStatus(VduStateType.INSTANTIATED)); - return vif; - } - - @Override - public VduInstance deleteVdu(CloudInfo cloudInfo, String instanceId, int timeoutMinutes) - throws VduException { - VduInstance vif = new VduInstance(); - vif.setVduInstanceId(instanceId); - - if (client == null) { - throw new VduException("Internal error: no ARIA connection found"); - } - Integer sid = serviceIds.get(instanceId); - if (sid == null) { - // service doesn't exist - vif.setStatus(new VduStatus(VduStateType.NOTFOUND)); - return vif; - } - - /** Run uninstall */ - try { - client.start_execution(sid, "uninstall", new ExecutionDetails()); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceId, - MsoLogger.ErrorCode.BusinessProcesssError, - "aria uninstall workflow failed", - e); - throw new VduException(e.getMessage()); - } - - /** Delete the service */ - try { - client.delete_service(sid); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceId, - MsoLogger.ErrorCode.BusinessProcesssError, - String.format("aria service delete failed. Service id: %d", sid), - e); - throw new VduException(e.getMessage()); - } - - /** Delete the blueprint */ - try { - client.delete_service_template(templateIds.get(instanceId)); - } catch (Exception e) { - logger.error( - MessageEnum.RA_CREATE_VNF_ERR, - "", - "", - "", - "", - instanceId, - MsoLogger.ErrorCode.BusinessProcesssError, - "aria template delete failed", - e); - throw new VduException(e.getMessage()); - } - - vif.setStatus(new VduStatus(VduStateType.DELETED)); - return vif; - } - - /** Deployment update not possible with ARIA */ - @Override - public VduInstance updateVdu( - CloudInfo cloudInfo, - String instanceId, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException { - throw new VduException("NOT IMPLEMENTED"); - } - - /** Private */ - - /** - * p Gets and repacks service outputs for internal use - * - * @param sid the service id (ARIA service id) - * @return - */ - private Map getOutputs(int sid) { - @SuppressWarnings("unchecked") - List outputs = (List) client.list_service_outputs(sid); - Map voutputs = new HashMap<>(); - for (Output output : outputs) { - voutputs.put(output.getName(), output.getValue()); - } - return voutputs; - } - - @SuppressWarnings("unchecked") - private int getServiceId(String service_name) throws VduException { - int sid = -1; - List services = (List) client.list_services(); - for (Service service : services) { - if (service.getName().equals(service_name)) { - sid = service.getId(); - } - } - if (sid == -1) { - throw new VduException( - String.format( - "Internal error: just created service not found: %s", service_name)); - } - return sid; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/CSAR.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/CSAR.java deleted file mode 100644 index bb1201fba3..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/aria/CSAR.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * ============LICENSE_START=================================================== - * Copyright (c) 2017 Cloudify.co. 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.aria; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintStream; -import java.util.Map; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.adapters.vdu.VduArtifact; -import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; - -import com.google.common.io.Files; - -/** - * The purpose of this class is to create a CSAR byte array from Vdu inputs for the purpose - * of forwarding to a TOSCA orchestrator. - * - * @author DeWayne - * - */ -public class CSAR { - private static final String MANIFEST_FILENAME = "MANIFEST.MF"; - private VduModelInfo vduModel; - - public CSAR(VduModelInfo model){ - this.vduModel = model; - } - - /** - * Creates a byte array representation of a CSAR corresponding to the VduBlueprint arg in the - * constructor. - * - * @return - */ - public byte[] create() { - File dir = Files.createTempDir(); - - /** - * Create subdir - */ - File metadir = new File(dir.getAbsolutePath() + "/" + "TOSCA-Metadata"); - if (!metadir.mkdir()) { - throw new RuntimeException("CSAR TOSCA-Metadata directory create failed"); - } - - /** - * Organize model info for consumption - */ - VduArtifact mainTemplate = null; - List extraFiles = null; - for(VduArtifact artifact: vduModel.getArtifacts()){ - if( artifact.getType() == ArtifactType.MAIN_TEMPLATE ){ - mainTemplate = artifact; - } - else{ - extraFiles.add(artifact); - } - } - - /** - * Write template files - */ - OutputStream ofs = null; - try { - ofs = new FileOutputStream(new File(dir, mainTemplate.getName())); - ofs.write(mainTemplate.getContent()); - ofs.close(); - - /** - * Write other files - */ - if (extraFiles != null) { - for (VduArtifact artifact: extraFiles){ - ofs = new FileOutputStream(new File(dir, artifact.getName())); - ofs.write(artifact.getContent()); - ofs.close(); - } - } - - - /** - * Create manifest - */ - PrintStream mfstream = new PrintStream(new File(metadir.getAbsolutePath() + "/" + MANIFEST_FILENAME)); - mfstream.println("TOSCA-Meta-File-Version: 1.0"); - mfstream.println("CSAR-Version: 1.1"); - mfstream.println("Created-by: ONAP"); - mfstream.println("Entry-Definitions: " + mainTemplate.getName()); - mfstream.close(); - - /** - * ZIP it up - */ - ByteArrayOutputStream zipbytes = new ByteArrayOutputStream(); - ZipOutputStream zos = new ZipOutputStream(zipbytes); - compressTree(zos, "", dir, dir); - zos.close(); - return zipbytes.toByteArray(); - - } catch (Exception e) { - throw new RuntimeException("Failed to create CSAR: " + e.getMessage()); - } finally { - - /** - * Clean up tmpdir - */ - deleteDirectory(dir); - } - } - - /** - * Private methods - */ - - /** - * Compresses (ZIPs) a directory tree - * - * @param dir - * @throws IOException - */ - private void compressTree(ZipOutputStream zos, String path, File basedir, File dir) throws IOException { - if (!dir.isDirectory()) - return; - - for (File f : dir.listFiles()) { - if (f.isDirectory()) { - String newpath = path + f.getName() + "/"; - ZipEntry entry = new ZipEntry(newpath); - zos.putNextEntry(entry); - zos.closeEntry(); - compressTree(zos, newpath, basedir, f); - } else { - ZipEntry ze = new ZipEntry( - f.getAbsolutePath().substring(basedir.getAbsolutePath().length() + 1).replaceAll("\\\\", "/")); - zos.putNextEntry(ze); - // read the file and write to ZipOutputStream - FileInputStream fis = new FileInputStream(f); - byte[] buffer = new byte[1024]; - int len; - while ((len = fis.read(buffer)) > 0) { - zos.write(buffer, 0, len); - } - zos.closeEntry(); - fis.close(); - } - } - } - - private boolean deleteDirectory(File directory) { - if (directory.exists()) { - File[] files = directory.listFiles(); - if (null != files) { - for (int i = 0; i < files.length; i++) { - if (files[i].isDirectory()) { - deleteDirectory(files[i]); - } else { - files[i].delete(); - } - } - } - } - return (directory.delete()); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java deleted file mode 100644 index 2c15391c81..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfig.java +++ /dev/null @@ -1,308 +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.openecomp.mso.cloud; - -import java.io.FileReader; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Optional; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * JavaBean JSON class for a CloudConfig. This bean maps a JSON-format cloud - * configuration file to Java. The CloudConfig contains information about - * Openstack cloud configurations. It includes: - * - CloudIdentity objects,representing DCP nodes (Openstack Identity Service) - * - CloudSite objects, representing LCP nodes (Openstack Compute & other services) - * - * Note that this is only used to access Cloud Configurations loaded from a JSON - * config file, so there are no explicit property setters. - * - * This class also contains methods to query cloud sites and/or identity - * services by ID. - * - */ - -@JsonRootName("cloud_config") -public class CloudConfig { - - private static final String CLOUD_SITE_VERSION = "2.5"; - private static final String DEFAULT_CLOUD_SITE_ID = "default"; - private boolean validCloudConfig = false; - private static ObjectMapper mapper = new ObjectMapper(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - protected String configFilePath; - protected int refreshTimerInMinutes; - @JsonProperty("identity_services") - private Map identityServices = new HashMap<>(); - @JsonProperty("cloud_sites") - private Map cloudSites = new HashMap (); - @JsonProperty("cloudify_managers") - private Map cloudifyManagers = new HashMap (); - - public CloudConfig() { - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); - } - - /** - * Get a map of all identity services that have been loaded. - */ - public synchronized Map getIdentityServices() { - return identityServices; - } - - /** - * Get a map of all cloud sites that have been loaded. - */ - public Map getCloudSites() { - return Collections.unmodifiableMap(cloudSites); - } - - /** - * Get a Map of all CloudifyManagers that have been loaded. - * @return the Map - */ - public synchronized Map getCloudifyManagers () { - return cloudifyManagers; - } - - /** - * Get a specific CloudSites, based on an ID. The ID is first checked - * against the regions, and if no match is found there, then against - * individual entries to try and find one with a CLLI that matches the ID - * and an AIC version of 2.5. - * - * @param id the ID to match - * @return an Optional of CloudSite object. - */ - public synchronized Optional getCloudSite(String id) { - if (id == null) { - return Optional.empty(); - } - if (cloudSites.containsKey(id)) { - return Optional.ofNullable(cloudSites.get(id)); - } - return null; - } - - private CloudSite getCloudSiteWithClli(String clli) { - Optional cloudSiteOptional = cloudSites.values().stream().filter(cs -> - cs.getClli() != null && clli.equals(cs.getClli()) && (CLOUD_SITE_VERSION.equals(cs.getAic_version()))) - .findAny(); - return cloudSiteOptional.orElse(getDefaultCloudSite(clli)); - } - - private CloudSite getDefaultCloudSite(String clli) { - Optional cloudSiteOpt = cloudSites.values().stream() - .filter(cs -> cs.getId().equalsIgnoreCase(DEFAULT_CLOUD_SITE_ID)).findAny(); - if (cloudSiteOpt.isPresent()) { - CloudSite defaultCloudSite = cloudSiteOpt.get(); - defaultCloudSite.setRegionId(clli); - defaultCloudSite.setId(clli); - return defaultCloudSite; - } else { - return null; - } - } - - /** - * Get a specific CloudIdentity, based on an ID. - * - * @param id - * the ID to match - * @return a CloudIdentity, or null of no match found - */ - public synchronized CloudIdentity getIdentityService(String id) { - if (identityServices.containsKey(id)) { - return identityServices.get(id); - } - return null; - } - - /** - * Get a specific CloudifyManager, based on an ID. - * @param id the ID to match - * @return a CloudifyManager, or null of no match found - */ - public synchronized CloudifyManager getCloudifyManager (String id) { - if (cloudifyManagers.containsKey (id)) { - return cloudifyManagers.get (id); - } - return null; - } - - protected synchronized void reloadPropertiesFile() throws IOException, MsoCloudIdentityNotFound { - this.loadCloudConfig(this.configFilePath, this.refreshTimerInMinutes); - } - - protected synchronized void loadCloudConfig(String configFile, int refreshTimer) - throws IOException, MsoCloudIdentityNotFound { - - FileReader reader = null; - configFilePath = configFile; - this.refreshTimerInMinutes = refreshTimer; - this.validCloudConfig=false; - - try { - reader = new FileReader(configFile); - // Parse the JSON input into a CloudConfig - - CloudConfig cloudConfig = mapper.readValue(reader, CloudConfig.class); - - this.cloudSites = cloudConfig.cloudSites; - this.identityServices = cloudConfig.identityServices; - this.cloudifyManagers = cloudConfig.cloudifyManagers; - - // Copy Cloud Identity IDs to CloudIdentity objects - for (Entry entry : cloudConfig.getIdentityServices().entrySet()) { - entry.getValue().setId(entry.getKey()); - } - - // Copy Cloduify IDs to CloudifyManager objects - for (Entry entry : cloudConfig.getCloudifyManagers ().entrySet ()) { - entry.getValue ().setId (entry.getKey ()); - } - - // Copy Cloud Site IDs to CloudSite objects, and set up internal - // pointers to their corresponding identity service. - for (Entry entry : cloudConfig.getCloudSites().entrySet()) { - CloudSite s = entry.getValue(); - s.setId(entry.getKey()); - CloudIdentity cloudIdentity = cloudConfig.getIdentityService(s.getIdentityServiceId()); - s.setIdentityService(cloudIdentity); - if (cloudIdentity == null) { - throw new MsoCloudIdentityNotFound(s.getId()+" Cloud site refers to a non-existing identity service: "+s.getIdentityServiceId()); - } - CloudifyManager cloudifyManager = cloudConfig.getCloudifyManager(s.getCloudifyId()); - s.setCloudifyManager(cloudifyManager); - } - this.validCloudConfig=true; - - } finally { - try { - if (reader != null) { - reader.close(); - } - } catch (IOException e) { - LOGGER.debug("Exception while closing reader for file:" + configFilePath, e); - } - } - } - - public String getConfigFilePath() { - return configFilePath; - } - - /** - * @return the validCouldConfig - */ - public synchronized boolean isValidCloudConfig() { - return validCloudConfig; - } - - @Override - public synchronized CloudConfig clone() { - CloudConfig ccCopy = new CloudConfig(); - for (Entry e : identityServices.entrySet()) { - - ccCopy.identityServices.put(e.getKey(), e.getValue().clone()); - } - - for (Entry e : cloudSites.entrySet()) { - - ccCopy.cloudSites.put(e.getKey(), e.getValue().clone()); - } - - for (Entry e:cloudifyManagers.entrySet()) { - - ccCopy.cloudifyManagers.put(e.getKey(), e.getValue().clone()); - } - - ccCopy.configFilePath = this.configFilePath; - ccCopy.refreshTimerInMinutes = this.refreshTimerInMinutes; - ccCopy.validCloudConfig = this.validCloudConfig; - return ccCopy; - } - - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((cloudSites == null) ? 0 : cloudSites.hashCode()); - result = prime * result + ((configFilePath == null) ? 0 : configFilePath.hashCode()); - result = prime * result + ((identityServices == null) ? 0 : identityServices.hashCode()); - result = prime * result + refreshTimerInMinutes; - result = prime * result + (validCloudConfig ? 1231 : 1237); - return result; - } - - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CloudConfig other = (CloudConfig) obj; - if (cloudSites == null) { - if (other.cloudSites != null) - return false; - } else if (!cloudSites.equals(other.cloudSites)) - return false; - if (configFilePath == null) { - if (other.configFilePath != null) - return false; - } else if (!configFilePath.equals(other.configFilePath)) - return false; - if (identityServices == null) { - if (other.identityServices != null) - return false; - } else if (!identityServices.equals(other.identityServices)) - return false; - if (refreshTimerInMinutes != other.refreshTimerInMinutes) - return false; - if (validCloudConfig != other.validCloudConfig) - return false; - return true; - } - - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java deleted file mode 100644 index 2b385910d9..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigFactory.java +++ /dev/null @@ -1,209 +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.openecomp.mso.cloud; - -import java.io.IOException; -import java.io.Serializable; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import javax.ejb.ConcurrencyManagement; -import javax.ejb.ConcurrencyManagementType; -import javax.ejb.LocalBean; -import javax.ejb.Schedule; -import javax.ejb.Singleton; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; -import org.openecomp.mso.openstack.utils.MsoHeatUtils; -import org.openecomp.mso.openstack.utils.MsoKeystoneUtils; -import org.openecomp.mso.openstack.utils.MsoNeutronUtils; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -/** - * This class returns a cloud Config instances - */ - -@Singleton(name = "CloudConfigFactory") -@ConcurrencyManagement(ConcurrencyManagementType.BEAN) -@LocalBean -@Path("/cloud") -public class CloudConfigFactory implements Serializable { - - private static final long serialVersionUID = 2956662716453261085L; - - private static CloudConfig cloudConfigCache = new CloudConfig(); - - protected static String prefixMsoPropertiesPath = System.getProperty ("mso.config.path"); - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - private static int refreshTimer; - - private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock (); - - static { - if (prefixMsoPropertiesPath == null) { - prefixMsoPropertiesPath = ""; - } - } - - public void initializeCloudConfig (String filePath, int refreshTimer) throws MsoCloudIdentityNotFound { - rwl.writeLock ().lock (); - try { - cloudConfigCache.loadCloudConfig (prefixMsoPropertiesPath + filePath, refreshTimer); - LOGGER.info (MessageEnum.RA_CONFIG_LOAD, prefixMsoPropertiesPath + filePath, "", ""); - } catch (JsonParseException e) { - LOGGER.error (MessageEnum.RA_CONFIG_EXC, "Error parsing cloud config file " + filePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonParseException", e); - } catch (JsonMappingException e) { - LOGGER.error (MessageEnum.RA_CONFIG_EXC, "Error parsing cloud config file " + filePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonMappingException", e); - } catch (IOException e) { - LOGGER.error (MessageEnum.RA_CONFIG_NOT_FOUND, filePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - config not found", e); - } finally { - rwl.writeLock ().unlock (); - } - } - - public CloudConfig getCloudConfig () { - rwl.readLock ().lock (); - try { - if (!cloudConfigCache.isValidCloudConfig()) { - // Not ideal, but better than returning an invalid object - throw new IllegalStateException("No valid CloudConfig is loaded"); - } - return cloudConfigCache.clone (); - } finally { - rwl.readLock ().unlock (); - } - } - - /** - * This method is not intended to be called, it's used to refresh the config - * automatically - */ - @Schedule(minute = "*/1", hour = "*", persistent = false) - public void reloadCloudConfig () { - - try { - if (!rwl.writeLock ().tryLock () && !rwl.writeLock ().tryLock (30L, TimeUnit.SECONDS)) { - LOGGER.debug ("Busy write lock on mso cloud config factory, skipping the reloading"); - return; - } - } catch (InterruptedException e1) { - LOGGER.debug ("Interrupted while trying to acquire write lock on cloud config factory, skipping the reloading"); - Thread.currentThread ().interrupt (); - return; - } - try { - //LOGGER.debug ("Processing a reload of the mso properties file entries"); - try { - - if (refreshTimer <= 1) { - CloudConfig oldCloudConfig = null; - if (cloudConfigCache.isValidCloudConfig()) { - oldCloudConfig = cloudConfigCache.clone(); - } - cloudConfigCache.reloadPropertiesFile (); - refreshTimer = cloudConfigCache.refreshTimerInMinutes; - if (!cloudConfigCache.equals(oldCloudConfig)) { - LOGGER.info (MessageEnum.RA_CONFIG_LOAD, prefixMsoPropertiesPath + cloudConfigCache.configFilePath, "", ""); - } - - } else { - --refreshTimer; - } - - } catch (JsonParseException e) { - LOGGER.error (MessageEnum.RA_CONFIG_EXC, - "Error parsing cloud config file " + cloudConfigCache.configFilePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonParseException", - e); - } catch (JsonMappingException e) { - LOGGER.error (MessageEnum.RA_CONFIG_EXC, - "Error parsing cloud config file " + cloudConfigCache.configFilePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - JsonMappingException", - e); - } catch (IOException e) { - LOGGER.error (MessageEnum.RA_CONFIG_NOT_FOUND, cloudConfigCache.configFilePath, "", "", MsoLogger.ErrorCode.DataError, "Exception - config not found", e); - } - } catch (Exception e) { - LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Global issue while reloading", "", "", MsoLogger.ErrorCode.DataError, "Exception - Global issue while reloading\"", e); - } finally { - rwl.writeLock ().unlock (); - } - } - - @GET - @Path("/showConfig") - @Produces("text/plain") - public Response showCloudConfig () { - CloudConfig cloudConfig = this.getCloudConfig(); - StringBuffer response = new StringBuffer(); - response.append("Cloud Sites:\n"); - for (CloudSite site : cloudConfig.getCloudSites().values()) { - response.append(site.toString()).append("\n"); - } - response.append("\n\nCloud Identity Services:\n"); - for (CloudIdentity identity : cloudConfig.getIdentityServices().values()) { - response.append(identity.toString()).append("\n"); - } - return Response.status(200).entity(response).build(); - } - - @GET - @Path("/resetClientCaches") - @Produces("text/plain") - public Response resetClientCaches () { - // Reset all cached clients/credentials - MsoKeystoneUtils.adminCacheReset (); - MsoHeatUtils.heatCacheReset (); - MsoNeutronUtils.neutronCacheReset (); - String response = "Client caches reset. All entries removed."; - return Response.status (200).entity (response).build (); - } - - @GET - @Path("/cleanupClientCaches") - @Produces("text/plain") - public Response cleanupClientCaches () { - // Reset all cached clients/credentials - MsoKeystoneUtils.adminCacheCleanup (); - MsoHeatUtils.heatCacheCleanup (); - MsoNeutronUtils.neutronCacheCleanup (); - String response = "Client caches cleaned up. All expired entries removed."; - return Response.status (200).entity (response).build (); - } - - @GET - @Path("/encryptPassword/{pwd}") - @Produces("text/plain") - public Response encryptPassword (@PathParam("pwd") String pwd) { - String encryptedPassword = CloudIdentity.encryptPassword (pwd); - - String response = "Encrypted Password = " + encryptedPassword; - return Response.status (200).entity (response).build (); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java deleted file mode 100644 index 9677d0ee1c..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudConfigIdentityMapper.java +++ /dev/null @@ -1,30 +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.openecomp.mso.cloud; - -/** - * This interface provides the method signature for mapping registration. - * All mappings should be registered by the implementing class. - */ -@FunctionalInterface -public interface CloudConfigIdentityMapper { - - public void registerAllMappings(); -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java deleted file mode 100644 index 07f0546256..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudIdentity.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud; - -import java.security.GeneralSecurityException; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import org.openecomp.mso.cloud.authentication.AuthenticationMethodFactory; -import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; -import org.openecomp.mso.cloud.authentication.wrappers.RackspaceAPIKeyWrapper; -import org.openecomp.mso.cloud.authentication.wrappers.UsernamePasswordWrapper; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoKeystoneUtils; -import org.openecomp.mso.openstack.utils.MsoTenantUtils; -import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory; -import org.openecomp.mso.utils.CryptoUtils; - -/** - * JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity - * service instance (i.e. a DCP node) in the NVP/AIC cloud. It will be loaded via - * CloudConfig object, of which it is a component (a CloudConfig JSON configuration - * file may contain multiple CloudIdentity definitions). - * - * Note that this is only used to access Cloud Configurations loaded from a - * JSON config file, so there are no explicit setters. - * - */ -public class CloudIdentity { - - // This block is needed to trigger the class loader so that static initialization - // of both inner static classes occur. This is required when the Json Deserializer - // gets called and no access to any of these inner classes happened yet. - static { - IdentityServerType.bootstrap(); - IdentityAuthenticationType.bootstrap(); - } - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - public final static class IdentityServerType extends IdentityServerTypeAbstract { - - public static final IdentityServerType KEYSTONE = new IdentityServerType("KEYSTONE", MsoKeystoneUtils.class); - - public IdentityServerType(String serverType, Class utilsClass) { - super(serverType, utilsClass); - } - - public static final void bootstrap() {} - } - - public static final class IdentityAuthenticationType extends IdentityAuthenticationTypeAbstract { - - public static final IdentityAuthenticationType USERNAME_PASSWORD = new IdentityAuthenticationType("USERNAME_PASSWORD", UsernamePasswordWrapper.class); - - public static final IdentityAuthenticationType RACKSPACE_APIKEY = new IdentityAuthenticationType("RACKSPACE_APIKEY", RackspaceAPIKeyWrapper.class); - - public IdentityAuthenticationType(String identityType, Class wrapperClass) { - super(identityType, wrapperClass); - } - - public static final void bootstrap() {} - } - - @JsonProperty - private String id; - @JsonProperty("identity_url") - private String identityUrl; - @JsonProperty("mso_id") - private String msoId; - @JsonProperty("mso_pass") - private String msoPass; - @JsonProperty("admin_tenant") - private String adminTenant; - @JsonProperty("member_role") - private String memberRole; - @JsonProperty("tenant_metadata") - private Boolean tenantMetadata; - @JsonProperty("identity_server_type") - @JsonSerialize(using=IdentityServerTypeJsonSerializer.class) - @JsonDeserialize(using=IdentityServerTypeJsonDeserializer.class) - private IdentityServerType identityServerType; - @JsonProperty("identity_authentication_type") - @JsonSerialize(using=IdentityAuthenticationTypeJsonSerializer.class) - @JsonDeserialize(using=IdentityAuthenticationTypeJsonDeserializer.class) - private IdentityAuthenticationType identityAuthenticationType; - - private static String cloudKey = "aa3871669d893c7fb8abbcda31b88b4f"; - - public CloudIdentity () { - } - - public String getId () { - return id; - } - - public void setId (String id) { - this.id = id; - } - - public String getKeystoneUrl (String regionId, String msoPropID) throws MsoException { - if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) { - return this.identityUrl; - } else { - if (this.identityServerType == null) { - return null; - } - MsoTenantUtils tenantUtils = new MsoTenantUtilsFactory(msoPropID).getTenantUtilsByServerType(this.identityServerType.toString()); - if (tenantUtils != null) { - return tenantUtils.getKeystoneUrl(regionId, msoPropID, this); - } else { - return null; - } - } - } - - public Authentication getAuthentication() { - if (this.getIdentityAuthenticationType() != null) { - return AuthenticationMethodFactory.getAuthenticationFor(this); - } else { - return new UsernamePassword(this.getMsoId(), this.getMsoPass()); - } - } - - public void setKeystoneUrl (String url) { - if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) { - this.identityUrl = url; - } - } - - public String getIdentityUrl() { - return this.identityUrl; - } - public void setIdentityUrl(String url) { - this.identityUrl = url; - } - - public String getMsoId () { - return msoId; - } - - public void setMsoId (String id) { - this.msoId = id; - } - - public String getMsoPass () { - try { - return CryptoUtils.decrypt (msoPass, cloudKey); - } catch (GeneralSecurityException e) { - LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in getMsoPass", e); - return null; - } - } - - public void setMsoPass (String pwd) { - this.msoPass = pwd; - } - - public String getAdminTenant () { - return adminTenant; - } - - public void setAdminTenant (String tenant) { - this.adminTenant = tenant; - } - - public String getMemberRole () { - return memberRole; - } - - public void setMemberRole (String role) { - this.memberRole = role; - } - - public boolean hasTenantMetadata () { - return tenantMetadata; - } - - public void setTenantMetadata (boolean meta) { - this.tenantMetadata = meta; - } - - public IdentityServerType getIdentityServerType() { - return this.identityServerType; - } - public void setIdentityServerType(IdentityServerType ist) { - this.identityServerType = ist; - } - public String getIdentityServerTypeAsString() { - return this.identityServerType.toString(); - } - /** - * @return the identityAuthenticationType - */ - public IdentityAuthenticationType getIdentityAuthenticationType() { - return identityAuthenticationType; - } - - /** - * @param identityAuthenticationType the identityAuthenticationType to set - */ - public void setIdentityAuthenticationType(IdentityAuthenticationType identityAuthenticationType) { - this.identityAuthenticationType = identityAuthenticationType; - } - - @Override - public String toString () { - return "Cloud Identity Service: id=" + id + - ", identityUrl=" + this.identityUrl + - ", msoId=" + msoId + - ", adminTenant=" + adminTenant + - ", memberRole=" + memberRole + - ", tenantMetadata=" + tenantMetadata + - ", identityServerType=" + (identityServerType == null ? "null" : identityServerType.toString()) + - ", identityAuthenticationType=" + (identityAuthenticationType == null ? "null" : identityAuthenticationType.toString()); - } - - public static String encryptPassword (String msoPass) { - try { - return CryptoUtils.encrypt (msoPass, cloudKey); - } catch (GeneralSecurityException e) { - LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in encryptPassword", e); - return null; - } - } - - - @Override - public CloudIdentity clone() { - CloudIdentity cloudIdentityCopy = new CloudIdentity(); - - cloudIdentityCopy.id = this.id; - cloudIdentityCopy.identityUrl = this.identityUrl; - cloudIdentityCopy.msoId = this.msoId; - cloudIdentityCopy.msoPass = this.msoPass; - cloudIdentityCopy.adminTenant = this.adminTenant; - cloudIdentityCopy.memberRole = this.memberRole; - cloudIdentityCopy.tenantMetadata = this.tenantMetadata; - cloudIdentityCopy.identityServerType = this.identityServerType; - cloudIdentityCopy.identityAuthenticationType = this.identityAuthenticationType; - - return cloudIdentityCopy; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((adminTenant == null) ? 0 : adminTenant.hashCode()); - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((identityUrl == null) ? 0 : identityUrl.hashCode()); - result = prime * result + ((memberRole == null) ? 0 : memberRole.hashCode()); - result = prime * result + ((msoId == null) ? 0 : msoId.hashCode()); - result = prime * result + ((msoPass == null) ? 0 : msoPass.hashCode()); - result = prime * result + ((tenantMetadata == null) ? 0 : tenantMetadata.hashCode()); - result = prime * result + ((identityServerType == null) ? 0 : identityServerType.hashCode()); - result = prime * result + ((identityAuthenticationType == null) ? 0 : identityAuthenticationType.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CloudIdentity other = (CloudIdentity) obj; - if (adminTenant == null) { - if (other.adminTenant != null) - return false; - } else if (!adminTenant.equals(other.adminTenant)) - return false; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - if (identityUrl == null) { - if (other.identityUrl != null) - return false; - } else if (!identityUrl.equals(other.identityUrl)) - return false; - if (memberRole == null) { - if (other.memberRole != null) - return false; - } else if (!memberRole.equals(other.memberRole)) - return false; - if (msoId == null) { - if (other.msoId != null) - return false; - } else if (!msoId.equals(other.msoId)) - return false; - if (msoPass == null) { - if (other.msoPass != null) - return false; - } else if (!msoPass.equals(other.msoPass)) - return false; - if (tenantMetadata == null) { - if (other.tenantMetadata != null) - return false; - } else if (!tenantMetadata.equals(other.tenantMetadata)) - return false; - if (identityServerType == null) { - if (other.getIdentityServerType() != null) - return false; - } else if (!identityServerType.equals(other.getIdentityServerType())) - return false; - if (identityAuthenticationType == null) { - if (other.getIdentityAuthenticationType() != null) - return false; - } else if (!identityAuthenticationType.equals(other.getIdentityAuthenticationType())) - return false; - - return true; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java deleted file mode 100644 index 1d013ebc60..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudSite.java +++ /dev/null @@ -1,208 +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.openecomp.mso.cloud; - - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * JavaBean JSON class for a CloudSite. This bean represents a cloud location - * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig - * object, of which it is a component (a CloudConfig JSON configuration file - * will contain multiple CloudSite definitions). - * - * Note that this is only used to access Cloud Configurations loaded from a - * JSON config file, so there are no explicit setters. - * - */ -public class CloudSite { - @JsonProperty - private String id; - @JsonProperty("region_id") - private String regionId; - @JsonProperty("identity_service_id") - private String identityServiceId; - @JsonProperty("aic_version") - private String aic_version; - @JsonProperty("clli") - private String clli; - @JsonProperty("cloudify_id") - private String cloudifyId; - @JsonProperty("platform") - private String platform; - @JsonProperty("orchestrator") - private String orchestrator; - - // Derived property (set by CloudConfig loader based on identityServiceId) - private CloudIdentity identityService; - // Derived property (set by CloudConfig loader based on cloudifyId) - private CloudifyManager cloudifyManager; - - public CloudSite() {} - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getRegionId() { - return regionId; - } - - public void setRegionId(String regionId) { - this.regionId = regionId; - } - - public String getIdentityServiceId() { - return identityServiceId; - } - - public CloudIdentity getIdentityService () { - return identityService; - } - - public void setIdentityService (CloudIdentity identity) { - this.identityService = identity; - } - - public String getAic_version() { - return aic_version; - } - - public void setAic_version(String aic_version) { - this.aic_version = aic_version; - } - - public String getClli() { - return clli; - } - - public void setClli(String clli) { - this.clli = clli; - } - - public String getCloudifyId() { - return cloudifyId; - } - - public void setCloudifyId (String id) { - this.cloudifyId = id; - } - - public CloudifyManager getCloudifyManager () { - return cloudifyManager; - } - - public void setCloudifyManager (CloudifyManager cloudify) { - this.cloudifyManager = cloudify; - } - - public String getPlatform() { - return platform; - } - - public void setPlatform(String platform) { - this.platform = platform; - } - - public String getOrchestrator() { - return orchestrator; - } - - public void setOrchestrator(String orchestrator) { - this.orchestrator = orchestrator; - } - - @Override - public String toString() { - return "CloudSite: id=" + id + - ", regionId=" + regionId + - ", identityServiceId=" + identityServiceId + - ", aic_version=" + aic_version + - ", clli=" + clli + - ", cloudifyId=" + cloudifyId + - ", platform=" + platform + - ", orchestrator=" + orchestrator; - } - - @Override - public CloudSite clone() { - CloudSite cloudSiteCopy = new CloudSite(); - cloudSiteCopy.id = this.id; - cloudSiteCopy.regionId = this.regionId; - cloudSiteCopy.identityServiceId = this.identityServiceId; - cloudSiteCopy.aic_version = this.aic_version; - cloudSiteCopy.clli = this.clli; - cloudSiteCopy.identityService = this.identityService.clone(); - cloudSiteCopy.cloudifyId = this.cloudifyId; - if (this.cloudifyManager != null) cloudSiteCopy.cloudifyManager = this.cloudifyManager.clone(); - cloudSiteCopy.platform = this.platform; - cloudSiteCopy.orchestrator = this.orchestrator; - - return cloudSiteCopy; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((identityService == null) ? 0 : identityService.hashCode()); - result = prime * result + ((identityServiceId == null) ? 0 : identityServiceId.hashCode()); - result = prime * result + ((regionId == null) ? 0 : regionId.hashCode()); - result = prime * result + ((aic_version == null) ? 0 : aic_version.hashCode()); - result = prime * result + ((clli == null) ? 0 : clli.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CloudSite other = (CloudSite) obj; - if (!cmp(id, other.id)) - return false; - if (!cmp(regionId, other.regionId)) - return false; - if (!cmp(identityServiceId, other.identityServiceId)) - return false; - if (!cmp(aic_version, other.aic_version)) - return false; - if (!cmp(clli, other.clli)) - return false; - if (!cmp(identityService, other.identityService)) - return false; - return true; - } - private boolean cmp(Object a, Object b) { - if (a == null) { - return (b == null); - } else { - return a.equals(b); - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudifyManager.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudifyManager.java deleted file mode 100644 index 98f2266216..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/CloudifyManager.java +++ /dev/null @@ -1,169 +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.openecomp.mso.cloud; - -import java.security.GeneralSecurityException; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.openecomp.mso.utils.CryptoUtils; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * JavaBean JSON class for a Cloudify Manager. This bean represents a Cloudify - * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the - * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints. - * Cloudify Managers may support multiple Cloud Sites, but each site will have - * at most one Cloudify Manager. - * - * This does not replace the ability to use the CloudSite directly via Openstack. - * - * Note that this is only used to access Cloud Configurations loaded from a - * JSON config file, so there are no explicit setters. - * - * @author JC1348 - */ -public class CloudifyManager { - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - @JsonProperty - private String id; - @JsonProperty ("cloudify_url") - private String cloudifyUrl; - @JsonProperty("username") - private String username; - @JsonProperty("password") - private String password; - @JsonProperty("version") - private String version; - - private static String cloudKey = "aa3871669d893c7fb8abbcda31b88b4f"; - - public CloudifyManager() {} - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - - public String getCloudifyUrl() { - return cloudifyUrl; - } - - public void setCloudifyUrl(String cloudifyUrl) { - this.cloudifyUrl = cloudifyUrl; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - try { - return CryptoUtils.decrypt (password, cloudKey); - } catch (GeneralSecurityException e) { - LOGGER.error (MessageEnum.RA_GENERAL_EXCEPTION, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in getMsoPass", e); - return null; - } - } - - public void setPassword(String password) { - this.password = password; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - - @Override - public String toString() { - return "CloudifyManager: id=" + id + - ", cloudifyUrl=" + cloudifyUrl + - ", username=" + username + - ", password=" + password + - ", version=" + version; - } - - @Override - public CloudifyManager clone() { - CloudifyManager cloudifyManagerCopy = new CloudifyManager(); - cloudifyManagerCopy.id = this.id; - cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl; - cloudifyManagerCopy.username = this.username; - cloudifyManagerCopy.password = this.password; - cloudifyManagerCopy.version = this.version; - return cloudifyManagerCopy; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((cloudifyUrl == null) ? 0 : cloudifyUrl.hashCode()); - result = prime * result + ((username == null) ? 0 : username.hashCode()); - result = prime * result + ((password == null) ? 0 : password.hashCode()); - result = prime * result + ((version == null) ? 0 : version.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CloudifyManager other = (CloudifyManager) obj; - if (!cmp(id, other.id)) - return false; - if (!cmp(cloudifyUrl, other.cloudifyUrl)) - return false; - if (!cmp(username, other.username)) - return false; - if (!cmp(version, other.version)) - return false; - if (!cmp(password, other.password)) - return false; - return true; - } - private boolean cmp(Object a, Object b) { - if (a == null) { - return (b == null); - } else { - return a.equals(b); - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java deleted file mode 100644 index 41f70e4492..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeAbstract.java +++ /dev/null @@ -1,86 +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.openecomp.mso.cloud; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; -import org.openecomp.mso.logger.MsoLogger; - -public abstract class IdentityAuthenticationTypeAbstract { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); - // This map will prevent duplicates (as if it was an Enum). - // Without this, using an instance specific field for the class could allow - // different classes bound to the same entry name. - private static final Map entries = new ConcurrentHashMap<>(); - - private String identityType; - - private Class wrapperClass; - - protected IdentityAuthenticationTypeAbstract(String identityType, Class wrapperClass) { - try { - this.identityType = identityType; - this.wrapperClass = wrapperClass; - entries.put(identityType, this); - AuthenticationWrapper.register(this.toString(), wrapperClass); - } catch (IllegalAccessException | InstantiationException e) { - LOGGER.debug("Exception in Identity Authentication",e); - } - } - - public static final IdentityAuthenticationTypeAbstract valueOf(String serverType) { - return entries.get(serverType); - } - - @Override - public final String toString() { - return this.identityType; - } - - public final String name() { - return this.identityType; - } - - public static final IdentityAuthenticationTypeAbstract[] values() { - return (IdentityAuthenticationTypeAbstract[]) entries.values().stream().toArray(IdentityAuthenticationTypeAbstract[]::new); - } - - public final Class getWrapperClass() { - return this.wrapperClass; - } - - @Override - public final boolean equals(Object other) { - return (this.identityType != null) && (other != null) && (other instanceof IdentityAuthenticationTypeAbstract) && (this.identityType.equals(other.toString())); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((identityType == null) ? 0 : identityType.hashCode()); - return result; - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java deleted file mode 100644 index 2b50c2690c..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonDeserializer.java +++ /dev/null @@ -1,42 +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.openecomp.mso.cloud; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; - -public class IdentityAuthenticationTypeJsonDeserializer extends JsonDeserializer { - - @Override - public IdentityAuthenticationTypeAbstract deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) - throws IOException, JsonProcessingException { - JsonToken token = jsonParser.getCurrentToken(); - if (JsonToken.VALUE_STRING.equals(token)) { - return IdentityAuthenticationTypeAbstract.valueOf(jsonParser.getText()); - } else { - return null; - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java deleted file mode 100644 index 065010035c..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityAuthenticationTypeJsonSerializer.java +++ /dev/null @@ -1,36 +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.openecomp.mso.cloud; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - - -public class IdentityAuthenticationTypeJsonSerializer extends JsonSerializer { - - @Override - public void serialize(IdentityAuthenticationTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) - throws IOException { - jsonGenerator.writeObject(tmpObj.toString()); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java deleted file mode 100644 index ad909a73c7..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeAbstract.java +++ /dev/null @@ -1,85 +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.openecomp.mso.cloud; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.openecomp.mso.openstack.utils.MsoTenantUtils; - - -public abstract class IdentityServerTypeAbstract { - - // This map will prevent duplicates (as if it was an Enum). - // Without this, using an instance specific field for the class could allow - // different classes bound to the same entry name. - private static final Map entries = new ConcurrentHashMap<>(); - - private String serverType; - - private Class utilsClass; - - protected IdentityServerTypeAbstract(String serverType, Class utilsClass) { - if ((serverType == null) || (serverType.isEmpty())) { - throw new IllegalArgumentException("Server Type name cannot be null or empty, provided value was " + serverType); - } - if (entries.containsKey(serverType)) { - throw new IllegalArgumentException("Duplicate Server Type entry for registration: " + serverType); - } - this.serverType = serverType; - this.utilsClass = utilsClass; - entries.put(serverType, this); - } - - public static final IdentityServerTypeAbstract valueOf(String serverType) { - return entries.get(serverType); - } - - @Override - public final String toString() { - return this.serverType; - } - - public final String name() { - return this.serverType; - } - - public static final IdentityServerTypeAbstract[] values() { - return (IdentityServerTypeAbstract[]) entries.values().stream().toArray(IdentityServerTypeAbstract[]::new); - } - - public final Class getMsoTenantUtilsClass() { - return this.utilsClass; - } - - @Override - public final boolean equals(Object other) { - return ((this.serverType != null) && (other != null) && (other instanceof IdentityServerTypeAbstract) && (this.serverType.equals(other.toString()))); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((serverType == null) ? 0 : serverType.hashCode()); - return result; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java deleted file mode 100644 index 093f7ff38b..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonDeserializer.java +++ /dev/null @@ -1,45 +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.openecomp.mso.cloud; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; - - -public class IdentityServerTypeJsonDeserializer extends JsonDeserializer { - - @Override - public IdentityServerTypeAbstract deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) - throws IOException, JsonProcessingException { - JsonToken token = jsonParser.getCurrentToken(); - if (JsonToken.VALUE_STRING.equals(token)) { - return IdentityServerTypeAbstract.valueOf(jsonParser.getText()); - } else { - return null; - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java deleted file mode 100644 index d2662a1622..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/IdentityServerTypeJsonSerializer.java +++ /dev/null @@ -1,37 +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.openecomp.mso.cloud; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; - - -public class IdentityServerTypeJsonSerializer extends JsonSerializer { - - @Override - public void serialize(IdentityServerTypeAbstract tmpObj, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) - throws IOException, JsonProcessingException { - jsonGenerator.writeObject(tmpObj.toString()); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java deleted file mode 100644 index c9be2c7949..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication; - -import com.woorea.openstack.keystone.model.Authentication; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import org.openecomp.mso.cloud.CloudIdentity; - -/** - * This factory manages all the wrappers associated to authentication types. - */ -public final class AuthenticationMethodFactory { - - private static Map authWrappers = new ConcurrentHashMap<>(); - - private AuthenticationMethodFactory() {} - - /** - * Function to be called by classes implementing the abstract {@link AuthenticationWrapper#register(String, Class)}. - */ - static final synchronized void register(String authenticationType, Class wrapperClass) throws InstantiationException, IllegalAccessException { - if ((authenticationType == null) || ("".equals(authenticationType))) { - throw new IllegalArgumentException("Authentication Type to register cannot be null or an empty name string, provided value is " + authenticationType + "."); - } - if (wrapperClass == null) { - throw new IllegalArgumentException("Wrapper Class to register for Authentication cannot be null"); - } - - if (!authWrappers.containsKey(authenticationType)) { - authWrappers.put(authenticationType, wrapperClass.newInstance()); - } - } - - public static final synchronized Authentication getAuthenticationFor(CloudIdentity cloudIdentity) { - if (cloudIdentity == null) { - throw new IllegalArgumentException("Cloud identity cannot be null"); - } - if ((cloudIdentity.getIdentityAuthenticationType() == null) || ("".equals(cloudIdentity.getIdentityAuthenticationType().toString()))) { - throw new IllegalArgumentException("Cloud identity authentication type cannot be null or empty, provided value is " + cloudIdentity.getIdentityAuthenticationType() + "."); - } - String authenticationType = cloudIdentity.getIdentityAuthenticationType().toString(); - - if (authWrappers.containsKey(authenticationType)) { - return authWrappers.get(authenticationType).getAuthentication(cloudIdentity); - } else { - throw new IllegalArgumentException("Provided authentication type (" + authenticationType + ") is not implemented by any wrapper."); - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java deleted file mode 100644 index 77f405a660..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/AuthenticationWrapper.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication; - -import org.openecomp.mso.cloud.CloudIdentity; - -import com.woorea.openstack.keystone.model.Authentication; - -/** - * This abstract class provides the necessary method for registering authentication - * types with wrapper classes, and also defines the contract for providing - * Openstack-compatible Authentication implementations for said authentication types. - * - */ -public abstract class AuthenticationWrapper { - - /** - * Registers the implementing class to the list of Authentication Wrappers. - * - * @param authenticationType The authentication type that is provided by the implementing class - * @param wrapperClass The implementing class Class object - * @throws InstantiationException If the provided implementing class cannot be instantiated - * @throws IllegalAccessException If the provided implementing class cannot be instantiated - */ - public static final void register(String authenticationType, Class wrapperClass) throws InstantiationException, IllegalAccessException { - AuthenticationMethodFactory.register(authenticationType, wrapperClass); - } - - /** - * Returns an OpenStack Authentication object for the provided CloudIdentity. - * - * @param cloudIdentity The input Cloud Identity instance - * @return the OpenStack Authentication associated with this cloud identity instance - */ - protected abstract Authentication getAuthentication(CloudIdentity cloudIdentity); - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java deleted file mode 100644 index 6c00349b85..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/models/RackspaceAuthentication.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication.models; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.woorea.openstack.keystone.model.Authentication; - -@JsonRootName("auth") -public class RackspaceAuthentication extends Authentication { - - private static final long serialVersionUID = 5451283386875662918L; - - public static final class Token { - - private String username; - private String apiKey; - - /** - * @return the username - */ - public String getUsername() { - return username; - } - /** - * @param username the username to set - */ - public void setUsername(String username) { - this.username = username; - } - /** - * @return the apiKey - */ - public String getApiKey() { - return apiKey; - } - /** - * @param apiKey the apiKey to set - */ - public void setApiKey(String apiKey) { - this.apiKey = apiKey; - } - } - - @JsonProperty("RAX-KSKEY:apiKeyCredentials") - private Token token = new Token(); - - public RackspaceAuthentication (String username, String apiKey) { - this.token.username = username; - this.token.apiKey = apiKey; - - } - - /** - * @return the token - */ - public Token getToken() { - return token; - } - - /** - * @param token the token to set - */ - public void setToken(Token token) { - this.token = token; - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java deleted file mode 100644 index e82306b6cd..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication.wrappers; - -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; -import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; - -import com.woorea.openstack.keystone.model.Authentication; - -/** - * This class implements the authentication wrapper for Rackspace Authentication. - * - */ -public class RackspaceAPIKeyWrapper extends AuthenticationWrapper { - - @Override - public Authentication getAuthentication(CloudIdentity cloudIdentity) { - if (cloudIdentity == null) { - throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password"); - } - return new RackspaceAuthentication (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ()); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java deleted file mode 100644 index a1beabe564..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication.wrappers; - -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.authentication.AuthenticationWrapper; - -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; - -/** - * This class implements the authentication wrapper for Openstack provided for - * user name and password authentication. - */ -public class UsernamePasswordWrapper extends AuthenticationWrapper { - - @Override - public Authentication getAuthentication(CloudIdentity cloudIdentity) { - if (cloudIdentity == null) { - throw new IllegalArgumentException("Provided cloud identity is null, cannot extract username and password"); - } - return new UsernamePassword (cloudIdentity.getMsoId (), cloudIdentity.getMsoPass ()); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentInfo.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentInfo.java deleted file mode 100644 index 9387e22f38..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentInfo.java +++ /dev/null @@ -1,186 +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.openecomp.mso.cloudify.beans; - -import java.util.Map; -import java.util.HashMap; - -import org.openecomp.mso.cloudify.v3.model.Deployment; -import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs; -import org.openecomp.mso.cloudify.v3.model.Execution; - -/* - * This Java bean class relays Heat stack status information to ActiveVOS processes. - * - * This bean is returned by all Heat-specific adapter operations (create, query, delete) - */ - -public class DeploymentInfo { - // Set defaults for everything - private String id = ""; - private DeploymentStatus status = DeploymentStatus.NOTFOUND; - private Map outputs = new HashMap(); - private Map inputs = new HashMap(); - private String lastAction; - private String actionStatus; - private String errorMessage; - - public DeploymentInfo () { - } - - public DeploymentInfo (String id, Map outputs) { - this.id = id; - if (outputs != null) this.outputs = outputs; - } - - public DeploymentInfo (String id) { - this.id = id; - } - - public DeploymentInfo (String id, DeploymentStatus status) { - this.id = id; - this.status = status; - } - - public DeploymentInfo (Deployment deployment) { - this(deployment, null, null); - } - - /** - * Construct a DeploymentInfo object from a deployment and the latest Execution action - * @param deployment - * @param execution - */ - public DeploymentInfo (Deployment deployment, DeploymentOutputs outputs, Execution execution) - { - if (deployment == null) { - this.id = null; - return; - } - - this.id = deployment.getId(); - - if (outputs != null) - this.outputs = outputs.getOutputs(); - - if (deployment.getInputs() != null) - this.inputs = deployment.getInputs(); - - if (execution != null) { - this.lastAction = execution.getWorkflowId(); - this.actionStatus = execution.getStatus(); - this.errorMessage = execution.getError(); - - // Compute the status based on the last workflow - if (lastAction.equals("install")) { - if (actionStatus.equals("terminated")) - this.status = DeploymentStatus.INSTALLED; - else if (actionStatus.equals("failed")) - this.status = DeploymentStatus.FAILED; - else if (actionStatus.equals("started") || actionStatus.equals("pending")) - this.status = DeploymentStatus.INSTALLING; - else - this.status = DeploymentStatus.UNKNOWN; - } - else if (lastAction.equals("uninstall")) { - if (actionStatus.equals("terminated")) - this.status = DeploymentStatus.CREATED; - else if (actionStatus.equals("failed")) - this.status = DeploymentStatus.FAILED; - else if (actionStatus.equals("started") || actionStatus.equals("pending")) - this.status = DeploymentStatus.UNINSTALLING; - else - this.status = DeploymentStatus.UNKNOWN; - } - else { - // Could have more cases in the future for different actions. - this.status = DeploymentStatus.UNKNOWN; - } - } - else { - this.status = DeploymentStatus.CREATED; - } - } - - public String getId() { - return id; - } - - public void setId (String id) { - this.id = id; - } - - public DeploymentStatus getStatus() { - return status; - } - - public void setStatus (DeploymentStatus status) { - this.status = status; - } - - public Map getOutputs () { - return outputs; - } - - public void setOutputs (Map outputs) { - this.outputs = outputs; - } - - public Map getInputs () { - return inputs; - } - - public void setInputs (Map inputs) { - this.inputs = inputs; - } - - public String getLastAction() { - return lastAction; - } - - public String getActionStatus() { - return actionStatus; - } - - public String getErrorMessage() { - return errorMessage; - } - - public void saveExecutionStatus (Execution execution) { - this.lastAction = execution.getWorkflowId(); - this.actionStatus = execution.getStatus(); - this.errorMessage = execution.getError(); - } - - @Override - public String toString() { - return "DeploymentInfo {" + - "id='" + id + '\'' + - ", inputs='" + inputs + '\'' + - ", outputs='" + outputs + '\'' + - ", lastAction='" + lastAction + '\'' + - ", status='" + status + '\'' + - ", errorMessage='" + errorMessage + '\'' + - '}'; - } - -} - diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentStatus.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentStatus.java deleted file mode 100644 index cef5e78c20..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/beans/DeploymentStatus.java +++ /dev/null @@ -1,31 +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.openecomp.mso.cloudify.beans; - - -/* - * Enum status values to capture the state of a deployment, based on last known workflow - * (assume only INSTALL and UNINSTALL at this point). - */ -public enum DeploymentStatus { - NOTFOUND, CREATED, INSTALLED, FAILED, INSTALLING, UNINSTALLING, UNKNOWN -} - diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoBlueprintAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoBlueprintAlreadyExists.java deleted file mode 100644 index 1bdd6f3850..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoBlueprintAlreadyExists.java +++ /dev/null @@ -1,33 +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.openecomp.mso.cloudify.exceptions; - -public class MsoBlueprintAlreadyExists extends MsoCloudifyException { - - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoCloudifyException instance - public MsoBlueprintAlreadyExists (String blueprintId, String cloud) { - // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Blueprint " + blueprintId + " already exists in Cloudify Manager supporting cloud site + " + cloud); - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyException.java deleted file mode 100644 index f2469f4706..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyException.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.openecomp.mso.cloudify.exceptions; - -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -/** - * OpenStack exception. - */ -public class MsoCloudifyException extends MsoException -{ - - /** - * Serialization id. - */ - private static final long serialVersionUID = 3313636124141766495L; - - private int statusCode; - private String statusMessage; - private String errorDetail; - private boolean pendingWorkflow; - - /** - * Constructor to create a new MsoOpenstackException instance - * @param code the error code - * @param message the error message - * @param detail error details - */ - public MsoCloudifyException (int code, String message, String detail) { - // Set the detailed error as the Exception 'message' - super(detail); - super.category = MsoExceptionCategory.OPENSTACK; - - this.statusCode = code; - this.statusMessage = message; - this.errorDetail = detail; - this.pendingWorkflow = false; - } - - /** - * Constructor to propagate the caught exception (mostly for stack trace) - * @param code the error code - * @param message the error message - * @param detail error details - * @param e the cause - */ - public MsoCloudifyException (int code, String message, String detail, Exception e) { - // Set the detailed error as the Exception 'message' - super(detail, e); - super.category = MsoExceptionCategory.OPENSTACK; - - this.statusCode = code; - this.statusMessage = message; - this.errorDetail = detail; - this.pendingWorkflow = false; - } - - public void setPendingWorkflow (boolean pendingWorkflow) { - this.pendingWorkflow = pendingWorkflow; - } - - @Override - public String toString () { - String error = "" + statusCode + " " + statusMessage + ": " + errorDetail + (pendingWorkflow ? " [workflow pending]" : ""); - return error; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyManagerNotFound.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyManagerNotFound.java deleted file mode 100644 index 601e5b78ea..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyManagerNotFound.java +++ /dev/null @@ -1,33 +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.openecomp.mso.cloudify.exceptions; - -public class MsoCloudifyManagerNotFound extends MsoCloudifyException { - - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoCloudifyException instance - public MsoCloudifyManagerNotFound (String cloudSiteId) { - // Set the detailed error as the Exception 'message' - super(0, "Cloudify Manager Not Found", "No Cloudify Manager configured for cloud site " + cloudSiteId); - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeout.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeout.java deleted file mode 100644 index ba1e2a721b..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeout.java +++ /dev/null @@ -1,64 +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.openecomp.mso.cloudify.exceptions; - -import org.openecomp.mso.cloudify.v3.model.Execution; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -/** - * MSO Exception when a Cloudify workflow execution times out waiting for completion. - * Exception includes the last known state of the workflow execution. - */ -public class MsoCloudifyTimeout extends MsoException -{ - - /** - * Serialization id. - */ - private static final long serialVersionUID = 3313636124141766495L; - - private Execution execution; - - /** - * Constructor to create a new MsoOpenstackException instance - * @param code the error code - * @param message the error message - * @param detail error details - */ - public MsoCloudifyTimeout (Execution execution) { - // Set the detailed error as the Exception 'message' - super("Cloudify Workflow Timeout for workflow " + execution.getWorkflowId() + " on deployment " + execution.getDeploymentId()); - super.category = MsoExceptionCategory.OPENSTACK; - - this.execution = execution; - } - - public Execution getExecution() { - return this.execution; - } - - @Override - public String toString () { - String error = "Workflow timeout: workflow=" + execution.getWorkflowId() + ",deployment=" + execution.getDeploymentId(); - return error; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowException.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowException.java deleted file mode 100644 index a397135667..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowException.java +++ /dev/null @@ -1,54 +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.openecomp.mso.cloudify.exceptions; - -/** - * Reports an error with a Cloudify Workflow execution. - * @author JC1348 - * - */ -public class MsoCloudifyWorkflowException extends MsoCloudifyException { - - private static final long serialVersionUID = 1L; - - private String workflowStatus; - private boolean workflowStillRunning = false; - - // Constructor to create a new MsoCloudifyException instance - public MsoCloudifyWorkflowException (String message, String deploymentId, String workflowId, String workflowStatus) - { - super(0, "Workflow Exception", "Workflow " + workflowId + " failed on deployment " + deploymentId + ": " + message); - this.workflowStatus = workflowStatus; - if (workflowStatus.equals("pending") || workflowStatus.equals("started") || - workflowStatus.equals("cancelling") || workflowStatus.equals("force_cancelling")) - { - workflowStillRunning = true; - } - } - - public String getWorkflowStatus() { - return workflowStatus; - } - - public boolean isWorkflowStillRunning () { - return workflowStillRunning; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoDeploymentAlreadyExists.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoDeploymentAlreadyExists.java deleted file mode 100644 index 37f97a8ce9..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/exceptions/MsoDeploymentAlreadyExists.java +++ /dev/null @@ -1,33 +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.openecomp.mso.cloudify.exceptions; - -public class MsoDeploymentAlreadyExists extends MsoCloudifyException { - - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoCloudifyException instance - public MsoDeploymentAlreadyExists (String deploymentId, String cloud) { - // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Deployment " + deploymentId + " already exists in Cloudify Manager suppporting cloud " + cloud); - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtils.java deleted file mode 100644 index bc3aa4f94f..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtils.java +++ /dev/null @@ -1,1483 +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.openecomp.mso.cloudify.utils; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import org.openecomp.mso.adapters.vdu.CloudInfo; -import org.openecomp.mso.adapters.vdu.PluginAction; -import org.openecomp.mso.adapters.vdu.VduArtifact; -import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; -import org.openecomp.mso.adapters.vdu.VduException; -import org.openecomp.mso.adapters.vdu.VduInstance; -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.adapters.vdu.VduPlugin; -import org.openecomp.mso.adapters.vdu.VduStateType; -import org.openecomp.mso.adapters.vdu.VduStatus; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.cloud.CloudifyManager; -import org.openecomp.mso.cloudify.base.client.CloudifyBaseException; -import org.openecomp.mso.cloudify.base.client.CloudifyClientTokenProvider; -import org.openecomp.mso.cloudify.base.client.CloudifyConnectException; -import org.openecomp.mso.cloudify.base.client.CloudifyRequest; -import org.openecomp.mso.cloudify.base.client.CloudifyResponseException; -import org.openecomp.mso.cloudify.beans.DeploymentInfo; -import org.openecomp.mso.cloudify.beans.DeploymentStatus; -import org.openecomp.mso.cloudify.exceptions.MsoCloudifyException; -import org.openecomp.mso.cloudify.exceptions.MsoCloudifyManagerNotFound; -import org.openecomp.mso.cloudify.exceptions.MsoDeploymentAlreadyExists; -import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.GetBlueprint; -import org.openecomp.mso.cloudify.v3.client.BlueprintsResource.UploadBlueprint; -import org.openecomp.mso.cloudify.v3.client.Cloudify; -import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.CreateDeployment; -import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.DeleteDeployment; -import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.GetDeployment; -import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.GetDeploymentOutputs; -import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.CancelExecution; -import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.GetExecution; -import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.ListExecutions; -import org.openecomp.mso.cloudify.v3.client.ExecutionsResource.StartExecution; -import org.openecomp.mso.cloudify.v3.model.AzureConfig; -import org.openecomp.mso.cloudify.v3.model.Blueprint; -import org.openecomp.mso.cloudify.v3.model.CancelExecutionParams; -import org.openecomp.mso.cloudify.v3.model.CloudifyError; -import org.openecomp.mso.cloudify.v3.model.CreateDeploymentParams; -import org.openecomp.mso.cloudify.v3.model.Deployment; -import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs; -import org.openecomp.mso.cloudify.v3.model.Execution; -import org.openecomp.mso.cloudify.v3.model.Executions; -import org.openecomp.mso.cloudify.v3.model.OpenstackConfig; -import org.openecomp.mso.cloudify.v3.model.StartExecutionParams; -import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import org.openecomp.mso.openstack.utils.MsoCommonUtils; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{ - - private MsoPropertiesFactory msoPropertiesFactory; - private CloudConfigFactory cloudConfigFactory; - - private static final String CLOUDIFY_ERROR = "CloudifyError"; - - private static final String CREATE_DEPLOYMENT = "CreateDeployment"; - private static final String DELETE_DEPLOYMENT = "DeleteDeployment"; - - // Fetch cloud configuration each time (may be cached in CloudConfig class) - protected CloudConfig cloudConfig; - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - protected MsoJavaProperties msoProps = null; - - // Properties names and variables (with default values) - protected String createPollIntervalProp = "ecomp.mso.adapters.heat.create.pollInterval"; - private String deletePollIntervalProp = "ecomp.mso.adapters.heat.delete.pollInterval"; - - protected int createPollIntervalDefault = 15; - private int deletePollIntervalDefault = 15; - - private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - - /** - * This constructor MUST be used ONLY in the JUNIT tests, not for real code. - */ - public MsoCloudifyUtils() { - - } - /** - * This constructor MUST be used ONLY in the JUNIT tests, not for real code. - * The MsoPropertiesFactory will be added by EJB injection. - * - * @param msoPropID ID of the mso pro config as defined in web.xml - * @param msoPropFactory The mso properties factory instanciated by EJB injection - * @param cloudConfFactory the Cloud Config instantiated by EJB injection - */ - public MsoCloudifyUtils (String msoPropID, MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfFactory) { - msoPropertiesFactory = msoPropFactory; - cloudConfigFactory = cloudConfFactory; - // Dynamically get properties each time (in case reloaded). - - try { - msoProps = msoPropertiesFactory.getMsoJavaProperties (msoPropID); - } catch (MsoPropertiesException e) { - LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - } - cloudConfig = cloudConfigFactory.getCloudConfig (); - LOGGER.debug("MsoCloudifyUtils:" + msoPropID); - - } - - - /** - * Create a new Deployment from a specified blueprint, and install it in the specified - * cloud location and tenant. The blueprint identifier and parameter map are passed in - * as arguments, along with the cloud access credentials. The blueprint should have been - * previously uploaded to Cloudify. - * - * It is expected that parameters have been validated and contain at minimum the required - * parameters for the given template with no extra (undefined) parameters.. - * - * The deployment ID supplied by the caller must be unique in the scope of the Cloudify - * tenant (not the Openstack tenant). However, it should also be globally unique, as it - * will be the identifier for the resource going forward in Inventory. This latter is - * managed by the higher levels invoking this function. - * - * This function executes the "install" workflow on the newly created workflow. Cloudify - * will be polled for completion unless the client requests otherwise. - * - * An error will be thrown if the requested Deployment already exists in the specified - * Cloudify instance. - * - * @param cloudSiteId The cloud (may be a region) in which to create the stack. - * @param tenantId The Openstack ID of the tenant in which to create the Stack - * @param deploymentId The identifier (name) of the deployment to create - * @param blueprintId The blueprint from which to create the deployment. - * @param inputs A map of key/value inputs - * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client - * @param timeoutMinutes Timeout after which the "install" will be cancelled - * @param environment An optional yaml-format string to specify environmental parameters - * @param backout Flag to delete deployment on install Failure - defaulted to True - * @return A DeploymentInfo object - * @throws MsoCloudifyException Thrown if the Cloudify API call returns an exception. - * @throws MsoIOException Thrown on Cloudify connection errors. - */ - - public DeploymentInfo createAndInstallDeployment (String cloudSiteId, - String tenantId, - String deploymentId, - String blueprintId, - Map inputs, - boolean pollForCompletion, - int timeoutMinutes, - boolean backout) throws MsoException - { - // Obtain the cloud site information where we will create the stack - Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); - if (!cloudSite.isPresent()) { - throw new MsoCloudSiteNotFound (cloudSiteId); - } - - Cloudify cloudify = getCloudifyClient (cloudSite.get()); - - LOGGER.debug ("Ready to Create Deployment (" + deploymentId + ") with input params: " + inputs); - - // Build up the inputs, including: - // - from provided "environment" file - // - passed in by caller - // - special input for cloud-specific Credentials - Map expandedInputs = new HashMap<> (inputs); - - String platform = cloudSite.get().getPlatform(); - if (platform == null || platform.equals("") || platform.equalsIgnoreCase("OPENSTACK")) { - // Create the Cloudify OpenstackConfig with the credentials - OpenstackConfig openstackConfig = getOpenstackConfig (cloudSite.get(), tenantId); - expandedInputs.put("openstack_config", openstackConfig); - } else if (platform.equalsIgnoreCase("AZURE")) { - // Create Cloudify AzureConfig with the credentials - AzureConfig azureConfig = getAzureConfig (cloudSite.get(), tenantId); - expandedInputs.put("azure_config", azureConfig); - } - - // Build up the parameters to create a new deployment - CreateDeploymentParams deploymentParams = new CreateDeploymentParams(); - deploymentParams.setBlueprintId(blueprintId); - deploymentParams.setInputs((Map)expandedInputs); - - Deployment deployment = null; - try { - CreateDeployment createDeploymentRequest = cloudify.deployments().create(deploymentId, deploymentParams); - LOGGER.debug (createDeploymentRequest.toString()); - - deployment = executeAndRecordCloudifyRequest (createDeploymentRequest); - } - catch (CloudifyResponseException e) { - // Since this came on the 'Create Deployment' command, nothing was changed - // in the cloud. Return the error as an exception. - if (e.getStatus () == 409) { - // Deployment already exists. Return a specific error for this case - MsoException me = new MsoDeploymentAlreadyExists (deploymentId, cloudSiteId); - me.addContext (CREATE_DEPLOYMENT); - throw me; - } else { - // Convert the CloudifyResponseException to an MsoException - LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); - MsoException me = cloudifyExceptionToMsoException (e, CREATE_DEPLOYMENT); - me.setCategory (MsoExceptionCategory.OPENSTACK); - throw me; - } - } catch (CloudifyConnectException e) { - // Error connecting to Cloudify instance. Convert to an MsoException - MsoException me = cloudifyExceptionToMsoException (e, CREATE_DEPLOYMENT); - throw me; - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, CREATE_DEPLOYMENT); - } - - /* - * It can take some time for Cloudify to be ready to execute a workflow - * on the deployment. Sleep 30 seconds based on observation of behavior - * in a Cloudify VM instance (delay due to "create_deployment_environment"). - */ - try { - Thread.sleep(30000); - } catch (InterruptedException e) {} - - /* - * Next execute the "install" workflow. - * Note - this assumes there are no additional parameters required for the workflow. - */ - int createPollInterval = msoProps.getIntProperty (createPollIntervalProp, createPollIntervalDefault); - int pollTimeout = (timeoutMinutes * 60) + createPollInterval; - - Execution installWorkflow = null; - - try { - installWorkflow = executeWorkflow (cloudify, deploymentId, "install", null, pollForCompletion, pollTimeout, createPollInterval); - - if (installWorkflow.getStatus().equals("terminated")) { - // Success! - // Create and return a DeploymentInfo structure. Include the Runtime outputs - DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId); - DeploymentInfo deploymentInfo = new DeploymentInfo (deployment, outputs, installWorkflow); - return deploymentInfo; - } - else { - // The workflow completed with errors. Must try to back it out. - if (!backout) - { - LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Deployment installation failed, backout deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Deployment Installation, backout suppressed"); - } - else { - // Poll on delete if we rollback - use same values for now - int deletePollInterval = createPollInterval; - int deletePollTimeout = pollTimeout; - - try { - // Run the uninstall to undo the install - Execution uninstallWorkflow = executeWorkflow (cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout, deletePollInterval); - - if (uninstallWorkflow.getStatus().equals("terminated")) - { - // The uninstall completed. Delete the deployment itself - DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId); - executeAndRecordCloudifyRequest (deleteRequest); - } - else { - // Didn't uninstall successfully. Log this error - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Deployment: Cloudify error rolling back deployment install: " + installWorkflow.getError(), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Cloudify error rolling back deployment installation"); - } - } - catch (Exception e) { - // Catch-all for backout errors trying to uninstall/delete - // Log this error, and return the original exception - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back deployment install: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back deployment installation"); - } - } - - MsoCloudifyException me = new MsoCloudifyException (0, "Workflow Execution Failed", installWorkflow.getError()); - me.addContext (CREATE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - } - catch (MsoException me) { - // Install failed. Unless requested otherwise, back out the deployment - - if (!backout) - { - LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Deployment installation failed, backout deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Deployment Installation, backout suppressed"); - } - else { - // Poll on delete if we rollback - use same values for now - int deletePollInterval = createPollInterval; - int deletePollTimeout = pollTimeout; - - try { - // Run the uninstall to undo the install. - // Always try to run it, as it should be idempotent - executeWorkflow (cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout, deletePollInterval); - - // Delete the deployment itself - DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId); - executeAndRecordCloudifyRequest (deleteRequest); - } - catch (Exception e) { - // Catch-all for backout errors trying to uninstall/delete - // Log this error, and return the original exception - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back deployment install: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back deployment installation"); - - } - } - - // Propagate the original exception from Stack Query. - me.addContext (CREATE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - } - - - /* - * Get the runtime Outputs of a deployment. - * Return the Map of tag/value outputs. - */ - private DeploymentOutputs getDeploymentOutputs (Cloudify cloudify, String deploymentId) - throws MsoException - { - // Build and send the Cloudify request - DeploymentOutputs deploymentOutputs = null; - try { - GetDeploymentOutputs queryDeploymentOutputs = cloudify.deployments().outputsById(deploymentId); - LOGGER.debug (queryDeploymentOutputs.toString()); - - deploymentOutputs = executeAndRecordCloudifyRequest(queryDeploymentOutputs, msoProps); - } - catch (CloudifyConnectException ce) { - // Couldn't connect to Cloudify - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "QueryDeploymentOutputs: Cloudify connection failure: " + ce, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "QueryDeploymentOutputs: Cloudify connection failure"); - throw new MsoIOException (ce.getMessage(), ce); - } - catch (CloudifyResponseException re) { - if (re.getStatus () == 404) { - // No Outputs - return null; - } - throw new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getLocalizedMessage(), re); - } - catch (Exception e) { - // Catch-all - throw new MsoAdapterException (e.getMessage(), e); - } - - return deploymentOutputs; - } - - /* - * Execute a workflow on a deployment. Handle polling for completion with timeout. - * Return the final Execution object with status. - * Throw an exception on Errors. - * Question - how does the client know whether rollback needs to be done? - */ - private Execution executeWorkflow (Cloudify cloudify, String deploymentId, String workflowId, Map workflowParams, boolean pollForCompletion, int timeout, int pollInterval) - throws MsoCloudifyException - { - LOGGER.debug("Executing '" + workflowId + "' workflow on deployment '" + deploymentId + "'"); - - StartExecutionParams executeParams = new StartExecutionParams(); - executeParams.setWorkflowId(workflowId); - executeParams.setDeploymentId(deploymentId); - executeParams.setParameters(workflowParams); - - Execution execution = null; - String executionId = null; - String command = "start"; - Exception savedException = null; - - try { - StartExecution executionRequest = cloudify.executions().start(executeParams); - LOGGER.debug (executionRequest.toString()); - execution = executeAndRecordCloudifyRequest (executionRequest); - executionId = execution.getId(); - - if (!pollForCompletion) { - // Client did not request polling, so just return the Execution object - return execution; - } - - // Enter polling loop - boolean timedOut = false; - int pollTimeout = timeout; - - String status = execution.getStatus(); - - // Create a reusable cloudify query request - GetExecution queryExecution = cloudify.executions().byId(executionId); - command = "query"; - - while (!timedOut && !(status.equals("terminated") || status.equals("failed") || status.equals("cancelled"))) - { - // workflow is still running; check for timeout - if (pollTimeout <= 0) { - LOGGER.debug ("workflow " + execution.getWorkflowId() + " timed out on deployment " + execution.getDeploymentId()); - timedOut = true; - continue; - } - - try { - Thread.sleep (pollInterval * 1000L); - } catch (InterruptedException e) {} - - pollTimeout -= pollInterval; - LOGGER.debug("pollTimeout remaining: " + pollTimeout); - - execution = queryExecution.execute(); - status = execution.getStatus(); - } - - // Broke the loop. Check again for a terminal state - if (status.equals("terminated")){ - // Success! - LOGGER.debug ("Workflow '" + workflowId + "' completed successfully on deployment '" + deploymentId + "'"); - return execution; - } - else if (status.equals("failed")){ - // Workflow failed. Log it and return the execution object (don't throw exception here) - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Cloudify workflow failure: " + execution.getError(), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow: Failed: " + execution.getError()); - return execution; - } - else if (status.equals("cancelled")){ - // Workflow was cancelled, leaving the deployment in an indeterminate state. Log it and return the execution object (don't throw exception here) - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Cloudify workflow cancelled. Deployment is in an indeterminate state", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow cancelled: " + workflowId); - return execution; - } - else { - // Can only get here after a timeout - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Cloudify workflow timeout", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow: Timed Out"); - } - } - catch (CloudifyConnectException ce) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Cloudify connection failure: " + ce, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Cloudify connection failure"); - savedException = ce; - } - catch (CloudifyResponseException re) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Cloudify response error: " + re, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Cloudify error" + re.getMessage()); - savedException = re; - } - catch (RuntimeException e) { - // Catch-all - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Unexpected error: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Internal error" + e.getMessage()); - savedException = e; - } - - // Get to this point ONLY on an error or timeout - // The cloudify execution is still running (we've not received a terminal status), - // so try to Cancel it. - CancelExecutionParams cancelParams = new CancelExecutionParams(); - cancelParams.setAction("cancel"); - // TODO: Use force_cancel? - - Execution cancelExecution = null; - - try { - CancelExecution cancelRequest = cloudify.executions().cancel(executionId, cancelParams); - LOGGER.debug (cancelRequest.toString()); - cancelExecution = cancelRequest.execute(); - - // Enter polling loop - boolean timedOut = false; - int cancelTimeout = timeout; // TODO: For now, just use same timeout - - String status = cancelExecution.getStatus(); - - // Poll for completion. Create a reusable cloudify query request - GetExecution queryExecution = cloudify.executions().byId(executionId); - - while (!timedOut && !status.equals("cancelled")) - { - // workflow is still running; check for timeout - if (cancelTimeout <= 0) { - LOGGER.debug ("Cancel timeout for workflow " + workflowId + " on deployment " + deploymentId); - timedOut = true; - continue; - } - - try { - Thread.sleep (pollInterval * 1000L); - } catch (InterruptedException e) {} - - cancelTimeout -= pollInterval; - LOGGER.debug("pollTimeout remaining: " + cancelTimeout); - - execution = queryExecution.execute(); - status = execution.getStatus(); - } - - // Broke the loop. Check again for a terminal state - if (status.equals("cancelled")){ - // Finished cancelling. Return the original exception - LOGGER.debug ("Cancel workflow " + workflowId + " completed on deployment " + deploymentId); - throw new MsoCloudifyException (-1, "", "", savedException); - } - else { - // Can only get here after a timeout - LOGGER.debug ("Cancel workflow " + workflowId + " timeout out on deployment " + deploymentId); - MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException); - exception.setPendingWorkflow(true); - throw exception; - } - } - catch (Exception e) { - // Catch-all. Log the message and throw the original exception -// LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Execute Workflow (" + command + "): Unexpected error: " + e, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Execute Workflow (" + command + "): Internal error" + e.getMessage()); - LOGGER.debug ("Cancel workflow " + workflowId + " failed for deployment " + deploymentId + ": " + e.getMessage()); - MsoCloudifyException exception = new MsoCloudifyException (-1, "", "", savedException); - exception.setPendingWorkflow(true); - throw exception; - } - } - - - - /** - * Query for a Cloudify Deployment (by Name). This call will always return a - * DeploymentInfo object. If the deployment does not exist, an "empty" DeploymentInfo will be - * returned - containing only the deployment ID and a special status of NOTFOUND. - * - * @param tenantId The Openstack ID of the tenant in which to query - * @param cloudSiteId The cloud identifier (may be a region) in which to query - * @param stackName The name of the stack to query (may be simple or canonical) - * @return A StackInfo object - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. - */ - public DeploymentInfo queryDeployment (String cloudSiteId, String tenantId, String deploymentId) - throws MsoException - { - LOGGER.debug ("Query Cloudify Deployment: " + deploymentId + " in tenant " + tenantId); - - // Obtain the cloud site information where we will create the stack - Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); - if (!cloudSite.isPresent()) { - throw new MsoCloudSiteNotFound (cloudSiteId); - } - - Cloudify cloudify = getCloudifyClient (cloudSite.get()); - - // Build and send the Cloudify request - Deployment deployment = null; - DeploymentOutputs outputs = null; - try { - GetDeployment queryDeployment = cloudify.deployments().byId(deploymentId); - LOGGER.debug (queryDeployment.toString()); - -// deployment = queryDeployment.execute(); - deployment = executeAndRecordCloudifyRequest(queryDeployment, msoProps); - - outputs = getDeploymentOutputs (cloudify, deploymentId); - - // Next look for the latest execution - ListExecutions listExecutions = cloudify.executions().listFiltered ("deployment_id=" + deploymentId, "-created_at"); - Executions executions = listExecutions.execute(); - - // If no executions, does this give NOT_FOUND or empty set? - if (executions.getItems().isEmpty()) { - return new DeploymentInfo (deployment); - } - else { - return new DeploymentInfo (deployment, outputs, executions.getItems().get(0)); - } - } - catch (CloudifyConnectException ce) { - // Couldn't connect to Cloudify - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "QueryDeployment: Cloudify connection failure: " + ce, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "QueryDeployment: Cloudify connection failure"); - throw new MsoIOException (ce.getMessage(), ce); - } - catch (CloudifyResponseException re) { - if (re.getStatus () == 404) { - // Got a NOT FOUND error. React differently based on deployment vs. execution - if (deployment != null) { - // Got NOT_FOUND on the executions. Assume this is a valid "empty" set - return new DeploymentInfo (deployment, outputs, null); - } else { - // Deployment not found. Default status of a DeploymentInfo object is NOTFOUND - return new DeploymentInfo (deploymentId); - } - } - throw new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getLocalizedMessage(), re); - } - catch (Exception e) { - // Catch-all - throw new MsoAdapterException (e.getMessage(), e); - } - } - - - /** - * Delete a Cloudify deployment (by ID). If the deployment is not found, it will be - * considered a successful deletion. The return value is a DeploymentInfo object which - * contains the last deployment status. - * - * There is no rollback from a successful deletion. A deletion failure will - * also result in an undefined deployment state - the components may or may not have been - * all or partially deleted, so the resulting deployment must be considered invalid. - * - * @param tenantId The Openstack ID of the tenant in which to perform the delete - * @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack. - * @param stackName The name/id of the stack to delete. May be simple or canonical - * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client - * @return A StackInfo object - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. - * @throws MsoCloudSiteNotFound - */ - public DeploymentInfo uninstallAndDeleteDeployment (String cloudSiteId, - String tenantId, - String deploymentId, - int timeoutMinutes) throws MsoException - { - // Obtain the cloud site information where we will create the stack - Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); - if (!cloudSite.isPresent()) { - throw new MsoCloudSiteNotFound (cloudSiteId); - } - - Cloudify cloudify = getCloudifyClient (cloudSite.get()); - - LOGGER.debug ("Ready to Uninstall/Delete Deployment (" + deploymentId + ")"); - - // Query first to save the trouble if deployment not found - Deployment deployment = null; - try { - GetDeployment queryDeploymentRequest = cloudify.deployments().byId(deploymentId); - LOGGER.debug (queryDeploymentRequest.toString()); - - deployment = executeAndRecordCloudifyRequest (queryDeploymentRequest); - } - catch (CloudifyResponseException e) { - // Since this came on the 'Create Deployment' command, nothing was changed - // in the cloud. Return the error as an exception. - if (e.getStatus () == 404) { - // Deployment doesn't exist. Return a "NOTFOUND" DeploymentInfo object - // TODO: Should return NULL? - LOGGER.debug("Deployment requested for deletion does not exist: " + deploymentId); - return new DeploymentInfo (deploymentId, DeploymentStatus.NOTFOUND); - } else { - // Convert the CloudifyResponseException to an MsoOpenstackException - LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); - MsoException me = cloudifyExceptionToMsoException (e, DELETE_DEPLOYMENT); - me.setCategory (MsoExceptionCategory.INTERNAL); - throw me; - } - } catch (CloudifyConnectException e) { - // Error connecting to Cloudify instance. Convert to an MsoException - MsoException me = cloudifyExceptionToMsoException (e, DELETE_DEPLOYMENT); - throw me; - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, DELETE_DEPLOYMENT); - } - - /* - * Query the outputs before deleting so they can be returned as well - */ - DeploymentOutputs outputs = getDeploymentOutputs (cloudify, deploymentId); - - /* - * Next execute the "uninstall" workflow. - * Note - this assumes there are no additional parameters required for the workflow. - */ - // TODO: No deletePollInterval that I'm aware of. Use the create interval - int deletePollInterval = msoProps.getIntProperty (deletePollIntervalProp, deletePollIntervalDefault); - int pollTimeout = (timeoutMinutes * 60) + deletePollInterval; - - Execution uninstallWorkflow = null; - - try { - uninstallWorkflow = executeWorkflow (cloudify, deploymentId, "uninstall", null, true, pollTimeout, deletePollInterval); - - if (uninstallWorkflow.getStatus().equals("terminated")) { - // Successful uninstall. - LOGGER.debug("Uninstall successful for deployment " + deploymentId); - } - else { - // The uninstall workflow completed with an error. Must fail the request, but will - // leave the deployment in an indeterminate state, as cloud resources may still exist. - MsoCloudifyException me = new MsoCloudifyException (0, "Uninstall Workflow Failed", uninstallWorkflow.getError()); - me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - } - catch (MsoException me) { - // Uninstall workflow has failed. - // Must fail the deletion... may leave the deployment in an inconclusive state - me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - - // At this point, the deployment has been successfully uninstalled. - // Next step is to delete the deployment itself - try { - DeleteDeployment deleteRequest = cloudify.deployments().deleteByName(deploymentId); - LOGGER.debug(deleteRequest.toString()); - - // The delete request returns the deleted deployment - deployment = deleteRequest.execute(); - - } - catch (CloudifyConnectException ce) { - // Failed to delete. Must fail the request, but will leave the (uninstalled) - // deployment in Cloudify DB. - MsoCloudifyException me = new MsoCloudifyException (0, "Deployment Delete Failed", ce.getMessage(), ce); - me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - catch (CloudifyResponseException re) { - // Failed to delete. Must fail the request, but will leave the (uninstalled) - // deployment in the Cloudify DB. - MsoCloudifyException me = new MsoCloudifyException (re.getStatus(), re.getMessage(), re.getMessage(), re); - me.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - catch (Exception e) { - // Catch-all - MsoAdapterException ae = new MsoAdapterException (e.getMessage(), e); - ae.addContext (DELETE_DEPLOYMENT); - alarmLogger.sendAlarm(CLOUDIFY_ERROR, MsoAlarmLogger.CRITICAL, ae.getContextMessage()); - throw ae; - } - - // Return the deleted deployment info (with runtime outputs) along with the completed uninstall workflow status - return new DeploymentInfo (deployment, outputs, uninstallWorkflow); - } - - - /** - * Check if a blueprint is available for use at a targeted cloud site. - * This requires checking the Cloudify Manager which is servicing that - * cloud site to see if the specified blueprint has been loaded. - * - * @param cloudSiteId The cloud site where the blueprint is needed - * @param blueprintId The ID for the blueprint in Cloudify - */ - public boolean isBlueprintLoaded (String cloudSiteId, String blueprintId) - throws MsoException - { - // Obtain the cloud site information where we will load the blueprint - Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); - if (!cloudSite.isPresent()) { - throw new MsoCloudSiteNotFound (cloudSiteId); - } - - Cloudify cloudify = getCloudifyClient (cloudSite.get()); - - GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId); - try { - Blueprint bp = getRequest.execute(); - LOGGER.debug("Blueprint exists: " + bp.getId()); - return true; - } - catch (CloudifyResponseException ce) { - if (ce.getStatus() == 404) { - return false; - } else { - throw ce; - } - } catch (Exception e) { - throw e; - } - } - - /** - * Upload a blueprint to the Cloudify Manager that is servicing a Cloud Site. - * The blueprint currently must be structured as a single directory with all - * of the required files. One of those files is designated the "main file" - * for the blueprint. Files are provided as byte arrays, though expect only - * text files will be distributed from ASDC and stored by MSO. - * - * Cloudify requires a single root directory in its blueprint zip files. - * The requested blueprint ID will also be used as the directory. - * All of the files will be added to this directory in the zip file. - */ - public void uploadBlueprint (String cloudSiteId, - String blueprintId, - String mainFileName, - Map blueprintFiles, - boolean failIfExists) - throws MsoException - { - // Obtain the cloud site information where we will load the blueprint - Optional cloudSite = cloudConfig.getCloudSite (cloudSiteId); - if (!cloudSite.isPresent()) { - throw new MsoCloudSiteNotFound (cloudSiteId); - } - - Cloudify cloudify = getCloudifyClient (cloudSite.get()); - - boolean blueprintUploaded = uploadBlueprint (cloudify, blueprintId, mainFileName, blueprintFiles); - - if (!blueprintUploaded && failIfExists) { - throw new MsoAdapterException ("Blueprint already exists"); - } - } - - /* - * Common method to load a blueprint. May be called from - */ - protected boolean uploadBlueprint (Cloudify cloudify, String blueprintId, String mainFileName, Map blueprintFiles) - throws MsoException - { - // Check if it already exists. If so, return false. - GetBlueprint getRequest = cloudify.blueprints().getMetadataById(blueprintId); - try { - Blueprint bp = getRequest.execute(); - LOGGER.debug("Blueprint " + bp.getId() + " already exists."); - return false; - } - catch (CloudifyResponseException ce) { - if (ce.getStatus() == 404) { - // This is the expected result. - LOGGER.debug("Verified that Blueprint doesn't exist yet"); - } else { - throw ce; - } - } catch (Exception e) { - throw e; - } - - // Create a blueprint ZIP file in memory - ByteArrayOutputStream zipBuffer = new ByteArrayOutputStream(); - ZipOutputStream zipOut = new ZipOutputStream(zipBuffer); - - try { - // Put the root directory - String rootDir = blueprintId + ((blueprintId.endsWith("/") ? "" : "/")); - zipOut.putNextEntry(new ZipEntry (rootDir)); - zipOut.closeEntry(); - - for (String fileName : blueprintFiles.keySet()) { - ZipEntry ze = new ZipEntry (rootDir + fileName); - zipOut.putNextEntry (ze); - zipOut.write (blueprintFiles.get(fileName)); - zipOut.closeEntry(); - } - zipOut.close(); - } - catch (IOException e) { - // Since we're writing to a byte array, this should never happen - } - LOGGER.debug ("Blueprint zip file size: " + zipBuffer.size()); - - // Ready to upload the blueprint zip - InputStream blueprintStream = new ByteArrayInputStream (zipBuffer.toByteArray()); - try { - UploadBlueprint uploadRequest = cloudify.blueprints().uploadFromStream(blueprintId, mainFileName, blueprintStream); - Blueprint blueprint = uploadRequest.execute(); - System.out.println("Successfully uploaded blueprint " + blueprint.getId()); - } - catch (CloudifyResponseException e) { - MsoException me = cloudifyExceptionToMsoException (e, "UPLOAD_BLUEPRINT"); - throw me; - } - catch (CloudifyConnectException e) { - MsoException me = cloudifyExceptionToMsoException (e, "UPLOAD_BLUEPRINT"); - throw me; - } - catch (RuntimeException e) { - // Catch-all - MsoException me = runtimeExceptionToMsoException (e, "UPLOAD_BLUEPRINT"); - throw me; - } - finally { - try { - blueprintStream.close(); - } catch (IOException e) {} - } - - return true; - } - - - - // --------------------------------------------------------------- - // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS - - /** - * Get a Cloudify client for the specified cloud site. - * Everything that is required can be found in the Cloud Config. - * - * @param cloudSite - * @return a Cloudify object - */ - public Cloudify getCloudifyClient (CloudSite cloudSite) throws MsoException - { - CloudifyManager cloudifyConfig = cloudSite.getCloudifyManager(); - if (cloudifyConfig == null) { - throw new MsoCloudifyManagerNotFound (cloudSite.getId()); - } - - // Get a Cloudify client - // Set a Token Provider to fetch tokens from Cloudify itself. - String cloudifyUrl = cloudifyConfig.getCloudifyUrl(); - Cloudify cloudify = new Cloudify (cloudifyUrl); - cloudify.setTokenProvider(new CloudifyClientTokenProvider(cloudifyUrl, cloudifyConfig.getUsername(), cloudifyConfig.getPassword())); - - return cloudify; - } - - - /* - * Query for a Cloudify Deployment. This function is needed in several places, so - * a common method is useful. This method takes an authenticated CloudifyClient - * (which internally identifies the cloud & tenant to search), and returns - * a Deployment object if found, Null if not found, or an MsoCloudifyException - * if the Cloudify API call fails. - * - * @param cloudifyClient an authenticated Cloudify client - * - * @param deploymentId the deployment to query - * - * @return a Deployment object or null if the requested deployment doesn't exist. - * - * @throws MsoCloudifyException Thrown if the Cloudify API call returns an exception - */ - protected Deployment queryDeployment (Cloudify cloudify, String deploymentId) throws MsoException { - if (deploymentId == null) { - return null; - } - try { - GetDeployment request = cloudify.deployments().byId (deploymentId); - return executeAndRecordCloudifyRequest (request, msoProps); - } catch (CloudifyResponseException e) { - if (e.getStatus () == 404) { - LOGGER.debug ("queryDeployment - not found: " + deploymentId); - return null; - } else { - // Convert the CloudifyResponseException to an MsoCloudifyException - throw cloudifyExceptionToMsoException (e, "QueryDeployment"); - } - } catch (CloudifyConnectException e) { - // Connection to Openstack failed - throw cloudifyExceptionToMsoException (e, "QueryDeployment"); - } - } - - - public void copyStringOutputsToInputs(Map inputs, - Map otherStackOutputs, boolean overWrite) { - if (inputs == null || otherStackOutputs == null) - return; - for (String key : otherStackOutputs.keySet()) { - if (!inputs.containsKey(key)) { - Object obj = otherStackOutputs.get(key); - if (obj instanceof String) { - inputs.put(key, (String) otherStackOutputs.get(key)); - } else if (obj instanceof JsonNode ){ - // This is a bit of mess - but I think it's the least impacting - // let's convert it BACK to a string - then it will get converted back later - try { - String str = this.convertNode((JsonNode) obj); - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("WARNING: unable to convert JsonNode output value for "+ key); - //effect here is this value will not have been copied to the inputs - and therefore will error out downstream - } - } else if (obj instanceof java.util.LinkedHashMap) { - LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode"); - try { - String str = JSON_MAPPER.writeValueAsString(obj); - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("WARNING: unable to convert LinkedHashMap output value for "+ key); - } - } else { - // just try to cast it - could be an integer or some such - try { - String str = (String) obj; - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("WARNING: unable to convert output value for "+ key); - //effect here is this value will not have been copied to the inputs - and therefore will error out downstream - } - } - } - } - return; - } - - /* - * Normalize an input value to an Object, based on the target parameter type. - * If the type is not recognized, it will just be returned unchanged (as a string). - */ - public Object convertInputValue (String inputValue, HeatTemplateParam templateParam) - { - String type = templateParam.getParamType(); - LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type); - - if (type.equalsIgnoreCase("number")) { - try { - return Integer.valueOf(inputValue); - } - catch (Exception e) { - LOGGER.debug("Unable to convert " + inputValue + " to an integer!"); - return null; - } - } else if (type.equalsIgnoreCase("json")) { - try { - JsonNode jsonNode = new ObjectMapper().readTree(inputValue); - return jsonNode; - } - catch (Exception e) { - LOGGER.debug("Unable to convert " + inputValue + " to a JsonNode!"); - return null; - } - } else if (type.equalsIgnoreCase("boolean")) { - return new Boolean(inputValue); - } - - // Nothing else matched. Return the original string - return inputValue; - } - - - private String convertNode(final JsonNode node) { - try { - final Object obj = JSON_MAPPER.treeToValue(node, Object.class); - final String json = JSON_MAPPER.writeValueAsString(obj); - return json; - } catch (JsonParseException jpe) { - LOGGER.debug("Error converting json to string " + jpe.getMessage()); - } catch (Exception e) { - LOGGER.debug("Error converting json to string " + e.getMessage()); - } - return "[Error converting json to string]"; - } - - - /* - * Method to execute a Cloudify command and track its execution time. - * For the metrics log, a category of "Cloudify" is used along with a - * sub-category that identifies the specific call (using the real - * cloudify-client classname of the CloudifyRequest parameter). - */ - - protected static T executeAndRecordCloudifyRequest (CloudifyRequest request) - { - return executeAndRecordCloudifyRequest (request, null); - } - protected static T executeAndRecordCloudifyRequest (CloudifyRequest request, MsoJavaProperties msoProps) { - - int limit; - // Get the name and method name of the parent class, which triggered this method - StackTraceElement[] classArr = new Exception ().getStackTrace (); - if (classArr.length >=2) { - limit = 3; - } else { - limit = classArr.length; - } - String parentServiceMethodName = classArr[0].getClassName () + "." + classArr[0].getMethodName (); - for (int i = 1; i < limit; i++) { - String className = classArr[i].getClassName (); - if (!className.equals (MsoCommonUtils.class.getName ())) { - parentServiceMethodName = className + "." + classArr[i].getMethodName (); - break; - } - } - - String requestType; - if (request.getClass ().getEnclosingClass () != null) { - requestType = request.getClass ().getEnclosingClass ().getSimpleName () + "." - + request.getClass ().getSimpleName (); - } else { - requestType = request.getClass ().getSimpleName (); - } - - int retryDelay = retryDelayDefault; - int retryCount = retryCountDefault; - String retryCodes = retryCodesDefault; - if (msoProps != null) //extra check to avoid NPE - { - retryDelay = msoProps.getIntProperty (retryDelayProp, retryDelayDefault); - retryCount = msoProps.getIntProperty (retryCountProp, retryCountDefault); - retryCodes = msoProps.getProperty (retryCodesProp, retryCodesDefault); - } - - // Run the actual command. All exceptions will be propagated - while (true) - { - try { - return request.execute (); - } - catch (CloudifyResponseException e) { - boolean retry = false; - if (retryCodes != null ) { - int code = e.getStatus(); - LOGGER.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code); - for (String rCode : retryCodes.split (",")) { - try { - if (retryCount > 0 && code == Integer.parseInt (rCode)) - { - retryCount--; - retry = true; - LOGGER.debug ("CloudifyResponseException ResponseCode:" + code + " at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); - break; - } - } catch (NumberFormatException e1) { - LOGGER.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config"); - throw e; - } - } - } - if (retry) - { - try { - Thread.sleep (retryDelay * 1000L); - } catch (InterruptedException e1) { - LOGGER.debug ("Thread interrupted while sleeping", e1); - } - } - else - throw e; // exceeded retryCount or code is not retryable - } - catch (CloudifyConnectException e) { - // Connection to Cloudify failed - if (retryCount > 0) - { - retryCount--; - LOGGER.debug ("CloudifyConnectException at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); - try { - Thread.sleep (retryDelay * 1000L); - } catch (InterruptedException e1) { - LOGGER.debug ("Thread interrupted while sleeping", e1); - } - } - else - throw e; - - } - } - } - /* - * Convert an Exception on a Cloudify call to an MsoCloudifyException. - * This method supports CloudifyResponseException and CloudifyConnectException. - */ - protected MsoException cloudifyExceptionToMsoException (CloudifyBaseException e, String context) { - MsoException me = null; - - if (e instanceof CloudifyResponseException) { - CloudifyResponseException re = (CloudifyResponseException) e; - - try { - // Failed Cloudify calls return an error entity body. - CloudifyError error = re.getResponse ().getErrorEntity (CloudifyError.class); - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Cloudify", "Cloudify Error on " + context + ": " + error.getErrorCode(), "Cloudify", "", MsoLogger.ErrorCode.DataError, "Exception - Cloudify Error on " + context); - String fullError = error.getErrorCode() + ": " + error.getMessage(); - LOGGER.debug(fullError); - me = new MsoCloudifyException (re.getStatus(), - re.getMessage(), - fullError); - } catch (Exception e2) { - // Couldn't parse the body as a "CloudifyError". Report the original HTTP error. - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Cloudify", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Cloudify", "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2); - me = new MsoCloudifyException (re.getStatus (), re.getMessage (), ""); - } - - // Add the context of the error - me.addContext (context); - - // Generate an alarm for 5XX and higher errors. - if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("CloudifyError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - } - } else if (e instanceof CloudifyConnectException) { - CloudifyConnectException ce = (CloudifyConnectException) e; - - me = new MsoIOException (ce.getMessage ()); - me.addContext (context); - - // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("CloudifyIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "Cloudify", "Cloudify connection error on " + context + ": " + e, "Cloudify", "", MsoLogger.ErrorCode.DataError, "Cloudify connection error on " + context); - } - - return me; - } - - - - /******************************************************************************* - * - * Methods (and associated utilities) to implement the VduPlugin interface - * - *******************************************************************************/ - - /** - * VduPlugin interface for instantiate function. - * - * This one is a bit more complex, in that it will first upload the blueprint if needed, - * then create the Cloudify deployment and execute the install workflow. - * - * This implementation also merges any parameters defined in the ENV file with the other - * other input parameters for any undefined parameters). - * The basic MsoCloudifyUtils separates blueprint management from deploument actions, - * but the VduPlugin does not declare blueprint management operations. - */ - public VduInstance instantiateVdu ( - CloudInfo cloudInfo, - String instanceName, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException - { - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - // Translate the VDU ModelInformation structure to that which is needed for - // creating and uploading a blueprint. Use the model customization UUID as - // the blueprint identifier. - - String blueprintId = vduModel.getModelCustomizationUUID(); - - try { - - if (! isBlueprintLoaded (cloudSiteId, blueprintId)) { - LOGGER.debug ("Blueprint " + blueprintId + " is not loaded. Will upload it now."); - - // Prepare the blueprint inputs. Need the set of blueprint templates and files, - // plus the main blueprint name. - Map blueprintFiles = new HashMap<>(); - String mainTemplate = ""; - - // Add all of the blueprint artifacts from the VDU model - List vduArtifacts = vduModel.getArtifacts(); - for (VduArtifact vduArtifact: vduArtifacts) - { - // Add all artifacts to the blueprint, with one exception. - // ENVIRONMENT files will be processed later as additional parameters. - - ArtifactType artifactType = vduArtifact.getType(); - if (artifactType != ArtifactType.ENVIRONMENT) { - blueprintFiles.put(vduArtifact.getName(), vduArtifact.getContent()); - - if (artifactType == ArtifactType.MAIN_TEMPLATE) { - mainTemplate = vduArtifact.getName(); - } - } - } - - // Upload the blueprint package - uploadBlueprint(cloudSiteId, blueprintId, mainTemplate, blueprintFiles, false); - } - } - catch (Exception e) { - throw new VduException ("CloudifyUtils (instantiateVDU): blueprint Exception", e); - } - - - // Next, create and install a new deployment based on the blueprint. - // For Cloudify, the deploymentId is specified by the client. Just use the instance name - // as the ID. - - try { - // Query the Cloudify Deployment object and populate a VduInstance - DeploymentInfo deployment = createAndInstallDeployment (cloudSiteId, - tenantId, - instanceName, - blueprintId, - inputs, - true, // (poll for completion) - vduModel.getTimeoutMinutes(), - rollbackOnFailure); - - VduInstance vduInstance = deploymentInfoToVduInstance(deployment); - - return vduInstance; - } - catch (Exception e) { - throw new VduException ("CloudifyUtils (instantiateVDU): Create-and-install-deployment Exception", e); - } - } - - - /** - * VduPlugin interface for query function. - */ - public VduInstance queryVdu (CloudInfo cloudInfo, String instanceId) - throws VduException - { - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - try { - // Query the Cloudify Deployment object and populate a VduInstance - DeploymentInfo deployment = queryDeployment (cloudSiteId, tenantId, instanceId); - - VduInstance vduInstance = deploymentInfoToVduInstance(deployment); - - return vduInstance; - } - catch (Exception e) { - throw new VduException ("Query VDU Exception", e); - } - } - - - /** - * VduPlugin interface for delete function. - */ - public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes) - throws VduException - { - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - try { - // Uninstall and delete the Cloudify Deployment - DeploymentInfo deployment = uninstallAndDeleteDeployment (cloudSiteId, tenantId, instanceId, timeoutMinutes); - - // Populate a VduInstance based on the deleted Cloudify Deployment object - VduInstance vduInstance = deploymentInfoToVduInstance(deployment); - - return vduInstance; - } - catch (Exception e) { - throw new VduException ("Delete VDU Exception", e); - } - } - - - /** - * VduPlugin interface for update function. - * - * Update is currently not supported in the MsoCloudifyUtils implementation. - * Just return a VduException. - * - */ - public VduInstance updateVdu ( - CloudInfo cloudInfo, - String instanceId, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException - { - throw new VduException ("CloudifyUtils: updateVDU interface not supported"); - } - - - /* - * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object - */ - protected VduInstance deploymentInfoToVduInstance (DeploymentInfo deployment) - { - VduInstance vduInstance = new VduInstance(); - - // only one ID in Cloudify, use for both VDU name and ID - vduInstance.setVduInstanceId(deployment.getId()); - vduInstance.setVduInstanceName(deployment.getId()); - - // Copy inputs and outputs - vduInstance.setInputs(deployment.getInputs()); - vduInstance.setOutputs(deployment.getOutputs()); - - // Translate the status elements - vduInstance.setStatus(deploymentStatusToVduStatus (deployment)); - - return vduInstance; - } - - protected VduStatus deploymentStatusToVduStatus (DeploymentInfo deployment) - { - VduStatus vduStatus = new VduStatus(); - - // Determine the status based on last action & status - // DeploymentInfo object should be enhanced to report a better status internally. - DeploymentStatus status = deployment.getStatus(); - - if (status == null) { - vduStatus.setState(VduStateType.UNKNOWN); - } - else if (status == DeploymentStatus.NOTFOUND) { - vduStatus.setState(VduStateType.NOTFOUND); - } - else if (status == DeploymentStatus.INSTALLED) { - vduStatus.setState(VduStateType.INSTANTIATED); - } - else if (status == DeploymentStatus.CREATED) { - // Deployment exists but is not installed. This shouldn't really happen, - // since create + install or uninstall + delete are always done together. - // But account for it anyway, assuming the operation is still in progress. - String lastAction = deployment.getLastAction(); - if (lastAction == null) - vduStatus.setState(VduStateType.INSTANTIATING); - else - vduStatus.setState(VduStateType.DELETING); - } - else if (status == DeploymentStatus.FAILED) { - vduStatus.setState(VduStateType.FAILED); - } else { - vduStatus.setState(VduStateType.UNKNOWN); - } - - vduStatus.setErrorMessage(deployment.getErrorMessage()); - vduStatus.setLastAction(new PluginAction(deployment.getLastAction(), deployment.getActionStatus(), deployment.getErrorMessage())); - - return vduStatus; - } - - /* - * Return an OpenstackConfig object as expected by Cloudify Openstack Plug-in. - * Base the values on the CloudSite definition. - */ - protected OpenstackConfig getOpenstackConfig (CloudSite cloudSite, String tenantId) { - OpenstackConfig openstackConfig = new OpenstackConfig(); - openstackConfig.setRegion (cloudSite.getRegionId()); - openstackConfig.setAuthUrl (cloudSite.getIdentityService().getIdentityUrl()); - openstackConfig.setUsername (cloudSite.getIdentityService().getMsoId()); - openstackConfig.setPassword (cloudSite.getIdentityService().getMsoPass()); - openstackConfig.setTenantName (tenantId); - return openstackConfig; - } - - /* - * Return an Azure object as expected by Cloudify Azure Plug-in. - * Base the values on the CloudSite definition. - */ - protected AzureConfig getAzureConfig (CloudSite cloudSite, String tenantId) { - AzureConfig azureConfig = new AzureConfig(); - // TODO: Use adminTenant for now, instead of adding another element - azureConfig.setSubscriptionId (cloudSite.getIdentityService().getAdminTenant()); - azureConfig.setTenantId (tenantId); - azureConfig.setClientId (cloudSite.getIdentityService().getMsoId()); - azureConfig.setClientSecret (cloudSite.getIdentityService().getMsoPass()); - return azureConfig; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java deleted file mode 100644 index 43b742f326..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java +++ /dev/null @@ -1,214 +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.openecomp.mso.openstack.beans; - -import org.openecomp.mso.entity.MsoRequest; -/** - * Javabean representing the rollback criteria following a "Create VNF" - * operation. This structure can be passed back to the "Rollback VNF" - * operation to undo the effects of the create. - * - * - */ -public class VnfRollback { - private String vnfId; - private String tenantId; - private String cloudSiteId; - private boolean tenantCreated = false; - private boolean vnfCreated = false; - private MsoRequest msoRequest; - private String volumeGroupName; - private String volumeGroupId; - private String requestType; - private String volumeGroupHeatStackId; - private String baseGroupHeatStackId; - private boolean isBase = false; - private String vfModuleStackId; - private String modelCustomizationUuid; //NOTE: this is the vfModule's modelCustomizationUuid - private String mode = "HEAT"; - - public VnfRollback() {} - - /** - * For backwards compatibility... orchestration mode defaults to HEAT - * - * @param vnfId - * @param tenantId - * @param cloudSiteId - * @param tenantCreated - * @param vnfCreated - * @param msoRequest - * @param volumeGroupName - * @param volumeGroupId - * @param requestType - * @param modelCustomizationUuid - */ - public VnfRollback(String vnfId, String tenantId, String cloudSiteId, - boolean tenantCreated, boolean vnfCreated, - MsoRequest msoRequest, - String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) { - super(); - this.vnfId = vnfId; - this.tenantId = tenantId; - this.cloudSiteId = cloudSiteId; - this.tenantCreated = tenantCreated; - this.vnfCreated = vnfCreated; - this.msoRequest = msoRequest; - this.volumeGroupName = volumeGroupName; - this.volumeGroupId = volumeGroupId; - this.requestType = requestType; - this.modelCustomizationUuid = modelCustomizationUuid; - } - - /** - * For backwards compatibility... orchestration mode defaults to HEAT - * - * @param vnfId - * @param tenantId - * @param cloudSiteId - * @param tenantCreated - * @param vnfCreated - * @param msoRequest - * @param volumeGroupName - * @param volumeGroupId - * @param requestType - * @param modelCustomizationUuid - */ - public VnfRollback(String vnfId, String tenantId, String cloudSiteId, - boolean tenantCreated, boolean vnfCreated, - MsoRequest msoRequest, String volumeGroupName, String volumeGroupId, - String requestType, String modelCustomizationUuid, String orchestrationMode) { - super(); - this.vnfId = vnfId; - this.tenantId = tenantId; - this.cloudSiteId = cloudSiteId; - this.tenantCreated = tenantCreated; - this.vnfCreated = vnfCreated; - this.msoRequest = msoRequest; - this.volumeGroupName = volumeGroupName; - this.volumeGroupId = volumeGroupId; - this.requestType = requestType; - this.modelCustomizationUuid = modelCustomizationUuid; - this.mode = orchestrationMode; - } - - public String getVnfId() { - return vnfId; - } - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getCloudSiteId() { - return cloudSiteId; - } - public void setCloudSiteId(String cloudId) { - this.cloudSiteId = cloudId; - } - public boolean getTenantCreated() { - return tenantCreated; - } - public void setTenantCreated(boolean tenantCreated) { - this.tenantCreated = tenantCreated; - } - public boolean getVnfCreated() { - return vnfCreated; - } - public void setVnfCreated(boolean vnfCreated) { - this.vnfCreated = vnfCreated; - } - public MsoRequest getMsoRequest() { - return msoRequest; - } - public void setMsoRequest (MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - public String getVolumeGroupName() { - return this.volumeGroupName; - } - public void setVolumeGroupName(String volumeGroupName) { - this.volumeGroupName = volumeGroupName; - } - public String getVolumeGroupId() { - return this.volumeGroupId; - } - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - public String getRequestType() { - return this.requestType; - } - public void setRequestType(String requestType) { - this.requestType = requestType; - } - public String getVolumeGroupHeatStackId() { - return this.volumeGroupHeatStackId; - } - public void setVolumeGroupHeatStackId(String volumeGroupHeatStackId) { - this.volumeGroupHeatStackId = volumeGroupHeatStackId; - } - - public String getBaseGroupHeatStackId() { - return this.baseGroupHeatStackId; - } - public void setBaseGroupHeatStackId(String baseGroupHeatStackId) { - this.baseGroupHeatStackId = baseGroupHeatStackId; - } - - public boolean isBase() { - return this.isBase; - } - public void setIsBase(boolean isBase) { - this.isBase = isBase; - } - public String getVfModuleStackId() { - return this.vfModuleStackId; - } - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - public String getMode() { - return this.mode; - } - public void setMode(String mode) { - this.mode = mode; - } - @Override - public String toString() { - return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId + - ", vnf=" + vnfId + ", tenantCreated=" + tenantCreated + - ", vnfCreated=" + vnfCreated + ", requestType = " + requestType - + ", modelCustomizationUuid=" + this.modelCustomizationUuid - + ", mode=" + mode; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java deleted file mode 100644 index 43a6171699..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/CloudConfigInitializer.java +++ /dev/null @@ -1,97 +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.openecomp.mso.openstack.utils; - - -import javax.ejb.EJB; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; - -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudConfigIdentityMapper; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class will attempt to initialize Cloud Config when part of a web application. - * - * - * - */ -@WebListener -public class CloudConfigInitializer implements ServletContextListener -{ - - private CloudConfigFactory cloudConfigFactory=new CloudConfigFactory(); - - public CloudConfigInitializer () { - } - - @Override - public void contextDestroyed(ServletContextEvent event) { - // Nothing to do... - } - - - @Override - public void contextInitialized(ServletContextEvent event) - { - - // Note - this logger may be before or after MSO Logging configuration applied - MsoLogger initLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL); - try { - // Look first in the init-parameters - String msoPropConfigParam = event.getServletContext().getInitParameter("mso.cloud_config.configuration"); - - String[] configFileSplit = msoPropConfigParam.split(","); - for (String msoPropConfig:configFileSplit) { - String[] msoPropDecoded = msoPropConfig.split("="); - - try { - cloudConfigFactory.initializeCloudConfig(msoPropDecoded[0], Integer.valueOf(msoPropDecoded[1])); - initLogger.info(MessageEnum.RA_CONFIG_LOAD, msoPropDecoded[0], "", ""); - initLogger.debug("Mso properties successfully loaded:"+msoPropDecoded[0]+"(Timer(mins):"+Integer.valueOf(msoPropDecoded[1])); - } catch (NumberFormatException ne) { - initLogger.error(MessageEnum.RA_CONFIG_EXC, msoPropDecoded[0] + ". MSO Properties failed due to conversion error (in web.xml file)", "", "", MsoLogger.ErrorCode.DataError, "MSO Properties failed due to conversion error (in web.xml file)", ne); - } - } - - // Second, obtain class name that will register all mappings - String msoMapperClassParam = event.getServletContext().getInitParameter("mso.cloud_config.mapper.class"); - if (msoMapperClassParam != null) { - Class mapperClass = Class.forName(msoMapperClassParam); - if (CloudConfigIdentityMapper.class.isAssignableFrom(mapperClass)) { - ((CloudConfigIdentityMapper)mapperClass.newInstance()).registerAllMappings(); - initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class)","",""); - } else { - initLogger.info(MessageEnum.RA_CONFIG_LOAD,msoMapperClassParam+"(Openstack authentication mapper class not an implementation of CloudConfigIdentityMapper)","",""); - } - } else { - initLogger.info(MessageEnum.RA_CONFIG_LOAD,"Openstack authentication mapper class not specified in web.xml (ONLY core authentication mechanisms will be loaded)","",""); - } - - } - catch (Exception e) { - initLogger.error(MessageEnum.RA_CONFIG_EXC, "Unknown. MSO Properties failed to initialize completely", "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception - MSO Properties failed to initialize completely", e); - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java deleted file mode 100644 index 7d6de317ad..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoCommonUtils.java +++ /dev/null @@ -1,313 +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.openecomp.mso.openstack.utils; - - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import org.openecomp.mso.properties.MsoJavaProperties; -import com.woorea.openstack.base.client.OpenStackBaseException; -import com.woorea.openstack.base.client.OpenStackConnectException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponseException; -import com.woorea.openstack.heat.model.Explanation; -import com.woorea.openstack.keystone.model.Error; -import com.woorea.openstack.quantum.model.NeutronError; - -public class MsoCommonUtils { - - private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - protected static MsoAlarmLogger alarmLogger = new MsoAlarmLogger(); - protected static String retryDelayProp = "ecomp.mso.adapters.po.retryDelay"; - protected static String retryCountProp = "ecomp.mso.adapters.po.retryCount"; - protected static String retryCodesProp = "ecomp.mso.adapters.po.retryCodes"; - protected static int retryDelayDefault = 5; - protected static int retryCountDefault = 3; - protected static String retryCodesDefault = "504"; - - /* - * Method to execute an Openstack command and track its execution time. - * For the metrics log, a category of "Openstack" is used along with a - * sub-category that identifies the specific call (using the real - * openstack-java-sdk classname of the OpenStackRequest parameter). - */ - - protected static T executeAndRecordOpenstackRequest (OpenStackRequest request) - { - return executeAndRecordOpenstackRequest (request, null); - } - protected static T executeAndRecordOpenstackRequest (OpenStackRequest request, MsoJavaProperties msoProps) { - - int limit; - // Get the name and method name of the parent class, which triggered this method - StackTraceElement[] classArr = new Exception ().getStackTrace (); - if (classArr.length >=2) { - limit = 3; - } else { - limit = classArr.length; - } - String parentServiceMethodName = classArr[0].getClassName () + "." + classArr[0].getMethodName (); - for (int i = 1; i < limit; i++) { - String className = classArr[i].getClassName (); - if (!className.equals (MsoCommonUtils.class.getName ())) { - parentServiceMethodName = className + "." + classArr[i].getMethodName (); - break; - } - } - - String requestType; - if (request.getClass ().getEnclosingClass () != null) { - requestType = request.getClass ().getEnclosingClass ().getSimpleName () + "." - + request.getClass ().getSimpleName (); - } else { - requestType = request.getClass ().getSimpleName (); - } - - int retryDelay = retryDelayDefault; - int retryCount = retryCountDefault; - String retryCodes = retryCodesDefault; - if (msoProps != null) //extra check to avoid NPE - { - retryDelay = msoProps.getIntProperty (retryDelayProp, retryDelayDefault); - retryCount = msoProps.getIntProperty (retryCountProp, retryCountDefault); - retryCodes = msoProps.getProperty (retryCodesProp, retryCodesDefault); - } - - // Run the actual command. All exceptions will be propagated - while (true) - { - try { - return request.execute (); - } - catch (OpenStackResponseException e) { - boolean retry = false; - if (retryCodes != null ) { - int code = e.getStatus(); - logger.debug ("Config values RetryDelay:" + retryDelay + " RetryCount:" + retryCount + " RetryCodes:" + retryCodes + " ResponseCode:" + code); - for (String rCode : retryCodes.split (",")) { - try { - if (retryCount > 0 && code == Integer.parseInt (rCode)) - { - retryCount--; - retry = true; - logger.debug ("OpenStackResponseException ResponseCode:" + code + " at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); - break; - } - } catch (NumberFormatException e1) { - logger.error (MessageEnum.RA_CONFIG_EXC, "No retries. Exception in parsing retry code in config:" + rCode, "", "", MsoLogger.ErrorCode.SchemaError, "Exception in parsing retry code in config"); - throw e; - } - } - } - if (retry) - { - try { - Thread.sleep (retryDelay * 1000L); - } catch (InterruptedException e1) { - logger.debug ("Thread interrupted while sleeping", e1); - Thread.currentThread().interrupt(); - } - } - else - throw e; // exceeded retryCount or code is not retryable - } - catch (OpenStackConnectException e) { - // Connection to Openstack failed - if (retryCount > 0) - { - retryCount--; - logger.debug ("OpenstackConnectException at:" + parentServiceMethodName + " request:" + requestType + " Retry indicated. Attempts remaining:" + retryCount); - try { - Thread.sleep (retryDelay * 1000L); - } catch (InterruptedException e1) { - logger.debug ("Thread interrupted while sleeping", e1); - Thread.currentThread().interrupt(); - } - } - else - throw e; - - } - } - } - - /* - * Convert an Openstack Exception on a Keystone call to an MsoException. - * This method supports both OpenstackResponseException and OpenStackConnectException. - */ - protected static MsoException keystoneErrorToMsoException (OpenStackBaseException e, String context) { - MsoException me = null; - - if (e instanceof OpenStackResponseException) { - OpenStackResponseException re = (OpenStackResponseException) e; - - try { - // Failed Keystone calls return an Error entity body. - Error error = re.getResponse ().getErrorEntity (Error.class); - logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Keystone Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone Error on " + context); - me = new MsoOpenstackException (error.getCode (), error.getTitle (), error.getMessage ()); - } catch (Exception e2) { - // Can't parse the body as an "Error". Report the HTTP error - logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "HTTP Error on " + context + ": " + re.getStatus() + "," + re.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "HTTP Error on " + context, e2); - me = new MsoOpenstackException (re.getStatus (), re.getMessage (), ""); - } - - // Add the context of the error - me.addContext (context); - - // Generate an alarm for 5XX and higher errors. - if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("KeystoneError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - } - } else if (e instanceof OpenStackConnectException) { - OpenStackConnectException ce = (OpenStackConnectException) e; - - me = new MsoIOException (ce.getMessage ()); - me.addContext (context); - - // Generate an alarm for all connection errors. - logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "Openstack Keystone connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Keystone connection error on " + context); - alarmLogger.sendAlarm ("KeystoneIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - } - - return me; - } - - /* - * Convert an Openstack Exception on a Heat call to an MsoOpenstackException. - * This method supports both OpenstackResponseException and OpenStackConnectException. - */ - protected MsoException heatExceptionToMsoException (OpenStackBaseException e, String context) { - MsoException me = null; - - if (e instanceof OpenStackResponseException) { - OpenStackResponseException re = (OpenStackResponseException) e; - - try { - // Failed Heat calls return an Explanation entity body. - Explanation explanation = re.getResponse ().getErrorEntity (Explanation.class); - logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error on " + context + ": " + explanation.toString(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - Openstack Error on " + context); - String fullError = explanation.getExplanation() + ", error.type=" + explanation.getError().getType() + ", error.message=" + explanation.getError().getMessage(); - logger.debug(fullError); - me = new MsoOpenstackException (explanation.getCode (), - explanation.getTitle (), - //explanation.getExplanation ()); - fullError); - } catch (Exception e2) { - // Couldn't parse the body as an "Explanation". Report the original HTTP error. - logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception - HTTP Error on " + context, e2); - me = new MsoOpenstackException (re.getStatus (), re.getMessage (), ""); - } - - // Add the context of the error - me.addContext (context); - - // Generate an alarm for 5XX and higher errors. - if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("HeatError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - } - } else if (e instanceof OpenStackConnectException) { - OpenStackConnectException ce = (OpenStackConnectException) e; - - me = new MsoIOException (ce.getMessage ()); - me.addContext (context); - - // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("HeatIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Heat connection error on " + context + ": " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Heat connection error on " + context); - } - - return me; - } - - /* - * Convert an Openstack Exception on a Neutron call to an MsoOpenstackException. - * This method supports both OpenstackResponseException and OpenStackConnectException. - */ - protected MsoException neutronExceptionToMsoException (OpenStackBaseException e, String context) { - MsoException me = null; - - if (e instanceof OpenStackResponseException) { - OpenStackResponseException re = (OpenStackResponseException) e; - - try { - // Failed Neutron calls return an NeutronError entity body - NeutronError error = re.getResponse ().getErrorEntity (NeutronError.class); - logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Error on " + context + ": " + error, "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Error on " + context); - me = new MsoOpenstackException (re.getStatus (), error.getType (), error.getMessage ()); - } catch (Exception e2) { - // Couldn't parse body as a NeutronError. Report the HTTP error. - logger.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "HTTP Error on " + context + ": " + re.getStatus() + "," + e.getMessage(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Openstack HTTP Error on " + context, e2); - me = new MsoOpenstackException (re.getStatus (), re.getMessage (), null); - } - - // Add the context of the error - me.addContext (context); - - // Generate an alarm for 5XX and higher errors. - if (re.getStatus () >= 500) { - alarmLogger.sendAlarm ("NeutronError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - } - } else if (e instanceof OpenStackConnectException) { - OpenStackConnectException ce = (OpenStackConnectException) e; - - me = new MsoIOException (ce.getMessage ()); - me.addContext (context); - - // Generate an alarm for all connection errors. - alarmLogger.sendAlarm ("NeutronIOError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - logger.error(MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Neutron Connection error on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Openstack Neutron Connection error on "+ context); - } - - return me; - } - - /* - * Convert a Java Runtime Exception to an MsoException. - * All Runtime exceptions will be translated into an MsoAdapterException, - * which captures internal errors. - * Alarms will be generated on all such exceptions. - */ - protected MsoException runtimeExceptionToMsoException (RuntimeException e, String context) { - MsoAdapterException me = new MsoAdapterException (e.getMessage (), e); - me.addContext (context); - me.setCategory (MsoExceptionCategory.INTERNAL); - - // Always generate an alarm for internal exceptions - logger.error(MessageEnum.RA_GENERAL_EXCEPTION_ARG, "An exception occured on "+ context + ": " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "An exception occured on "+ context); - alarmLogger.sendAlarm ("AdapterInternalError", MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - - return me; - } - - public static boolean isNullOrEmpty (String s) { - return s == null || s.isEmpty(); - } - - - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java deleted file mode 100644 index 7046096979..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntry.java +++ /dev/null @@ -1,263 +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.openecomp.mso.openstack.utils; - - -import java.util.HashSet; -import java.util.ArrayList; -import java.util.Set; - -import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; -import org.openecomp.mso.logger.MsoLogger; - -public class MsoHeatEnvironmentEntry { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - - private Set parameters = null; - private Set resources = null; - private StringBuilder rawEntry = null; - private boolean valid = true; - private String errorString = null; - private StringBuilder resourceRegistryEntryRaw = null; - - public MsoHeatEnvironmentEntry() { - super(); - } - - public MsoHeatEnvironmentEntry(StringBuilder sb) { - this(); - this.rawEntry = sb; - this.processRawEntry(); - } - - private void processRawEntry() { - try { - if (this.rawEntry == null || "".equals(this.rawEntry)) - return; - byte[] b = this.rawEntry.toString().getBytes(); - MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(b); - this.parameters = yaml.getParameterListFromEnvt(); - //this.resources = yaml.getResourceListFromEnvt(); - StringBuilder sb = this.getResourceRegistryRawEntry(); - if (sb == null) { - this.resourceRegistryEntryRaw = new StringBuilder(""); - } else { - this.resourceRegistryEntryRaw = sb; - } - } catch (Exception e) { - LOGGER.debug("Exception:", e); - this.valid = false; - this.errorString = e.getMessage(); - //e.printStackTrace(); - } - } - - public boolean isValid() { - return this.valid; - } - - public String getErrorString() { - return this.errorString; - } - - public Set getParameters() { - return this.parameters; - } - - public Set getResources() { - return this.resources; - } - - public void setParameters(Set paramSet) { - if (paramSet == null) { - this.parameters = null; - } else { - this.parameters = paramSet; - } - } - - public void setResources(Set resourceSet) { - if (resourceSet == null) { - this.resources = null; - } else { - this.resources = resourceSet; - } - } - - public void addParameter(MsoHeatEnvironmentParameter hep) { - if (this.parameters == null) { - this.parameters = new HashSet<>(); - } - this.parameters.add(hep); - } - - public void addResource(MsoHeatEnvironmentResource her) { - if (this.resources == null) { - this.resources = new HashSet<>(); - } - this.resources.add(her); - } - - public int getNumberOfParameters() { - return this.parameters.size(); - } - - public int getNumberOfResources() { - return this.resources.size(); - } - - public boolean hasResources() { - if (this.resources != null && this.resources.size() > 0) { - return true; - } - return false; - } - - public boolean hasParameters() { - if (this.parameters != null && this.parameters.size() > 0) { - return true; - } - return false; - } - - public boolean containsParameter(String paramName) { - boolean contains = false; - if (this.parameters == null || this.parameters.size() < 1) { - return false; - } - if (this.parameters.contains(new MsoHeatEnvironmentParameter(paramName))) { - contains = true; - } - return contains; - } - - public boolean containsParameter(String paramName, String paramAlias) { - if (this.containsParameter(paramName)) { - return true; - } - if (this.containsParameter(paramAlias)) { - return true; - } - return false; - } - - @Override - public String toString() { - return "MsoHeatEnvironmentEntry{" + "parameters=" + parameters + - ", resourceRegistryEntryRaw='" + resourceRegistryEntryRaw + '\'' + - '}'; - } - - public StringBuilder toFullStringExcludeNonParams(Set params) { - // Basically give back the envt - but exclude the params that aren't in the HeatTemplate - - StringBuilder sb = new StringBuilder(); - ArrayList paramNameList = new ArrayList(params.size()); - for (HeatTemplateParam htp : params) { - paramNameList.add(htp.getParamName()); - } - - if (this.hasParameters()) { - sb.append("parameters:\n"); - for (MsoHeatEnvironmentParameter hep : this.parameters) { - String paramName = hep.getName(); - if (paramNameList.contains(paramName)) { - // This parameter *is* in the Heat Template - so include it: - sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n"); - // New - 1607 - if any of the params mapped badly - JUST RETURN THE ORIGINAL ENVT! - if (hep.getValue().startsWith("_BAD")) { - return this.rawEntry; - } - } - } - sb.append("\n"); - } -// if (this.hasResources()) { -// sb.append("resource_registry:\n"); -// for (MsoHeatEnvironmentResource her : this.resources) { -// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n"); -// } -// } - sb.append("\n"); - sb.append(this.resourceRegistryEntryRaw); - return sb; - } - - public StringBuilder toFullString() { - StringBuilder sb = new StringBuilder(); - - if (this.hasParameters()) { - sb.append("parameters:\n"); - for (MsoHeatEnvironmentParameter hep : this.parameters) { - sb.append(" " + hep.getName() + ": " + hep.getValue() + "\n"); - } - sb.append("\n"); - } -// if (this.hasResources()) { -// sb.append("resource_registry:\n"); -// for (MsoHeatEnvironmentResource her : this.resources) { -// sb.append(" \"" + her.getName() + "\": " + her.getValue() + "\n"); -// } -// } - sb.append("\n"); - sb.append(this.resourceRegistryEntryRaw); - return sb; - } - - public StringBuilder getRawEntry() { - return this.rawEntry; - } - - private StringBuilder getResourceRegistryRawEntry() { - - if (this.rawEntry == null) { - return null; - } - - StringBuilder sb = new StringBuilder(); - int indexOf = this.rawEntry.indexOf("resource_registry:"); - if (indexOf < 0) { // no resource_registry: - return null; - } - sb.append(this.rawEntry.substring(indexOf)); - return sb; - } - - public void setHPAParameters(StringBuilder hpasb) { - try { - MsoYamlEditorWithEnvt yaml = new MsoYamlEditorWithEnvt(hpasb.toString().getBytes()); - Set hpaParams = yaml.getParameterListFromEnvt(); - for (MsoHeatEnvironmentParameter hpaparam : hpaParams) { - for (MsoHeatEnvironmentParameter param : this.parameters) { - if (param.getName() == hpaparam.getName()) { - param.setValue(hpaparam.getValue()); - } - } - } - } catch (Exception e) { - LOGGER.debug("Exception:", e); - this.errorString = e.getMessage(); - //e.printStackTrace(); - } - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java deleted file mode 100644 index cd1a3e5130..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameter.java +++ /dev/null @@ -1,77 +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.openecomp.mso.openstack.utils; - -import java.util.Objects; - -public class MsoHeatEnvironmentParameter { - - private String name; - private String value; - - public MsoHeatEnvironmentParameter(String name, String value) { - super(); - this.name = name; - this.value = value; - } - public MsoHeatEnvironmentParameter(String name) { - // Allow to initialize with a null value - this(name, null); - } - public MsoHeatEnvironmentParameter() { - this(null, null); - } - - public String getName() { - return this.name; - } - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return this.value; - } - public void setValue(String value) { - this.value = value; - } - public String toString() { - return this.name + ": " + this.value; - } - - public boolean equals(Object o) { - if (!(o instanceof MsoHeatEnvironmentParameter)) { - return false; - } - if (this == o) { - return true; - } - MsoHeatEnvironmentParameter hep = (MsoHeatEnvironmentParameter) o; - // If the name of the parameter is the same, then they're equal - return hep.getName().equals(this.getName()); - } - - public int hashCode() { - return Objects.hashCode(this.name); - } - - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java deleted file mode 100644 index a0c9b7a105..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResource.java +++ /dev/null @@ -1,96 +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.openecomp.mso.openstack.utils; - -import org.openecomp.mso.logger.MsoLogger; - -public class MsoHeatEnvironmentResource { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - private String name; - private String value; - - public MsoHeatEnvironmentResource(String name, String value) { - super(); - this.name = name; - this.value = value; - } - public MsoHeatEnvironmentResource(String name) { - // Allow to initialize with a null value - this(name, null); - } - public MsoHeatEnvironmentResource() { - this(null, null); - } - - public String getName() { - return this.name; - } - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return this.value; - } - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "\"" + - this.name + - "\": " + - this.value; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof MsoHeatEnvironmentResource)) { - return false; - } - if (this == o) { - return true; - } - MsoHeatEnvironmentResource her = (MsoHeatEnvironmentResource) o; - // If the name of the parameter is the same, then they're equal - if (her.getName().equals(this.getName())) { - return true; - } - return false; - } - - @Override - public int hashCode() { - int result = 0; - try { - result = this.name.hashCode(); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - return result; - } - - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java deleted file mode 100644 index f7723b6a8f..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtils.java +++ /dev/null @@ -1,1860 +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.openecomp.mso.openstack.utils; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.openecomp.mso.adapters.vdu.CloudInfo; -import org.openecomp.mso.adapters.vdu.PluginAction; -import org.openecomp.mso.adapters.vdu.VduArtifact; -import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; -import org.openecomp.mso.adapters.vdu.VduException; -import org.openecomp.mso.adapters.vdu.VduInstance; -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.adapters.vdu.VduPlugin; -import org.openecomp.mso.adapters.vdu.VduStateType; -import org.openecomp.mso.adapters.vdu.VduStatus; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.db.catalog.beans.HeatTemplate; -import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.HeatStatus; -import org.openecomp.mso.openstack.beans.StackInfo; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists; -import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.woorea.openstack.base.client.OpenStackConnectException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponseException; -import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.model.CreateStackParam; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.heat.model.Stack.Output; -import com.woorea.openstack.heat.model.Stacks; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.utils.KeystoneUtils; - -public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ - - private MsoPropertiesFactory msoPropertiesFactory; - - private CloudConfigFactory cloudConfigFactory; - - private static final String TOKEN_AUTH = "TokenAuth"; - - private static final String QUERY_ALL_STACKS = "QueryAllStacks"; - - private static final String DELETE_STACK = "DeleteStack"; - - private static final String HEAT_ERROR = "HeatError"; - - private static final String CREATE_STACK = "CreateStack"; - - // Cache Heat Clients statically. Since there is just one MSO user, there is no - // benefit to re-authentication on every request (or across different flows). The - // token will be used until it expires. - // - // The cache key is "tenantId:cloudId" - private static Map heatClientCache = new HashMap <> (); - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - protected MsoJavaProperties msoProps = null; - - // Properties names and variables (with default values) - protected String createPollIntervalProp = "ecomp.mso.adapters.heat.create.pollInterval"; - private String deletePollIntervalProp = "ecomp.mso.adapters.heat.delete.pollInterval"; - private String deletePollTimeoutProp = "ecomp.mso.adapters.heat.delete.pollTimeout"; - - protected int createPollIntervalDefault = 15; - private int deletePollIntervalDefault = 15; - private int deletePollTimeoutDefault = 300; - private String msoPropID; - - private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - - /** - * This constructor MUST be used ONLY in the JUNIT tests, not for real code. - */ - public MsoHeatUtils() { - - } - - /** - * This constructor MUST be used ONLY in the JUNIT tests, not for real code. - * The MsoPropertiesFactory will be added by EJB injection. - * - * @param msoPropID ID of the mso pro config as defined in web.xml - * @param msoPropFactory The mso properties factory instanciated by EJB injection - * @param cloudConfFactory the Cloud Config instantiated by EJB injection - */ - public MsoHeatUtils (String msoPropID, MsoPropertiesFactory msoPropFactory, CloudConfigFactory cloudConfFactory) { - msoPropertiesFactory = msoPropFactory; - cloudConfigFactory = cloudConfFactory; - this.msoPropID = msoPropID; - // Dynamically get properties each time (in case reloaded). - - try { - msoProps = msoPropertiesFactory.getMsoJavaProperties (msoPropID); - } catch (MsoPropertiesException e) { - LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - } - LOGGER.debug("MsoHeatUtils:" + msoPropID); - } - - protected CloudConfigFactory getCloudConfigFactory() { - return cloudConfigFactory; - } - - /** - * keep this old method signature here to maintain backwards compatibility. keep others as well. - * this method does not include environment, files, or heatFiles - */ - public StackInfo createStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes) throws MsoException { - // Just call the new method with the environment & files variable set to null - return this.createStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - null, - null, - null, - true); - } - - // This method has environment, but not files or heatFiles - public StackInfo createStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment) throws MsoException { - // Just call the new method with the files/heatFiles variables set to null - return this.createStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - environment, - null, - null, - true); - } - - // This method has environment and files, but not heatFiles. - public StackInfo createStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment, - Map files) throws MsoException { - return this.createStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - environment, - files, - null, - true); - } - - // This method has environment, files, heatfiles - public StackInfo createStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment, - Map files, - Map heatFiles) throws MsoException { - return this.createStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - environment, - files, - heatFiles, - true); - } - - /** - * Create a new Stack in the specified cloud location and tenant. The Heat template - * and parameter map are passed in as arguments, along with the cloud access credentials. - * It is expected that parameters have been validated and contain at minimum the required - * parameters for the given template with no extra (undefined) parameters.. - * - * The Stack name supplied by the caller must be unique in the scope of this tenant. - * However, it should also be globally unique, as it will be the identifier for the - * resource going forward in Inventory. This latter is managed by the higher levels - * invoking this function. - * - * The caller may choose to let this function poll Openstack for completion of the - * stack creation, or may handle polling itself via separate calls to query the status. - * In either case, a StackInfo object will be returned containing the current status. - * When polling is enabled, a status of CREATED is expected. When not polling, a - * status of BUILDING is expected. - * - * An error will be thrown if the requested Stack already exists in the specified - * Tenant and Cloud. - * - * For 1510 - add "environment", "files" (nested templates), and "heatFiles" (get_files) as - * parameters for createStack. If environment is non-null, it will be added to the stack. - * The nested templates and get_file entries both end up being added to the "files" on the - * stack. We must combine them before we add them to the stack if they're both non-null. - * - * @param cloudSiteId The cloud (may be a region) in which to create the stack. - * @param tenantId The Openstack ID of the tenant in which to create the Stack - * @param stackName The name of the stack to create - * @param heatTemplate The Heat template - * @param stackInputs A map of key/value inputs - * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client - * @param environment An optional yaml-format string to specify environmental parameters - * @param files a Map that lists the child template IDs (file is the string, object is an int of - * Template id) - * @param heatFiles a Map that lists the get_file entries (fileName, fileBody) - * @param backout Donot delete stack on create Failure - defaulted to True - * @return A StackInfo object - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. - */ - - @SuppressWarnings("unchecked") - public StackInfo createStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment, - Map files, - Map heatFiles, - boolean backout) throws MsoException { - // Create local variables checking to see if we have an environment, nested, get_files - // Could later add some checks to see if it's valid. - boolean haveEnvtVariable = true; - if (environment == null || "".equalsIgnoreCase (environment.trim ())) { - haveEnvtVariable = false; - LOGGER.debug ("createStack called with no environment variable"); - } else { - LOGGER.debug ("createStack called with an environment variable: " + environment); - } - - boolean haveFiles = true; - if (files == null || files.isEmpty ()) { - haveFiles = false; - LOGGER.debug ("createStack called with no files / child template ids"); - } else { - LOGGER.debug ("createStack called with " + files.size () + " files / child template ids"); - } - - boolean haveHeatFiles = true; - if (heatFiles == null || heatFiles.isEmpty ()) { - haveHeatFiles = false; - LOGGER.debug ("createStack called with no heatFiles"); - } else { - LOGGER.debug ("createStack called with " + heatFiles.size () + " heatFiles"); - } - - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - LOGGER.debug("Found: " + cloudSite.toString()); - // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) - // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated) - Heat heatClient = getHeatClient (cloudSite, tenantId); - if (heatClient != null) { - LOGGER.debug("Found: " + heatClient.toString()); - } - - LOGGER.debug ("Ready to Create Stack (" + heatTemplate + ") with input params: " + stackInputs); - - // Build up the stack to create - // Disable auto-rollback, because error reason is lost. Always rollback in the code. - CreateStackParam stack = new CreateStackParam (); - stack.setStackName (stackName); - stack.setTimeoutMinutes (timeoutMinutes); - stack.setParameters ((Map ) stackInputs); - stack.setTemplate (heatTemplate); - stack.setDisableRollback (true); - // TJM New for PO Adapter - add envt variable - if (haveEnvtVariable) { - LOGGER.debug ("Found an environment variable - value: " + environment); - stack.setEnvironment (environment); - } - // Now handle nested templates or get_files - have to combine if we have both - // as they're both treated as "files:" on the stack. - if (haveFiles && haveHeatFiles) { - // Let's do this here - not in the bean - LOGGER.debug ("Found files AND heatFiles - combine and add!"); - Map combinedFiles = new HashMap <> (); - for (String keyString : files.keySet ()) { - combinedFiles.put (keyString, files.get (keyString)); - } - for (String keyString : heatFiles.keySet ()) { - combinedFiles.put (keyString, heatFiles.get (keyString)); - } - stack.setFiles (combinedFiles); - } else { - // Handle if we only have one or neither: - if (haveFiles) { - LOGGER.debug ("Found files - adding to stack"); - stack.setFiles (files); - } - if (haveHeatFiles) { - LOGGER.debug ("Found heatFiles - adding to stack"); - // the setFiles was modified to handle adding the entries - stack.setFiles (heatFiles); - } - } - - // 1802 - attempt to add better formatted printout of request to openstack - try { - Map inputs = new HashMap(); - for (String key : stackInputs.keySet()) { - Object o = (Object) stackInputs.get(key); - if (o != null) { - inputs.put(key, o); - } - } - LOGGER.debug(this.printStackRequest(tenantId, heatFiles, files, environment, inputs, stackName, heatTemplate, timeoutMinutes, backout, cloudSiteId)); - } catch (Exception e) { - // that's okay - this is a nice-to-have - LOGGER.debug("(had an issue printing nicely formatted request to debuglog) " + e.getMessage()); - } - - Stack heatStack = null; - try { - // Execute the actual Openstack command to create the Heat stack - OpenStackRequest request = heatClient.getStacks ().create (stack); - // Begin X-Auth-User - // Obtain an MSO token for the tenant - CloudIdentity cloudIdentity = cloudSite.getIdentityService (); - // cloudIdentity.getMsoId(), cloudIdentity.getMsoPass() - //req - request.header ("X-Auth-User", cloudIdentity.getMsoId ()); - request.header ("X-Auth-Key", cloudIdentity.getMsoPass ()); - LOGGER.debug ("headers added, about to executeAndRecordOpenstackRequest"); - //LOGGER.debug(this.requestToStringBuilder(stack).toString()); - // END - try to fix X-Auth-User - heatStack = executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - // Since this came on the 'Create Stack' command, nothing was changed - // in the cloud. Return the error as an exception. - if (e.getStatus () == 409) { - // Stack already exists. Return a specific error for this case - MsoStackAlreadyExists me = new MsoStackAlreadyExists (stackName, tenantId, cloudSiteId); - me.addContext (CREATE_STACK); - throw me; - } else { - // Convert the OpenStackResponseException to an MsoOpenstackException - LOGGER.debug("ERROR STATUS = " + e.getStatus() + ",\n" + e.getMessage() + "\n" + e.getLocalizedMessage()); - throw heatExceptionToMsoException (e, CREATE_STACK); - } - } catch (OpenStackConnectException e) { - // Error connecting to Openstack instance. Convert to an MsoException - throw heatExceptionToMsoException (e, CREATE_STACK); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, CREATE_STACK); - } - - // Subsequent access by the canonical name "/". - // Otherwise, simple query by name returns a 302 redirect. - // NOTE: This is specific to the v1 Orchestration API. - String canonicalName = stackName + "/" + heatStack.getId (); - - // If client has requested a final response, poll for stack completion - if (pollForCompletion) { - // Set a time limit on overall polling. - // Use the resource (template) timeout for Openstack (expressed in minutes) - // and add one poll interval to give Openstack a chance to fail on its own. - int createPollInterval = msoProps.getIntProperty (createPollIntervalProp, createPollIntervalDefault); - int pollTimeout = (timeoutMinutes * 60) + createPollInterval; - // New 1610 - poll on delete if we rollback - use same values for now - int deletePollInterval = createPollInterval; - int deletePollTimeout = pollTimeout; - boolean createTimedOut = false; - StringBuilder stackErrorStatusReason = new StringBuilder(""); - LOGGER.debug("createPollInterval=" + createPollInterval + ", pollTimeout=" + pollTimeout); - - while (true) { - try { - heatStack = queryHeatStack (heatClient, canonicalName); - LOGGER.debug (heatStack.getStackStatus () + " (" + canonicalName + ")"); - try { - LOGGER.debug("Current stack " + this.getOutputsAsStringBuilder(heatStack).toString()); - } catch (Exception e) { - LOGGER.debug("an error occurred trying to print out the current outputs of the stack", e); - } - - if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) { - // Stack creation is still running. - // Sleep and try again unless timeout has been reached - if (pollTimeout <= 0) { - // Note that this should not occur, since there is a timeout specified - // in the Openstack call. - LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Create stack timeout"); - createTimedOut = true; - break; - } - try { - Thread.sleep (createPollInterval * 1000L); - } catch (InterruptedException e) { - LOGGER.debug ("Thread interrupted while sleeping", e); - } - - pollTimeout -= createPollInterval; - LOGGER.debug("pollTimeout remaining: " + pollTimeout); - } else { - //save off the status & reason msg before we attempt delete - stackErrorStatusReason.append("Stack error (" + heatStack.getStackStatus() + "): " + heatStack.getStackStatusReason()); - break; - } - } catch (MsoException me) { - // Cannot query the stack status. Something is wrong. - // Try to roll back the stack - if (!backout) - { - LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack, stack deletion suppressed"); - } - else - { - try { - LOGGER.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + canonicalName + " - This will likely fail and/or we won't be able to query to see if delete worked"); - OpenStackRequest request = heatClient.getStacks ().deleteByName (canonicalName); - executeAndRecordOpenstackRequest (request, msoProps); - // this may be a waste of time - if we just got an exception trying to query the stack - we'll just - // get another one, n'est-ce pas? - boolean deleted = false; - while (!deleted) { - try { - heatStack = queryHeatStack(heatClient, canonicalName); - if (heatStack != null) { - LOGGER.debug(heatStack.getStackStatus()); - if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) { - if (deletePollTimeout <= 0) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, - "Rollback: DELETE stack timeout"); - break; - } else { - try { - Thread.sleep(deletePollInterval * 1000L); - } catch (InterruptedException ie) { - LOGGER.debug("Thread interrupted while sleeping", ie); - } - deletePollTimeout -= deletePollInterval; - } - } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())){ - LOGGER.debug("DELETE_COMPLETE for " + canonicalName); - deleted = true; - continue; - } else { - //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate - break; - } - } else { - // assume if we can't find it - it's deleted - LOGGER.debug("heatStack returned null - assume the stack " + canonicalName + " has been deleted"); - deleted = true; - continue; - } - - } catch (Exception e3) { - // Just log this one. We will report the original exception. - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e3, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack on error on query"); - - } - } - } catch (Exception e2) { - // Just log this one. We will report the original exception. - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack: Nested exception rolling back stack"); - } - } - - // Propagate the original exception from Stack Query. - me.addContext (CREATE_STACK); - throw me; - } - } - - if (!"CREATE_COMPLETE".equals (heatStack.getStackStatus ())) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack error: Polling complete with non-success status: " - + heatStack.getStackStatus () + ", " + heatStack.getStackStatusReason (), "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error"); - - // Rollback the stack creation, since it is in an indeterminate state. - if (!backout) - { - LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion suppressed", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion suppressed"); - } - else - { - try { - LOGGER.debug("Create Stack errored - attempting to DELETE stack: " + canonicalName); - LOGGER.debug("deletePollInterval=" + deletePollInterval + ", deletePollTimeout=" + deletePollTimeout); - OpenStackRequest request = heatClient.getStacks ().deleteByName (canonicalName); - executeAndRecordOpenstackRequest (request, msoProps); - boolean deleted = false; - while (!deleted) { - try { - heatStack = queryHeatStack(heatClient, canonicalName); - if (heatStack != null) { - LOGGER.debug(heatStack.getStackStatus() + " (" + canonicalName + ")"); - if ("DELETE_IN_PROGRESS".equals(heatStack.getStackStatus())) { - if (deletePollTimeout <= 0) { - LOGGER.error (MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, - heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, - "Rollback: DELETE stack timeout"); - break; - } else { - try { - Thread.sleep(deletePollInterval * 1000L); - } catch (InterruptedException ie) { - LOGGER.debug("Thread interrupted while sleeping", ie); - } - deletePollTimeout -= deletePollInterval; - LOGGER.debug("deletePollTimeout remaining: " + deletePollTimeout); - } - } else if ("DELETE_COMPLETE".equals(heatStack.getStackStatus())){ - LOGGER.debug("DELETE_COMPLETE for " + canonicalName); - deleted = true; - continue; - } else if ("DELETE_FAILED".equals(heatStack.getStackStatus())) { - // Warn about this (?) - but still throw the original exception - LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, stack deletion FAILED", "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Create Stack error, stack deletion FAILED"); - LOGGER.debug("Stack deletion FAILED on a rollback of a create - " + canonicalName + ", status=" + heatStack.getStackStatus() + ", reason=" + heatStack.getStackStatusReason()); - break; - } else { - //got a status other than DELETE_IN_PROGRESS or DELETE_COMPLETE - so break and evaluate - break; - } - } else { - // assume if we can't find it - it's deleted - LOGGER.debug("heatStack returned null - assume the stack " + canonicalName + " has been deleted"); - deleted = true; - continue; - } - - } catch (MsoException me2) { - // We got an exception on the delete - don't throw this exception - throw the original - just log. - LOGGER.debug("Exception thrown trying to delete " + canonicalName + " on a create->rollback: " + me2.getContextMessage(), me2); - LOGGER.warn(MessageEnum.RA_CREATE_STACK_ERR, "Create Stack errored, then stack deletion FAILED - exception thrown", "", "", MsoLogger.ErrorCode.BusinessProcesssError, me2.getContextMessage()); - } - - } // end while !deleted - StringBuilder errorContextMessage; - if (createTimedOut) { - errorContextMessage = new StringBuilder("Stack Creation Timeout"); - } else { - errorContextMessage = stackErrorStatusReason; - } - if (deleted) { - errorContextMessage.append(" - stack successfully deleted"); - } else { - errorContextMessage.append(" - encountered an error trying to delete the stack"); - } -// MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); - // me.addContext(CREATE_STACK); - // alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - // throw me; - } catch (Exception e2) { - // shouldn't happen - but handle - LOGGER.error (MessageEnum.RA_CREATE_STACK_ERR, "Create Stack: Nested exception rolling back stack: " + e2, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in Create Stack: rolling back stack"); - } - } - MsoOpenstackException me = new MsoOpenstackException(0, "", stackErrorStatusReason.toString()); - me.addContext(CREATE_STACK); - alarmLogger.sendAlarm(HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage()); - throw me; - } - - } else { - // Get initial status, since it will have been null after the create. - heatStack = queryHeatStack (heatClient, canonicalName); - LOGGER.debug (heatStack.getStackStatus ()); - } - - return new StackInfo (heatStack); - } - - /** - * Query for a single stack (by Name) in a tenant. This call will always return a - * StackInfo object. If the stack does not exist, an "empty" StackInfo will be - * returned - containing only the stack name and a status of NOTFOUND. - * - * @param tenantId The Openstack ID of the tenant in which to query - * @param cloudSiteId The cloud identifier (may be a region) in which to query - * @param stackName The name of the stack to query (may be simple or canonical) - * @return A StackInfo object - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. - */ - public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException { - LOGGER.debug ("Query HEAT stack: " + stackName + " in tenant " + tenantId); - - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - LOGGER.debug("Found: " + cloudSite.toString()); - - // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) - Heat heatClient = null; - try { - heatClient = getHeatClient (cloudSite, tenantId); - if (heatClient != null) { - LOGGER.debug("Found: " + heatClient.toString()); - } - } catch (MsoTenantNotFound e) { - // Tenant doesn't exist, so stack doesn't either - LOGGER.debug ("Tenant with id " + tenantId + "not found.", e); - return new StackInfo (stackName, HeatStatus.NOTFOUND); - } catch (MsoException me) { - // Got an Openstack error. Propagate it - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Exception on Token request: " + me, "Openstack", "", MsoLogger.ErrorCode.AvailabilityError, "Connection Exception"); - me.addContext ("QueryStack"); - throw me; - } - - // Query the Stack. - // An MsoException will propagate transparently to the caller. - Stack heatStack = queryHeatStack (heatClient, stackName); - - if (heatStack == null) { - // Stack does not exist. Return a StackInfo with status NOTFOUND - StackInfo stackInfo = new StackInfo (stackName, HeatStatus.NOTFOUND); - return stackInfo; - } - - return new StackInfo (heatStack); - } - - /** - * Delete a stack (by Name/ID) in a tenant. If the stack is not found, it will be - * considered a successful deletion. The return value is a StackInfo object which - * contains the current stack status. - * - * The client may choose to let the adapter poll Openstack for completion of the - * stack deletion, or may handle polling itself via separate query calls. In either - * case, a StackInfo object will be returned. When polling is enabled, a final - * status of NOTFOUND is expected. When not polling, a status of DELETING is expected. - * - * There is no rollback from a successful stack deletion. A deletion failure will - * also result in an undefined stack state - the components may or may not have been - * all or partially deleted, so the resulting stack must be considered invalid. - * - * @param tenantId The Openstack ID of the tenant in which to perform the delete - * @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack. - * @param stackName The name/id of the stack to delete. May be simple or canonical - * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client - * @return A StackInfo object - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. - * @throws MsoCloudSiteNotFound - */ - public StackInfo deleteStack (String tenantId, - String cloudSiteId, - String stackName, - boolean pollForCompletion) throws MsoException { - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - LOGGER.debug("Found: " + cloudSite.toString()); - - // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) - Heat heatClient = null; - try { - heatClient = getHeatClient (cloudSite, tenantId); - if (heatClient != null) { - LOGGER.debug("Found: " + heatClient.toString()); - } - } catch (MsoTenantNotFound e) { - // Tenant doesn't exist, so stack doesn't either - LOGGER.debug ("Tenant with id " + tenantId + "not found.", e); - return new StackInfo (stackName, HeatStatus.NOTFOUND); - } catch (MsoException me) { - // Got an Openstack error. Propagate it - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack", "Openstack Exception on Token request: " + me, "Openstack", "", MsoLogger.ErrorCode.AvailabilityError, "Connection Exception"); - me.addContext (DELETE_STACK); - throw me; - } - - // OK if stack not found, perform a query first - Stack heatStack = queryHeatStack (heatClient, stackName); - if (heatStack == null || "DELETE_COMPLETE".equals (heatStack.getStackStatus ())) { - // Not found. Return a StackInfo with status NOTFOUND - return new StackInfo (stackName, HeatStatus.NOTFOUND); - } - - // Delete the stack. - - // Use canonical name "/" to delete. - // Otherwise, deletion by name returns a 302 redirect. - // NOTE: This is specific to the v1 Orchestration API. - String canonicalName = heatStack.getStackName () + "/" + heatStack.getId (); - - try { - OpenStackRequest request = null; - if(null != heatClient) { - request = heatClient.getStacks ().deleteByName (canonicalName); - } - else { - LOGGER.debug ("Heat Client is NULL" ); - } - - executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - // Not found. We are OK with this. Return a StackInfo with status NOTFOUND - return new StackInfo (stackName, HeatStatus.NOTFOUND); - } else { - // Convert the OpenStackResponseException to an MsoOpenstackException - throw heatExceptionToMsoException (e, DELETE_STACK); - } - } catch (OpenStackConnectException e) { - // Error connecting to Openstack instance. Convert to an MsoException - throw heatExceptionToMsoException (e, DELETE_STACK); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, DELETE_STACK); - } - - // Requery the stack for current status. - // It will probably still exist with "DELETE_IN_PROGRESS" status. - heatStack = queryHeatStack (heatClient, canonicalName); - - if (pollForCompletion) { - // Set a timeout on polling - int pollInterval = msoProps.getIntProperty (deletePollIntervalProp, deletePollIntervalDefault); - int pollTimeout = msoProps.getIntProperty (deletePollTimeoutProp, deletePollTimeoutDefault); - - // When querying by canonical name, Openstack returns DELETE_COMPLETE status - // instead of "404" (which would result from query by stack name). - while (heatStack != null && !"DELETE_COMPLETE".equals (heatStack.getStackStatus ())) { - LOGGER.debug ("Stack status: " + heatStack.getStackStatus ()); - - if ("DELETE_FAILED".equals (heatStack.getStackStatus ())) { - // Throw a 'special case' of MsoOpenstackException to report the Heat status - String error = "Stack delete error (" + heatStack.getStackStatus () - + "): " - + heatStack.getStackStatusReason (); - MsoOpenstackException me = new MsoOpenstackException (0, "", error); - me.addContext (DELETE_STACK); - - // Alarm this condition, stack deletion failed - alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - - throw me; - } - - if (pollTimeout <= 0) { - LOGGER.error (MessageEnum.RA_DELETE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, heatStack.getStackStatus (), "", "", MsoLogger.ErrorCode.AvailabilityError, "Delete Stack Timeout"); - - // Throw a 'special case' of MsoOpenstackException to report the Heat status - MsoOpenstackException me = new MsoOpenstackException (0, "", "Stack Deletion Timeout"); - me.addContext (DELETE_STACK); - - // Alarm this condition, stack deletion failed - alarmLogger.sendAlarm (HEAT_ERROR, MsoAlarmLogger.CRITICAL, me.getContextMessage ()); - - throw me; - } - - try { - Thread.sleep (pollInterval * 1000L); - } catch (InterruptedException e) { - LOGGER.debug ("Thread interrupted while sleeping", e); - } - - pollTimeout -= pollInterval; - - heatStack = queryHeatStack (heatClient, canonicalName); - } - - // The stack is gone when this point is reached - return new StackInfo (stackName, HeatStatus.NOTFOUND); - } - - // Return the current status (if not polling, the delete may still be in progress) - StackInfo stackInfo = new StackInfo (heatStack); - stackInfo.setName (stackName); - - return stackInfo; - } - - /** - * Query for all stacks in a tenant site. This call will return a List of StackInfo - * objects, one for each deployed stack. - * - * Note that this is limited to a single site. To ensure that a tenant is truly - * empty would require looping across all tenant endpoints. - * - * @param tenantId The Openstack ID of the tenant to query - * @param cloudSiteId The cloud identifier (may be a region) in which to query. - * @return A List of StackInfo objects - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception. - * @throws MsoCloudSiteNotFound - */ - public List queryAllStacks (String tenantId, String cloudSiteId) throws MsoException { - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) - Heat heatClient = getHeatClient (cloudSite, tenantId); - - try { - OpenStackRequest request = heatClient.getStacks ().list (); - Stacks stacks = executeAndRecordOpenstackRequest (request, msoProps); - - List stackList = new ArrayList <> (); - - // Not sure if returns an empty list or null if no stacks exist - if (stacks != null) { - for (Stack stack : stacks) { - stackList.add (new StackInfo (stack)); - } - } - - return stackList; - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - // Not sure if this can happen, but return an empty list - LOGGER.debug ("queryAllStacks - stack not found: "); - return new ArrayList <> (); - } else { - // Convert the OpenStackResponseException to an MsoOpenstackException - throw heatExceptionToMsoException (e, QUERY_ALL_STACKS); - } - } catch (OpenStackConnectException e) { - // Error connecting to Openstack instance. Convert to an MsoException - throw heatExceptionToMsoException (e, QUERY_ALL_STACKS); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, QUERY_ALL_STACKS); - } - } - - /** - * Validate parameters to be passed to Heat template. This method performs - * three functions: - * 1. Apply default values to parameters which have them defined - * 2. Report any required parameters that are missing. This will generate an - * exception in the caller, since stack create/update operations would fail. - * 3. Report and remove any extraneous parameters. This will allow clients to - * pass supersets of parameters and not get errors. - * - * These functions depend on the HeatTemplate definition from the MSO Catalog DB, - * along with the input parameter Map. The output is an updated parameter map. - * If the parameters are invalid for the template, an IllegalArgumentException - * is thrown. - */ - public Map validateStackParams (Map inputParams, - HeatTemplate heatTemplate) throws IllegalArgumentException { - // Check that required parameters have been supplied for this template type - StringBuilder missingParams = null; - List paramList = new ArrayList <> (); - - // TODO: Enhance DB to support defaults for Heat Template parameters - - for (HeatTemplateParam parm : heatTemplate.getParameters ()) { - if (parm.isRequired () && !inputParams.containsKey (parm.getParamName ())) { - if (missingParams == null) { - missingParams = new StringBuilder(parm.getParamName()); - } else { - missingParams.append("," + parm.getParamName()); - } - } - paramList.add (parm.getParamName ()); - } - if (missingParams != null) { - // Problem - missing one or more required parameters - String error = "Missing Required inputs for HEAT Template: " + missingParams; - LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams + " for HEAT Template", "", "", MsoLogger.ErrorCode.SchemaError, "Missing Required inputs for HEAT Template: " + missingParams); - throw new IllegalArgumentException (error); - } - - // Remove any extraneous parameters (don't throw an error) - Map updatedParams = new HashMap <> (); - List extraParams = new ArrayList <> (); - for (String key : inputParams.keySet ()) { - if (!paramList.contains (key)) { - // This is not a valid parameter for this template - extraParams.add (key); - } else { - updatedParams.put (key, inputParams.get (key)); - } - } - if (!extraParams.isEmpty ()) { - LOGGER.warn (MessageEnum.RA_GENERAL_WARNING, "Heat Stack (" + heatTemplate.getTemplateName () - + ") extra input params received: " - + extraParams, "", "", MsoLogger.ErrorCode.DataError, "Heat Stack (" + heatTemplate.getTemplateName () + ") extra input params received: "+ extraParams); - } - - return updatedParams; - } - - // --------------------------------------------------------------- - // PRIVATE FUNCTIONS FOR USE WITHIN THIS CLASS - - /** - * Get a Heat client for the Openstack Identity service. - * This requires a 'member'-level userId + password, which will be retrieved from - * properties based on the specified cloud Id. The tenant in which to operate - * must also be provided. - *

- * On successful authentication, the Heat object will be cached for the - * tenantID + cloudId so that it can be reused without reauthenticating with - * Openstack every time. - * - * @return an authenticated Heat object - */ - public Heat getHeatClient (CloudSite cloudSite, String tenantId) throws MsoException { - String cloudId = cloudSite.getId (); - - // Check first in the cache of previously authorized clients - String cacheKey = cloudId + ":" + tenantId; - if (heatClientCache.containsKey (cacheKey)) { - if (!heatClientCache.get (cacheKey).isExpired ()) { - LOGGER.debug ("Using Cached HEAT Client for " + cacheKey); - return heatClientCache.get (cacheKey).getHeatClient (); - } else { - // Token is expired. Remove it from cache. - heatClientCache.remove (cacheKey); - LOGGER.debug ("Expired Cached HEAT Client for " + cacheKey); - } - } - - // Obtain an MSO token for the tenant - CloudIdentity cloudIdentity = cloudSite.getIdentityService (); - LOGGER.debug("Found: " + cloudIdentity.toString()); - String keystoneUrl = cloudIdentity.getKeystoneUrl (cloudId, msoPropID); - LOGGER.debug("keystoneUrl=" + keystoneUrl); - Keystone keystoneTenantClient = new Keystone (keystoneUrl); - Access access = null; - try { - Authentication credentials = cloudIdentity.getAuthentication (); - - OpenStackRequest request = keystoneTenantClient.tokens () - .authenticate (credentials).withTenantId (tenantId); - - access = executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 401) { - // Authentication error. - String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException (error); - } else { - throw keystoneErrorToMsoException (e, TOKEN_AUTH); - } - } catch (OpenStackConnectException e) { - // Connection to Openstack failed - MsoIOException me = new MsoIOException (e.getMessage (), e); - me.addContext (TOKEN_AUTH); - throw me; - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, TOKEN_AUTH); - } - - // For DCP/LCP, the region should be the cloudId. - String region = cloudSite.getRegionId (); - String heatUrl = null; - try { - heatUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "orchestration", region, "public"); - LOGGER.debug("heatUrl=" + heatUrl + ", region=" + region); - } catch (RuntimeException e) { - // This comes back for not found (probably an incorrect region ID) - String error = "Orchestration service not found: region=" + region + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException (error, e); - } - - Heat heatClient = new Heat (heatUrl); - heatClient.token (access.getToken ().getId ()); - - heatClientCache.put (cacheKey, - new HeatCacheEntry (heatUrl, - access.getToken ().getId (), - access.getToken ().getExpires ())); - LOGGER.debug ("Caching HEAT Client for " + cacheKey); - - return heatClient; - } - - /** - * Forcibly expire a HEAT client from the cache. This call is for use by - * the KeystoneClient in case where a tenant is deleted. In that case, - * all cached credentials must be purged so that fresh authentication is - * done if a similarly named tenant is re-created. - *

- * Note: This is probably only applicable to dev/test environments where - * the same Tenant Name is repeatedly used for creation/deletion. - *

- * - */ - public static void expireHeatClient (String tenantId, String cloudId) { - String cacheKey = cloudId + ":" + tenantId; - if (heatClientCache.containsKey (cacheKey)) { - heatClientCache.remove (cacheKey); - LOGGER.debug ("Deleted Cached HEAT Client for " + cacheKey); - } - } - - /* - * Query for a Heat Stack. This function is needed in several places, so - * a common method is useful. This method takes an authenticated Heat Client - * (which internally identifies the cloud & tenant to search), and returns - * a Stack object if found, Null if not found, or an MsoOpenstackException - * if the Openstack API call fails. - * - * The stack name may be a simple name or a canonical name ("{name}/{id}"). - * When simple name is used, Openstack always returns a 302 redirect which - * results in a 2nd request (to the canonical name). Note that query by - * canonical name for a deleted stack returns a Stack object with status - * "DELETE_COMPLETE" while query by simple name for a deleted stack returns - * HTTP 404. - * - * @param heatClient an authenticated Heat client - * - * @param stackName the stack name to query - * - * @return a Stack object that describes the current stack or null if the - * requested stack doesn't exist. - * - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - */ - protected Stack queryHeatStack (Heat heatClient, String stackName) throws MsoException { - if (stackName == null) { - return null; - } - try { - OpenStackRequest request = heatClient.getStacks ().byName (stackName); - return executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - LOGGER.debug ("queryHeatStack - stack not found: " + stackName); - return null; - } else { - // Convert the OpenStackResponseException to an MsoOpenstackException - throw heatExceptionToMsoException (e, "QueryStack"); - } - } catch (OpenStackConnectException e) { - // Connection to Openstack failed - throw heatExceptionToMsoException (e, "QueryAllStack"); - } - } - - /* - * An entry in the Heat Client Cache. It saves the Heat client object - * along with the token expiration. After this interval, this cache - * item will no longer be used. - */ - private static class HeatCacheEntry implements Serializable { - - private static final long serialVersionUID = 1L; - - private String heatUrl; - private String token; - private Calendar expires; - - public HeatCacheEntry (String heatUrl, String token, Calendar expires) { - this.heatUrl = heatUrl; - this.token = token; - this.expires = expires; - } - - public Heat getHeatClient () { - Heat heatClient = new Heat (heatUrl); - heatClient.token (token); - return heatClient; - } - - public boolean isExpired () { - return expires == null || System.currentTimeMillis() > expires.getTimeInMillis(); - - } - } - - /** - * Clean up the Heat client cache to remove expired entries. - */ - public static void heatCacheCleanup () { - for (String cacheKey : heatClientCache.keySet ()) { - if (heatClientCache.get (cacheKey).isExpired ()) { - heatClientCache.remove (cacheKey); - LOGGER.debug ("Cleaned Up Cached Heat Client for " + cacheKey); - } - } - } - - /** - * Reset the Heat client cache. - * This may be useful if cached credentials get out of sync. - */ - public static void heatCacheReset () { - heatClientCache = new HashMap <> (); - } - - public Map queryStackForOutputs(String cloudSiteId, - String tenantId, String stackName) throws MsoException { - LOGGER.debug("MsoHeatUtils.queryStackForOutputs)"); - StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName); - if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) { - return null; - } - Map outputs = heatStack.getOutputs(); - return outputs; - } - - public void queryAndCopyOutputsToInputs(String cloudSiteId, - String tenantId, String stackName, Map inputs, - boolean overWrite) throws MsoException { - LOGGER.debug("MsoHeatUtils.queryAndCopyOutputsToInputs"); - Map outputs = this.queryStackForOutputs(cloudSiteId, - tenantId, stackName); - this.copyStringOutputsToInputs(inputs, outputs, overWrite); - return; - } - - public void copyStringOutputsToInputs(Map inputs, - Map otherStackOutputs, boolean overWrite) { - if (inputs == null || otherStackOutputs == null) - return; - for (String key : otherStackOutputs.keySet()) { - if (!inputs.containsKey(key)) { - Object obj = otherStackOutputs.get(key); - if (obj instanceof String) { - inputs.put(key, (String) otherStackOutputs.get(key)); - } else if (obj instanceof JsonNode ){ - // This is a bit of mess - but I think it's the least impacting - // let's convert it BACK to a string - then it will get converted back later - try { - String str = this.convertNode((JsonNode) obj); - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key, e); - //effect here is this value will not have been copied to the inputs - and therefore will error out downstream - } - } else if (obj instanceof java.util.LinkedHashMap) { - LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode"); - try { - String str = JSON_MAPPER.writeValueAsString(obj); - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key, e); - } - } else if (obj instanceof Integer) { - try { - String str = "" + obj; - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key, e); - } - } else { - try { - String str = obj.toString(); - inputs.put(key, str); - } catch (Exception e) { - LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Other "+ key +" (" + e.getMessage() + ")", e); - //effect here is this value will not have been copied to the inputs - and therefore will error out downstream - } - } - } - } - return; - } - public StringBuilder requestToStringBuilder(CreateStackParam stack) { - StringBuilder sb = new StringBuilder(); - sb.append("Stack:\n"); - sb.append("\tStackName: " + stack.getStackName()); - sb.append("\tTemplateUrl: " + stack.getTemplateUrl()); - sb.append("\tTemplate: " + stack.getTemplate()); - sb.append("\tEnvironment: " + stack.getEnvironment()); - sb.append("\tTimeout: " + stack.getTimeoutMinutes()); - sb.append("\tParameters:\n"); - Map params = stack.getParameters(); - if (params == null || params.size() < 1) { - sb.append("\nNONE"); - } else { - for (String key : params.keySet()) { - if (params.get(key) instanceof String) { - sb.append("\n").append(key).append("=").append((String) params.get(key)); - } else if (params.get(key) instanceof JsonNode) { - String jsonStringOut = this.convertNode((JsonNode)params.get(key)); - sb.append("\n").append(key).append("=").append(jsonStringOut); - } else if (params.get(key) instanceof Integer) { - String integerOut = "" + params.get(key); - sb.append("\n").append(key).append("=").append(integerOut); - - } else { - try { - String str = params.get(key).toString(); - sb.append("\n").append(key).append("=").append(str); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - } - } - } - } - return sb; - } - - private String convertNode(final JsonNode node) { - try { - final Object obj = JSON_MAPPER.treeToValue(node, Object.class); - final String json = JSON_MAPPER.writeValueAsString(obj); - return json; - } catch (Exception e) { - LOGGER.debug("Error converting json to string " + e.getMessage(), e); - } - return "[Error converting json to string]"; - } - - - private StringBuilder getOutputsAsStringBuilder(Stack heatStack) { - // This should only be used as a utility to print out the stack outputs - // to the log - StringBuilder sb = new StringBuilder(""); - if (heatStack == null) { - sb.append("(heatStack is null)"); - return sb; - } - List outputList = heatStack.getOutputs(); - if (outputList == null || outputList.isEmpty()) { - sb.append("(outputs is empty)"); - return sb; - } - Map outputs = new HashMap<>(); - for (Output outputItem : outputList) { - outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); - } - int counter = 0; - sb.append("OUTPUTS:\n"); - for (String key : outputs.keySet()) { - sb.append("outputs[").append(counter++).append("]: ").append(key).append("="); - Object obj = outputs.get(key); - if (obj instanceof String) { - sb.append((String) obj).append(" (a string)"); - } else if (obj instanceof JsonNode) { - sb.append(this.convertNode((JsonNode) obj)).append(" (a JsonNode)"); - } else if (obj instanceof java.util.LinkedHashMap) { - try { - String str = JSON_MAPPER.writeValueAsString(obj); - sb.append(str).append(" (a java.util.LinkedHashMap)"); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - sb.append("(a LinkedHashMap value that would not convert nicely)"); - } - } else if (obj instanceof Integer) { - String str = ""; - try { - str = obj.toString() + " (an Integer)\n"; - } catch (Exception e) { - LOGGER.debug("Exception :",e); - str = "(an Integer unable to call .toString() on)"; - } - sb.append(str); - } else if (obj instanceof ArrayList) { - String str = ""; - try { - str = obj.toString() + " (an ArrayList)"; - } catch (Exception e) { - LOGGER.debug("Exception :",e); - str = "(an ArrayList unable to call .toString() on?)"; - } - sb.append(str); - } else if (obj instanceof Boolean) { - String str = ""; - try { - str = obj.toString() + " (a Boolean)"; - } catch (Exception e) { - LOGGER.debug("Exception :",e); - str = "(an Boolean unable to call .toString() on?)"; - } - sb.append(str); - } - else { - String str = ""; - try { - str = obj.toString() + " (unknown Object type)"; - } catch (Exception e) { - LOGGER.debug("Exception :",e); - str = "(a value unable to call .toString() on?)"; - } - sb.append(str); - } - sb.append("\n"); - } - sb.append("[END]"); - return sb; - } - - - public void copyBaseOutputsToInputs(Map inputs, - Map otherStackOutputs, ArrayList paramNames, HashMap aliases) { - if (inputs == null || otherStackOutputs == null) - return; - for (String key : otherStackOutputs.keySet()) { - if (paramNames != null) { - if (!paramNames.contains(key) && !aliases.containsKey(key)) { - LOGGER.debug("\tParameter " + key + " is NOT defined to be in the template - do not copy to inputs"); - continue; - } - if (aliases.containsKey(key)) { - LOGGER.debug("Found an alias! Will move " + key + " to " + aliases.get(key)); - Object obj = otherStackOutputs.get(key); - key = aliases.get(key); - otherStackOutputs.put(key, obj); - } - } - if (!inputs.containsKey(key)) { - Object obj = otherStackOutputs.get(key); - LOGGER.debug("\t**Adding " + key + " to inputs (.toString()=" + obj.toString()); - if (obj instanceof String) { - LOGGER.debug("\t\t**A String"); - inputs.put(key, obj); - } else if (obj instanceof Integer) { - LOGGER.debug("\t\t**An Integer"); - inputs.put(key, obj); - } else if (obj instanceof JsonNode) { - LOGGER.debug("\t\t**A JsonNode"); - inputs.put(key, obj); - } else if (obj instanceof Boolean) { - LOGGER.debug("\t\t**A Boolean"); - inputs.put(key, obj); - } else if (obj instanceof java.util.LinkedHashMap) { - LOGGER.debug("\t\t**A java.util.LinkedHashMap **"); - //Object objJson = this.convertObjectToJsonNode(obj.toString()); - //if (objJson == null) { - // LOGGER.debug("\t\tFAILED!! Will just put LinkedHashMap on the inputs"); - inputs.put(key, obj); - //} - //else { - // LOGGER.debug("\t\tSuccessfully converted to JsonNode: " + objJson.toString()); - // inputs.put(key, objJson); - //} - } else if (obj instanceof java.util.ArrayList) { - LOGGER.debug("\t\t**An ArrayList"); - inputs.put(key, obj); - } else { - LOGGER.debug("\t\t**UNKNOWN OBJECT TYPE"); - inputs.put(key, obj); - } - } else { - LOGGER.debug("key=" + key + " is already in the inputs - will not overwrite"); - } - } - return; - } - - public JsonNode convertObjectToJsonNode(Object lhm) { - if (lhm == null) { - return null; - } - JsonNode jsonNode = null; - try { - String jsonString = lhm.toString(); - jsonNode = new ObjectMapper().readTree(jsonString); - } catch (Exception e) { - LOGGER.debug("Unable to convert " + lhm.toString() + " to a JsonNode " + e.getMessage(), e); - jsonNode = null; - } - return jsonNode; - } - - public ArrayList convertCdlToArrayList(String cdl) { - String cdl2 = cdl.trim(); - String cdl3; - if (cdl2.startsWith("[") && cdl2.endsWith("]")) { - cdl3 = cdl2.substring(1, cdl2.lastIndexOf("]")); - } else { - cdl3 = cdl2; - } - ArrayList list = new ArrayList<>(Arrays.asList(cdl3.split(","))); - return list; - } - - /** - * New with 1707 - this method will convert all the String *values* of the inputs - * to their "actual" object type (based on the param type: in the db - which comes from the template): - * (heat variable type) -> java Object type - * string -> String - * number -> Integer - * json -> JsonNode XXX Removed with MSO-1475 / 1802 - * comma_delimited_list -> ArrayList - * boolean -> Boolean - * if any of the conversions should fail, we will default to adding it to the inputs - * as a string - see if Openstack can handle it. - * Also, will remove any params that are extra. - * Any aliases will be converted to their appropriate name (anyone use this feature?) - * @param inputs - the Map of the inputs received on the request - * @param template the HeatTemplate object - this is so we can also verify if the param is valid for this template - * @return HashMap of the inputs, cleaned and converted - */ - public HashMap convertInputMap(Map inputs, HeatTemplate template) { - HashMap newInputs = new HashMap<>(); - HashMap params = new HashMap<>(); - HashMap paramAliases = new HashMap<>(); - - if (inputs == null) { - LOGGER.debug("convertInputMap - inputs is null - nothing to do here"); - return new HashMap<>(); - } - - LOGGER.debug("convertInputMap in MsoHeatUtils called, with " + inputs.size() + " inputs, and template " + template.getArtifactUuid()); - try { - LOGGER.debug(template.toString()); - Set paramSet = template.getParameters(); - LOGGER.debug("paramSet has " + paramSet.size() + " entries"); - } catch (Exception e) { - LOGGER.debug("Exception occurred in convertInputMap:" + e.getMessage(), e); - } - - for (HeatTemplateParam htp : template.getParameters()) { - LOGGER.debug("Adding " + htp.getParamName()); - params.put(htp.getParamName(), htp); - if (htp.getParamAlias() != null && !"".equals(htp.getParamAlias())) { - LOGGER.debug("\tFound ALIAS " + htp.getParamName() + "->" + htp.getParamAlias()); - paramAliases.put(htp.getParamAlias(), htp); - } - } - LOGGER.debug("Now iterate through the inputs..."); - for (String key : inputs.keySet()) { - LOGGER.debug("key=" + key); - boolean alias = false; - String realName = null; - if (!params.containsKey(key)) { - LOGGER.debug(key + " is not a parameter in the template! - check for an alias"); - // add check here for an alias - if (!paramAliases.containsKey(key)) { - LOGGER.debug("The parameter " + key + " is in the inputs, but it's not a parameter for this template - omit"); - continue; - } else { - alias = true; - realName = paramAliases.get(key).getParamName(); - LOGGER.debug("FOUND AN ALIAS! Will use " + realName + " in lieu of give key/alias " + key); - } - } - String type = params.get(key).getParamType(); - if (type == null || "".equals(type)) { - LOGGER.debug("**PARAM_TYPE is null/empty for " + key + ", will default to string"); - type = "string"; - } - LOGGER.debug("Parameter: " + key + " is of type " + type); - if ("string".equalsIgnoreCase(type)) { - // Easiest! - String str = inputs.get(key); - if (alias) - newInputs.put(realName, str); - else - newInputs.put(key, str); - } else if ("number".equalsIgnoreCase(type)) { - String integerString = inputs.get(key); - Integer anInteger = null; - try { - anInteger = Integer.parseInt(integerString); - } catch (Exception e) { - LOGGER.debug("Unable to convert " + integerString + " to an integer!!", e); - anInteger = null; - } - if (anInteger != null) { - if (alias) - newInputs.put(realName, anInteger); - else - newInputs.put(key, anInteger); - } - else { - if (alias) - newInputs.put(realName, integerString); - else - newInputs.put(key, integerString); - } - } else if ("json".equalsIgnoreCase(type)) { - // MSO-1475 - Leave this as a string now - String jsonString = inputs.get(key); - LOGGER.debug("Skipping conversion to jsonNode..."); - if (alias) - newInputs.put(realName, jsonString); - else - newInputs.put(key, jsonString); - //} - } else if ("comma_delimited_list".equalsIgnoreCase(type)) { - String commaSeparated = inputs.get(key); - try { - ArrayList anArrayList = this.convertCdlToArrayList(commaSeparated); - if (alias) - newInputs.put(realName, anArrayList); - else - newInputs.put(key, anArrayList); - } catch (Exception e) { - LOGGER.debug("Unable to convert " + commaSeparated + " to an ArrayList!!", e); - if (alias) - newInputs.put(realName, commaSeparated); - else - newInputs.put(key, commaSeparated); - } - } else if ("boolean".equalsIgnoreCase(type)) { - String booleanString = inputs.get(key); - Boolean aBool = Boolean.valueOf(booleanString); - if (alias) - newInputs.put(realName, aBool); - else - newInputs.put(key, aBool); - } else { - // it's null or something undefined - just add it back as a String - String str = inputs.get(key); - if (alias) - newInputs.put(realName, str); - else - newInputs.put(key, str); - } - } - return newInputs; - } - - - /* - * Create a string suitable for being dumped to a debug log that creates a - * pseudo-JSON request dumping what's being sent to Openstack API in the create or update request - */ - - private String printStackRequest(String tenantId, - Map heatFiles, - Map nestedTemplates, - String environment, - Map inputs, - String vfModuleName, - String template, - int timeoutMinutes, - boolean backout, - String cloudSiteId) { - StringBuffer sb = new StringBuffer(); - sb.append("CREATE STACK REQUEST (formatted for readability)\n"); - sb.append("tenant=" + tenantId + ", cloud=" + cloudSiteId); - sb.append("{\n"); - sb.append(" \"stack_name\": \"" + vfModuleName + "\",\n"); - sb.append(" \"disable_rollback\": " + backout + ",\n"); - sb.append(" \"timeout_mins\": " + timeoutMinutes + ",\n"); - sb.append(" \"template\": {\n"); - sb.append(template); - sb.append(" },\n"); - sb.append(" \"environment\": {\n"); - if (environment == null) - sb.append(""); - else - sb.append(environment); - sb.append(" },\n"); - sb.append(" \"files\": {\n"); - int filesCounter = 0; - if (heatFiles != null) { - for (String key : heatFiles.keySet()) { - filesCounter++; - if (filesCounter > 1) { - sb.append(",\n"); - } - sb.append(" \"" + key + "\": {\n"); - sb.append(heatFiles.get(key).toString() + "\n }"); - } - } - if (nestedTemplates != null) { - for (String key : nestedTemplates.keySet()) { - filesCounter++; - if (filesCounter > 1) { - sb.append(",\n"); - } - sb.append(" \"" + key + "\": {\n"); - sb.append(nestedTemplates.get(key).toString() + "\n }"); - } - } - sb.append("\n },\n"); - sb.append(" \"parameters\": {\n"); - int paramCounter = 0; - for (String name : inputs.keySet()) { - paramCounter++; - if (paramCounter > 1) { - sb.append(",\n"); - } - Object o = inputs.get(name); - if (o instanceof java.lang.String) { - sb.append(" \"" + name + "\": \"" + inputs.get(name).toString() + "\""); - } else if (o instanceof Integer) { - sb.append(" \"" + name + "\": " + inputs.get(name).toString() ); - } else if (o instanceof ArrayList) { - sb.append(" \"" + name + "\": " + inputs.get(name).toString() ); - } else if (o instanceof Boolean) { - sb.append(" \"" + name + "\": " + inputs.get(name).toString() ); - } else { - sb.append(" \"" + name + "\": " + "\"(there was an issue trying to dump this value...)\"" ); - } - } - sb.append("\n }\n}\n"); - - return sb.toString(); - } - - /******************************************************************************* - * - * Methods (and associated utilities) to implement the VduPlugin interface - * - *******************************************************************************/ - - /** - * VduPlugin interface for instantiate function. - * - * Translate the VduPlugin parameters to the corresponding 'createStack' parameters, - * and then invoke the existing function. - */ - public VduInstance instantiateVdu ( - CloudInfo cloudInfo, - String instanceName, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException - { - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - // Translate the VDU ModelInformation structure to that which is needed for - // creating the Heat stack. Loop through the artifacts, looking specifically - // for MAIN_TEMPLATE and ENVIRONMENT. Any other artifact will - // be attached as a FILE. - String heatTemplate = null; - Map nestedTemplates = new HashMap<>(); - Map files = new HashMap<>(); - String heatEnvironment = null; - - for (VduArtifact vduArtifact: vduModel.getArtifacts()) { - if (vduArtifact.getType() == ArtifactType.MAIN_TEMPLATE) { - heatTemplate = new String(vduArtifact.getContent()); - } - else if (vduArtifact.getType() == ArtifactType.NESTED_TEMPLATE) { - nestedTemplates.put(vduArtifact.getName(), new String(vduArtifact.getContent())); - } - else if (vduArtifact.getType() == ArtifactType.ENVIRONMENT) { - heatEnvironment = new String(vduArtifact.getContent()); - } - } - - try { - StackInfo stackInfo = createStack (cloudSiteId, - tenantId, - instanceName, - heatTemplate, - inputs, - true, // poll for completion - vduModel.getTimeoutMinutes(), - heatEnvironment, - nestedTemplates, - files, - rollbackOnFailure); - - // Populate a vduInstance from the StackInfo - VduInstance vduInstance = stackInfoToVduInstance(stackInfo); - - return vduInstance; - } - catch (Exception e) { - throw new VduException ("MsoHeatUtils (instantiateVDU): createStack Exception", e); - } - } - - - /** - * VduPlugin interface for query function. - */ - public VduInstance queryVdu (CloudInfo cloudInfo, String instanceId) - throws VduException - { - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - try { - // Query the Cloudify Deployment object and populate a VduInstance - StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId); - - VduInstance vduInstance = stackInfoToVduInstance(stackInfo); - - return vduInstance; - } - catch (Exception e) { - throw new VduException ("MsoHeatUtile (queryVdu): queryStack Exception ", e); - } - } - - - /** - * VduPlugin interface for delete function. - */ - public VduInstance deleteVdu (CloudInfo cloudInfo, String instanceId, int timeoutMinutes) - throws VduException - { - String cloudSiteId = cloudInfo.getCloudSiteId(); - String tenantId = cloudInfo.getTenantId(); - - try { - // Delete the Heat stack - StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true); - - // Populate a VduInstance based on the deleted Cloudify Deployment object - VduInstance vduInstance = stackInfoToVduInstance(stackInfo); - - // Override return state to DELETED (HeatUtils sets to NOTFOUND) - vduInstance.getStatus().setState(VduStateType.DELETED); - - return vduInstance; - } - catch (Exception e) { - throw new VduException ("Delete VDU Exception", e); - } - } - - - /** - * VduPlugin interface for update function. - * - * Update is currently not supported in the MsoHeatUtils implementation of VduPlugin. - * Just return a VduException. - * - */ - public VduInstance updateVdu ( - CloudInfo cloudInfo, - String instanceId, - Map inputs, - VduModelInfo vduModel, - boolean rollbackOnFailure) - throws VduException - { - throw new VduException ("MsoHeatUtils: updateVdu interface not supported"); - } - - - /* - * Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object - */ - private VduInstance stackInfoToVduInstance (StackInfo stackInfo) - { - VduInstance vduInstance = new VduInstance(); - - // The full canonical name as the instance UUID - vduInstance.setVduInstanceId(stackInfo.getCanonicalName()); - vduInstance.setVduInstanceName(stackInfo.getName()); - - // Copy inputs and outputs - vduInstance.setInputs(stackInfo.getParameters()); - vduInstance.setOutputs(stackInfo.getOutputs()); - - // Translate the status elements - vduInstance.setStatus(stackStatusToVduStatus (stackInfo)); - - return vduInstance; - } - - private VduStatus stackStatusToVduStatus (StackInfo stackInfo) - { - VduStatus vduStatus = new VduStatus(); - - // Map the status fields to more generic VduStatus. - // There are lots of HeatStatus values, so this is a bit long... - HeatStatus heatStatus = stackInfo.getStatus(); - String statusMessage = stackInfo.getStatusMessage(); - - if (heatStatus == HeatStatus.INIT || heatStatus == HeatStatus.BUILDING) { - vduStatus.setState(VduStateType.INSTANTIATING); - vduStatus.setLastAction((new PluginAction ("create", "in_progress", statusMessage))); - } - else if (heatStatus == HeatStatus.NOTFOUND) { - vduStatus.setState(VduStateType.NOTFOUND); - } - else if (heatStatus == HeatStatus.CREATED) { - vduStatus.setState(VduStateType.INSTANTIATED); - vduStatus.setLastAction((new PluginAction ("create", "complete", statusMessage))); - } - else if (heatStatus == HeatStatus.UPDATED) { - vduStatus.setState(VduStateType.INSTANTIATED); - vduStatus.setLastAction((new PluginAction ("update", "complete", statusMessage))); - } - else if (heatStatus == HeatStatus.UPDATING) { - vduStatus.setState(VduStateType.UPDATING); - vduStatus.setLastAction((new PluginAction ("update", "in_progress", statusMessage))); - } - else if (heatStatus == HeatStatus.DELETING) { - vduStatus.setState(VduStateType.DELETING); - vduStatus.setLastAction((new PluginAction ("delete", "in_progress", statusMessage))); - } - else if (heatStatus == HeatStatus.FAILED) { - vduStatus.setState(VduStateType.FAILED); - vduStatus.setErrorMessage(stackInfo.getStatusMessage()); - } else { - vduStatus.setState(VduStateType.UNKNOWN); - } - - return vduStatus; - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java deleted file mode 100644 index 08ae9df4b5..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsWithUpdate.java +++ /dev/null @@ -1,437 +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.openecomp.mso.openstack.utils; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.StackInfo; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import org.openecomp.mso.openstack.exceptions.MsoStackNotFound; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.woorea.openstack.base.client.OpenStackBaseException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.heat.model.Stack.Output; -import com.woorea.openstack.heat.model.UpdateStackParam; - -public class MsoHeatUtilsWithUpdate extends MsoHeatUtils { - - private static final String UPDATE_STACK = "UpdateStack"; - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - protected MsoJavaProperties msoProps = null; - - private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - - public MsoHeatUtilsWithUpdate (String msoPropID, MsoPropertiesFactory msoPropertiesFactory, CloudConfigFactory cloudConfFactory) { - super (msoPropID,msoPropertiesFactory,cloudConfFactory); - - try { - msoProps = msoPropertiesFactory.getMsoJavaProperties (msoPropID); - } catch (MsoPropertiesException e) { - LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception Mso Properties ID not found in cache: " + msoPropID, e); - } - } - - /* - * Keep these methods around for backward compatibility - */ - - public StackInfo updateStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes) throws MsoException { - // Keeping this method to allow compatibility with no environment or files variable sent. In this case, - // simply return the new method with the environment variable set to null. - return this.updateStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - null, - null, - null); - } - - public StackInfo updateStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment) throws MsoException { - // Keeping this method to allow compatibility with no environment variable sent. In this case, - // simply return the new method with the files variable set to null. - return this.updateStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - environment, - null, - null); - } - - public StackInfo updateStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment, - Map files) throws MsoException { - return this.updateStack (cloudSiteId, - tenantId, - stackName, - heatTemplate, - stackInputs, - pollForCompletion, - timeoutMinutes, - environment, - files, - null); - } - - /** - * Update a Stack in the specified cloud location and tenant. The Heat template - * and parameter map are passed in as arguments, along with the cloud access credentials. - * It is expected that parameters have been validated and contain at minimum the required - * parameters for the given template with no extra (undefined) parameters.. - * - * The Stack name supplied by the caller must be unique in the scope of this tenant. - * However, it should also be globally unique, as it will be the identifier for the - * resource going forward in Inventory. This latter is managed by the higher levels - * invoking this function. - * - * The caller may choose to let this function poll Openstack for completion of the - * stack creation, or may handle polling itself via separate calls to query the status. - * In either case, a StackInfo object will be returned containing the current status. - * When polling is enabled, a status of CREATED is expected. When not polling, a - * status of BUILDING is expected. - * - * An error will be thrown if the requested Stack already exists in the specified - * Tenant and Cloud. - * - * @param tenantId The Openstack ID of the tenant in which to create the Stack - * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant. - * @param stackName The name of the stack to update - * @param heatTemplate The Heat template - * @param stackInputs A map of key/value inputs - * @param pollForCompletion Indicator that polling should be handled in Java vs. in the client - * @param environment An optional yaml-format string to specify environmental parameters - * @param files a Map for listing child template IDs - * @param heatFiles a Map for listing get_file entries (fileName, fileBody) - * @return A StackInfo object - * @throws MsoException Thrown if the Openstack API call returns an exception. - */ - - public StackInfo updateStack (String cloudSiteId, - String tenantId, - String stackName, - String heatTemplate, - Map stackInputs, - boolean pollForCompletion, - int timeoutMinutes, - String environment, - Map files, - Map heatFiles) throws MsoException { - boolean heatEnvtVariable = true; - if (environment == null || "".equalsIgnoreCase (environment.trim ())) { - heatEnvtVariable = false; - } - boolean haveFiles = true; - if (files == null || files.isEmpty ()) { - haveFiles = false; - } - boolean haveHeatFiles = true; - if (heatFiles == null || heatFiles.isEmpty ()) { - haveHeatFiles = false; - } - - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - // Get a Heat client. They are cached between calls (keyed by tenantId:cloudId) - // This could throw MsoTenantNotFound or MsoOpenstackException (both propagated) - Heat heatClient = getHeatClient (cloudSite, tenantId); - - // Perform a query first to get the current status - Stack heatStack = queryHeatStack (heatClient, stackName); - if (heatStack == null || "DELETE_COMPLETE".equals (heatStack.getStackStatus ())) { - // Not found. Return a StackInfo with status NOTFOUND - throw new MsoStackNotFound (stackName, tenantId, cloudSiteId); - } - - // Use canonical name "/" to update the stack. - // Otherwise, update by name returns a 302 redirect. - // NOTE: This is specific to the v1 Orchestration API. - String canonicalName = heatStack.getStackName () + "/" + heatStack.getId (); - - LOGGER.debug ("Ready to Update Stack (" + canonicalName + ") with input params: " + stackInputs); - - // Build up the stack update parameters - // Disable auto-rollback, because error reason is lost. Always rollback in the code. - UpdateStackParam stack = new UpdateStackParam (); - stack.setTimeoutMinutes (timeoutMinutes); - stack.setParameters (stackInputs); - stack.setTemplate (heatTemplate); - stack.setDisableRollback (true); - // TJM add envt to stack - if (heatEnvtVariable) { - stack.setEnvironment (environment); - } - - // Handle nested templates & get_files here. if we have both - must combine - // and then add to stack (both are part of "files:" being added to stack) - if (haveFiles && haveHeatFiles) { - // Let's do this here - not in the bean - LOGGER.debug ("Found files AND heatFiles - combine and add!"); - Map combinedFiles = new HashMap<>(); - for (String keyString : files.keySet ()) { - combinedFiles.put (keyString, files.get (keyString)); - } - for (String keyString : heatFiles.keySet ()) { - combinedFiles.put (keyString, heatFiles.get (keyString)); - } - stack.setFiles (combinedFiles); - } else { - // Handle case where we have one or neither - if (haveFiles) { - stack.setFiles (files); - } - if (haveHeatFiles) { - // setFiles method modified to handle adding a map. - stack.setFiles (heatFiles); - } - } - - try { - // Execute the actual Openstack command to update the Heat stack - OpenStackRequest request = heatClient.getStacks ().update (canonicalName, stack); - executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackBaseException e) { - // Since this came on the 'Update Stack' command, nothing was changed - // in the cloud. Rethrow the error as an MSO exception. - throw heatExceptionToMsoException (e, UPDATE_STACK); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, UPDATE_STACK); - } - - // If client has requested a final response, poll for stack completion - Stack updateStack = null; - if (pollForCompletion) { - // Set a time limit on overall polling. - // Use the resource (template) timeout for Openstack (expressed in minutes) - // and add one poll interval to give Openstack a chance to fail on its own. - int createPollInterval = msoProps.getIntProperty (createPollIntervalProp, createPollIntervalDefault); - int pollTimeout = (timeoutMinutes * 60) + createPollInterval; - - boolean loopAgain = true; - while (loopAgain) { - try { - updateStack = queryHeatStack (heatClient, canonicalName); - LOGGER.debug (updateStack.getStackStatus () + " (" + canonicalName + ")"); - try { - LOGGER.debug("Current stack " + this.getOutputsAsStringBuilder(heatStack).toString()); - } catch (Exception e) { - LOGGER.debug("an error occurred trying to print out the current outputs of the stack", e); - } - - - if ("UPDATE_IN_PROGRESS".equals (updateStack.getStackStatus ())) { - // Stack update is still running. - // Sleep and try again unless timeout has been reached - if (pollTimeout <= 0) { - // Note that this should not occur, since there is a timeout specified - // in the Openstack call. - LOGGER.error (MessageEnum.RA_UPDATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName, updateStack.getStackStatus(), "", "", MsoLogger.ErrorCode.AvailabilityError, "Update stack timeout"); - loopAgain = false; - } else { - try { - Thread.sleep (createPollInterval * 1000L); - } catch (InterruptedException e) { - // If we are interrupted, we should stop ASAP. - loopAgain = false; - // Set again the interrupted flag - Thread.currentThread().interrupt(); - } - } - pollTimeout -= createPollInterval; - LOGGER.debug("pollTimeout remaining: " + pollTimeout); - } else { - loopAgain = false; - } - } catch (MsoException e) { - // Cannot query the stack. Something is wrong. - - // TODO: No way to roll back the stack at this point. What to do? - e.addContext (UPDATE_STACK); - throw e; - } - } - - if (!"UPDATE_COMPLETE".equals (updateStack.getStackStatus ())) { - LOGGER.error (MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(), "", "", MsoLogger.ErrorCode.DataError, "Update Stack error"); - - // TODO: No way to roll back the stack at this point. What to do? - // Throw a 'special case' of MsoOpenstackException to report the Heat status - MsoOpenstackException me = null; - if ("UPDATE_IN_PROGRESS".equals (updateStack.getStackStatus ())) { - me = new MsoOpenstackException (0, "", "Stack Update Timeout"); - } else { - String error = "Stack error (" + updateStack.getStackStatus () - + "): " - + updateStack.getStackStatusReason (); - me = new MsoOpenstackException (0, "", error); - } - me.addContext (UPDATE_STACK); - throw me; - } - - } else { - // Return the current status. - updateStack = queryHeatStack (heatClient, canonicalName); - if (updateStack != null) { - LOGGER.debug ("UpdateStack, status = " + updateStack.getStackStatus ()); - } else { - LOGGER.debug ("UpdateStack, stack not found"); - } - } - return new StackInfo (updateStack); - } - - private StringBuilder getOutputsAsStringBuilder(Stack heatStack) { - // This should only be used as a utility to print out the stack outputs - // to the log - StringBuilder sb = new StringBuilder(""); - if (heatStack == null) { - sb.append("(heatStack is null)"); - return sb; - } - List outputList = heatStack.getOutputs(); - if (outputList == null || outputList.isEmpty()) { - sb.append("(outputs is empty)"); - return sb; - } - Map outputs = new HashMap<>(); - for (Output outputItem : outputList) { - outputs.put(outputItem.getOutputKey(), outputItem.getOutputValue()); - } - int counter = 0; - sb.append("OUTPUTS:\n"); - for (String key : outputs.keySet()) { - sb.append("outputs[").append(counter++).append("]: ").append(key).append("="); - Object obj = outputs.get(key); - if (obj instanceof String) { - sb.append((String) obj).append(" (a string)"); - } else if (obj instanceof JsonNode) { - sb.append(this.convertNode((JsonNode) obj)).append(" (a JsonNode)"); - } else if (obj instanceof java.util.LinkedHashMap) { - try { - String str = JSON_MAPPER.writeValueAsString(obj); - sb.append(str).append(" (a java.util.LinkedHashMap)"); - } catch (Exception e) { - LOGGER.debug("Exception :", e); - sb.append("(a LinkedHashMap value that would not convert nicely)"); - } - } else if (obj instanceof Integer) { - String str = ""; - try { - str = obj.toString() + " (an Integer)\n"; - } catch (Exception e) { - LOGGER.debug("Exception :", e); - str = "(an Integer unable to call .toString() on)"; - } - sb.append(str); - } else if (obj instanceof ArrayList) { - String str = ""; - try { - str = obj.toString() + " (an ArrayList)"; - } catch (Exception e) { - LOGGER.debug("Exception :", e); - str = "(an ArrayList unable to call .toString() on?)"; - } - sb.append(str); - } else if (obj instanceof Boolean) { - String str = ""; - try { - str = obj.toString() + " (a Boolean)"; - } catch (Exception e) { - LOGGER.debug("Exception :", e); - str = "(an Boolean unable to call .toString() on?)"; - } - sb.append(str); - } - else { - String str = ""; - try { - str = obj.toString() + " (unknown Object type)"; - } catch (Exception e) { - LOGGER.debug("Exception :", e); - str = "(a value unable to call .toString() on?)"; - } - sb.append(str); - } - sb.append("\n"); - } - sb.append("[END]"); - return sb; - } - - private String convertNode(final JsonNode node) { - try { - final Object obj = JSON_MAPPER.treeToValue(node, Object.class); - final String json = JSON_MAPPER.writeValueAsString(obj); - return json; - } catch (Exception e) { - LOGGER.debug("Error converting json to string " + e.getMessage(), e); - } - return "[Error converting json to string]"; - } - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java deleted file mode 100644 index 1f3c43c79e..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtils.java +++ /dev/null @@ -1,604 +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.openecomp.mso.openstack.utils; - - -import java.io.Serializable; -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; - -import java.util.Optional; - -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.openstack.beans.MsoTenant; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import org.openecomp.mso.openstack.exceptions.MsoTenantAlreadyExists; -import com.woorea.openstack.base.client.OpenStackBaseException; -import com.woorea.openstack.base.client.OpenStackConnectException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponseException; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.model.Metadata; -import com.woorea.openstack.keystone.model.Role; -import com.woorea.openstack.keystone.model.Roles; -import com.woorea.openstack.keystone.model.Tenant; -import com.woorea.openstack.keystone.model.User; -import com.woorea.openstack.keystone.utils.KeystoneUtils; -import com.woorea.openstack.keystone.model.Authentication; - -public class MsoKeystoneUtils extends MsoTenantUtils { - - // Cache the Keystone Clients statically. Since there is just one MSO user, there is no - // benefit to re-authentication on every request (or across different flows). The - // token will be used until it expires. - // - // The cache key is "cloudId" - private static Map adminClientCache = new HashMap<>(); - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - String msoPropID; - - public MsoKeystoneUtils(String msoPropID, CloudConfigFactory cloudConfigFactory) { - super(msoPropID, cloudConfigFactory); - this.msoPropID = msoPropID; - LOGGER.debug("MsoKeyStoneUtils:" + msoPropID); - } - - /** - * Create a tenant with the specified name in the given cloud. If the tenant already exists, - * an Exception will be thrown. The MSO User will also be added to the "member" list of - * the new tenant to perform subsequent Nova/Heat commands in the tenant. If the MSO User - * association fails, the entire transaction will be rolled back. - *

- * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin - * requests go to the centralized identity service in DCP. However, if some artifact - * must exist in each local LCP instance as well, then it will be needed to access the - * correct region. - *

- * - * @param tenantName The tenant name to create - * @param cloudSiteId The cloud identifier (may be a region) in which to create the tenant. - * @return the tenant ID of the newly created tenant - * @throws MsoTenantAlreadyExists Thrown if the requested tenant already exists - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - */ - public String createTenant (String tenantName, - String cloudSiteId, - Map metadata, - boolean backout) throws MsoException { - // Obtain the cloud site information where we will create the tenant - Optional cloudSiteOpt = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId); - if (!cloudSiteOpt.isPresent()) { - LOGGER.error(MessageEnum.RA_CREATE_TENANT_ERR, "MSOCloudSite not found", "", "", MsoLogger.ErrorCode.DataError, "MSOCloudSite not found"); - throw new MsoCloudSiteNotFound (cloudSiteId); - } - Keystone keystoneAdminClient = getKeystoneAdminClient(cloudSiteOpt.get()); - Tenant tenant = null; - try { - // Check if the tenant already exists - tenant = findTenantByName (keystoneAdminClient, tenantName); - - if (tenant != null) { - // Tenant already exists. Throw an exception - LOGGER.error(MessageEnum.RA_TENANT_ALREADY_EXIST, tenantName, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant already exists"); - throw new MsoTenantAlreadyExists (tenantName, cloudSiteId); - } - - // Does not exist, create a new one - tenant = new Tenant (); - tenant.setName (tenantName); - tenant.setDescription ("SDN Tenant (via MSO)"); - tenant.setEnabled (true); - - OpenStackRequest request = keystoneAdminClient.tenants ().create (tenant); - tenant = executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackBaseException e) { - // Convert Keystone OpenStackResponseException to MsoOpenstackException - throw keystoneErrorToMsoException (e, "CreateTenant"); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, "CreateTenant"); - } - - // Add MSO User to the tenant as a member and - // apply tenant metadata if supported by the cloud site - try { - CloudIdentity cloudIdentity = cloudSiteOpt.get().getIdentityService (); - - User msoUser = findUserByNameOrId (keystoneAdminClient, cloudIdentity.getMsoId ()); - Role memberRole = findRoleByNameOrId (keystoneAdminClient, cloudIdentity.getMemberRole ()); - - OpenStackRequest request = keystoneAdminClient.tenants ().addUser (tenant.getId (), - msoUser.getId (), - memberRole.getId ()); - executeAndRecordOpenstackRequest (request, msoProps); - - if (cloudIdentity.hasTenantMetadata () && metadata != null && !metadata.isEmpty ()) { - Metadata tenantMetadata = new Metadata (); - tenantMetadata.setMetadata (metadata); - - OpenStackRequest metaRequest = keystoneAdminClient.tenants () - .createOrUpdateMetadata (tenant.getId (), - tenantMetadata); - executeAndRecordOpenstackRequest (metaRequest, msoProps); - } - } catch (Exception e) { - // Failed to attach MSO User to the new tenant. Can't operate without access, - // so roll back the tenant. - if (!backout) - { - LOGGER.warn(MessageEnum.RA_CREATE_TENANT_ERR, "Create Tenant errored, Tenant deletion suppressed", "Openstack", "", MsoLogger.ErrorCode.DataError, "Create Tenant error, Tenant deletion suppressed"); - } - else - { - try { - OpenStackRequest request = keystoneAdminClient.tenants ().delete (tenant.getId ()); - executeAndRecordOpenstackRequest (request, msoProps); - } catch (Exception e2) { - // Just log this one. We will report the original exception. - LOGGER.error (MessageEnum.RA_CREATE_TENANT_ERR, "Nested exception rolling back tenant", "Openstack", "", MsoLogger.ErrorCode.DataError, "Create Tenant error, Nested exception rolling back tenant", e2); - } - } - - - // Propagate the original exception on user/role/tenant mapping - if (e instanceof OpenStackBaseException) { - // Convert Keystone Exception to MsoOpenstackException - throw keystoneErrorToMsoException ((OpenStackBaseException) e, "CreateTenantUser"); - } else { - MsoAdapterException me = new MsoAdapterException (e.getMessage (), e); - me.addContext ("CreateTenantUser"); - throw me; - } - } - return tenant.getId (); - } - - /** - * Query for a tenant by ID in the given cloud. If the tenant exists, - * return an MsoTenant object. If not, return null. - *

- * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin - * requests go to the centralized identity service in DCP. However, if some artifact - * must exist in each local LCP instance as well, then it will be needed to access the - * correct region. - *

- * - * @param tenantId The Openstack ID of the tenant to query - * @param cloudSiteId The cloud identifier (may be a region) in which to query the tenant. - * @return the tenant properties of the queried tenant, or null if not found - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - */ - public MsoTenant queryTenant (String tenantId, String cloudSiteId) throws MsoException { - // Obtain the cloud site information where we will query the tenant - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - - Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite); - - // Check if the tenant exists and return its Tenant Id - try { - Tenant tenant = findTenantById (keystoneAdminClient, tenantId); - if (tenant == null) { - return null; - } - - Map metadata = new HashMap<>(); - if (cloudSite.getIdentityService ().hasTenantMetadata ()) { - OpenStackRequest request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); - Metadata tenantMetadata = executeAndRecordOpenstackRequest (request, msoProps); - if (tenantMetadata != null) { - metadata = tenantMetadata.getMetadata (); - } - } - return new MsoTenant (tenant.getId (), tenant.getName (), metadata); - } catch (OpenStackBaseException e) { - // Convert Keystone OpenStackResponseException to MsoOpenstackException - throw keystoneErrorToMsoException (e, "QueryTenant"); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, "QueryTenant"); - } - } - - /** - * Query for a tenant with the specified name in the given cloud. If the tenant exists, - * return an MsoTenant object. If not, return null. This query is useful if the client - * knows it has the tenant name, skipping an initial lookup by ID that would always fail. - *

- * For the AIC Cloud (DCP/LCP): it is not clear that cloudId is needed, as all admin - * requests go to the centralized identity service in DCP. However, if some artifact - * must exist in each local LCP instance as well, then it will be needed to access the - * correct region. - *

- * - * @param tenantName The name of the tenant to query - * @param cloudSiteId The cloud identifier (may be a region) in which to query the tenant. - * @return the tenant properties of the queried tenant, or null if not found - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - */ - public MsoTenant queryTenantByName (String tenantName, String cloudSiteId) throws MsoException { - // Obtain the cloud site information where we will query the tenant - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite); - - try { - Tenant tenant = findTenantByName (keystoneAdminClient, tenantName); - if (tenant == null) { - return null; - } - - Map metadata = new HashMap<>(); - if (cloudSite.getIdentityService ().hasTenantMetadata ()) { - OpenStackRequest request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ()); - Metadata tenantMetadata = executeAndRecordOpenstackRequest (request, msoProps); - if (tenantMetadata != null) { - metadata = tenantMetadata.getMetadata (); - } - } - return new MsoTenant (tenant.getId (), tenant.getName (), metadata); - } catch (OpenStackBaseException e) { - // Convert Keystone OpenStackResponseException to MsoOpenstackException - throw keystoneErrorToMsoException (e, "QueryTenantName"); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, "QueryTenantName"); - } - } - - /** - * Delete the specified Tenant (by ID) in the given cloud. This method returns true or - * false, depending on whether the tenant existed and was successfully deleted, or if - * the tenant already did not exist. Both cases are treated as success (no Exceptions). - *

- * Note for the AIC Cloud (DCP/LCP): all admin requests go to the centralized identity - * service in DCP. So deleting a tenant from one cloudSiteId will remove it from all - * sites managed by that identity service. - *

- * - * @param tenantId The Openstack ID of the tenant to delete - * @param cloudSiteId The cloud identifier from which to delete the tenant. - * @return true if the tenant was deleted, false if the tenant did not exist. - * @throws MsoOpenstackException If the Openstack API call returns an exception. - */ - public boolean deleteTenant (String tenantId, String cloudSiteId) throws MsoException { - // Obtain the cloud site information where we will query the tenant - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - Keystone keystoneAdminClient = getKeystoneAdminClient (cloudSite); - - try { - // Check that the tenant exists. Also, need the ID to delete - Tenant tenant = findTenantById (keystoneAdminClient, tenantId); - if (tenant == null) { - LOGGER.error(MessageEnum.RA_TENANT_NOT_FOUND, tenantId, cloudSiteId, "", "", MsoLogger.ErrorCode.DataError, "Tenant not found"); - return false; - } - - OpenStackRequest request = keystoneAdminClient.tenants ().delete (tenant.getId ()); - executeAndRecordOpenstackRequest (request, msoProps); - LOGGER.debug ("Deleted Tenant " + tenant.getId () + " (" + tenant.getName () + ")"); - - // Clear any cached clients. Not really needed, ID will not be reused. - MsoHeatUtils.expireHeatClient (tenant.getId (), cloudSiteId); - MsoNeutronUtils.expireNeutronClient (tenant.getId (), cloudSiteId); - } catch (OpenStackBaseException e) { - // Convert Keystone OpenStackResponseException to MsoOpenstackException - throw keystoneErrorToMsoException (e, "Delete Tenant"); - } catch (RuntimeException e) { - // Catch-all - throw runtimeExceptionToMsoException (e, "DeleteTenant"); - } - - return true; - } - - // ------------------------------------------------------------------- - // PRIVATE UTILITY FUNCTIONS FOR USE WITHIN THIS CLASS - - /* - * Get a Keystone Admin client for the Openstack Identity service. - * This requires an 'admin'-level userId + password along with an 'admin' tenant - * in the target cloud. These values will be retrieved from properties based - * on the specified cloud ID. - *

- * On successful authentication, the Keystone object will be cached for the cloudId - * so that it can be reused without going back to Openstack every time. - * - * @param cloudId - * - * @return an authenticated Keystone object - */ - public Keystone getKeystoneAdminClient (CloudSite cloudSite) throws MsoException { - CloudIdentity cloudIdentity = cloudSite.getIdentityService (); - - String cloudId = cloudIdentity.getId (); - String adminTenantName = cloudIdentity.getAdminTenant (); - String region = cloudSite.getRegionId (); - - // Check first in the cache of previously authorized clients - KeystoneCacheEntry entry = adminClientCache.get (cloudId); - if (entry != null) { - if (!entry.isExpired ()) { - return entry.getKeystoneClient (); - } else { - // Token is expired. Remove it from cache. - adminClientCache.remove (cloudId); - } - } - - Keystone keystone = new Keystone (cloudIdentity.getKeystoneUrl (region, msoPropID)); - - // Must authenticate against the 'admin' tenant to get the services endpoints - Access access = null; - String token = null; - try { - Authentication credentials = cloudIdentity.getAuthentication (); - OpenStackRequest request = keystone.tokens () - .authenticate (credentials) - .withTenantName (adminTenantName); - access = executeAndRecordOpenstackRequest (request, msoProps); - token = access.getToken ().getId (); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 401) { - // Authentication error. Can't access admin tenant - something is mis-configured - String error = "MSO Authentication Failed for " + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException (error); - } else { - throw keystoneErrorToMsoException (e, "TokenAuth"); - } - } catch (OpenStackConnectException e) { - // Connection to Openstack failed - throw keystoneErrorToMsoException (e, "TokenAuth"); - } - - // Get the Identity service URL. Throws runtime exception if not found per region. - String adminUrl = null; - try { - // TODO: FOR TESTING!!!! - adminUrl = KeystoneUtils.findEndpointURL (access.getServiceCatalog (), "identity", region, "public"); - adminUrl = adminUrl.replaceFirst("5000", "35357"); - } catch (RuntimeException e) { - String error = "Identity service not found: region=" + region + ",cloud=" + cloudIdentity.getId (); - alarmLogger.sendAlarm ("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); - LOGGER.error(MessageEnum.IDENTITY_SERVICE_NOT_FOUND, region, cloudIdentity.getId(), "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in findEndpointURL"); - throw new MsoAdapterException (error, e); - } - - // A new Keystone object is required for the new URL. Use the auth token from above. - // Note: this doesn't go back to Openstack, it's just a local object. - keystone = new Keystone (adminUrl); - keystone.token (token); - - // Cache to avoid re-authentication for every call. - KeystoneCacheEntry cacheEntry = new KeystoneCacheEntry (adminUrl, token, access.getToken ().getExpires ()); - adminClientCache.put (cloudId, cacheEntry); - - return keystone; - } - - /* - * Find a tenant (or query its existance) by its Id. - * - * @param adminClient an authenticated Keystone object - * - * @param tenantName the tenant ID to query - * - * @return a Tenant object or null if not found - */ - private Tenant findTenantById (Keystone adminClient, String tenantId) { - if (tenantId == null) { - return null; - } - - try { - OpenStackRequest request = adminClient.tenants ().show (tenantId); - return executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - return null; - } else { - LOGGER.error(MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET Tenant by Id (" + tenantId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET tenant by Id"); - throw e; - } - } - } - - /* - * Find a tenant (or query its existance) by its Name. This method avoids an - * initial lookup by ID when it's known that we have the tenant Name. - * - * @param adminClient an authenticated Keystone object - * - * @param tenantName the tenant name to query - * - * @return a Tenant object or null if not found - */ - public Tenant findTenantByName (Keystone adminClient, String tenantName) { - if (tenantName == null) { - return null; - } - - try { - OpenStackRequest request = adminClient.tenants ().show ("").queryParam ("name", tenantName); - return executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - return null; - } else { - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET Tenant By Name (" + tenantName + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET Tenant By Name"); - throw e; - } - } - } - - /* - * Look up an Openstack User by Name or Openstack ID. Check the ID first, and if that - * fails, try the Name. - * - * @param adminClient an authenticated Keystone object - * - * @param userName the user name or ID to query - * - * @return a User object or null if not found - */ - private User findUserByNameOrId (Keystone adminClient, String userNameOrId) { - if (userNameOrId == null) { - return null; - } - - try { - OpenStackRequest request = adminClient.users ().show (userNameOrId); - return executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - // Not found by ID. Search for name - return findUserByName (adminClient, userNameOrId); - } else { - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET User (" + userNameOrId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET User"); - throw e; - } - } - } - - /* - * Look up an Openstack User by Name. This avoids initial Openstack query by ID - * if we know we have the User Name. - * - * @param adminClient an authenticated Keystone object - * - * @param userName the user name to query - * - * @return a User object or null if not found - */ - public User findUserByName (Keystone adminClient, String userName) { - if (userName == null) { - return null; - } - - try { - OpenStackRequest request = adminClient.users ().show ("").queryParam ("name", userName); - return executeAndRecordOpenstackRequest (request, msoProps); - } catch (OpenStackResponseException e) { - if (e.getStatus () == 404) { - return null; - } else { - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "Openstack Error, GET User By Name (" + userName + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack GET User By Name"); - throw e; - } - } - } - - /* - * Look up an Openstack Role by Name or Id. There is no direct query for Roles, so - * need to retrieve a full list from Openstack and look for a match. By default, - * Openstack should have a "_member_" role for normal VM-level privileges and an - * "admin" role for expanded privileges (e.g. administer tenants, users, and roles). - *

- * - * @param adminClient an authenticated Keystone object - * - * @param roleNameOrId the Role name or ID to look up - * - * @return a Role object - */ - private Role findRoleByNameOrId (Keystone adminClient, String roleNameOrId) { - if (roleNameOrId == null) { - return null; - } - - // Search by name or ID. Must search in list - OpenStackRequest request = adminClient.roles ().list (); - Roles roles = executeAndRecordOpenstackRequest (request, msoProps); - - for (Role role : roles) { - if (roleNameOrId.equals (role.getName ()) || roleNameOrId.equals (role.getId ())) { - return role; - } - } - - return null; - } - - private static class KeystoneCacheEntry implements Serializable { - - private static final long serialVersionUID = 1L; - - private String keystoneUrl; - private String token; - private Calendar expires; - - public KeystoneCacheEntry (String url, String token, Calendar expires) { - this.keystoneUrl = url; - this.token = token; - this.expires = expires; - } - - public Keystone getKeystoneClient () { - Keystone keystone = new Keystone (keystoneUrl); - keystone.token (token); - return keystone; - } - - public boolean isExpired () { - // adding arbitrary guard timer of 5 minutes - return expires == null || System.currentTimeMillis() > (expires.getTimeInMillis() - 300000); - - } - } - - /** - * Clean up the Admin client cache to remove expired entries. - */ - public static void adminCacheCleanup () { - for (String cacheKey : adminClientCache.keySet ()) { - if (adminClientCache.get (cacheKey).isExpired ()) { - adminClientCache.remove (cacheKey); - LOGGER.debug ("Cleaned Up Cached Admin Client for " + cacheKey); - } - } - } - - /** - * Reset the Admin client cache. - * This may be useful if cached credentials get out of sync. - */ - public static void adminCacheReset () { - adminClientCache = new HashMap<>(); - } - - @Override - public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity) { - return cloudIdentity.getIdentityUrl(); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java deleted file mode 100644 index df769ec0c2..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java +++ /dev/null @@ -1,588 +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.openecomp.mso.openstack.utils; - - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.NetworkInfo; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.exceptions.MsoNetworkAlreadyExists; -import org.openecomp.mso.openstack.exceptions.MsoNetworkNotFound; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import com.woorea.openstack.base.client.OpenStackBaseException; -import com.woorea.openstack.base.client.OpenStackConnectException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponseException; -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.utils.KeystoneUtils; -import com.woorea.openstack.quantum.Quantum; -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Networks; -import com.woorea.openstack.quantum.model.Segment; -import com.woorea.openstack.keystone.model.Authentication; - -public class MsoNeutronUtils extends MsoCommonUtils -{ - // Cache Neutron Clients statically. Since there is just one MSO user, there is no - // benefit to re-authentication on every request (or across different flows). The - // token will be used until it expires. - // - // The cache key is "tenantId:cloudId" - private static Map neutronClientCache = new HashMap<>(); - - private CloudConfigFactory cloudConfigFactory; - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private String msoPropID; - - public enum NetworkType { - BASIC, PROVIDER, MULTI_PROVIDER - }; - - public MsoNeutronUtils(String msoPropID, CloudConfigFactory cloudConfigFactory) { - this.cloudConfigFactory = cloudConfigFactory; - this.msoPropID = msoPropID; - } - - protected CloudConfigFactory getCloudConfigFactory() { - return cloudConfigFactory; - } - - /** - * Create a network with the specified parameters in the given cloud/tenant. - * - * If a network already exists with the same name, an exception will be thrown. Note that - * this is an MSO-imposed restriction. Openstack does not require uniqueness on network names. - *

- * @param cloudSiteId The cloud identifier (may be a region) in which to create the network. - * @param tenantId The tenant in which to create the network - * @param type The type of network to create (Basic, Provider, Multi-Provider) - * @param networkName The network name to create - * @param provider The provider network name (for Provider or Multi-Provider networks) - * @param vlans A list of VLAN segments for the network (for Provider or Multi-Provider networks) - * @return a NetworkInfo object which describes the newly created network - * @throws MsoNetworkAlreadyExists Thrown if a network with the same name already exists - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - * @throws MsoCloudSiteNotFound Thrown if the cloudSite is invalid or unknown - */ - public NetworkInfo createNetwork (String cloudSiteId, String tenantId, NetworkType type, String networkName, String provider, List vlans) - throws MsoException - { - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - - Quantum neutronClient = getNeutronClient (cloudSite, tenantId); - - // Check if a network already exists with this name - // Openstack will allow duplicate name, so require explicit check - Network network = findNetworkByName (neutronClient, networkName); - - if (network != null) { - // Network already exists. Throw an exception - LOGGER.error(MessageEnum.RA_NETWORK_ALREADY_EXIST, networkName, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network already exists"); - throw new MsoNetworkAlreadyExists (networkName, tenantId, cloudSiteId); - } - - // Does not exist, create a new one - network = new Network(); - network.setName(networkName); - network.setAdminStateUp(true); - - if (type == NetworkType.PROVIDER) { - if (provider != null && vlans != null && vlans.size() > 0) { - network.setProviderPhysicalNetwork (provider); - network.setProviderNetworkType("vlan"); - network.setProviderSegmentationId (vlans.get(0)); - } - } else if (type == NetworkType.MULTI_PROVIDER) { - if (provider != null && vlans != null && vlans.size() > 0) { - List segments = new ArrayList<>(vlans.size()); - for (int vlan : vlans) { - Segment segment = new Segment(); - segment.setProviderPhysicalNetwork (provider); - segment.setProviderNetworkType("vlan"); - segment.setProviderSegmentationId (vlan); - - segments.add(segment); - } - network.setSegments(segments); - } - } - - try { - OpenStackRequest request = neutronClient.networks().create(network); - Network newNetwork = executeAndRecordOpenstackRequest(request); - return new NetworkInfo(newNetwork); - } - catch (OpenStackBaseException e) { - // Convert Neutron exception to an MsoOpenstackException - MsoException me = neutronExceptionToMsoException (e, "CreateNetwork"); - throw me; - } - catch (RuntimeException e) { - // Catch-all - MsoException me = runtimeExceptionToMsoException(e, "CreateNetwork"); - throw me; - } - } - - - /** - * Query for a network with the specified name or ID in the given cloud. If the network exists, - * return an NetworkInfo object. If not, return null. - *

- * Whenever possible, the network ID should be used as it is much more efficient. Query by - * name requires retrieval of all networks for the tenant and search for matching name. - *

- * @param networkNameOrId The network to query - * @param tenantId The Openstack tenant to look in for the network - * @param cloudSiteId The cloud identifier (may be a region) in which to query the network. - * @return a NetworkInfo object describing the queried network, or null if not found - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - * @throws MsoCloudSiteNotFound - */ - public NetworkInfo queryNetwork(String networkNameOrId, String tenantId, String cloudSiteId) throws MsoException - { - LOGGER.debug("In queryNetwork"); - - // Obtain the cloud site information - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - - Quantum neutronClient = getNeutronClient (cloudSite, tenantId); - // Check if the network exists and return its info - try { - Network network = findNetworkByNameOrId (neutronClient, networkNameOrId); - if (network == null) { - LOGGER.debug ("Query Network: " + networkNameOrId + " not found in tenant " + tenantId); - return null; - } - return new NetworkInfo(network); - } - catch (OpenStackBaseException e) { - // Convert Neutron exception to an MsoOpenstackException - MsoException me = neutronExceptionToMsoException (e, "QueryNetwork"); - throw me; - } - catch (RuntimeException e) { - // Catch-all - MsoException me = runtimeExceptionToMsoException(e, "QueryNetwork"); - throw me; - } - } - - /** - * Delete the specified Network (by ID) in the given cloud. - * If the network does not exist, success is returned. - *

- * @param networkId Openstack ID of the network to delete - * @param tenantId The Openstack tenant. - * @param cloudSiteId The cloud identifier (may be a region) from which to delete the network. - * @return true if the network was deleted, false if the network did not exist - * @throws MsoOpenstackException If the Openstack API call returns an exception, this local - * exception will be thrown. - * @throws MsoCloudSiteNotFound - */ - public boolean deleteNetwork(String networkId, String tenantId, String cloudSiteId) throws MsoException - { - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - Quantum neutronClient = getNeutronClient (cloudSite, tenantId); - try { - // Check that the network exists. - Network network = findNetworkById (neutronClient, networkId); - if (network == null) { - LOGGER.info(MessageEnum.RA_DELETE_NETWORK_EXC, networkId, cloudSiteId, tenantId, "Openstack", ""); - return false; - } - - OpenStackRequest request = neutronClient.networks().delete(network.getId()); - executeAndRecordOpenstackRequest(request); - - LOGGER.debug ("Deleted Network " + network.getId() + " (" + network.getName() + ")"); - } - catch (OpenStackBaseException e) { - // Convert Neutron exception to an MsoOpenstackException - MsoException me = neutronExceptionToMsoException (e, "Delete Network"); - throw me; - } - catch (RuntimeException e) { - // Catch-all - MsoException me = runtimeExceptionToMsoException(e, "DeleteNetwork"); - throw me; - } - - return true; - } - - - /** - * Update a network with the specified parameters in the given cloud/tenant. - * - * Specifically, this call is intended to update the VLAN segments on a - * multi-provider network. The provider segments will be replaced with the - * supplied list of VLANs. - *

- * Note that updating the 'segments' array is not normally supported by Neutron. - * This method relies on a Platform Orchestration extension (using SDN controller - * to manage the virtual networking). - * - * @param cloudSiteId The cloud site ID (may be a region) in which to update the network. - * @param tenantId Openstack ID of the tenant in which to update the network - * @param networkId The unique Openstack ID of the network to be updated - * @param type The network type (Basic, Provider, Multi-Provider) - * @param provider The provider network name. This should not change. - * @param vlans The list of VLAN segments to replace - * @return a NetworkInfo object which describes the updated network - * @throws MsoNetworkNotFound Thrown if the requested network does not exist - * @throws MsoOpenstackException Thrown if the Openstack API call returns an exception - * @throws MsoCloudSiteNotFound - */ - public NetworkInfo updateNetwork (String cloudSiteId, String tenantId, String networkId, NetworkType type, String provider, List vlans) - throws MsoException - { - // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - Quantum neutronClient = getNeutronClient (cloudSite, tenantId); - // Check that the network exists - Network network = findNetworkById (neutronClient, networkId); - - if (network == null) { - // Network not found. Throw an exception - LOGGER.error(MessageEnum.RA_NETWORK_NOT_FOUND, networkId, cloudSiteId, tenantId, "Openstack", "", MsoLogger.ErrorCode.DataError, "Network not found"); - throw new MsoNetworkNotFound (networkId, tenantId, cloudSiteId); - } - - // Overwrite the properties to be updated - if (type == NetworkType.PROVIDER) { - if (provider != null && vlans != null && vlans.size() > 0) { - network.setProviderPhysicalNetwork (provider); - network.setProviderNetworkType("vlan"); - network.setProviderSegmentationId (vlans.get(0)); - } - } else if (type == NetworkType.MULTI_PROVIDER) { - if (provider != null && vlans != null && vlans.size() > 0) { - List segments = new ArrayList<>(vlans.size()); - for (int vlan : vlans) { - Segment segment = new Segment(); - segment.setProviderPhysicalNetwork (provider); - segment.setProviderNetworkType("vlan"); - segment.setProviderSegmentationId (vlan); - - segments.add(segment); - } - network.setSegments(segments); - } - } - - try { - OpenStackRequest request = neutronClient.networks().update(network); - Network newNetwork = executeAndRecordOpenstackRequest(request); - return new NetworkInfo(newNetwork); - } - catch (OpenStackBaseException e) { - // Convert Neutron exception to an MsoOpenstackException - MsoException me = neutronExceptionToMsoException (e, "UpdateNetwork"); - throw me; - } - catch (RuntimeException e) { - // Catch-all - MsoException me = runtimeExceptionToMsoException(e, "UpdateNetwork"); - throw me; - } - } - - - // ------------------------------------------------------------------- - // PRIVATE UTILITY FUNCTIONS FOR USE WITHIN THIS CLASS - - /** - * Get a Neutron (Quantum) client for the Openstack Network service. - * This requires a 'member'-level userId + password, which will be retrieved from - * properties based on the specified cloud Id. The tenant in which to operate - * must also be provided. - *

- * On successful authentication, the Quantum object will be cached for the - * tenantID + cloudId so that it can be reused without reauthenticating with - * Openstack every time. - * - * @param cloudSite - a cloud site definition - * @param tenantId - Openstack tenant ID - * @return an authenticated Quantum object - */ - private Quantum getNeutronClient(CloudSite cloudSite, String tenantId) throws MsoException - { - String cloudId = cloudSite.getId(); - - // Check first in the cache of previously authorized clients - String cacheKey = cloudId + ":" + tenantId; - if (neutronClientCache.containsKey(cacheKey)) { - if (! neutronClientCache.get(cacheKey).isExpired()) { - LOGGER.debug ("Using Cached HEAT Client for " + cacheKey); - Quantum neutronClient = neutronClientCache.get(cacheKey).getNeutronClient(); - return neutronClient; - } - else { - // Token is expired. Remove it from cache. - neutronClientCache.remove(cacheKey); - LOGGER.debug ("Expired Cached Neutron Client for " + cacheKey); - } - } - - // Obtain an MSO token for the tenant from the identity service - CloudIdentity cloudIdentity = cloudSite.getIdentityService(); - Keystone keystoneTenantClient = new Keystone (cloudIdentity.getKeystoneUrl(cloudId, msoPropID)); - Access access = null; - try { - Authentication credentials = cloudIdentity.getAuthentication (); - OpenStackRequest request = keystoneTenantClient.tokens().authenticate(credentials).withTenantId(tenantId); - access = executeAndRecordOpenstackRequest(request); - } - catch (OpenStackResponseException e) { - if (e.getStatus() == 401) { - // Authentication error. - String error = "Authentication Failure: tenant=" + tenantId + ",cloud=" + cloudIdentity.getId(); - alarmLogger .sendAlarm("MsoAuthenticationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException(error); - } - else { - MsoException me = keystoneErrorToMsoException(e, "TokenAuth"); - throw me; - } - } - catch (OpenStackConnectException e) { - // Connection to Openstack failed - MsoIOException me = new MsoIOException (e.getMessage(), e); - me.addContext("TokenAuth"); - throw me; - } - catch (RuntimeException e) { - // Catch-all - MsoException me = runtimeExceptionToMsoException(e, "TokenAuth"); - throw me; - } - - String region = cloudSite.getRegionId(); - String neutronUrl = null; - try { - neutronUrl = KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "network", region, "public"); - if (! neutronUrl.endsWith("/")) { - neutronUrl += "/v2.0/"; - } - } catch (RuntimeException e) { - // This comes back for not found (probably an incorrect region ID) - String error = "Network service not found: region=" + region + ",cloud=" + cloudIdentity.getId(); - alarmLogger.sendAlarm("MsoConfigurationError", MsoAlarmLogger.CRITICAL, error); - throw new MsoAdapterException (error, e); - } - - Quantum neutronClient = new Quantum(neutronUrl); - neutronClient.token(access.getToken().getId()); - - neutronClientCache.put(cacheKey, new NeutronCacheEntry(neutronUrl, access.getToken().getId(), access.getToken().getExpires())); - LOGGER.debug ("Caching Neutron Client for " + cacheKey); - - return neutronClient; - } - - /** - * Forcibly expire a Neutron client from the cache. This call is for use by - * the KeystoneClient in case where a tenant is deleted. In that case, - * all cached credentials must be purged so that fresh authentication is - * done on subsequent calls. - */ - public static void expireNeutronClient (String tenantId, String cloudId) { - String cacheKey = cloudId + ":" + tenantId; - if (neutronClientCache.containsKey(cacheKey)) { - neutronClientCache.remove(cacheKey); - LOGGER.debug ("Deleted Cached Neutron Client for " + cacheKey); - } - } - - - /* - * Find a tenant (or query its existence) by its Name or Id. Check first against the - * ID. If that fails, then try by name. - * - * @param adminClient an authenticated Keystone object - * @param tenantName the tenant name or ID to query - * @return a Tenant object or null if not found - */ - public Network findNetworkByNameOrId (Quantum neutronClient, String networkNameOrId) - { - if (networkNameOrId == null) { - return null; - } - - Network network = findNetworkById(neutronClient, networkNameOrId); - - if (network == null) { - network = findNetworkByName(neutronClient, networkNameOrId); - } - - return network; - } - - /* - * Find a network (or query its existence) by its Id. - * - * @param neutronClient an authenticated Quantum object - * @param networkId the network ID to query - * @return a Network object or null if not found - */ - private static Network findNetworkById (Quantum neutronClient, String networkId) - { - if (networkId == null) { - return null; - } - - try { - OpenStackRequest request = neutronClient.networks().show(networkId); - Network network = executeAndRecordOpenstackRequest(request); - return network; - } - catch (OpenStackResponseException e) { - if (e.getStatus() == 404) { - return null; - } else { - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error, GET Network By ID (" + networkId + "): " + e, "Openstack", "", MsoLogger.ErrorCode.DataError, "Exception in Openstack"); - throw e; - } - } - } - - /* - * Find a network (or query its existence) by its Name. This method avoids an - * initial lookup by ID when it's known that we have the network Name. - * - * Neutron does not support 'name=*' query parameter for Network query (show). - * The only way to query by name is to retrieve all networks and look for the - * match. While inefficient, this capability will be provided as it is needed - * by MSO, but should be avoided in favor of ID whenever possible. - * - * TODO: - * Network names are not required to be unique, though MSO will attempt to enforce - * uniqueness. This call probably needs to return an error (instead of returning - * the first match). - * - * @param neutronClient an authenticated Quantum object - * @param networkName the network name to query - * @return a Network object or null if not found - */ - public Network findNetworkByName (Quantum neutronClient, String networkName) - { - if (networkName == null) { - return null; - } - - try { - OpenStackRequest request = neutronClient.networks().list(); - Networks networks = executeAndRecordOpenstackRequest(request); - for (Network network : networks.getList()) { - if (network.getName().equals(networkName)) { - LOGGER.debug ("Found match on network name: " + networkName); - return network; - } - } - LOGGER.debug ("findNetworkByName - no match found for " + networkName); - return null; - } - catch (OpenStackResponseException e) { - if (e.getStatus() == 404) { - return null; - } else { - LOGGER.error (MessageEnum.RA_CONNECTION_EXCEPTION, "OpenStack", "Openstack Error, GET Network By Name (" + networkName + "): " + e, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception in OpenStack"); - throw e; - } - } - } - - - /* - * An entry in the Neutron Client Cache. It saves the Neutron client object - * along with the token expiration. After this interval, this cache - * item will no longer be used. - */ - private static class NeutronCacheEntry implements Serializable - { - private static final long serialVersionUID = 1L; - - private String neutronUrl; - private String token; - private Calendar expires; - - public NeutronCacheEntry (String neutronUrl, String token, Calendar expires) { - this.neutronUrl = neutronUrl; - this.token = token; - this.expires = expires; - } - - public Quantum getNeutronClient () { - Quantum neutronClient = new Quantum(neutronUrl); - neutronClient.token(token); - return neutronClient; - } - - public boolean isExpired() { - return expires == null || System.currentTimeMillis() > expires.getTimeInMillis(); - } - } - - /** - * Clean up the Neutron client cache to remove expired entries. - */ - public static void neutronCacheCleanup () { - for (String cacheKey : neutronClientCache.keySet()) { - if (neutronClientCache.get(cacheKey).isExpired()) { - neutronClientCache.remove(cacheKey); - LOGGER.debug ("Cleaned Up Cached Neutron Client for " + cacheKey); - } - } - } - - /** - * Reset the Neutron client cache. - * This may be useful if cached credentials get out of sync. - */ - public static void neutronCacheReset () { - neutronClientCache = new HashMap<>(); - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java deleted file mode 100644 index 964babd1e0..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtils.java +++ /dev/null @@ -1,75 +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.openecomp.mso.openstack.utils; - - -import java.util.Map; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.MsoTenant; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -public abstract class MsoTenantUtils extends MsoCommonUtils { - - private CloudConfigFactory cloudConfigFactory; - protected MsoPropertiesFactory msoPropFactory; - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - protected MsoJavaProperties msoProps; - - public MsoTenantUtils (String msoPropID, CloudConfigFactory cloudConfigFactory) { - this.cloudConfigFactory = cloudConfigFactory; - msoPropFactory = new MsoPropertiesFactory(); - - LOGGER.debug("msoTenantUtils:" + msoPropID); - - try { - msoProps = msoPropFactory.getMsoJavaProperties (msoPropID); - } catch (MsoPropertiesException e) { - LOGGER.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + msoPropID, "", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e); - } - } - - public CloudConfigFactory getCloudConfigFactory() { - return cloudConfigFactory; - } - - public abstract String createTenant (String tenantName, String cloudSiteId, Map metadata, boolean backout) - throws MsoException; - - public abstract MsoTenant queryTenant (String tenantId, String cloudSiteId) - throws MsoException, MsoCloudSiteNotFound; - - public abstract MsoTenant queryTenantByName (String tenantName, String cloudSiteId) - throws MsoException, MsoCloudSiteNotFound; - - public abstract boolean deleteTenant (String tenantId, String cloudSiteId) - throws MsoException; - - public abstract String getKeystoneUrl (String regionId, String msoPropID, CloudIdentity cloudIdentity) - throws MsoException; - -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java deleted file mode 100644 index 49c262268d..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactory.java +++ /dev/null @@ -1,75 +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.openecomp.mso.openstack.utils; - -import java.lang.reflect.InvocationTargetException; - -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; - - -public class MsoTenantUtilsFactory { - - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); - private String msoPropID; - - public MsoTenantUtilsFactory (String msoPropID) { - this.msoPropID = msoPropID; - } - - public void setCloudConfigFactory(CloudConfigFactory cloudConfigFactory) { - this.cloudConfigFactory = cloudConfigFactory; - } - - public CloudConfigFactory getCloudConfigFactory() { - return cloudConfigFactory; - } - - //based on Cloud IdentityServerType returns ORM or KEYSTONE Utils - public MsoTenantUtils getTenantUtils(String cloudSiteId) throws MsoCloudSiteNotFound { - // Obtain the cloud site information - CloudConfig cloudConfig = getCloudConfigFactory().getCloudConfig(); - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( - () -> new MsoCloudSiteNotFound(cloudSiteId)); - return getTenantUtilsByServerType(cloudSite.getIdentityService().getIdentityServerType().toString()); - } - - public MsoTenantUtils getTenantUtilsByServerType(String serverType) { - - MsoTenantUtils tenantU = null; - if (CloudIdentity.IdentityServerType.KEYSTONE.toString().equals(serverType)) { - tenantU = new MsoKeystoneUtils(msoPropID, getCloudConfigFactory()); - } else { - try { - tenantU = CloudIdentity.IdentityServerType.valueOf(serverType).getMsoTenantUtilsClass() - .getConstructor(String.class, CloudConfigFactory.class).newInstance(msoPropID, getCloudConfigFactory()); - } catch (InvocationTargetException | InstantiationException | NoSuchMethodException | IllegalAccessException e) { - throw new RuntimeException("Could not instantiate an MsoTenantUtils class for " + serverType, e); - } - } - return tenantU; - } -} diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java deleted file mode 100644 index 8704911e26..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvt.java +++ /dev/null @@ -1,163 +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.openecomp.mso.openstack.utils; - - - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.Map.Entry; -import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; -import com.fasterxml.jackson.databind.ObjectMapper; - -import org.yaml.snakeyaml.Yaml; - -import org.openecomp.mso.logger.MsoLogger; - -public class MsoYamlEditorWithEnvt { - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - private Map yml; - private Yaml yaml = new Yaml (); - private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); - - public MsoYamlEditorWithEnvt() { - super(); - } - public MsoYamlEditorWithEnvt(byte[] b) { - init(b); - } - - @SuppressWarnings("unchecked") - private synchronized void init (byte[] body) { - InputStream input = new ByteArrayInputStream (body); - yml = (Map ) yaml.load (input); - } - - @SuppressWarnings("unchecked") - public synchronized Set getParameterListFromEnvt() { - // In an environment entry, the parameters section can only contain the name:value - - // not other attributes. - Set paramSet = new HashSet<>(); - Map resourceMap = null; - try { - resourceMap = (Map) yml.get("parameters"); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - return paramSet; - } - if (resourceMap == null) { - return paramSet; - } - - for (Entry stringObjectEntry : resourceMap.entrySet()) { - MsoHeatEnvironmentParameter hep = new MsoHeatEnvironmentParameter(); - Entry pair = stringObjectEntry; - String value; - Object obj = pair.getValue(); - if (obj instanceof String) { - value = yaml.dump(obj); - // but this adds an extra '\n' at the end - which won't hurt - but we don't need it - value = value.substring(0, value.length() - 1); - } else if (obj instanceof LinkedHashMap) { - //Handle that it's json - try { - value = JSON_MAPPER.writeValueAsString(obj); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - value = "_BAD_JSON_MAPPING"; - } - } else { - //this handles integers/longs/floats/etc. - value = String.valueOf(obj); - } - hep.setName((String) pair.getKey()); - hep.setValue(value); - paramSet.add(hep); - } - return paramSet; - } - public synchronized Set getResourceListFromEnvt() { - try { - Set resourceList = new HashSet<>(); - @SuppressWarnings("unchecked") - Map resourceMap = (Map) yml.get("resource_registry"); - - for (Entry stringObjectEntry : resourceMap.entrySet()) { - MsoHeatEnvironmentResource her = new MsoHeatEnvironmentResource(); - Entry pair = stringObjectEntry; - her.setName((String) pair.getKey()); - her.setValue((String) pair.getValue()); - resourceList.add(her); - } - return resourceList; - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - return null; - } - public synchronized Set getParameterList () { - Set paramSet = new HashSet <> (); - @SuppressWarnings("unchecked") - Map resourceMap = (Map ) yml.get ("parameters"); - - for (Entry stringObjectEntry : resourceMap.entrySet()) { - HeatTemplateParam param = new HeatTemplateParam(); - Entry pair = stringObjectEntry; - @SuppressWarnings("unchecked") - Map resourceEntry = (Map) pair.getValue(); - String value = null; - try { - value = resourceEntry.get("default"); - } catch (ClassCastException cce) { - LOGGER.debug("Exception:", cce); - // This exception only - the value is an integer. For what we're doing - // here - we don't care - so set value to something - and it will - // get marked as not being required - which is correct. - //System.out.println("cce exception!"); - value = "300"; - // okay - } - param.setParamName((String) pair.getKey()); - if (value != null) { - param.setRequired(false); - } else { - param.setRequired(true); - } - value = resourceEntry.get("type"); - param.setParamType(value); - - paramSet.add(param); - - } - return paramSet; - - } - - -} diff --git a/adapters/mso-adapter-utils/src/main/resources/application-local.yaml b/adapters/mso-adapter-utils/src/main/resources/application-local.yaml new file mode 100644 index 0000000000..5fc2144bd6 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/resources/application-local.yaml @@ -0,0 +1,64 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck +# MSO Properties go here +mso: + catalog: + db: + spring: + endpoint: "http://localhost:8080" + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= +cloud_config: + identity_services: + MT_KEYSTONE: + identity_url: "http://localhost:5000/v2.0" + mso_id: "john" + mso_pass: "313DECE408AF7759D442D7B06DD9A6AA" + admin_tenant: "admin" + member_role: "_member_" + tenant_metadata: false + identity_server_type: "KEYSTONE" + identity_authentication_type: "USERNAME_PASSWORD" + DAN_KEYSTONE: + identity_url: "http://192.168.170.21:5000/v2.0" + mso_id: "jc1348" + mso_pass: "313DECE408AF7759D442D7B06DD9A6AA" + admin_tenant: "service" + member_role: "_member_" + tenant_metadata: false + identity_server_type: "KEYSTONE" + identity_authentication_type: "USERNAME_PASSWORD" + cloud_sites: + regionOne: + region_id: "regionOne" + clli: "MT2" + aic_version: "2.5" + identity_service_id: "MT_KEYSTONE" + DAN: + region_id: "RegionOne" + clli: "MT" + aic_version: "2.5" + identity_service_id: "DAN_KEYSTONE" + DEFAULT: + region_id: "" + clli: "MTN6" + aic_version: "3.0" + identity_service_id: "ORDM3" +adapters: + po: + retryCodes: "504" + retryDelay: "5" + retryCount: "3" + tenant: + tenant_description: "ECOMP Tenant" + region_type: "single" + user_role: "admin" + success_status_string: "Success" + no_regions_status_string: "no regions" + orm_request_path: "/v1/orm/customers/" + x_aic_orm_client_string: "ECOMP-MSO" + keystone_url_version: "/v2.0" + keystone_reg_ex: "/[vV][0-9]" + orm_url_replace_this: "8080" + orm_url_replace_with_this: "7080" + quota_value: "10" + set_default_quota: "false" diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..36f82e15bd --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,46 @@ +/*- + * ============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 com.github.tomakehurst.wiremock.client.WireMock; +import org.junit.After; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +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") +@AutoConfigureWireMock(port = 0) +public abstract class BaseTest extends TestDataSetup { + + @Value("${wiremock.server.port}") + protected int wireMockPort; + + @After + public void after() { + WireMock.reset(); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java new file mode 100644 index 0000000000..f5867befc0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/StubOpenStack.java @@ -0,0 +1,148 @@ +/*- + * ============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.apache.http.HttpStatus; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.IOException; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +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.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; + +public class StubOpenStack { + + public static void mockOpenStackResponseAccess(int port) throws IOException { + stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackDelete(String id) { + stubFor(delete(urlMatching("/mockPublicUrl/stacks/" + id)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + } + + + public static void mockOpenStackPostStack_200(String filename) { + stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException { + stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) + .willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetTenantByName(String tenantName) throws IOException { + stubFor(get(urlMatching("/mockPublicUrl/tenants/[?]name=" + tenantName)) + .willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetTenantById(String tenantId) throws IOException { + stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId")) + .willReturn(aResponse().withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackDeleteTenantById_200(String tenantId) { + stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetUserById(String user) { + stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetUserByName(String userName) { + stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetUserByName_500(String userName) { + stubFor(get(urlMatching("/mockPublicUrl/users/[?]name=" + userName)).willReturn(aResponse() + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + } + + public static void mockOpenStackGetRoles_200(String roleFor) { + stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenstackPostNetwork(String responseFile) { + stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenstackPutNetwork(String responseFile, String networkId) { + stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetNeutronNetwork(String filename,String networkId) { + stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetNeutronNetwork_500(String networkId) { + stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) + .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + } + + public static void mockOpenStackDeleteNeutronNetwork(String networkId) { + stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) + .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); + } + + private static String readFile(String fileName) throws IOException { + try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + return sb.toString(); + } + } + + public static String getBodyFromFile(String fileName, int port, String urlPath) throws IOException { + return readFile("src/test/resources/__files/" + fileName).replaceAll("port", "http://localhost:" + port + urlPath); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/TestApplication.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..479731c870 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/TestApplication.java @@ -0,0 +1,39 @@ +/*- + * ============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; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +@SpringBootApplication +@Profile("test") +@ComponentScan(basePackages = {"org.onap.so", "com.att"}, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/TestDataSetup.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/TestDataSetup.java new file mode 100644 index 0000000000..21c4c225ba --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/TestDataSetup.java @@ -0,0 +1,40 @@ +/*- + * ============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.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TestDataSetup { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + public static final String RESOURCE_PATH = "src/test/resources/__files/"; + public ObjectMapper mapper; + + @Before + public void testDataSetupBefore() { + mapper = new ObjectMapper(); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java new file mode 100644 index 0000000000..539e7acef0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapter_utils.tests; + + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.cloud.Application; +import org.onap.so.openstack.utils.MsoCommonUtils; +import org.onap.so.openstack.utils.MsoHeatUtils; +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; +import static org.junit.Assert.assertEquals; + +/** + * This class implements test methods of the MsoHeatUtils + * + * + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@ActiveProfiles("test") +public class MsoHeatUtilsRefactorTest extends MsoCommonUtils { + + @Autowired + private MsoHeatUtils msoHeatUtils; + + @Test + public final void testGetKeystoneUrl() { + try { + String keyUrl = msoHeatUtils.getCloudSiteKeystoneUrl("DAN"); + assertEquals("http://192.168.170.21:5000/v2.0",keyUrl); + } catch (Exception e) { + + } + } + + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java new file mode 100644 index 0000000000..c9a0a1d8c6 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsTest.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapter_utils.tests; + +import java.util.HashMap; + +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.cloud.Application; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.exceptions.MsoStackAlreadyExists; +import org.onap.so.openstack.exceptions.MsoTenantNotFound; +import org.onap.so.openstack.utils.MsoCommonUtils; +import org.onap.so.openstack.utils.MsoHeatUtils; +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; + +import com.woorea.openstack.heat.model.CreateStackParam; + +/** + * This class implements test methods of the MsoHeatUtils + * + * + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@ActiveProfiles("test") +@Ignore +public class MsoHeatUtilsTest extends MsoCommonUtils { + @Autowired + private MsoHeatUtils msoHeatUtils; + + @Test + public final void testCreateStackBadCloudConfig() + throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + try { + msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap(), + Boolean.TRUE, 10); + } catch (MsoCloudSiteNotFound e) { + + } catch (java.lang.NullPointerException npe) { + + } + + } + + @Test + public final void testCreateStackFailedConnectionHeatClient() + throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap(), Boolean.TRUE, + 10); + } catch (MsoIOException e) { + + } + + } + + @Test + public final void testCreateStackFailedConnection() + throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap(), Boolean.TRUE, + 10); + } catch (MsoIOException e) { + + } + + } + + @Test + public final void createStackSuccessWithEnvironment() throws MsoException { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap(), Boolean.TRUE, 10, + "environment"); + } catch (MsoIOException e) { + + } + + } + + @Test + public final void createStackSuccessWithFiles() throws MsoException { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap(), Boolean.TRUE, 10, + "environment", new HashMap()); + } catch (MsoIOException e) { + + } + + } + + @Test + public final void createStackSuccessWithHeatFiles() throws MsoException { + try { + msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap(), Boolean.TRUE, 10, + "environment", new HashMap(), new HashMap()); + } catch (MsoIOException e) { + + } + } + + @Test + public final void requestToStringBuilderTest() { + CreateStackParam param = new CreateStackParam(); + param.setDisableRollback(false); + param.setEnvironment("environment"); + param.setFiles(new HashMap()); + param.setParameters(new HashMap<>()); + param.setStackName("stackName"); + param.setTemplate("template"); + param.setTemplateUrl("http://templateUrl"); + param.setTimeoutMinutes(1); + + msoHeatUtils.requestToStringBuilder(param); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java new file mode 100644 index 0000000000..6d9687216d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java @@ -0,0 +1,134 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapter_utils.tests; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; + +import java.security.GeneralSecurityException; +import java.util.HashMap; +import java.util.Map; + +import java.util.Optional; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloud.ServerType; +import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate; +import org.onap.so.utils.CryptoUtils; + +import com.woorea.openstack.base.client.OpenStackConnectException; + +@RunWith(MockitoJUnitRunner.class) +public class MsoHeatUtilsWithUpdateTest { + + + @Mock + private CloudConfig cloudConfig; + @InjectMocks + private MsoHeatUtilsWithUpdate util=new MsoHeatUtilsWithUpdate(); + + private CloudSite cloudSite; + + @Before + public void init () { + cloudSite = new CloudSite (); + cloudSite.setRegionId("cloud"); + CloudIdentity cloudIdentity = new CloudIdentity (); + cloudIdentity.setIdentityServerType(ServerType.KEYSTONE); + cloudIdentity.setIdentityUrl("toto"); + cloudIdentity.setMsoPass (CryptoUtils.encryptCloudConfigPassword("mockId")); + cloudSite.setIdentityService (cloudIdentity); + when(cloudConfig.getCloudSite("cloud")).thenReturn (Optional.of(cloudSite)); + when(cloudConfig.getCloudSite("none")).thenReturn (Optional.empty()); + } + + @Test + @Ignore + public void testUpdateStack () { + // Heat heat = Mockito.mock (Heat.class); + Map stackInputs = new HashMap <> (); + try { + util.updateStack ("none", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1); + } catch (MsoException e) { + if (e instanceof MsoCloudSiteNotFound) { + // Ok + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment"); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + try { + util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null, null); + } catch (MsoException e) { + if (e instanceof MsoIOException && e.getCause () != null + && e.getCause () instanceof OpenStackConnectException) { + // Ok, we were able to go up to the connection to OpenStack + } else { + e.printStackTrace (); + fail ("Exception caught"); + } + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java new file mode 100644 index 0000000000..668b1806ac --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java @@ -0,0 +1,107 @@ +/*- + * ============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.cloud; + +import static org.junit.Assert.*; + +import java.util.Map; +import java.util.Optional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.BaseTest; +import org.onap.so.openstack.exceptions.MsoException; +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; + +/** + * This class implements test methods of the CloudConfig features. + * + * + */ +public class CloudConfigTest extends BaseTest { + + @Autowired + private CloudConfig con; + + /** + * This method implements a test for the getCloudSites method. + */ + @Test + public final void testGetCloudSites () { + Map siteMap = con.getCloudSites(); + assertNotNull(siteMap); + + CloudSite site1 = siteMap.get("regionOne"); + + assertEquals ("regionOne", site1.getRegionId()); + assertEquals ("MT_KEYSTONE", site1.getIdentityServiceId()); + assertEquals ("MT2", site1.getClli()); + assertEquals ("2.5", site1.getAicVersion()); + } + + + /** + * This method implements a test for the getIdentityServices method. + * @throws MsoException + */ + @Test + public final void testGetIdentityServices () throws MsoException { + Map identityMap = con.getIdentityServices (); + assertNotNull(identityMap); + + CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); + + assertEquals("john", identity1.getMsoId()); + assertEquals("313DECE408AF7759D442D7B06DD9A6AA", identity1.getMsoPass()); + assertEquals("admin", identity1.getAdminTenant()); + assertEquals("_member_", identity1.getMemberRole()); + assertEquals(false, identity1.hasTenantMetadata()); + assertEquals("http://localhost:"+wireMockPort+"/v2.0", identity1.getIdentityUrl()); + assertEquals(ServerType.KEYSTONE, identity1.getIdentityServerType()); + assertEquals(AuthenticationType.USERNAME_PASSWORD, identity1.getIdentityAuthenticationType()); + + } + + /** + * This method implements a test for the getCloudSite method. + */ + @Test + public final void testGetDefaultCloudSite () { + Optional site = con.getCloudSite("NotThere"); + assertTrue(site.isPresent()); + CloudSite site1 = site.get(); + assertEquals ("NotThere", site1.getRegionId()); + assertEquals("MTN6", site1.getClli()); + assertEquals("NotThere", site1.getId()); + assertEquals ("ORDM3", site1.getIdentityServiceId()); + } + + @Test + public void testGetIdentityService() { + CloudIdentity identity = con.getIdentityService("MT_KEYSTONE"); + assertEquals("john", identity.getMsoId()); + assertEquals("MT_KEYSTONE", identity.getId()); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java new file mode 100644 index 0000000000..db2ba05bf1 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudIdentityTest.java @@ -0,0 +1,100 @@ +/*- + * ============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.cloud; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.security.GeneralSecurityException; + +import org.junit.Test; +import org.onap.so.utils.CryptoUtils; + +public class CloudIdentityTest { + + private CloudIdentity cloudIdentity = new CloudIdentity(); + private static final String ID = "testId"; + private static final String IDENTITY_URL = "testIdentityUrl"; + private static final String MSO_ID = "testMsoId"; + private static final String MSO_PASS = "testMsoPassword"; + private static final String ADMIN_TENANT = "testAdminTenant"; + private static final String MEMBER_ROLE = "testMemberRole"; + private static final Boolean TENANT_METADATA = true; + + @Test + public final void testCloudIdentity () { + CloudIdentity id = new CloudIdentity (); + id.setAdminTenant ("AdminTenant"); + id.setId ("id"); +// id.setKeystoneUrl ("keystone"); + id.setIdentityUrl ("keystone"); + id.setMemberRole ("member"); + id.setMsoId ("msoId"); + id.setMsoPass (CryptoUtils.encryptCloudConfigPassword("password")); + id.setTenantMetadata (true); + id.setIdentityServerType(null); + id.setIdentityAuthenticationType(null); + + + assertTrue (id.getAdminTenant ().equals ("AdminTenant")); + assertTrue (id.getId ().equals ("id")); +// assertTrue (id.getKeystoneUrl ().equals ("keystone")); + assertTrue (id.getMemberRole ().equals ("member")); + assertTrue (id.getMsoId ().equals ("msoId")); + assertTrue (CryptoUtils.decryptCloudConfigPassword(id.getMsoPass()).equals ("password")); + assertTrue (id.hasTenantMetadata ()); +// assertTrue (id.toString ().contains ("keystone")); + assertTrue(id.toString().contains("null")); + } + + @Test + public final void testEncryption () throws GeneralSecurityException { + String encrypted = CryptoUtils.encryptCloudConfigPassword("password"); + assertTrue (encrypted != null); + assertTrue (!encrypted.equals ("password")); + } + + @Test + public void cloneTest() { + cloudIdentity = setupCloudIdentity(cloudIdentity, ID, IDENTITY_URL, MSO_ID, MSO_PASS, ADMIN_TENANT, + MEMBER_ROLE, TENANT_METADATA, ServerType.ORM, AuthenticationType.USERNAME_PASSWORD); + CloudIdentity cloudIdentity2 = cloudIdentity.clone(); + + assertEquals(cloudIdentity.getClass(), cloudIdentity2.getClass()); + } + + private CloudIdentity setupCloudIdentity(CloudIdentity obj, String id, String identityUrl, + String msoId, String msoPass, String adminTenant, String memberRole, Boolean tenantMetadata, + ServerType identityServerType, AuthenticationType identityAuthenticationType) { + obj.setId(id); + obj.setIdentityUrl(identityUrl); + obj.setMsoId(msoId); + obj.setMsoPass(msoPass); + obj.setAdminTenant(adminTenant); + obj.setMemberRole(memberRole); + obj.setTenantMetadata(tenantMetadata); + obj.setIdentityServerType(identityServerType); + obj.setIdentityAuthenticationType(identityAuthenticationType); + + return obj; + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java new file mode 100644 index 0000000000..89c15b0deb --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudPojoTest.java @@ -0,0 +1,58 @@ +/*- + * ============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.cloud; + +import org.junit.Test; +import org.onap.so.openpojo.rules.EqualsAndHashCodeTester; +import org.onap.so.openpojo.rules.ToStringTester; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.EqualsAndHashCodeMatchRule; +import com.openpojo.validation.rule.impl.NoPrimitivesRule; +import com.openpojo.validation.rule.impl.NoPublicFieldsRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class CloudPojoTest { + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(CloudIdentity.class)); + test(PojoClassFactory.getPojoClass(CloudifyManager.class)); + test(PojoClassFactory.getPojoClass(CloudSite.class)); + test(PojoClassFactory.getPojoClass(CloudConfig.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create() + .with(new EqualsAndHashCodeMatchRule()) + .with(new NoPrimitivesRule()) + .with(new NoPublicFieldsRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .with(new ToStringTester()) + .with(new EqualsAndHashCodeTester()) + .build(); + validator.validate(pojoClass); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java new file mode 100644 index 0000000000..9a660b4d40 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudifyManagerTest.java @@ -0,0 +1,46 @@ +/*- + * ============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.cloud; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class CloudifyManagerTest { + + private CloudifyManager cloudifyManager = new CloudifyManager(); + private static final String ID = "testId"; + private static final String CLOUDIFY_URL = "testCloudifyUrl"; + private static final String USERNAME = "testUsername"; + private static final String PASSWORD = "testPassword"; + private static final String VERSION = "testVersion"; + + @Test + public void cloneTest() { + cloudifyManager.setId(ID); + cloudifyManager.setCloudifyUrl(CLOUDIFY_URL); + cloudifyManager.setUsername(USERNAME); + cloudifyManager.setPassword(PASSWORD); + cloudifyManager.setVersion(VERSION); + + CloudifyManager clone = cloudifyManager.clone(); + assertEquals(cloudifyManager, clone); + } +} 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 new file mode 100644 index 0000000000..e1c533757b --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/authentication/AuthenticationMethodTest.java @@ -0,0 +1,106 @@ +/*- + * ============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.cloud.authentication; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.cloud.Application; +import org.onap.so.cloud.AuthenticationType; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.authentication.models.RackspaceAuthentication; +import org.onap.so.openstack.exceptions.MsoException; +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; + +import com.woorea.openstack.keystone.model.Authentication; +import com.woorea.openstack.keystone.model.authentication.UsernamePassword; + +/** + * A few JUnit tests to evaluate the new factory that manages authentication + * types and their associated wrapper classes. Here it is assumed that core types + * only are tested. + * + */ +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +@ActiveProfiles("test") +public class AuthenticationMethodTest { + + @Autowired + private AuthenticationMethodFactory authenticationMethodFactory; + /** + * + */ + public AuthenticationMethodTest() { + // TODO Auto-generated constructor stub + } + + @Test + public void testCustomRackspaceAuth() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("test"); + + Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); + assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + + } + + @Test + public void testCoreUsernamePasswordAuth() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("someuser"); + + Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); + assertTrue(UsernamePassword.class.equals(auth.getClass())); + + } + + @Test + public void testCustomRackspaceAuthFromCloudIdentity() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(AuthenticationType.RACKSPACE_APIKEY); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("test"); + + Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); + assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + } + + @Test + public void testCoreUsernamePasswordAuthFromCloudIdentity() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("someuser"); + + Authentication auth = authenticationMethodFactory.getAuthenticationFor(ci); + assertTrue(UsernamePassword.class.equals(auth.getClass())); + + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoTest.java new file mode 100644 index 0000000000..e200f9aa96 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/beans/DeploymentInfoTest.java @@ -0,0 +1,76 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.cloudify.beans; + +import static org.mockito.Mockito.mock; +import java.util.HashMap; +import java.util.Map; +import org.junit.Test; +import org.mockito.Mock; +import org.onap.so.cloudify.v3.model.Deployment; +import org.onap.so.cloudify.v3.model.DeploymentOutputs; +import org.onap.so.cloudify.v3.model.Execution; +import org.powermock.api.mockito.PowerMockito; + +public class DeploymentInfoTest { + + @Mock + DeploymentStatus status; + + @Mock + DeploymentOutputs out; + + @Mock + Execution execution; + + @Mock + Deployment deployment; + + @Test + public void test() { + Deployment deployment=mock(Deployment.class); + Map dep=new HashMap(); + Map outputs = new HashMap(); + Map inputs = new HashMap(); + inputs.put("id",dep); + status=DeploymentStatus.CREATED; + outputs.put("id", out); + dep.put("id", outputs); + DeploymentInfo dinfo=new DeploymentInfo(deployment); + DeploymentInfo dinfi=new DeploymentInfo("id"); + DeploymentInfo din=new DeploymentInfo("id",outputs); + DeploymentInfo dfo=new DeploymentInfo("id", status); + DeploymentInfo dfoi=new DeploymentInfo(deployment, out, execution); + dinfo=PowerMockito.spy(new DeploymentInfo()); + dinfo.setId("id"); + dinfi.setInputs(inputs); + din.setStatus(status); + din.setOutputs(outputs); + assert(din.toString()!=null); + assert(din.getOutputs().equals(outputs)); + assert(din.getId().equals("id")); + assert(din.getStatus().equals(status)); + din.getLastAction(); + din.getErrorMessage(); + din.getActionStatus(); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java new file mode 100644 index 0000000000..4bf087b7a4 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyExceptionTest.java @@ -0,0 +1,39 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.cloudify.exceptions; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MsoCloudifyExceptionTest { + + @Test + public void test() { + Exception e = null; + boolean pendingWorkflow=true; + MsoCloudifyException mce=new MsoCloudifyException(200, "message", "detail"); + MsoCloudifyException mcl=new MsoCloudifyException(200, "message", "detail", e); + mce.setPendingWorkflow(pendingWorkflow); + assert(mcl.toString()!=null); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java new file mode 100644 index 0000000000..a1859e491a --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTest.java @@ -0,0 +1,35 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.cloudify.exceptions; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MsoCloudifyTest { + + @Test + public void test() { + MsoBlueprintAlreadyExists mbae=new MsoBlueprintAlreadyExists("blueprintId", "cloud"); + MsoCloudifyManagerNotFound mcm=new MsoCloudifyManagerNotFound("cloudSiteId"); + MsoDeploymentAlreadyExists mdae=new MsoDeploymentAlreadyExists("deploymentId", "cloud"); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java new file mode 100644 index 0000000000..21c625feb3 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyTimeoutTest.java @@ -0,0 +1,38 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.cloudify.exceptions; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +import org.junit.Test; +import org.onap.so.cloudify.v3.model.Execution; + +public class MsoCloudifyTimeoutTest { + + @Test + public void test() { + Execution execution=mock(Execution.class); + MsoCloudifyTimeout mct=new MsoCloudifyTimeout(execution); + mct.getExecution(); + assert(mct.toString()!=null); + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java new file mode 100644 index 0000000000..68df574611 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java @@ -0,0 +1,36 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.cloudify.exceptions; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class MsoCloudifyWorkflowExceptionTest { + + @Test + public void test() { + MsoCloudifyWorkflowException mcw=new MsoCloudifyWorkflowException("message", "id", "workflowId", "workflowStatus"); + mcw.getWorkflowStatus(); + assertFalse(mcw.isWorkflowStillRunning()); + + } + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java new file mode 100644 index 0000000000..e75a4aecaf --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloudify/utils/MsoCloudifyUtilsTest2.java @@ -0,0 +1,231 @@ +/*- + * ============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.cloudify.utils; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.so.adapters.vdu.CloudInfo; +import org.onap.so.adapters.vdu.PluginAction; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduInstance; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.adapters.vdu.VduStateType; +import org.onap.so.adapters.vdu.VduStatus; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudIdentity; +import org.onap.so.cloud.CloudSite; +import org.onap.so.cloudify.beans.DeploymentInfo; +import org.onap.so.cloudify.beans.DeploymentStatus; +import org.onap.so.cloudify.v3.client.Cloudify; +import org.onap.so.cloudify.v3.model.AzureConfig; +import org.onap.so.cloudify.v3.model.OpenstackConfig; +import org.onap.so.openstack.exceptions.MsoException; + +public class MsoCloudifyUtilsTest2 { + + @Test + public void instantiateVduTest() throws MsoException { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("id"); + expected.setVduInstanceName("id"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.INSTANTIATED); + status.setLastAction(new PluginAction(null, null, null)); + expected.setStatus(status); + + MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class); + CloudSite site = new CloudSite(); + Optional opSite = Optional.ofNullable(site); + CloudConfig config = Mockito.mock(CloudConfig.class); + cloudify.cloudConfig = config; + Cloudify cloudifyClient = new Cloudify("cloudSite"); + CloudInfo cloudInfo = new CloudInfo(); + cloudInfo.setCloudSiteId("cloudSiteId"); + cloudInfo.setTenantId("tenantId"); + VduModelInfo vduModel = new VduModelInfo(); + vduModel.setModelCustomizationUUID("blueprintId"); + vduModel.setTimeoutMinutes(1); + VduArtifact artifact = new VduArtifact(); + artifact.setName("name"); + artifact.setType(ArtifactType.MAIN_TEMPLATE); + byte[] content = new byte[1]; + artifact.setContent(content); + List artifacts = new ArrayList<>(); + artifacts.add(artifact); + vduModel.setArtifacts(artifacts); + DeploymentInfo deployment = new DeploymentInfo(); + deployment.setId("id"); + deployment.setStatus(DeploymentStatus.INSTALLED); + Map blueprintFiles = new HashMap<>(); + blueprintFiles.put(artifact.getName(), artifact.getContent()); + String instanceName = "instanceName"; + Map inputs = new HashMap<>(); + boolean rollbackOnFailure = true; + + when(config.getCloudSite(cloudInfo.getCloudSiteId())).thenReturn(opSite); + doReturn(false).when(cloudify).isBlueprintLoaded(cloudInfo.getCloudSiteId(), + vduModel.getModelCustomizationUUID()); + doReturn(cloudifyClient).when(cloudify).getCloudifyClient(site); + doReturn(true).when(cloudify).uploadBlueprint(cloudifyClient, vduModel.getModelCustomizationUUID(), + artifact.getName(), blueprintFiles); + doReturn(deployment).when(cloudify).createAndInstallDeployment(cloudInfo.getCloudSiteId(), + cloudInfo.getTenantId(), instanceName, vduModel.getModelCustomizationUUID(), inputs, true, + vduModel.getTimeoutMinutes(), rollbackOnFailure); + + VduInstance actual = cloudify.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure); + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void queryVduTest() throws MsoException { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("id"); + expected.setVduInstanceName("id"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.INSTANTIATED); + status.setLastAction(new PluginAction(null, null, null)); + expected.setStatus(status); + + CloudInfo cloudInfo = new CloudInfo(); + cloudInfo.setCloudSiteId("cloudSiteId"); + cloudInfo.setTenantId("tenantId"); + DeploymentInfo deployment = new DeploymentInfo(); + deployment.setId("id"); + deployment.setStatus(DeploymentStatus.INSTALLED); + String instanceId = "instanceId"; + + MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class); + + doReturn(deployment).when(cloudify).queryDeployment(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(), + instanceId); + + VduInstance actual = cloudify.queryVdu(cloudInfo, instanceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void deleteVduTest() throws MsoException { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("id"); + expected.setVduInstanceName("id"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.DELETING); + status.setLastAction(new PluginAction("deleting", null, null)); + expected.setStatus(status); + + CloudInfo cloudInfo = new CloudInfo(); + cloudInfo.setCloudSiteId("cloudSiteId"); + cloudInfo.setTenantId("tenantId"); + String instanceId = "instanceId"; + int timeoutMinutes = 1; + DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class); + deployment.setId("id"); + deployment.setStatus(DeploymentStatus.CREATED); + when(deployment.getId()).thenReturn("id"); + when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED); + when(deployment.getLastAction()).thenReturn("deleting"); + MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class); + doReturn(deployment).when(cloudify).uninstallAndDeleteDeployment(cloudInfo.getCloudSiteId(), + cloudInfo.getTenantId(), instanceId, timeoutMinutes); + + VduInstance actual = cloudify.deleteVdu(cloudInfo, instanceId, timeoutMinutes); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void deploymentInfoToVduInstanceTest() { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("id"); + expected.setVduInstanceName("id"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.DELETING); + status.setLastAction(new PluginAction("deleting", null, null)); + expected.setStatus(status); + + DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class); + deployment.setId("id"); + deployment.setStatus(DeploymentStatus.CREATED); + when(deployment.getId()).thenReturn("id"); + when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED); + when(deployment.getLastAction()).thenReturn("deleting"); + + MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); + + VduInstance actual = cloudify.deploymentInfoToVduInstance(deployment); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void deploymentStatusToVduStatusTest() { + VduStatus expected = new VduStatus(); + expected.setState(VduStateType.DELETING); + expected.setLastAction(new PluginAction("deleting", null, null)); + + DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class); + deployment.setId("id"); + deployment.setStatus(DeploymentStatus.CREATED); + when(deployment.getId()).thenReturn("id"); + when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED); + when(deployment.getLastAction()).thenReturn("deleting"); + + MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); + + VduStatus actual = cloudify.deploymentStatusToVduStatus(deployment); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void getAzureConfigTest() { + AzureConfig expected = new AzureConfig(); + expected.setSubscriptionId("subscriptionId"); + expected.setTenantId("tenantId"); + expected.setClientId("msoId"); + expected.setClientSecret("msoPass"); + + MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); + CloudSite cloudSite = Mockito.mock(CloudSite.class); + CloudIdentity cloudIdentity = Mockito.mock(CloudIdentity.class); + when(cloudSite.getIdentityService()).thenReturn(cloudIdentity); + when(cloudIdentity.getAdminTenant()).thenReturn("subscriptionId"); + when(cloudIdentity.getMsoId()).thenReturn("msoId"); + when(cloudIdentity.getMsoPass()).thenReturn("msoPass"); + String tenantId = "tenantId"; + AzureConfig actual = cloudify.getAzureConfig(cloudSite, tenantId); + + assertThat(actual, sameBeanAs(expected)); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java new file mode 100644 index 0000000000..d347dedb4f --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/config/PoConfigTest.java @@ -0,0 +1,50 @@ +/*- + * ============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.config; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.cloud.Application; +import org.onap.so.config.beans.PoConfig; +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 = Application.class) +@ActiveProfiles("test") +public class PoConfigTest { + + + @Autowired + private PoConfig poConfig; + + + @Test + public void tenantConfigValues() { + assertEquals("504", poConfig.getRetryCodes()); + assertEquals(5, poConfig.getRetryDelay()); + + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java new file mode 100644 index 0000000000..4adf6bf5be --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/HeatCacheEntryTest.java @@ -0,0 +1,65 @@ +/*- + * ============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.openstack.beans; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +import org.junit.Test; +import org.onap.so.BaseTest; + +public class HeatCacheEntryTest extends BaseTest { + + private static final String HEAT_URL = "testHeatUrl"; + private static final String TOKEN = "testToken"; + + @Test + public void getHeatClientTest() { + Calendar expires = new GregorianCalendar(2013,0,31); + HeatCacheEntry heatCacheEntry = new HeatCacheEntry(HEAT_URL, TOKEN, expires); + assertNotNull(heatCacheEntry.getHeatClient()); + } + + @Test + public void isExpiredTrueTest() { + Calendar expires = new GregorianCalendar(2013,0,31); + HeatCacheEntry heatCacheEntry = new HeatCacheEntry(HEAT_URL, TOKEN, expires); + assertTrue(heatCacheEntry.isExpired()); + } + + @Test + public void isExpiredFalseTest() { + Calendar expires = new GregorianCalendar(2100,0,31); + HeatCacheEntry heatCacheEntry = new HeatCacheEntry(HEAT_URL, TOKEN, expires); + assertFalse(heatCacheEntry.isExpired()); + } + + @Test + public void isExpiredNullTest() { + Calendar expires = null; + HeatCacheEntry heatCacheEntry = new HeatCacheEntry(HEAT_URL, TOKEN, expires); + assertTrue(heatCacheEntry.isExpired()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java new file mode 100644 index 0000000000..379501f206 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/MsoTenantTest.java @@ -0,0 +1,42 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.openstack.beans; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +public class MsoTenantTest { + MsoTenant ms = new MsoTenant(); + + @Test + public void test() { + Map map = new HashMap<>(); + map.put("id","name"); + ms.setTenantId("tenantId"); + ms.setTenantName("tenantName"); + ms.setMetadata(map); + assert(ms.getMetadata().equals(map)); + assert(ms.getTenantId().equals("tenantId")); + assert(ms.getTenantName().equals("tenantName")); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NetworkRollbackTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NetworkRollbackTest.java new file mode 100644 index 0000000000..5a5e2bb75e --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NetworkRollbackTest.java @@ -0,0 +1,69 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.openstack.beans; + +import static org.junit.Assert.*; +import java.util.ArrayList; +import java.util.List; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.onap.so.entity.MsoRequest; + +public class NetworkRollbackTest { + @Mock + MsoRequest ms = new MsoRequest(); + + @InjectMocks + NetworkRollback nr = new NetworkRollback(); + + @Test + public void test() { + List vlans = new ArrayList(); + vlans.add(1); + vlans.add(2); + nr.setCloudId("cloudId"); + nr.setModelCustomizationUuid("modelCustomizationUuid"); + nr.setNetworkId("networkId"); + nr.setNetworkName("networkName"); + nr.setNetworkStackId("networkStackId"); + nr.setNetworkType("networkType");; + nr.setNeutronNetworkId("neutronNetworkId"); + nr.setPhysicalNetwork("physicalNetwork"); + nr.setTenantId("tenantId"); + nr.setNetworkCreated(false); + nr.setVlans(vlans); + nr.setMsoRequest(ms); + assert(nr.getCloudId().equals("cloudId")); + assert(nr.getModelCustomizationUuid().equals("modelCustomizationUuid")); + assert(nr.getNetworkId().equals("networkId")); + assert(nr.getNetworkName().equals("networkName")); + assert(nr.getNetworkStackId().equals("networkStackId")); + assert(nr.getNeutronNetworkId().equals("neutronNetworkId")); + assert(nr.getPhysicalNetwork().equals("physicalNetwork")); + assert(nr.getNetworkType().equals("networkType")); + assert(nr.getTenantId().equals("tenantId")); + assert(nr.getMsoRequest().equals(ms)); + assertFalse(nr.getNetworkCreated()); + assert(nr.getVlans().equals(vlans)); + assert(nr.toString()!=null); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java new file mode 100644 index 0000000000..3a652042b7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/NeutronCacheEntryTest.java @@ -0,0 +1,57 @@ +/*- + * ============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.openstack.beans; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Calendar; +import java.util.GregorianCalendar; + +import org.junit.Test; +import org.onap.so.BaseTest; + +public class NeutronCacheEntryTest extends BaseTest { + + private static final String NEUTRON_URL = "testNeutronUrl"; + private static final String TOKEN = "testToken"; + + @Test + public void isExpiredTrueTest() { + Calendar expires = new GregorianCalendar(2013,0,31); + NeutronCacheEntry neutronCacheEntry = new NeutronCacheEntry(NEUTRON_URL, TOKEN, expires); + assertTrue(neutronCacheEntry.isExpired()); + } + + @Test + public void isExpiredFalseTest() { + Calendar expires = new GregorianCalendar(2100,0,31); + NeutronCacheEntry neutronCacheEntry = new NeutronCacheEntry(NEUTRON_URL, TOKEN, expires); + assertFalse(neutronCacheEntry.isExpired()); + } + + @Test + public void isExpiredNullTest() { + Calendar expires = null; + NeutronCacheEntry neutronCacheEntry = new NeutronCacheEntry(NEUTRON_URL, TOKEN, expires); + assertTrue(neutronCacheEntry.isExpired()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java new file mode 100644 index 0000000000..522a261fdd --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/OpenstackBeansPojoTest.java @@ -0,0 +1,48 @@ +/*- + * ============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.openstack.beans; + +import org.junit.Test; +import org.onap.so.BaseTest; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.impl.PojoClassFactory; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class OpenstackBeansPojoTest extends BaseTest { + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(VnfRollback.class)); + test(PojoClassFactory.getPojoClass(NeutronCacheEntry.class)); + test(PojoClassFactory.getPojoClass(HeatCacheEntry.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create() + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoClass); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java new file mode 100644 index 0000000000..163f141c5d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java @@ -0,0 +1,90 @@ +/*- + * ============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.openstack.beans; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.entity.MsoRequest; +import org.springframework.beans.factory.annotation.Autowired; + +public class VnfRollbackTest extends BaseTest { + @Autowired + private VnfRollback vnfRollback; + + private String vnfId = "testVnfId"; + private String tenantId = "testTenantId"; + private String cloudSiteId = "testCloudSiteId"; + private boolean tenantCreated = true; + private boolean vnfCreated = true; + private MsoRequest msoRequest = new MsoRequest(); + private String volumeGroupName = "testVolumeGroupName"; + private String volumeGroupId = "testVolumeGroupId"; + private String requestType = "testRequestType"; + private String modelCustomizationUuid = "testModelCustimizationUuid"; + private String orchestrationMode = "testOrchestrationMode"; + private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, tenant=testTenantId, vnf=testVnfId, " + + "tenantCreated=true, vnfCreated=true, requestType = testRequestType, modelCustomizationUuid=testModelCustimizationUuid, mode=testOrchestrationMode"; + + @Test + public void VnfRollbackInstantiationTest() { + vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated, + msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid); + + assertEquals(vnfId, vnfRollback.getVnfId()); + assertEquals(tenantId, vnfRollback.getTenantId()); + assertEquals(cloudSiteId, vnfRollback.getCloudSiteId()); + assertEquals(tenantCreated, vnfRollback.getTenantCreated()); + assertEquals(vnfCreated, vnfRollback.getVnfCreated()); + assertEquals(msoRequest, vnfRollback.getMsoRequest()); + assertEquals(volumeGroupName, vnfRollback.getVolumeGroupName()); + assertEquals(volumeGroupId, vnfRollback.getVolumeGroupId()); + assertEquals(requestType, vnfRollback.getRequestType()); + assertEquals(modelCustomizationUuid, vnfRollback.getModelCustomizationUuid()); + } + + @Test + public void VnfRollbackInstantiationOrchestrationModeTest() { + vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated, + msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode); + + assertEquals(vnfId, vnfRollback.getVnfId()); + assertEquals(tenantId, vnfRollback.getTenantId()); + assertEquals(cloudSiteId, vnfRollback.getCloudSiteId()); + assertEquals(tenantCreated, vnfRollback.getTenantCreated()); + assertEquals(vnfCreated, vnfRollback.getVnfCreated()); + assertEquals(msoRequest, vnfRollback.getMsoRequest()); + assertEquals(volumeGroupName, vnfRollback.getVolumeGroupName()); + assertEquals(volumeGroupId, vnfRollback.getVolumeGroupId()); + assertEquals(requestType, vnfRollback.getRequestType()); + assertEquals(modelCustomizationUuid, vnfRollback.getModelCustomizationUuid()); + assertEquals(orchestrationMode, vnfRollback.getMode()); + } + + @Test + public void toStringTest() { + vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated, + msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode); + + assertEquals(VNF_ROLLBACK_STRING, vnfRollback.toString()); + } +} 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 new file mode 100644 index 0000000000..7ac92574a0 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoCommonUtilsTest.java @@ -0,0 +1,207 @@ +/*- + * ============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.openstack.utils; + + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; + +import java.io.File; +import java.io.IOException; + +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.onap.so.BaseTest; +import org.onap.so.openstack.exceptions.MsoAdapterException; +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; +import org.onap.so.openstack.exceptions.MsoIOException; +import org.onap.so.openstack.exceptions.MsoOpenstackException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.base.client.OpenStackBaseException; +import com.woorea.openstack.base.client.OpenStackConnectException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.base.client.OpenStackResponse; +import com.woorea.openstack.base.client.OpenStackResponseException; +import com.woorea.openstack.heat.model.Explanation; +import com.woorea.openstack.keystone.model.Error; +import com.woorea.openstack.quantum.model.NeutronError; + +/** + * This class implements test methods of the MsoCommonUtils + */ +public class MsoCommonUtilsTest extends BaseTest { + @Autowired + @Qualifier("CommonUtils") + private MsoCommonUtils commonUtils; + + @Mock + private OpenStackRequest openstackRequest; + + @Test + public final void testExecuteAndRecordOpenstackRequest() { + Mockito.when(openstackRequest.endpoint()).thenReturn("localhost"); + Mockito.when(openstackRequest.path()).thenReturn("/test"); + //TODO:Must try a real connection + assertNull(commonUtils.executeAndRecordOpenstackRequest (openstackRequest)); + } + + @Test + public void testexecuteAndRecordOpenstackRequestResponseException() { + expectedException.expect(OpenStackResponseException.class); + + doThrow(OpenStackResponseException.class).when(openstackRequest).execute(); + + commonUtils.executeAndRecordOpenstackRequest(openstackRequest); + } + + @Test + public void testexecuteAndRecordOpenstackRequestConnectException() { + expectedException.expect(OpenStackConnectException.class); + + doThrow(OpenStackConnectException.class).when(openstackRequest).execute(); + + commonUtils.executeAndRecordOpenstackRequest(openstackRequest); + } + + @Test + public final void testKeystoneErrorToMsoException() throws JsonParseException, JsonMappingException, IOException { + OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); + + OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); + + MsoException me = commonUtils.keystoneErrorToMsoException(openStackConnectException,"ContextError"); + + assertTrue(me instanceof MsoIOException); + assertTrue("connect".equals(me.getMessage())); + + + MsoException me2 = commonUtils.keystoneErrorToMsoException(openStackResponseException,"ContextError"); + assertTrue(me2 instanceof MsoOpenstackException); + assertTrue("ContextError".equals(me2.getContext())); + assertTrue(MsoExceptionCategory.OPENSTACK.equals(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)); + + openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); + + MsoException me3 = commonUtils.keystoneErrorToMsoException(openStackResponseException,"ContextError"); + + assertTrue(me3 instanceof MsoOpenstackException); + assertEquals("1 title: message", me3.toString()); + } + + @Test + public final void testHeatExceptionToMsoException() throws JsonParseException, JsonMappingException, IOException { + OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); + + OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); + + MsoException me = commonUtils.heatExceptionToMsoException(openStackConnectException,"ContextError"); + + assertTrue(me instanceof MsoIOException); + assertTrue("connect".equals(me.getMessage())); + + + MsoException me2 = commonUtils.heatExceptionToMsoException(openStackResponseException,"ContextError"); + assertTrue(me2 instanceof MsoOpenstackException); + assertTrue("ContextError".equals(me2.getContext())); + assertTrue(MsoExceptionCategory.OPENSTACK.equals(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)); + + openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); + + MsoException me3 = commonUtils.heatExceptionToMsoException(openStackResponseException,"ContextError"); + + assertTrue(me3 instanceof MsoOpenstackException); + assertEquals("1 title: explanation, error.type=null, error.message=null", me3.toString()); + } + + @Test + public final void testNeutronExceptionToMsoException() throws JsonParseException, JsonMappingException, IOException { + OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); + + OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); + + MsoException me = commonUtils.neutronExceptionToMsoException(openStackConnectException,"ContextError"); + + assertTrue(me instanceof MsoIOException); + assertTrue("connect".equals(me.getMessage())); + + MsoException me2 = commonUtils.neutronExceptionToMsoException(openStackResponseException,"ContextError"); + assertTrue(me2 instanceof MsoOpenstackException); + assertTrue("ContextError".equals(me2.getContext())); + assertTrue(MsoExceptionCategory.OPENSTACK.equals(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)); + + openStackResponseException = new OpenStackResponseException("response", 501, openStackResponse); + + MsoException me3 = commonUtils.neutronExceptionToMsoException(openStackResponseException,"ContextError"); + + assertTrue(me3 instanceof MsoOpenstackException); + assertEquals("501 type: message", me3.toString()); + } + + @Test + public final void testRuntimeExceptionToMsoException() { + RuntimeException re = new RuntimeException("runtime"); + MsoException me = commonUtils.runtimeExceptionToMsoException(re, "ContextError"); + + assertTrue(me instanceof MsoAdapterException); + assertTrue("ContextError".equals(me.getContext())); + assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory())); + } + + @Test + public void testIoExceptionToMsoException() { + IOException exception = new IOException("IOExceptionTestMessage"); + + MsoException msoException = commonUtils.ioExceptionToMsoException(exception, "ContextError"); + + assertTrue(msoException instanceof MsoAdapterException); + assertEquals("ContextError", msoException.getContext()); + assertTrue(MsoExceptionCategory.INTERNAL.equals(msoException.getCategory())); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntryTest.java new file mode 100644 index 0000000000..700d03dad3 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentEntryTest.java @@ -0,0 +1,110 @@ +/*- + * ============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.openstack.utils; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; + +import org.junit.Test; +import org.onap.so.TestDataSetup; +import org.onap.so.db.catalog.beans.HeatTemplateParam; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; + +public class MsoHeatEnvironmentEntryTest extends TestDataSetup { + + private static final String PARAMETER_NAME = "keyTest"; + private static final String VALUE_NAME = "valueTest"; + private static final String NOT_EXISTING_PARAM = "notExistingParam"; + private static final String RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY = "parameters: {" + + PARAMETER_NAME + ": " + VALUE_NAME + "}"; + private static final String RAW_ENTRY_WITH_RESOURCE_REGISTRY = "resource_registry: resourceTest"; + private static final String RAW_ENTRY_INVALID = "invalidRawEntry"; + + @Test + public void createObjectWithNullStringBuilder() { + MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(null); + assertThat(testedObject.isValid()).isTrue(); + assertThat(testedObject.getRawEntry()).isNull(); + assertThat(testedObject.containsParameter(PARAMETER_NAME)).isFalse(); + } + + @Test + public void toFullString_ResourceRegistryNotPresentInRawEntry() throws JsonParseException, JsonMappingException, IOException { + StringBuilder sb = new StringBuilder(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY); + + MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb); + + HeatTemplateParam heatTemplateParam = mapper.readValue(new File(RESOURCE_PATH + "HeatTemplateParam.json"), HeatTemplateParam.class); + + assertThat(testedObject.getRawEntry()).isEqualTo(sb); + assertThat(testedObject.isValid()).isTrue(); + assertThat(testedObject.containsParameter(PARAMETER_NAME)).isTrue(); + assertThat(testedObject.toString()).doesNotContain(RAW_ENTRY_WITH_RESOURCE_REGISTRY); + assertTrue(testedObject.containsParameter(PARAMETER_NAME, "dummyAlias")); + assertTrue(testedObject.containsParameter("dummyName", PARAMETER_NAME)); + assertFalse(testedObject.containsParameter("dummyName", "dummyAlias")); + assertEquals("parameters:\n " + PARAMETER_NAME + ": " + VALUE_NAME + "\n\n\n", testedObject.toFullString().toString()); + assertEquals("parameters:\n " + PARAMETER_NAME + ": " + VALUE_NAME + "\n\n\n", testedObject.toFullStringExcludeNonParams(new HashSet(Arrays.asList(heatTemplateParam))).toString()); + assertEquals(1, testedObject.getNumberOfParameters()); + assertFalse(testedObject.hasResources()); + + MsoHeatEnvironmentResource heatResource = new MsoHeatEnvironmentResource("resourceName", "resourceValue"); + MsoHeatEnvironmentParameter heatParameter = new MsoHeatEnvironmentParameter("parameterName", "parameterValue"); + testedObject.addResource(heatResource); + testedObject.addParameter(heatParameter); + assertEquals(1, testedObject.getNumberOfResources()); + assertEquals(2, testedObject.getNumberOfParameters()); + + testedObject.setResources(null); + testedObject.setParameters(null); + assertNull(testedObject.getParameters()); + assertNull(testedObject.getResources()); + } + + @Test + public void toFullString_ExceptionOccurred() { + StringBuilder sb = new StringBuilder(RAW_ENTRY_INVALID); + MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb); + assertThat(testedObject.getRawEntry()).isEqualTo(sb); + assertThat(testedObject.isValid()).isFalse(); + assertThat(testedObject.getErrorString()).isNotNull().isNotEmpty(); + } + + @Test + public void checkIfContainsTheParameter() { + StringBuilder sb = new StringBuilder(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY); + MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb); + assertThat(testedObject.getRawEntry()).isEqualTo(sb); + assertThat(testedObject.isValid()).isTrue(); + assertThat(testedObject.containsParameter(PARAMETER_NAME)).isTrue(); + assertThat(testedObject.containsParameter(NOT_EXISTING_PARAM)).isFalse(); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java new file mode 100644 index 0000000000..182a6d0e02 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentParameterTest.java @@ -0,0 +1,46 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.openstack.utils; + +import static org.mockito.Mockito.mock; + +import org.junit.Test; + +public class MsoHeatEnvironmentParameterTest { + + @Test + public void test() { + MsoHeatEnvironmentParameter hep=mock(MsoHeatEnvironmentParameter.class); + Object op=hep.getName(); + MsoHeatEnvironmentParameter meo=new MsoHeatEnvironmentParameter(); + MsoHeatEnvironmentParameter mea=new MsoHeatEnvironmentParameter("name"); + MsoHeatEnvironmentParameter mep=new MsoHeatEnvironmentParameter("name"," value"); + mea.setName("name"); + mep.setValue("value"); + assert(mea.getName().equals("name")); + assert(mep.getValue().equals("value")); + assert(meo.toString()!=null); + //assertTrue(op.equals(hep)); + meo.equals(op); + meo.hashCode(); + } + +} 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 new file mode 100644 index 0000000000..934c149055 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatEnvironmentResourceTest.java @@ -0,0 +1,49 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.openstack.utils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +public class MsoHeatEnvironmentResourceTest { + @Test + public void test() { + Object op = true; + + MsoHeatEnvironmentResource mre = new MsoHeatEnvironmentResource("name"); + MsoHeatEnvironmentResource mae = new MsoHeatEnvironmentResource("name", "maeValue"); + MsoHeatEnvironmentResource msoHER = new MsoHeatEnvironmentResource(); + + msoHER.setName("msoHERName"); + msoHER.setValue("msoHERValue"); + + assertEquals("name", mre.getName()); + assertEquals("maeValue", mae.getValue()); + assertEquals("\"msoHERName\": msoHERValue", msoHER.toString()); + assertEquals("\"name\": maeValue", mae.toString()); + assertFalse(mae.equals(op)); + assertTrue(mae.equals(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 new file mode 100644 index 0000000000..6bcb209125 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -0,0 +1,188 @@ +/*- + * ============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.openstack.utils; + +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.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 java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.woorea.openstack.heat.model.CreateStackParam; +import org.apache.http.HttpStatus; +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.StubOpenStack; +import org.onap.so.adapters.vdu.CloudInfo; +import org.onap.so.adapters.vdu.PluginAction; +import org.onap.so.adapters.vdu.VduArtifact; +import org.onap.so.adapters.vdu.VduArtifact.ArtifactType; +import org.onap.so.adapters.vdu.VduInstance; +import org.onap.so.adapters.vdu.VduModelInfo; +import org.onap.so.adapters.vdu.VduStateType; +import org.onap.so.adapters.vdu.VduStatus; +import org.onap.so.openstack.exceptions.MsoException; + +import org.springframework.beans.factory.annotation.Autowired; + +public class MsoHeatUtilsTest extends BaseTest{ + + @Autowired + private MsoHeatUtils heatUtils; + + @Test + public void instantiateVduTest() throws MsoException, IOException { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b"); + expected.setVduInstanceName("name"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.INSTANTIATED); + status.setLastAction((new PluginAction("create", "complete", null))); + expected.setStatus(status); + + CloudInfo cloudInfo = new CloudInfo(); + cloudInfo.setCloudSiteId("regionOne"); + cloudInfo.setTenantId("tenantId"); + VduModelInfo vduModel = new VduModelInfo(); + vduModel.setModelCustomizationUUID("blueprintId"); + vduModel.setTimeoutMinutes(1); + VduArtifact artifact = new VduArtifact(); + artifact.setName("name"); + artifact.setType(ArtifactType.MAIN_TEMPLATE); + byte[] content = new byte[1]; + artifact.setContent(content); + List artifacts = new ArrayList<>(); + artifacts.add(artifact); + vduModel.setArtifacts(artifacts); + Map blueprintFiles = new HashMap<>(); + blueprintFiles.put(artifact.getName(), artifact.getContent()); + String instanceName = "instanceName"; + Map inputs = new HashMap<>(); + boolean rollbackOnFailure = true; + + StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json"); + + stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceName/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_StackId.json") + .withStatus(HttpStatus.SC_OK))); + + VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure); + + assertThat(actual, sameBeanAs(expected)); + } + + + @Test + public void queryVduTest() throws Exception { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("name/da886914-efb2-4917-b335-c8381528d90b"); + expected.setVduInstanceName("name"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.INSTANTIATED); + status.setLastAction((new PluginAction("create", "complete",null))); + expected.setStatus(status); + + CloudInfo cloudInfo = new CloudInfo(); + cloudInfo.setCloudSiteId("regionOne"); + cloudInfo.setTenantId("tenantId"); + String instanceId = "instanceId"; + + StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json"); + + stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_StackId.json") + .withStatus(HttpStatus.SC_OK))); + + VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void deleteVduTest() throws Exception { + VduInstance expected = new VduInstance(); + expected.setVduInstanceId("instanceId"); + expected.setVduInstanceName("instanceId"); + VduStatus status = new VduStatus(); + status.setState(VduStateType.DELETED); + expected.setStatus(status); + + CloudInfo cloudInfo = new CloudInfo(); + cloudInfo.setCloudSiteId("regionOne"); + cloudInfo.setTenantId("tenantId"); + String instanceId = "instanceId"; + + int timeoutInMinutes = 1; + + StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/instanceId")).willReturn(aResponse().withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK))); + StubOpenStack.mockOpenStackDelete("name/da886914-efb2-4917-b335-c8381528d90b"); + stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/name/da886914-efb2-4917-b335-c8381528d90b")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_DeleteComplete.json").withStatus(HttpStatus.SC_OK))); + + VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public final void requestToStringBuilderTest() { + CreateStackParam param = new CreateStackParam(); + param.setDisableRollback(false); + param.setEnvironment("environment"); + param.setFiles(new HashMap()); + param.setParameters(new HashMap<>()); + param.setStackName("stackName"); + param.setTemplate("template"); + param.setTemplateUrl("http://templateUrl"); + param.setTimeoutMinutes(1); + + StringBuilder stringBuilder = heatUtils.requestToStringBuilder(param); + + Assert.assertTrue(stringBuilder.toString().contains("StackName:")); + } + + @Test + public final void copyBaseOutputsToInputsTest() { + Map inputs = new HashMap<>(); + inputs.put("str1", "str"); + Map otherStackOutputs = new HashMap<>(); + otherStackOutputs.put("str", "str"); + List paramNames = new ArrayList<>(); + Map aliases = new HashMap<>(); + aliases.put("str", "str"); + heatUtils.copyBaseOutputsToInputs(inputs, otherStackOutputs, null, aliases); + Assert.assertEquals("str",otherStackOutputs.get("str")); + } + + +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java new file mode 100644 index 0000000000..c252f61e7f --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java @@ -0,0 +1,170 @@ +/*- + * ============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.openstack.utils; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.TestDataSetup; +import org.onap.so.cloud.CloudConfig; +import org.onap.so.cloud.CloudSite; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; +import org.onap.so.openstack.exceptions.MsoException; +import org.springframework.core.env.Environment; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.woorea.openstack.base.client.OpenStackRequest; +import com.woorea.openstack.heat.Heat; +import com.woorea.openstack.heat.StackResource; +import com.woorea.openstack.heat.StackResource.UpdateStack; +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.UpdateStackParam; + +@RunWith(MockitoJUnitRunner.class) +public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { + @Mock + private CloudConfig cloudConfig; + + @Mock + private Environment environment; + + @Spy + @InjectMocks + private MsoHeatUtilsWithUpdate heatUtils; + + private String cloudSiteId; + private String tenantId; + private String stackName; + private String heatTemplate; + private Map stackInputs; + private boolean pollForCompletion; + private int timeoutMinutes; + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + + cloudSiteId = "cloudSiteId"; + tenantId = "tenantId"; + stackName = "stackName"; + heatTemplate = "heatTemplate"; + stackInputs = new HashMap<>(); + pollForCompletion = true; + timeoutMinutes = 0; + } + + @Test + public void updateStackTest() throws MsoException, JsonParseException, JsonMappingException, IOException { + CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class); + Heat heatClient = new Heat("endpoint"); + Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class); + Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class); + + StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null); + expectedStackInfo.setCanonicalName("stackName/id"); + + doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class)); + doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class)); + doReturn(heatStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class)); + doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class)); + doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class)); + doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class)); + + StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName, + heatTemplate, stackInputs, pollForCompletion, timeoutMinutes); + + assertThat(actualStackInfo, sameBeanAs(expectedStackInfo)); + } + + @Test + public void updateStackWithEnvironmentTest() throws JsonParseException, JsonMappingException, IOException, MsoException { + String environmentString = "environmentString"; + + CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class); + Heat heatClient = new Heat("endpoint"); + Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class); + Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class); + + StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null); + expectedStackInfo.setCanonicalName("stackName/id"); + + doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class)); + doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class)); + doReturn(heatStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class)); + doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class)); + doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class)); + doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class)); + + StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName, + heatTemplate, stackInputs, pollForCompletion, timeoutMinutes, environmentString); + + assertThat(actualStackInfo, sameBeanAs(expectedStackInfo)); + } + + @Test + public void updateStackWithFilesTest() throws MsoException, JsonParseException, JsonMappingException, IOException { + String environmentString = "environmentString"; + Map files = new HashMap<>(); + files.put("file1", new Object()); + + CloudSite cloudSite = mapper.readValue(new File(RESOURCE_PATH + "CloudSite.json"), CloudSite.class); + Heat heatClient = new Heat("endpoint"); + Stack heatStack = mapper.readValue(new File(RESOURCE_PATH + "HeatStack.json"), Stack.class); + Stack updateStack = mapper.readValue(new File(RESOURCE_PATH + "UpdateStack.json"), Stack.class); + + StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null); + expectedStackInfo.setCanonicalName("stackName/id"); + + doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class)); + doReturn(heatClient).when(heatUtils).getHeatClient(isA(CloudSite.class), isA(String.class)); + doReturn(heatStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class)); + doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class)); + doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class)); + doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class)); + + StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName, + heatTemplate, stackInputs, pollForCompletion, timeoutMinutes , environmentString, files); + + assertThat(actualStackInfo, sameBeanAs(expectedStackInfo)); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java new file mode 100644 index 0000000000..706427e985 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoKeystoneUtilsTest.java @@ -0,0 +1,111 @@ +/*- + * ============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.openstack.utils; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.StubOpenStack; +import org.onap.so.openstack.beans.MsoTenant; +import org.onap.so.openstack.exceptions.MsoException; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.IOException; +import java.util.HashMap; + +public class MsoKeystoneUtilsTest extends BaseTest { + + @Autowired + private MsoKeystoneUtils msoKeystoneUtils; + + @Before + public void before() throws IOException { + StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + } + + @Test + public void createTenantTest() throws Exception { + StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); + + StubOpenStack.mockOpenStackGetUserById("john"); + StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); + String response = msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true); + + Assert.assertEquals("tenantId", response); + } + + @Test + public void createTenantTest_FindUserByName() throws Exception { + StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); + + StubOpenStack.mockOpenStackGetUserByName("john"); + StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); + String response = msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true); + Assert.assertEquals("tenantId", response); + + } + + @Test + public void createTenantTest_Exception() throws Exception { + expectedException.expect(MsoException.class); + StubOpenStack.mockOpenStackPostTenantWithBodyFile_200(); + StubOpenStack.mockOpenStackGetUserByName_500("john"); + StubOpenStack.mockOpenStackGetRoles_200("OS-KSADM"); + msoKeystoneUtils.createTenant("tenant", "regionOne", new HashMap<>(), true); + } + + @Test + public void queryTenantTest() throws Exception { + StubOpenStack.mockOpenStackGetTenantById("tenantId"); + + MsoTenant msoTenant = msoKeystoneUtils.queryTenant("tenantId", "regionOne"); + + Assert.assertEquals("testingTenantName", msoTenant.getTenantName()); + } + + @Test + public void queryTenantByNameTest() throws Exception { + StubOpenStack.mockOpenStackGetTenantByName("tenant"); + + MsoTenant msoTenant = msoKeystoneUtils.queryTenantByName("tenant", "regionOne"); + + Assert.assertEquals("testingTenantName", msoTenant.getTenantName()); + } + + @Test + public void deleteTenantTest() throws Exception { + StubOpenStack.mockOpenStackGetTenantById("tenantId"); + StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId"); + boolean result = msoKeystoneUtils.deleteTenant("tenantId", "regionOne"); + + Assert.assertTrue(result); + } + + @Test + public void deleteTenantByNameTest() throws Exception { + StubOpenStack.mockOpenStackGetTenantByName("tenant"); + StubOpenStack.mockOpenStackDeleteTenantById_200("tenantId"); + boolean result = msoKeystoneUtils.deleteTenantByName("tenant", "regionOne"); + + Assert.assertTrue(result); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java new file mode 100644 index 0000000000..9f8b51a3b7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoNeutronUtilsTest.java @@ -0,0 +1,125 @@ +/*- + * ============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.openstack.utils; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.StubOpenStack; +import org.onap.so.openstack.beans.NetworkInfo; +import org.onap.so.openstack.exceptions.MsoException; +import org.springframework.beans.factory.annotation.Autowired; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class MsoNeutronUtilsTest extends BaseTest{ + + @Autowired + private MsoNeutronUtils msoNeutronUtils; + + private List vlans; + + @Before + public void before() throws IOException { + vlans = new ArrayList<>(); + vlans.add(3014); + StubOpenStack.mockOpenStackResponseAccess(wireMockPort); + } + + @Test + public void createNetworkTest_OpenStackBaseException() throws Exception { + expectedException.expect(MsoException.class); + msoNeutronUtils.createNetwork("regionOne", "tenantId", + MsoNeutronUtils.NetworkType.PROVIDER,"networkName", "PROVIDER", vlans); + } + + @Test + public void createNetworkTest_NetworkTypeAsMultiProvider() throws Exception { + StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json"); + NetworkInfo networkInfo = msoNeutronUtils.createNetwork("regionOne", "tenantId", + MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"networkName","PROVIDER", vlans); + + Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); + } + + @Test + public void createNetworkTest() throws Exception { + StubOpenStack.mockOpenstackPostNetwork("OpenstackCreateNeutronNetworkResponse.json"); + NetworkInfo networkInfo = msoNeutronUtils.createNetwork("regionOne", "tenantId", + MsoNeutronUtils.NetworkType.PROVIDER,"networkName","PROVIDER", vlans); + + Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); + } + + @Test + public void queryNetworkTest() throws Exception { + StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + + Assert.assertEquals("net1",networkInfo.getName()); + } + + @Test + public void queryNetworkTest_404() throws Exception { + NetworkInfo networkInfo = msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + Assert.assertNull(networkInfo); + } + + @Test + public void queryNetworkTest_500() throws Exception { + expectedException.expect(MsoException.class); + StubOpenStack.mockOpenStackGetNeutronNetwork_500("43173f6a-d699-414b-888f-ab243dda6dfe"); + msoNeutronUtils.queryNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + + } + + @Test + public void deleteNetworkkTest() throws Exception { + StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenStackDeleteNeutronNetwork("43173f6a-d699-414b-888f-ab243dda6dfe"); + Boolean result = msoNeutronUtils.deleteNetwork("43173f6a-d699-414b-888f-ab243dda6dfe", "tenantId","regionOne"); + + Assert.assertTrue(result); + } + + @Test + public void updateNetworkTest() throws Exception { + StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("regionOne", "tenantId", + "43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.PROVIDER,"PROVIDER", vlans); + + Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); + } + + @Test + public void updateNetworkTest_NetworkTypeAsMultiProvider() throws Exception { + StubOpenStack.mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + StubOpenStack.mockOpenstackPutNetwork("OpenstackCreateNeutronNetworkResponse.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + NetworkInfo networkInfo = msoNeutronUtils.updateNetwork("regionOne", "tenantId", + "43173f6a-d699-414b-888f-ab243dda6dfe",MsoNeutronUtils.NetworkType.MULTI_PROVIDER,"PROVIDER", vlans); + + Assert.assertEquals("2a4017ef-31ff-496a-9294-e96ecc3bc9c9",networkInfo.getId()); + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvtTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvtTest.java new file mode 100644 index 0000000000..70b5f2699d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoYamlEditorWithEnvtTest.java @@ -0,0 +1,95 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 2018 TechMahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.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.openstack.utils; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertNull; + +import java.io.File; +import java.io.IOException; +import java.util.Set; + +import org.junit.Test; +import org.onap.so.TestDataSetup; +import org.onap.so.db.catalog.beans.HeatTemplateParam; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; + +public class MsoYamlEditorWithEnvtTest extends TestDataSetup { + private MsoYamlEditorWithEnvt yaml; + private static final String PARAMETER_NAME = "keyTest"; + private static final String PARAMETER_VALUE = "{type : paramType}"; + private static final String RESOURCE_NAME = "resourceKey"; + private static final String RESOURCE_VALUE = "resourceValue"; + private static final String RAW_ENTRY_WITH_RESOURCE_REGISTRY = "resource_registry: {" + RESOURCE_NAME + " : " + RESOURCE_VALUE + "}"; + private static final String RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY = "parameters: {" + + PARAMETER_NAME + ": " + PARAMETER_VALUE + "}"; + + @Test + public void getParameterListTest() throws JsonParseException, JsonMappingException, IOException { + yaml = new MsoYamlEditorWithEnvt(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY.getBytes()); + + MsoHeatEnvironmentParameter expectedHeatParam = mapper.readValue(new File(RESOURCE_PATH + "HeatEnvironmentParameter.json"), MsoHeatEnvironmentParameter.class); + + Set heatEnvironmentSet = yaml.getParameterListFromEnvt(); + + for(MsoHeatEnvironmentParameter heatEnvironment : heatEnvironmentSet) { + assertThat(heatEnvironment, sameBeanAs(expectedHeatParam)); + } + } + + @Test + public void getResourceListFromEnvtTest() { + yaml = new MsoYamlEditorWithEnvt(RAW_ENTRY_WITH_RESOURCE_REGISTRY.getBytes()); + + MsoHeatEnvironmentResource expectedHeatResource = new MsoHeatEnvironmentResource(RESOURCE_NAME, RESOURCE_VALUE); + + Set heatResourceSet = yaml.getResourceListFromEnvt(); + + for(MsoHeatEnvironmentResource heatResource : heatResourceSet) { + assertThat(heatResource, sameBeanAs(expectedHeatResource)); + } + } + + @Test + public void getResourceListFromEnvtExceptionTest() { + yaml = new MsoYamlEditorWithEnvt(); + + Set heatResourceSet = yaml.getResourceListFromEnvt(); + + assertNull(heatResourceSet); + } + + @Test + public void getParameterListFromEnvtTest() throws JsonParseException, JsonMappingException, IOException { + yaml = new MsoYamlEditorWithEnvt(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY.getBytes()); + + HeatTemplateParam expectedHeatParam = mapper.readValue(new File(RESOURCE_PATH + "HeatTemplateParamExpected.json"), HeatTemplateParam.class); + + Set heatParamSet = yaml.getParameterList(); + + for(HeatTemplateParam heatParam : heatParamSet) { + assertThat(heatParam, sameBeanAs(expectedHeatParam)); + } + } +} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java deleted file mode 100644 index 250211845f..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/AdapterBeansTest.java +++ /dev/null @@ -1,159 +0,0 @@ -/*- - * ============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.openecomp.mso.adapter_utils.tests; - -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.junit.Test; -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.MsoTenant; -import org.openecomp.mso.openstack.beans.NetworkRollback; -import org.openecomp.mso.openstack.beans.Pool; -import org.openecomp.mso.openstack.beans.Subnet; -import org.openecomp.mso.openstack.beans.VnfRollback; - -public class AdapterBeansTest { - @Test - public final void msoTenantTest() { - MsoTenant tenant = new MsoTenant(); - tenant.setTenantId("1"); - assertTrue(tenant.getTenantId().equalsIgnoreCase("1")); - tenant.setTenantName("TenantName"); - assertTrue(tenant.getTenantName().equalsIgnoreCase("TenantName")); - Map hm = new HashMap<>(); - hm.put("Key1", "value1"); - tenant.setMetadata(hm); - assertTrue(tenant.getMetadata() != null); - new MsoTenant("1", "TenantName", hm); - // assertTrue(tenant.toString() != null); - } - - @Test - public final void networkRollbackTest() { - NetworkRollback networkRollback = new NetworkRollback(); - networkRollback.setCloudId("cloudId"); - assertTrue(networkRollback.getCloudId().equalsIgnoreCase("cloudId")); - networkRollback.setModelCustomizationUuid("modelCustomizationUuid"); - assertTrue(networkRollback.getModelCustomizationUuid().equalsIgnoreCase("modelCustomizationUuid")); - MsoRequest msoRequest = new MsoRequest(); - networkRollback.setMsoRequest(msoRequest); - networkRollback.getMsoRequest(); - // assertTrue(networkRollback.getMsoRequest() == null); - networkRollback.setNetworkCreated(Boolean.TRUE); - assertTrue(networkRollback.getNetworkCreated()); - networkRollback.setNetworkId("networkId"); - assertTrue(networkRollback.getNetworkId().equalsIgnoreCase("networkId")); - networkRollback.setNetworkName("networkName"); - assertTrue(networkRollback.getNetworkName().equalsIgnoreCase("networkName")); - networkRollback.setNetworkStackId("networkStackId"); - assertTrue(networkRollback.getNetworkStackId().equalsIgnoreCase("networkStackId")); - networkRollback.setNetworkType("networkType"); - assertTrue(networkRollback.getNetworkType().equalsIgnoreCase("networkType")); - networkRollback.setNeutronNetworkId("neutronNetworkId"); - assertTrue(networkRollback.getNeutronNetworkId().equalsIgnoreCase("neutronNetworkId")); - networkRollback.setPhysicalNetwork("physicalNetwork"); - assertTrue(networkRollback.getPhysicalNetwork().equalsIgnoreCase("physicalNetwork")); - networkRollback.setTenantId("tenantId"); - assertTrue(networkRollback.getTenantId().equalsIgnoreCase("tenantId")); - List al = new ArrayList<>(); - al.add(1); - al.add(2); - networkRollback.setVlans(al); - assertTrue(networkRollback.getVlans() != null); - assertTrue(networkRollback.toString() != null); - } - - @Test - public final void poolTest() { - Pool p = new Pool(); - p.setStart("start"); - p.getStart(); - p.setEnd("end"); - p.getEnd(); - p.toString(); - } - - @Test - public final void subnetTest() { - Subnet subnet = new Subnet(); - subnet.setAllocationPools(new ArrayList<>()); - subnet.getAllocationPools(); - subnet.setCidr("cidr"); - subnet.getCidr(); - subnet.setDnsNameServers(new ArrayList<>()); - subnet.getDnsNameServers(); - subnet.setEnableDHCP(true); - subnet.getEnableDHCP(); - subnet.setGatewayIp("gatewayIp"); - subnet.getGatewayIp(); - subnet.setHostRoutes(new ArrayList<>()); - subnet.getHostRoutes(); - subnet.setIpVersion("ipVersion"); - subnet.getIpVersion(); - subnet.setNeutronId("neutronId"); - subnet.getNeutronId(); - subnet.setSubnetId("subnetId"); - subnet.getSubnetId(); - subnet.setSubnetName("subnetName"); - subnet.getSubnetName(); - subnet.toString(); - } - - @Test - public final void vnfRollbackTest() { - VnfRollback vnfRollback = new VnfRollback(); - new VnfRollback("vnfId", "tenantId", "cloudSiteId", true, true, new MsoRequest(), "volumeGroupName", - "volumeGroupId", "requestType", "modelCustomizationUuid"); - vnfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId"); - vnfRollback.getBaseGroupHeatStackId(); - vnfRollback.setCloudSiteId("cloudId"); - vnfRollback.getCloudSiteId(); - vnfRollback.setIsBase(false); - vnfRollback.isBase(); - vnfRollback.setModelCustomizationUuid("modelCustomizationUuid"); - vnfRollback.getModelCustomizationUuid(); - vnfRollback.setMsoRequest(new MsoRequest()); - vnfRollback.getMsoRequest(); - vnfRollback.setRequestType("requestType"); - vnfRollback.getRequestType(); - vnfRollback.setTenantCreated(true); - vnfRollback.getTenantCreated(); - vnfRollback.setTenantId("tenantId"); - vnfRollback.getTenantId(); - vnfRollback.setVfModuleStackId("vfModuleStackId"); - vnfRollback.getVfModuleStackId(); - vnfRollback.setVnfCreated(true); - vnfRollback.getVnfCreated(); - vnfRollback.setVnfId("vnfId"); - vnfRollback.getVnfId(); - vnfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId"); - vnfRollback.getVolumeGroupHeatStackId(); - vnfRollback.setVolumeGroupId("volumeGroupId"); - vnfRollback.getVolumeGroupId(); - vnfRollback.setVolumeGroupName("volumeGroupName"); - vnfRollback.getVolumeGroupName(); - vnfRollback.toString(); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java deleted file mode 100644 index 73bd67723d..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoCommonUtilsTest.java +++ /dev/null @@ -1,130 +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.openecomp.mso.adapter_utils.tests; - - -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.mockito.Mockito; - -import org.openecomp.mso.logger.MsoAlarmLogger; -import org.openecomp.mso.openstack.exceptions.MsoAdapterException; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.exceptions.MsoOpenstackException; -import org.openecomp.mso.openstack.utils.MsoCommonUtils; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import com.woorea.openstack.base.client.OpenStackBaseException; -import com.woorea.openstack.base.client.OpenStackConnectException; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.base.client.OpenStackResponseException; - - -/** - * This class implements test methods of the MsoCommonUtils - * - * - */ -public class MsoCommonUtilsTest extends MsoCommonUtils { - - public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - - @Test - public final void testExecuteAndRecordOpenstackRequest () { - OpenStackRequest openstackRequest = Mockito.mock(OpenStackRequest.class); - Mockito.when(openstackRequest.endpoint()).thenReturn("localhost"); - Mockito.when(openstackRequest.path()).thenReturn("/test"); - //TODO:Must try a real connection - assertNull(super.executeAndRecordOpenstackRequest (openstackRequest)); - - } - - @Test - public final void testKeystoneErrorToMsoException () { - OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); - - OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); - - MsoException me = super.keystoneErrorToMsoException (openStackConnectException,"ContextError"); - - assertTrue(me instanceof MsoIOException); - assertTrue("connect".equals(me.getMessage())); - - - MsoException me2 = super.keystoneErrorToMsoException (openStackResponseException,"ContextError"); - assertTrue(me2 instanceof MsoOpenstackException); - assertTrue("ContextError".equals(me2.getContext())); - assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); - - } - - @Test - public final void testHeatExceptionToMsoException () { - OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); - - OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); - - MsoException me = super.heatExceptionToMsoException (openStackConnectException,"ContextError"); - - assertTrue(me instanceof MsoIOException); - assertTrue("connect".equals(me.getMessage())); - - - MsoException me2 = super.heatExceptionToMsoException (openStackResponseException,"ContextError"); - assertTrue(me2 instanceof MsoOpenstackException); - assertTrue("ContextError".equals(me2.getContext())); - assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); - } - - @Test - public final void testNeutronExceptionToMsoException () { - OpenStackBaseException openStackConnectException = new OpenStackConnectException("connect"); - - OpenStackBaseException openStackResponseException = new OpenStackResponseException("response",1); - - MsoException me = super.neutronExceptionToMsoException (openStackConnectException,"ContextError"); - - assertTrue(me instanceof MsoIOException); - assertTrue("connect".equals(me.getMessage())); - - MsoException me2 = super.neutronExceptionToMsoException (openStackResponseException,"ContextError"); - assertTrue(me2 instanceof MsoOpenstackException); - assertTrue("ContextError".equals(me2.getContext())); - assertTrue(MsoExceptionCategory.OPENSTACK.equals(me2.getCategory())); - } - - @Test - public final void testRuntimeExceptionToMsoException () { - RuntimeException re = new RuntimeException ("runtime"); - MsoException me = super.runtimeExceptionToMsoException (re, "ContextError"); - - assertTrue (me instanceof MsoAdapterException); - assertTrue("ContextError".equals(me.getContext())); - assertTrue(MsoExceptionCategory.INTERNAL.equals(me.getCategory())); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java deleted file mode 100644 index 93afbcccaf..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsTest.java +++ /dev/null @@ -1,365 +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.openecomp.mso.adapter_utils.tests; - -import java.io.IOException; -import java.util.*; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.TextNode; -import com.woorea.openstack.base.client.HttpMethod; -import com.woorea.openstack.base.client.OpenStackRequest; -import com.woorea.openstack.heat.model.Stack; -import com.woorea.openstack.keystone.model.Access; -import com.woorea.openstack.keystone.utils.KeystoneUtils; -import mockit.Deencapsulation; -import mockit.Invocation; -import mockit.Mock; -import mockit.MockUp; -import mockit.integration.junit4.JMockit; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudConfigTest; -import org.openecomp.mso.openstack.beans.StackInfo; -import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.exceptions.MsoStackAlreadyExists; -import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound; -import org.openecomp.mso.openstack.utils.MsoCommonUtils; -import org.openecomp.mso.openstack.utils.MsoHeatUtils; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import com.woorea.openstack.heat.model.CreateStackParam; - -/** - * This class implements test methods of the MsoHeatUtils - * - * - */ -public class MsoHeatUtilsTest extends MsoCommonUtils { - public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); - public static MsoHeatUtils msoHeatUtils; - - @BeforeClass - public static final void loadClasses() throws MsoCloudIdentityNotFound, MsoPropertiesException { - ClassLoader classLoader = MsoHeatUtilsTest.class.getClassLoader(); - String cloudConfigJson = classLoader.getResource("cloud_config.json").getPath(); - cloudConfigFactory.initializeCloudConfig(cloudConfigJson, 1); - msoPropertiesFactory.initializeMsoProperties("NO_PROP", classLoader.getResource("mso.properties").getPath()); - msoHeatUtils = new MsoHeatUtils("NO_PROP", msoPropertiesFactory, cloudConfigFactory); - } - - @Test - public final void testCreateStackBadCloudConfig() - throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { - try { - msoHeatUtils.createStack("DOESNOTEXIST", "test", "stackName", "test", new HashMap<>(), - Boolean.TRUE, 10); - } catch (MsoCloudSiteNotFound e) { - - } catch (java.lang.NullPointerException npe) { - - } - - } - - @Test - public final void testCreateStackFailedConnectionHeatClient() - throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { - try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, - 10); - } catch (MsoIOException e) { - - } - - } - - @Test - public final void testCreateStackFailedConnection() - throws MsoStackAlreadyExists, MsoTenantNotFound, MsoException, MsoCloudSiteNotFound { - try { - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, - 10); - } catch (MsoIOException e) { - - } - - } - - @Test - public final void createStackSuccessWithEnvironment() throws MsoException { - final MockUp> mockRequest = new MockUp>() { - @Mock - public Object execute(Invocation invocation) { - final OpenStackRequest invokedInstance = invocation.getInvokedInstance(); - final Class returnType = Deencapsulation.getField(invokedInstance, "returnType"); - - try { - if (returnType == Access.class) { - ObjectMapper mapper = new ObjectMapper(); - String json = "{\"token\":{\"id\":\"tokenId\",\"tenant\":{\"id\":\"tenantId\",\"name\":\"tenantName\"}},\"serviceCatalog\":[{\"type\":\"orchestration\",\"name\":\"orchestration\",\"endpoints\":[{\"region\":\"region1\",\"publicURL\":\"http://localhost:5000\",\"internalURL\":\"http://localhost:5000\",\"adminURL\":\"http://localhost:5000\"}]}]}"; - return mapper.readValue(json, Access.class); - } else if (returnType == Stack.class) { - final Stack stack = new Stack(); - stack.setId("stackId"); - stack.setStackName("stackName"); - stack.setStackStatus("CREATE_COMPLETE"); - return stack; - } - return null; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - final MockUp mockKeystone = new MockUp() { - @Mock - String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - return "http://localhost:5000"; - } - }; - - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10, - "environment"); - - mockRequest.tearDown(); - mockKeystone.tearDown(); - } - - @Test - public final void createStackSuccessWithFiles() throws MsoException { - final MockUp> mockRequest = new MockUp>() { - @Mock - public Object execute(Invocation invocation) { - final OpenStackRequest invokedInstance = invocation.getInvokedInstance(); - final Class returnType = Deencapsulation.getField(invokedInstance, "returnType"); - - try { - if (returnType == Access.class) { - ObjectMapper mapper = new ObjectMapper(); - String json = "{\"token\":{\"id\":\"tokenId\",\"tenant\":{\"id\":\"tenantId\",\"name\":\"tenantName\"}},\"serviceCatalog\":[{\"type\":\"orchestration\",\"name\":\"orchestration\",\"endpoints\":[{\"region\":\"region1\",\"publicURL\":\"http://localhost:5000\",\"internalURL\":\"http://localhost:5000\",\"adminURL\":\"http://localhost:5000\"}]}]}"; - return mapper.readValue(json, Access.class); - } else if (returnType == Stack.class) { - final Stack stack = new Stack(); - stack.setId("stackId"); - stack.setStackName("stackName"); - stack.setStackStatus("CREATE_COMPLETE"); - return stack; - } - return null; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - final MockUp mockKeystone = new MockUp() { - @Mock - String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - return "http://localhost:5000"; - } - }; - - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10, - "environment", new HashMap<>()); - - mockRequest.tearDown(); - mockKeystone.tearDown(); - } - - @Test - public final void createStackSuccessWithHeatFiles() throws MsoException { - - final MockUp> mockRequest = new MockUp>() { - @Mock - public Object execute(Invocation invocation) { - final OpenStackRequest invokedInstance = invocation.getInvokedInstance(); - final Class returnType = Deencapsulation.getField(invokedInstance, "returnType"); - - try { - if (returnType == Access.class) { - ObjectMapper mapper = new ObjectMapper(); - String json = "{\"token\":{\"id\":\"tokenId\",\"tenant\":{\"id\":\"tenantId\",\"name\":\"tenantName\"}},\"serviceCatalog\":[{\"type\":\"orchestration\",\"name\":\"orchestration\",\"endpoints\":[{\"region\":\"region1\",\"publicURL\":\"http://localhost:5000\",\"internalURL\":\"http://localhost:5000\",\"adminURL\":\"http://localhost:5000\"}]}]}"; - return mapper.readValue(json, Access.class); - } else if (returnType == Stack.class) { - final Stack stack = new Stack(); - stack.setId("stackId"); - stack.setStackName("stackName"); - stack.setStackStatus("CREATE_COMPLETE"); - return stack; - } - return null; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - final MockUp mockKeystone = new MockUp() { - @Mock - String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - return "http://localhost:5000"; - } - }; - - msoHeatUtils.createStack("MT", "test", "stackName", "test", new HashMap<>(), Boolean.TRUE, 10, - "environment", new HashMap<>(), new HashMap<>()); - - mockRequest.tearDown(); - mockKeystone.tearDown(); - } - - @Test - public final void requestToStringBuilderTest() { - CreateStackParam param = new CreateStackParam(); - param.setDisableRollback(false); - param.setEnvironment("environment"); - param.setFiles(new HashMap<>()); - param.setParameters(new HashMap<>()); - param.setStackName("stackName"); - param.setTemplate("template"); - param.setTemplateUrl("http://templateUrl"); - param.setTimeoutMinutes(1); - - msoHeatUtils.requestToStringBuilder(param); - } - - @Test - public final void heatCacheResetTest() { - msoHeatUtils.heatCacheReset(); - } - - @Test - public final void expireHeatClientTest() { - msoHeatUtils.expireHeatClient("tenantId", "cloudId"); - } - - @Test - public final void heatCacheCleanupTest() { - msoHeatUtils.heatCacheCleanup(); - } - - @Test - public void queryStackTest() throws MsoException { - final MockUp> mockRequest = new MockUp>() { - @Mock - public Object execute(Invocation invocation) { - final OpenStackRequest invokedInstance = invocation.getInvokedInstance(); - final Class returnType = Deencapsulation.getField(invokedInstance, "returnType"); - - try { - if (returnType == Access.class) { - ObjectMapper mapper = new ObjectMapper(); - String json = "{\"token\":{\"id\":\"tokenId\",\"tenant\":{\"id\":\"tenantId\",\"name\":\"tenantName\"}},\"serviceCatalog\":[{\"type\":\"orchestration\",\"name\":\"orchestration\",\"endpoints\":[{\"region\":\"region1\",\"publicURL\":\"http://localhost:5000\",\"internalURL\":\"http://localhost:5000\",\"adminURL\":\"http://localhost:5000\"}]}]}"; - return mapper.readValue(json, Access.class); - } else if (returnType == Stack.class) { - final Stack stack = new Stack(); - stack.setId("stackId"); - stack.setStackName("stackName"); - stack.setStackStatus("CREATE_COMPLETE"); - return stack; - } - return null; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - final MockUp mockKeystone = new MockUp() { - @Mock - String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - return "http://localhost:5000"; - } - }; - - final StackInfo stackInfo = msoHeatUtils.queryStack("MT", "test", "stackName"); - - mockRequest.tearDown(); - mockKeystone.tearDown(); - } - - @Test - public void deleteStack() throws MsoException { - final MockUp> mockRequest = new MockUp>() { - @Mock - public Object execute(Invocation invocation) { - final OpenStackRequest invokedInstance = invocation.getInvokedInstance(); - final Class returnType = Deencapsulation.getField(invokedInstance, "returnType"); - final String path = Deencapsulation.getField(invokedInstance, "endpoint"); -// final String stackName = path.substring(path.lastIndexOf("/")); - - try { - if (returnType == Access.class) { - ObjectMapper mapper = new ObjectMapper(); - String json = "{\"token\":{\"id\":\"tokenId\",\"tenant\":{\"id\":\"tenantId\",\"name\":\"tenantName\"}},\"serviceCatalog\":[{\"type\":\"orchestration\",\"name\":\"orchestration\",\"endpoints\":[{\"region\":\"region1\",\"publicURL\":\"http://localhost:5000\",\"internalURL\":\"http://localhost:5000\",\"adminURL\":\"http://localhost:5000\"}]}]}"; - return mapper.readValue(json, Access.class); - } else if (returnType == Stack.class) { - final Stack stack = new Stack(); - stack.setId("stackId"); - stack.setStackName("stackName"); - final String status = "DELETE_COMPLETE"; - stack.setStackStatus(status); - return stack; - } - return null; - } catch (Exception e) { - throw new RuntimeException(e); - } - } - }; - - final MockUp mockKeystone = new MockUp() { - @Mock - String findEndpointURL(List serviceCatalog, String type, String region, String facing) { - return "http://localhost:5000"; - } - }; - - final StackInfo stackInfo = msoHeatUtils.deleteStack("test", "MT", "stackName", true); - - mockRequest.tearDown(); - mockKeystone.tearDown(); - } - - @Test - public void copyStringOutputsToInputsTest() { - Map inputs = new HashMap(){{put("key41", "value41");}}; - Map outputs = new HashMap(){{ - put("key2", "val2"); - put("key3", new TextNode("val3")); - put("key4", new LinkedHashMap(){{put("key41", "value41");}}); - }}; - msoHeatUtils.copyStringOutputsToInputs(inputs, outputs, true); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java deleted file mode 100644 index 62043e83b8..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapter_utils/tests/MsoHeatUtilsWithUpdateTest.java +++ /dev/null @@ -1,136 +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.openecomp.mso.adapter_utils.tests; - -import static org.junit.Assert.fail; -import static org.mockito.Mockito.when; - -import java.util.HashMap; -import java.util.Map; - -import java.util.Optional; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoIOException; -import org.openecomp.mso.openstack.utils.MsoHeatUtilsWithUpdate; -import org.openecomp.mso.properties.MsoPropertiesFactory; - -import com.woorea.openstack.base.client.OpenStackConnectException; - -@RunWith(MockitoJUnitRunner.class) -public class MsoHeatUtilsWithUpdateTest { - - public static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - public static CloudConfigFactory cloudConfigFactory = new CloudConfigFactory(); - - @Mock - CloudConfig cloudConfig; - @InjectMocks - MsoHeatUtilsWithUpdate util=new MsoHeatUtilsWithUpdate("NO_PROP",msoPropertiesFactory,cloudConfigFactory); - - private CloudSite cloudSite; - - @Before - public void init () { - cloudSite = new CloudSite (); - cloudSite.setId ("cloud"); - CloudIdentity cloudIdentity = new CloudIdentity (); - cloudIdentity.setIdentityServerType(IdentityServerType.KEYSTONE); - cloudIdentity.setKeystoneUrl ("toto"); - cloudIdentity.setMsoPass (CloudIdentity.encryptPassword ("mockId")); - cloudSite.setIdentityService (cloudIdentity); - when(cloudConfig.getCloudSite("cloud")).thenReturn (Optional.of(cloudSite)); - when(cloudConfig.getCloudSite("none")).thenReturn (Optional.empty()); - } - - @Test - @Ignore - public void testUpdateStack () { - // Heat heat = Mockito.mock (Heat.class); - Map stackInputs = new HashMap <> (); - try { - util.updateStack ("none", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1); - } catch (MsoException e) { - if (e instanceof MsoCloudSiteNotFound) { - // Ok - } else { - e.printStackTrace (); - fail ("Exception caught"); - } - } - try { - util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1); - } catch (MsoException e) { - if (e instanceof MsoIOException && e.getCause () != null - && e.getCause () instanceof OpenStackConnectException) { - // Ok, we were able to go up to the connection to OpenStack - } else { - e.printStackTrace (); - fail ("Exception caught"); - } - } - try { - util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment"); - } catch (MsoException e) { - if (e instanceof MsoIOException && e.getCause () != null - && e.getCause () instanceof OpenStackConnectException) { - // Ok, we were able to go up to the connection to OpenStack - } else { - e.printStackTrace (); - fail ("Exception caught"); - } - } - try { - util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null); - } catch (MsoException e) { - if (e instanceof MsoIOException && e.getCause () != null - && e.getCause () instanceof OpenStackConnectException) { - // Ok, we were able to go up to the connection to OpenStack - } else { - e.printStackTrace (); - fail ("Exception caught"); - } - } - try { - util.updateStack ("cloud", "tenantId", "stackName", "heatTemplate", stackInputs, false, 1, "environment", null, null); - } catch (MsoException e) { - if (e instanceof MsoIOException && e.getCause () != null - && e.getCause () instanceof OpenStackConnectException) { - // Ok, we were able to go up to the connection to OpenStack - } else { - e.printStackTrace (); - fail ("Exception caught"); - } - } - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapters/vdu/BeansTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapters/vdu/BeansTest.java deleted file mode 100644 index 1452c1569c..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/adapters/vdu/BeansTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.vdu; - -import org.junit.Test; - -import com.openpojo.reflection.PojoClass; -import com.openpojo.reflection.PojoClassFilter; -import com.openpojo.reflection.filters.FilterPackageInfo; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.rule.impl.GetterMustExistRule; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; - -public class BeansTest { - - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - @Test - public void pojoStructure() { - test("org.openecomp.mso.adapters.vdu"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new SetterTester()) - .with(new GetterTester()) - .build(); - validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses); - } - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigFactoryTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigFactoryTest.java deleted file mode 100644 index c6c6baf61b..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigFactoryTest.java +++ /dev/null @@ -1,162 +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.openecomp.mso.cloud; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import javax.ws.rs.core.Response; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; - -public class CloudConfigFactoryTest { - - private static final String CLOUD_CONFIG_FIELD_NAME = "cloudConfigCache"; - private static final int REFRESH_TIMER_VALUE = 1; - - private CloudConfigFactory testedObject; - private CloudConfig cloudConfigMock; - private CloudConfig savedCloudConfig; - - @Before - public void init() throws NoSuchFieldException, IllegalAccessException { - cloudConfigMock = mock(CloudConfig.class); - testedObject = new CloudConfigFactory(); - Field field = CloudConfigFactory.class.getDeclaredField(CLOUD_CONFIG_FIELD_NAME); - field.setAccessible(true); - savedCloudConfig = (CloudConfig) field.get(null); - field.set(null, cloudConfigMock); - } - - @After - public void reset() throws NoSuchFieldException, IllegalAccessException { - Field field = CloudConfigFactory.class.getDeclaredField(CLOUD_CONFIG_FIELD_NAME); - field.setAccessible(true); - field.set(null, savedCloudConfig); - } - - @Test - public void initializeCloudConfigSuccessful() throws MsoCloudIdentityNotFound, IOException { - ClassLoader classLoader = CloudConfigFactoryTest.class.getClassLoader(); - String cloudConfigJsonFilePath = classLoader.getResource("cloud_config.json").getPath(); - testedObject.initializeCloudConfig(cloudConfigJsonFilePath, REFRESH_TIMER_VALUE); - verify(cloudConfigMock).loadCloudConfig(cloudConfigJsonFilePath, REFRESH_TIMER_VALUE); - } - - @Test - public void getValidCloudConfig() { - when(cloudConfigMock.isValidCloudConfig()).thenReturn(true); - - testedObject.getCloudConfig(); - - verify(cloudConfigMock).clone(); - } - - @Test - public void reload_CloudConfigValid() throws IOException, MsoCloudIdentityNotFound { - when(cloudConfigMock.isValidCloudConfig()).thenReturn(true); - - testedObject.reloadCloudConfig(); - - verify(cloudConfigMock).clone(); - verify(cloudConfigMock).reloadPropertiesFile(); - } - - @Test - public void reload_CloudConfigNotValid() - throws IOException, MsoCloudIdentityNotFound { - when(cloudConfigMock.isValidCloudConfig()).thenReturn(false); - - testedObject.reloadCloudConfig(); - - verify(cloudConfigMock).reloadPropertiesFile(); - } - - @Test - public void showCloudConfig() throws NoSuchFieldException, IllegalAccessException { - when(cloudConfigMock.isValidCloudConfig()).thenReturn(true); - when(cloudConfigMock.clone()).thenReturn(createCloudConfig("IdTest576", "identityTest456")); - Response response = testedObject.showCloudConfig(); - - assertThat(response.getStatus()).isEqualTo(200); - assertThat(response.getEntity().toString()).containsPattern("CloudSite:.*IdTest576") - .containsPattern("Cloud Identity Service:.*identityTest456"); - - } - - @Test - public void resetClientCaches_Successful() { - Response response = testedObject.resetClientCaches(); - assertThat(response.getStatus()).isEqualTo(200); - assertThat(response.getEntity().toString()).isEqualTo("Client caches reset. All entries removed."); - } - - @Test - public void cleanUpClientCache_Successful() { - Response response = testedObject.cleanupClientCaches(); - assertThat(response.getStatus()).isEqualTo(200); - assertThat(response.getEntity().toString()).isEqualTo("Client caches cleaned up. All expired entries removed."); - } - - @Test - public void encryptPassword_Successful() { - Response response = testedObject.encryptPassword("passTest123"); - String expectedEncryptedPassword = CloudIdentity.encryptPassword("passTest123"); - assertThat(response.getStatus()).isEqualTo(200); - assertThat(response.getEntity().toString()).isEqualTo("Encrypted Password = "+expectedEncryptedPassword); - } - - private CloudConfig createCloudConfig(String cloudSiteId, String identityServiceId) - throws NoSuchFieldException, IllegalAccessException { - CloudConfig cloudConfig = new CloudConfig(); - Map cloudSiteMap = new HashMap<>(); - CloudSite cs = new CloudSite(); - cs.setId(cloudSiteId); - cloudSiteMap.put("keyTest", cs); - Field cloudSitesField = cloudConfig.getClass().getDeclaredField("cloudSites"); - cloudSitesField.setAccessible(true); - cloudSitesField.set(cloudConfig, cloudSiteMap); - - Map identityServicesMap = new HashMap<>(); - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setId(identityServiceId); - identityServicesMap.put("identityKey", cloudIdentity); - - Field identityServicesField = cloudConfig.getClass().getDeclaredField("identityServices"); - identityServicesField.setAccessible(true); - identityServicesField.set(cloudConfig, identityServicesMap); - - return cloudConfig; - } - - private void setCloudConfig() - throws NoSuchFieldException, IllegalAccessException { - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java deleted file mode 100644 index a4859a11b2..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java +++ /dev/null @@ -1,244 +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.openecomp.mso.cloud; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; - -public class CloudConfigTest { - - private static final int NUMBER_OF_CLOUD_SITES_IN_JSON_FILE = 4; - private static final int NUMBER_OF_IDENTITY_SERVICES_IN_JSON_FILE = 4; - private static final String CLOUD_SITES_FIELD_NAME = "cloudSites"; - private static final String IDENTITY_SERVICE_FIELD_NAME = "identityServices"; - private static final String CLOUD_SITE_DEFAULT = "default"; - private static final String CLOUD_CONFIG_JSON_FILE_NAME = "cloud_config.json"; - private static final String CLOUD_CONFIG_INVALID_JSON_FILE_NAME = "cloud_config_bad.json"; - - private CloudConfig testedObject; - private CloudSite cloudSite; - private CloudSite cloudSiteDefault; - - @Before - public void init() { - testedObject = new CloudConfig(); - } - - @Test - public void cloudSite_returnEmptyOptionalIfIdIsNull() { - Optional cloudConfigOpt = new CloudConfig().getCloudSite(null); - assertThat(cloudConfigOpt).isEmpty(); - } - - @Test - public void cloudSiteIsGotById_when_IdFound() throws NoSuchFieldException, IllegalAccessException { - setCloudSitesMap(); - Optional cloudSiteOpt = testedObject.getCloudSite(cloudSite.getId()); - assertThat(cloudSiteOpt).isPresent(); - assertThat(cloudSiteOpt.get().getId()).isEqualTo(cloudSite.getId()); - assertThat(cloudSiteOpt.get().getClli()).isEqualTo(cloudSite.getClli()); - } - - @Test - @Ignore // 1802 merge - public void cloudSiteIsGotByClli_when_IdNotFound() throws NoSuchFieldException, IllegalAccessException { - setCloudSitesMap(); - Optional cloudSiteOpt = testedObject.getCloudSite(cloudSite.getClli()); - assertTrue(cloudSiteOpt.isPresent()); - assertThat(cloudSiteOpt.get().getId()).isEqualTo(cloudSite.getId()); - assertThat(cloudSiteOpt.get().getClli()).isEqualTo(cloudSite.getClli()); - } - - @Test - @Ignore // 1802 merge - public void cloudSiteIsGotByDefault_when_IdAndClliNotFound() throws NoSuchFieldException, IllegalAccessException { - setCloudSitesMap(); - Optional cloudSiteOpt = testedObject.getCloudSite("not_existing_id"); - assertTrue(cloudSiteOpt.isPresent()); - assertThat(cloudSiteOpt.get().getId()).isEqualTo("not_existing_id"); - assertThat(cloudSiteOpt.get().getClli()).isEqualTo(cloudSiteDefault.getClli()); - } - - @Test - @Ignore // 1802 merge - public void cloudSiteNotFound_returnNull() { - assertThat(testedObject.getCloudSite("not_existing_id")).isEmpty(); - } - - @Test - public void identityServiceFoundById() throws NoSuchFieldException, IllegalAccessException { - CloudIdentity cloudIdentity = createCloudIdentity(); - setIdentityServiceMap(); - CloudIdentity cloudIdentityResult = testedObject.getIdentityService(cloudIdentity.getId()); - - assertThat(cloudIdentityResult).isNotNull(); - assertThat(cloudIdentityResult.getId()).isEqualTo(cloudIdentity.getId()); - assertThat(cloudIdentityResult.getMsoId()).isEqualTo(cloudIdentity.getMsoId()); - } - - @Test - public void defaultClodeSiteNotFound_returnNull() { - assertThat(testedObject.getIdentityService("not_existing_id")).isNull(); - } - - @Test - public void loadCloudConfigSuccessful() throws IOException, MsoCloudIdentityNotFound { - ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); - String cloudConfigJsonFilePath = classLoader.getResource(CLOUD_CONFIG_JSON_FILE_NAME).getPath(); - testedObject.loadCloudConfig(cloudConfigJsonFilePath, 1); - assertThat(testedObject.isValidCloudConfig()).isTrue(); - checkCloudSites(); - checkIdentityServices(); - } - - @Test - public void loadCloudConfig_cloudIdentityNotFound() { - ClassLoader classLoader = CloudConfigTest.class.getClassLoader(); - String cloudConfigInvalidJsonFilePath = classLoader.getResource(CLOUD_CONFIG_INVALID_JSON_FILE_NAME).getPath(); - assertThatThrownBy(() -> testedObject.loadCloudConfig(cloudConfigInvalidJsonFilePath, 1)) - .isInstanceOf(MsoCloudIdentityNotFound.class) - .hasMessage("Cloud Identity [MT Cloud site refers to a non-existing identity service: " - + "MT_KEYSTONE_NOT_EXISTING] not found"); - assertThat(testedObject.isValidCloudConfig()).isFalse(); - } - - private void checkCloudSites() { - Map siteMap = testedObject.getCloudSites(); - assertThat(siteMap).isNotEmpty().hasSize(NUMBER_OF_CLOUD_SITES_IN_JSON_FILE); - CloudSite site1 = siteMap.get("MT"); - CloudSite site2 = siteMap.get("DAN"); - CloudSite site3 = siteMap.get("MTINJVCC101"); - CloudSite site4 = siteMap.get("MTSNJA4LCP1"); - - assertThat(site1.getId()).isEqualTo("MT"); - assertThat(site1.getRegionId()).isEqualTo("regionOne"); - assertThat(site1.getIdentityServiceId()).isEqualTo("MT_KEYSTONE"); - assertThat(site1.getIdentityService()).isNotNull(); - assertThat(site1.getIdentityService().getId()).isEqualTo(site1.getIdentityServiceId()); - - assertThat(site2.getId()).isEqualTo("DAN"); - assertThat(site2.getRegionId()).isEqualTo("RegionOne"); - assertThat(site2.getIdentityServiceId()).isEqualTo("DAN_KEYSTONE"); - assertThat(site2.getIdentityService()).isNotNull(); - assertThat(site2.getIdentityService().getId()).isEqualTo(site2.getIdentityServiceId()); - - assertThat(site3.getId()).isEqualTo("MTINJVCC101"); - assertThat(site3.getRegionId()).isEqualTo("regionTwo"); - assertThat(site3.getIdentityServiceId()).isEqualTo("MTINJVCC101_DCP"); - assertThat(site3.getIdentityService()).isNotNull(); - assertThat(site3.getIdentityService().getId()).isEqualTo(site3.getIdentityServiceId()); - - assertThat(site4.getId()).isEqualTo("MTSNJA4LCP1"); - assertThat(site4.getRegionId()).isEqualTo("mtsnjlcp1"); - assertThat(site4.getIdentityServiceId()).isEqualTo("MTSNJA3DCP1"); - assertThat(site4.getIdentityService()).isNotNull(); - assertThat(site4.getIdentityService().getId()).isEqualTo(site4.getIdentityServiceId()); - } - - private void checkIdentityServices() { - Map identityMap = testedObject.getIdentityServices(); - assertThat(identityMap).isNotEmpty().hasSize(NUMBER_OF_IDENTITY_SERVICES_IN_JSON_FILE); - - CloudIdentity identity1 = identityMap.get("MT_KEYSTONE"); - CloudIdentity identity2 = identityMap.get("DAN_KEYSTONE"); - CloudIdentity identity3 = identityMap.get("MTINJVCC101_DCP"); - CloudIdentity identity4 = identityMap.get("MTSNJA3DCP1"); - - assertThat(identity1.getMsoId()).isEqualTo("john"); - assertThat(identity1.getMsoPass()).isEqualTo("changeme"); - assertThat(identity1.getAdminTenant()).isEqualTo("admin"); - assertThat(identity1.getMemberRole()).isEqualTo("_member_"); - assertThat(identity1.hasTenantMetadata()).isFalse(); - - assertThat(identity2.getMsoId()).isEqualTo("mockId"); - assertThat(identity2.getMsoPass()).isEqualTo("stack123"); - assertThat(identity2.getAdminTenant()).isEqualTo("service"); - assertThat(identity2.getMemberRole()).isEqualTo("_member_"); - assertThat(identity2.hasTenantMetadata()).isFalse(); - - assertThat(identity3.getMsoId()).isEqualTo("mockIdToo"); - assertThat(identity3.getMsoPass()).isEqualTo("AICG@mm@@2015"); - assertThat(identity3.getAdminTenant()).isEqualTo("service"); - assertThat(identity3.getMemberRole()).isEqualTo("admin"); - assertThat(identity3.hasTenantMetadata()).isTrue(); - - assertThat(identity4.getMsoId()).isEqualTo("mockIdToo"); - assertThat(identity4.getMsoPass()).isEqualTo("2315QRS2015srq"); - assertThat(identity4.getAdminTenant()).isEqualTo("service"); - assertThat(identity4.getMemberRole()).isEqualTo("admin"); - assertThat(identity4.hasTenantMetadata()).isTrue(); - } - - @Test - public void cloneSuccessful() throws NoSuchFieldException, IllegalAccessException { - setCloudSitesMap(); - setIdentityServiceMap(); - assertThat(testedObject.clone()).isEqualTo(testedObject); - } - - private void setCloudSitesMap() throws NoSuchFieldException, IllegalAccessException { - Field field = testedObject.getClass().getDeclaredField(CLOUD_SITES_FIELD_NAME); - field.setAccessible(true); - Map cloudSites = new HashMap<>(); - cloudSite = createCloudSite("idTest1", "clliTest1"); - cloudSiteDefault = createCloudSite(CLOUD_SITE_DEFAULT, "clliTest2"); - cloudSites.put(cloudSite.getId(), cloudSite); - cloudSites.put(cloudSiteDefault.getId(), cloudSiteDefault); - field.set(testedObject, cloudSites); - } - - private void setIdentityServiceMap() throws NoSuchFieldException, IllegalAccessException { - Field field = testedObject.getClass().getDeclaredField(IDENTITY_SERVICE_FIELD_NAME); - field.setAccessible(true); - - Map cloudIdentityMap = new HashMap<>(); - CloudIdentity cloudIdentity = createCloudIdentity(); - cloudIdentityMap.put(cloudIdentity.getId(), cloudIdentity); - field.set(testedObject, cloudIdentityMap); - } - - private CloudIdentity createCloudIdentity() { - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setId("identityTestId"); - cloudIdentity.setMsoId("msoTestId"); - return cloudIdentity; - } - - private CloudSite createCloudSite(String id, String clli) { - CloudSite cloudSite = new CloudSite(); - cloudSite.setId(id); - cloudSite.setClli(clli); - cloudSite.setAic_version("2.5"); - cloudSite.setIdentityService(createCloudIdentity()); - return cloudSite; - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java deleted file mode 100644 index eef45b7164..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java +++ /dev/null @@ -1,64 +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.openecomp.mso.cloud; - - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - - -public class CloudIdentityTest { - - @Test - public final void testCloudIdentity () { - CloudIdentity id = new CloudIdentity (); - id.setAdminTenant ("AdminTenant"); - id.setId ("id"); -// id.setKeystoneUrl ("keystone"); - id.setIdentityUrl ("keystone"); - id.setMemberRole ("member"); - id.setMsoId ("msoId"); - id.setMsoPass (CloudIdentity.encryptPassword ("password")); - id.setTenantMetadata (true); - id.setIdentityServerType(null); - id.setIdentityAuthenticationType(null); - - - assertTrue (id.getAdminTenant ().equals ("AdminTenant")); - assertTrue (id.getId ().equals ("id")); -// assertTrue (id.getKeystoneUrl ().equals ("keystone")); - assertTrue (id.getMemberRole ().equals ("member")); - assertTrue (id.getMsoId ().equals ("msoId")); - assertTrue (id.getMsoPass ().equals ("password")); - assertTrue (id.hasTenantMetadata ()); -// assertTrue (id.toString ().contains ("keystone")); - assertTrue(id.toString().contains("null")); - } - - @Test - public final void testEncryption () { - String encrypted = CloudIdentity.encryptPassword ("password"); - assertTrue (encrypted != null); - assertTrue (!encrypted.equals ("password")); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteTest.java deleted file mode 100644 index 4c5ceb238c..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudSiteTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.cloud; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -public class CloudSiteTest { - - @Mock - CloudIdentity ci= new CloudIdentity(); - - @InjectMocks - CloudSite cs = new CloudSite(); - - -@Before -public void init(){ - MockitoAnnotations.initMocks(this); - } - @Test - public void testCloudSite() { - cs.setAic_version("aic_version"); - cs.setClli("clli"); - cs.setId("id"); - cs.setIdentityService(ci); - cs.setRegionId("regionId"); - assert(cs.getAic_version().equals("aic_version")); - assert(cs.getClli().equals("clli")); - assert(cs.getId().equals("id")); - assert(cs.getIdentityService().equals(ci)); - assert(cs.getRegionId().equals("regionId")); - } - @Test - public void testtoStringmethod(){ - assert(cs.toString()!=null); - } - @Test - public void testhashCodemethod(){ - assert(cs.hashCode()!=0); - } - @Test - public void testclone(){ - assert(cs.clone()!=null); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactoryTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactoryTest.java deleted file mode 100644 index 2cfce276d8..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodFactoryTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.woorea.openstack.keystone.model.Authentication; -import org.junit.Test; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudIdentity.IdentityAuthenticationType; -import org.openecomp.mso.cloud.authentication.wrappers.RackspaceAPIKeyWrapper; - -public class AuthenticationMethodFactoryTest { - - private static final Class WRAPPER_CLASS = RackspaceAPIKeyWrapper.class; - private static final String AUTHENTICATION_TYPE = "authenticationTest"; - - @Test - public void register_NoExceptionThrown() throws IllegalAccessException, InstantiationException { - AuthenticationMethodFactory.register(AUTHENTICATION_TYPE, WRAPPER_CLASS); - } - - @Test - public void register_throwExceptionWhenAuthTypeIsNull() throws InstantiationException, IllegalAccessException { - try { - AuthenticationMethodFactory.register(null, WRAPPER_CLASS); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isNotEmpty().contains("Authentication Type to register cannot be null " - + "or an empty name string"); - } - } - - @Test - public void register_throwExceptionWhenAuthTypeIsEmpty() throws InstantiationException, IllegalAccessException { - try { - AuthenticationMethodFactory.register("", WRAPPER_CLASS); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isNotEmpty().contains("Authentication Type to register cannot be null " - + "or an empty name string"); - } - } - - @Test - public void register_throwExceptionWhenWrapperIsNull() throws IllegalAccessException, InstantiationException { - try { - AuthenticationMethodFactory.register(AUTHENTICATION_TYPE, null); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isNotEmpty() - .contains("Wrapper Class to register for Authentication cannot be null"); - } - } - - @Test - public void getAuthentication_NoExceptionThrown() { - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setIdentityAuthenticationType(IdentityAuthenticationType.RACKSPACE_APIKEY); - cloudIdentity.setMsoId("msoIdTest"); - cloudIdentity.setMsoPass("123"); - Authentication result = AuthenticationMethodFactory.getAuthenticationFor(cloudIdentity); - assertThat(result).isNotNull(); - } - - @Test - public void getAuthentication_ThrowExWhenCloudSiteIsNull() { - try { - AuthenticationMethodFactory.getAuthenticationFor(null); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isNotEmpty().contains("Cloud identity cannot be null"); - } - } - - @Test - public void getAuthentication_ThrowExWhenIdentityAuthenticationTypeIsNotSet() { - try { - AuthenticationMethodFactory.getAuthenticationFor(new CloudIdentity()); - } catch (IllegalArgumentException e) { - assertThat(e.getMessage()).isNotEmpty() - .contains("Cloud identity authentication type cannot be null or empty"); - } - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java deleted file mode 100644 index b6c1c7373f..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication; - -import static org.junit.Assert.assertTrue; - -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import org.junit.Test; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; - -/** - * A few JUnit tests to evaluate the new factory that manages authentication - * types and their associated wrapper classes. Here it is assumed that core types - * only are tested. - * - */ -public class AuthenticationMethodTest { - - /** - * - */ - public AuthenticationMethodTest() { - // TODO Auto-generated constructor stub - } - - @Test - public void testCustomRackspaceAuthFromCloudIdentity() { - CloudIdentity ci = new CloudIdentity(); - ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); - ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); - ci.setMsoId("test"); - Authentication auth = ci.getAuthentication(); - assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); - } - - @Test - public void testCoreUsernamePasswordAuthFromCloudIdentity() { - CloudIdentity ci = new CloudIdentity(); - ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD); - ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); - ci.setMsoId("someuser"); - Authentication auth = ci.getAuthentication(); - assertTrue(UsernamePassword.class.equals(auth.getClass())); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapperTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapperTest.java deleted file mode 100644 index 33f91c641e..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/RackspaceAPIKeyWrapperTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication.wrappers; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import com.woorea.openstack.keystone.model.Authentication; -import org.junit.Test; -import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; - -public class RackspaceAPIKeyWrapperTest { - - @Test - public void getAuthenticationSuccessful() { - RackspaceAPIKeyWrapper testedObject = new RackspaceAPIKeyWrapper(); - Authentication authentication = testedObject.getAuthentication(WrapperTestUtility.createCloudIdentity()); - - assertThat(authentication).isInstanceOf(RackspaceAuthentication.class); - RackspaceAuthentication rackspaceAuthentication = (RackspaceAuthentication) authentication; - assertThat(rackspaceAuthentication.getToken().getUsername()) - .isEqualTo(WrapperTestUtility.CLOUD_IDENTITY_MSO_ID); - assertThat(rackspaceAuthentication.getToken().getApiKey()) - .isEqualTo(WrapperTestUtility.CLOUD_IDENTITY_MSO_PASS); - } - - @Test - public void getAuthenticationThrowsException() { - assertThatThrownBy(() -> new RackspaceAPIKeyWrapper().getAuthentication(null)) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage(WrapperTestUtility.EXCEPTION_MESSAGE); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapperTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapperTest.java deleted file mode 100644 index 0cfe287dfe..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/UsernamePasswordWrapperTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication.wrappers; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import com.woorea.openstack.keystone.model.Authentication; -import com.woorea.openstack.keystone.model.authentication.UsernamePassword; -import org.junit.Test; - -public class UsernamePasswordWrapperTest { - - @Test - public void getAuthenticationSuccessful() { - UsernamePasswordWrapper testedObject = new UsernamePasswordWrapper(); - Authentication authentication = testedObject.getAuthentication(WrapperTestUtility.createCloudIdentity()); - - assertThat(authentication).isInstanceOf(UsernamePassword.class); - UsernamePassword usernamePassword = (UsernamePassword) authentication; - assertThat(usernamePassword.getPasswordCredentials().getUsername()) - .isEqualTo(WrapperTestUtility.CLOUD_IDENTITY_MSO_ID); - assertThat(usernamePassword.getPasswordCredentials().getPassword()) - .isEqualTo(WrapperTestUtility.CLOUD_IDENTITY_MSO_PASS); - } - - @Test - public void getAuthenticationThrowsException() { - assertThatThrownBy(() -> new UsernamePasswordWrapper().getAuthentication(null)). - isInstanceOf(IllegalArgumentException.class). - hasMessage(WrapperTestUtility.EXCEPTION_MESSAGE); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/WrapperTestUtility.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/WrapperTestUtility.java deleted file mode 100644 index 3cbc48d090..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/wrappers/WrapperTestUtility.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * ============LICENSE_START========================================== - * =================================================================== - * 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============================================ - * - * ECOMP and OpenECOMP are trademarks - * and service marks of AT&T Intellectual Property. - * - */ - -package org.openecomp.mso.cloud.authentication.wrappers; - -import org.openecomp.mso.cloud.CloudIdentity; - -final class WrapperTestUtility { - - static final String CLOUD_IDENTITY_MSO_ID = "msoIdTest"; - static final String CLOUD_IDENTITY_MSO_PASS = "msoPassTest"; - static final String EXCEPTION_MESSAGE = "Provided cloud identity is null, cannot extract username and " - + "password"; - - private WrapperTestUtility() { - } - - static CloudIdentity createCloudIdentity() { - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setMsoId(CLOUD_IDENTITY_MSO_ID); - cloudIdentity.setMsoPass(CloudIdentity.encryptPassword(CLOUD_IDENTITY_MSO_PASS)); - return cloudIdentity; - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java deleted file mode 100644 index 40108b3802..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java +++ /dev/null @@ -1,71 +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.openecomp.mso.cloud.servertype; - -import java.util.Map; - -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.openstack.beans.MsoTenant; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoTenantUtils; - - -public class NewServerTypeUtils extends MsoTenantUtils { - - public NewServerTypeUtils(String msoPropID, CloudConfigFactory cloudConfigFactory) { - super(msoPropID, cloudConfigFactory); - } - - @Override - public String createTenant(String tenantName, String cloudSiteId, Map metadata, boolean backout) - throws MsoException { - // TODO Auto-generated method stub - return null; - } - - @Override - public MsoTenant queryTenant(String tenantId, String cloudSiteId) throws MsoException, MsoCloudSiteNotFound { - // TODO Auto-generated method stub - return null; - } - - @Override - public MsoTenant queryTenantByName(String tenantName, String cloudSiteId) - throws MsoException, MsoCloudSiteNotFound { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean deleteTenant(String tenantId, String cloudSiteId) throws MsoException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getKeystoneUrl(String regionId, String msoPropID, CloudIdentity cloudIdentity) - throws MsoException { - return msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl(); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java deleted file mode 100644 index 69fab27f78..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java +++ /dev/null @@ -1,92 +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.openecomp.mso.cloud.servertype; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudIdentity.IdentityServerType; -import org.openecomp.mso.cloud.IdentityServerTypeAbstract; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoKeystoneUtilsTest; - -public class ServerTypeTest { - - @BeforeClass - public static void init() throws Exception { - String cloudConfigJson = ServerTypeTest.class.getClassLoader() - .getResource("cloud_config.json").getPath(); - (new CloudConfigFactory()).initializeCloudConfig(cloudConfigJson, 0); - } - - @Test - @Ignore // IGNORED FOR 1710 MERGE TO ONAP - public void testKeystoneServerType() { - IdentityServerTypeAbstract keystoneServerType = IdentityServerType.valueOf("KEYSTONE"); - assertNotNull(keystoneServerType); - } - - @Test - public void testNewServerType() { - IdentityServerTypeAbstract customServerType = null; - try { - customServerType = new IdentityServerType("NewServerType", NewServerTypeUtils.class); - - } catch (IllegalArgumentException e) { - fail("An exception should not be raised when we register a new server type for the first time"); - } finally { - System.out.println(IdentityServerType.values().toString()); - assertEquals(customServerType, IdentityServerType.valueOf("NewServerType")); - } - - // Create it a second time - IdentityServerTypeAbstract customServerType2 = null; - try { - customServerType2 = new IdentityServerType("NewServerType", NewServerTypeUtils.class); - fail("An exception should be raised as server type does not exist"); - } catch (IllegalArgumentException e) { - // Fail silently -- it simply indicates we already registered it - customServerType2 = IdentityServerType.valueOf("NewServerType"); - } finally { - System.out.println(IdentityServerType.values().toString()); - assertEquals(customServerType2, IdentityServerType.valueOf("NewServerType")); - } - - // Check the KeystoneURL for this custom TenantUtils - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setIdentityUrl("LocalIdentity"); - cloudIdentity.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); - cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.valueOf("NewServerType")); - String regionId = "RegionA"; - String msoPropID = "12345"; - try { - assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl()); - } catch (MsoException e) { - fail("No MSO Exception should have occured here"); - } - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java deleted file mode 100644 index a8fef5db94..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/beans/DeploymentInfoTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.cloudify.beans; - -import static org.mockito.Mockito.mock; -import java.util.HashMap; -import java.util.Map; -import org.junit.Test; -import org.mockito.Mock; -import org.openecomp.mso.cloudify.v3.model.Deployment; -import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs; -import org.openecomp.mso.cloudify.v3.model.Execution; -import org.powermock.api.mockito.PowerMockito; - -public class DeploymentInfoTest { - - @Mock - DeploymentStatus status; - - @Mock - DeploymentOutputs out; - - @Mock - Execution execution; - - @Mock - Deployment deployment; - - @Test - public void test() { - Deployment deployment=mock(Deployment.class); - Map dep=new HashMap(); - Map outputs = new HashMap(); - Map inputs = new HashMap(); - inputs.put("id",dep); - status=DeploymentStatus.CREATED; - outputs.put("id", out); - dep.put("id", outputs); - DeploymentInfo dinfo=new DeploymentInfo(deployment); - DeploymentInfo dinfi=new DeploymentInfo("id"); - DeploymentInfo din=new DeploymentInfo("id",outputs); - DeploymentInfo dfo=new DeploymentInfo("id", status); - DeploymentInfo dfoi=new DeploymentInfo(deployment, out, execution); - dinfo=PowerMockito.spy(new DeploymentInfo()); - dinfo.setId("id"); - dinfi.setInputs(inputs); - din.setStatus(status); - din.setOutputs(outputs); - assert(din.toString()!=null); - assert(din.getOutputs().equals(outputs)); - assert(din.getId().equals("id")); - assert(din.getStatus().equals(status)); - din.getLastAction(); - din.getErrorMessage(); - din.getActionStatus(); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java deleted file mode 100644 index 1521d11f31..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyExceptionTest.java +++ /dev/null @@ -1,39 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.cloudify.exceptions; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class MsoCloudifyExceptionTest { - - @Test - public void test() { - Exception e = null; - boolean pendingWorkflow=true; - MsoCloudifyException mce=new MsoCloudifyException(200, "message", "detail"); - MsoCloudifyException mcl=new MsoCloudifyException(200, "message", "detail", e); - mce.setPendingWorkflow(pendingWorkflow); - assert(mcl.toString()!=null); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTest.java deleted file mode 100644 index 1646f53022..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.cloudify.exceptions; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class MsoCloudifyTest { - - @Test - public void test() { - MsoBlueprintAlreadyExists mbae=new MsoBlueprintAlreadyExists("blueprintId", "cloud"); - MsoCloudifyManagerNotFound mcm=new MsoCloudifyManagerNotFound("cloudSiteId"); - MsoDeploymentAlreadyExists mdae=new MsoDeploymentAlreadyExists("deploymentId", "cloud"); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java deleted file mode 100644 index f24db06389..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyTimeoutTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.cloudify.exceptions; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.mock; - -import org.junit.Test; -import org.openecomp.mso.cloudify.v3.model.Execution; - -public class MsoCloudifyTimeoutTest { - - @Test - public void test() { - Execution execution=mock(Execution.class); - MsoCloudifyTimeout mct=new MsoCloudifyTimeout(execution); - mct.getExecution(); - assert(mct.toString()!=null); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java deleted file mode 100644 index 985066cab1..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/exceptions/MsoCloudifyWorkflowExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.cloudify.exceptions; - -import static org.junit.Assert.*; - -import org.junit.Test; - -public class MsoCloudifyWorkflowExceptionTest { - - @Test - public void test() { - MsoCloudifyWorkflowException mcw=new MsoCloudifyWorkflowException("message", "id", "workflowId", "workflowStatus"); - mcw.getWorkflowStatus(); - assertFalse(mcw.isWorkflowStillRunning()); - - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java deleted file mode 100644 index da4aebd3d9..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest.java +++ /dev/null @@ -1,144 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.cloudify.utils; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.cloudify.beans.DeploymentInfo; -import org.openecomp.mso.cloudify.exceptions.MsoCloudifyManagerNotFound; -import org.openecomp.mso.cloudify.v3.client.Cloudify; -import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.HashMap; -import java.util.Map; -import static org.mockito.Mockito.mock; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; - -//@RunWith(PowerMockRunner.class) -@PrepareForTest({MsoCloudifyUtils.class}) - - -public class MsoCloudifyUtilsTest { - - - @Mock - MsoPropertiesFactory msoPropertiesFactory; - - @Mock - CloudConfigFactory cloudConfigFactory; - - @Mock - DeploymentInfo deploymentInfo; - - @Mock - Cloudify cloudify; - - @Mock - DeploymentOutputs deploymentOutputs; - - @Mock - CloudSite cloudSite; - - @Test(expected = NullPointerException.class) - public void testCreateandInstallDeployment() throws MsoException { - - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - Map inputs = new HashMap<>(); - inputs.put("1", "value"); - - mcu.createAndInstallDeployment("cloudSiteId", "tenantId", "deploymentId", "blueprintId" - , inputs, true, 1, true); - - assert (mcu.createAndInstallDeployment("cloudSiteId", "tenantId", "deploymentId", "blueprintId" - , inputs, true, 1, true) != null); - - - } - - @Test(expected = NullPointerException.class) - public void testDeploymentOutputs() throws MsoException { - - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - mcu.queryDeployment("cloudSiteId", "tenantId", "deploymentId"); - assert (mcu.queryDeployment("cloudSiteId", "tenantId", "deploymentId") != null); - } - - @Test(expected = NullPointerException.class) - public void testUninstallAndDeleteDeployment() throws MsoException { - - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - mcu.uninstallAndDeleteDeployment("cloudSiteId", "tenantId", "deploymentId", 1); - assert (mcu.uninstallAndDeleteDeployment("cloudSiteId", "tenantId", "deploymentId", 1) != null); - } - - @Test(expected = NullPointerException.class) - public void testIsBlueprintLoaded() throws MsoException { - - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - mcu.isBlueprintLoaded("cloudSiteId", "blueprintId"); - assertTrue(mcu.isBlueprintLoaded("cloudSiteId", "blueprintId")); - } - - @Test(expected = MsoCloudifyManagerNotFound.class) - public void testCloudifyClient() throws MsoException { - msoPropertiesFactory = mock(MsoPropertiesFactory.class); - cloudConfigFactory = mock(CloudConfigFactory.class); - cloudSite = mock(CloudSite.class); - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - mcu.getCloudifyClient(cloudSite); - assert (mcu.getCloudifyClient(cloudSite) != null); - - } - - @Test(expected = NullPointerException.class) - public void testuploadBlueprint() throws MsoException { - - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - - Map blueprintFiles = new HashMap(); - byte[] byteArray = new byte[]{8, 1, 2, 8}; - blueprintFiles.put("1", byteArray); - - mcu.uploadBlueprint("cloudSiteId", "blueprintId", "mainFileName", blueprintFiles, false); - - } - - @Test(expected = NullPointerException.class) - public void testqueryDeployment() throws MsoException { - - MsoCloudifyUtils mcu = new MsoCloudifyUtils("msoPropID", msoPropertiesFactory, cloudConfigFactory); - mcu.queryDeployment(cloudify, "deploymentId"); - assert (mcu.queryDeployment(cloudify, "deploymentId") != null); - - - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest2.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest2.java deleted file mode 100644 index 05608b4d99..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloudify/utils/MsoCloudifyUtilsTest2.java +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * ============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.openecomp.mso.cloudify.utils; - -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.mso.adapters.vdu.CloudInfo; -import org.openecomp.mso.adapters.vdu.PluginAction; -import org.openecomp.mso.adapters.vdu.VduArtifact; -import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; -import org.openecomp.mso.adapters.vdu.VduInstance; -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.adapters.vdu.VduStateType; -import org.openecomp.mso.adapters.vdu.VduStatus; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.cloudify.beans.DeploymentInfo; -import org.openecomp.mso.cloudify.beans.DeploymentStatus; -import org.openecomp.mso.cloudify.v3.client.Cloudify; -import org.openecomp.mso.cloudify.v3.model.AzureConfig; -import org.openecomp.mso.cloudify.v3.model.OpenstackConfig; -import org.openecomp.mso.openstack.exceptions.MsoException; - -public class MsoCloudifyUtilsTest2 { - - @Test - public void instantiateVduTest() throws MsoException { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("id"); - expected.setVduInstanceName("id"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.INSTANTIATED); - status.setLastAction(new PluginAction(null, null, null)); - expected.setStatus(status); - - MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class); - CloudSite site = new CloudSite(); - Optional opSite = Optional.ofNullable(site); - CloudConfig config = Mockito.mock(CloudConfig.class); - cloudify.cloudConfig = config; - Cloudify cloudifyClient = new Cloudify("cloudSite"); - CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("cloudSiteId"); - cloudInfo.setTenantId("tenantId"); - VduModelInfo vduModel = new VduModelInfo(); - vduModel.setModelCustomizationUUID("blueprintId"); - vduModel.setTimeoutMinutes(1); - VduArtifact artifact = new VduArtifact(); - artifact.setName("name"); - artifact.setType(ArtifactType.MAIN_TEMPLATE); - byte[] content = new byte[1]; - artifact.setContent(content); - List artifacts = new ArrayList<>(); - artifacts.add(artifact); - vduModel.setArtifacts(artifacts); - DeploymentInfo deployment = new DeploymentInfo(); - deployment.setId("id"); - deployment.setStatus(DeploymentStatus.INSTALLED); - Map blueprintFiles = new HashMap<>(); - blueprintFiles.put(artifact.getName(), artifact.getContent()); - String instanceName = "instanceName"; - Map inputs = new HashMap<>(); - boolean rollbackOnFailure = true; - - when(config.getCloudSite(cloudInfo.getCloudSiteId())).thenReturn(opSite); - doReturn(false).when(cloudify).isBlueprintLoaded(cloudInfo.getCloudSiteId(), - vduModel.getModelCustomizationUUID()); - doReturn(cloudifyClient).when(cloudify).getCloudifyClient(site); - doReturn(true).when(cloudify).uploadBlueprint(cloudifyClient, vduModel.getModelCustomizationUUID(), - artifact.getName(), blueprintFiles); - doReturn(deployment).when(cloudify).createAndInstallDeployment(cloudInfo.getCloudSiteId(), - cloudInfo.getTenantId(), instanceName, vduModel.getModelCustomizationUUID(), inputs, true, - vduModel.getTimeoutMinutes(), rollbackOnFailure); - - VduInstance actual = cloudify.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure); - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void queryVduTest() throws MsoException { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("id"); - expected.setVduInstanceName("id"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.INSTANTIATED); - status.setLastAction(new PluginAction(null, null, null)); - expected.setStatus(status); - - CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("cloudSiteId"); - cloudInfo.setTenantId("tenantId"); - DeploymentInfo deployment = new DeploymentInfo(); - deployment.setId("id"); - deployment.setStatus(DeploymentStatus.INSTALLED); - String instanceId = "instanceId"; - - MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class); - - doReturn(deployment).when(cloudify).queryDeployment(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(), - instanceId); - - VduInstance actual = cloudify.queryVdu(cloudInfo, instanceId); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void deleteVduTest() throws MsoException { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("id"); - expected.setVduInstanceName("id"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.DELETING); - status.setLastAction(new PluginAction("deleting", null, null)); - expected.setStatus(status); - - CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("cloudSiteId"); - cloudInfo.setTenantId("tenantId"); - String instanceId = "instanceId"; - int timeoutMinutes = 1; - DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class); - deployment.setId("id"); - deployment.setStatus(DeploymentStatus.CREATED); - when(deployment.getId()).thenReturn("id"); - when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED); - when(deployment.getLastAction()).thenReturn("deleting"); - MsoCloudifyUtils cloudify = Mockito.spy(MsoCloudifyUtils.class); - doReturn(deployment).when(cloudify).uninstallAndDeleteDeployment(cloudInfo.getCloudSiteId(), - cloudInfo.getTenantId(), instanceId, timeoutMinutes); - - VduInstance actual = cloudify.deleteVdu(cloudInfo, instanceId, timeoutMinutes); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void deploymentInfoToVduInstanceTest() { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("id"); - expected.setVduInstanceName("id"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.DELETING); - status.setLastAction(new PluginAction("deleting", null, null)); - expected.setStatus(status); - - DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class); - deployment.setId("id"); - deployment.setStatus(DeploymentStatus.CREATED); - when(deployment.getId()).thenReturn("id"); - when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED); - when(deployment.getLastAction()).thenReturn("deleting"); - - MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); - - VduInstance actual = cloudify.deploymentInfoToVduInstance(deployment); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void deploymentStatusToVduStatusTest() { - VduStatus expected = new VduStatus(); - expected.setState(VduStateType.DELETING); - expected.setLastAction(new PluginAction("deleting", null, null)); - - DeploymentInfo deployment = Mockito.mock(DeploymentInfo.class); - deployment.setId("id"); - deployment.setStatus(DeploymentStatus.CREATED); - when(deployment.getId()).thenReturn("id"); - when(deployment.getStatus()).thenReturn(DeploymentStatus.CREATED); - when(deployment.getLastAction()).thenReturn("deleting"); - - MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); - - VduStatus actual = cloudify.deploymentStatusToVduStatus(deployment); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void getOpenstackConfigTest() { - OpenstackConfig expected = new OpenstackConfig(); - expected.setRegion("regionId"); - expected.setAuthUrl("identityUrl"); - expected.setUsername("msoId"); - expected.setPassword("msoPass"); - expected.setTenantName("tenantId"); - - MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); - CloudSite cloudSite = Mockito.mock(CloudSite.class); - CloudIdentity cloudIdentity = Mockito.mock(CloudIdentity.class); - when(cloudSite.getIdentityService()).thenReturn(cloudIdentity); - when(cloudSite.getRegionId()).thenReturn("regionId"); - when(cloudIdentity.getIdentityUrl()).thenReturn("identityUrl"); - when(cloudIdentity.getMsoId()).thenReturn("msoId"); - when(cloudIdentity.getMsoPass()).thenReturn("msoPass"); - String tenantId = "tenantId"; - OpenstackConfig actual = cloudify.getOpenstackConfig(cloudSite, tenantId); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void getAzureConfigTest() { - AzureConfig expected = new AzureConfig(); - expected.setSubscriptionId("subscriptionId"); - expected.setTenantId("tenantId"); - expected.setClientId("msoId"); - expected.setClientSecret("msoPass"); - - MsoCloudifyUtils cloudify = new MsoCloudifyUtils(); - CloudSite cloudSite = Mockito.mock(CloudSite.class); - CloudIdentity cloudIdentity = Mockito.mock(CloudIdentity.class); - when(cloudSite.getIdentityService()).thenReturn(cloudIdentity); - when(cloudIdentity.getAdminTenant()).thenReturn("subscriptionId"); - when(cloudIdentity.getMsoId()).thenReturn("msoId"); - when(cloudIdentity.getMsoPass()).thenReturn("msoPass"); - String tenantId = "tenantId"; - AzureConfig actual = cloudify.getAzureConfig(cloudSite, tenantId); - - assertThat(actual, sameBeanAs(expected)); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java deleted file mode 100644 index a1de54e231..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.beans; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; - -public class MsoTenantTest { - MsoTenant ms = new MsoTenant(); - - @Test - public void test() { - Map map = new HashMap<>(); - map.put("id","name"); - ms.setTenantId("tenantId"); - ms.setTenantName("tenantName"); - ms.setMetadata(map); - assert(ms.getMetadata().equals(map)); - assert(ms.getTenantId().equals("tenantId")); - assert(ms.getTenantName().equals("tenantName")); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java deleted file mode 100644 index 0f357e5555..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java +++ /dev/null @@ -1,158 +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.openecomp.mso.openstack.beans; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Segment; -import java.util.ArrayList; -import java.util.List; -import org.junit.Test; - -public class NetworkInfoTest { - - private static final String NETWORK_STATUS_ACTIVE = "ACTIVE"; - private static final String NETWORK_STATUS_ID = "networkIdTest"; - private static final String NETWORK_STATUS_NAME = "networkNameTest"; - private static final String SUBNET_NAME = "subnetTest"; - private static final String PROVIDER = "providerTest"; - private static final String PROVIDER_NETWORK_TYPE_VLAN = "vlan"; - private static final String PROVIDER_NETWORK_TYPE_OTHER = "providerTypeTest"; - private static final Integer PROVIDER_SEGMENTATION_ID = 777; - private static final String PROVIDER_FOR_SEGMENT = "providerSegmentTest"; - private static final Integer PROVIDER_SEGMENTATION_ID_FOR_SEGMENT = 123; - - @Test - public void networkStatusUnknownWhenIsNullInNetwork() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetwork(null)); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.UNKNOWN); - checkCommonPartWhenProviderIsNotPresent(networkInfo); - } - - @Test - public void networkStatusUnknownWhenNotFoundInNetworkStatusMap() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetwork("notExistingNetworkStatus")); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.UNKNOWN); - checkCommonPartWhenProviderIsNotPresent(networkInfo); - } - - @Test - public void setNetworkStatusWhenNetworkStatusFoundInNetworkStatusMap() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetwork(NETWORK_STATUS_ACTIVE)); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.ACTIVE); - checkCommonPartWhenProviderIsNotPresent(networkInfo); - } - - @Test - public void setVLANProviderFromTheNetwork() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetworkWithProvider(NETWORK_STATUS_ACTIVE, PROVIDER, - PROVIDER_NETWORK_TYPE_VLAN)); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.ACTIVE); - assertThat(networkInfo.getProvider()).isEqualTo(PROVIDER); - assertThat(networkInfo.getVlans()).hasSize(1).contains(PROVIDER_SEGMENTATION_ID); - checkCommonPart(networkInfo); - } - - @Test - public void setOtherProviderFromTheNetwork() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetworkWithProvider(NETWORK_STATUS_ACTIVE, PROVIDER, - PROVIDER_NETWORK_TYPE_OTHER)); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.ACTIVE); - assertThat(networkInfo.getProvider()).isEqualTo(PROVIDER); - assertThat(networkInfo.getVlans()).isEmpty(); - checkCommonPart(networkInfo); - } - - @Test - public void setVLANProviderFromTheNetworkSegments() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetworkWithSegments(NETWORK_STATUS_ACTIVE, - prepareSegment(PROVIDER_NETWORK_TYPE_VLAN))); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.ACTIVE); - assertThat(networkInfo.getProvider()).isEqualTo(PROVIDER_FOR_SEGMENT); - assertThat(networkInfo.getVlans()).hasSize(1).contains(PROVIDER_SEGMENTATION_ID_FOR_SEGMENT); - checkCommonPart(networkInfo); - } - - @Test - public void setOtherProviderFromTheNetworkSegments() { - NetworkInfo networkInfo = new NetworkInfo(prepareNetworkWithSegments(NETWORK_STATUS_ACTIVE, - prepareSegment(PROVIDER_NETWORK_TYPE_OTHER))); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.ACTIVE); - assertThat(networkInfo.getProvider()).isEqualTo(PROVIDER_FOR_SEGMENT); - assertThat(networkInfo.getVlans()).isEmpty(); - checkCommonPart(networkInfo); - } - - @Test - public void setNetworkStatusNotFoundWhenNetworkIsNull() { - NetworkInfo networkInfo = new NetworkInfo(null); - assertThat(networkInfo.getStatus()).isEqualTo(NetworkStatus.NOTFOUND); - } - - private void checkCommonPartWhenProviderIsNotPresent(NetworkInfo networkInfo) { - assertThat(networkInfo.getProvider()).isEmpty(); - assertThat(networkInfo.getVlans()).isEmpty(); - checkCommonPart(networkInfo); - } - - private void checkCommonPart(NetworkInfo networkInfo) { - assertThat(networkInfo.getId()).isEqualTo(NETWORK_STATUS_ID); - assertThat(networkInfo.getName()).isEqualTo(NETWORK_STATUS_NAME); - assertThat(networkInfo.getSubnets()).hasSize(1).contains(SUBNET_NAME); - } - - private Network prepareNetwork(String networkStatus) { - Network network = new Network(); - network.setId(NETWORK_STATUS_ID); - network.setName(NETWORK_STATUS_NAME); - network.setStatus(networkStatus); - List subnets = new ArrayList<>(); - subnets.add(SUBNET_NAME); - network.setSubnets(subnets); - return network; - } - - private Network prepareNetworkWithProvider(String networkStatus, String providerPhysicalNetwork, String providerNetworkType) { - Network network = prepareNetwork(networkStatus); - network.setProviderPhysicalNetwork(providerPhysicalNetwork); - network.setProviderNetworkType(providerNetworkType); - network.setProviderSegmentationId(PROVIDER_SEGMENTATION_ID); - return network; - } - - private Network prepareNetworkWithSegments(String networkStatus, Segment segment) { - Network network = prepareNetwork(networkStatus); - List segments = new ArrayList<>(); - segments.add(segment); - network.setSegments(segments); - return network; - } - - private Segment prepareSegment(String providerNetworkType) { - Segment segment = new Segment(); - segment.setProviderPhysicalNetwork(PROVIDER_FOR_SEGMENT); - segment.setProviderNetworkType(providerNetworkType); - segment.setProviderSegmentationId(PROVIDER_SEGMENTATION_ID_FOR_SEGMENT); - return segment; - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java deleted file mode 100644 index d70c01d0d3..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.beans; - -import static org.junit.Assert.*; -import java.util.ArrayList; -import java.util.List; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.openecomp.mso.entity.MsoRequest; - -public class NetworkRollbackTest { - @Mock - MsoRequest ms = new MsoRequest(); - - @InjectMocks - NetworkRollback nr = new NetworkRollback(); - - @Test - public void test() { - List vlans = new ArrayList(); - vlans.add(1); - vlans.add(2); - nr.setCloudId("cloudId"); - nr.setModelCustomizationUuid("modelCustomizationUuid"); - nr.setNetworkId("networkId"); - nr.setNetworkName("networkName"); - nr.setNetworkStackId("networkStackId"); - nr.setNetworkType("networkType");; - nr.setNeutronNetworkId("neutronNetworkId"); - nr.setPhysicalNetwork("physicalNetwork"); - nr.setTenantId("tenantId"); - nr.setNetworkCreated(false); - nr.setVlans(vlans); - nr.setMsoRequest(ms); - assert(nr.getCloudId().equals("cloudId")); - assert(nr.getModelCustomizationUuid().equals("modelCustomizationUuid")); - assert(nr.getNetworkId().equals("networkId")); - assert(nr.getNetworkName().equals("networkName")); - assert(nr.getNetworkStackId().equals("networkStackId")); - assert(nr.getNeutronNetworkId().equals("neutronNetworkId")); - assert(nr.getPhysicalNetwork().equals("physicalNetwork")); - assert(nr.getNetworkType().equals("networkType")); - assert(nr.getTenantId().equals("tenantId")); - assert(nr.getMsoRequest().equals(ms)); - assertFalse(nr.getNetworkCreated()); - assert(nr.getVlans().equals(vlans)); - assert(nr.toString()!=null); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java deleted file mode 100644 index 9c7911ef89..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java +++ /dev/null @@ -1,98 +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.openecomp.mso.openstack.beans; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.woorea.openstack.heat.model.Stack; -import java.io.IOException; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; -import org.junit.Test; - -public class StackInfoTest { - - private static final String STACK_NAME = "stackNameTest"; - private static final String STACK_STATUS = "CREATE_COMPLETE"; - private static final String STACK_OUTPUT_KEY = "outputKeyTest"; - private static final String STACK_OUTPUT_VALUE = "outputValueTest"; - private static final String STACK_PARAM_KEY = "paramKeyTest"; - private static final String STACK_PARAM_VALUE = "paramValueTest"; - - @Test - public void setStatusNotFoundWhenStackIsNull() { - StackInfo stackInfo = new StackInfo(null); - assertThat(stackInfo.getStatus()).isEqualTo(HeatStatus.NOTFOUND); - assertThat(stackInfo.getOutputs()).isEmpty(); - assertThat(stackInfo.getParameters()).isEmpty(); - } - - @Test - public void createObjectWhenStackStatusIsNull() { - StackInfo stackInfo = new StackInfo(createStackWithStatus(null)); - assertThat(stackInfo.getName()).isEqualTo(STACK_NAME); - assertThat(stackInfo.getOutputs()).isEmpty(); - assertThat(stackInfo.getStatus()).isEqualTo(HeatStatus.INIT); - assertThat(stackInfo.getParameters()).hasSize(1).containsEntry(STACK_PARAM_KEY, STACK_PARAM_VALUE); - } - - @Test - public void createObjectWhenStackStatusIsFound() { - StackInfo stackInfo = new StackInfo(createStackWithStatus(STACK_STATUS)); - assertThat(stackInfo.getName()).isEqualTo(STACK_NAME); - assertThat(stackInfo.getOutputs()).isEmpty(); - assertThat(stackInfo.getStatus()).isEqualTo(HeatStatus.CREATED); - assertThat(stackInfo.getParameters()).hasSize(1).containsEntry(STACK_PARAM_KEY, STACK_PARAM_VALUE); - } - - @Test - public void createObjectWhenStackStatusIsUnknown() { - StackInfo stackInfo = new StackInfo(createStackWithStatus("unknownStatus")); - assertThat(stackInfo.getName()).isEqualTo(STACK_NAME); - assertThat(stackInfo.getOutputs()).isEmpty(); - assertThat(stackInfo.getStatus()).isEqualTo(HeatStatus.UNKNOWN); - assertThat(stackInfo.getParameters()).hasSize(1).containsEntry(STACK_PARAM_KEY, STACK_PARAM_VALUE); - } - - @Test - public void createStackWhenOutputsListIsNotNull() throws IOException { - StackInfo stackInfo = new StackInfo(createStackWithOutputs()); - assertThat(stackInfo.getOutputs()).isNotEmpty().hasSize(1); - assertThat(stackInfo.getOutputs()).hasSize(1).containsEntry(STACK_OUTPUT_KEY, STACK_OUTPUT_VALUE); - } - - private Stack createStackWithStatus(String stackStatus) { - Stack stack = new Stack(); - stack.setStackName(STACK_NAME); - stack.setStackStatus(stackStatus); - stack.getParameters().put(STACK_PARAM_KEY, STACK_PARAM_VALUE); - return stack; - } - - private Stack createStackWithOutputs() throws IOException { - String json = "{\"outputs\":[{\"output_key\" : \"" + STACK_OUTPUT_KEY + "\", \"output_value\" : \"" - + STACK_OUTPUT_VALUE + "\" }]}"; - JsonNode node = new ObjectMapper().readTree(json); - Stack stack = new ObjectMapper().readValue(node, Stack.class); - return stack; - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java deleted file mode 100644 index 668bc68a3d..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentEntryTest.java +++ /dev/null @@ -1,73 +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.openecomp.mso.openstack.utils; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Test; - -public class MsoHeatEnvironmentEntryTest { - - private static final String PARAMETER_NAME = "keyTest"; - private static final String VALUE_NAME = "valueTest"; - private static final String NOT_EXISTING_PARAM = "notExistingParam"; - private static final String RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY = "parameters: {" - + PARAMETER_NAME + ": " + VALUE_NAME + "}"; - private static final String RAW_ENTRY_WITH_RESOURCE_REGISTRY = "resource_registry: resourceTest"; - private static final String RAW_ENTRY_INVALID = "invalidRawEntry"; - - @Test - public void createObjectWithNullStringBuilder() { - MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(null); - assertThat(testedObject.isValid()).isTrue(); - assertThat(testedObject.getRawEntry()).isNull(); - assertThat(testedObject.containsParameter(PARAMETER_NAME)).isFalse(); - } - - @Test - public void toFullString_ResourceRegistryNotPresentInRawEntry() { - StringBuilder sb = new StringBuilder(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY); - MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb); - assertThat(testedObject.getRawEntry()).isEqualTo(sb); - assertThat(testedObject.isValid()).isTrue(); - assertThat(testedObject.containsParameter(PARAMETER_NAME)).isTrue(); - assertThat(testedObject.toString()).doesNotContain(RAW_ENTRY_WITH_RESOURCE_REGISTRY); - } - - @Test - public void toFullString_ExceptionOccurred() { - StringBuilder sb = new StringBuilder(RAW_ENTRY_INVALID); - MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb); - assertThat(testedObject.getRawEntry()).isEqualTo(sb); - assertThat(testedObject.isValid()).isFalse(); - assertThat(testedObject.getErrorString()).isNotNull().isNotEmpty(); - } - - @Test - public void checkIfContainsTheParameter() { - StringBuilder sb = new StringBuilder(RAW_ENTRY_WITH_NO_RESOURCE_REGISTRY); - MsoHeatEnvironmentEntry testedObject = new MsoHeatEnvironmentEntry(sb); - assertThat(testedObject.getRawEntry()).isEqualTo(sb); - assertThat(testedObject.isValid()).isTrue(); - assertThat(testedObject.containsParameter(PARAMETER_NAME)).isTrue(); - assertThat(testedObject.containsParameter(NOT_EXISTING_PARAM)).isFalse(); - } -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java deleted file mode 100644 index 17a94840cf..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentParameterTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import static org.mockito.Mockito.mock; - -import org.junit.Test; - -public class MsoHeatEnvironmentParameterTest { - - @Test - public void test() { - MsoHeatEnvironmentParameter hep=mock(MsoHeatEnvironmentParameter.class); - Object op=hep.getName(); - MsoHeatEnvironmentParameter meo=new MsoHeatEnvironmentParameter(); - MsoHeatEnvironmentParameter mea=new MsoHeatEnvironmentParameter("name"); - MsoHeatEnvironmentParameter mep=new MsoHeatEnvironmentParameter("name"," value"); - mea.setName("name"); - mep.setValue("value"); - assert(mea.getName().equals("name")); - assert(mep.getValue().equals("value")); - assert(meo.toString()!=null); - //assertTrue(op.equals(hep)); - meo.equals(op); - meo.hashCode(); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java deleted file mode 100644 index fb666ea5df..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatEnvironmentResourceTest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import org.junit.Test; - - -public class MsoHeatEnvironmentResourceTest { - - - @Test - public void test() { - Object op=true; - // MsoHeatEnvironmentResource mer=mock(MsoHeatEnvironmentResource.class); - // MsoHeatEnvironmentResource mrea=new MsoHeatEnvironmentResource(); - MsoHeatEnvironmentResource mre=new MsoHeatEnvironmentResource("name"); - MsoHeatEnvironmentResource mae=new MsoHeatEnvironmentResource("name", "value"); - mre.setName("name"); - mae.setValue("value"); - assert(mre.getName().equals("name")); - assert(mae.getValue().equals("value")); - assert(mre.toString()!=null); - //assertFalse(mer.equals(op)); - mae.equals(op); - mae.hashCode(); - //when(mer.hashCode()).thenReturn(result); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java deleted file mode 100644 index 9ba9b2f39d..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest.java +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.utils; - - -import com.woorea.openstack.heat.Heat; -import com.woorea.openstack.heat.model.Stack; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.openstack.beans.HeatStatus; -import org.openecomp.mso.openstack.beans.StackInfo; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.exceptions.MsoTenantNotFound; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.doReturn; - -//@RunWith(PowerMockRunner.class) -@PrepareForTest({MsoHeatUtils.class}) - - -public class MsoHeatUtilsTest { - - @Mock - StackInfo stackInfo; - - @Mock - MsoPropertiesFactory msoPropertiesFactory; - - @Mock - CloudConfigFactory cloudConfigFactory; - - @Mock - Heat heatClient; - - @Mock - CloudSite cloudSite; - - @Test(expected = NullPointerException.class) - public void testCreateStack() throws MsoException - { - - MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1); - doReturn(mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - null, null, - null, - true)); - - } - - @Test(expected = NullPointerException.class) - public void testCreateStackOne() throws MsoException - { - MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - "env"); - doReturn(mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - "env", null, - null, - true)); - } - - @Test(expected = NullPointerException.class) - public void testCreateStackTwo() throws MsoException - { - MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - MapfileMap=new HashMap<>(); - fileMap.put("2", "value"); - mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - "env", - fileMap); - doReturn(mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - "env", fileMap, - null, - true)); - } - - @Test(expected = NullPointerException.class) - public void testCreateStackThree() throws MsoException - { - MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - MapfileMap=new HashMap<>(); - fileMap.put("2", "value"); - MapheatFileMap=new HashMap<>(); - heatFileMap.put("3", "value"); - mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - "env", - fileMap, - heatFileMap); - doReturn(mht.createStack("cloudSiteId", - "tenantId", - "stackName", - "heatTemplate", - metadata, - true, - 1, - "env", fileMap, - heatFileMap, - true)); - } - - @Test(expected = NullPointerException.class) - - - public void testqueryStack() throws MsoException - { - MsoHeatUtils mht = PowerMockito.spy(new MsoHeatUtils("msoPropID" ,msoPropertiesFactory,cloudConfigFactory)); - - mht.queryStack("cloudSiteId","tenantId","stackName"); - - try { - heatClient = mht.getHeatClient (cloudSite, "tenantId"); - assertNotNull(heatClient); - - } catch (MsoTenantNotFound e) { - doReturn(new StackInfo ("stackName", HeatStatus.NOTFOUND)); - } catch (MsoException me) { - - me.addContext ("QueryStack"); - throw me; - } - - Stack heatStack = mht.queryHeatStack (heatClient, "stackName"); - - assertNull(heatStack); - StackInfo stackInfo = new StackInfo ("stackName", HeatStatus.NOTFOUND); - doReturn(stackInfo); - - assertNotNull(heatStack); - doReturn(new StackInfo (heatStack)); - - - - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java deleted file mode 100644 index 74d512c63e..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoHeatUtilsTest2.java +++ /dev/null @@ -1,172 +0,0 @@ -/*- - * ============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.openecomp.mso.openstack.utils; - -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import org.junit.Test; -import org.mockito.Mockito; -import org.openecomp.mso.adapters.vdu.CloudInfo; -import org.openecomp.mso.adapters.vdu.PluginAction; -import org.openecomp.mso.adapters.vdu.VduArtifact; -import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; -import org.openecomp.mso.adapters.vdu.VduInstance; -import org.openecomp.mso.adapters.vdu.VduModelInfo; -import org.openecomp.mso.adapters.vdu.VduStateType; -import org.openecomp.mso.adapters.vdu.VduStatus; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.cloudify.beans.DeploymentInfo; -import org.openecomp.mso.cloudify.beans.DeploymentStatus; -import org.openecomp.mso.cloudify.utils.MsoCloudifyUtils; -import org.openecomp.mso.openstack.beans.HeatStatus; -import org.openecomp.mso.openstack.beans.StackInfo; -import org.openecomp.mso.openstack.exceptions.MsoException; - -import com.fasterxml.jackson.core.JsonProcessingException; - -public class MsoHeatUtilsTest2 { - - @Test - public void instantiateVduTest() throws MsoException, JsonProcessingException { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("canonicalName"); - expected.setVduInstanceName("name"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.INSTANTIATED); - status.setLastAction((new PluginAction("create", "complete", ""))); - expected.setStatus(status); - - MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class); - CloudSite site = new CloudSite(); - Optional opSite = Optional.ofNullable(site); - CloudConfig config = Mockito.mock(CloudConfig.class); - CloudConfigFactory cloudConfigFactory = Mockito.mock(CloudConfigFactory.class); - when(cloudConfigFactory.getCloudConfig()).thenReturn(config); - when(heatUtils.getCloudConfigFactory()).thenReturn(cloudConfigFactory); - CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("cloudSiteId"); - cloudInfo.setTenantId("tenantId"); - VduModelInfo vduModel = new VduModelInfo(); - vduModel.setModelCustomizationUUID("blueprintId"); - vduModel.setTimeoutMinutes(1); - VduArtifact artifact = new VduArtifact(); - artifact.setName("name"); - artifact.setType(ArtifactType.MAIN_TEMPLATE); - byte[] content = new byte[1]; - artifact.setContent(content); - List artifacts = new ArrayList<>(); - artifacts.add(artifact); - vduModel.setArtifacts(artifacts); - Map blueprintFiles = new HashMap<>(); - blueprintFiles.put(artifact.getName(), artifact.getContent()); - String instanceName = "instanceName"; - Map inputs = new HashMap<>(); - boolean rollbackOnFailure = true; - String heatTemplate = new String(artifact.getContent()); - when(config.getCloudSite(cloudInfo.getCloudSiteId())).thenReturn(opSite); - Map nestedTemplates = new HashMap(); - Map files = new HashMap(); - - StackInfo stackInfo = new StackInfo(); - stackInfo.setCanonicalName("canonicalName"); - stackInfo.setName("name"); - stackInfo.setStatus(HeatStatus.CREATED); - - doReturn(stackInfo).when(heatUtils).createStack(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(), - instanceName, heatTemplate, inputs, true, vduModel.getTimeoutMinutes(), null, nestedTemplates, files, - rollbackOnFailure); - - VduInstance actual = heatUtils.instantiateVdu(cloudInfo, instanceName, inputs, vduModel, rollbackOnFailure); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void queryVduTest() throws MsoException, JsonProcessingException { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("canonicalName"); - expected.setVduInstanceName("name"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.INSTANTIATED); - status.setLastAction((new PluginAction("create", "complete", ""))); - expected.setStatus(status); - - CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("cloudSiteId"); - cloudInfo.setTenantId("tenantId"); - String instanceId = "instanceId"; - - StackInfo stackInfo = new StackInfo(); - stackInfo.setCanonicalName("canonicalName"); - stackInfo.setName("name"); - stackInfo.setStatus(HeatStatus.CREATED); - - MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class); - - doReturn(stackInfo).when(heatUtils).queryStack(cloudInfo.getCloudSiteId(), cloudInfo.getTenantId(), instanceId); - - VduInstance actual = heatUtils.queryVdu(cloudInfo, instanceId); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void deleteVduTest() throws MsoException { - VduInstance expected = new VduInstance(); - expected.setVduInstanceId("canonicalName"); - expected.setVduInstanceName("name"); - VduStatus status = new VduStatus(); - status.setState(VduStateType.DELETED); - expected.setStatus(status); - - CloudInfo cloudInfo = new CloudInfo(); - cloudInfo.setCloudSiteId("cloudSiteId"); - cloudInfo.setTenantId("tenantId"); - String instanceId = "instanceId"; - - StackInfo stackInfo = new StackInfo(); - stackInfo.setCanonicalName("canonicalName"); - stackInfo.setName("name"); - stackInfo.setStatus(HeatStatus.NOTFOUND); - - int timeoutInMinutes = 1; - - MsoHeatUtils heatUtils = Mockito.spy(MsoHeatUtils.class); - - doReturn(stackInfo).when(heatUtils).deleteStack( cloudInfo.getTenantId(), cloudInfo.getCloudSiteId(), instanceId, true); - - VduInstance actual = heatUtils.deleteVdu(cloudInfo, instanceId, timeoutInMinutes); - - assertThat(actual, sameBeanAs(expected)); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java deleted file mode 100644 index f2d14d8b22..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoKeystoneUtilsTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - -import java.util.HashMap; -import java.util.Map; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudIdentity; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.openstack.beans.MsoTenant; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import com.woorea.openstack.keystone.Keystone; -import com.woorea.openstack.keystone.model.Tenant; - -//@RunWith(PowerMockRunner.class) -@PrepareForTest({MsoKeystoneUtils.class,CloudSite.class,CloudIdentity.class,Tenant.class,Keystone.class,MsoTenant.class,MsoJavaProperties.class}) -public class MsoKeystoneUtilsTest { - - @Mock - Tenant tenant; - - @Mock - Keystone adminClient; - - @Mock - MsoTenant mst; - - @Mock - CloudSite cs; - - @Mock - CloudIdentity cloudIdentity; - - @Mock - MsoJavaProperties msoProps; - - @Mock - private static CloudConfigFactory cloudConfigFactory; - - @BeforeClass - public static final void prepare () { - cloudConfigFactory = Mockito.mock(CloudConfigFactory.class); - CloudConfig cloudConfig = Mockito.mock(CloudConfig.class); - Mockito.when(cloudConfigFactory.getCloudConfig()).thenReturn(cloudConfig); - } - - @Test - public void testcreateTenant() throws MsoException{ - MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - tenant = mock(Tenant.class); - PowerMockito.when(tenant.getId ()).thenReturn("ID"); - doReturn(tenant.getId ()).when(msk).createTenant("tenantName", "cloudSiteId", metadata, true); - PowerMockito.spy(tenant.getId ()); - String Id = msk.createTenant("tenantName", "cloudSiteId", metadata, true); - Assert.assertEquals(tenant.getId (), Id); - assert(msk.createTenant("tenantName", "cloudSiteId", metadata, true)!=null); - } - @Test - public void testdeleteTenant() throws MsoException{ - MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory)); - doReturn(true).when(msk).deleteTenant("tenantId", "cloudSiteId"); - assertTrue(msk.deleteTenant("tenantId", "cloudSiteId")); - } - @Test - public void testfindTenantByName() throws Exception{ - MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory)); - doReturn(null).when(msk).findTenantByName(adminClient, "tenantName"); - assertNull(msk.findTenantByName(adminClient, "tenantName")); - } - @Test - public void testqueryTenant() throws MsoException{ - MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - mst = mock(MsoTenant.class); - PowerMockito.when(mst.getTenantId()).thenReturn("tenantId"); - PowerMockito.when(mst.getMetadata()).thenReturn(metadata); - PowerMockito.when(mst.getTenantName()).thenReturn("name"); - doReturn(mst).when(msk).queryTenant ("tenantId", "cloudSiteId"); - assertNotNull(msk.queryTenant("tenantId", "cloudSiteId")); - } - - @Test - public void testqueryTenantByName()throws MsoException { - MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory)); - Mapmetadata=new HashMap<>(); - metadata.put("1", "value"); - mst = mock(MsoTenant.class); - PowerMockito.when(mst.getTenantId()).thenReturn("tenantId"); - PowerMockito.when(mst.getMetadata()).thenReturn(metadata); - PowerMockito.when(mst.getTenantName()).thenReturn("name"); - doReturn(mst).when(msk).queryTenantByName ("tenantId", "cloudSiteId"); - assertNotNull(msk.queryTenantByName("tenantId", "cloudSiteId")); - - } - - @Test - public void testgetKeystoneAdminClient() throws MsoException{ - cloudIdentity = mock(CloudIdentity.class); - Keystone keystone = new Keystone (cloudIdentity.getKeystoneUrl ("region", "msoPropID")); - MsoKeystoneUtils msk = PowerMockito.spy(new MsoKeystoneUtils("ID", cloudConfigFactory)); - doReturn(keystone).when(msk).getKeystoneAdminClient(cs); - assertNotNull(msk.getKeystoneAdminClient(cs)); - } -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java deleted file mode 100644 index 839da370df..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoNeutronUtilsTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.openecomp.mso.cloud.CloudConfig; -import org.openecomp.mso.cloud.CloudConfigFactory; -import org.openecomp.mso.cloud.CloudSite; -import org.openecomp.mso.openstack.beans.NetworkInfo; -import org.openecomp.mso.openstack.exceptions.MsoException; -import org.openecomp.mso.openstack.utils.MsoNeutronUtils.NetworkType; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; - -import com.woorea.openstack.quantum.Quantum; -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Segment; - - -//@RunWith(PowerMockRunner.class) -@PrepareForTest({MsoNeutronUtils.class,MsoCommonUtils.class,NetworkInfo.class,CloudConfigFactory.class,CloudConfig.class,Segment.class,Network.class,Quantum.class}) -public class MsoNeutronUtilsTest{ - -@Mock -MsoCommonUtils utils; - -@Mock -NetworkInfo net; - -@Mock -CloudConfig cloudConfig; - -@Mock -Segment segment; - -@Mock -CloudConfigFactory cloudConfigFactory; - -@Mock -Network network; - -@Mock -NetworkInfo ninfo; - -@Mock -Quantum neutronClient; - -@Mock -CloudSite cloudSite; - - - @Test - public void testcreateNetwork() throws MsoException{ - List vlans=new ArrayList(); - vlans.add(1); - cloudConfigFactory = mock(CloudConfigFactory.class); - ninfo = mock(NetworkInfo.class); - MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory)); - NetworkType type=NetworkType.PROVIDER; - doReturn(ninfo).when(mnu).createNetwork("cloudSiteId", "tenantId", type, "networkName", "provider", vlans); - assert(mnu.createNetwork("cloudSiteId", "tenantId", type, "networkName", "provider", vlans)!=null); - - } - @Test - public void testqueryNetwork() throws MsoException{ - cloudConfigFactory = mock(CloudConfigFactory.class); - ninfo = mock(NetworkInfo.class); - MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory)); - doReturn(ninfo).when(mnu).queryNetwork("networkNameOrId", "tenantId", "cloudSiteId"); - NetworkInfo ni = mnu.queryNetwork("networkNameOrId", "tenantId", "cloudSiteId"); - assert(ni!=null); - } - - @Test - public void testdeleteNetwork() throws MsoException{ - cloudConfigFactory = mock(CloudConfigFactory.class); - MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory)); - doReturn(true).when(mnu).deleteNetwork("networkId", "tenantId", "cloudSiteId"); - assertTrue(mnu.deleteNetwork("networkId", "tenantId", "cloudSiteId")); - - } - @Test - public void testupdateNetwork() throws MsoException{ - List vlans=new ArrayList(); - vlans.add(1); - NetworkType type=NetworkType.PROVIDER; - cloudConfigFactory = mock(CloudConfigFactory.class); - ninfo = mock(NetworkInfo.class); - MsoNeutronUtils mnu=PowerMockito.spy(new MsoNeutronUtils("msoProp",cloudConfigFactory)); - doReturn(ninfo).when(mnu).updateNetwork("cloudSiteId", "tenantId", "Nid", type, "provider", vlans); - assert(mnu.updateNetwork("cloudSiteId", "tenantId", "Nid", type, "provider", vlans)!=null); - } - - } - - diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java deleted file mode 100644 index a759e0d1a6..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsFactoryTest.java +++ /dev/null @@ -1,44 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.junit.Test; -import org.openecomp.mso.openstack.exceptions.MsoCloudSiteNotFound; - -public class MsoTenantUtilsFactoryTest { - - MsoTenantUtils tenantU = null; - - @Test - public void test() throws MsoCloudSiteNotFound { - tenantU = mock( MsoKeystoneUtils.class); - new MsoTenantUtilsFactory("ID"); - MsoTenantUtilsFactory mti=mock(MsoTenantUtilsFactory.class); - mti.getTenantUtils("cloudSiteId"); - when(mti.getTenantUtils("cloudSiteId")).thenReturn(tenantU); - mti.getTenantUtilsByServerType("type"); - when(mti.getTenantUtilsByServerType("type")).thenReturn(tenantU); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java deleted file mode 100644 index ffb1e3b787..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoTenantUtilsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; -import org.openecomp.mso.cloud.CloudIdentity; - -@RunWith(MockitoJUnitRunner.class) -public class MsoTenantUtilsTest { - - @Test - public void test()throws Exception { - MsoTenantUtils mtu =mock(MsoTenantUtils.class); - //MsoTenantUtils mki = null; - CloudIdentity cloudIdentity=mock(CloudIdentity.class); - Map metadata=new HashMap<>(); - mtu.createTenant("name", "id", metadata, true); - verify(mtu).createTenant("name", "id", metadata, true); - mtu.queryTenant("tenantId", "cloudSiteId"); - verify(mtu).queryTenant("tenantId", "cloudSiteId"); - mtu.deleteTenant("tenantId", "cloudSiteId"); - verify(mtu).deleteTenant("tenantId", "cloudSiteId"); - mtu.getKeystoneUrl("regionId", "msoPropID", cloudIdentity); - verify(mtu).getKeystoneUrl("regionId", "msoPropID", cloudIdentity); - mtu.queryTenantByName("tenantName", "cloudSiteId"); - verify(mtu).queryTenantByName("tenantName", "cloudSiteId"); - - } -} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java deleted file mode 100644 index 3dee177dee..0000000000 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/openstack/utils/MsoYamlEditorWithEnvtTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.openstack.utils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.util.HashSet; -import java.util.Set; -import org.junit.Test; -import org.mockito.Mock; -import org.openecomp.mso.db.catalog.beans.HeatTemplateParam; -import org.powermock.api.mockito.PowerMockito; - -public class MsoYamlEditorWithEnvtTest { - - @Mock - MsoHeatEnvironmentParameter mhep; - - @Mock - HeatTemplateParam hep; - - @Test - public void testgetParameterList() { - Set paramSet = new HashSet<>(); - paramSet.add(hep); - mhep=PowerMockito.spy(new MsoHeatEnvironmentParameter()); - MsoYamlEditorWithEnvt Mso=mock(MsoYamlEditorWithEnvt.class); - when(Mso.getParameterList()).thenReturn(paramSet); - assert(Mso.getParameterList()!=null); - } - - @Test - public void testgetResourceLisstFromEnvt() { - Set paramSet = new HashSet<>(); - paramSet.add(mhep); - new MsoHeatEnvironmentResource();; - mhep=PowerMockito.spy(new MsoHeatEnvironmentParameter()); - MsoYamlEditorWithEnvt Mso=mock(MsoYamlEditorWithEnvt.class); - when(Mso.getParameterListFromEnvt()).thenReturn(paramSet); - } - - @Test - public void getParameterListFromEnvt() { - mhep=PowerMockito.spy(new MsoHeatEnvironmentParameter()); - Set paramSet = new HashSet<>(); - paramSet.add(mhep); - new MsoHeatEnvironmentResource();; - MsoYamlEditorWithEnvt Mso=mock(MsoYamlEditorWithEnvt.class); - when(Mso.getParameterListFromEnvt()).thenReturn(paramSet); - } - -} diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/CloudSite.json b/adapters/mso-adapter-utils/src/test/resources/__files/CloudSite.json new file mode 100644 index 0000000000..c86c98726b --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/CloudSite.json @@ -0,0 +1,9 @@ +{ + "region_id" : "regionId", + "identity_service_id" : "identityServiceId", + "aic_version" : "aicVersion", + "clli" : "clli", + "cloudify_id" : "cloudifyId", + "platform" : "platform", + "orchestrator" : "orchestrator" +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/Error.json b/adapters/mso-adapter-utils/src/test/resources/__files/Error.json new file mode 100644 index 0000000000..2d8136887e --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/Error.json @@ -0,0 +1,5 @@ +{ + "code" : 1, + "title" : "title", + "message" : "message" +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/Explanation.json b/adapters/mso-adapter-utils/src/test/resources/__files/Explanation.json new file mode 100644 index 0000000000..0ca060c64e --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/Explanation.json @@ -0,0 +1,6 @@ +{ + "explanation" : "explanation", + "code" : 1, + "title" : "title", + "error" : {} +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/GetNeutronNetwork.json b/adapters/mso-adapter-utils/src/test/resources/__files/GetNeutronNetwork.json new file mode 100644 index 0000000000..822f87f427 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/GetNeutronNetwork.json @@ -0,0 +1,45 @@ +{ + "network": { + "admin_state_up": true, + "availability_zone_hints": [], + "availability_zones": [ + "nova" + ], + "created_at": "2016-03-08T20:19:41", + "dns_domain": "my-domain.org.", + "id": "43173f6a-d699-414b-888f-ab243dda6dfe", + "ipv4_address_scope": null, + "ipv6_address_scope": null, + "l2_adjacency": false, + "mtu": 1500, + "name": "net1", + "port_security_enabled": true, + "project_id": "9bacb3c5d39d41a79512987f338cf177", + "qos_policy_id": "6a8454ade84346f59e8d40665f878b2e", + "revision_number": 1, + "router:external": false, + "segments": [ + { + "provider:network_type": "vlan", + "provider:physical_network": "public", + "provider:segmentation_id": 2 + }, + { + "provider:network_type": "flat", + "provider:physical_network": "default", + "provider:segmentation_id": 0 + } + ], + "shared": false, + "status": "ACTIVE", + "subnets": [ + "54d6f61d-db07-451c-9ab3-b9609b6b6f0b" + ], + "tags": ["tag1,tag2"], + "tenant_id": "4fd44f30292945e481c7b8a0c8908869", + "updated_at": "2016-03-08T20:19:41", + "vlan_transparent": false, + "description": "", + "is_default": false + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/HeatEnvironmentParameter.json b/adapters/mso-adapter-utils/src/test/resources/__files/HeatEnvironmentParameter.json new file mode 100644 index 0000000000..fbff1b564d --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/HeatEnvironmentParameter.json @@ -0,0 +1,4 @@ +{ + "name": "keyTest", + "value": "{\"type\":\"paramType\"}" +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json b/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json new file mode 100644 index 0000000000..411a3e0bd7 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/HeatStack.json @@ -0,0 +1,11 @@ +{ + "description" : "description", + "links" : [], + "stackStatusReason" : "stackStatusReason", + "stackName" : "stackName", + "updatedTime" : null, + "creationTime" : null, + "stackStatus" : "stackStatus", + "id" : "id", + "files" : {} +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParam.json b/adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParam.json new file mode 100644 index 0000000000..2200e0c57f --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParam.json @@ -0,0 +1,7 @@ +{ + "heatTemplateArtifactUuid" : "heatTemplateArtifactUuid", + "paramName" : "keyTest", + "required" : true, + "paramType" : "paramType", + "paramAlias" : "paramAlias" +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParamExpected.json b/adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParamExpected.json new file mode 100644 index 0000000000..581249f8e1 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/HeatTemplateParamExpected.json @@ -0,0 +1,5 @@ +{ + "paramName" : "keyTest", + "required" : true, + "paramType" : "paramType" +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/NeutronError.json b/adapters/mso-adapter-utils/src/test/resources/__files/NeutronError.json new file mode 100644 index 0000000000..853f89c685 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/NeutronError.json @@ -0,0 +1,5 @@ +{ + "type" : "type", + "message" : "message", + "detail" : "detail" +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json new file mode 100644 index 0000000000..d92f92a873 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackCreateNeutronNetworkResponse.json @@ -0,0 +1,11 @@ +{ + "network": + { + "status": "ACTIVE", + "subnets": [], + "name": "net-name", + "admin_state_up": true, + "tenant_id": "388a70781bae4ca895f17b7f6293eb70", + "shared": false, "id": "2a4017ef-31ff-496a-9294-e96ecc3bc9c9" + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json new file mode 100644 index 0000000000..7153f8b672 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Access.json @@ -0,0 +1,53 @@ +{ + "access": { + "token": { + "id": "tokenId1234", + "issued_at": null, + "expires": "1517418429142", + "tenant": null + }, + "serviceCatalog": [ + { + "type": "orchestration", + "name": null, + "endpoints": [ + { + "region": "regionOne", + "publicURL": "port", + "internalURL": null, + "adminURL": null + } + ], + "endpointsLinks": null + }, + { + "type": "network", + "name": null, + "endpoints": [ + { + "region": "regionOne", + "publicURL": "port", + "internalURL": null, + "adminURL": null + } + ], + "endpointsLinks": null + }, + { + "type": "identity", + "name": null, + "endpoints": [ + { + "region": "regionOne", + "publicURL": "port", + "internalURL": null, + "adminURL": null + } + ], + "endpointsLinks": null + } + ], + "user": null, + "metadata": null + } +} diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Roles.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Roles.json new file mode 100644 index 0000000000..47ae4488cd --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Roles.json @@ -0,0 +1,10 @@ +{ + "roles": [ + { + "id": "admin", + "name": "admin", + "description": null, + "enabled": null + } + ] +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_StackId.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_StackId.json new file mode 100644 index 0000000000..96e6e0fe8a --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_StackId.json @@ -0,0 +1,14 @@ +{ + "stack": { + "id": "da886914-efb2-4917-b335-c8381528d90b", + "links" : [ + { + "href" : "port", + "rel" : "self" + } + ], + "stack_name": "name", + "stack_status": "CREATE_COMPLETE" + + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json new file mode 100644 index 0000000000..477acadf81 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_Created.json @@ -0,0 +1,17 @@ +{ + "stack": { + "description": null, + "links": null, + "stack_status_reason": null, + "stack_name": "stackname", + "updated_time": null, + "creation_time": null, + "stack_status": "CREATE_COMPLETE", + "id": "stackId", + "files": null, + "outputs": null, + "parameters": { + + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json new file mode 100644 index 0000000000..8612258eee --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json @@ -0,0 +1,17 @@ +{ + "stack": { + "description": null, + "links": null, + "stackStatusReason": null, + "stackName": null, + "updatedTime": null, + "creationTime": null, + "stack_status": "DELETE_COMPLETE", + "id": "stackId", + "files": null, + "outputs": null, + "parameters": { + + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Tenant.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Tenant.json new file mode 100644 index 0000000000..e8eebbbf7c --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Tenant.json @@ -0,0 +1,8 @@ +{ + "tenant": { + "id": "tenantId", + "name": "testingTenantName", + "description": null, + "enabled": null + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_User.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_User.json new file mode 100644 index 0000000000..d2f3ea2b0e --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_User.json @@ -0,0 +1,11 @@ +{ + "user": { + "id": "msoId", + "username": "admin", + "password": null, + "tenantId": "tenantId", + "name": "testingTenantName", + "email": null, + "enabled": null + } +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json b/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json new file mode 100644 index 0000000000..0a09d599ba --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/__files/UpdateStack.json @@ -0,0 +1,11 @@ +{ + "description" : "description", + "links" : [], + "stackStatusReason" : "stackStatusReason", + "stackName" : "stackName", + "updatedTime" : null, + "creationTime" : null, + "stackStatus" : "UPDATE_COMPLETE", + "id" : "id", + "files" : {} +} \ No newline at end of file diff --git a/adapters/mso-adapter-utils/src/test/resources/application-test.yaml b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..b584088587 --- /dev/null +++ b/adapters/mso-adapter-utils/src/test/resources/application-test.yaml @@ -0,0 +1,50 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck +# MSO Properties go here +mso: + catalog: + db: + spring: + endpoint: "http://localhost:" + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= +cloud_config: + identity_services: + MT_KEYSTONE: + identity_url: "http://localhost:${wiremock.server.port}/v2.0" + mso_id: "john" + mso_pass: "313DECE408AF7759D442D7B06DD9A6AA" + admin_tenant: "admin" + member_role: "_member_" + tenant_metadata: false + identity_server_type: "KEYSTONE" + identity_authentication_type: "USERNAME_PASSWORD" + cloud_sites: + regionOne: + region_id: "regionOne" + clli: "MT2" + aic_version: "2.5" + identity_service_id: "MT_KEYSTONE" + DEFAULT: + region_id: "" + clli: "MTN6" + aic_version: "3.0" + identity_service_id: "ORDM3" +adapters: + po: + retryCodes: "504" + retryDelay: "5" + retryCount: "3" + tenant: + tenant_description: "ECOMP Tenant" + region_type: "single" + user_role: "admin" + success_status_string: "Success" + no_regions_status_string: "no regions" + orm_request_path: "/v1/orm/customers/" + x_aic_orm_client_string: "ECOMP-MSO" + keystone_url_version: "/v2.0" + keystone_reg_ex: "/[vV][0-9]" + orm_url_replace_this: "8080" + orm_url_replace_with_this: "7080" + quota_value: "10" + set_default_quota: "false" diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json b/adapters/mso-adapter-utils/src/test/resources/cloud_config.json deleted file mode 100644 index ee3532fe15..0000000000 --- a/adapters/mso-adapter-utils/src/test/resources/cloud_config.json +++ /dev/null @@ -1,87 +0,0 @@ -{ "cloud_config": { - "identity_services": - { - "MT_KEYSTONE": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "john", - "mso_pass": "FD205490A48D48475607C36B9AD902BF", - "admin_tenant": "admin", - "member_role": "_member_", - "tenant_metadata": false, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "RACKSPACE_APIKEY" - }, - "DAN_KEYSTONE": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "mockId", - "mso_pass": "BC59F80E38208A42ABB81ECCDD4FB3E4", - "admin_tenant": "service", - "member_role": "_member_", - "tenant_metadata": false, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "USERNAME_PASSWORD" - }, - "MTINJVCC101_DCP": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "mockIdToo", - "mso_pass": "95604B9EAAC4D77D74786FAE54177206", - "admin_tenant": "service", - "member_role": "admin", - "tenant_metadata": true, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "USERNAME_PASSWORD" - }, - "MTSNJA3DCP1": - { - "identity_url": "https://localhost:5000/v2.0", - "mso_id": "mockIdToo", - "mso_pass": "1491DE07AC9D716A7966BB8C2848F031", - "admin_tenant": "service", - "member_role": "admin", - "tenant_metadata": true, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "USERNAME_PASSWORD" - } - - }, - "cloud_sites": - { - "MT": - { - "region_id": "regionOne", - "clli": "MT", - "aic_version": "2.5", - "identity_service_id": "MT_KEYSTONE" - }, - "DAN": - { - "region_id": "RegionOne", - "clli": "DAN", - "aic_version": "2.5", - "identity_service_id": "DAN_KEYSTONE" - }, - "MTINJVCC101": - { - "region_id": "regionTwo", - "clli": "MTINJVCC101", - "aic_version": "2.5", - "identity_service_id": "MTINJVCC101_DCP" - }, - "MTSNJA4LCP1": - { - "region_id": "mtsnjlcp1", - "clli": "MTSNJA4LCP1", - "aic_version": "2.5", - "identity_service_id": "MTSNJA3DCP1" - } - - } -} -} - - - - diff --git a/adapters/mso-adapter-utils/src/test/resources/cloud_config_bad.json b/adapters/mso-adapter-utils/src/test/resources/cloud_config_bad.json deleted file mode 100644 index 186b6c3aa0..0000000000 --- a/adapters/mso-adapter-utils/src/test/resources/cloud_config_bad.json +++ /dev/null @@ -1,31 +0,0 @@ -{ "cloud_config": { - "identity_services": - { - "MT_KEYSTONE": - { - "identity_url": "http://localhost:5000/v2.0", - "mso_id": "john", - "mso_pass": "FD205490A48D48475607C36B9AD902BF", - "admin_tenant": "admin", - "member_role": "_member_", - "tenant_metadata": false, - "identity_server_type": "KEYSTONE", - "identity_authentication_type": "RACKSPACE_APIKEY" - } - }, - "cloud_sites": - { - "MT": - { - "region_id": "regionOne", - "clli": "MT", - "aic_version": "2.5", - "identity_service_id": "MT_KEYSTONE_NOT_EXISTING" - } - } -} -} - - - - diff --git a/adapters/mso-adapter-utils/src/test/resources/logback-test.xml b/adapters/mso-adapter-utils/src/test/resources/logback-test.xml index d2c17192ea..3873b2c509 100644 --- a/adapters/mso-adapter-utils/src/test/resources/logback-test.xml +++ b/adapters/mso-adapter-utils/src/test/resources/logback-test.xml @@ -37,8 +37,12 @@ - + + + + diff --git a/adapters/mso-adapters-rest-interface/pom.xml b/adapters/mso-adapters-rest-interface/pom.xml index 00c6b7a986..7e341f0952 100644 --- a/adapters/mso-adapters-rest-interface/pom.xml +++ b/adapters/mso-adapters-rest-interface/pom.xml @@ -4,7 +4,7 @@ org.onap.so adapters - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT org.onap.so.adapters mso-adapters-rest-interface @@ -23,9 +23,18 @@ target/classes + + org.jacoco + jacoco-maven-plugin + + + org.javatuples + javatuples + 1.2 + org.onap.so.libs.openstack-java-sdk keystone-client @@ -51,6 +60,5 @@ common ${project.version} - diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRef.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRef.java new file mode 100644 index 0000000000..f207c6185e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRef.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailPolicyRef { + + @JsonProperty("network_policy_refs_data_sequence") + private ContrailPolicyRefSeq seq; + + + public ContrailPolicyRefSeq getSeq() { + return seq; + } + + public void setSeq(ContrailPolicyRefSeq seq) { + this.seq = seq; + } + + public ContrailPolicyRef withRefSeq(ContrailPolicyRefSeq seq) { + this.seq = seq; + return this; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRefSeq.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRefSeq.java new file mode 100644 index 0000000000..a3a5a710ed --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailPolicyRefSeq.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailPolicyRefSeq { + + @JsonProperty("network_policy_refs_data_sequence_major") + private String major; + + @JsonProperty("network_policy_refs_data_sequence_minor") + private String minor; + + public ContrailPolicyRefSeq() { + } + + public ContrailPolicyRefSeq(String major, String minor) { + super(); + this.major = major; + this.minor = minor; + } + + public String getMajor() { + return major; + } + + public void setMajor(String major) { + this.major = major; + } + + public String getMinor() { + return minor; + } + + public void setMinor(String minor) { + this.minor = minor; + } + + @Override + public String toString() { + return "ContrailPolicyRefSeq [major=" + major + ", minor=" + minor + + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java new file mode 100644 index 0000000000..fc674a0416 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnet.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailSubnet { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet") + private ContrailSubnetIp subnet = new ContrailSubnetIp(); + + @JsonProperty("network_ipam_refs_data_ipam_subnets_default_gateway") + private String defaultGateway; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_name") + private String subnetName; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_enable_dhcp") + private Boolean enableDhcp; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_addr_from_start") + private Boolean addrFromStart = true; + /** future - leave this commented + private String subnet_uuid; + private String dns_server_address; + private List dns_nameservers; + private String dhcp_option_list; + **/ + + @JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools") + private List allocationPools = new ArrayList<>(); + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes") + private ContrailSubnetHostRoutes hostRoutes = new ContrailSubnetHostRoutes(); + + public ContrailSubnet() { + super(); + } + + public String getDefaultGateway() { + return defaultGateway; + } + + public void setDefaultGateway(String defaultGateway) { + this.defaultGateway = defaultGateway; + } + + public ContrailSubnetIp getSubnet() { + return subnet; + } + + public void setSubnet(ContrailSubnetIp subnet) { + this.subnet = subnet; + } + + public Boolean isEnableDhcp() { + return enableDhcp; + } + + public void setEnableDhcp(Boolean enableDhcp) { + this.enableDhcp = enableDhcp; + } + + public String getSubnetName() { + return subnetName; + } + + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + + public List getAllocationPools() { + return allocationPools; + } + + public void setAllocationPools(List allocationPools) { + this.allocationPools = allocationPools; + } + + public Boolean isAddrFromStart() { + return addrFromStart; + } + + public void setAddrFromStart(Boolean addrFromStart) { + this.addrFromStart = addrFromStart; + } + + public ContrailSubnetHostRoutes getHostRoutes() { + return hostRoutes; + } + + public void setHostRoutes(ContrailSubnetHostRoutes hostRoutes) { + this.hostRoutes = hostRoutes; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder (); + for (ContrailSubnetPool pool : allocationPools) + { + buf.append(pool.toString()); + } + return "ContrailSubnet [subnet=" + subnet.toString() + " default_gateway=" + defaultGateway + + " enable_dhcp=" + enableDhcp + " addr_from_start=" + addrFromStart + " subnet_name=" + subnetName + " allocation_pools=" + buf + " ]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java new file mode 100644 index 0000000000..7d53715e3c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoute.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import com.fasterxml.jackson.annotation.JsonProperty; +public class ContrailSubnetHostRoute { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route_prefix") + private String prefix; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route_next_hop") + private String nextHop; + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public String getNextHop() { + return nextHop; + } + + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + + @Override + public String toString() { + return "ContrailSubnetHostRoute [prefix=" + prefix + ", nextHop=" + nextHop + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java new file mode 100644 index 0000000000..cd7192b6e2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetHostRoutes.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import java.util.ArrayList; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonProperty; +public class ContrailSubnetHostRoutes { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_host_routes_route") + private List hostRoutes = new ArrayList<>(); + + public List getHostRoutes() { + return hostRoutes; + } + + public void setHostRoutes(List hostRoutes) { + this.hostRoutes = hostRoutes; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder (); + if (hostRoutes != null) + { + for (ContrailSubnetHostRoute hr : hostRoutes) + { + buf.append(hr.toString()); + } + } + return "ContrailSubnetHostRoutes [" + buf.toString() + "]"; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetIp.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetIp.java new file mode 100644 index 0000000000..3986592dde --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetIp.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailSubnetIp { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_ip_prefix") + private String ipPrefix; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_subnet_ip_prefix_len") + private String ipPrefixLen; + + public String getIpPrefix() { + return ipPrefix; + } + + public void setIpPrefix(String ipPrefix) { + this.ipPrefix = ipPrefix; + } + + public String getIpPrefixLen() { + return ipPrefixLen; + } + + public void setIpPrefixLen(String ipPrefixLen) { + this.ipPrefixLen = ipPrefixLen; + } + + @Override + public String toString() { + return "ContrailSubnetIp [ip_prefix=" + ipPrefix + ", ip_prefix_len=" + ipPrefixLen + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetPool.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetPool.java new file mode 100644 index 0000000000..11a06c69d5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/beans/ContrailSubnetPool.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.beans; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ContrailSubnetPool { + + @JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools_start") + private String start; + + @JsonProperty("network_ipam_refs_data_ipam_subnets_allocation_pools_end") + private String end; + + public String getStart() { + return start; + } + + public void setStart(String start) { + this.start = start; + } + + public String getEnd() { + return end; + } + + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "ContrailSubnetPool [start=" + start + ", end=" + end + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetHostRouteMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetHostRouteMapper.java new file mode 100644 index 0000000000..03800de5b8 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetHostRouteMapper.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.mappers; + +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoute; +import org.onap.so.openstack.beans.HostRoute; + +public class ContrailSubnetHostRouteMapper { + + private final HostRoute hostRoute; + public ContrailSubnetHostRouteMapper(HostRoute hostRoute) { + this.hostRoute = hostRoute; + } + + public ContrailSubnetHostRoute map() { + + final ContrailSubnetHostRoute contrailSubnetHostRoute = new ContrailSubnetHostRoute(); + + if (hostRoute != null) { + contrailSubnetHostRoute.setNextHop(hostRoute.getNextHop()); + contrailSubnetHostRoute.setPrefix(hostRoute.getPrefix()); + } + return contrailSubnetHostRoute; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java new file mode 100644 index 0000000000..d3ccb35a60 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetMapper.java @@ -0,0 +1,135 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.mappers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.onap.so.adapters.network.beans.ContrailSubnet; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoute; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoutes; +import org.onap.so.adapters.network.beans.ContrailSubnetIp; +import org.onap.so.adapters.network.beans.ContrailSubnetPool; +import org.onap.so.openstack.beans.HostRoute; +import org.onap.so.openstack.beans.Pool; +import org.onap.so.openstack.beans.Subnet; + +public class ContrailSubnetMapper { + + private final Subnet inputSubnet; + public ContrailSubnetMapper(Subnet inputSubnet) { + this.inputSubnet = inputSubnet; + } + + public ContrailSubnet map() { + + final ContrailSubnet result = new ContrailSubnet(); + if (inputSubnet != null) { + final String subnetname = this.getSubnetName(inputSubnet); + result.setSubnetName(subnetname); + result.setEnableDhcp(inputSubnet.getEnableDHCP()); + result.setDefaultGateway(inputSubnet.getGatewayIp()); + + Optional csIp = createSubnet(inputSubnet); + if (csIp.isPresent()) { + result.setSubnet(csIp.get()); + } + Optional> pools = this.createContrailSubnetPool(inputSubnet); + if (pools.isPresent()) { + result.setAllocationPools(pools.get()); + } + Optional routes = this.createContrailSubnetHostRoutes(inputSubnet); + if (routes.isPresent()) { + result.setHostRoutes(routes.get()); + } + } + + return result; + } + + protected String getSubnetName(Subnet subnet) { + final String result; + if (!isNullOrEmpty(subnet.getSubnetName())) { + result = subnet.getSubnetName(); + } else { + result = subnet.getSubnetId(); + } + + return result; + } + + protected Optional> createContrailSubnetPool(final Subnet subnet) { + Optional> result = Optional.empty(); + if (subnet.getAllocationPools() != null) { + List pools = new ArrayList<>(); + for (Pool pool : subnet.getAllocationPools()) { + if ( !isNullOrEmpty(pool.getStart()) && !isNullOrEmpty(pool.getEnd()) ) { + + pools.add(new ContrailSubnetPoolMapper(pool).map()); + } + } + if (!pools.isEmpty()) { + result = Optional.of(pools); + } + } + + return result; + } + + protected Optional createContrailSubnetHostRoutes(final Subnet subnet) { + Optional result = Optional.empty(); + if (subnet.getHostRoutes() != null) { + ContrailSubnetHostRoutes hostRoutesObj = new ContrailSubnetHostRoutes(); + List hrList = new ArrayList<>(); + for (HostRoute hr : subnet.getHostRoutes()) { + if ( !isNullOrEmpty(hr.getPrefix()) || !isNullOrEmpty(hr.getNextHop()) ) { + hrList.add(new ContrailSubnetHostRouteMapper(hr).map()); + } + } + if (!hrList.isEmpty()) { + hostRoutesObj.setHostRoutes(hrList); + result = Optional.of(hostRoutesObj); + } + } + + return result; + + } + protected Optional createSubnet(final Subnet subnet) { + Optional result = Optional.empty(); + if (!isNullOrEmpty(subnet.getCidr()) ) { + int idx = subnet.getCidr().indexOf("/"); + final ContrailSubnetIp csIp = new ContrailSubnetIp(); + if (idx != -1) { + csIp.setIpPrefix(subnet.getCidr().substring(0, idx)); + csIp.setIpPrefixLen(subnet.getCidr().substring(idx+1)); + result = Optional.of(csIp); + } + } + + return result; + } + + protected boolean isNullOrEmpty (String s) { + return s == null || s.isEmpty(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetPoolMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetPoolMapper.java new file mode 100644 index 0000000000..a492cd30c0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/network/mappers/ContrailSubnetPoolMapper.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.network.mappers; + +import org.onap.so.adapters.network.beans.ContrailSubnetPool; +import org.onap.so.openstack.beans.Pool; + +public class ContrailSubnetPoolMapper { + + private final Pool pool; + + public ContrailSubnetPoolMapper(Pool pool) { + this.pool = pool; + } + + public ContrailSubnetPool map() { + + ContrailSubnetPool result = new ContrailSubnetPool(); + if (pool != null) { + result.setStart(pool.getStart()); + result.setEnd(pool.getEnd()); + } + return result; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ContrailNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ContrailNetwork.java new file mode 100644 index 0000000000..9a7431130d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ContrailNetwork.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + +import java.io.Serializable; +import java.util.List; + +import org.onap.so.openstack.beans.RouteTarget; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("contrailNetwork") +public class ContrailNetwork implements Serializable{ + + + /** + * + */ + private static final long serialVersionUID = 6879356795950005963L; + private String shared = "false"; + private String external = "false"; + private List routeTargets; + private List policyFqdns; + private List routeTableFqdns; + + public ContrailNetwork() { + super(); + } + + public ContrailNetwork(String shared, String external, List routeTargets, List policyFqdns, List routeTableFqdns) { + super(); + this.shared = shared; + this.external = external; + this.routeTargets = routeTargets; + this.policyFqdns = policyFqdns; + this.routeTableFqdns = routeTableFqdns; + } + + public String getShared() { + return shared; + } + + public void setShared(String shared) { + this.shared = shared; + } + + public String getExternal() { + return external; + } + + public void setExternal(String external) { + this.external = external; + } + + public List getRouteTargets() { + return routeTargets; + } + + public void setRouteTargets(List routeTargets) { + this.routeTargets = routeTargets; + } + + public List getPolicyFqdns() { + return policyFqdns; + } + + public void setPolicyFqdns(List policyFqdns) { + this.policyFqdns = policyFqdns; + } + + public List getRouteTableFqdns() { + return routeTableFqdns; + } + + public void setRouteTableFqdns(List routeTableFqdns) { + this.routeTableFqdns = routeTableFqdns; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkError.java new file mode 100644 index 0000000000..fec9b474dd --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkError.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "createNetworkError") +public class CreateNetworkError extends NetworkExceptionResponse implements Serializable { + private static final long serialVersionUID = -4283402447149144456L; + + public CreateNetworkError() { + super(""); + } + + public CreateNetworkError(String message) { + super(message); + } + + public CreateNetworkError(String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { + super(message, category, rolledBack, messageid); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java new file mode 100644 index 0000000000..3e4d18cb1b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkRequest.java @@ -0,0 +1,206 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.Subnet; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + + +/* README + Map elements when marshalled to XML produce a list of ${MsoUtils.xmlEscape(key)}${MsoUtils.xmlEscape(value)} elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. +*/ +@JsonRootName("createNetworkRequest") +@XmlRootElement(name = "createNetworkRequest") +public class CreateNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -8984362978831333521L; + private String cloudSiteId; + private String tenantId; + private String networkId; + private String networkName; + private String networkType; + private String networkTypeVersion; + private String modelCustomizationUuid; + private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON; + private List subnets; + private ProviderVlanNetwork providerVlanNetwork; + private ContrailNetwork contrailNetwork; + private Boolean failIfExists = false; + private Boolean backout = true; + private Map networkParams = new HashMap<>(); + private MsoRequest msoRequest = new MsoRequest(); + @JsonProperty + private boolean contrailRequest; + + public CreateNetworkRequest() { + super(); + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + 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 getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getNetworkTypeVersion() { + return networkTypeVersion; + } + + public void setNetworkTypeVersion(String networkTypeVersion) { + this.networkTypeVersion = networkTypeVersion; + } + + public NetworkTechnology getNetworkTechnology() { + return networkTechnology; + } + + public void setNetworkTechnology(NetworkTechnology networkTechnology) { + this.networkTechnology = networkTechnology; + this.contrailRequest = determineContrail(); + } + + public List getSubnets() { + return subnets; + } + + public void setSubnets(List subnets) { + this.subnets = subnets; + } + + public ProviderVlanNetwork getProviderVlanNetwork() { + return providerVlanNetwork; + } + + public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) { + this.providerVlanNetwork = providerVlanNetwork; + } + + public ContrailNetwork getContrailNetwork() { + return contrailNetwork; + } + + public void setContrailNetwork(ContrailNetwork contrailNetwork) { + this.contrailNetwork = contrailNetwork; + this.contrailRequest = determineContrail(); + } + + public Boolean getFailIfExists() { + return failIfExists; + } + + public void setFailIfExists(Boolean failIfExists) { + this.failIfExists = failIfExists; + } + + public Boolean getBackout() { + return backout; + } + + public void setBackout(Boolean backout) { + this.backout = backout; + } + + public Map getNetworkParams() { + return networkParams; + } + + public void setNetworkParams(Map networkParams) { + this.networkParams = networkParams; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + public boolean isContrailRequest() { + return this.contrailRequest; + } + + @JsonIgnore + protected void setContrailRequest(boolean contrailRequest) { + this.contrailRequest = contrailRequest; + } + + private boolean determineContrail() { + return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null)); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkResponse.java new file mode 100644 index 0000000000..763732213d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/CreateNetworkResponse.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("createNetworkResponse") +@XmlRootElement(name = "createNetworkResponse") + +public class CreateNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = -7730406297031948309L; + + private String networkId; + private String neutronNetworkId; + private String networkStackId; + private String networkFqdn; + private Boolean networkCreated; + private Map subnetMap; + private NetworkRollback rollback = new NetworkRollback(); + + public CreateNetworkResponse() { + super(); + } + + public CreateNetworkResponse(String networkId, + String neutronNetworkId, + String networkStackId, + String networkFqdn, + Boolean networkCreated, + Map subnetIdMap, + NetworkRollback rollback, + String messageId) { + super(messageId); + this.networkId = networkId; + this.neutronNetworkId = neutronNetworkId; + this.networkStackId = networkStackId; + this.networkFqdn = networkFqdn; + this.networkCreated = networkCreated; + this.subnetMap = subnetIdMap; + this.rollback = rollback; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNetworkStackId() { + return networkStackId; + } + + public void setNetworkStackId(String networkStackId) { + this.networkStackId = networkStackId; + } + + public String getNetworkFqdn() { + return networkFqdn; + } + + public void setNetworkFqdn(String networkFqdn) { + this.networkFqdn = networkFqdn; + } + + public Boolean getNetworkCreated() { + return networkCreated; + } + + public void setNetworkCreated(Boolean networkCreated) { + this.networkCreated = networkCreated; + } + + public Map getSubnetMap() { + return subnetMap; + } + + public void setSubnetMap(Map subnetMap) { + this.subnetMap = subnetMap; + } + + public NetworkRollback getRollback() { + return rollback; + } + + public void setRollback(NetworkRollback rollback) { + this.rollback = rollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkError.java new file mode 100644 index 0000000000..f874be56a3 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkError.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "deleteNetworkError") +public class DeleteNetworkError extends NetworkExceptionResponse implements Serializable { + private static final long serialVersionUID = 2735474165790444180L; + + public DeleteNetworkError() { + super(""); + } + + public DeleteNetworkError(String message) { + super(message); + } + + public DeleteNetworkError(String message, MsoExceptionCategory category, boolean unused, String messageid) { + super(message, category, unused, messageid); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java new file mode 100644 index 0000000000..f069bf2ed2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkRequest.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("deleteNetworkRequest") +@XmlRootElement(name = "deleteNetworkRequest") +public class DeleteNetworkRequest extends NetworkRequestCommon { + + /** + * + */ + private static final long serialVersionUID = -2445072708572065058L; + private String cloudSiteId; + private String tenantId; + private String networkId; + private String networkStackId; + private String networkType; + private String modelCustomizationUuid; + private MsoRequest msoRequest = new MsoRequest(); + + public DeleteNetworkRequest() {} + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkStackId() { + return networkStackId; + } + + public void setNetworkStackId(String networkStackId) { + this.networkStackId = networkStackId; + } + + public String getNetworkType() { + return networkType; + } + + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkResponse.java new file mode 100644 index 0000000000..1de7f8be76 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/DeleteNetworkResponse.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("deleteNetworkResponse") +@XmlRootElement(name = "deleteNetworkResponse") +public class DeleteNetworkResponse extends NetworkResponseCommon { + + /** + * + */ + private static final long serialVersionUID = 68336086339501537L; + private String networkId; + private Boolean networkDeleted; + + public DeleteNetworkResponse() { + super(); + } + + public DeleteNetworkResponse(String networkId, Boolean networkDeleted, String messageId) { + super(messageId); + this.networkId = networkId; + this.networkDeleted = networkDeleted; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public Boolean getNetworkDeleted() { + return networkDeleted; + } + + public void setNetworkDeleted(Boolean networkDeleted) { + this.networkDeleted = networkDeleted; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkExceptionResponse.java new file mode 100644 index 0000000000..4b9f283e20 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkExceptionResponse.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +public class NetworkExceptionResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = -7160401922983004097L; + private String message; + private MsoExceptionCategory category; + private Boolean rolledBack; + + public NetworkExceptionResponse () {} + + public NetworkExceptionResponse (String message) { + super(); + this.message = message; + } + + public NetworkExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { + super(messageid); + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public Boolean getRolledBack() { + return rolledBack; + } + + public void setRolledBack(Boolean rolledBack) { + this.rolledBack = rolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkRequestCommon.java new file mode 100644 index 0000000000..3d66da3a2d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkRequestCommon.java @@ -0,0 +1,109 @@ +/*- + * ============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.adapters.nwrest; + + + +import java.io.ByteArrayOutputStream; +import java.io.Serializable; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * Everything that is common between all Network Requests. + */ +public abstract class NetworkRequestCommon implements Serializable { + private static final long serialVersionUID = -6732431343649282079L; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NetworkRequestCommon.class); + private Boolean skipAAI = false; + private String messageId; + private String notificationUrl; + @JsonProperty + private boolean synchronous = true; + public Boolean getSkipAAI() { + return skipAAI; + } + + public void setSkipAAI(Boolean skipAAI) { + this.skipAAI = skipAAI; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String getNotificationUrl() { + return notificationUrl; + } + + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + this.synchronous = notificationUrl == null || (notificationUrl.isEmpty()); + } + + public boolean isSynchronous() { + return this.synchronous; + } + + @JsonIgnore + protected void setSynchronous(boolean synchronous) { + this.synchronous = synchronous; + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + return jsonString; + } + + public String toXmlString() { + try { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + JAXBContext context = JAXBContext.newInstance(this.getClass()); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML + marshaller.marshal(this, bs); + return bs.toString(); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + return ""; + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkResponseCommon.java new file mode 100644 index 0000000000..d626f26aa6 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkResponseCommon.java @@ -0,0 +1,86 @@ +/*- + * ============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.adapters.nwrest; + + + +import java.io.ByteArrayOutputStream; +import java.io.Serializable; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +/** + * Everything that is common between all Volume Group Responses, except for QueryVolumeGroupResponse. + */ +public abstract class NetworkResponseCommon implements Serializable { + + private static final long serialVersionUID = 1233520856935129726L; + private String messageId; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, NetworkResponseCommon.class); + + public NetworkResponseCommon() { + messageId = null; + } + + public NetworkResponseCommon(String messageId) { + this.messageId = messageId; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + } + return jsonString; + } + + public String toXmlString() { + try { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + JAXBContext context = JAXBContext.newInstance(this.getClass()); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML + marshaller.marshal(this, bs); + return bs.toString(); + } catch (Exception e) { + LOGGER.debug("Exception:", e); + return ""; + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkTechnology.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkTechnology.java new file mode 100644 index 0000000000..cade9b44c8 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/NetworkTechnology.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + +public enum NetworkTechnology { + NEUTRON, VMWARE, CONTRAIL +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ProviderVlanNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ProviderVlanNetwork.java new file mode 100644 index 0000000000..fbd21b8197 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/ProviderVlanNetwork.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import java.io.Serializable; +import java.util.List; + +public class ProviderVlanNetwork implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 6744949861614446315L; + private String physicalNetworkName; + private List vlans; + + public ProviderVlanNetwork() { + super(); + } + + public ProviderVlanNetwork(String physicalNetworkName, List vlans) { + super(); + this.physicalNetworkName = physicalNetworkName; + this.vlans = vlans; + } + + public String getPhysicalNetworkName() { + return physicalNetworkName; + } + + public void setPhysicalNetworkName(String physicalNetworkName) { + this.physicalNetworkName = physicalNetworkName; + } + + public List getVlans() { + return vlans; + } + + public void setVlans(List vlans) { + this.vlans = vlans; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkError.java new file mode 100644 index 0000000000..6e8ace9cf0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkError.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.adapters.nwrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "queryNetworkError") +public class QueryNetworkError extends NetworkExceptionResponse implements Serializable { + private static final long serialVersionUID = -6125469596399867146L; +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java new file mode 100644 index 0000000000..6953dfe7e5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/QueryNetworkResponse.java @@ -0,0 +1,135 @@ +/*- + * ============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.adapters.nwrest; + +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.NetworkStatus; +import org.onap.so.openstack.beans.RouteTarget; + +@XmlRootElement(name = "queryNetworkResponse") +public class QueryNetworkResponse extends NetworkResponseCommon { + /** + * + */ + private static final long serialVersionUID = -5251191073081795026L; + private String networkId; + private String neutronNetworkId; + private String networkStackId; + private Boolean networkExists; + private NetworkStatus networkStatus; + private List vlans; + private List routeTargets; + private Map subnetIdMap; + private Map networkOutputs; + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryNetworkResponse.class); + + public QueryNetworkResponse() { + super(); + } + + public QueryNetworkResponse(String networkId, String neutronNetworkId, String networkStackId, + NetworkStatus networkStatus, Map networkOutputs) { + super(); + this.networkId = networkId; + this.neutronNetworkId = neutronNetworkId; + this.networkStackId = networkStackId; + this.networkStatus = networkStatus; + this.networkOutputs = networkOutputs; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNetworkStackId() { + return networkStackId; + } + + public void setNetworkStackId(String networkStackId) { + this.networkStackId = networkStackId; + } + + public NetworkStatus getNetworkStatus() { + return networkStatus; + } + + public void setNetworkStatus(NetworkStatus networkStatus) { + this.networkStatus = networkStatus; + } + + public Boolean getNetworkExists() { + return networkExists; + } + + public void setNetworkExists(Boolean networkExists) { + this.networkExists = networkExists; + } + + public List getVlans() { + return vlans; + } + + public void setVlans(List vlans) { + this.vlans = vlans; + } + + public List getRouteTargets() { + return routeTargets; + } + + public void setRouteTargets(List routeTargets) { + this.routeTargets = routeTargets; + } + + public Map getSubnetIdMap() { + return subnetIdMap; + } + + public void setSubnetIdMap(Map subnetIdMap) { + this.subnetIdMap = subnetIdMap; + } + + public Map getNetworkOutputs() { + return networkOutputs; + } + + public void setNetworkOutputs(Map networkOutputs) { + this.networkOutputs = networkOutputs; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkError.java new file mode 100644 index 0000000000..cb148dfcef --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkError.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "rollbackNetworkError") +public class RollbackNetworkError extends NetworkExceptionResponse implements Serializable { + private static final long serialVersionUID = -3954464103037391980L; + + public RollbackNetworkError() { + super(""); + } + + public RollbackNetworkError(String message) { + super(message); + } + + public RollbackNetworkError(String message, MsoExceptionCategory category, boolean unused, String messageid) { + super(message, category, unused, messageid); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkRequest.java new file mode 100644 index 0000000000..494d3123d1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkRequest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("rollbackNetworkRequest") +@XmlRootElement(name = "rollbackNetworkRequest") +public class RollbackNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -8705660877263749940L; + private NetworkRollback networkRollback; + + public RollbackNetworkRequest() { + super(); + } + + public NetworkRollback getNetworkRollback() { + return networkRollback; + } + + public void setNetworkRollback(NetworkRollback networkRollback) { + this.networkRollback = networkRollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkResponse.java new file mode 100644 index 0000000000..9be8bb3a69 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/RollbackNetworkResponse.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("rollbackNetworkResponse") +@XmlRootElement(name = "rollbackNetworkResponse") +public class RollbackNetworkResponse extends NetworkResponseCommon { + + /** + * + */ + private static final long serialVersionUID = 3115905123337163846L; + private Boolean networkRolledBack; + + public RollbackNetworkResponse() { + super(); + } + + public RollbackNetworkResponse(Boolean networkRolledBack, String messageId) { + super(messageId); + this.networkRolledBack = networkRolledBack; + } + + public Boolean getNetworkRolledBack() { + return networkRolledBack; + } + + public void setNetworkRolledBack(Boolean networkRolledBack) { + this.networkRolledBack = networkRolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkError.java new file mode 100644 index 0000000000..642ac4cc64 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkError.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "updateNetworkError") +public class UpdateNetworkError extends NetworkExceptionResponse implements Serializable { + private static final long serialVersionUID = 46820809807914392L; + + public UpdateNetworkError() { + super(""); + } + + public UpdateNetworkError(String message) { + super(message); + } + + public UpdateNetworkError(String message, MsoExceptionCategory category, boolean unused, String messageid) { + super(message, category, unused, messageid); + } +} 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 new file mode 100644 index 0000000000..c1c8258a6a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkRequest.java @@ -0,0 +1,201 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import java.util.HashMap; +import java.util.List; +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; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("updateNetworkRequest") +@XmlRootElement(name = "updateNetworkRequest") +public class UpdateNetworkRequest extends NetworkRequestCommon { + /** + * + */ + private static final long serialVersionUID = -1219693235726357143L; + private String cloudSiteId; + private String tenantId; + private String networkId; + private String networkStackId; + private String networkName; + private String networkType; + private String networkTypeVersion; + private String modelCustomizationUuid; + private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON; + private List subnets; + private ProviderVlanNetwork providerVlanNetwork; + private ContrailNetwork contrailNetwork; + private Boolean backout = true; + private Map networkParams = new HashMap<>(); + private MsoRequest msoRequest = new MsoRequest(); + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, UpdateNetworkRequest.class); + @JsonProperty + private boolean contrailRequest; + public UpdateNetworkRequest() { + super(); + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNetworkStackId() { + return networkStackId; + } + + public void setNetworkStackId(String networkStackId) { + this.networkStackId = networkStackId; + } + + 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 getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getNetworkTypeVersion() { + return networkTypeVersion; + } + + public void setNetworkTypeVersion(String networkTypeVersion) { + this.networkTypeVersion = networkTypeVersion; + } + + public NetworkTechnology getNetworkTechnology() { + return networkTechnology; + } + + public void setNetworkTechnology(NetworkTechnology networkTechnology) { + this.networkTechnology = networkTechnology; + this.contrailRequest = determineContrail(); + } + + public List getSubnets() { + return subnets; + } + + public void setSubnets(List subnets) { + this.subnets = subnets; + } + + public ProviderVlanNetwork getProviderVlanNetwork() { + return providerVlanNetwork; + } + + public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) { + this.providerVlanNetwork = providerVlanNetwork; + } + + public ContrailNetwork getContrailNetwork() { + return contrailNetwork; + } + + public void setContrailNetwork(ContrailNetwork contrailNetwork) { + this.contrailNetwork = contrailNetwork; + this.contrailRequest = determineContrail(); + } + + public Boolean getBackout() { + return backout; + } + + public void setBackout(Boolean backout) { + this.backout = backout; + } + + public Map getNetworkParams() { + return networkParams; + } + + public void setNetworkParams(Map networkParams) { + this.networkParams = networkParams; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + @JsonIgnore + protected void setContrailRequest(boolean contrailRequest) { + this.contrailRequest = contrailRequest; + } + public boolean isContrailRequest() { + return contrailRequest; + } + + private boolean determineContrail() { + return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null)); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkResponse.java new file mode 100644 index 0000000000..7ce66ba58e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/nwrest/UpdateNetworkResponse.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + + + +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("updateNetworkResponse") +@XmlRootElement(name = "updateNetworkResponse") +public class UpdateNetworkResponse extends NetworkResponseCommon { + + /** + * + */ + private static final long serialVersionUID = -7528214382414366136L; + private String networkId; + private String neutronNetworkId; + private Map subnetMap; + + public UpdateNetworkResponse() { + /* Empty Constructor */ + } + + public UpdateNetworkResponse(String networkId, String neutronNetworkId, + Map subnetMap, String messageId) { + super(messageId); + this.networkId = networkId; + this.neutronNetworkId = neutronNetworkId; + this.subnetMap = subnetMap; + } + + public String getNetworkId() { + return networkId; + } + + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public Map getSubnetMap() { + return subnetMap; + } + + public void setSubnetMap(Map subnetMap) { + this.subnetMap = subnetMap; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/RequestInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/RequestInformation.java new file mode 100644 index 0000000000..ae7ff27bed --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/RequestInformation.java @@ -0,0 +1,143 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request Information specified by the SDNC "agnostic" API. + */ +public class RequestInformation implements Serializable { + private static final long serialVersionUID = 1L; + + // Identifies the transaction MSO has with the calling system. + private String requestId; + + // Identifies the calling system, e.g. CCD. + private String source; + + // The calling system's endpoint for receiving notifications from MSO. + private String notificationUrl; + + // NOTE: these are defined in the SDNC AID, but not used by MSO: + // request-action + // request-sub-action + + // Identifies the request action + private String requestAction; + + // Identifies the request sub action + private String requestSubAction; + + @JsonProperty("orderNumber") + @XmlElement(name = "orderNumber") + private String orderNumber; + + @JsonProperty("orderVersion") + @XmlElement(name = "orderVersion") + private String orderVersion; + + public RequestInformation(String requestId, String source, String notificationUrl) { + this.requestId = requestId; + this.source = source; + this.notificationUrl = notificationUrl; + } + + public RequestInformation() { + } + + @JsonProperty("requestId") + @XmlElement(name = "requestId") + public String getRequestId() { + return requestId; + } + + @JsonProperty("requestId") + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @JsonProperty("source") + @XmlElement(name = "source") + public String getSource() { + return source; + } + + @JsonProperty("source") + public void setSource(String source) { + this.source = source; + } + + @JsonProperty("notificationUrl") + @XmlElement(name = "notificationUrl") + public String getNotificationUrl() { + return notificationUrl; + } + + @JsonProperty("notificationUrl") + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } + + @JsonProperty("requestAction") + @XmlElement(name = "requestAction") + public String getRequestAction() { + return requestAction; + } + + @JsonProperty("requestAction") + public void setRequestAction(String requestAction) { + this.requestAction = requestAction; + } + + @JsonProperty("requestSubAction") + @XmlElement(name = "requestSubAction") + public String getRequestSubAction() { + return requestSubAction; + } + + @JsonProperty("requestSubAction") + public void setRequestSubAction(String requestSubAction) { + this.requestSubAction = requestSubAction; + } + + public String getOrderNumber() { + return orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public String getOrderVersion() { + return orderVersion; + } + + public void setOrderVersion(String orderVersion) { + this.orderVersion = orderVersion; + } + + +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCErrorCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCErrorCommon.java new file mode 100644 index 0000000000..b6cd6a1eed --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCErrorCommon.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.Serializable; + +/** + * Base class for all SDNC adapter error responses. + */ +public abstract class SDNCErrorCommon extends SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + public SDNCErrorCommon(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCErrorCommon() { + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCEvent.java new file mode 100644 index 0000000000..7d6aebdf16 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCEvent.java @@ -0,0 +1,142 @@ +/*- + * ============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.adapters.sdncrest; + +import java.io.IOException; +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + Map elements when marshalled to XML produce a list of ${MsoUtils.xmlEscape(key)}${MsoUtils.xmlEscape(value)} elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. + * + */ +@JsonRootName("SDNCEvent") +@JsonInclude(Include.NON_NULL) +@XmlRootElement(name = "SDNCEvent") +public class SDNCEvent implements Serializable { + private static final long serialVersionUID = 1L; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCEvent.class); + + // Event type + private String eventType; + + // Event correlator type + private String eventCorrelatorType; + + // Event correlator value. + private String eventCorrelator; + + // Map of response parameters (possibly none). + private Map params = null; + + public SDNCEvent(String eventType, String eventCorrelatorType, String eventCorrelator) { + this.eventType = eventType; + this.eventCorrelatorType = eventCorrelatorType; + this.eventCorrelator = eventCorrelator; + } + + public SDNCEvent() { + } + + @JsonProperty("eventType") + @XmlElement(name = "eventType") + public String getEventType() { + return eventType; + } + + @JsonProperty("eventType") + public void setEventType(String eventType) { + this.eventType = eventType; + } + + @JsonProperty("eventCorrelatorType") + @XmlElement(name = "eventCorrelatorType") + public String getEventCorrelatorType() { + return eventCorrelatorType; + } + + @JsonProperty("eventCorrelatorType") + public void setEventCorrelatorType(String eventCorrelatorType) { + this.eventCorrelatorType = eventCorrelatorType; + } + + @JsonProperty("eventCorrelator") + @XmlElement(name = "eventCorrelator") + public String getEventCorrelator() { + return eventCorrelator; + } + + @JsonProperty("eventCorrelator") + public void setEventCorrelator(String eventCorrelator) { + this.eventCorrelator = eventCorrelator; + } + + @JsonProperty("params") + @XmlElement(name = "params") + public Map getParams() { + return params; + } + + @JsonProperty("params") + public void setParams(Map params) { + this.params = params; + } + + public void addParam(String name, String value) { + if (params == null) { + params = new LinkedHashMap<>(); + } + params.put(name, value); + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Include.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + LOGGER.debug("Exception:", e); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCRequestCommon.java new file mode 100644 index 0000000000..9ddf55cc21 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCRequestCommon.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.IOException; +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * Base class for all SDNC adapter requests. + */ +public abstract class SDNCRequestCommon implements Serializable { + private static final long serialVersionUID = 1L; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCRequestCommon.class); + + // Endpoint on which BPMN can receive notifications from the SDNC adapter. + private String bpNotificationUrl; + + // BPMN flow timeout value in ISO 8601 format, e.g. PT5M. + // Not currently used by the SDNC adapter. + private String bpTimeout; + + // Identifies the MSO transaction with SDNC. + // Maps to sdnc-request-header/requestId in the SDNC request. + private String sdncRequestId; + + public SDNCRequestCommon(String sdncRequestId, String bpNotificationUrl, + String bpTimeout) { + this.sdncRequestId = sdncRequestId; + this.bpNotificationUrl = bpNotificationUrl; + this.bpTimeout = bpTimeout; + } + + public SDNCRequestCommon() { + } + + @JsonProperty("bpNotificationUrl") + @XmlElement(name = "bpNotificationUrl") + public String getBPNotificationUrl() { + return bpNotificationUrl; + } + + @JsonProperty("bpNotificationUrl") + public void setBPNotificationUrl(String bpNotificationUrl) { + this.bpNotificationUrl = bpNotificationUrl; + } + + @JsonProperty("bpTimeout") + @XmlElement(name = "bpTimeout") + public String getBPTimeout() { + return bpTimeout; + } + + @JsonProperty("bpTimeout") + public void setBPTimeout(String bpTimeout) { + this.bpTimeout = bpTimeout; + } + + @JsonProperty("sdncRequestId") + @XmlElement(name = "sdncRequestId") + public String getSdncRequestId() { + return sdncRequestId; + } + + @JsonProperty("sdncRequestId") + public void setSdncRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + + @JsonIgnore + public boolean isSynchronous() { + return bpNotificationUrl == null || bpNotificationUrl.isEmpty(); + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Include.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + LOGGER.debug("Exception:", e); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCResponseCommon.java new file mode 100644 index 0000000000..2da94017ca --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCResponseCommon.java @@ -0,0 +1,124 @@ +/*- + * ============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.adapters.sdncrest; + +import java.io.IOException; +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * Base class for all SDNC adapter responses, including errors. + */ +public abstract class SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCResponseCommon.class); + + // Identifies the MSO transaction with SDNC. + private String sdncRequestId; + + // Response code, either from SDNC, or generated by the SDNC adapter. + // 2XX responses are considered success responses. + private String responseCode; + + // Response message, either from SDNC, or generated by the SDNC adapter. + private String responseMessage; + + // Indicates if the response is final (Y or N). + private String ackFinalIndicator; + + public SDNCResponseCommon(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + this.sdncRequestId = sdncRequestId; + this.responseCode = responseCode; + this.responseMessage = responseMessage; + this.ackFinalIndicator = ackFinalIndicator; + } + + public SDNCResponseCommon() { + } + + @JsonProperty("sdncRequestId") + @XmlElement(name = "sdncRequestId") + public String getSdncRequestId() { + return sdncRequestId; + } + + @JsonProperty("sdncRequestId") + public void setSdncRequestId(String sdncRequestId) { + this.sdncRequestId = sdncRequestId; + } + + @JsonProperty("responseCode") + @XmlElement(name = "responseCode") + public String getResponseCode() { + return responseCode; + } + + @JsonProperty("responseCode") + public void setResponseCode(String responseCode) { + this.responseCode = responseCode; + } + + @JsonProperty("responseMessage") + @XmlElement(name = "responseMessage") + public String getResponseMessage() { + return responseMessage; + } + + @JsonProperty("responseMessage") + public void setResponseMessage(String responseMessage) { + this.responseMessage = responseMessage; + } + + @JsonProperty("ackFinalIndicator") + @XmlElement(name = "ackFinalIndicator") + public String getAckFinalIndicator() { + return ackFinalIndicator; + } + + @JsonProperty("ackFinalIndicator") + public void setAckFinalIndicator(String ackFinalIndicator) { + this.ackFinalIndicator = ackFinalIndicator; + } + + public String toJson() { + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.setSerializationInclusion(Include.NON_NULL); + return mapper.writeValueAsString(this); + } catch (IOException e) { + LOGGER.debug("Exception:", e); + throw new UnsupportedOperationException("Cannot convert " + + getClass().getSimpleName() + " to JSON", e); + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceError.java new file mode 100644 index 0000000000..fdb735891c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceError.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonRootName; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter error response for "agnostic" API services. + */ +@JsonRootName("SDNCServiceError") +@JsonInclude(Include.NON_NULL) +@XmlRootElement(name = "SDNCServiceError") +public class SDNCServiceError extends SDNCErrorCommon implements Serializable { + private static final long serialVersionUID = 1; + + public SDNCServiceError(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCServiceError() { + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java new file mode 100644 index 0000000000..b271af2f9b --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceRequest.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.Serializable; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + * SDNC adapter request for "agnostic" API services. + * The target action is determined by a service type and an operation. + */ +@JsonRootName("SDNCServiceRequest") +@JsonInclude(Include.NON_NULL) +@XmlRootElement(name = "SDNCServiceRequest") +public class SDNCServiceRequest extends SDNCRequestCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Request Information specified by SDNC "agnostic" API + private RequestInformation requestInformation; + + // Service Information specified by: SDNC "agnostic" API + private ServiceInformation serviceInformation; + + // The SDNC service type specified by SDNC "agnostic" API + private String sdncService; + + // The SDNC operation specified by SDNC "agnostic" API + private String sdncOperation; + + // The SDNC service data type specified by SDNC "agnostic" API + private String sdncServiceDataType; + + // The SDNC service data specified by SDNC "agnostic" API + private String sdncServiceData; + + public SDNCServiceRequest() { + } + + public SDNCServiceRequest(String bpNotificationUrl, String bpTimeout, + String sdncRequestId, String sdncService, String sdncOperation, + RequestInformation requestInformation, + ServiceInformation serviceInformation, String sdncServiceDataType, + String sndcServiceData) { + super(bpNotificationUrl, bpTimeout, sdncRequestId); + this.requestInformation = requestInformation; + this.serviceInformation = serviceInformation; + this.sdncService = sdncService; + this.sdncOperation = sdncOperation; + this.sdncServiceDataType = sdncServiceDataType; + this.sdncServiceData = sndcServiceData; + } + + @JsonProperty("requestInformation") + @XmlElement(name = "requestInformation") + public RequestInformation getRequestInformation() { + return requestInformation; + } + + @JsonProperty("requestInformation") + public void setRequestInformation(RequestInformation requestInformation) { + this.requestInformation = requestInformation; + } + + @JsonProperty("serviceInformation") + @XmlElement(name = "serviceInformation") + public ServiceInformation getServiceInformation() { + return serviceInformation; + } + + @JsonProperty("serviceInformation") + public void setServiceInformation(ServiceInformation serviceInformation) { + this.serviceInformation = serviceInformation; + } + + @JsonProperty("sdncService") + @XmlElement(name = "sdncService") + public String getSdncService() { + return sdncService; + } + + @JsonProperty("sdncService") + public void setSdncService(String sdncService) { + this.sdncService = sdncService; + } + + @JsonProperty("sdncOperation") + @XmlElement(name = "sdncOperation") + public String getSdncOperation() { + return sdncOperation; + } + + @JsonProperty("sdncOperation") + public void setSdncOperation(String sdncOperation) { + this.sdncOperation = sdncOperation; + } + + @JsonProperty("sdncServiceDataType") + @XmlElement(name = "sdncServiceDataType") + public String getSdncServiceDataType() { + return sdncServiceDataType; + } + + @JsonProperty("sdncServiceDataType") + public void setSdncServiceDataType(String sdncServiceDataType) { + this.sdncServiceDataType = sdncServiceDataType; + } + + @JsonProperty("sdncServiceData") + @XmlElement(name = "sdncServiceData") + public String getSdncServiceData() { + return sdncServiceData; + } + + @JsonProperty("sdncServiceData") + public void setSdncServiceData(String sndcServiceData) { + this.sdncServiceData = sndcServiceData; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceResponse.java new file mode 100644 index 0000000000..18c9d49939 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/SDNCServiceResponse.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; + +// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, +// even though we are using JSON exclusively. The @NoJackson annotation +// is also required in this environment. + +/** + Map elements when marshalled to XML produce a list of ${MsoUtils.xmlEscape(key)}${MsoUtils.xmlEscape(value)} elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. + * + */ +@JsonRootName("SDNCServiceResponse") +@JsonInclude(Include.NON_NULL) +@XmlRootElement(name = "SDNCServiceResponse") +public class SDNCServiceResponse extends SDNCResponseCommon implements Serializable { + private static final long serialVersionUID = 1L; + + // Map of response parameters (possibly none). + private Map params = null; + + public SDNCServiceResponse(String sdncRequestId, String responseCode, + String responseMessage, String ackFinalIndicator) { + super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); + } + + public SDNCServiceResponse() { + } + + @JsonProperty("params") + @XmlElement(name = "params") + public Map getParams() { + return params; + } + + @JsonProperty("params") + public void setParams(Map params) { + this.params = params; + } + + public void addParam(String name, String value) { + if (params == null) { + params = new LinkedHashMap<>(); + } + params.put(name, value); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/ServiceInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/ServiceInformation.java new file mode 100644 index 0000000000..b4fe26ac00 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/sdncrest/ServiceInformation.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.sdncrest; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlElement; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Service Information specified by the SDNC "agnostic" API. + */ +public class ServiceInformation implements Serializable { + private static final long serialVersionUID = 1L; + + // The subscription's service type for the target service instance. + private String serviceType; + + // Identifies the target service instance for this particular SDNC request. + // NOTE: this could be a child of the parent model instance, i.e. this + // service instance ID may be different from the service instance ID + // associated with the transaction MSO has with the system that invoked it. + private String serviceInstanceId; + + // The subscriber name. + private String subscriberName; + + // The subscriber global ID (customer ID). + private String subscriberGlobalId; + + public ServiceInformation(String serviceType, String serviceInstanceId, + String subscriberName, String subscriberGlobalId) { + this.serviceType = serviceType; + this.serviceInstanceId = serviceInstanceId; + this.subscriberName = subscriberName; + this.subscriberGlobalId = subscriberGlobalId; + } + + public ServiceInformation() { + } + + @JsonProperty("serviceType") + @XmlElement(name = "serviceType") + public String getServiceType() { + return serviceType; + } + + @JsonProperty("serviceType") + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + @JsonProperty("serviceInstanceId") + @XmlElement(name = "serviceInstanceId") + public String getServiceInstanceId() { + return serviceInstanceId; + } + + @JsonProperty("serviceInstanceId") + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + @JsonProperty("subscriberName") + @XmlElement(name = "subscriberName") + public String getSubscriberName() { + return subscriberName; + } + + @JsonProperty("subscriberName") + public void setSubscriberName(String subscriberName) { + this.subscriberName = subscriberName; + } + + @JsonProperty("subscriberGlobalId") + @XmlElement(name = "subscriberGlobalId") + public String getSubscriberGlobalId() { + return subscriberGlobalId; + } + + @JsonProperty("subscriberGlobalId") + public void setSubscriberGlobalId(String subscriberGlobalId) { + this.subscriberGlobalId = subscriberGlobalId; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantError.java new file mode 100644 index 0000000000..34da8c6292 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantError.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "createTenantError") +public class CreateTenantError implements Serializable { + private static final long serialVersionUID = 7305288262646805568L; + private String message; + private MsoExceptionCategory category; + private Boolean rolledBack; + + public CreateTenantError () {} + + public CreateTenantError (String message) { + this.message = message; + } + + public CreateTenantError (String message, MsoExceptionCategory category, boolean rolledBack) { + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public Boolean getRolledBack() { + return rolledBack; + } + + public void setRolledBack(Boolean rolledBack) { + this.rolledBack = rolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java new file mode 100644 index 0000000000..d52e714f70 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantRequest.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +@XmlRootElement(name = "createTenantRequest") +public class CreateTenantRequest extends TenantRequestCommon { + private String cloudSiteId; + private String tenantName; + private Boolean failIfExists; + private Boolean backout; + private Map metadata = new HashMap<>(); + private MsoRequest msoRequest = new MsoRequest(); + + public CreateTenantRequest() {} + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public Boolean getFailIfExists() { + return failIfExists; + } + + public void setFailIfExists(Boolean failIfExists) { + this.failIfExists = failIfExists; + } + + public Boolean getBackout() { + return backout; + } + + public void setBackout(Boolean backout) { + this.backout = backout; + } + + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + @Override + public String toString() { + return "CreateTenantRequest [cloudSiteId=" + cloudSiteId + + ", tenantName=" + tenantName + ", failIfExists=" + + failIfExists + ", backout=" + backout + ", metadata=" + + metadata + "]"; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantResponse.java new file mode 100644 index 0000000000..ec304cec41 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/CreateTenantResponse.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.adapters.tenantrest; + + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "createTenantResponse") +public class CreateTenantResponse implements Serializable { + private static final long serialVersionUID = -456155026754759682L; + private String cloudSiteId; + private String tenantId; + private Boolean tenantCreated; + private TenantRollback tenantRollback = new TenantRollback(); + + public CreateTenantResponse() {} + + public CreateTenantResponse(String cloudSiteId, String tenantId, + Boolean tenantCreated, TenantRollback tenantRollback) { + this.cloudSiteId = cloudSiteId; + this.tenantId = tenantId; + this.tenantCreated = tenantCreated; + this.tenantRollback = tenantRollback; + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public Boolean getTenantCreated() { + return tenantCreated; + } + + public void setTenantCreated(Boolean tenantCreated) { + this.tenantCreated = tenantCreated; + } + + public TenantRollback getTenantRollback() { + return tenantRollback; + } + + public void setTenantRollback(TenantRollback tenantRollback) { + this.tenantRollback = tenantRollback; + } + + @Override + public String toString() { + return "CreateTenantResponse [cloudSiteId=" + cloudSiteId + + ", tenantId=" + tenantId + ", tenantCreated=" + tenantCreated + + ", tenantRollback=" + tenantRollback.toString() + "]"; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantError.java new file mode 100644 index 0000000000..d2c22e8506 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantError.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "deleteTenantError") +public class DeleteTenantError implements Serializable { + private static final long serialVersionUID = -5778340182805870809L; + private String message; + private MsoExceptionCategory category; + private Boolean rolledBack; + + public DeleteTenantError () {} + + public DeleteTenantError (String message) { + this.message = message; + } + + public DeleteTenantError (String message, MsoExceptionCategory category, boolean rolledBack) { + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public Boolean getRolledBack() { + return rolledBack; + } + + public void setRolledBack(Boolean rolledBack) { + this.rolledBack = rolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.java new file mode 100644 index 0000000000..a39b7164e2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantRequest.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.adapters.tenantrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +@XmlRootElement(name = "deleteTenantRequest") +public class DeleteTenantRequest extends TenantRequestCommon { + + private String cloudSiteId; + private String tenantId; + + private MsoRequest msoRequest = new MsoRequest(); + + public DeleteTenantRequest() {} + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantResponse.java new file mode 100644 index 0000000000..e7961d4607 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/DeleteTenantResponse.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "deleteTenantResponse") +public class DeleteTenantResponse { + + private Boolean tenantDeleted; + + public DeleteTenantResponse() {} + + public Boolean getTenantDeleted() { + return tenantDeleted; + } + + public void setTenantDeleted(Boolean tenantDeleted) { + this.tenantDeleted = tenantDeleted; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantError.java new file mode 100644 index 0000000000..10f4b70a07 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantError.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "queryTenantError") +public class QueryTenantError implements Serializable { + private static final long serialVersionUID = 7358240830662453507L; + private String message; + private MsoExceptionCategory category; + + public QueryTenantError () {} + + public QueryTenantError (String message) { + this.message = message; + } + + public QueryTenantError (String message, MsoExceptionCategory category) { + this.message = message; + this.category = category; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantResponse.java new file mode 100644 index 0000000000..8d478cd393 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/QueryTenantResponse.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "queryTenantResponse") +public class QueryTenantResponse extends TenantRequestCommon { + private String tenantId; + private String tenantName; + private Map metadata; + + public QueryTenantResponse() {} + + public QueryTenantResponse (String id, String name, Map metadata) { + this.tenantId = id; + this.tenantName = name; + this.metadata = metadata; + } + + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getTenantName() { + return tenantName; + } + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public Map getMetadata() { + return metadata; + } + public void setMetadata(Map metadata) { + this.metadata = metadata; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantError.java new file mode 100644 index 0000000000..725b40549d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantError.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "rollbackTenantError") +public class RollbackTenantError implements Serializable { + private static final long serialVersionUID = -5313713674529615223L; + private String message; + private MsoExceptionCategory category; + private Boolean rolledBack; + + public RollbackTenantError () {} + + public RollbackTenantError (String message, MsoExceptionCategory category, boolean rolledBack) { + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public Boolean getRolledBack() { + return rolledBack; + } + + public void setRolledBack(Boolean rolledBack) { + this.rolledBack = rolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantRequest.java new file mode 100644 index 0000000000..d99150fc47 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantRequest.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "rollbackTenantRequest") +public class RollbackTenantRequest extends TenantRequestCommon { + + private TenantRollback tenantRollback; + + public RollbackTenantRequest() {} + + public TenantRollback getTenantRollback() { + return tenantRollback; + } + + public void setTenantRollback(TenantRollback tenantRollback) { + this.tenantRollback = tenantRollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantResponse.java new file mode 100644 index 0000000000..25b77b3490 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/RollbackTenantResponse.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "rollbackTenantResponse") +public class RollbackTenantResponse { + + private Boolean tenantRolledback; + + public RollbackTenantResponse() {} + + public Boolean getTenantRolledback() { + return tenantRolledback; + } + + public void setTenantRolledback(Boolean tenantRolledback) { + this.tenantRolledback = tenantRolledback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantExceptionResponse.java new file mode 100644 index 0000000000..f4dd7f9499 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantExceptionResponse.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "createTenantResponse") +public class TenantExceptionResponse implements Serializable { + + private static final long serialVersionUID = -9062290006520066109L; + + private String message; + private MsoExceptionCategory category; + private Boolean rolledBack; + + public TenantExceptionResponse () {} + + public TenantExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack) { + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public Boolean getRolledBack() { + return rolledBack; + } + + public void setRolledBack(Boolean rolledBack) { + this.rolledBack = rolledBack; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRequestCommon.java new file mode 100644 index 0000000000..168200e477 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRequestCommon.java @@ -0,0 +1,66 @@ +/*- + * ============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.adapters.tenantrest; + + +import java.io.ByteArrayOutputStream; +import java.io.Serializable; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public abstract class TenantRequestCommon implements Serializable { + + private static final long serialVersionUID = 1486834308868170854L; + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, TenantRequestCommon.class); + public String toJsonString() { + try { + String jsonString; + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + return jsonString; + } catch (Exception e) { + LOGGER.debug("Exception :",e); + return ""; + } + } + + public String toXmlString() { + try { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + JAXBContext context = JAXBContext.newInstance(this.getClass()); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML + marshaller.marshal(this, bs); + return bs.toString(); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + return ""; + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRollback.java new file mode 100644 index 0000000000..195628167e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/tenantrest/TenantRollback.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.tenantrest; + + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +/** + * Javabean representing the rollback criteria following a "Create Tenant" + * operation. This structure can be passed back to the "Rollback Tenant" + * operation to undo the effects of the create. + * + * + */ + +@XmlRootElement(name = "rollbackTenantRequest") +public class TenantRollback extends TenantRequestCommon { + private static final long serialVersionUID = -4540810517355635993L; + private String tenantId; + private String cloudId; + private boolean tenantCreated = false; + private MsoRequest msoRequest; + + public TenantRollback() {} + + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getCloudId() { + return cloudId; + } + public void setCloudId(String cloudId) { + this.cloudId = cloudId; + } + + public boolean getTenantCreated() { + return tenantCreated; + } + public void setTenantCreated(boolean tenantCreated) { + this.tenantCreated = tenantCreated; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest (MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + @Override + public String toString() { + return "VnfRollback: cloud=" + cloudId + ", tenant=" + tenantId + + ", tenantCreated=" + tenantCreated; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java new file mode 100644 index 0000000000..a56a6929a9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java @@ -0,0 +1,69 @@ +/*- + * ============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.adapters.vdu; + +/** + * Cloud information structure for deploying/managing a VDU. Includes the cloud site + * as well as tenant information within the site. Currently this is defined as a + * cloud site ID. which would map to a CloudConfig entry. + * Perhaps the CloudConfig entry itself should be provided, instead of requiring each + * plug-in to query it. + * + * The meaning of 'tenant' may differ by cloud provider, but every cloud supports some + * sort of tenant partitioning. + * + */ +public class CloudInfo { + + private String cloudSiteId; + private String tenantId; + private String tenantName;//bpmn query and pass + + public CloudInfo() { + } + + public CloudInfo (String cloudSiteId, String tenantId, String tenantName) { + this.cloudSiteId = cloudSiteId; + this.tenantId = tenantId; + this.tenantName = tenantName; + } + + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getTenantName() { + return tenantName; + } + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java new file mode 100644 index 0000000000..1f097ddd68 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/PluginAction.java @@ -0,0 +1,63 @@ +/*- + * ============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.adapters.vdu; + +/** + * Java beam representing a detailed action performed within a plugin during VDU + * orchestration. This allows the plugin to convey more detailed information about + * recent activities it has performed. It is primarily intended for logging and + * troubleshooting, so plugins are free to populate this as desired. + */ +public class PluginAction { + + private String action; + private String status; + private String rawMessage; + + public PluginAction () { + } + + public PluginAction (String action, String status, String rawMessage) { + this.action = action; + this.status = status; + this.rawMessage = rawMessage; + } + + public String getAction() { + return action; + } + public void setAction(String action) { + this.action = action; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public String getRawMessage() { + return rawMessage; + } + public void setRawMessage(String rawMessage) { + this.rawMessage = rawMessage; + } + +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java new file mode 100644 index 0000000000..a53cd0ce49 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java @@ -0,0 +1,80 @@ +/*- + * ============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.adapters.vdu; + +import java.util.Arrays; +import java.util.Objects; + +public class VduArtifact { + + // Enumerate the types of artifacts permitted. This may need to be a variable string + // value if arbitrary (cloud-specific) artifacts may be attached to VDUs in ASDC. + public enum ArtifactType { + MAIN_TEMPLATE, NESTED_TEMPLATE, CONFIG_FILE, SCRIPT_FILE, TEXT_FILE, ENVIRONMENT + } + + private String name; + private byte[] content; + private ArtifactType type; + + // Default constructor + public VduArtifact() {} + + // Fully specified constructor + public VduArtifact (String name, byte[] content, ArtifactType type) { + this.name = name; + this.content = content; + this.type = type; + } + + public String getName() { + return name; + } + public void setName (String name) { + this.name = name; + } + public byte[] getContent() { + return content; + } + public void setContent(byte[] content) { + this.content = content; + } + public ArtifactType getType() { + return type; + } + public void setType(ArtifactType type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VduArtifact that = (VduArtifact) o; + return Objects.equals(name, that.name) && + Arrays.equals(content, that.content) && + type == that.type; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java new file mode 100644 index 0000000000..c611b87e5c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduException.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.onap.so.adapters.vdu; + +import org.onap.so.openstack.exceptions.MsoException; +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +/** + * OpenStack exception. + */ +public class VduException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 3313636124141766495L; + + /** + * Constructor to create a new VduException instance + * @param detail error details + */ + public VduException (String detail) { + // Set the detailed error as the Exception 'message' + super(detail); + // TODO: Need a more generic category than OPENSTACK + super.category = MsoExceptionCategory.OPENSTACK; + } + + /** + * Constructor to create a new VduException instance + * @param detail error details + * @param e the cause + */ + public VduException (String detail, Exception e) { + // Set the detailed error as the Exception 'message' + super(detail, e); + // TODO: Need a more generic category than OPENSTACK + super.category = MsoExceptionCategory.OPENSTACK; + } + +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java new file mode 100644 index 0000000000..8f5f0f9745 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduInstance.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.onap.so.adapters.vdu; + +import java.util.Map; +import java.util.HashMap; + +/* + * This Java bean class relays VDU status information in a cloud-agnostic format. + * + * This bean is returned by all implementors of the VduPlugin interface operations + * (instantiate, query, delete). + */ + +public class VduInstance { + // Set defaults for everything + protected String vduInstanceId; + protected String vduInstanceName; + protected VduStatus status; + protected Map outputs = new HashMap<>(); + protected Map inputs = new HashMap<>(); + + public String getVduInstanceId() { + return vduInstanceId; + } + + public void setVduInstanceId(String vduInstanceId) { + this.vduInstanceId = vduInstanceId; + } + + public String getVduInstanceName() { + return vduInstanceName; + } + + public void setVduInstanceName(String vduInstanceName) { + this.vduInstanceName = vduInstanceName; + } + + public VduStatus getStatus() { + return status; + } + + public void setStatus(VduStatus status) { + this.status = status; + } + + public Map getOutputs() { + return outputs; + } + + public void setOutputs(Map outputs) { + this.outputs = outputs; + } + + public Map getInputs() { + return inputs; + } + + public void setInputs(Map inputs) { + this.inputs = inputs; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java new file mode 100644 index 0000000000..47f4c74aae --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduModelInfo.java @@ -0,0 +1,50 @@ +/*- + * ============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.adapters.vdu; + +import java.util.ArrayList; +import java.util.List; + +public class VduModelInfo { + private String modelCustomizationUUID; + private int timeoutMinutes; + private List artifacts = new ArrayList<>(); + + public String getModelCustomizationUUID() { + return modelCustomizationUUID; + } + public void setModelCustomizationUUID(String modelCustomizationUUID) { + this.modelCustomizationUUID = modelCustomizationUUID; + } + public int getTimeoutMinutes() { + return timeoutMinutes; + } + public void setTimeoutMinutes(int timeoutMinutes) { + this.timeoutMinutes = timeoutMinutes; + } + public List getArtifacts() { + return artifacts; + } + public void setArtifacts(List artifacts) { + this.artifacts = artifacts; + } + +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java new file mode 100644 index 0000000000..0b95b392f6 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStateType.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.onap.so.adapters.vdu; + + +/* + * Enum status values to capture the state of a generic (cloud-agnostic) VDU. + */ +public enum VduStateType { + NOTFOUND, + INSTANTIATING, + INSTANTIATED, + DELETING, + DELETED, // Note - only returned in success response to deleteVdu call. + UPDATING, + FAILED, + UNKNOWN +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java new file mode 100644 index 0000000000..7797c997a5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduStatus.java @@ -0,0 +1,58 @@ +/*- + * ============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.adapters.vdu; + +public class VduStatus { + + private VduStateType state; + private String errorMessage; + private PluginAction lastAction; + + public VduStatus(){} + public VduStatus( VduStateType state) { + this.state = state; + } + public VduStateType getState() { + return state; + } + public void setState(VduStateType state) { + this.state = state; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public PluginAction getLastAction() { + return lastAction; + } + public void setLastAction(PluginAction lastAction) { + this.lastAction = lastAction; + } + public void setLastAction (String action, String status, String rawCloudMessage) { + lastAction = new PluginAction(); + lastAction.setAction (action); + lastAction.setStatus (status); + lastAction.setRawMessage(rawCloudMessage); + } + +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java new file mode 100644 index 0000000000..d0caef33e4 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java @@ -0,0 +1,215 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + +/* README + Map elements when marshalled to XML produce a list of ${MsoUtils.xmlEscape(key)}${MsoUtils.xmlEscape(value)} elements. + When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. +*/ +@JsonRootName("createVfModuleRequest") +@XmlRootElement(name = "createVfModuleRequest") +public class CreateVfModuleRequest extends VfRequestCommon { + private String cloudSiteId; + private String tenantId; + + private String vnfId; + private String vnfType; + private String vnfVersion; + + private String vfModuleId; + private String vfModuleName; + private String vfModuleType; + + private String volumeGroupId; + private String volumeGroupStackId; + private String baseVfModuleId; + private String baseVfModuleStackId; + private String modelCustomizationUuid; + + private String requestType; + private Boolean failIfExists; + private Boolean backout; + private Boolean enableBridge; + + private Map vfModuleParams = new HashMap<>(); + private MsoRequest msoRequest = new MsoRequest(); + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleName() { + return vfModuleName; + } + + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getVnfVersion() { + return vnfVersion; + } + + public void setVnfVersion(String vnfVersion) { + this.vnfVersion = vnfVersion; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public void setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public String getBaseVfModuleId() { + return baseVfModuleId; + } + + public void setBaseVfModuleId(String baseVfModuleId) { + this.baseVfModuleId = baseVfModuleId; + } + + public String getBaseVfModuleStackId() { + return baseVfModuleStackId; + } + + public void setBaseVfModuleStackId(String baseVfModuleStackId) { + this.baseVfModuleStackId = baseVfModuleStackId; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public String getRequestType() { + return requestType; + } + + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + public Boolean getFailIfExists() { + return failIfExists; + } + + public void setFailIfExists(Boolean failIfExists) { + this.failIfExists = failIfExists; + } + + public Boolean getBackout() { + return backout; + } + + public void setBackout(Boolean backout) { + this.backout = backout; + } + + public Map getVfModuleParams() { + return vfModuleParams; + } + + public void setVfModuleParams(Map vfModuleParams) { + this.vfModuleParams = vfModuleParams; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + public Boolean getEnableBridge() { + return this.enableBridge; + } + + public void setEnableBridge(Boolean enableBridge) { + this.enableBridge = enableBridge; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleResponse.java new file mode 100644 index 0000000000..b9d1f4c376 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleResponse.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("createVfModuleResponse") +@XmlRootElement(name = "createVfModuleResponse") +public class CreateVfModuleResponse extends VfResponseCommon { + private String vnfId; + private String vfModuleId; + private String vfModuleStackId; + private Boolean vfModuleCreated; + private Map vfModuleOutputs = new HashMap<>(); + private VfModuleRollback rollback = new VfModuleRollback(); + + public CreateVfModuleResponse() { + super(); + } + + public CreateVfModuleResponse(String vnfId, String vfModuleId, + String vfModuleStackId, Boolean vfModuleCreated, + Map vfModuleOutputs, VfModuleRollback rollback, + String messageId) { + super(messageId); + this.vnfId = vnfId; + this.vfModuleId = vfModuleId; + this.vfModuleStackId = vfModuleStackId; + this.vfModuleCreated = vfModuleCreated; + this.vfModuleOutputs = vfModuleOutputs; + this.rollback = rollback; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleStackId() { + return vfModuleStackId; + } + + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + + public Boolean getVfModuleCreated() { + return vfModuleCreated; + } + + public void setVfModuleCreated(Boolean vfModuleCreated) { + this.vfModuleCreated = vfModuleCreated; + } + + public Map getVfModuleOutputs() { + return vfModuleOutputs; + } + + public void setVfModuleOutputs(Map vfModuleOutputs) { + this.vfModuleOutputs = vfModuleOutputs; + } + + public VfModuleRollback getRollback() { + return rollback; + } + + public void setRollback(VfModuleRollback rollback) { + this.rollback = rollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java new file mode 100644 index 0000000000..698b2ccebe --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("createVolumeGroupRequest") +@XmlRootElement(name = "createVolumeGroupRequest") +public class CreateVolumeGroupRequest extends VfRequestCommon { + private String cloudSiteId; + private String tenantId; + private String volumeGroupName; + private String volumeGroupId; + private String vnfType; + private String vnfVersion; + private String vfModuleType; + private String modelCustomizationUuid; + private Map volumeGroupParams = new HashMap<>(); + private Boolean failIfExists; + private Boolean enableBridge; + private Boolean suppressBackout; + private MsoRequest msoRequest = new MsoRequest(); + + public CreateVolumeGroupRequest() { + super(); + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getVnfVersion() { + return vnfVersion; + } + + public void setVnfVersion(String vnfVersion) { + this.vnfVersion = vnfVersion; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public void setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + } + + public Map getVolumeGroupParams() { + return volumeGroupParams; + } + + public void setVolumeGroupParams(Map volumeGroupParams) { + this.volumeGroupParams = volumeGroupParams; + } + + public String getVolumeGroupName() { + return volumeGroupName; + } + + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public Boolean getFailIfExists() { + return failIfExists; + } + + public void setFailIfExists(Boolean failIfExists) { + this.failIfExists = failIfExists; + } + + public Boolean getSuppressBackout() { + return suppressBackout; + } + + public void setSuppressBackout(Boolean suppressBackout) { + this.suppressBackout = suppressBackout; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + public Boolean getEnableBridge() { + return enableBridge; + } + + public void setEnableBridge(Boolean enableBridge) { + this.enableBridge = enableBridge; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupResponse.java new file mode 100644 index 0000000000..d98318d3e6 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupResponse.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("createVolumeGroupResponse") +@XmlRootElement(name = "createVolumeGroupResponse") +public class CreateVolumeGroupResponse extends VfResponseCommon { + private String volumeGroupId; + private String volumeGroupStackId; + private Boolean volumeGroupCreated; + private Map volumeGroupOutputs = new HashMap<>(); + private VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback(); + + public CreateVolumeGroupResponse() { + super(); + } + + public CreateVolumeGroupResponse( + String volumeGroupId, + String volumeGroupStackId, + Boolean volumeGroupCreated, + Map volumeGroupOutputs, + VolumeGroupRollback volumeGroupRollback, + String messageId) + { + super(messageId); + this.volumeGroupId = volumeGroupId; + this.volumeGroupStackId = volumeGroupStackId; + this.volumeGroupCreated = volumeGroupCreated; + this.volumeGroupOutputs = volumeGroupOutputs; + this.volumeGroupRollback = volumeGroupRollback; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public Boolean getVolumeGroupCreated() { + return volumeGroupCreated; + } + + public void setVolumeGroupCreated(Boolean volumeGroupCreated) { + this.volumeGroupCreated = volumeGroupCreated; + } + + public Map getVolumeGroupOutputs() { + return volumeGroupOutputs; + } + + public void setVolumeGroupOutputs(Map volumeGroupOutputs) { + this.volumeGroupOutputs = volumeGroupOutputs; + } + + public VolumeGroupRollback getVolumeGroupRollback() { + return volumeGroupRollback; + } + + public void setVolumeGroupRollback(VolumeGroupRollback volumeGroupRollback) { + this.volumeGroupRollback = volumeGroupRollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java new file mode 100644 index 0000000000..6ce9b2fa4c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("deleteVfModuleRequest") +@XmlRootElement(name = "deleteVfModuleRequest") +public class DeleteVfModuleRequest extends VfRequestCommon implements Serializable { + /** + * + */ + private static final long serialVersionUID = -8504083539107392561L; + private String cloudSiteId; + private String tenantId; + private String vnfId; + private String vfModuleId; + private String vfModuleStackId; + + private MsoRequest msoRequest = new MsoRequest(); + + public DeleteVfModuleRequest() { + super(); + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleStackId() { + return vfModuleStackId; + } + + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleResponse.java new file mode 100644 index 0000000000..ca713d36a0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleResponse.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("deleteVfModuleResponse") +@XmlRootElement(name = "deleteVfModuleResponse") +public class DeleteVfModuleResponse extends VfResponseCommon { + private String vnfId; + private String vfModuleId; + private Boolean vfModuleDeleted; + private Map vfModuleOutputs = new HashMap<>(); + public DeleteVfModuleResponse() { + super(); + } + + public DeleteVfModuleResponse(String vnfId, String vfModuleId, Boolean vfModuleDeleted, String messageId, Map outputs) { + super(messageId); + this.vnfId = vnfId; + this.vfModuleId = vfModuleId; + this.vfModuleDeleted = vfModuleDeleted; + this.vfModuleOutputs = outputs; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public Boolean getVfModuleDeleted() { + return vfModuleDeleted; + } + + public void setVfModuleDeleted(Boolean vfModuleDeleted) { + this.vfModuleDeleted = vfModuleDeleted; + } + public Map getVfModuleOutputs() { + return vfModuleOutputs; + } + + public void setVfModuleOutputs(Map vfModuleOutputs) { + this.vfModuleOutputs = vfModuleOutputs; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java new file mode 100644 index 0000000000..d17c5dd0de --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.ToStringBuilder; + +@JsonRootName("deleteVolumeGroupRequest") +@XmlRootElement(name = "deleteVolumeGroupRequest") +public class DeleteVolumeGroupRequest extends VfRequestCommon { + private String cloudSiteId; + private String tenantId; + private String volumeGroupId; + private String volumeGroupStackId; + private MsoRequest msoRequest = new MsoRequest(); + + public DeleteVolumeGroupRequest() { + super(); + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + @Override + public String toString() { + return new ToStringBuilder(this).appendSuper(super.toString()).append("cloudSiteId", cloudSiteId) + .append("tenantId", tenantId).append("volumeGroupId", volumeGroupId) + .append("volumeGroupStackId", volumeGroupStackId).append("msoRequest", msoRequest).toString(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupResponse.java new file mode 100644 index 0000000000..4a7442108a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupResponse.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("deleteVolumeGroupResponse") +@XmlRootElement(name = "deleteVolumeGroupResponse") +public class DeleteVolumeGroupResponse extends VfResponseCommon { + private Boolean volumeGroupDeleted; + + public DeleteVolumeGroupResponse() { + super(); + } + + public DeleteVolumeGroupResponse(Boolean volumeGroupDeleted, String messageId) { + super(messageId); + this.volumeGroupDeleted = volumeGroupDeleted; + } + + public Boolean getVolumeGroupDeleted() { + return volumeGroupDeleted; + } + + public void setVolumeGroupDeleted(Boolean volumeGroupDeleted) { + this.volumeGroupDeleted = volumeGroupDeleted; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVfModuleResponse.java new file mode 100644 index 0000000000..0214d15ee8 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVfModuleResponse.java @@ -0,0 +1,97 @@ +/*- + * ============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.adapters.vnfrest; + +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.VnfStatus; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("queryVfModuleResponse") +@XmlRootElement(name = "queryVfModuleResponse") +public class QueryVfModuleResponse extends VfResponseCommon{ + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryVfModuleResponse.class); + private String vnfId; + private String vfModuleId; + private String vfModuleStackId; + private VnfStatus vnfStatus; + private Map vfModuleOutputs; + + public QueryVfModuleResponse() { + super(); + } + + public QueryVfModuleResponse(String vnfId, String vfModuleId, String vfModuleStackId, VnfStatus vnfStatus, + Map vfModuleOutputs) { + super(); + this.vnfId = vnfId; + this.vfModuleId = vfModuleId; + this.vfModuleStackId = vfModuleStackId; + this.vnfStatus = vnfStatus; + this.vfModuleOutputs = vfModuleOutputs; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleStackId() { + return vfModuleStackId; + } + + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + + public VnfStatus getVnfStatus() { + return vnfStatus; + } + + public void setVnfStatus(VnfStatus vnfStatus) { + this.vnfStatus = vnfStatus; + } + + public Map getVfModuleOutputs() { + return vfModuleOutputs; + } + + public void setVfModuleOutputs(Map vfModuleOutputs) { + this.vfModuleOutputs = vfModuleOutputs; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java new file mode 100644 index 0000000000..6e8027c689 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/QueryVolumeGroupResponse.java @@ -0,0 +1,103 @@ +/*- + * ============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.adapters.vnfrest; + + +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.logger.MsoLogger; +import org.onap.so.openstack.beans.VnfStatus; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +@XmlRootElement(name = "queryVolumeGroupResponse") +public class QueryVolumeGroupResponse { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, QueryVolumeGroupResponse.class); + private String volumeGroupId; + private String volumeGroupStackId; + private VnfStatus volumeGroupStatus; + private Map volumeGroupOutputs; + + public QueryVolumeGroupResponse() { + } + + public QueryVolumeGroupResponse( + String volumeGroupId, + String volumeGroupStackId, + VnfStatus volumeGroupStatus, + Map volumeGroupOutputs) + { + super(); + this.volumeGroupId = volumeGroupId; + this.volumeGroupStackId = volumeGroupStackId; + this.volumeGroupStatus = volumeGroupStatus; + this.volumeGroupOutputs = volumeGroupOutputs; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public VnfStatus getVolumeGroupStatus() { + return volumeGroupStatus; + } + + public void setVolumeGroupStatus(VnfStatus volumeGroupStatus) { + this.volumeGroupStatus = volumeGroupStatus; + } + + public Map getVolumeGroupOutputs() { + return volumeGroupOutputs; + } + + public void setVolumeGroupOutputs(Map volumeGroupOutputs) { + this.volumeGroupOutputs = volumeGroupOutputs; + } + + public String toJsonString() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + } + catch (Exception e) { + LOGGER.debug("Exception :",e); + } + return jsonString; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleRequest.java new file mode 100644 index 0000000000..4ad7a7a417 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleRequest.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("rollbackVfModuleRequest") +@XmlRootElement(name = "rollbackVfModuleRequest") +public class RollbackVfModuleRequest extends VfRequestCommon { + private VfModuleRollback vfModuleRollback; + + public RollbackVfModuleRequest() { + super(); + } + + public VfModuleRollback getVfModuleRollback() { + return vfModuleRollback; + } + + public void setVfModuleRollback(VfModuleRollback vfModuleRollback) { + this.vfModuleRollback = vfModuleRollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleResponse.java new file mode 100644 index 0000000000..43db90c566 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVfModuleResponse.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("rollbackVfModuleResponse") +@XmlRootElement(name = "rollbackVfModuleResponse") +public class RollbackVfModuleResponse extends VfResponseCommon { + private Boolean vfModuleRolledback; + + public RollbackVfModuleResponse() { + super(); + } + + public RollbackVfModuleResponse(Boolean vfModuleRolledback, String messageId) { + super(messageId); + this.vfModuleRolledback = vfModuleRolledback; + } + + public Boolean getVfModuleRolledback() { + return vfModuleRolledback; + } + + public void setVfModuleRolledback(Boolean vfModuleRolledback) { + this.vfModuleRolledback = vfModuleRolledback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupRequest.java new file mode 100644 index 0000000000..14c2c2a3d9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupRequest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("rollbackVolumeGroupRequest") +@XmlRootElement(name = "rollbackVolumeGroupRequest") +public class RollbackVolumeGroupRequest extends VfRequestCommon { + private VolumeGroupRollback volumeGroupRollback; + + public RollbackVolumeGroupRequest() { + super(); + } + + public VolumeGroupRollback getVolumeGroupRollback() { + return volumeGroupRollback; + } + + public void setVolumeGroupRollback(VolumeGroupRollback volumeGroupRollback) { + this.volumeGroupRollback = volumeGroupRollback; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupResponse.java new file mode 100644 index 0000000000..46ac26825c --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/RollbackVolumeGroupResponse.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("rollbackVolumeGroupResponse") +@XmlRootElement(name = "rollbackVolumeGroupResponse") +public class RollbackVolumeGroupResponse extends VfResponseCommon { + private Boolean volumeGroupRolledBack; + + public RollbackVolumeGroupResponse() { + super(); + } + + public RollbackVolumeGroupResponse(Boolean volumeGroupRolledBack, String messageId) { + super(messageId); + this.volumeGroupRolledBack = volumeGroupRolledBack; + } + + public Boolean getVolumeGroupRolledBack() { + return volumeGroupRolledBack; + } + + public void setVolumeGroupRolledBack(Boolean volumeGroupRolledBack) { + this.volumeGroupRolledBack = volumeGroupRolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java new file mode 100644 index 0000000000..0fb5c05e2a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java @@ -0,0 +1,215 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("updateVfModuleRequest") +@XmlRootElement(name = "updateVfModuleRequest") +public class UpdateVfModuleRequest extends VfRequestCommon { + + private String cloudSiteId; + private String tenantId; + + private String vnfId; + private String vnfType; + private String vnfVersion; + + private String vfModuleName; + private String vfModuleType; + private String vfModuleId; + private String vfModuleStackId; + + private String volumeGroupId; + private String volumeGroupStackId; + + private String baseVfModuleId; + private String baseVfModuleStackId; + + private String modelCustomizationUuid; + + private String requestType; + private Boolean failIfExists; + private Boolean backout; + + private Map vfModuleParams = new HashMap<>(); + private MsoRequest msoRequest = new MsoRequest(); + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleName() { + return vfModuleName; + } + + public void setVfModuleName(String vfModuleName) { + this.vfModuleName = vfModuleName; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getVnfVersion() { + return vnfVersion; + } + + public void setVnfVersion(String vnfVersion) { + this.vnfVersion = vnfVersion; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public void setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + } + + public String getVfModuleStackId() { + return vfModuleStackId; + } + + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public String getBaseVfModuleId() { + return baseVfModuleId; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public void setBaseVfModuleId(String baseVfModuleId) { + this.baseVfModuleId = baseVfModuleId; + } + + public String getBaseVfModuleStackId() { + return baseVfModuleStackId; + } + + public void setBaseVfModuleStackId(String baseVfModuleStackId) { + this.baseVfModuleStackId = baseVfModuleStackId; + } + + public String getRequestType() { + return requestType; + } + + public void setRequestType(String requestType) { + this.requestType = requestType; + } + + public Boolean getFailIfExists() { + return failIfExists; + } + + public void setFailIfExists(Boolean failIfExists) { + this.failIfExists = failIfExists; + } + + public Boolean getBackout() { + return backout; + } + + public void setBackout(Boolean backout) { + this.backout = backout; + } + + public Map getVfModuleParams() { + return vfModuleParams; + } + + public void setVfModuleParams(Map vfModuleParams) { + this.vfModuleParams = vfModuleParams; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleResponse.java new file mode 100644 index 0000000000..4504bf3461 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleResponse.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.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("updateVfModuleResponse") +@XmlRootElement(name = "updateVfModuleResponse") +public class UpdateVfModuleResponse extends VfResponseCommon { + private String vnfId; + private String vfModuleId; + private String vfModuleStackId; + private Map vfModuleOutputs = new HashMap<>(); + + public UpdateVfModuleResponse() { + super(); + } + + public UpdateVfModuleResponse(String vnfId, String vfModuleId, + String vfModuleStackId, + Map vfModuleOutputs, + String messageId) { + super(messageId); + this.vnfId = vnfId; + this.vfModuleId = vfModuleId; + this.vfModuleStackId = vfModuleStackId; + this.vfModuleOutputs = vfModuleOutputs; + } + + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleStackId() { + return vfModuleStackId; + } + + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + + public Map getVfModuleOutputs() { + return vfModuleOutputs; + } + + public void setVfModuleOutputs(Map vfModuleOutputs) { + this.vfModuleOutputs = vfModuleOutputs; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java new file mode 100644 index 0000000000..d9f83aad2f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("updateVolumeGroupRequest") +@XmlRootElement(name = "updateVolumeGroupRequest") +public class UpdateVolumeGroupRequest extends VfRequestCommon { + private String cloudSiteId; + private String tenantId; + private String volumeGroupId; + private String volumeGroupStackId; + private String vnfType; + private String vnfVersion; + private String vfModuleType; + private String modelCustomizationUuid; + private Map volumeGroupParams = new HashMap<>(); + private MsoRequest msoRequest = new MsoRequest(); + + public UpdateVolumeGroupRequest() { + super(); + } + + public String getCloudSiteId() { + return cloudSiteId; + } + + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { + this.vnfType = vnfType; + } + + public String getVnfVersion() { + return vnfVersion; + } + + public void setVnfVersion(String vnfVersion) { + this.vnfVersion = vnfVersion; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public void setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public Map getVolumeGroupParams() { + return volumeGroupParams; + } + + public void setVolumeGroupParams(Map volumeGroupParams) { + this.volumeGroupParams = volumeGroupParams; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupResponse.java new file mode 100644 index 0000000000..8c003b1835 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupResponse.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.fasterxml.jackson.annotation.JsonRootName; + + +@JsonRootName("updateVolumeGroupResponse") +@XmlRootElement(name = "updateVolumeGroupResponse") +public class UpdateVolumeGroupResponse extends VfResponseCommon { + private String volumeGroupId; + private String volumeGroupStackId; + private Map volumeGroupOutputs; + + public UpdateVolumeGroupResponse() { + super(); + this.volumeGroupOutputs = new HashMap<>(); + } + + public UpdateVolumeGroupResponse( + String volumeGroupId, + String volumeGroupStackId, + Map volumeGroupOutputs, + String messageId) + { + super(messageId); + this.volumeGroupId = volumeGroupId; + this.volumeGroupStackId = volumeGroupStackId; + this.volumeGroupOutputs = volumeGroupOutputs; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + + public Map getVolumeGroupOutputs() { + return volumeGroupOutputs; + } + + public void setVolumeGroupOutputs(Map volumeGroupOutputs) { + this.volumeGroupOutputs = volumeGroupOutputs; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleExceptionResponse.java new file mode 100644 index 0000000000..4f53531585 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleExceptionResponse.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "vfModuleException") + +public class VfModuleExceptionResponse extends VfResponseCommon implements Serializable { + private static final long serialVersionUID = -9062290006520066109L; + + private String message; + private MsoExceptionCategory category; + private Boolean rolledBack; + + public VfModuleExceptionResponse () {} + + public VfModuleExceptionResponse (String message) { + this.message = message; + } + + public VfModuleExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { + super(messageid); + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public MsoExceptionCategory getCategory () { + return category; + } + + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public Boolean getRolledBack() { + return rolledBack; + } + + public void setRolledBack(Boolean rolledBack) { + this.rolledBack = rolledBack; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java new file mode 100644 index 0000000000..0e716e5924 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java @@ -0,0 +1,130 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.VnfRollback; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("VfModuleRollback") +@XmlRootElement(name = "VfModuleRollback") +public class VfModuleRollback { + private String vnfId; + private String vfModuleId; + private String vfModuleStackId; + private boolean vfModuleCreated = false; + private String tenantId; + private String cloudSiteId; + private MsoRequest msoRequest; + private String messageId; + private String mode = "HEAT"; // default + + public VfModuleRollback() { + } + + public VfModuleRollback(VnfRollback vrb, String vfModuleId, String vfModuleStackId, String messageId) + { + this.vnfId = vrb.getVnfId(); + this.vfModuleId = vfModuleId; + this.vfModuleStackId = vfModuleStackId; + this.vfModuleCreated = vrb.getVnfCreated(); + this.tenantId = vrb.getTenantId(); + this.cloudSiteId = vrb.getCloudSiteId(); + this.msoRequest = vrb.getMsoRequest(); + this.messageId = messageId; + this.mode = vrb.getMode(); + } + + public VfModuleRollback(String vnfId, String vfModuleId, + String vfModuleStackId, boolean vfModuleCreated, String tenantId, + String cloudSiteId, + MsoRequest msoRequest, + String messageId) { + super(); + this.vnfId = vnfId; + this.vfModuleId = vfModuleId; + this.vfModuleStackId = vfModuleStackId; + this.vfModuleCreated = vfModuleCreated; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.msoRequest = msoRequest; + this.messageId = messageId; + } + + public String getVnfId() { + return vnfId; + } + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + public String getVfModuleId() { + return vfModuleId; + } + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + public String getVfModuleStackId() { + return vfModuleStackId; + } + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + public boolean isVfModuleCreated() { + return vfModuleCreated; + } + public void setVfModuleCreated(boolean vfModuleCreated) { + this.vfModuleCreated = vfModuleCreated; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + public String getMessageId() { + return messageId; + } + public void setMessageId(String messageId) { + this.messageId = messageId; + } + public String getMode() { + return mode; + } + public void setMode(String mode) { + this.mode = mode; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfRequestCommon.java new file mode 100644 index 0000000000..f934bc63d8 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfRequestCommon.java @@ -0,0 +1,61 @@ +/*- + * ============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.adapters.vnfrest; + +import org.apache.commons.lang3.builder.ToStringBuilder; + + +/** + * Everything that is common between all VfModule and VolumeGroup Requests. + */ +public abstract class VfRequestCommon extends VfResponseCommon { + private Boolean skipAAI; + private String notificationUrl; + + public Boolean getSkipAAI() { + return skipAAI; + } + + public void setSkipAAI(Boolean skipAAI) { + this.skipAAI = skipAAI; + } + + public String getNotificationUrl() { + return notificationUrl; + } + + public void setNotificationUrl(String notificationUrl) { + this.notificationUrl = notificationUrl; + } + + public boolean isSynchronous() { + return notificationUrl == null || notificationUrl.isEmpty(); + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("skipAAI", skipAAI).append("notificationUrl", notificationUrl) + .toString(); + } + + // getMessageId, setMessageId, toJsonString, toJsonString are all defined in VfResponseCommon. +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java new file mode 100644 index 0000000000..2828ac3d43 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfResponseCommon.java @@ -0,0 +1,85 @@ +/*- + * ============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.adapters.vnfrest; + + +import java.io.ByteArrayOutputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * Everything that is common between all VfModule and VolumeGroup Responses, + * except for QueryVfModuleResponse and QueryVolumeGroupResponse. + */ +public abstract class VfResponseCommon { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VfResponseCommon.class); + private String messageId; + + public VfResponseCommon() { + messageId = null; + } + + public VfResponseCommon(String messageId) { + this.messageId = messageId; + } + + public String getMessageId() { + return messageId; + } + + public void setMessageId(String messageId) { + this.messageId = messageId; + } + + public String toJsonString() { + try { + String jsonString; + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + return jsonString; + } catch (Exception e) { + LOGGER.debug("Exception :",e); + return ""; + } + } + + public String toXmlString() { + try { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + JAXBContext context = JAXBContext.newInstance(this.getClass()); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML + marshaller.marshal(this, bs); + return bs.toString(); + } catch (Exception e) { + LOGGER.debug("Exception :",e); + return ""; + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupExceptionResponse.java new file mode 100644 index 0000000000..2e5801b4ae --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupExceptionResponse.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.openstack.exceptions.MsoExceptionCategory; + +@XmlRootElement(name = "volumeGroupException") +public class VolumeGroupExceptionResponse extends VfModuleExceptionResponse { + // Exactly the same as a VfModuleExceptionResponse + + private static final long serialVersionUID = 1168681288205898800L; + + public VolumeGroupExceptionResponse() { + super(); + } + + public VolumeGroupExceptionResponse(String message) { + super(message); + } + + public VolumeGroupExceptionResponse(String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { + super(message, category, rolledBack, messageid); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java new file mode 100644 index 0000000000..2795ba0de3 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnfrest; + + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonRootName; + +@JsonRootName("VolumeGroupRollback") +@XmlRootElement(name = "VolumeGroupRollback") +public class VolumeGroupRollback { +// “volumeGroupRollback”: { +// “volumeGroupId”: “”, +// “volumeGroupStackId”: “”, +// “tenantId”: “”, +// “cloudSiteId”: “”, +// “volumeGroupCreated”: TRUE|FALSE, +// “msoRequest”: { +// “requestId”: “”, +// “serviceInstanceId”: “” +// } +//}, + + private String volumeGroupId; + private String volumeGroupStackId; + private String tenantId; + private String cloudSiteId; + private boolean volumeGroupCreated = false; + private MsoRequest msoRequest; + private String messageId; + + public VolumeGroupRollback() { + } + + public VolumeGroupRollback(VolumeGroupRollback vrb, String volumeGroupStackId, String messageId) + { + this.volumeGroupId = vrb.getVolumeGroupId(); + this.volumeGroupStackId = volumeGroupStackId; + this.tenantId = vrb.getTenantId(); + this.cloudSiteId = vrb.getCloudSiteId(); + this.volumeGroupCreated = vrb.isVolumeGroupCreated(); + this.msoRequest = vrb.getMsoRequest(); + this.messageId = messageId; + } + + public VolumeGroupRollback( + String volumeGroupId, + String volumeGroupStackId, + boolean volumeGroupCreated, + String tenantId, + String cloudSiteId, + MsoRequest msoRequest, + String messageId) + { + super(); + this.volumeGroupId = volumeGroupId; + this.volumeGroupStackId = volumeGroupStackId; + this.volumeGroupCreated = volumeGroupCreated; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.msoRequest = msoRequest; + this.messageId = messageId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + public String getVolumeGroupStackId() { + return volumeGroupStackId; + } + public void setVolumeGroupStackId(String volumeGroupStackId) { + this.volumeGroupStackId = volumeGroupStackId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudSiteId) { + this.cloudSiteId = cloudSiteId; + } + public boolean isVolumeGroupCreated() { + return volumeGroupCreated; + } + public void setVolumeGroupCreated(boolean volumeGroupCreated) { + this.volumeGroupCreated = volumeGroupCreated; + } + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest(MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + public String getMessageId() { + return messageId; + } + public void setMessageId(String messageId) { + this.messageId = messageId; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java new file mode 100644 index 0000000000..dd68d37736 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HeatStatus.java @@ -0,0 +1,30 @@ +/*- + * ============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.openstack.beans; + + +/* + * Enum status values to mirror the Openstack Heat stack status values + */ +public enum HeatStatus { + INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java new file mode 100644 index 0000000000..228bb2c03d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/HostRoute.java @@ -0,0 +1,69 @@ +/*- + * ============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.openstack.beans; + + + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "prefix", + "nextHop" +}) +public class HostRoute { + + private String prefix; + private String nextHop; + + /** + * @return the prefix + */ + public String getPrefix() { + return prefix; + } + /** + * @param prefix the prefix to set + */ + public void setPrefix(String prefix) { + this.prefix = prefix; + } + /** + * @return the nextHop + */ + public String getNextHop() { + return nextHop; + } + /** + * @param nextHop the nextHop to set + */ + public void setNextHop(String nextHop) { + this.nextHop = nextHop; + } + + @Override + public String toString() { + return "Host_route [prefix=" + prefix + ", nextHop=" + nextHop + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java new file mode 100644 index 0000000000..b06ea0e59f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/MsoTenant.java @@ -0,0 +1,66 @@ +/*- + * ============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.openstack.beans; + + + +import java.util.Map; + +/** + * This bean class represents the Openstack tenant properties that are + * needed by MSO. + * + * + */ +public class MsoTenant { + private String tenantId; + private String tenantName; + private Map metadata; + + public MsoTenant() {} + + public MsoTenant (String id, String name, Map metadata) { + this.tenantId = id; + this.tenantName = name; + this.metadata = metadata; + } + + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getTenantName() { + return tenantName; + } + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public Map getMetadata() { + return metadata; + } + public void setMetadata(Map metadata) { + this.metadata = metadata; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java new file mode 100644 index 0000000000..6110fa5073 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkInfo.java @@ -0,0 +1,120 @@ +/*- + * ============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.openstack.beans; + + + +import java.util.ArrayList; +import java.util.List; + +/* + * This Java bean class relays Network details (including status) to ActiveVOS processes. + * + * This bean is returned by all Network-specific adapter operations (create, query, delete) + */ + +public class NetworkInfo { + // Set defaults for everything + private String name = ""; + private String id = ""; + private NetworkStatus status = NetworkStatus.UNKNOWN; + private String provider = ""; + private List vlans = new ArrayList<>(); + private List subnets = new ArrayList<>(); + private String shared = ""; + + public NetworkInfo () { + } + + public NetworkInfo (String name, NetworkStatus status) { + this.name = name; + this.id = name; // Don't have an ID, so just use name + this.status = status; + } + + public String getName() { + return name; + } + + public void setName (String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId (String id) { + this.id = id; + } + + public NetworkStatus getStatus() { + return status; + } + + public void setStatus (NetworkStatus status) { + this.status = status; + } + + public String getProvider() { + return provider; + } + + public void setProvider (String provider) { + this.provider = provider; + } + + public List getVlans () { + return vlans; + } + + public void setVlans (List vlans) { + this.vlans = vlans; + } + + public List getSubnets () { + return subnets; + } + + public void setSubnets (List subnets) { + this.subnets = subnets; + } + + public String getShared() { + return shared; + } + + public void setShared(String shared) { + this.shared = shared; + } + + @Override + public String toString() { + return "NetworkInfo{" + "name='" + name + '\'' + + ", id='" + id + '\'' + + ", status=" + status + + ", provider='" + provider + '\'' + + ", vlans=" + vlans + + ", subnets=" + subnets + + '}'; + } +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java new file mode 100644 index 0000000000..e95c564f27 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkRollback.java @@ -0,0 +1,157 @@ +/*- + * ============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.openstack.beans; + + +import java.io.Serializable; +import java.util.List; + +import org.onap.so.entity.MsoRequest; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +/** + * Javabean representing the rollback criteria following a "Create Network" + * or "Update Network" operation. This structure can be passed back to the + * "Rollback Network" operation to undo the effects of the create/update. + * + * Once a network is created, the only possible update through MSO is to + * the set of VLANs supported by the network. The vlans attribute of the + * rollback object contains the previous VLANs before update. + * + * + */ +@JsonInclude(Include.NON_EMPTY) +public class NetworkRollback implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 11949663223019185L; + private String networkId; + private String neutronNetworkId; + private String networkStackId; + private String tenantId; + private String cloudId; + private String networkType; + private String modelCustomizationUuid; + private boolean networkCreated = false; + // Previous values for updates + private String networkName = null; + private String physicalNetwork = null; + private List vlans = null; + private MsoRequest msoRequest; + + public String getNetworkId() { + return networkId; + } + public void setNetworkId(String networkId) { + this.networkId = networkId; + } + + public String getNeutronNetworkId() { + return neutronNetworkId; + } + public void setNeutronNetworkId(String neutronNetworkId) { + this.neutronNetworkId = neutronNetworkId; + } + + public String getNetworkStackId() { + return networkStackId; + } + public void setNetworkStackId(String networkStackId) { + this.networkStackId = networkStackId; + } + public String getTenantId() { + return tenantId; + } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getCloudId() { + return cloudId; + } + public void setCloudId(String cloudId) { + this.cloudId = cloudId; + } + + public String getNetworkType() { + return networkType; + } + public void setNetworkType(String networkType) { + this.networkType = networkType; + } + + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + + public boolean getNetworkCreated() { + return networkCreated; + } + public void setNetworkCreated(boolean networkCreated) { + this.networkCreated = networkCreated; + } + + public String getNetworkName() { + return networkName; + } + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public String getPhysicalNetwork() { + return physicalNetwork; + } + public void setPhysicalNetwork(String physicalNetwork) { + this.physicalNetwork = physicalNetwork; + } + + public List getVlans () { + return vlans; + } + public void setVlans (List vlans) { + this.vlans = vlans; + } + + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest (MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + + @Override + public String toString() { + return "NetworkRollback [networkId=" + networkId + + ", neutronNetworkId=" + neutronNetworkId + ", networkStackId=" + + networkStackId + ", tenantId=" + tenantId + ", cloudId=" + + cloudId + ", networkType=" + networkType + + ", networkCreated=" + networkCreated + ", networkName=" + networkName + + ", physicalNetwork=" + physicalNetwork + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.java new file mode 100644 index 0000000000..b7b1366562 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/NetworkStatus.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.openstack.beans; + + +/** + * Enum status values to mirror the Openstack Neutron + * network status values + */ +public enum NetworkStatus { + NOTFOUND, ACTIVE, DOWN, BUILD, ERROR, UNKNOWN +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.java new file mode 100644 index 0000000000..1c82907f80 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Pool.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.openstack.beans; + + + + + +public class Pool { + + private String start; + private String end; + + /** + * @return the start + */ + public String getStart() { + return start; + } + /** + * @param start the start to set + */ + public void setStart(String start) { + this.start = start; + } + /** + * @return the end + */ + public String getEnd() { + return end; + } + /** + * @param end the end to set + */ + public void setEnd(String end) { + this.end = end; + } + + @Override + public String toString() { + return "Allocation_pool [start=" + start + ", end=" + end + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.java new file mode 100644 index 0000000000..fcea8796c2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/RouteTarget.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.openstack.beans; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "routeTarget", + "routeTargetRole" +}) +public class RouteTarget implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = 5425083030715789604L; + private String routeTarget; + private String routeTargetRole; + + public String getRouteTarget() { + return routeTarget; + } + public void setRouteTarget(String routeTarget) { + this.routeTarget = routeTarget; + } + public String getRouteTargetRole() { + return routeTargetRole; + } + public void setRouteTargetRole(String routeTargetRole) { + this.routeTargetRole = routeTargetRole; + } + + + @Override + public String toString() { + return "RouteTarget [routeTarget=" + routeTarget + ", routeTargetRole=" + routeTargetRole + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java new file mode 100644 index 0000000000..028ec9ec8d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/StackInfo.java @@ -0,0 +1,109 @@ +/*- + * ============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.openstack.beans; + + +import java.util.HashMap; +import java.util.Map; + +/* + * This Java bean class relays Heat stack status information to ActiveVOS processes. + * + * This bean is returned by all Heat-specific adapter operations (create, query, delete) + */ + +public class StackInfo { + // Set defaults for everything + private String name = ""; + private String canonicalName = ""; + private HeatStatus status = HeatStatus.UNKNOWN; + private String statusMessage = ""; + private Map outputs = new HashMap<>(); + private Map parameters = new HashMap<>(); + + public StackInfo () { + } + + public StackInfo (String name, HeatStatus status, String statusMessage, Map outputs) { + this.name = name; + this.canonicalName = name; // Don't have an ID, so just use name + + this.status = status; + if (statusMessage != null) this.statusMessage = statusMessage; + if (outputs != null) this.outputs = outputs; + } + + public StackInfo (String name, HeatStatus status) { + this.name = name; + this.canonicalName = name; // Don't have an ID, so just use name + this.status = status; + } + + public String getName() { + return name; + } + + public void setName (String name) { + this.name = name; + } + + public String getCanonicalName() { + return canonicalName; + } + + public void setCanonicalName (String name) { + this.canonicalName = name; + } + + public HeatStatus getStatus() { + return status; + } + + public void setStatus (HeatStatus status) { + this.status = status; + } + + public String getStatusMessage() { + return statusMessage; + } + + public void setStatusMessage (String statusMessage) { + this.statusMessage = statusMessage; + } + + public Map getOutputs () { + return outputs; + } + + public void setOutputs (Map outputs) { + this.outputs = outputs; + } + + public Map getParameters () { + return parameters; + } + + public void setParameters (Map parameters) { + this.parameters = parameters; + } + +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java new file mode 100644 index 0000000000..3213323101 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/Subnet.java @@ -0,0 +1,213 @@ +/*- + * ============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.openstack.beans; + + + +import java.io.Serializable; +import java.util.List; + +import javax.xml.bind.annotation.XmlTransient; + +public class Subnet implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -530027355187604839L; + + private String subnetName; + + private String neutronId; + + private String subnetId; // value from aai + + private String cidr; //Only field required + + private String gatewayIp; + + private String ipVersion="4"; + + private Boolean enableDHCP=false; + + private Boolean addrFromStart=true; + + private List hostRoutes; + + private List allocationPools; + + private List dnsNameServers; + + public Subnet () { + } + + public String getSubnetName() { + return subnetName; + } + + public void setSubnetName(String subnetName) { + this.subnetName = subnetName; + } + + public List getAllocationPools() { + return allocationPools; + } + + /** + * @return the cidr + */ + public String getCidr() { + return cidr; + } + + /** + * @return the dnsNames + */ + public List getDnsNameServers() { + return dnsNameServers; + } + + + public Boolean getEnableDHCP() { + return enableDHCP; + } + + public Boolean getAddrFromStart() { + return addrFromStart; + } + + public void setAddrFromStart(Boolean addrFromStart) { + this.addrFromStart = addrFromStart; + } + + /** + * @return the gw + */ + public String getGatewayIp() { + return gatewayIp; + } + + /** + * @return the hostRoutes + */ + public List getHostRoutes() { + return hostRoutes; + } + + /** + * @return the NeutronId + */ + @XmlTransient + public String getNeutronId() { + return neutronId; + } + + /** + * @return the ipversion + */ + public String getIpVersion() { + return ipVersion; + } + + /** + * @return the name + */ + public String getSubnetId() { + return subnetId; + } + + public void setAllocationPools(List allocationPools) { + this.allocationPools = allocationPools; + } + + /** + * @param cidr + * the cidr to set + */ + public void setCidr(String cidr) { + this.cidr = cidr; + } + + /** + * @param dnsNames + * the dnsNames to set + */ + public void setDnsNameServers(List dnsNameServers) { + this.dnsNameServers = dnsNameServers; + } + + /** + * @param enableDHCP + * the enableDHCP to set + */ + public void setEnableDHCP(Boolean enableDHCP) { + this.enableDHCP = enableDHCP; + } + + /** + * @param gw + * the gw to set + */ + public void setGatewayIp(String gatewayIp) { + this.gatewayIp = gatewayIp; + } + + /** + * @param hostRoutes + * the hostRoutes to set + */ + public void setHostRoutes(List hostRoutes) { + this.hostRoutes = hostRoutes; + } + + /** + * @param neutronId + * the id to set + */ + public void setNeutronId(String neutronId) { + this.neutronId = neutronId; + } + + /** + * @param ipversion + * the ipversion to set + */ + public void setIpVersion(String ipVersion) { + this.ipVersion = ipVersion; + } + + /** + * @param name + * the name to set + */ + public void setSubnetId(String subnetId) { + this.subnetId = subnetId; + } + + @Override + public String toString() { + return "Subnet [subnetName=" + subnetName + ", neutronId=" + neutronId + ", subnetId=" + subnetId + ", cidr=" + + cidr + ", gatewayIp=" + gatewayIp + ", ipVersion=" + ipVersion + ", enableDHCP=" + enableDHCP + + ", addrFromStart=" + addrFromStart + ", hostRoutes=" + hostRoutes + ", allocationPools=" + + allocationPools + ", dnsNameServers=" + dnsNameServers + "]"; + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java new file mode 100644 index 0000000000..ba7f6532e1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java @@ -0,0 +1,213 @@ +/*- + * ============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.openstack.beans; + +import org.onap.so.entity.MsoRequest; +/** + * Javabean representing the rollback criteria following a "Create VNF" + * operation. This structure can be passed back to the "Rollback VNF" + * operation to undo the effects of the create. + * + * + */ +public class VnfRollback { + private String vnfId; + private String tenantId; + private String cloudSiteId; + private boolean tenantCreated = false; + private boolean vnfCreated = false; + private MsoRequest msoRequest; + private String volumeGroupName; + private String volumeGroupId; + private String requestType; + private String volumeGroupHeatStackId; + private String baseGroupHeatStackId; + private boolean isBase = false; + private String vfModuleStackId; + private String modelCustomizationUuid; //NOTE: this is the vfModule's modelCustomizationUuid + private String mode = "HEAT"; + + public VnfRollback() {} + + /** + * For backwards compatibility... orchestration mode defaults to HEAT + * + * @param vnfId + * @param tenantId + * @param cloudSiteId + * @param tenantCreated + * @param vnfCreated + * @param msoRequest + * @param volumeGroupName + * @param volumeGroupId + * @param requestType + * @param modelCustomizationUuid + */ + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, + boolean tenantCreated, boolean vnfCreated, + MsoRequest msoRequest, + String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) { + super(); + this.vnfId = vnfId; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.tenantCreated = tenantCreated; + this.vnfCreated = vnfCreated; + this.msoRequest = msoRequest; + this.volumeGroupName = volumeGroupName; + this.volumeGroupId = volumeGroupId; + this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; + } + + /** + * + * @param vnfId + * @param tenantId + * @param cloudSiteId + * @param tenantCreated + * @param vnfCreated + * @param msoRequest + * @param volumeGroupName + * @param volumeGroupId + * @param requestType + * @param modelCustomizationUuid + */ + public VnfRollback(String vnfId, String tenantId, String cloudSiteId, + boolean tenantCreated, boolean vnfCreated, + MsoRequest msoRequest, String volumeGroupName, String volumeGroupId, + String requestType, String modelCustomizationUuid, String orchestrationMode) { + super(); + this.vnfId = vnfId; + this.tenantId = tenantId; + this.cloudSiteId = cloudSiteId; + this.tenantCreated = tenantCreated; + this.vnfCreated = vnfCreated; + this.msoRequest = msoRequest; + this.volumeGroupName = volumeGroupName; + this.volumeGroupId = volumeGroupId; + this.requestType = requestType; + this.modelCustomizationUuid = modelCustomizationUuid; + this.mode = orchestrationMode; + } + + public String getVnfId() { + return vnfId; + } + public void setVnfId(String vnfId) { + this.vnfId = vnfId; + } + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getCloudSiteId() { + return cloudSiteId; + } + public void setCloudSiteId(String cloudId) { + this.cloudSiteId = cloudId; + } + public boolean getTenantCreated() { + return tenantCreated; + } + public void setTenantCreated(boolean tenantCreated) { + this.tenantCreated = tenantCreated; + } + public boolean getVnfCreated() { + return vnfCreated; + } + public void setVnfCreated(boolean vnfCreated) { + this.vnfCreated = vnfCreated; + } + public MsoRequest getMsoRequest() { + return msoRequest; + } + public void setMsoRequest (MsoRequest msoRequest) { + this.msoRequest = msoRequest; + } + public String getVolumeGroupName() { + return this.volumeGroupName; + } + public void setVolumeGroupName(String volumeGroupName) { + this.volumeGroupName = volumeGroupName; + } + public String getVolumeGroupId() { + return this.volumeGroupId; + } + public void setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + } + public String getRequestType() { + return this.requestType; + } + public void setRequestType(String requestType) { + this.requestType = requestType; + } + public String getVolumeGroupHeatStackId() { + return this.volumeGroupHeatStackId; + } + public void setVolumeGroupHeatStackId(String volumeGroupHeatStackId) { + this.volumeGroupHeatStackId = volumeGroupHeatStackId; + } + + public String getBaseGroupHeatStackId() { + return this.baseGroupHeatStackId; + } + public void setBaseGroupHeatStackId(String baseGroupHeatStackId) { + this.baseGroupHeatStackId = baseGroupHeatStackId; + } + + public boolean isBase() { + return this.isBase; + } + public void setIsBase(boolean isBase) { + this.isBase = isBase; + } + public String getVfModuleStackId() { + return this.vfModuleStackId; + } + public void setVfModuleStackId(String vfModuleStackId) { + this.vfModuleStackId = vfModuleStackId; + } + public String getModelCustomizationUuid() { + return this.modelCustomizationUuid; + } + public void setModelCustomizationUuid(String modelCustomizationUuid) { + this.modelCustomizationUuid = modelCustomizationUuid; + } + public String getMode() { + return this.mode; + } + public void setMode(String mode) { + this.mode = mode; + } + @Override + public String toString() { + return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId + + ", vnf=" + vnfId + ", tenantCreated=" + tenantCreated + + ", vnfCreated=" + vnfCreated + ", requestType = " + requestType + + ", modelCustomizationUuid=" + this.modelCustomizationUuid + + ", mode=" + mode; + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java new file mode 100644 index 0000000000..9f1ae8813d --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfStatus.java @@ -0,0 +1,30 @@ +/*- + * ============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.openstack.beans; + + +/* + * Enum status values to mirror the Openstack Heat stack status values + */ +public enum VnfStatus { + ACTIVE, FAILED, NOTFOUND, UNKNOWN +} + diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java new file mode 100644 index 0000000000..31c4727934 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoAdapterException.java @@ -0,0 +1,45 @@ +/*- + * ============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.openstack.exceptions; + + + +/** + * General MSO Exception class for any non-specific errors. + * + * + */ +public class MsoAdapterException extends MsoException +{ + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoException instance + public MsoAdapterException (String message) { + super(message); + super.category = MsoExceptionCategory.INTERNAL; + } + + // Constructor to wrap a nested exception + public MsoAdapterException (String message, Throwable t) { + super(message, t); + super.category = MsoExceptionCategory.INTERNAL; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java new file mode 100644 index 0000000000..31f3f6f7dd --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFound.java @@ -0,0 +1,56 @@ +/*- + * ============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.openstack.exceptions; + + +/** + * Cloud site not found exception. + */ +public class MsoCloudIdentityNotFound extends MsoException { + + /** + * Serialization id. + */ + private static final long serialVersionUID = 2583769056266415665L; + + /** + * Default constructor (needed for BPEL/JAXB) + */ + public MsoCloudIdentityNotFound () { + super("Cloud Identity not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + /** + * Constructor to create a new MsoOpenstackException instance + * @param cloudSite the cloud site + */ + public MsoCloudIdentityNotFound (String cloudIdentity) { + // Set the detailed error as the Exception 'message' + super("Cloud Identity [" + cloudIdentity + "] not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + @Override + public String toString () { + return getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java new file mode 100644 index 0000000000..ceb08d8ccb --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFound.java @@ -0,0 +1,56 @@ +/*- + * ============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.openstack.exceptions; + + +/** + * Cloud site not found exception. + */ +public class MsoCloudSiteNotFound extends MsoException { + + /** + * Serialization id. + */ + private static final long serialVersionUID = 2583769056266415664L; + + /** + * Default constructor (needed for BPEL/JAXB) + */ + public MsoCloudSiteNotFound () { + super("Cloud site not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + /** + * Constructor to create a new MsoOpenstackException instance + * @param cloudSite the cloud site + */ + public MsoCloudSiteNotFound (String cloudSite) { + // Set the detailed error as the Exception 'message' + super("Cloud Site [" + cloudSite + "] not found"); + super.category=MsoExceptionCategory.USERDATA; + } + + @Override + public String toString () { + return getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java new file mode 100644 index 0000000000..625914e820 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoException.java @@ -0,0 +1,66 @@ +/*- + * ============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.openstack.exceptions; + + + +public abstract class MsoException extends Exception +{ + private static final long serialVersionUID = 1L; + + protected MsoExceptionCategory category = MsoExceptionCategory.INTERNAL; + protected String context = null; + + protected MsoException (String message) { + super(message); + } + + protected MsoException (String message, Throwable t) { + super(message,t); + } + + public MsoExceptionCategory getCategory() { + return category; + } + public void setCategory (MsoExceptionCategory category) { + this.category = category; + } + + public String getContext () { + return context; + } + public void setContext (String context) { + this.context = context; + } + public void addContext (String ctx) { + if (this.context != null) + this.context = ctx + ":" + this.context; + else + this.context = ctx; + } + + public String getContextMessage () { + if (this.context == null) + return getMessage(); + else + return "[" + context + "] " + getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java new file mode 100644 index 0000000000..ed57488301 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoExceptionCategory.java @@ -0,0 +1,27 @@ +/*- + * ============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.openstack.exceptions; + + + +public enum MsoExceptionCategory { + OPENSTACK, IO, INTERNAL, USERDATA +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java new file mode 100644 index 0000000000..dda7384d9e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoHeatNotFoundException.java @@ -0,0 +1,54 @@ +/*- + * ============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.openstack.exceptions; + +/** + * MSO Heat not found exception. + */ +public class MsoHeatNotFoundException extends MsoException { + /** + * Serialization id. + */ + private static final long serialVersionUID = 6547134336163166841L; + + /** + * Default constructor (needed for BPEL/JAXB) + */ + public MsoHeatNotFoundException() { + super("Heat not found"); + super.category = MsoExceptionCategory.USERDATA; + } + + /** + * Constructor to create a new MsoHeatNotFoundException instance + * @param heat the heat parameter + */ + public MsoHeatNotFoundException(String heat) { + // Set the detailed error as the Exception 'message' + super("Heat [" + heat + "] not found"); + super.category = MsoExceptionCategory.USERDATA; + } + + @Override + public String toString() { + return getMessage(); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java new file mode 100644 index 0000000000..35f2445d41 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoIOException.java @@ -0,0 +1,53 @@ +/*- + * ============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.openstack.exceptions; + + +/** + * I/O exception + */ +public class MsoIOException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 6752445132721635760L; + + /** + * Basic constructor with message + * @param message the error message + */ + public MsoIOException (String message) { + super(message); + super.category = MsoExceptionCategory.IO; + } + + /** + * Constructor to wrap a nested exception + * @param message the error message + * @param t the cause + */ + public MsoIOException (String message, Throwable t) { + super (message, t); + super.category = MsoExceptionCategory.IO; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java new file mode 100644 index 0000000000..dd7817d310 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExists.java @@ -0,0 +1,35 @@ +/*- + * ============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.openstack.exceptions; + + + +public class MsoNetworkAlreadyExists extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoNetworkAlreadyExists (String stack, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Stack " + stack + " already exists in Tenant " + tenant + " in Cloud " + cloud); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java new file mode 100644 index 0000000000..7306142cd0 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoNetworkNotFound.java @@ -0,0 +1,35 @@ +/*- + * ============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.openstack.exceptions; + + + +public class MsoNetworkNotFound extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoNetworkNotFound (String networkId, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(404, "Not Found", "Network " + networkId + " does not exist in Cloud/Tenant " + cloud + "/" + tenant); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java new file mode 100644 index 0000000000..1410650dd2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoOpenstackException.java @@ -0,0 +1,80 @@ +/*- + * ============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.openstack.exceptions; + + +/** + * OpenStack exception. + */ +public class MsoOpenstackException extends MsoException +{ + + /** + * Serialization id. + */ + private static final long serialVersionUID = 3313636124141766495L; + + private int statusCode; + private String statusMessage; + private String errorDetail; + + /** + * Constructor to create a new MsoOpenstackException instance + * @param code the error code + * @param message the error message + * @param detail error details + */ + public MsoOpenstackException (int code, String message, String detail) { + // Set the detailed error as the Exception 'message' + super(detail); + super.category = MsoExceptionCategory.OPENSTACK; + + this.statusCode = code; + this.statusMessage = message; + this.errorDetail = detail; + } + + /** + * Constructor to propagate the caught exception (mostly for stack trace) + * @param code the error code + * @param message the error message + * @param detail error details + * @param e the cause + */ + public MsoOpenstackException (int code, String message, String detail, Exception e) { + // Set the detailed error as the Exception 'message' + super(detail, e); + super.category = MsoExceptionCategory.OPENSTACK; + + this.statusCode = code; + this.statusMessage = message; + this.errorDetail = detail; + } + + @Override + public String toString() { + return statusCode + + " " + + statusMessage + + ": " + + errorDetail; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java new file mode 100644 index 0000000000..fc98ee95ed --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExists.java @@ -0,0 +1,35 @@ +/*- + * ============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.openstack.exceptions; + + + +public class MsoStackAlreadyExists extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoStackAlreadyExists (String stack, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Stack " + stack + " already exists in Tenant " + tenant + " in Cloud " + cloud); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java new file mode 100644 index 0000000000..1cd6b9650a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoStackNotFound.java @@ -0,0 +1,44 @@ +/*- + * ============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.openstack.exceptions; + + +/** + * Thrown when HEAT stack is not found or deleted. + */ +public class MsoStackNotFound extends MsoOpenstackException { + + /** + * Serialization id. + */ + private static final long serialVersionUID = 7354069716354359246L; + + /** + * Constructor to create a new MsoOpenstackException instance. + * @param stack the stack name + * @param tenant the tenant name + * @param cloud the cloud name + */ + public MsoStackNotFound (String stack, String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(404, "Not Found", "Stack " + stack + " does not exist in Cloud/Tenant " + cloud + "/" + tenant); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java new file mode 100644 index 0000000000..5da32847b1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExists.java @@ -0,0 +1,35 @@ +/*- + * ============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.openstack.exceptions; + + + +public class MsoTenantAlreadyExists extends MsoOpenstackException { + + private static final long serialVersionUID = 1L; + + // Constructor to create a new MsoOpenstackException instance + public MsoTenantAlreadyExists (String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(409, "Conflict", "Tenant " + tenant + " already exists in Cloud " + cloud); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java new file mode 100644 index 0000000000..9b135b61b2 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/exceptions/MsoTenantNotFound.java @@ -0,0 +1,43 @@ +/*- + * ============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.openstack.exceptions; + + +/** + * Tenant not found exception. + */ +public class MsoTenantNotFound extends MsoOpenstackException { + + /** + * Serialization id. + */ + private static final long serialVersionUID = 5640069939645577063L; + + /** + * Constructor to create the exception + * @param tenant the tenant id + * @param cloud the cloud id + */ + public MsoTenantNotFound (String tenant, String cloud) { + // Set the detailed error as the Exception 'message' + super(404, "Not Found", "Tenant " + tenant + " does not exist in Cloud " + cloud); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java new file mode 100644 index 0000000000..aa0f17810e --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/NetworkInfoMapper.java @@ -0,0 +1,107 @@ +/*- + * ============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.openstack.mappers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.javatuples.Pair; +import org.onap.so.openstack.beans.NetworkInfo; +import org.onap.so.openstack.beans.NetworkStatus; + +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Segment; + +public class NetworkInfoMapper { + + private final Network network; + private final Map networkStatusMap = new HashMap<>(); + + public NetworkInfoMapper(Network network) { + this.network = network; + configureNetworkStatusMap(); + } + + /** + * Capture the data from a Neutron Network object. + * + * For MSO, there are assumptions regarding all networks. + * - Everything will be a provider network + * - All provider networks are VLANs + * - Multiple VLANs are supported, and indicated by multi-provider segments. + * Each will have the same physical network & network type "vlan". + * + * @param network + */ + public NetworkInfo map() { + final NetworkInfo info = new NetworkInfo(); + if (network == null) { + info.setStatus(NetworkStatus.NOTFOUND); + } else { + info.setName(network.getName()); + info.setId(network.getId()); + info.setStatus(this.mapStatus(network.getStatus())); + Pair, List> result = locateVlanInformation(network); + Optional value0 = result.getValue0(); + if (value0.isPresent()) { + info.setProvider(value0.get()); + } + info.setVlans(result.getValue1()); + info.setSubnets(network.getSubnets()); + } + return info; + } + + protected NetworkStatus mapStatus(String status) { + return networkStatusMap.getOrDefault(status, NetworkStatus.UNKNOWN); + } + + protected Pair, List> locateVlanInformation(Network network) { + final List vlans = new ArrayList<>(); + Optional provider = Optional.empty(); + if (network.getProviderPhysicalNetwork() != null) { + provider = Optional.ofNullable(network.getProviderPhysicalNetwork()); + if ("vlan".equals(network.getProviderNetworkType())) { + vlans.add(network.getProviderSegmentationId()); + } + } else if (network.getSegments() != null && !network.getSegments().isEmpty()) { + Segment s = network.getSegments().get(0); + provider = Optional.ofNullable(s.getProviderPhysicalNetwork()); + if ("vlan".equals(s.getProviderNetworkType())) { + for (Segment s1 : network.getSegments()) { + vlans.add(s1.getProviderSegmentationId()); + } + } + } + + return Pair.with(provider, vlans); + } + + private void configureNetworkStatusMap() { + networkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE); + networkStatusMap.put("DOWN", NetworkStatus.DOWN); + networkStatusMap.put("BUILD", NetworkStatus.BUILD); + networkStatusMap.put("ERROR", NetworkStatus.ERROR); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java new file mode 100644 index 0000000000..85fd6cc279 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/mappers/StackInfoMapper.java @@ -0,0 +1,99 @@ +/*- + * ============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.openstack.mappers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; + +import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.heat.model.Stack.Output; + +public class StackInfoMapper { + + private final Stack stack; + private final Map heatStatusMap = new HashMap<>(); + public StackInfoMapper(Stack stack) { + this.stack = stack; + configureHeatStatusMap(); + } + + public StackInfo map() { + final StackInfo info = new StackInfo(); + if (stack == null) { + info.setStatus(HeatStatus.NOTFOUND); + } else { + info.setName(stack.getStackName()); + info.setCanonicalName(stack.getStackName() + "/" + stack.getId()); + info.setStatus(this.mapStatus(stack.getStackStatus())); + + info.setStatusMessage(stack.getStackStatusReason()); + + Optional> result = this.mapOutputToMap(stack.getOutputs()); + if (result.isPresent()) { + info.setOutputs(result.get()); + } + + info.setParameters(stack.getParameters()); + } + + return info; + } + + protected HeatStatus mapStatus(String status) { + final HeatStatus result; + if (status == null) { + result = HeatStatus.INIT; + } else { + result = heatStatusMap.getOrDefault(status, HeatStatus.UNKNOWN); + } + + return result; + } + + protected Optional> mapOutputToMap(List outputs) { + Optional> result = Optional.empty(); + if (outputs != null) { + final HashMap map = new HashMap<>(); + for (Output output : outputs) { + map.put(output.getOutputKey(), output.getOutputValue()); + } + result = Optional.of(map); + } + + return result; + } + private void configureHeatStatusMap() { + heatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING); + heatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED); + heatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED); + heatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING); + heatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND); + heatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED); + heatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING); + heatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED); + heatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java deleted file mode 100644 index 5bb1dacb4a..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapDeserializer.java +++ /dev/null @@ -1,67 +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.openecomp.mso.adapters.json; - -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.JsonDeserializer; -import org.codehaus.jackson.map.ObjectMapper; - -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Custom JSON Deserializer for Map. - * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as - * follows: - *

- * "params": {
- *   "entry": [
- *     {"key": "P1", "value": "V1"},
- *     {"key": "P2", "value": "V2"},
- *     ...
- *     {"key": "PN", "value": "VN"}
- *   ]
- * }
- * The implementation uses a LinkedHashMap to preserve the ordering of entries.
- * 
- */ -public class MapDeserializer extends JsonDeserializer> { - - @Override - public Map deserialize(JsonParser parser, - DeserializationContext context) throws IOException { - ObjectMapper mapper = new ObjectMapper(); - JsonNode tree = mapper.readTree(parser); - Map map = new LinkedHashMap<>(); - if (tree == null) - return map; - for (JsonNode element : tree) { - for (JsonNode arrayElement : element) { - String key = arrayElement.get("key").getTextValue(); - String value = arrayElement.get("value").getTextValue(); - map.put(key, value); - } - } - return map; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java deleted file mode 100644 index 3e9f5c6b58..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/json/MapSerializer.java +++ /dev/null @@ -1,63 +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.openecomp.mso.adapters.json; - -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.JsonSerializer; -import org.codehaus.jackson.map.SerializerProvider; - -import java.io.IOException; -import java.util.Map; - -/** - * Custom JSON Serializer for Map. - * In MSO with Jackson 1.9.12 and RestEasy 3.0.8, maps in JSON are serialized as - * follows: - *
- * "params": {
- *   "entry": [
- *     {"key": "P1", "value": "V1"},
- *     {"key": "P2", "value": "V2"},
- *     ...
- *     {"key": "PN", "value": "VN"}
- *   ]
- * }
- * 
- * The implementation uses a TreeMap, so entries are always sorted according - * to the natural ordering of the keys. - */ -public class MapSerializer extends JsonSerializer> { - @Override - public void serialize(Map map, JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeStartObject(); - jsonGenerator.writeArrayFieldStart("entry"); - for (Map.Entry entry : map.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - jsonGenerator.writeStartObject(); - jsonGenerator.writeStringField("key", key); - jsonGenerator.writeStringField("value", value); - jsonGenerator.writeEndObject(); - } - jsonGenerator.writeEndArray(); - jsonGenerator.writeEndObject(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java deleted file mode 100644 index 60684a3599..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ContrailNetwork.java +++ /dev/null @@ -1,90 +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.openecomp.mso.adapters.nwrest; - - -import java.util.List; -import org.openecomp.mso.openstack.beans.RouteTarget; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("contrailNetwork") -public class ContrailNetwork { - private String shared = "false"; - private String external = "false"; - private List routeTargets; - private List policyFqdns; - private List routeTableFqdns; - - public ContrailNetwork() { - super(); - } - - public ContrailNetwork(String shared, String external, List routeTargets, List policyFqdns, List routeTableFqdns) { - super(); - this.shared = shared; - this.external = external; - this.routeTargets = routeTargets; - this.policyFqdns = policyFqdns; - this.routeTableFqdns = routeTableFqdns; - } - - public String getShared() { - return shared; - } - - public void setShared(String shared) { - this.shared = shared; - } - - public String getExternal() { - return external; - } - - public void setExternal(String external) { - this.external = external; - } - - public List getRouteTargets() { - return routeTargets; - } - - public void setRouteTargets(List routeTargets) { - this.routeTargets = routeTargets; - } - - public List getPolicyFqdns() { - return policyFqdns; - } - - public void setPolicyFqdns(List policyFqdns) { - this.policyFqdns = policyFqdns; - } - - public List getRouteTableFqdns() { - return routeTableFqdns; - } - - public void setRouteTableFqdns(List routeTableFqdns) { - this.routeTableFqdns = routeTableFqdns; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java deleted file mode 100644 index 4b105cce92..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkError.java +++ /dev/null @@ -1,45 +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.openecomp.mso.adapters.nwrest; - - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "createNetworkError") -public class CreateNetworkError extends NetworkExceptionResponse implements Serializable { - private static final long serialVersionUID = -4283402447149144456L; - - public CreateNetworkError() { - super(""); - } - - public CreateNetworkError(String message) { - super(message); - } - - public CreateNetworkError(String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { - super(message, category, rolledBack, messageid); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java deleted file mode 100644 index 4c2cc36c83..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkRequest.java +++ /dev/null @@ -1,196 +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.openecomp.mso.adapters.nwrest; - - - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.Subnet; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - - -/* README - Map elements when marshalled to XML produce a list of ${key}${value} elements. - When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. -*/ -@JsonRootName("createNetworkRequest") -@XmlRootElement(name = "createNetworkRequest") -public class CreateNetworkRequest extends NetworkRequestCommon { - private String cloudSiteId; - private String tenantId; - private String networkId; - private String networkName; - private String networkType; - private String networkTypeVersion; - private String modelCustomizationUuid; - private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON; - private List subnets; - private ProviderVlanNetwork providerVlanNetwork; - private ContrailNetwork contrailNetwork; - private Boolean failIfExists = false; - private Boolean backout = true; - private Map networkParams = new HashMap<>(); - private MsoRequest msoRequest = new MsoRequest(); - @JsonProperty - private boolean contrailRequest; - - public CreateNetworkRequest() { - super(); - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - 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 getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public String getNetworkTypeVersion() { - return networkTypeVersion; - } - - public void setNetworkTypeVersion(String networkTypeVersion) { - this.networkTypeVersion = networkTypeVersion; - } - - public String getNetworkTechnology() { - return networkTechnology.toString(); - } - - public void setNetworkTechnology(String networkTechnology) { - this.networkTechnology = NetworkTechnology.valueOf(networkTechnology); - } - - public List getSubnets() { - return subnets; - } - - public void setSubnets(List subnets) { - this.subnets = subnets; - } - - public ProviderVlanNetwork getProviderVlanNetwork() { - return providerVlanNetwork; - } - - public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) { - this.providerVlanNetwork = providerVlanNetwork; - } - - public ContrailNetwork getContrailNetwork() { - return contrailNetwork; - } - - public void setContrailNetwork(ContrailNetwork contrailNetwork) { - this.contrailNetwork = contrailNetwork; - } - - public Boolean getFailIfExists() { - return failIfExists; - } - - public void setFailIfExists(Boolean failIfExists) { - this.failIfExists = failIfExists; - } - - public Boolean getBackout() { - return backout; - } - - public void setBackout(Boolean backout) { - this.backout = backout; - } - - public Map getNetworkParams() { - return networkParams; - } - - public void setNetworkParams(Map networkParams) { - this.networkParams = networkParams; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - - public boolean isContrailRequest() { - return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null); - } - - @JsonIgnore - public void setContrailRequest(boolean contrailRequest) { - this.contrailRequest = contrailRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java deleted file mode 100644 index 6db7661905..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/CreateNetworkResponse.java +++ /dev/null @@ -1,122 +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.openecomp.mso.adapters.nwrest; - - - -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.beans.NetworkRollback; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("createNetworkResponse") -@XmlRootElement(name = "createNetworkResponse") - -public class CreateNetworkResponse extends NetworkResponseCommon { - private String networkId; - private String neutronNetworkId; - private String networkStackId; - private String networkFqdn; - private Boolean networkCreated; - private Map subnetMap; - private NetworkRollback rollback = new NetworkRollback(); - - public CreateNetworkResponse() { - super(); - } - - public CreateNetworkResponse(String networkId, - String neutronNetworkId, - String networkStackId, - String networkFqdn, - Boolean networkCreated, - Map subnetIdMap, - NetworkRollback rollback, - String messageId) { - super(messageId); - this.networkId = networkId; - this.neutronNetworkId = neutronNetworkId; - this.networkStackId = networkStackId; - this.networkFqdn = networkFqdn; - this.networkCreated = networkCreated; - this.subnetMap = subnetIdMap; - this.rollback = rollback; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - - public String getNetworkStackId() { - return networkStackId; - } - - public void setNetworkStackId(String networkStackId) { - this.networkStackId = networkStackId; - } - - public String getNetworkFqdn() { - return networkFqdn; - } - - public void setNetworkFqdn(String networkFqdn) { - this.networkFqdn = networkFqdn; - } - - public Boolean getNetworkCreated() { - return networkCreated; - } - - public void setNetworkCreated(Boolean networkCreated) { - this.networkCreated = networkCreated; - } - - public Map getSubnetMap() { - return subnetMap; - } - - public void setSubnetMap(Map subnetMap) { - this.subnetMap = subnetMap; - } - - public NetworkRollback getRollback() { - return rollback; - } - - public void setRollback(NetworkRollback rollback) { - this.rollback = rollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java deleted file mode 100644 index 6a5e354f87..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkError.java +++ /dev/null @@ -1,45 +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.openecomp.mso.adapters.nwrest; - - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "deleteNetworkError") -public class DeleteNetworkError extends NetworkExceptionResponse implements Serializable { - private static final long serialVersionUID = 2735474165790444180L; - - public DeleteNetworkError() { - super(""); - } - - public DeleteNetworkError(String message) { - super(message); - } - - public DeleteNetworkError(String message, MsoExceptionCategory category, boolean unused, String messageid) { - super(message, category, unused, messageid); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java deleted file mode 100644 index d899ac921e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkRequest.java +++ /dev/null @@ -1,101 +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.openecomp.mso.adapters.nwrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("deleteNetworkRequest") -@XmlRootElement(name = "deleteNetworkRequest") -public class DeleteNetworkRequest extends NetworkRequestCommon { - - private String cloudSiteId; - private String tenantId; - private String networkId; - private String networkStackId; - private String networkType; - private String modelCustomizationUuid; - private MsoRequest msoRequest = new MsoRequest(); - - public DeleteNetworkRequest() {} - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNetworkStackId() { - return networkStackId; - } - - public void setNetworkStackId(String networkStackId) { - this.networkStackId = networkStackId; - } - - public String getNetworkType() { - return networkType; - } - - public void setNetworkType(String networkType) { - this.networkType = networkType; - } - - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java deleted file mode 100644 index ee62751edb..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/DeleteNetworkResponse.java +++ /dev/null @@ -1,61 +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.openecomp.mso.adapters.nwrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("deleteNetworkResponse") -@XmlRootElement(name = "deleteNetworkResponse") -public class DeleteNetworkResponse extends NetworkResponseCommon { - - private String networkId; - private Boolean networkDeleted; - - public DeleteNetworkResponse() { - super(); - } - - public DeleteNetworkResponse(String networkId, Boolean networkDeleted, String messageId) { - super(messageId); - this.networkId = networkId; - this.networkDeleted = networkDeleted; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public Boolean getNetworkDeleted() { - return networkDeleted; - } - - public void setNetworkDeleted(Boolean networkDeleted) { - this.networkDeleted = networkDeleted; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkExceptionResponse.java deleted file mode 100644 index 195d6da176..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkExceptionResponse.java +++ /dev/null @@ -1,69 +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.openecomp.mso.adapters.nwrest; - - - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -public class NetworkExceptionResponse extends NetworkResponseCommon { - private String message; - private MsoExceptionCategory category; - private Boolean rolledBack; - - public NetworkExceptionResponse () {} - - public NetworkExceptionResponse (String message) { - super(); - this.message = message; - } - - public NetworkExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { - super(messageid); - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public Boolean getRolledBack() { - return rolledBack; - } - - public void setRolledBack(Boolean rolledBack) { - this.rolledBack = rolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java deleted file mode 100644 index 56fc19870c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkRequestCommon.java +++ /dev/null @@ -1,106 +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.openecomp.mso.adapters.nwrest; - - - -import java.io.ByteArrayOutputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Everything that is common between all Network Requests. - */ -public abstract class NetworkRequestCommon { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private Boolean skipAAI = false; - private String messageId; - private String notificationUrl; - @JsonProperty - private boolean synchronous; - public Boolean getSkipAAI() { - return skipAAI; - } - - public void setSkipAAI(Boolean skipAAI) { - this.skipAAI = skipAAI; - } - - public String getMessageId() { - return messageId; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public String getNotificationUrl() { - return notificationUrl; - } - - public void setNotificationUrl(String notificationUrl) { - this.notificationUrl = notificationUrl; - } - - public boolean isSynchronous() { - return notificationUrl == null || (notificationUrl.isEmpty()); - } - - @JsonIgnore - public void setSynchronous(boolean synchronous) { - this.synchronous = synchronous; - } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - return jsonString; - } - - public String toXmlString() { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML - marshaller.marshal(this, bs); - return bs.toString(); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - return ""; - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java deleted file mode 100644 index f92f4ea769..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkResponseCommon.java +++ /dev/null @@ -1,82 +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.openecomp.mso.adapters.nwrest; - - - -import java.io.ByteArrayOutputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import org.openecomp.mso.logger.MsoLogger; -/** - * Everything that is common between all Volume Group Responses, except for QueryVolumeGroupResponse. - */ -public abstract class NetworkResponseCommon { - private String messageId; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - public NetworkResponseCommon() { - messageId = null; - } - - public NetworkResponseCommon(String messageId) { - this.messageId = messageId; - } - - public String getMessageId() { - return messageId; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - } - return jsonString; - } - - public String toXmlString() { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML - marshaller.marshal(this, bs); - return bs.toString(); - } catch (Exception e) { - LOGGER.debug("Exception:", e); - return ""; - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkTechnology.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkTechnology.java deleted file mode 100644 index 83eddbc33d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/NetworkTechnology.java +++ /dev/null @@ -1,26 +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.openecomp.mso.adapters.nwrest; - - -public enum NetworkTechnology { - NEUTRON, VMWARE, CONTRAIL -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ProviderVlanNetwork.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ProviderVlanNetwork.java deleted file mode 100644 index 7525da9049..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/ProviderVlanNetwork.java +++ /dev/null @@ -1,56 +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.openecomp.mso.adapters.nwrest; - - - -import java.util.List; - -public class ProviderVlanNetwork { - private String physicalNetworkName; - private List vlans; - - public ProviderVlanNetwork() { - super(); - } - - public ProviderVlanNetwork(String physicalNetworkName, List vlans) { - super(); - this.physicalNetworkName = physicalNetworkName; - this.vlans = vlans; - } - - public String getPhysicalNetworkName() { - return physicalNetworkName; - } - - public void setPhysicalNetworkName(String physicalNetworkName) { - this.physicalNetworkName = physicalNetworkName; - } - - public List getVlans() { - return vlans; - } - - public void setVlans(List vlans) { - this.vlans = vlans; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java deleted file mode 100644 index 5ff64a47a2..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkError.java +++ /dev/null @@ -1,31 +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.openecomp.mso.adapters.nwrest; - - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "queryNetworkError") -public class QueryNetworkError extends NetworkExceptionResponse implements Serializable { - private static final long serialVersionUID = -6125469596399867146L; -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java deleted file mode 100644 index 7df5472607..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/QueryNetworkResponse.java +++ /dev/null @@ -1,131 +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.openecomp.mso.adapters.nwrest; - -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.NetworkStatus; -import org.openecomp.mso.openstack.beans.RouteTarget; - -@XmlRootElement(name = "queryNetworkResponse") -public class QueryNetworkResponse extends NetworkResponseCommon { - private String networkId; - private String neutronNetworkId; - private String networkStackId; - private Boolean networkExists; - private NetworkStatus networkStatus; - private List vlans; - private List routeTargets; - private Map subnetIdMap; - private Map networkOutputs; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - public QueryNetworkResponse() { - super(); - } - - public QueryNetworkResponse(String networkId, String neutronNetworkId, String networkStackId, - NetworkStatus networkStatus, Map networkOutputs) { - super(); - this.networkId = networkId; - this.neutronNetworkId = neutronNetworkId; - this.networkStackId = networkStackId; - this.networkStatus = networkStatus; - this.networkOutputs = networkOutputs; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - - public String getNetworkStackId() { - return networkStackId; - } - - public void setNetworkStackId(String networkStackId) { - this.networkStackId = networkStackId; - } - - public NetworkStatus getNetworkStatus() { - return networkStatus; - } - - public void setNetworkStatus(NetworkStatus networkStatus) { - this.networkStatus = networkStatus; - } - - public Boolean getNetworkExists() { - return networkExists; - } - - public void setNetworkExists(Boolean networkExists) { - this.networkExists = networkExists; - } - - public List getVlans() { - return vlans; - } - - public void setVlans(List vlans) { - this.vlans = vlans; - } - - public List getRouteTargets() { - return routeTargets; - } - - public void setRouteTargets(List routeTargets) { - this.routeTargets = routeTargets; - } - - public Map getSubnetIdMap() { - return subnetIdMap; - } - - public void setSubnetIdMap(Map subnetIdMap) { - this.subnetIdMap = subnetIdMap; - } - - public Map getNetworkOutputs() { - return networkOutputs; - } - - public void setNetworkOutputs(Map networkOutputs) { - this.networkOutputs = networkOutputs; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java deleted file mode 100644 index 67a4b906c7..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkError.java +++ /dev/null @@ -1,45 +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.openecomp.mso.adapters.nwrest; - - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "rollbackNetworkError") -public class RollbackNetworkError extends NetworkExceptionResponse implements Serializable { - private static final long serialVersionUID = -3954464103037391980L; - - public RollbackNetworkError() { - super(""); - } - - public RollbackNetworkError(String message) { - super(message); - } - - public RollbackNetworkError(String message, MsoExceptionCategory category, boolean unused, String messageid) { - super(message, category, unused, messageid); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java deleted file mode 100644 index 03b4123d06..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkRequest.java +++ /dev/null @@ -1,46 +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.openecomp.mso.adapters.nwrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; -import org.openecomp.mso.openstack.beans.NetworkRollback; - -@JsonRootName("rollbackNetworkRequest") -@XmlRootElement(name = "rollbackNetworkRequest") -public class RollbackNetworkRequest extends NetworkRequestCommon { - private NetworkRollback networkRollback; - - public RollbackNetworkRequest() { - super(); - } - - public NetworkRollback getNetworkRollback() { - return networkRollback; - } - - public void setNetworkRollback(NetworkRollback networkRollback) { - this.networkRollback = networkRollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java deleted file mode 100644 index f7b80bd63e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/RollbackNetworkResponse.java +++ /dev/null @@ -1,52 +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.openecomp.mso.adapters.nwrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("rollbackNetworkResponse") -@XmlRootElement(name = "rollbackNetworkResponse") -public class RollbackNetworkResponse extends NetworkResponseCommon { - - private Boolean networkRolledBack; - - public RollbackNetworkResponse() { - super(); - } - - public RollbackNetworkResponse(Boolean networkRolledBack, String messageId) { - super(messageId); - this.networkRolledBack = networkRolledBack; - } - - public Boolean getNetworkRolledBack() { - return networkRolledBack; - } - - public void setNetworkRolledBack(Boolean networkRolledBack) { - this.networkRolledBack = networkRolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java deleted file mode 100644 index 3385167f60..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkError.java +++ /dev/null @@ -1,45 +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.openecomp.mso.adapters.nwrest; - - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "updateNetworkError") -public class UpdateNetworkError extends NetworkExceptionResponse implements Serializable { - private static final long serialVersionUID = 46820809807914392L; - - public UpdateNetworkError() { - super(""); - } - - public UpdateNetworkError(String message) { - super(message); - } - - public UpdateNetworkError(String message, MsoExceptionCategory category, boolean unused, String messageid) { - super(message, category, unused, messageid); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java deleted file mode 100644 index 7b3236efa5..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkRequest.java +++ /dev/null @@ -1,196 +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.openecomp.mso.adapters.nwrest; - - - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.Subnet; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("updateNetworkRequest") -@XmlRootElement(name = "updateNetworkRequest") -public class UpdateNetworkRequest extends NetworkRequestCommon { - private String cloudSiteId; - private String tenantId; - private String networkId; - private String networkStackId; - private String networkName; - private String networkType; - private String networkTypeVersion; - private String modelCustomizationUuid; - private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON; - private List subnets; - private ProviderVlanNetwork providerVlanNetwork; - private ContrailNetwork contrailNetwork; - private Boolean backout = true; - private Map networkParams = new HashMap<>(); - private MsoRequest msoRequest = new MsoRequest(); - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - @JsonProperty - private boolean contrailRequest; - public UpdateNetworkRequest() { - super(); - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNetworkStackId() { - return networkStackId; - } - - public void setNetworkStackId(String networkStackId) { - this.networkStackId = networkStackId; - } - - 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 getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public String getNetworkTypeVersion() { - return networkTypeVersion; - } - - public void setNetworkTypeVersion(String networkTypeVersion) { - this.networkTypeVersion = networkTypeVersion; - } - - public String getNetworkTechnology() { - return networkTechnology.toString(); - } - - public void setNetworkTechnology(String networkTechnology) { - try { - this.networkTechnology = NetworkTechnology.valueOf(networkTechnology.toUpperCase()); - } catch (IllegalArgumentException e) { - LOGGER.debug("Exception:", e); - } - } - - public List getSubnets() { - return subnets; - } - - public void setSubnets(List subnets) { - this.subnets = subnets; - } - - public ProviderVlanNetwork getProviderVlanNetwork() { - return providerVlanNetwork; - } - - public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) { - this.providerVlanNetwork = providerVlanNetwork; - } - - public ContrailNetwork getContrailNetwork() { - return contrailNetwork; - } - - public void setContrailNetwork(ContrailNetwork contrailNetwork) { - this.contrailNetwork = contrailNetwork; - } - - public Boolean getBackout() { - return backout; - } - - public void setBackout(Boolean backout) { - this.backout = backout; - } - - public Map getNetworkParams() { - return networkParams; - } - - public void setNetworkParams(Map networkParams) { - this.networkParams = networkParams; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - - public boolean isContrailRequest() { - return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null); - } - - @JsonIgnore - public void setContrailRequest() { - this.contrailRequest = contrailRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java deleted file mode 100644 index 3ca6824a49..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/nwrest/UpdateNetworkResponse.java +++ /dev/null @@ -1,74 +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.openecomp.mso.adapters.nwrest; - - - -import java.util.Map; -import javax.xml.bind.annotation.XmlRootElement; -import org.jboss.resteasy.annotations.providers.NoJackson; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("updateNetworkResponse") -@XmlRootElement(name = "updateNetworkResponse") -@NoJackson -public class UpdateNetworkResponse extends NetworkResponseCommon { - - private String networkId; - private String neutronNetworkId; - private Map subnetMap; - - public UpdateNetworkResponse() { - /* Empty Constructor */ - } - - public UpdateNetworkResponse(String networkId, String neutronNetworkId, - Map subnetMap, String messageId) { - super(messageId); - this.networkId = networkId; - this.neutronNetworkId = neutronNetworkId; - this.subnetMap = subnetMap; - } - - public String getNetworkId() { - return networkId; - } - - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - - public Map getSubnetMap() { - return subnetMap; - } - - public void setSubnetMap(Map subnetMap) { - this.subnetMap = subnetMap; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java deleted file mode 100644 index aa55c6349d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/providers/JettisonStyleMapperProvider.java +++ /dev/null @@ -1,53 +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.openecomp.mso.adapters.providers; - -import javax.ws.rs.Produces; -import javax.ws.rs.ext.ContextResolver; -import javax.ws.rs.ext.Provider; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@Provider -@Produces("application/json") -public class JettisonStyleMapperProvider implements ContextResolver { - - final ObjectMapper mapper; - - public JettisonStyleMapperProvider() { - - mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - mapper.enable(MapperFeature.USE_ANNOTATIONS); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } - - @Override - public ObjectMapper getContext(Class type) { - return mapper; - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java deleted file mode 100644 index 3dc81fbdda..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/RequestInformation.java +++ /dev/null @@ -1,115 +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.openecomp.mso.adapters.sdncrest; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import javax.xml.bind.annotation.XmlElement; -import java.io.Serializable; - -/** - * Request Information specified by the SDNC "agnostic" API. - */ -public class RequestInformation implements Serializable { - private static final long serialVersionUID = 1L; - - // Identifies the transaction MSO has with the calling system. - private String requestId; - - // Identifies the calling system, e.g. CCD. - private String source; - - // The calling system's endpoint for receiving notifications from MSO. - private String notificationUrl; - - // NOTE: these are defined in the SDNC AID, but not used by MSO: - // request-action - // request-sub-action - - // Identifies the request action - private String requestAction; - - // Identifies the request sub action - private String requestSubAction; - - public RequestInformation(String requestId, String source, String notificationUrl) { - this.requestId = requestId; - this.source = source; - this.notificationUrl = notificationUrl; - } - - public RequestInformation() { - } - - @JsonProperty("requestId") - @XmlElement(name = "requestId") - public String getRequestId() { - return requestId; - } - - @JsonProperty("requestId") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - @JsonProperty("source") - @XmlElement(name = "source") - public String getSource() { - return source; - } - - @JsonProperty("source") - public void setSource(String source) { - this.source = source; - } - - @JsonProperty("notificationUrl") - @XmlElement(name = "notificationUrl") - public String getNotificationUrl() { - return notificationUrl; - } - - @JsonProperty("notificationUrl") - public void setNotificationUrl(String notificationUrl) { - this.notificationUrl = notificationUrl; - } - - @JsonProperty("requestAction") - @XmlElement(name = "requestAction") - public String getRequestAction() { - return requestAction; - } - - @JsonProperty("requestAction") - public void setRequestAction(String requestAction) { - this.requestAction = requestAction; - } - - @JsonProperty("requestSubAction") - @XmlElement(name = "requestSubAction") - public String getRequestSubAction() { - return requestSubAction; - } - - @JsonProperty("requestSubAction") - public void setRequestSubAction(String requestSubAction) { - this.requestSubAction = requestSubAction; - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java deleted file mode 100644 index 280703a534..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCErrorCommon.java +++ /dev/null @@ -1,37 +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.openecomp.mso.adapters.sdncrest; - -import java.io.Serializable; - -/** - * Base class for all SDNC adapter error responses. - */ -public abstract class SDNCErrorCommon extends SDNCResponseCommon implements Serializable { - private static final long serialVersionUID = 1L; - - public SDNCErrorCommon(String sdncRequestId, String responseCode, - String responseMessage, String ackFinalIndicator) { - super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); - } - - public SDNCErrorCommon() { - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java deleted file mode 100644 index 3dbeaef17f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCEvent.java +++ /dev/null @@ -1,141 +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.openecomp.mso.adapters.sdncrest; - -import java.io.IOException; -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, -// even though we are using JSON exclusively. The @NoJackson annotation -// is also required in this environment. - -/** - Map elements when marshalled to XML produce a list of ${key}${value} elements. - When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. - * - */ -@JsonRootName("SDNCEvent") -@JsonInclude(Include.NON_NULL) -@XmlRootElement(name = "SDNCEvent") -public class SDNCEvent implements Serializable { - private static final long serialVersionUID = 1L; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - // Event type - private String eventType; - - // Event correlator type - private String eventCorrelatorType; - - // Event correlator value. - private String eventCorrelator; - - // Map of response parameters (possibly none). - private Map params = null; - - public SDNCEvent(String eventType, String eventCorrelatorType, String eventCorrelator) { - this.eventType = eventType; - this.eventCorrelatorType = eventCorrelatorType; - this.eventCorrelator = eventCorrelator; - } - - public SDNCEvent() { - } - - @JsonProperty("eventType") - @XmlElement(name = "eventType") - public String getEventType() { - return eventType; - } - - @JsonProperty("eventType") - public void setEventType(String eventType) { - this.eventType = eventType; - } - - @JsonProperty("eventCorrelatorType") - @XmlElement(name = "eventCorrelatorType") - public String getEventCorrelatorType() { - return eventCorrelatorType; - } - - @JsonProperty("eventCorrelatorType") - public void setEventCorrelatorType(String eventCorrelatorType) { - this.eventCorrelatorType = eventCorrelatorType; - } - - @JsonProperty("eventCorrelator") - @XmlElement(name = "eventCorrelator") - public String getEventCorrelator() { - return eventCorrelator; - } - - @JsonProperty("eventCorrelator") - public void setEventCorrelator(String eventCorrelator) { - this.eventCorrelator = eventCorrelator; - } - - @JsonProperty("params") - @XmlElement(name = "params") - public Map getParams() { - return params; - } - - @JsonProperty("params") - public void setParams(Map params) { - this.params = params; - } - - public void addParam(String name, String value) { - if (params == null) { - params = new LinkedHashMap<>(); - } - params.put(name, value); - } - - public String toJson() { - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.setSerializationInclusion(Include.NON_NULL); - return mapper.writeValueAsString(this); - } catch (IOException e) { - LOGGER.debug("Exception:", e); - throw new UnsupportedOperationException("Cannot convert " - + getClass().getSimpleName() + " to JSON", e); - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java deleted file mode 100644 index e1ee9894e2..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCRequestCommon.java +++ /dev/null @@ -1,114 +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.openecomp.mso.adapters.sdncrest; - -import java.io.IOException; -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlElement; - -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * Base class for all SDNC adapter requests. - */ -public abstract class SDNCRequestCommon implements Serializable { - private static final long serialVersionUID = 1L; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - // Endpoint on which BPMN can receive notifications from the SDNC adapter. - private String bpNotificationUrl; - - // BPMN flow timeout value in ISO 8601 format, e.g. PT5M. - // Not currently used by the SDNC adapter. - private String bpTimeout; - - // Identifies the MSO transaction with SDNC. - // Maps to sdnc-request-header/requestId in the SDNC request. - private String sdncRequestId; - - public SDNCRequestCommon(String sdncRequestId, String bpNotificationUrl, - String bpTimeout) { - this.sdncRequestId = sdncRequestId; - this.bpNotificationUrl = bpNotificationUrl; - this.bpTimeout = bpTimeout; - } - - public SDNCRequestCommon() { - } - - @JsonProperty("bpNotificationUrl") - @XmlElement(name = "bpNotificationUrl") - public String getBPNotificationUrl() { - return bpNotificationUrl; - } - - @JsonProperty("bpNotificationUrl") - public void setBPNotificationUrl(String bpNotificationUrl) { - this.bpNotificationUrl = bpNotificationUrl; - } - - @JsonProperty("bpTimeout") - @XmlElement(name = "bpTimeout") - public String getBPTimeout() { - return bpTimeout; - } - - @JsonProperty("bpTimeout") - public void setBPTimeout(String bpTimeout) { - this.bpTimeout = bpTimeout; - } - - @JsonProperty("sdncRequestId") - @XmlElement(name = "sdncRequestId") - public String getSDNCRequestId() { - return sdncRequestId; - } - - @JsonProperty("sdncRequestId") - public void setSDNCRequestId(String sdncRequestId) { - this.sdncRequestId = sdncRequestId; - } - - @JsonIgnore - public boolean isSynchronous() { - return bpNotificationUrl == null || bpNotificationUrl.isEmpty(); - } - - public String toJson() { - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.setSerializationInclusion(Include.NON_NULL); - return mapper.writeValueAsString(this); - } catch (IOException e) { - LOGGER.debug("Exception:", e); - throw new UnsupportedOperationException("Cannot convert " - + getClass().getSimpleName() + " to JSON", e); - } - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java deleted file mode 100644 index 7265d67923..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCResponseCommon.java +++ /dev/null @@ -1,123 +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.openecomp.mso.adapters.sdncrest; - -import java.io.IOException; -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlElement; - -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * Base class for all SDNC adapter responses, including errors. - */ -public abstract class SDNCResponseCommon implements Serializable { - private static final long serialVersionUID = 1L; - - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - // Identifies the MSO transaction with SDNC. - private String sdncRequestId; - - // Response code, either from SDNC, or generated by the SDNC adapter. - // 2XX responses are considered success responses. - private String responseCode; - - // Response message, either from SDNC, or generated by the SDNC adapter. - private String responseMessage; - - // Indicates if the response is final (Y or N). - private String ackFinalIndicator; - - public SDNCResponseCommon(String sdncRequestId, String responseCode, - String responseMessage, String ackFinalIndicator) { - this.sdncRequestId = sdncRequestId; - this.responseCode = responseCode; - this.responseMessage = responseMessage; - this.ackFinalIndicator = ackFinalIndicator; - } - - public SDNCResponseCommon() { - } - - @JsonProperty("sdncRequestId") - @XmlElement(name = "sdncRequestId") - public String getSDNCRequestId() { - return sdncRequestId; - } - - @JsonProperty("sdncRequestId") - public void setSDNCRequestId(String sdncRequestId) { - this.sdncRequestId = sdncRequestId; - } - - @JsonProperty("responseCode") - @XmlElement(name = "responseCode") - public String getResponseCode() { - return responseCode; - } - - @JsonProperty("responseCode") - public void setResponseCode(String responseCode) { - this.responseCode = responseCode; - } - - @JsonProperty("responseMessage") - @XmlElement(name = "responseMessage") - public String getResponseMessage() { - return responseMessage; - } - - @JsonProperty("responseMessage") - public void setResponseMessage(String responseMessage) { - this.responseMessage = responseMessage; - } - - @JsonProperty("ackFinalIndicator") - @XmlElement(name = "ackFinalIndicator") - public String getAckFinalIndicator() { - return ackFinalIndicator; - } - - @JsonProperty("ackFinalIndicator") - public void setAckFinalIndicator(String ackFinalIndicator) { - this.ackFinalIndicator = ackFinalIndicator; - } - - public String toJson() { - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.setSerializationInclusion(Include.NON_NULL); - return mapper.writeValueAsString(this); - } catch (IOException e) { - LOGGER.debug("Exception:", e); - throw new UnsupportedOperationException("Cannot convert " - + getClass().getSimpleName() + " to JSON", e); - } - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java deleted file mode 100644 index 8d693e932a..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceError.java +++ /dev/null @@ -1,50 +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.openecomp.mso.adapters.sdncrest; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonRootName; - -// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, -// even though we are using JSON exclusively. The @NoJackson annotation -// is also required in this environment. - -/** - * SDNC adapter error response for "agnostic" API services. - */ -@JsonRootName("SDNCServiceError") -@JsonInclude(Include.NON_NULL) -@XmlRootElement(name = "SDNCServiceError") -public class SDNCServiceError extends SDNCErrorCommon implements Serializable { - private static final long serialVersionUID = 1; - - public SDNCServiceError(String sdncRequestId, String responseCode, - String responseMessage, String ackFinalIndicator) { - super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); - } - - public SDNCServiceError() { - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java deleted file mode 100644 index a21585764f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequest.java +++ /dev/null @@ -1,146 +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.openecomp.mso.adapters.sdncrest; - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, -// even though we are using JSON exclusively. The @NoJackson annotation -// is also required in this environment. - -/** - * SDNC adapter request for "agnostic" API services. - * The target action is determined by a service type and an operation. - */ -@JsonRootName("SDNCServiceRequest") -@JsonInclude(Include.NON_NULL) -@XmlRootElement(name = "SDNCServiceRequest") -public class SDNCServiceRequest extends SDNCRequestCommon implements Serializable { - private static final long serialVersionUID = 1L; - - // Request Information specified by SDNC "agnostic" API - private RequestInformation requestInformation; - - // Service Information specified by: SDNC "agnostic" API - private ServiceInformation serviceInformation; - - // The SDNC service type specified by SDNC "agnostic" API - private String sdncService; - - // The SDNC operation specified by SDNC "agnostic" API - private String sdncOperation; - - // The SDNC service data type specified by SDNC "agnostic" API - private String sdncServiceDataType; - - // The SDNC service data specified by SDNC "agnostic" API - private String sndcServiceData; - - public SDNCServiceRequest() { - } - - public SDNCServiceRequest(String bpNotificationUrl, String bpTimeout, - String sdncRequestId, String sdncService, String sdncOperation, - RequestInformation requestInformation, - ServiceInformation serviceInformation, String sdncServiceDataType, - String sndcServiceData) { - super(bpNotificationUrl, bpTimeout, sdncRequestId); - this.requestInformation = requestInformation; - this.serviceInformation = serviceInformation; - this.sdncService = sdncService; - this.sdncOperation = sdncOperation; - this.sdncServiceDataType = sdncServiceDataType; - this.sndcServiceData = sndcServiceData; - } - - @JsonProperty("requestInformation") - @XmlElement(name = "requestInformation") - public RequestInformation getRequestInformation() { - return requestInformation; - } - - @JsonProperty("requestInformation") - public void setRequestInformation(RequestInformation requestInformation) { - this.requestInformation = requestInformation; - } - - @JsonProperty("serviceInformation") - @XmlElement(name = "serviceInformation") - public ServiceInformation getServiceInformation() { - return serviceInformation; - } - - @JsonProperty("serviceInformation") - public void setServiceInformation(ServiceInformation serviceInformation) { - this.serviceInformation = serviceInformation; - } - - @JsonProperty("sdncService") - @XmlElement(name = "sdncService") - public String getSDNCService() { - return sdncService; - } - - @JsonProperty("sdncService") - public void setSDNCService(String sdncService) { - this.sdncService = sdncService; - } - - @JsonProperty("sdncOperation") - @XmlElement(name = "sdncOperation") - public String getSDNCOperation() { - return sdncOperation; - } - - @JsonProperty("sdncOperation") - public void setSDNCOperation(String sdncOperation) { - this.sdncOperation = sdncOperation; - } - - @JsonProperty("sdncServiceDataType") - @XmlElement(name = "sdncServiceDataType") - public String getSDNCServiceDataType() { - return sdncServiceDataType; - } - - @JsonProperty("sdncServiceDataType") - public void setSDNCServiceDataType(String sdncServiceDataType) { - this.sdncServiceDataType = sdncServiceDataType; - } - - @JsonProperty("sdncServiceData") - @XmlElement(name = "sdncServiceData") - public String getSDNCServiceData() { - return sndcServiceData; - } - - @JsonProperty("sdncServiceData") - public void setSDNCServiceData(String sndcServiceData) { - this.sndcServiceData = sndcServiceData; - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java deleted file mode 100644 index c74fb08972..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponse.java +++ /dev/null @@ -1,77 +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.openecomp.mso.adapters.sdncrest; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -// NOTE: the JAXB (XML) annotations are required with JBoss AS7 and RESTEasy, -// even though we are using JSON exclusively. The @NoJackson annotation -// is also required in this environment. - -/** - Map elements when marshalled to XML produce a list of ${key}${value} elements. - When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. - * - */ -@JsonRootName("SDNCServiceResponse") -@JsonInclude(Include.NON_NULL) -@XmlRootElement(name = "SDNCServiceResponse") -public class SDNCServiceResponse extends SDNCResponseCommon implements Serializable { - private static final long serialVersionUID = 1L; - - // Map of response parameters (possibly none). - private Map params = null; - - public SDNCServiceResponse(String sdncRequestId, String responseCode, - String responseMessage, String ackFinalIndicator) { - super(sdncRequestId, responseCode, responseMessage, ackFinalIndicator); - } - - public SDNCServiceResponse() { - } - - @JsonProperty("params") - @XmlElement(name = "params") - public Map getParams() { - return params; - } - - @JsonProperty("params") - public void setParams(Map params) { - this.params = params; - } - - public void addParam(String name, String value) { - if (params == null) { - params = new LinkedHashMap<>(); - } - params.put(name, value); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java deleted file mode 100644 index 1cdea6518a..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/sdncrest/ServiceInformation.java +++ /dev/null @@ -1,102 +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.openecomp.mso.adapters.sdncrest; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import javax.xml.bind.annotation.XmlElement; -import java.io.Serializable; - -/** - * Service Information specified by the SDNC "agnostic" API. - */ -public class ServiceInformation implements Serializable { - private static final long serialVersionUID = 1L; - - // The subscription's service type for the target service instance. - private String serviceType; - - // Identifies the target service instance for this particular SDNC request. - // NOTE: this could be a child of the parent model instance, i.e. this - // service instance ID may be different from the service instance ID - // associated with the transaction MSO has with the system that invoked it. - private String serviceInstanceId; - - // The subscriber name. - private String subscriberName; - - // The subscriber global ID (customer ID). - private String subscriberGlobalId; - - public ServiceInformation(String serviceType, String serviceInstanceId, - String subscriberName, String subscriberGlobalId) { - this.serviceType = serviceType; - this.serviceInstanceId = serviceInstanceId; - this.subscriberName = subscriberName; - this.subscriberGlobalId = subscriberGlobalId; - } - - public ServiceInformation() { - } - - @JsonProperty("serviceType") - @XmlElement(name = "serviceType") - public String getServiceType() { - return serviceType; - } - - @JsonProperty("serviceType") - public void setServiceType(String serviceType) { - this.serviceType = serviceType; - } - - @JsonProperty("serviceInstanceId") - @XmlElement(name = "serviceInstanceId") - public String getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty("serviceInstanceId") - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - @JsonProperty("subscriberName") - @XmlElement(name = "subscriberName") - public String getSubscriberName() { - return subscriberName; - } - - @JsonProperty("subscriberName") - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } - - @JsonProperty("subscriberGlobalId") - @XmlElement(name = "subscriberGlobalId") - public String getSubscriberGlobalId() { - return subscriberGlobalId; - } - - @JsonProperty("subscriberGlobalId") - public void setSubscriberGlobalId(String subscriberGlobalId) { - this.subscriberGlobalId = subscriberGlobalId; - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java deleted file mode 100644 index 38fb4ac3f8..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantError.java +++ /dev/null @@ -1,71 +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.openecomp.mso.adapters.tenantrest; - - - -import java.io.Serializable; -import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "createTenantError") -public class CreateTenantError implements Serializable { - private static final long serialVersionUID = 7305288262646805568L; - private String message; - private MsoExceptionCategory category; - private Boolean rolledBack; - - public CreateTenantError () {} - - public CreateTenantError (String message) { - this.message = message; - } - - public CreateTenantError (String message, MsoExceptionCategory category, boolean rolledBack) { - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public Boolean getRolledBack() { - return rolledBack; - } - - public void setRolledBack(Boolean rolledBack) { - this.rolledBack = rolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java deleted file mode 100644 index 227e58338d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantRequest.java +++ /dev/null @@ -1,96 +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.openecomp.mso.adapters.tenantrest; - - - -import org.openecomp.mso.entity.MsoRequest; -import java.util.Map; -import java.util.HashMap; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "createTenantRequest") -public class CreateTenantRequest extends TenantRequestCommon { - private String cloudSiteId; - private String tenantName; - private Boolean failIfExists; - private Boolean backout; - private Map metadata = new HashMap<>(); - private MsoRequest msoRequest = new MsoRequest(); - - public CreateTenantRequest() {} - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantName() { - return tenantName; - } - - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - - public Boolean getFailIfExists() { - return failIfExists; - } - - public void setFailIfExists(Boolean failIfExists) { - this.failIfExists = failIfExists; - } - - public Boolean getBackout() { - return backout; - } - - public void setBackout(Boolean backout) { - this.backout = backout; - } - - public Map getMetadata() { - return metadata; - } - - public void setMetadata(Map metadata) { - this.metadata = metadata; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - - @Override - public String toString() { - return "CreateTenantRequest [cloudSiteId=" + cloudSiteId - + ", tenantName=" + tenantName + ", failIfExists=" - + failIfExists + ", backout=" + backout + ", metadata=" - + metadata + "]"; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java deleted file mode 100644 index f091a22bcb..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/CreateTenantResponse.java +++ /dev/null @@ -1,84 +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.openecomp.mso.adapters.tenantrest; - - - -import java.io.Serializable; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "createTenantResponse") -public class CreateTenantResponse implements Serializable { - private static final long serialVersionUID = -456155026754759682L; - private String cloudSiteId; - private String tenantId; - private Boolean tenantCreated; - private TenantRollback tenantRollback = new TenantRollback(); - - public CreateTenantResponse() {} - - public CreateTenantResponse(String cloudSiteId, String tenantId, - Boolean tenantCreated, TenantRollback tenantRollback) { - this.cloudSiteId = cloudSiteId; - this.tenantId = tenantId; - this.tenantCreated = tenantCreated; - this.tenantRollback = tenantRollback; - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public Boolean getTenantCreated() { - return tenantCreated; - } - - public void setTenantCreated(Boolean tenantCreated) { - this.tenantCreated = tenantCreated; - } - - public TenantRollback getTenantRollback() { - return tenantRollback; - } - - public void setTenantRollback(TenantRollback tenantRollback) { - this.tenantRollback = tenantRollback; - } - - @Override - public String toString() { - return "CreateTenantResponse [cloudSiteId=" + cloudSiteId - + ", tenantId=" + tenantId + ", tenantCreated=" + tenantCreated - + ", tenantRollback=" + tenantRollback.toString() + "]"; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java deleted file mode 100644 index 17af950f3f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantError.java +++ /dev/null @@ -1,71 +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.openecomp.mso.adapters.tenantrest; - - - -import java.io.Serializable; -import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "deleteTenantError") -public class DeleteTenantError implements Serializable { - private static final long serialVersionUID = -5778340182805870809L; - private String message; - private MsoExceptionCategory category; - private Boolean rolledBack; - - public DeleteTenantError () {} - - public DeleteTenantError (String message) { - this.message = message; - } - - public DeleteTenantError (String message, MsoExceptionCategory category, boolean rolledBack) { - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public Boolean getRolledBack() { - return rolledBack; - } - - public void setRolledBack(Boolean rolledBack) { - this.rolledBack = rolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java deleted file mode 100644 index 47761ce086..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantRequest.java +++ /dev/null @@ -1,61 +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.openecomp.mso.adapters.tenantrest; - - - -import org.openecomp.mso.entity.MsoRequest; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "deleteTenantRequest") -public class DeleteTenantRequest extends TenantRequestCommon { - - private String cloudSiteId; - private String tenantId; - - private MsoRequest msoRequest = new MsoRequest(); - - public DeleteTenantRequest() {} - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java deleted file mode 100644 index 9c18734a17..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/DeleteTenantResponse.java +++ /dev/null @@ -1,41 +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.openecomp.mso.adapters.tenantrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "deleteTenantResponse") -public class DeleteTenantResponse { - - private Boolean tenantDeleted; - - public DeleteTenantResponse() {} - - public Boolean getTenantDeleted() { - return tenantDeleted; - } - - public void setTenantDeleted(Boolean tenantDeleted) { - this.tenantDeleted = tenantDeleted; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java deleted file mode 100644 index dac3b9ea3c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/HealthCheckHandler.java +++ /dev/null @@ -1,51 +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.openecomp.mso.adapters.tenantrest; - - - -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -import org.apache.http.HttpStatus; - -import org.openecomp.mso.logger.MsoLogger; - -@Path("/") -public class HealthCheckHandler { - - private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - private static final String CHECK_HTML = "Health CheckApplication ready"; - private static final Response HEALTH_CHECK_RESPONSE = Response.status (HttpStatus.SC_OK) - .entity (CHECK_HTML) - .build (); - @HEAD - @GET - @Path("/healthcheck") - @Produces("text/html") - public Response healthcheck () { - msoLogger.debug ("Health check call in Tenant Adapter"); - return HEALTH_CHECK_RESPONSE; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java deleted file mode 100644 index 1347f78fbe..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantError.java +++ /dev/null @@ -1,61 +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.openecomp.mso.adapters.tenantrest; - - - -import java.io.Serializable; -import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "queryTenantError") -public class QueryTenantError implements Serializable { - private static final long serialVersionUID = 7358240830662453507L; - private String message; - private MsoExceptionCategory category; - - public QueryTenantError () {} - - public QueryTenantError (String message) { - this.message = message; - } - - public QueryTenantError (String message, MsoExceptionCategory category) { - this.message = message; - this.category = category; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java deleted file mode 100644 index 4d667b6a0e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/QueryTenantResponse.java +++ /dev/null @@ -1,62 +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.openecomp.mso.adapters.tenantrest; - - - -import java.util.Map; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "queryTenantResponse") -public class QueryTenantResponse extends TenantRequestCommon { - private String tenantId; - private String tenantName; - private Map metadata; - - public QueryTenantResponse() {} - - public QueryTenantResponse (String id, String name, Map metadata) { - this.tenantId = id; - this.tenantName = name; - this.metadata = metadata; - } - - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getTenantName() { - return tenantName; - } - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - - public Map getMetadata() { - return metadata; - } - public void setMetadata(Map metadata) { - this.metadata = metadata; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java deleted file mode 100644 index af76d689fe..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantError.java +++ /dev/null @@ -1,67 +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.openecomp.mso.adapters.tenantrest; - - - -import java.io.Serializable; -import javax.xml.bind.annotation.XmlRootElement; -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "rollbackTenantError") -public class RollbackTenantError implements Serializable { - private static final long serialVersionUID = -5313713674529615223L; - private String message; - private MsoExceptionCategory category; - private Boolean rolledBack; - - public RollbackTenantError () {} - - public RollbackTenantError (String message, MsoExceptionCategory category, boolean rolledBack) { - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public Boolean getRolledBack() { - return rolledBack; - } - - public void setRolledBack(Boolean rolledBack) { - this.rolledBack = rolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java deleted file mode 100644 index 7a67ffeaaa..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantRequest.java +++ /dev/null @@ -1,41 +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.openecomp.mso.adapters.tenantrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "rollbackTenantRequest") -public class RollbackTenantRequest extends TenantRequestCommon { - - private TenantRollback tenantRollback; - - public RollbackTenantRequest() {} - - public TenantRollback getTenantRollback() { - return tenantRollback; - } - - public void setTenantRollback(TenantRollback tenantRollback) { - this.tenantRollback = tenantRollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java deleted file mode 100644 index da329b8a29..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/RollbackTenantResponse.java +++ /dev/null @@ -1,41 +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.openecomp.mso.adapters.tenantrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "rollbackTenantResponse") -public class RollbackTenantResponse { - - private Boolean tenantRolledback; - - public RollbackTenantResponse() {} - - public Boolean getTenantRolledback() { - return tenantRolledback; - } - - public void setTenantRolledback(Boolean tenantRolledback) { - this.tenantRolledback = tenantRolledback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java deleted file mode 100644 index 930f46271b..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantExceptionResponse.java +++ /dev/null @@ -1,68 +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.openecomp.mso.adapters.tenantrest; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; -import java.io.Serializable; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "createTenantResponse") -public class TenantExceptionResponse implements Serializable { - - private static final long serialVersionUID = -9062290006520066109L; - - private String message; - private MsoExceptionCategory category; - private Boolean rolledBack; - - public TenantExceptionResponse () {} - - public TenantExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack) { - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public Boolean getRolledBack() { - return rolledBack; - } - - public void setRolledBack(Boolean rolledBack) { - this.rolledBack = rolledBack; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java deleted file mode 100644 index b00b98ef3e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRequestCommon.java +++ /dev/null @@ -1,63 +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.openecomp.mso.adapters.tenantrest; - - -import java.io.ByteArrayOutputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -import org.openecomp.mso.logger.MsoLogger; - -public class TenantRequestCommon { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - public String toJsonString() { - try { - String jsonString; - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - return jsonString; - } catch (Exception e) { - LOGGER.debug("Exception :",e); - return ""; - } - } - - public String toXmlString() { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML - marshaller.marshal(this, bs); - return bs.toString(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - return ""; - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java deleted file mode 100644 index 27aab8d3ff..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/tenantrest/TenantRollback.java +++ /dev/null @@ -1,79 +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.openecomp.mso.adapters.tenantrest; - - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -/** - * Javabean representing the rollback criteria following a "Create Tenant" - * operation. This structure can be passed back to the "Rollback Tenant" - * operation to undo the effects of the create. - * - * - */ - -@XmlRootElement(name = "rollbackTenantRequest") -public class TenantRollback extends TenantRequestCommon { - private String tenantId; - private String cloudId; - private boolean tenantCreated = false; - private MsoRequest msoRequest; - - public TenantRollback() {} - - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getCloudId() { - return cloudId; - } - public void setCloudId(String cloudId) { - this.cloudId = cloudId; - } - - public boolean getTenantCreated() { - return tenantCreated; - } - public void setTenantCreated(boolean tenantCreated) { - this.tenantCreated = tenantCreated; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - public void setMsoRequest (MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - - @Override - public String toString() { - return "VnfRollback: cloud=" + cloudId + ", tenant=" + tenantId + - ", tenantCreated=" + tenantCreated; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java deleted file mode 100644 index dac09d4cd1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleRequest.java +++ /dev/null @@ -1,208 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -/* README - Map elements when marshalled to XML produce a list of ${key}${value} elements. - When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers. -*/ -@JsonRootName("createVfModuleRequest") -@XmlRootElement(name = "createVfModuleRequest") -public class CreateVfModuleRequest extends VfRequestCommon { - private String cloudSiteId; - private String tenantId; - - private String vnfId; - private String vnfType; - private String vnfVersion; - - private String vfModuleId; - private String vfModuleName; - private String vfModuleType; - - private String volumeGroupId; - private String volumeGroupStackId; - private String baseVfModuleId; - private String baseVfModuleStackId; - private String modelCustomizationUuid; - - private String requestType; - private Boolean failIfExists; - private Boolean backout; - - private Map vfModuleParams = new HashMap<>(); - private MsoRequest msoRequest = new MsoRequest(); - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleName() { - return vfModuleName; - } - - public void setVfModuleName(String vfModuleName) { - this.vfModuleName = vfModuleName; - } - - public String getVnfType() { - return vnfType; - } - - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public String getVnfVersion() { - return vnfVersion; - } - - public void setVnfVersion(String vnfVersion) { - this.vnfVersion = vnfVersion; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getVfModuleType() { - return vfModuleType; - } - - public void setVfModuleType(String vfModuleType) { - this.vfModuleType = vfModuleType; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public String getBaseVfModuleId() { - return baseVfModuleId; - } - - public void setBaseVfModuleId(String baseVfModuleId) { - this.baseVfModuleId = baseVfModuleId; - } - - public String getBaseVfModuleStackId() { - return baseVfModuleStackId; - } - - public void setBaseVfModuleStackId(String baseVfModuleStackId) { - this.baseVfModuleStackId = baseVfModuleStackId; - } - - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public Boolean getFailIfExists() { - return failIfExists; - } - - public void setFailIfExists(Boolean failIfExists) { - this.failIfExists = failIfExists; - } - - public Boolean getBackout() { - return backout; - } - - public void setBackout(Boolean backout) { - this.backout = backout; - } - - public Map getVfModuleParams() { - return vfModuleParams; - } - - public void setVfModuleParams(Map vfModuleParams) { - this.vfModuleParams = vfModuleParams; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java deleted file mode 100644 index 70c9535a32..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVfModuleResponse.java +++ /dev/null @@ -1,105 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("createVfModuleResponse") -@XmlRootElement(name = "createVfModuleResponse") -public class CreateVfModuleResponse extends VfResponseCommon { - private String vnfId; - private String vfModuleId; - private String vfModuleStackId; - private Boolean vfModuleCreated; - private Map vfModuleOutputs = new HashMap<>(); - private VfModuleRollback rollback = new VfModuleRollback(); - - public CreateVfModuleResponse() { - super(); - } - - public CreateVfModuleResponse(String vnfId, String vfModuleId, - String vfModuleStackId, Boolean vfModuleCreated, - Map vfModuleOutputs, VfModuleRollback rollback, - String messageId) { - super(messageId); - this.vnfId = vnfId; - this.vfModuleId = vfModuleId; - this.vfModuleStackId = vfModuleStackId; - this.vfModuleCreated = vfModuleCreated; - this.vfModuleOutputs = vfModuleOutputs; - this.rollback = rollback; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getVfModuleStackId() { - return vfModuleStackId; - } - - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - - public Boolean getVfModuleCreated() { - return vfModuleCreated; - } - - public void setVfModuleCreated(Boolean vfModuleCreated) { - this.vfModuleCreated = vfModuleCreated; - } - - public Map getVfModuleOutputs() { - return vfModuleOutputs; - } - - public void setVfModuleOutputs(Map vfModuleOutputs) { - this.vfModuleOutputs = vfModuleOutputs; - } - - public VfModuleRollback getRollback() { - return rollback; - } - - public void setRollback(VfModuleRollback rollback) { - this.rollback = rollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java deleted file mode 100644 index 2c684e0aa4..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupRequest.java +++ /dev/null @@ -1,148 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("createVolumeGroupRequest") -@XmlRootElement(name = "createVolumeGroupRequest") -public class CreateVolumeGroupRequest extends VfRequestCommon { - private String cloudSiteId; - private String tenantId; - private String volumeGroupName; - private String volumeGroupId; - private String vnfType; - private String vnfVersion; - private String vfModuleType; - private String modelCustomizationUuid; - private Map volumeGroupParams = new HashMap<>(); - private Boolean failIfExists; - private Boolean suppressBackout; - private MsoRequest msoRequest = new MsoRequest(); - - public CreateVolumeGroupRequest() { - super(); - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getVnfType() { - return vnfType; - } - - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public String getVnfVersion() { - return vnfVersion; - } - - public void setVnfVersion(String vnfVersion) { - this.vnfVersion = vnfVersion; - } - - public String getVfModuleType() { - return vfModuleType; - } - - public void setVfModuleType(String vfModuleType) { - this.vfModuleType = vfModuleType; - } - - public Map getVolumeGroupParams() { - return volumeGroupParams; - } - - public void setVolumeGroupParams(Map volumeGroupParams) { - this.volumeGroupParams = volumeGroupParams; - } - - public String getVolumeGroupName() { - return volumeGroupName; - } - - public void setVolumeGroupName(String volumeGroupName) { - this.volumeGroupName = volumeGroupName; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public Boolean getFailIfExists() { - return failIfExists; - } - - public void setFailIfExists(Boolean failIfExists) { - this.failIfExists = failIfExists; - } - - public Boolean getSuppressBackout() { - return suppressBackout; - } - - public void setSuppressBackout(Boolean suppressBackout) { - this.suppressBackout = suppressBackout; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java deleted file mode 100644 index 18a348aa05..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/CreateVolumeGroupResponse.java +++ /dev/null @@ -1,100 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("createVolumeGroupResponse") -@XmlRootElement(name = "createVolumeGroupResponse") -public class CreateVolumeGroupResponse extends VfResponseCommon { - private String volumeGroupId; - private String volumeGroupStackId; - private Boolean volumeGroupCreated; - private Map volumeGroupOutputs = new HashMap<>(); - private VolumeGroupRollback volumeGroupRollback = new VolumeGroupRollback(); - - public CreateVolumeGroupResponse() { - super(); - } - - public CreateVolumeGroupResponse( - String volumeGroupId, - String volumeGroupStackId, - Boolean volumeGroupCreated, - Map volumeGroupOutputs, - VolumeGroupRollback volumeGroupRollback, - String messageId) - { - super(messageId); - this.volumeGroupId = volumeGroupId; - this.volumeGroupStackId = volumeGroupStackId; - this.volumeGroupCreated = volumeGroupCreated; - this.volumeGroupOutputs = volumeGroupOutputs; - this.volumeGroupRollback = volumeGroupRollback; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public Boolean getVolumeGroupCreated() { - return volumeGroupCreated; - } - - public void setVolumeGroupCreated(Boolean volumeGroupCreated) { - this.volumeGroupCreated = volumeGroupCreated; - } - - public Map getVolumeGroupOutputs() { - return volumeGroupOutputs; - } - - public void setVolumeGroupOutputs(Map volumeGroupOutputs) { - this.volumeGroupOutputs = volumeGroupOutputs; - } - - public VolumeGroupRollback getVolumeGroupRollback() { - return volumeGroupRollback; - } - - public void setVolumeGroupRollback(VolumeGroupRollback volumeGroupRollback) { - this.volumeGroupRollback = volumeGroupRollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java deleted file mode 100644 index b2b602ae33..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleRequest.java +++ /dev/null @@ -1,92 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("deleteVfModuleRequest") -@XmlRootElement(name = "deleteVfModuleRequest") -public class DeleteVfModuleRequest extends VfRequestCommon { - private String cloudSiteId; - private String tenantId; - private String vnfId; - private String vfModuleId; - private String vfModuleStackId; - - private MsoRequest msoRequest = new MsoRequest(); - - public DeleteVfModuleRequest() { - super(); - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getVfModuleStackId() { - return vfModuleStackId; - } - - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java deleted file mode 100644 index db04d5b20c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVfModuleResponse.java +++ /dev/null @@ -1,80 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("deleteVfModuleResponse") -@XmlRootElement(name = "deleteVfModuleResponse") -public class DeleteVfModuleResponse extends VfResponseCommon { - private String vnfId; - private String vfModuleId; - private Boolean vfModuleDeleted; - private Map vfModuleOutputs = new HashMap<>(); - public DeleteVfModuleResponse() { - super(); - } - - public DeleteVfModuleResponse(String vnfId, String vfModuleId, Boolean vfModuleDeleted, String messageId, Map outputs) { - super(messageId); - this.vnfId = vnfId; - this.vfModuleId = vfModuleId; - this.vfModuleDeleted = vfModuleDeleted; - this.vfModuleOutputs = outputs; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public Boolean getVfModuleDeleted() { - return vfModuleDeleted; - } - - public void setVfModuleDeleted(Boolean vfModuleDeleted) { - this.vfModuleDeleted = vfModuleDeleted; - } - public Map getVfModuleOutputs() { - return vfModuleOutputs; - } - - public void setVfModuleOutputs(Map vfModuleOutputs) { - this.vfModuleOutputs = vfModuleOutputs; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java deleted file mode 100644 index fc600e2d75..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupRequest.java +++ /dev/null @@ -1,82 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("deleteVolumeGroupRequest") -@XmlRootElement(name = "deleteVolumeGroupRequest") -public class DeleteVolumeGroupRequest extends VfRequestCommon { - private String cloudSiteId; - private String tenantId; - private String volumeGroupId; - private String volumeGroupStackId; - private MsoRequest msoRequest = new MsoRequest(); - - public DeleteVolumeGroupRequest() { - super(); - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java deleted file mode 100644 index 553cc0e8e0..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/DeleteVolumeGroupResponse.java +++ /dev/null @@ -1,49 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("deleteVolumeGroupResponse") -@XmlRootElement(name = "deleteVolumeGroupResponse") -public class DeleteVolumeGroupResponse extends VfResponseCommon { - private Boolean volumeGroupDeleted; - - public DeleteVolumeGroupResponse() { - super(); - } - - public DeleteVolumeGroupResponse(Boolean volumeGroupDeleted, String messageId) { - super(messageId); - this.volumeGroupDeleted = volumeGroupDeleted; - } - - public Boolean getVolumeGroupDeleted() { - return volumeGroupDeleted; - } - - public void setVolumeGroupDeleted(Boolean volumeGroupDeleted) { - this.volumeGroupDeleted = volumeGroupDeleted; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java deleted file mode 100644 index 222644ca1c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVfModuleResponse.java +++ /dev/null @@ -1,97 +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.openecomp.mso.adapters.vnfrest; - -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.VnfStatus; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("queryVfModuleResponse") -@XmlRootElement(name = "queryVfModuleResponse") -public class QueryVfModuleResponse extends VfResponseCommon{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private String vnfId; - private String vfModuleId; - private String vfModuleStackId; - private VnfStatus vnfStatus; - private Map vfModuleOutputs; - - public QueryVfModuleResponse() { - super(); - } - - public QueryVfModuleResponse(String vnfId, String vfModuleId, String vfModuleStackId, VnfStatus vnfStatus, - Map vfModuleOutputs) { - super(); - this.vnfId = vnfId; - this.vfModuleId = vfModuleId; - this.vfModuleStackId = vfModuleStackId; - this.vnfStatus = vnfStatus; - this.vfModuleOutputs = vfModuleOutputs; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getVfModuleStackId() { - return vfModuleStackId; - } - - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - - public VnfStatus getVnfStatus() { - return vnfStatus; - } - - public void setVnfStatus(VnfStatus vnfStatus) { - this.vnfStatus = vnfStatus; - } - - public Map getVfModuleOutputs() { - return vfModuleOutputs; - } - - public void setVfModuleOutputs(Map vfModuleOutputs) { - this.vfModuleOutputs = vfModuleOutputs; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java deleted file mode 100644 index 41226c3696..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/QueryVolumeGroupResponse.java +++ /dev/null @@ -1,103 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.logger.MsoLogger; -import org.openecomp.mso.openstack.beans.VnfStatus; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -@XmlRootElement(name = "queryVolumeGroupResponse") -public class QueryVolumeGroupResponse { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private String volumeGroupId; - private String volumeGroupStackId; - private VnfStatus volumeGroupStatus; - private Map volumeGroupOutputs; - - public QueryVolumeGroupResponse() { - } - - public QueryVolumeGroupResponse( - String volumeGroupId, - String volumeGroupStackId, - VnfStatus volumeGroupStatus, - Map volumeGroupOutputs) - { - super(); - this.volumeGroupId = volumeGroupId; - this.volumeGroupStackId = volumeGroupStackId; - this.volumeGroupStatus = volumeGroupStatus; - this.volumeGroupOutputs = volumeGroupOutputs; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public VnfStatus getVolumeGroupStatus() { - return volumeGroupStatus; - } - - public void setVolumeGroupStatus(VnfStatus volumeGroupStatus) { - this.volumeGroupStatus = volumeGroupStatus; - } - - public Map getVolumeGroupOutputs() { - return volumeGroupOutputs; - } - - public void setVolumeGroupOutputs(Map volumeGroupOutputs) { - this.volumeGroupOutputs = volumeGroupOutputs; - } - - public String toJsonString() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - } - catch (Exception e) { - LOGGER.debug("Exception :",e); - } - return jsonString; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java deleted file mode 100644 index aa9b35bb98..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleRequest.java +++ /dev/null @@ -1,45 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("rollbackVfModuleRequest") -@XmlRootElement(name = "rollbackVfModuleRequest") -public class RollbackVfModuleRequest extends VfRequestCommon { - private VfModuleRollback vfModuleRollback; - - public RollbackVfModuleRequest() { - super(); - } - - public VfModuleRollback getVfModuleRollback() { - return vfModuleRollback; - } - - public void setVfModuleRollback(VfModuleRollback vfModuleRollback) { - this.vfModuleRollback = vfModuleRollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java deleted file mode 100644 index c77155fe81..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVfModuleResponse.java +++ /dev/null @@ -1,49 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("rollbackVfModuleResponse") -@XmlRootElement(name = "rollbackVfModuleResponse") -public class RollbackVfModuleResponse extends VfResponseCommon { - private Boolean vfModuleRolledback; - - public RollbackVfModuleResponse() { - super(); - } - - public RollbackVfModuleResponse(Boolean vfModuleRolledback, String messageId) { - super(messageId); - this.vfModuleRolledback = vfModuleRolledback; - } - - public Boolean getVfModuleRolledback() { - return vfModuleRolledback; - } - - public void setVfModuleRolledback(Boolean vfModuleRolledback) { - this.vfModuleRolledback = vfModuleRolledback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java deleted file mode 100644 index d7f49fd530..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupRequest.java +++ /dev/null @@ -1,44 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("rollbackVolumeGroupRequest") -@XmlRootElement(name = "rollbackVolumeGroupRequest") -public class RollbackVolumeGroupRequest extends VfRequestCommon { - private VolumeGroupRollback volumeGroupRollback; - - public RollbackVolumeGroupRequest() { - super(); - } - - public VolumeGroupRollback getVolumeGroupRollback() { - return volumeGroupRollback; - } - - public void setVolumeGroupRollback(VolumeGroupRollback volumeGroupRollback) { - this.volumeGroupRollback = volumeGroupRollback; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java deleted file mode 100644 index 22164d9508..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/RollbackVolumeGroupResponse.java +++ /dev/null @@ -1,49 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("rollbackVolumeGroupResponse") -@XmlRootElement(name = "rollbackVolumeGroupResponse") -public class RollbackVolumeGroupResponse extends VfResponseCommon { - private Boolean volumeGroupRolledBack; - - public RollbackVolumeGroupResponse() { - super(); - } - - public RollbackVolumeGroupResponse(Boolean volumeGroupRolledBack, String messageId) { - super(messageId); - this.volumeGroupRolledBack = volumeGroupRolledBack; - } - - public Boolean getVolumeGroupRolledBack() { - return volumeGroupRolledBack; - } - - public void setVolumeGroupRolledBack(Boolean volumeGroupRolledBack) { - this.volumeGroupRolledBack = volumeGroupRolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java deleted file mode 100644 index c52cc60b35..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleRequest.java +++ /dev/null @@ -1,215 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("updateVfModuleRequest") -@XmlRootElement(name = "updateVfModuleRequest") -public class UpdateVfModuleRequest extends VfRequestCommon { - - private String cloudSiteId; - private String tenantId; - - private String vnfId; - private String vnfType; - private String vnfVersion; - - private String vfModuleName; - private String vfModuleType; - private String vfModuleId; - private String vfModuleStackId; - - private String volumeGroupId; - private String volumeGroupStackId; - - private String baseVfModuleId; - private String baseVfModuleStackId; - - private String modelCustomizationUuid; - - private String requestType; - private Boolean failIfExists; - private Boolean backout; - - private Map vfModuleParams = new HashMap<>(); - private MsoRequest msoRequest = new MsoRequest(); - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleName() { - return vfModuleName; - } - - public void setVfModuleName(String vfModuleName) { - this.vfModuleName = vfModuleName; - } - - public String getVnfType() { - return vnfType; - } - - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public String getVnfVersion() { - return vnfVersion; - } - - public void setVnfVersion(String vnfVersion) { - this.vnfVersion = vnfVersion; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getVfModuleType() { - return vfModuleType; - } - - public void setVfModuleType(String vfModuleType) { - this.vfModuleType = vfModuleType; - } - - public String getVfModuleStackId() { - return vfModuleStackId; - } - - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public String getBaseVfModuleId() { - return baseVfModuleId; - } - - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public void setBaseVfModuleId(String baseVfModuleId) { - this.baseVfModuleId = baseVfModuleId; - } - - public String getBaseVfModuleStackId() { - return baseVfModuleStackId; - } - - public void setBaseVfModuleStackId(String baseVfModuleStackId) { - this.baseVfModuleStackId = baseVfModuleStackId; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public Boolean getFailIfExists() { - return failIfExists; - } - - public void setFailIfExists(Boolean failIfExists) { - this.failIfExists = failIfExists; - } - - public Boolean getBackout() { - return backout; - } - - public void setBackout(Boolean backout) { - this.backout = backout; - } - - public Map getVfModuleParams() { - return vfModuleParams; - } - - public void setVfModuleParams(Map vfModuleParams) { - this.vfModuleParams = vfModuleParams; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java deleted file mode 100644 index aa9a3aad31..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVfModuleResponse.java +++ /dev/null @@ -1,85 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("updateVfModuleResponse") -@XmlRootElement(name = "updateVfModuleResponse") -public class UpdateVfModuleResponse extends VfResponseCommon { - private String vnfId; - private String vfModuleId; - private String vfModuleStackId; - private Map vfModuleOutputs = new HashMap<>(); - - public UpdateVfModuleResponse() { - super(); - } - - public UpdateVfModuleResponse(String vnfId, String vfModuleId, - String vfModuleStackId, - Map vfModuleOutputs, - String messageId) { - super(messageId); - this.vnfId = vnfId; - this.vfModuleId = vfModuleId; - this.vfModuleStackId = vfModuleStackId; - this.vfModuleOutputs = vfModuleOutputs; - } - - public String getVnfId() { - return vnfId; - } - - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - - public String getVfModuleId() { - return vfModuleId; - } - - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - - public String getVfModuleStackId() { - return vfModuleStackId; - } - - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - - public Map getVfModuleOutputs() { - return vfModuleOutputs; - } - - public void setVfModuleOutputs(Map vfModuleOutputs) { - this.vfModuleOutputs = vfModuleOutputs; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java deleted file mode 100644 index 983e81602c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupRequest.java +++ /dev/null @@ -1,130 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("updateVolumeGroupRequest") -@XmlRootElement(name = "updateVolumeGroupRequest") -public class UpdateVolumeGroupRequest extends VfRequestCommon { - private String cloudSiteId; - private String tenantId; - private String volumeGroupId; - private String volumeGroupStackId; - private String vnfType; - private String vnfVersion; - private String vfModuleType; - private String modelCustomizationUuid; - private Map volumeGroupParams = new HashMap<>(); - private MsoRequest msoRequest = new MsoRequest(); - - public UpdateVolumeGroupRequest() { - super(); - } - - public String getCloudSiteId() { - return cloudSiteId; - } - - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public String getVnfType() { - return vnfType; - } - - public void setVnfType(String vnfType) { - this.vnfType = vnfType; - } - - public String getVnfVersion() { - return vnfVersion; - } - - public void setVnfVersion(String vnfVersion) { - this.vnfVersion = vnfVersion; - } - - public String getVfModuleType() { - return vfModuleType; - } - - public void setVfModuleType(String vfModuleType) { - this.vfModuleType = vfModuleType; - } - - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public Map getVolumeGroupParams() { - return volumeGroupParams; - } - - public void setVolumeGroupParams(Map volumeGroupParams) { - this.volumeGroupParams = volumeGroupParams; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java deleted file mode 100644 index d71ef275e1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/UpdateVolumeGroupResponse.java +++ /dev/null @@ -1,79 +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.openecomp.mso.adapters.vnfrest; - - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("updateVolumeGroupResponse") -@XmlRootElement(name = "updateVolumeGroupResponse") -public class UpdateVolumeGroupResponse extends VfResponseCommon { - private String volumeGroupId; - private String volumeGroupStackId; - private Map volumeGroupOutputs; - - public UpdateVolumeGroupResponse() { - super(); - this.volumeGroupOutputs = new HashMap<>(); - } - - public UpdateVolumeGroupResponse( - String volumeGroupId, - String volumeGroupStackId, - Map volumeGroupOutputs, - String messageId) - { - super(messageId); - this.volumeGroupId = volumeGroupId; - this.volumeGroupStackId = volumeGroupStackId; - this.volumeGroupOutputs = volumeGroupOutputs; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - - public Map getVolumeGroupOutputs() { - return volumeGroupOutputs; - } - - public void setVolumeGroupOutputs(Map volumeGroupOutputs) { - this.volumeGroupOutputs = volumeGroupOutputs; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java deleted file mode 100644 index 6416d2df5e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleExceptionResponse.java +++ /dev/null @@ -1,75 +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.openecomp.mso.adapters.vnfrest; - - -import java.io.Serializable; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "vfModuleException") - -public class VfModuleExceptionResponse extends VfResponseCommon implements Serializable { - private static final long serialVersionUID = -9062290006520066109L; - - private String message; - private MsoExceptionCategory category; - private Boolean rolledBack; - - public VfModuleExceptionResponse () {} - - public VfModuleExceptionResponse (String message) { - this.message = message; - } - - public VfModuleExceptionResponse (String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { - super(messageid); - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public MsoExceptionCategory getCategory () { - return category; - } - - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public Boolean getRolledBack() { - return rolledBack; - } - - public void setRolledBack(Boolean rolledBack) { - this.rolledBack = rolledBack; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java deleted file mode 100644 index 59bd5020d2..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfModuleRollback.java +++ /dev/null @@ -1,130 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; -import org.openecomp.mso.openstack.beans.VnfRollback; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("VfModuleRollback") -@XmlRootElement(name = "VfModuleRollback") -public class VfModuleRollback { - private String vnfId; - private String vfModuleId; - private String vfModuleStackId; - private boolean vfModuleCreated = false; - private String tenantId; - private String cloudSiteId; - private MsoRequest msoRequest; - private String messageId; - private String mode = "HEAT"; // default - - public VfModuleRollback() { - } - - public VfModuleRollback(VnfRollback vrb, String vfModuleId, String vfModuleStackId, String messageId) - { - this.vnfId = vrb.getVnfId(); - this.vfModuleId = vfModuleId; - this.vfModuleStackId = vfModuleStackId; - this.vfModuleCreated = vrb.getVnfCreated(); - this.tenantId = vrb.getTenantId(); - this.cloudSiteId = vrb.getCloudSiteId(); - this.msoRequest = vrb.getMsoRequest(); - this.messageId = messageId; - this.mode = vrb.getMode(); - } - - public VfModuleRollback(String vnfId, String vfModuleId, - String vfModuleStackId, boolean vfModuleCreated, String tenantId, - String cloudSiteId, - MsoRequest msoRequest, - String messageId) { - super(); - this.vnfId = vnfId; - this.vfModuleId = vfModuleId; - this.vfModuleStackId = vfModuleStackId; - this.vfModuleCreated = vfModuleCreated; - this.tenantId = tenantId; - this.cloudSiteId = cloudSiteId; - this.msoRequest = msoRequest; - this.messageId = messageId; - } - - public String getVnfId() { - return vnfId; - } - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - public String getVfModuleId() { - return vfModuleId; - } - public void setVfModuleId(String vfModuleId) { - this.vfModuleId = vfModuleId; - } - public String getVfModuleStackId() { - return vfModuleStackId; - } - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - public boolean isVfModuleCreated() { - return vfModuleCreated; - } - public void setVfModuleCreated(boolean vfModuleCreated) { - this.vfModuleCreated = vfModuleCreated; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getCloudSiteId() { - return cloudSiteId; - } - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - public MsoRequest getMsoRequest() { - return msoRequest; - } - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - public String getMessageId() { - return messageId; - } - public void setMessageId(String messageId) { - this.messageId = messageId; - } - public String getMode() { - return mode; - } - public void setMode(String mode) { - this.mode = mode; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java deleted file mode 100644 index aa6af56082..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfRequestCommon.java +++ /dev/null @@ -1,53 +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.openecomp.mso.adapters.vnfrest; - - -/** - * Everything that is common between all VfModule and VolumeGroup Requests. - */ -public abstract class VfRequestCommon extends VfResponseCommon { - private Boolean skipAAI; - private String notificationUrl; - - public Boolean getSkipAAI() { - return skipAAI; - } - - public void setSkipAAI(Boolean skipAAI) { - this.skipAAI = skipAAI; - } - - public String getNotificationUrl() { - return notificationUrl; - } - - public void setNotificationUrl(String notificationUrl) { - this.notificationUrl = notificationUrl; - } - - public boolean isSynchronous() { - return notificationUrl == null || notificationUrl.isEmpty(); - } - - // getMessageId, setMessageId, toJsonString, toJsonString are all defined in VfResponseCommon. -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java deleted file mode 100644 index 4f55c5a615..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VfResponseCommon.java +++ /dev/null @@ -1,85 +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.openecomp.mso.adapters.vnfrest; - - -import java.io.ByteArrayOutputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import org.openecomp.mso.logger.MsoLogger; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * Everything that is common between all VfModule and VolumeGroup Responses, - * except for QueryVfModuleResponse and QueryVolumeGroupResponse. - */ -public abstract class VfResponseCommon { - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private String messageId; - - public VfResponseCommon() { - messageId = null; - } - - public VfResponseCommon(String messageId) { - this.messageId = messageId; - } - - public String getMessageId() { - return messageId; - } - - public void setMessageId(String messageId) { - this.messageId = messageId; - } - - public String toJsonString() { - try { - String jsonString; - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - return jsonString; - } catch (Exception e) { - LOGGER.debug("Exception :",e); - return ""; - } - } - - public String toXmlString() { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML - marshaller.marshal(this, bs); - return bs.toString(); - } catch (Exception e) { - LOGGER.debug("Exception :",e); - return ""; - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java deleted file mode 100644 index 4c3a0a6d60..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupExceptionResponse.java +++ /dev/null @@ -1,45 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory; - -@XmlRootElement(name = "volumeGroupException") -public class VolumeGroupExceptionResponse extends VfModuleExceptionResponse { - // Exactly the same as a VfModuleExceptionResponse - - private static final long serialVersionUID = 1168681288205898800L; - - public VolumeGroupExceptionResponse() { - super(); - } - - public VolumeGroupExceptionResponse(String message) { - super(message); - } - - public VolumeGroupExceptionResponse(String message, MsoExceptionCategory category, boolean rolledBack, String messageid) { - super(message, category, rolledBack, messageid); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java deleted file mode 100644 index c815a7658c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/adapters/vnfrest/VolumeGroupRollback.java +++ /dev/null @@ -1,128 +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.openecomp.mso.adapters.vnfrest; - - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("VolumeGroupRollback") -@XmlRootElement(name = "VolumeGroupRollback") -public class VolumeGroupRollback { -// “volumeGroupRollback”: { -// “volumeGroupId”: “”, -// “volumeGroupStackId”: “”, -// “tenantId”: “”, -// “cloudSiteId”: “”, -// “volumeGroupCreated”: TRUE|FALSE, -// “msoRequest”: { -// “requestId”: “”, -// “serviceInstanceId”: “” -// } -//}, - - private String volumeGroupId; - private String volumeGroupStackId; - private String tenantId; - private String cloudSiteId; - private boolean volumeGroupCreated = false; - private MsoRequest msoRequest; - private String messageId; - - public VolumeGroupRollback() { - } - - public VolumeGroupRollback(VolumeGroupRollback vrb, String volumeGroupStackId, String messageId) - { - this.volumeGroupId = vrb.getVolumeGroupId(); - this.volumeGroupStackId = volumeGroupStackId; - this.tenantId = vrb.getTenantId(); - this.cloudSiteId = vrb.getCloudSiteId(); - this.volumeGroupCreated = vrb.isVolumeGroupCreated(); - this.msoRequest = vrb.getMsoRequest(); - this.messageId = messageId; - } - - public VolumeGroupRollback( - String volumeGroupId, - String volumeGroupStackId, - boolean volumeGroupCreated, - String tenantId, - String cloudSiteId, - MsoRequest msoRequest, - String messageId) - { - super(); - this.volumeGroupId = volumeGroupId; - this.volumeGroupStackId = volumeGroupStackId; - this.volumeGroupCreated = volumeGroupCreated; - this.tenantId = tenantId; - this.cloudSiteId = cloudSiteId; - this.msoRequest = msoRequest; - this.messageId = messageId; - } - - public String getVolumeGroupId() { - return volumeGroupId; - } - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - public String getVolumeGroupStackId() { - return volumeGroupStackId; - } - public void setVolumeGroupStackId(String volumeGroupStackId) { - this.volumeGroupStackId = volumeGroupStackId; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getCloudSiteId() { - return cloudSiteId; - } - public void setCloudSiteId(String cloudSiteId) { - this.cloudSiteId = cloudSiteId; - } - public boolean isVolumeGroupCreated() { - return volumeGroupCreated; - } - public void setVolumeGroupCreated(boolean volumeGroupCreated) { - this.volumeGroupCreated = volumeGroupCreated; - } - public MsoRequest getMsoRequest() { - return msoRequest; - } - public void setMsoRequest(MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - public String getMessageId() { - return messageId; - } - public void setMessageId(String messageId) { - this.messageId = messageId; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java deleted file mode 100644 index 8e223b7bcb..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HeatStatus.java +++ /dev/null @@ -1,30 +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.openecomp.mso.openstack.beans; - - -/* - * Enum status values to mirror the Openstack Heat stack status values - */ -public enum HeatStatus { - INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED -} - diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java deleted file mode 100644 index 4d9dc0009e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/HostRoute.java +++ /dev/null @@ -1,69 +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.openecomp.mso.openstack.beans; - - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "prefix", - "nextHop" -}) -public class HostRoute { - - private String prefix; - private String nextHop; - - /** - * @return the prefix - */ - public String getPrefix() { - return prefix; - } - /** - * @param prefix the prefix to set - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - /** - * @return the nextHop - */ - public String getNextHop() { - return nextHop; - } - /** - * @param nextHop the nextHop to set - */ - public void setNextHop(String nextHop) { - this.nextHop = nextHop; - } - - @Override - public String toString() { - return "Host_route [prefix=" + prefix + ", nextHop=" + nextHop + "]"; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java deleted file mode 100644 index 5e037096df..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/MsoTenant.java +++ /dev/null @@ -1,66 +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.openecomp.mso.openstack.beans; - - - -import java.util.Map; - -/** - * This bean class represents the Openstack tenant properties that are - * needed by MSO. - * - * - */ -public class MsoTenant { - private String tenantId; - private String tenantName; - private Map metadata; - - public MsoTenant() {} - - public MsoTenant (String id, String name, Map metadata) { - this.tenantId = id; - this.tenantName = name; - this.metadata = metadata; - } - - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getTenantName() { - return tenantName; - } - public void setTenantName(String tenantName) { - this.tenantName = tenantName; - } - - public Map getMetadata() { - return metadata; - } - public void setMetadata(Map metadata) { - this.metadata = metadata; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java deleted file mode 100644 index 64460b20bb..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkInfo.java +++ /dev/null @@ -1,151 +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.openecomp.mso.openstack.beans; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; - -import com.woorea.openstack.quantum.model.Network; -import com.woorea.openstack.quantum.model.Segment; - -/* - * This Java bean class relays Network details (including status) to ActiveVOS processes. - * - * This bean is returned by all Network-specific adapter operations (create, query, delete) - */ -public class NetworkInfo { - // Set defaults for everything - private String name = ""; - private String id = ""; - private NetworkStatus status = NetworkStatus.UNKNOWN; - private String provider = ""; - private List vlans = new ArrayList<>(); - private List subnets = new ArrayList<>(); - - static Map NetworkStatusMap; - static { - NetworkStatusMap = new HashMap<>(); - NetworkStatusMap.put("ACTIVE", NetworkStatus.ACTIVE); - NetworkStatusMap.put("DOWN", NetworkStatus.DOWN); - NetworkStatusMap.put("BUILD", NetworkStatus.BUILD); - NetworkStatusMap.put("ERROR", NetworkStatus.ERROR); - } - - /** - * Capture the data from a Neutron Network object. - * - * For MSO, there are assumptions regarding all networks. - * - Everything will be a provider network - * - All provider networks are VLANs - * - Multiple VLANs are supported, and indicated by multi-provider segments. - * Each will have the same physical network & network type "vlan". - * - * @param network - */ - public NetworkInfo(Network network) { - if (network != null) { - initFieldsWithDataFromNetwork(network); - } else { - status = NetworkStatus.NOTFOUND; - } - } - - private void initFieldsWithDataFromNetwork(Network network){ - name = network.getName(); - id = network.getId(); - - if (network.getStatus() != null && NetworkStatusMap.containsKey(network.getStatus())) { - status = NetworkStatusMap.get(network.getStatus()); - } - if (network.getProviderPhysicalNetwork() != null) { - provider = network.getProviderPhysicalNetwork(); - if ("vlan".equals(network.getProviderNetworkType())) { - vlans.add(network.getProviderSegmentationId()); - } - } - else if (network.getSegments() != null && !network.getSegments().isEmpty()) { - Segment s = network.getSegments().get(0); - provider = s.getProviderPhysicalNetwork(); - if ("vlan".equals(s.getProviderNetworkType())) { - network.getSegments().forEach(segment -> vlans.add(segment.getProviderSegmentationId())); - } - } - subnets = network.getSubnets(); - } - - public String getName() { - return name; - } - - public void setName (String name) { - this.name = name; - } - - public String getId() { - return id; - } - - public void setId (String id) { - this.id = id; - } - - public NetworkStatus getStatus() { - return status; - } - - public void setStatus (NetworkStatus status) { - this.status = status; - } - - public String getProvider() { - return provider; - } - - public void setProvider (String provider) { - this.provider = provider; - } - - public List getVlans () { - return vlans; - } - - public void setVlans (List vlans) { - this.vlans = vlans; - } - - public List getSubnets () { - return subnets; - } - - @Override - public String toString() { - return "NetworkInfo{" + "name='" + name + '\'' + - ", id='" + id + '\'' + - ", status=" + status + - ", provider='" + provider + '\'' + - ", vlans=" + vlans + - ", subnets=" + subnets + - '}'; - } -} - diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java deleted file mode 100644 index a965122921..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkRollback.java +++ /dev/null @@ -1,152 +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.openecomp.mso.openstack.beans; - - -import java.util.List; - -import org.openecomp.mso.entity.MsoRequest; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; - -/** - * Javabean representing the rollback criteria following a "Create Network" - * or "Update Network" operation. This structure can be passed back to the - * "Rollback Network" operation to undo the effects of the create/update. - * - * Once a network is created, the only possible update through MSO is to - * the set of VLANs supported by the network. The vlans attribute of the - * rollback object contains the previous VLANs before update. - * - * - */ -@JsonInclude(Include.NON_EMPTY) -public class NetworkRollback { - private String networkId; - private String neutronNetworkId; - private String networkStackId; - private String tenantId; - private String cloudId; - private String networkType; - private String modelCustomizationUuid; - private boolean networkCreated = false; - // Previous values for updates - private String networkName = null; - private String physicalNetwork = null; - private List vlans = null; - private MsoRequest msoRequest; - - public String getNetworkId() { - return networkId; - } - public void setNetworkId(String networkId) { - this.networkId = networkId; - } - - public String getNeutronNetworkId() { - return neutronNetworkId; - } - public void setNeutronNetworkId(String neutronNetworkId) { - this.neutronNetworkId = neutronNetworkId; - } - - public String getNetworkStackId() { - return networkStackId; - } - public void setNetworkStackId(String networkStackId) { - this.networkStackId = networkStackId; - } - public String getTenantId() { - return tenantId; - } - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - public String getCloudId() { - return cloudId; - } - public void setCloudId(String cloudId) { - this.cloudId = cloudId; - } - - public String getNetworkType() { - return networkType; - } - public void setNetworkType(String networkType) { - this.networkType = networkType; - } - - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - - public boolean getNetworkCreated() { - return networkCreated; - } - public void setNetworkCreated(boolean networkCreated) { - this.networkCreated = networkCreated; - } - - public String getNetworkName() { - return networkName; - } - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - public String getPhysicalNetwork() { - return physicalNetwork; - } - public void setPhysicalNetwork(String physicalNetwork) { - this.physicalNetwork = physicalNetwork; - } - - public List getVlans () { - return vlans; - } - public void setVlans (List vlans) { - this.vlans = vlans; - } - - public MsoRequest getMsoRequest() { - return msoRequest; - } - public void setMsoRequest (MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - - @Override - public String toString() { - return "NetworkRollback [networkId=" + networkId - + ", neutronNetworkId=" + neutronNetworkId + ", networkStackId=" - + networkStackId + ", tenantId=" + tenantId + ", cloudId=" - + cloudId + ", networkType=" + networkType - + ", networkCreated=" + networkCreated + ", networkName=" + networkName - + ", physicalNetwork=" + physicalNetwork + "]"; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java deleted file mode 100644 index 199028e56c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/NetworkStatus.java +++ /dev/null @@ -1,31 +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.openecomp.mso.openstack.beans; - - -/** - * Enum status values to mirror the Openstack Neutron - * network status values - */ -public enum NetworkStatus { - NOTFOUND, ACTIVE, DOWN, BUILD, ERROR, UNKNOWN -} - diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java deleted file mode 100644 index a3a04abc60..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Pool.java +++ /dev/null @@ -1,69 +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.openecomp.mso.openstack.beans; - - - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "start", - "end" -}) -public class Pool { - - private String start; - private String end; - - /** - * @return the start - */ - public String getStart() { - return start; - } - /** - * @param start the start to set - */ - public void setStart(String start) { - this.start = start; - } - /** - * @return the end - */ - public String getEnd() { - return end; - } - /** - * @param end the end to set - */ - public void setEnd(String end) { - this.end = end; - } - - @Override - public String toString() { - return "Allocation_pool [start=" + start + ", end=" + end + "]"; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java deleted file mode 100644 index 7903b08ff9..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/RouteTarget.java +++ /dev/null @@ -1,56 +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.openecomp.mso.openstack.beans; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "routeTarget", - "routeTargetRole" -}) -public class RouteTarget { - - private String routeTarget; - private String routeTargetRole; - - public String getRouteTarget() { - return routeTarget; - } - public void setRouteTarget(String routeTarget) { - this.routeTarget = routeTarget; - } - public String getRouteTargetRole() { - return routeTargetRole; - } - public void setRole(String routeTargetRole) { - this.routeTargetRole = routeTargetRole; - } - - - @Override - public String toString() { - return "RouteTarget [routeTarget=" + routeTarget + ", routeTargetRole=" + routeTargetRole + "]"; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java deleted file mode 100644 index e88b5f87a0..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/StackInfo.java +++ /dev/null @@ -1,155 +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.openecomp.mso.openstack.beans; - - -import java.util.Map; -import java.util.HashMap; - -import com.woorea.openstack.heat.model.Stack; - -/* - * This Java bean class relays Heat stack status information to ActiveVOS processes. - * - * This bean is returned by all Heat-specific adapter operations (create, query, delete) - */ - -public class StackInfo { - // Set defaults for everything - private String name = ""; - private String canonicalName = ""; - private HeatStatus status = HeatStatus.UNKNOWN; - private String statusMessage = ""; - private Map outputs = new HashMap<>(); - private Map parameters = new HashMap<>(); - - static Map HeatStatusMap; - static { - HeatStatusMap = new HashMap<>(); - HeatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING); - HeatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED); - HeatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED); - HeatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING); - HeatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND); - HeatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED); - HeatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING); - HeatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED); - HeatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED); - } - - public StackInfo () { - } - - public StackInfo (String name, HeatStatus status, String statusMessage, Map outputs) { - this.name = name; - this.canonicalName = name; // Don't have an ID, so just use name - - this.status = status; - if (statusMessage != null) this.statusMessage = statusMessage; - if (outputs != null) this.outputs = outputs; - } - - public StackInfo (String name, HeatStatus status) { - this.name = name; - this.canonicalName = name; // Don't have an ID, so just use name - this.status = status; - } - - public StackInfo (Stack stack) - { - if (stack == null) { - this.status = HeatStatus.NOTFOUND; - return; - } - - this.name = stack.getStackName(); - this.canonicalName = stack.getStackName() + "/" + stack.getId(); - - if (stack.getStackStatus() == null) { - this.status = HeatStatus.INIT; - } else if (HeatStatusMap.containsKey(stack.getStackStatus())) { - this.status = HeatStatusMap.get(stack.getStackStatus()); - } else { - this.status = HeatStatusMap.getOrDefault(stack.getStackStatus(), HeatStatus.UNKNOWN); - } - - this.statusMessage = stack.getStackStatusReason(); - - if (stack.getOutputs() != null) { - this.outputs = new HashMap<>(); - for (Stack.Output output : stack.getOutputs()) { - this.outputs.put(output.getOutputKey(), output.getOutputValue()); - } - } - - this.parameters = stack.getParameters(); - } - - public String getName() { - return name; - } - - public void setName (String name) { - this.name = name; - } - - public String getCanonicalName() { - return canonicalName; - } - - public void setCanonicalName (String name) { - this.canonicalName = name; - } - - public HeatStatus getStatus() { - return status; - } - - public void setStatus (HeatStatus status) { - this.status = status; - } - - public String getStatusMessage() { - return statusMessage; - } - - public void setStatusMessage (String statusMessage) { - this.statusMessage = statusMessage; - } - - public Map getOutputs () { - return outputs; - } - - public void setOutputs (Map outputs) { - this.outputs = outputs; - } - - public Map getParameters () { - return parameters; - } - - public void setParameters (Map parameters) { - this.parameters = parameters; - } - -} - diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java deleted file mode 100644 index 086395cc93..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/Subnet.java +++ /dev/null @@ -1,207 +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.openecomp.mso.openstack.beans; - - - -import java.util.List; - -import javax.xml.bind.annotation.XmlTransient; - -public class Subnet { - - private String subnetName; - - private String neutronId; - - private String subnetId; // value from aai - - private String cidr; //Only field required - - private String gatewayIp=""; - - private String ipVersion="4"; - - private Boolean enableDHCP=false; - - private Boolean addrFromStart=true; - - private List hostRoutes; - - private List allocationPools; - - private List dnsNameServers; - - public Subnet () { - } - - public String getSubnetName() { - return subnetName; - } - - public void setSubnetName(String subnetName) { - this.subnetName = subnetName; - } - - public List getAllocationPools() { - return allocationPools; - } - - /** - * @return the cidr - */ - public String getCidr() { - return cidr; - } - - /** - * @return the dnsNames - */ - public List getDnsNameServers() { - return dnsNameServers; - } - - - public Boolean getEnableDHCP() { - return enableDHCP; - } - - public Boolean getAddrFromStart() { - return addrFromStart; - } - - public void setAddrFromStart(Boolean addrFromStart) { - this.addrFromStart = addrFromStart; - } - - /** - * @return the gw - */ - public String getGatewayIp() { - return gatewayIp; - } - - /** - * @return the hostRoutes - */ - public List getHostRoutes() { - return hostRoutes; - } - - /** - * @return the NeutronId - */ - @XmlTransient - public String getNeutronId() { - return neutronId; - } - - /** - * @return the ipversion - */ - public String getIpVersion() { - return ipVersion; - } - - /** - * @return the name - */ - public String getSubnetId() { - return subnetId; - } - - public void setAllocationPools(List allocationPools) { - this.allocationPools = allocationPools; - } - - /** - * @param cidr - * the cidr to set - */ - public void setCidr(String cidr) { - this.cidr = cidr; - } - - /** - * @param dnsNames - * the dnsNames to set - */ - public void setDnsNameServers(List dnsNameServers) { - this.dnsNameServers = dnsNameServers; - } - - /** - * @param enableDHCP - * the enableDHCP to set - */ - public void setEnableDHCP(Boolean enableDHCP) { - this.enableDHCP = enableDHCP; - } - - /** - * @param gw - * the gw to set - */ - public void setGatewayIp(String gatewayIp) { - this.gatewayIp = gatewayIp; - } - - /** - * @param hostRoutes - * the hostRoutes to set - */ - public void setHostRoutes(List hostRoutes) { - this.hostRoutes = hostRoutes; - } - - /** - * @param neutronId - * the id to set - */ - public void setNeutronId(String neutronId) { - this.neutronId = neutronId; - } - - /** - * @param ipversion - * the ipversion to set - */ - public void setIpVersion(String ipVersion) { - this.ipVersion = ipVersion; - } - - /** - * @param name - * the name to set - */ - public void setSubnetId(String subnetId) { - this.subnetId = subnetId; - } - - @Override - public String toString() { - return "Subnet [subnetName=" + subnetName + ", neutronId=" + neutronId + ", subnetId=" + subnetId + ", cidr=" - + cidr + ", gatewayIp=" + gatewayIp + ", ipVersion=" + ipVersion + ", enableDHCP=" + enableDHCP - + ", addrFromStart=" + addrFromStart + ", hostRoutes=" + hostRoutes + ", allocationPools=" - + allocationPools + ", dnsNameServers=" + dnsNameServers + "]"; - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java deleted file mode 100644 index c4f63138e0..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfRollback.java +++ /dev/null @@ -1,214 +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.openecomp.mso.openstack.beans; - -import org.openecomp.mso.entity.MsoRequest; -/** - * Javabean representing the rollback criteria following a "Create VNF" - * operation. This structure can be passed back to the "Rollback VNF" - * operation to undo the effects of the create. - * - * - */ -public class VnfRollback { - private String vnfId; - private String tenantId; - private String cloudSiteId; - private boolean tenantCreated = false; - private boolean vnfCreated = false; - private MsoRequest msoRequest; - private String volumeGroupName; - private String volumeGroupId; - private String requestType; - private String volumeGroupHeatStackId; - private String baseGroupHeatStackId; - private boolean isBase = false; - private String vfModuleStackId; - private String modelCustomizationUuid; //NOTE: this is the vfModule's modelCustomizationUuid - private String mode = "HEAT"; - - public VnfRollback() {} - - /** - * For backwards compatibility... orchestration mode defaults to HEAT - * - * @param vnfId - * @param tenantId - * @param cloudSiteId - * @param tenantCreated - * @param vnfCreated - * @param msoRequest - * @param volumeGroupName - * @param volumeGroupId - * @param requestType - * @param modelCustomizationUuid - */ - public VnfRollback(String vnfId, String tenantId, String cloudSiteId, - boolean tenantCreated, boolean vnfCreated, - MsoRequest msoRequest, - String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) { - super(); - this.vnfId = vnfId; - this.tenantId = tenantId; - this.cloudSiteId = cloudSiteId; - this.tenantCreated = tenantCreated; - this.vnfCreated = vnfCreated; - this.msoRequest = msoRequest; - this.volumeGroupName = volumeGroupName; - this.volumeGroupId = volumeGroupId; - this.requestType = requestType; - this.modelCustomizationUuid = modelCustomizationUuid; - } - - /** - * For backwards compatibility... orchestration mode defaults to HEAT - * - * @param vnfId - * @param tenantId - * @param cloudSiteId - * @param tenantCreated - * @param vnfCreated - * @param msoRequest - * @param volumeGroupName - * @param volumeGroupId - * @param requestType - * @param modelCustomizationUuid - */ - public VnfRollback(String vnfId, String tenantId, String cloudSiteId, - boolean tenantCreated, boolean vnfCreated, - MsoRequest msoRequest, String volumeGroupName, String volumeGroupId, - String requestType, String modelCustomizationUuid, String orchestrationMode) { - super(); - this.vnfId = vnfId; - this.tenantId = tenantId; - this.cloudSiteId = cloudSiteId; - this.tenantCreated = tenantCreated; - this.vnfCreated = vnfCreated; - this.msoRequest = msoRequest; - this.volumeGroupName = volumeGroupName; - this.volumeGroupId = volumeGroupId; - this.requestType = requestType; - this.modelCustomizationUuid = modelCustomizationUuid; - this.mode = orchestrationMode; - } - - public String getVnfId() { - return vnfId; - } - public void setVnfId(String vnfId) { - this.vnfId = vnfId; - } - public String getTenantId() { - return tenantId; - } - - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - public String getCloudSiteId() { - return cloudSiteId; - } - public void setCloudSiteId(String cloudId) { - this.cloudSiteId = cloudId; - } - public boolean getTenantCreated() { - return tenantCreated; - } - public void setTenantCreated(boolean tenantCreated) { - this.tenantCreated = tenantCreated; - } - public boolean getVnfCreated() { - return vnfCreated; - } - public void setVnfCreated(boolean vnfCreated) { - this.vnfCreated = vnfCreated; - } - public MsoRequest getMsoRequest() { - return msoRequest; - } - public void setMsoRequest (MsoRequest msoRequest) { - this.msoRequest = msoRequest; - } - public String getVolumeGroupName() { - return this.volumeGroupName; - } - public void setVolumeGroupName(String volumeGroupName) { - this.volumeGroupName = volumeGroupName; - } - public String getVolumeGroupId() { - return this.volumeGroupId; - } - public void setVolumeGroupId(String volumeGroupId) { - this.volumeGroupId = volumeGroupId; - } - public String getRequestType() { - return this.requestType; - } - public void setRequestType(String requestType) { - this.requestType = requestType; - } - public String getVolumeGroupHeatStackId() { - return this.volumeGroupHeatStackId; - } - public void setVolumeGroupHeatStackId(String volumeGroupHeatStackId) { - this.volumeGroupHeatStackId = volumeGroupHeatStackId; - } - - public String getBaseGroupHeatStackId() { - return this.baseGroupHeatStackId; - } - public void setBaseGroupHeatStackId(String baseGroupHeatStackId) { - this.baseGroupHeatStackId = baseGroupHeatStackId; - } - - public boolean isBase() { - return this.isBase; - } - public void setIsBase(boolean isBase) { - this.isBase = isBase; - } - public String getVfModuleStackId() { - return this.vfModuleStackId; - } - public void setVfModuleStackId(String vfModuleStackId) { - this.vfModuleStackId = vfModuleStackId; - } - public String getModelCustomizationUuid() { - return this.modelCustomizationUuid; - } - public void setModelCustomizationUuid(String modelCustomizationUuid) { - this.modelCustomizationUuid = modelCustomizationUuid; - } - public String getMode() { - return this.mode; - } - public void setMode(String mode) { - this.mode = mode; - } - @Override - public String toString() { - return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId + - ", vnf=" + vnfId + ", tenantCreated=" + tenantCreated + - ", vnfCreated=" + vnfCreated + ", requestType = " + requestType - + ", modelCustomizationUuid=" + this.modelCustomizationUuid - + ", mode=" + mode; - } -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java deleted file mode 100644 index cc7e66eecb..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/beans/VnfStatus.java +++ /dev/null @@ -1,30 +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.openecomp.mso.openstack.beans; - - -/* - * Enum status values to mirror the Openstack Heat stack status values - */ -public enum VnfStatus { - ACTIVE, FAILED, NOTFOUND, UNKNOWN -} - diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java deleted file mode 100644 index 454880cee1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoAdapterException.java +++ /dev/null @@ -1,45 +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.openecomp.mso.openstack.exceptions; - - - -/** - * General MSO Exception class for any non-specific errors. - * - * - */ -public class MsoAdapterException extends MsoException -{ - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoException instance - public MsoAdapterException (String message) { - super(message); - super.category = MsoExceptionCategory.INTERNAL; - } - - // Constructor to wrap a nested exception - public MsoAdapterException (String message, Throwable t) { - super(message, t); - super.category = MsoExceptionCategory.INTERNAL; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java deleted file mode 100644 index 7e21d9d15a..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFound.java +++ /dev/null @@ -1,49 +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.openecomp.mso.openstack.exceptions; - -/** - * Signals that an attempt to find a specific mso cloud identity has failed. - */ -public class MsoCloudIdentityNotFound extends MsoException { - - private static final long serialVersionUID = 2583769056266415665L; - - - /** - * Default constructor (needed for BPEL/JAXB) - */ - public MsoCloudIdentityNotFound () { - super("Cloud Identity not found"); - super.category=MsoExceptionCategory.USERDATA; - } - - public MsoCloudIdentityNotFound (String cloudIdentity) { - // Set the detailed error as the Exception 'message' - super("Cloud Identity [" + cloudIdentity + "] not found"); - super.category=MsoExceptionCategory.USERDATA; - } - - @Override - public String toString () { - return getMessage(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java deleted file mode 100644 index 7c6e98d55f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFound.java +++ /dev/null @@ -1,48 +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.openecomp.mso.openstack.exceptions; - -/** - * Signals that an attempt to find a specific mso cloud site has failed. - */ -public class MsoCloudSiteNotFound extends MsoException { - - private static final long serialVersionUID = 2583769056266415664L; - - /** - * Default constructor (needed for BPEL/JAXB) - */ - public MsoCloudSiteNotFound () { - super("Cloud site not found"); - super.category=MsoExceptionCategory.USERDATA; - } - - public MsoCloudSiteNotFound (String cloudSite) { - // Set the detailed error as the Exception 'message' - super("Cloud Site [" + cloudSite + "] not found"); - super.category=MsoExceptionCategory.USERDATA; - } - - @Override - public String toString () { - return getMessage(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java deleted file mode 100644 index b8a7a5571c..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoException.java +++ /dev/null @@ -1,66 +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.openecomp.mso.openstack.exceptions; - - - -public abstract class MsoException extends Exception -{ - private static final long serialVersionUID = 1L; - - protected MsoExceptionCategory category = MsoExceptionCategory.INTERNAL; - protected String context = null; - - protected MsoException (String message) { - super(message); - } - - protected MsoException (String message, Throwable t) { - super(message,t); - } - - public MsoExceptionCategory getCategory() { - return category; - } - public void setCategory (MsoExceptionCategory category) { - this.category = category; - } - - public String getContext () { - return context; - } - public void setContext (String context) { - this.context = context; - } - public void addContext (String ctx) { - if (this.context != null) - this.context = ctx + ":" + this.context; - else - this.context = ctx; - } - - public String getContextMessage () { - if (this.context == null) - return getMessage(); - else - return "[" + context + "] " + getMessage(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java deleted file mode 100644 index 81a0edc2d3..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoExceptionCategory.java +++ /dev/null @@ -1,27 +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.openecomp.mso.openstack.exceptions; - - - -public enum MsoExceptionCategory { - OPENSTACK, IO, INTERNAL, USERDATA -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java deleted file mode 100644 index 9c7f6fa91a..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoIOException.java +++ /dev/null @@ -1,53 +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.openecomp.mso.openstack.exceptions; - - -/** - * I/O exception - */ -public class MsoIOException extends MsoException -{ - - /** - * Serialization id. - */ - private static final long serialVersionUID = 6752445132721635760L; - - /** - * Basic constructor with message - * @param message the error message - */ - public MsoIOException (String message) { - super(message); - super.category = MsoExceptionCategory.IO; - } - - /** - * Constructor to wrap a nested exception - * @param message the error message - * @param t the cause - */ - public MsoIOException (String message, Throwable t) { - super (message, t); - super.category = MsoExceptionCategory.IO; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java deleted file mode 100644 index 98b85394be..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExists.java +++ /dev/null @@ -1,35 +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.openecomp.mso.openstack.exceptions; - - - -public class MsoNetworkAlreadyExists extends MsoOpenstackException { - - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoOpenstackException instance - public MsoNetworkAlreadyExists (String stack, String tenant, String cloud) { - // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Stack " + stack + " already exists in Tenant + " + tenant + " in Cloud " + cloud); - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java deleted file mode 100644 index 5802aa1208..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFound.java +++ /dev/null @@ -1,35 +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.openecomp.mso.openstack.exceptions; - - - -public class MsoNetworkNotFound extends MsoOpenstackException { - - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoOpenstackException instance - public MsoNetworkNotFound (String networkId, String tenant, String cloud) { - // Set the detailed error as the Exception 'message' - super(404, "Not Found", "Network " + networkId + " does not exist in Cloud/Tenant " + cloud + "/" + tenant); - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java deleted file mode 100644 index eead8439d4..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackException.java +++ /dev/null @@ -1,80 +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.openecomp.mso.openstack.exceptions; - - -/** - * OpenStack exception. - */ -public class MsoOpenstackException extends MsoException -{ - - /** - * Serialization id. - */ - private static final long serialVersionUID = 3313636124141766495L; - - private int statusCode; - private String statusMessage; - private String errorDetail; - - /** - * Constructor to create a new MsoOpenstackException instance - * @param code the error code - * @param message the error message - * @param detail error details - */ - public MsoOpenstackException (int code, String message, String detail) { - // Set the detailed error as the Exception 'message' - super(detail); - super.category = MsoExceptionCategory.OPENSTACK; - - this.statusCode = code; - this.statusMessage = message; - this.errorDetail = detail; - } - - /** - * Constructor to propagate the caught exception (mostly for stack trace) - * @param code the error code - * @param message the error message - * @param detail error details - * @param e the cause - */ - public MsoOpenstackException (int code, String message, String detail, Exception e) { - // Set the detailed error as the Exception 'message' - super(detail, e); - super.category = MsoExceptionCategory.OPENSTACK; - - this.statusCode = code; - this.statusMessage = message; - this.errorDetail = detail; - } - - @Override - public String toString() { - return statusCode + - " " + - statusMessage + - ": " + - errorDetail; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java deleted file mode 100644 index 2901b6b3a7..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExists.java +++ /dev/null @@ -1,35 +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.openecomp.mso.openstack.exceptions; - - - -public class MsoStackAlreadyExists extends MsoOpenstackException { - - private static final long serialVersionUID = 1L; - - // Constructor to create a new MsoOpenstackException instance - public MsoStackAlreadyExists (String stack, String tenant, String cloud) { - // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Stack " + stack + " already exists in Tenant + " + tenant + " in Cloud " + cloud); - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java deleted file mode 100644 index 21082a28c9..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFound.java +++ /dev/null @@ -1,44 +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.openecomp.mso.openstack.exceptions; - - -/** - * Thrown when HEAT stack is not found or deleted. - */ -public class MsoStackNotFound extends MsoOpenstackException { - - /** - * Serialization id. - */ - private static final long serialVersionUID = 7354069716354359246L; - - /** - * Constructor to create a new MsoOpenstackException instance. - * @param stack the stack name - * @param tenant the tenant name - * @param cloud the cloud name - */ - public MsoStackNotFound (String stack, String tenant, String cloud) { - // Set the detailed error as the Exception 'message' - super(404, "Not Found", "Stack " + stack + " does not exist in Cloud/Tenant " + cloud + "/" + tenant); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java deleted file mode 100644 index 7a597d6f4d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExists.java +++ /dev/null @@ -1,32 +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.openecomp.mso.openstack.exceptions; - -public class MsoTenantAlreadyExists extends MsoOpenstackException { - - private static final long serialVersionUID = 1L; - - public MsoTenantAlreadyExists (String tenant, String cloud) { - // Set the detailed error as the Exception 'message' - super(409, "Conflict", "Tenant " + tenant + " already exists in Cloud " + cloud); - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java b/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java deleted file mode 100644 index f26d6b6d49..0000000000 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFound.java +++ /dev/null @@ -1,43 +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.openecomp.mso.openstack.exceptions; - - -/** - * Tenant not found exception. - */ -public class MsoTenantNotFound extends MsoOpenstackException { - - /** - * Serialization id. - */ - private static final long serialVersionUID = 5640069939645577063L; - - /** - * Constructor to create the exception - * @param tenant the tenant id - * @param cloud the cloud id - */ - public MsoTenantNotFound (String tenant, String cloud) { - // Set the detailed error as the Exception 'message' - super(404, "Not Found", "Tenant " + tenant + " does not exist in Cloud " + cloud); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java new file mode 100644 index 0000000000..e3474009c9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/BeansTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei 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; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterNonConcrete; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.rule.impl.SetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + + +public class BeansTest { + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.adapters.nwrest"); + test("org.onap.so.adapters.sdncrest"); + test("org.onap.so.adapters.tenantrest"); + test("org.onap.so.adapters.vnfrest"); + test("org.onap.so.adapters.network.beans"); + test("org.onap.so.openstack.beans"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.java new file mode 100644 index 0000000000..240074bca7 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/network/mappers/ContrailSubnetMappersTest.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.adapters.network.mappers; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.Test; +import org.onap.so.adapters.network.beans.ContrailSubnet; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoute; +import org.onap.so.adapters.network.beans.ContrailSubnetHostRoutes; +import org.onap.so.adapters.network.beans.ContrailSubnetIp; +import org.onap.so.adapters.network.beans.ContrailSubnetPool; +import org.onap.so.openstack.beans.HostRoute; +import org.onap.so.openstack.beans.Pool; +import org.onap.so.openstack.beans.Subnet; + +public class ContrailSubnetMappersTest { + + + + @Test + public void contrailSubnetHostRouteMapperTest() { + HostRoute hostRoute = new HostRoute(); + hostRoute.setNextHop("hop"); + hostRoute.setPrefix("prefix"); + ContrailSubnetHostRouteMapper mapper = new ContrailSubnetHostRouteMapper(hostRoute); + ContrailSubnetHostRoute cshr = mapper.map(); + assertEquals("hop", cshr.getNextHop()); + assertEquals("prefix", cshr.getPrefix()); + } + + @Test + public void contrailSubnetPoolMapperTest() { + Pool pool = new Pool(); + pool.setStart("start"); + pool.setEnd("end"); + ContrailSubnetPoolMapper mapper = new ContrailSubnetPoolMapper(pool); + ContrailSubnetPool csPool = mapper.map(); + assertEquals("start", csPool.getStart()); + assertEquals("end", csPool.getEnd()); + } + + @Test + public void checkIsNullOrEmpty() { + ContrailSubnetMapper mapper = new ContrailSubnetMapper(null); + assertEquals(true, mapper.isNullOrEmpty("")); + assertEquals(true, mapper.isNullOrEmpty(null)); + assertEquals(false, mapper.isNullOrEmpty("hello")); + } + + @Test + public void createSubnetTestValidCidr() { + Subnet subnet = new Subnet(); + subnet.setCidr("test/value"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + + assertEquals("test",result.getSubnet().getIpPrefix()); + assertEquals("value", result.getSubnet().getIpPrefixLen()); + } + + @Test + public void createSubnetTestInvalidCidr() { + Subnet subnet = new Subnet(); + subnet.setCidr("test"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + assertEquals(null, result.getSubnet().getIpPrefix()); + assertEquals(null, result.getSubnet().getIpPrefixLen()); + + } + + @Test + public void createSubnetTestNullCidr() { + Subnet subnet = new Subnet(); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + assertEquals(null, result.getSubnet().getIpPrefix()); + assertEquals(null, result.getSubnet().getIpPrefixLen()); + } + + @Test + public void createContrailSubnetPoolTest() { + List pools = new ArrayList<>(); + Pool pool1 = new Pool(); + pool1.setStart("start1"); + pool1.setEnd("end1"); + Pool pool2 = new Pool(); + pool2.setStart("start2"); + pool2.setEnd("end2"); + pools.add(pool1); + pools.add(pool2); + + Subnet subnet = new Subnet(); + subnet.setAllocationPools(pools); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + List cspools = result.getAllocationPools(); + assertEquals(2, cspools.size()); + assertEquals("start2", cspools.get(1).getStart()); + assertEquals("end2", cspools.get(1).getEnd()); + } + + @Test + public void createContrailSubnetPoolInvalidTest() { + List pools = new ArrayList<>(); + Pool pool1 = new Pool(); + pool1.setStart("start1"); + pool1.setEnd("end1"); + Pool pool2 = new Pool(); + pool2.setStart("start2"); + pools.add(pool1); + pools.add(pool2); + + Subnet subnet = new Subnet(); + subnet.setAllocationPools(pools); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + List cspools = result.getAllocationPools(); + assertEquals(1, cspools.size()); + assertEquals("start1", cspools.get(0).getStart()); + assertEquals("end1", cspools.get(0).getEnd()); + } + + @Test + public void createContrailSubnetPoolEmptyTest() { + + Subnet subnet = new Subnet(); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + List cspools = result.getAllocationPools(); + assertEquals(true, cspools.isEmpty()); + + } + + @Test + public void createContrailSubnetHostRoutesTest() { + List hostRoutes = new ArrayList<>(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setNextHop("next-hop1"); + hostRoute1.setPrefix("prefix1"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setNextHop("next-hop2"); + hostRoute2.setPrefix("prefix2"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + + Subnet subnet = new Subnet(); + subnet.setHostRoutes(hostRoutes); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + ContrailSubnetHostRoutes routes = result.getHostRoutes(); + assertEquals(2, routes.getHostRoutes().size()); + assertEquals("next-hop2", routes.getHostRoutes().get(1).getNextHop()); + assertEquals("prefix2", routes.getHostRoutes().get(1).getPrefix()); + } + + @Test + public void createContrailSubnetHostRoutesMissingFieldTest() { + List hostRoutes = new ArrayList<>(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setNextHop("next-hop1"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setNextHop("next-hop2"); + hostRoute2.setPrefix("prefix2"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + + Subnet subnet = new Subnet(); + subnet.setHostRoutes(hostRoutes); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + ContrailSubnetHostRoutes routes = result.getHostRoutes(); + assertEquals(2, routes.getHostRoutes().size()); + assertEquals("next-hop1", routes.getHostRoutes().get(0).getNextHop()); + assertEquals("prefix2", routes.getHostRoutes().get(1).getPrefix()); + } + + @Test + public void createContrailSubnetHostRoutesEmptyTest() { + List hostRoutes = new ArrayList<>(); + Subnet subnet = new Subnet(); + subnet.setHostRoutes(hostRoutes); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + ContrailSubnetHostRoutes routes = result.getHostRoutes(); + assertEquals(true, routes.getHostRoutes().isEmpty()); + } + + @Test + public void getSubnetNameTest() { + Subnet subnet = new Subnet(); + subnet.setSubnetName("name"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + assertEquals("if subnetName is populated map", "name", mapper.getSubnetName(subnet)); + subnet = new Subnet(); + subnet.setSubnetId("id"); + mapper = new ContrailSubnetMapper(subnet); + assertEquals("choose id when name is null", "id", mapper.getSubnetName(subnet)); + subnet = new Subnet(); + mapper = new ContrailSubnetMapper(subnet); + assertEquals("expect null", null, mapper.getSubnetName(subnet)); + } + @Test + public void mapRemainingFields() { + Subnet subnet = new Subnet(); + subnet.setEnableDHCP(true); + subnet.setGatewayIp("gateway-ip"); + ContrailSubnetMapper mapper = new ContrailSubnetMapper(subnet); + ContrailSubnet result = mapper.map(); + assertEquals(true, result.isEnableDhcp()); + assertEquals("gateway-ip", result.getDefaultGateway()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java new file mode 100644 index 0000000000..08851c2ce9 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/nwrest/NetworkRequestTest.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.nwrest; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class NetworkRequestTest { + + + @Test + public void isSynchronousTrue() { + CreateNetworkRequest networkResponse = new CreateNetworkRequest(); + assertEquals(true, networkResponse.isSynchronous()); + //flip synchronous to false in the background + networkResponse.setNotificationUrl("testtest"); + assertEquals(false, networkResponse.isSynchronous()); + networkResponse.setNotificationUrl(""); + assertEquals(true, networkResponse.isSynchronous()); + } + + @Test + public void isContrailRequest() { + CreateNetworkRequest networkResponse = new CreateNetworkRequest(); + assertEquals(false, networkResponse.isContrailRequest()); + networkResponse.setNetworkTechnology(NetworkTechnology.CONTRAIL); + assertEquals(false, networkResponse.isContrailRequest()); + networkResponse.setContrailNetwork(new ContrailNetwork()); + assertEquals(true, networkResponse.isContrailRequest()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java new file mode 100644 index 0000000000..e681d43256 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/adapters/vdu/BeansTest.java @@ -0,0 +1,56 @@ +/*- + * ============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.adapters.vdu; + +import org.junit.Test; + +import com.openpojo.reflection.PojoClass; +import com.openpojo.reflection.PojoClassFilter; +import com.openpojo.reflection.filters.FilterPackageInfo; +import com.openpojo.validation.Validator; +import com.openpojo.validation.ValidatorBuilder; +import com.openpojo.validation.rule.impl.GetterMustExistRule; +import com.openpojo.validation.test.impl.GetterTester; +import com.openpojo.validation.test.impl.SetterTester; + +public class BeansTest { + + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + @Test + public void pojoStructure() { + test("org.onap.so.adapters.vdu"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create() + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses); + } + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java new file mode 100644 index 0000000000..28a4a8302f --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoAdapterExceptionTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoAdapterExceptionTest { + + @Test + public void testConstructor() { + MsoAdapterException msoAdapterException = new MsoAdapterException("test"); + Assert.assertEquals("test",msoAdapterException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.INTERNAL, msoAdapterException.category); + } + + @Test + public void testOverloadedConstructor() { + MsoAdapterException msoAdapterException = new MsoAdapterException("test" , new Throwable()); + Assert.assertEquals("test",msoAdapterException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.INTERNAL, msoAdapterException.category); + Assert.assertNotNull(msoAdapterException.getCause()); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFoundTest.java new file mode 100644 index 0000000000..e7befed71a --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudIdentityNotFoundTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoCloudIdentityNotFoundTest { + + @Test + public void testConstructor() { + MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound(); + Assert.assertEquals("Cloud Identity not found",msoCloudIdentityNotFound.getMessage()); + Assert.assertEquals("Cloud Identity not found",msoCloudIdentityNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudIdentityNotFound.category); + } + + @Test + public void testOverloadedConstructor() { + MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound("test"); + Assert.assertEquals("Cloud Identity [test] not found",msoCloudIdentityNotFound.getMessage()); + Assert.assertEquals("Cloud Identity [test] not found",msoCloudIdentityNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudIdentityNotFound.category); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java new file mode 100644 index 0000000000..c75a66e100 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoCloudSiteNotFoundTest.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoCloudSiteNotFoundTest { + + @Test + public void testConstructor() { + MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound(); + Assert.assertEquals("Cloud site not found",msoCloudSiteNotFound.getMessage()); + Assert.assertEquals("Cloud site not found",msoCloudSiteNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudSiteNotFound.category); + } + + @Test + public void testOverloadedConstructor() { + MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound("test"); + Assert.assertEquals("Cloud Site [test] not found",msoCloudSiteNotFound.getMessage()); + Assert.assertEquals("Cloud Site [test] not found",msoCloudSiteNotFound.toString()); + Assert.assertEquals(MsoExceptionCategory.USERDATA, msoCloudSiteNotFound.category); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoIOExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoIOExceptionTest.java new file mode 100644 index 0000000000..e257e52cd4 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoIOExceptionTest.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoIOExceptionTest { + + @Test + public void testConstructor() { + MsoIOException msoIOException = new MsoIOException("test"); + Assert.assertEquals("test",msoIOException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.IO, msoIOException.category); + } + + @Test + public void testOverloadedConstructor() { + MsoIOException msoIOException = new MsoIOException("test", new Throwable()); + Assert.assertEquals("test",msoIOException.getMessage()); + Assert.assertEquals(MsoExceptionCategory.IO, msoIOException.category); + Assert.assertNotNull(msoIOException.getCause()); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExistsTest.java new file mode 100644 index 0000000000..96ff89c094 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkAlreadyExistsTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoNetworkAlreadyExistsTest { + + @Test + public void testConstructor() { + MsoNetworkAlreadyExists msoNetworkAlreadyExists = new MsoNetworkAlreadyExists("test","test","test"); + Assert.assertEquals("Stack test already exists in Tenant test in Cloud test",msoNetworkAlreadyExists.getMessage()); + Assert.assertEquals("409 Conflict: Stack test already exists in Tenant test in Cloud test",msoNetworkAlreadyExists.toString()); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkNotFoundTest.java new file mode 100644 index 0000000000..5991e55915 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoNetworkNotFoundTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoNetworkNotFoundTest { + + @Test + public void testConstructor() { + MsoNetworkNotFound msoNetworkNotFound =new MsoNetworkNotFound("test","test","test"); + Assert.assertEquals("Network test does not exist in Cloud/Tenant test/test",msoNetworkNotFound.getMessage()); + Assert.assertEquals("404 Not Found: Network test does not exist in Cloud/Tenant test/test",msoNetworkNotFound.toString()); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java new file mode 100644 index 0000000000..7bdb2283e8 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoOpenstackExceptionTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Test; +import org.junit.Assert; + +public class MsoOpenstackExceptionTest { + + @Test + public void testConstructor() { + MsoOpenstackException msoOpenstackException= new MsoOpenstackException(404,"test","test"); + Assert.assertEquals("test",msoOpenstackException.getMessage()); + Assert.assertEquals("404 test: test",msoOpenstackException.toString()); + Assert.assertEquals(MsoExceptionCategory.OPENSTACK, msoOpenstackException.category); + } + + @Test + public void testOverloadedConstructor() { + MsoOpenstackException msoOpenstackExceptionEx= new MsoOpenstackException(404,"test","test",new Exception()); + Assert.assertEquals("test",msoOpenstackExceptionEx.getMessage()); + Assert.assertEquals("404 test: test",msoOpenstackExceptionEx.toString()); + Assert.assertEquals(MsoExceptionCategory.OPENSTACK, msoOpenstackExceptionEx.category); + Assert.assertNotNull(msoOpenstackExceptionEx.getCause()); + + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExistsTest.java new file mode 100644 index 0000000000..4b44f0db93 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackAlreadyExistsTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; + +public class MsoStackAlreadyExistsTest { + + @Test + public void testConstructor() { + MsoStackAlreadyExists msoStackAlreadyExists = new MsoStackAlreadyExists("test", "test", "test"); + Assert.assertEquals("Stack test already exists in Tenant test in Cloud test",msoStackAlreadyExists.getMessage()); + Assert.assertEquals("409 Conflict: Stack test already exists in Tenant test in Cloud test",msoStackAlreadyExists.toString()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackNotFoundTest.java new file mode 100644 index 0000000000..8ce5a33cc4 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoStackNotFoundTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; + +public class MsoStackNotFoundTest { + + @Test + public void testConstructor() { + MsoStackNotFound msoStackNotFound = new MsoStackNotFound("test", "test", "test"); + Assert.assertEquals("Stack test does not exist in Cloud/Tenant test/test",msoStackNotFound.getMessage()); + Assert.assertEquals("404 Not Found: Stack test does not exist in Cloud/Tenant test/test",msoStackNotFound.toString()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExistsTest.java new file mode 100644 index 0000000000..5999a587a5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantAlreadyExistsTest.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; + +public class MsoTenantAlreadyExistsTest { + + @Test + public void testConstructor() { + MsoTenantAlreadyExists msoTenantAlreadyExists = new MsoTenantAlreadyExists("test","test"); + Assert.assertEquals("Tenant test already exists in Cloud test",msoTenantAlreadyExists.getMessage()); + Assert.assertEquals("409 Conflict: Tenant test already exists in Cloud test",msoTenantAlreadyExists.toString()); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantNotFoundTest.java new file mode 100644 index 0000000000..23df616573 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/exceptions/MsoTenantNotFoundTest.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei 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.openstack.exceptions; + +import org.junit.Assert; +import org.junit.Test; + +public class MsoTenantNotFoundTest { + + @Test + public void testConstructor() { + MsoTenantNotFound msoTenantNotFound = new MsoTenantNotFound("test","test"); + Assert.assertEquals("Tenant test does not exist in Cloud test",msoTenantNotFound.getMessage()); + Assert.assertEquals("404 Not Found: Tenant test does not exist in Cloud test",msoTenantNotFound.toString()); + } + +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java new file mode 100644 index 0000000000..90e15f8ba5 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/NetworkInfoMapperTest.java @@ -0,0 +1,124 @@ +/*- + * ============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.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +import org.javatuples.Pair; +import org.junit.Test; +import org.onap.so.openstack.beans.NetworkInfo; +import org.onap.so.openstack.beans.NetworkStatus; + +import com.woorea.openstack.quantum.model.Network; +import com.woorea.openstack.quantum.model.Segment; + +public class NetworkInfoMapperTest { + + @Test + public void checkNetworkStatusMap() { + NetworkInfoMapper mapper = new NetworkInfoMapper(new Network()); + assertEquals(NetworkStatus.ACTIVE, mapper.mapStatus("ACTIVE")); + assertEquals(NetworkStatus.BUILD, mapper.mapStatus("BUILD")); + assertEquals(NetworkStatus.ERROR, mapper.mapStatus("ERROR")); + assertEquals(NetworkStatus.DOWN, mapper.mapStatus("DOWN")); + assertEquals(NetworkStatus.UNKNOWN, mapper.mapStatus("NOT IN MAP")); + assertEquals(NetworkStatus.UNKNOWN, mapper.mapStatus(null)); + } + + @Test + public void checkLocateVlanInformationNoSegments() { + Network network = new Network(); + network.setProviderPhysicalNetwork("test-physical-network"); + network.setProviderNetworkType("vlan"); + network.setProviderSegmentationId(2); + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo result = mapper.map(); + assertEquals("test-physical-network", result.getProvider()); + assertEquals(1, result.getVlans().size()); + assertEquals(2, result.getVlans().get(0).intValue()); + } + + @Test + public void checkLocateVlanInformationSegments() { + Network network = new Network(); + addSegments(network); + + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo result = mapper.map(); + assertEquals("type1", result.getProvider()); + assertEquals(2, result.getVlans().size()); + assertEquals(Arrays.asList(1, 2).toString(), result.getVlans().toString()); + } + + @Test + public void checkLocateVlanInformationSegmentsAndPhysical() { + Network network = new Network(); + addSegments(network); + network.setProviderPhysicalNetwork("test-physical-network"); + network.setProviderNetworkType("vlan"); + network.setProviderSegmentationId(2); + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo result = mapper.map(); + assertEquals("test-physical-network", result.getProvider()); + assertEquals(1, result.getVlans().size()); + assertEquals(2, result.getVlans().get(0).intValue()); + } + + @Test + public void nullNetwork() { + NetworkInfoMapper mapper = new NetworkInfoMapper(null); + assertEquals(NetworkStatus.NOTFOUND, mapper.map().getStatus()); + } + + @Test + public void mapFields() { + Network network = new Network(); + network.setId("id"); + network.setName("name"); + network.setSubnets(Arrays.asList("string1", "string2")); + NetworkInfoMapper mapper = new NetworkInfoMapper(network); + NetworkInfo mapped = mapper.map(); + assertEquals("name", mapped.getName()); + assertEquals("id", mapped.getId()); + assertEquals(network.getSubnets(), mapped.getSubnets()); + } + + private Network addSegments(Network network) { + List segments = new ArrayList<>(); + Segment segment1 = new Segment(); + segment1.setProviderPhysicalNetwork("type1"); + segment1.setProviderNetworkType("vlan"); + segment1.setProviderSegmentationId(1); + segments.add(segment1); + Segment segment2 = new Segment(); + segment2.setProviderPhysicalNetwork("type2"); + segment2.setProviderNetworkType("vlan"); + segment2.setProviderSegmentationId(2); + segments.add(segment2); + network.setSegments(segments); + return network; + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java new file mode 100644 index 0000000000..f01745f8c1 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/java/org/onap/so/openstack/mappers/StackInfoMapperTest.java @@ -0,0 +1,94 @@ +/*- + * ============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.openstack.mappers; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.onap.so.openstack.beans.HeatStatus; +import org.onap.so.openstack.beans.StackInfo; + +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.woorea.openstack.heat.model.Stack; + +public class StackInfoMapperTest { + + private static final String PATH = "src/test/resources/"; + @Test + public void nullStack() { + StackInfoMapper mapper = new StackInfoMapper(null); + assertEquals(HeatStatus.NOTFOUND, mapper.map().getStatus()); + } + + @Test + public void checkHeatStatusMap() { + StackInfoMapper mapper = new StackInfoMapper(null); + assertEquals(HeatStatus.BUILDING, mapper.mapStatus("CREATE_IN_PROGRESS")); + assertEquals(HeatStatus.CREATED, mapper.mapStatus("CREATE_COMPLETE")); + assertEquals(HeatStatus.FAILED, mapper.mapStatus("CREATE_FAILED")); + assertEquals(HeatStatus.DELETING, mapper.mapStatus("DELETE_IN_PROGRESS")); + assertEquals(HeatStatus.NOTFOUND, mapper.mapStatus("DELETE_COMPLETE")); + assertEquals(HeatStatus.FAILED, mapper.mapStatus("DELETE_FAILED")); + assertEquals(HeatStatus.UPDATING, mapper.mapStatus("UPDATE_IN_PROGRESS")); + assertEquals(HeatStatus.FAILED, mapper.mapStatus("UPDATE_FAILED")); + assertEquals(HeatStatus.UPDATED, mapper.mapStatus("UPDATE_COMPLETE")); + assertEquals(HeatStatus.INIT, mapper.mapStatus(null)); + assertEquals(HeatStatus.UNKNOWN, mapper.mapStatus("status-not-there")); + } + + @Test + public void checkOutputToMap() throws JsonParseException, JsonMappingException, IOException { + ObjectMapper jacksonMapper = new ObjectMapper(); + Stack sample = jacksonMapper.readValue(this.getJson("stack-example.json"), Stack.class); + StackInfoMapper mapper = new StackInfoMapper(sample); + StackInfo result = mapper.map(); + Map map = result.getOutputs(); + assertEquals(true, map.containsKey("key2")); + assertEquals("value1", map.get("key1")); + } + + @Test + public void mapRemainingFields() { + Stack stack = new Stack(); + stack.setStackName("name"); + stack.setId("id"); + stack.setStackStatusReason("message"); + stack.setParameters(new HashMap()); + StackInfoMapper mapper = new StackInfoMapper(stack); + StackInfo info = mapper.map(); + assertEquals("name", info.getName()); + assertEquals("name/id", info.getCanonicalName()); + assertEquals("message", info.getStatusMessage()); + assertEquals(stack.getParameters(), info.getParameters()); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(PATH + filename))); + } +} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java deleted file mode 100644 index 9efaee921f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/BeanTest.java +++ /dev/null @@ -1,452 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei 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.adapters; - -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import org.junit.Test; -import org.openecomp.mso.adapters.nwrest.ContrailNetwork; -import org.openecomp.mso.adapters.nwrest.CreateNetworkError; -import org.openecomp.mso.adapters.nwrest.CreateNetworkRequest; -import org.openecomp.mso.adapters.nwrest.CreateNetworkResponse; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkError; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkRequest; -import org.openecomp.mso.adapters.nwrest.DeleteNetworkResponse; -import org.openecomp.mso.adapters.nwrest.NetworkExceptionResponse; -import org.openecomp.mso.adapters.nwrest.NetworkTechnology; -import org.openecomp.mso.adapters.nwrest.ProviderVlanNetwork; -import org.openecomp.mso.adapters.nwrest.QueryNetworkResponse; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkError; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkRequest; -import org.openecomp.mso.adapters.nwrest.RollbackNetworkResponse; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkError; -import org.openecomp.mso.adapters.nwrest.UpdateNetworkRequest; -import org.openecomp.mso.adapters.tenantrest.CreateTenantError; -import org.openecomp.mso.adapters.tenantrest.CreateTenantRequest; -import org.openecomp.mso.adapters.tenantrest.CreateTenantResponse; -import org.openecomp.mso.adapters.tenantrest.DeleteTenantError; -import org.openecomp.mso.adapters.tenantrest.DeleteTenantRequest; -import org.openecomp.mso.adapters.tenantrest.DeleteTenantResponse; -import org.openecomp.mso.adapters.tenantrest.HealthCheckHandler; -import org.openecomp.mso.adapters.tenantrest.QueryTenantError; -import org.openecomp.mso.adapters.tenantrest.QueryTenantResponse; -import org.openecomp.mso.adapters.tenantrest.RollbackTenantError; -import org.openecomp.mso.adapters.tenantrest.RollbackTenantRequest; -import org.openecomp.mso.adapters.tenantrest.RollbackTenantResponse; -import org.openecomp.mso.adapters.tenantrest.TenantExceptionResponse; -import org.openecomp.mso.adapters.tenantrest.TenantRollback; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.CreateVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.DeleteVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.QueryVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.RollbackVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVfModuleResponse; -import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupRequest; -import org.openecomp.mso.adapters.vnfrest.UpdateVolumeGroupResponse; -import org.openecomp.mso.adapters.vnfrest.VfModuleExceptionResponse; -import org.openecomp.mso.adapters.vnfrest.VfModuleRollback; -import org.openecomp.mso.adapters.vnfrest.VolumeGroupRollback; -import org.openecomp.mso.entity.MsoRequest; - -public class BeanTest { - - // Test cases for code coverage - @Test - public void testCreateNetworkRequest() { - CreateNetworkRequest n = new CreateNetworkRequest(); - n.setBackout(true); - n.setCloudSiteId("test"); - ContrailNetwork contrailNetwork = new ContrailNetwork("shared", "external", new ArrayList<>(), - new ArrayList<>(), new ArrayList<>()); - contrailNetwork.setExternal("dgddb"); - contrailNetwork.setPolicyFqdns(new ArrayList<>()); - contrailNetwork.setRouteTableFqdns(new ArrayList<>()); - contrailNetwork.setRouteTargets(new ArrayList<>()); - contrailNetwork.setShared("test"); - n.setContrailNetwork(contrailNetwork); - n.setFailIfExists(true); - n.setMessageId("38829"); - n.setModelCustomizationUuid("4u838282"); - MsoRequest req = new MsoRequest(); - req.setRequestId("38849"); - req.setServiceInstanceId("3884839"); - n.setMsoRequest(req); - n.setNetworkId("478383"); - n.setNetworkName("tetet"); - n.setNetworkParams(new HashMap<>()); - n.setNetworkTechnology("VMWARE"); - n.setNetworkType("tete"); - n.setNetworkTypeVersion("v1"); - n.setNotificationUrl("test"); - ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("test", new ArrayList<>()); - providerVlanNetwork.setPhysicalNetworkName("physicalNetworkName"); - providerVlanNetwork.setVlans(new ArrayList<>()); - n.setProviderVlanNetwork(providerVlanNetwork); - n.setSkipAAI(false); - n.setSubnets(new ArrayList<>()); - n.setTenantId("tenantId"); - n.getBackout(); - n.getCloudSiteId(); - ContrailNetwork cn = n.getContrailNetwork(); - cn.getExternal(); - cn.getPolicyFqdns(); - cn.getRouteTableFqdns(); - cn.getRouteTargets(); - cn.getShared(); - n.getFailIfExists(); - n.getMessageId(); - n.getModelCustomizationUuid(); - n.getMsoRequest(); - n.getNetworkId(); - n.getNetworkName(); - n.getNetworkParams(); - n.getNetworkTechnology(); - n.getNetworkType(); - n.getNetworkTypeVersion(); - n.getNotificationUrl(); - n.getProviderVlanNetwork(); - n.getSkipAAI(); - n.getSubnets(); - n.getTenantId(); - n.isContrailRequest(); - n.isSynchronous(); - n.toJsonString(); - n.toXmlString(); - } - - @Test - public void testDeleteNetworkRequest() { - DeleteNetworkRequest r = new DeleteNetworkRequest(); - r.setCloudSiteId("test"); - r.setMessageId("messageId"); - r.setModelCustomizationUuid("modelCustomizationUuid"); - r.setMsoRequest(null); - r.setNetworkId("networkId"); - r.setNetworkStackId("networkStackId"); - r.setNetworkType("networkType"); - r.setNotificationUrl("notificationUrl"); - r.setSkipAAI(true); - r.setTenantId("tenantId"); - r.getCloudSiteId(); - r.getMessageId(); - r.getModelCustomizationUuid(); - r.getMsoRequest(); - r.getNetworkId(); - r.getNetworkStackId(); - r.getNetworkType(); - r.getNotificationUrl(); - r.getSkipAAI(); - r.getTenantId(); - } - - @Test - public void testCreateNetworkError() { - CreateNetworkError e = new CreateNetworkError("message"); - e = new CreateNetworkError("message", null, true, "messageid"); - DeleteNetworkError d = new DeleteNetworkError("message"); - d = new DeleteNetworkError("message", null, false, "29102"); - } - - @Test - public void testCreatenetworkResponse() { - CreateNetworkResponse cnr = new CreateNetworkResponse("networkId", "neutronNetworkId", "networkStackId", - "networkFqdn", false, null, null, "messageId"); - cnr.setMessageId("messageId"); - cnr.setNetworkCreated(true); - cnr.setNetworkFqdn(null); - cnr.setNetworkStackId(null); - cnr.setNeutronNetworkId(null); - cnr.setRollback(null); - cnr.setNetworkStackId(null); - cnr.setSubnetMap(null); - cnr.getMessageId(); - cnr.getNetworkCreated(); - cnr.getNetworkFqdn(); - cnr.getNetworkId(); - cnr.getNetworkStackId(); - cnr.getNeutronNetworkId(); - cnr.getRollback(); - cnr.getSubnetMap(); - - DeleteNetworkResponse dr = new DeleteNetworkResponse("networkId", true, "messageId"); - dr.setMessageId(null); - dr.setNetworkDeleted(null); - dr.setNetworkId(null); - dr.getMessageId(); - dr.getNetworkDeleted(); - dr.getNetworkId(); - - NetworkExceptionResponse ner = new NetworkExceptionResponse("message"); - ner = new NetworkExceptionResponse(null, null, false, null); - ner.setCategory(null); - ner.setMessage(null); - ner.setRolledBack(null); - ner.setMessageId(null); - ner.getCategory(); - ner.getMessage(); - ner.getMessageId(); - ner.getRolledBack(); - - ner.toJsonString(); - ner.toXmlString(); - NetworkTechnology nt = NetworkTechnology.NEUTRON; - ProviderVlanNetwork pvn = new ProviderVlanNetwork(null, null); - pvn.setPhysicalNetworkName(null); - pvn.setVlans(null); - pvn.getPhysicalNetworkName(); - pvn.getVlans(); - - QueryNetworkResponse qnr = new QueryNetworkResponse(null, null, null, null, null); - qnr.setNetworkExists(null); - qnr.setNetworkId(null); - qnr.setNetworkOutputs(null); - qnr.setNetworkStackId(null); - qnr.setNetworkStatus(null); - qnr.setNeutronNetworkId(null); - qnr.setRouteTargets(null); - qnr.setSubnetIdMap(null); - qnr.setVlans(null); - qnr.getNetworkExists(); - qnr.getNetworkId(); - qnr.getNetworkOutputs(); - qnr.getNetworkStatus(); - qnr.getNeutronNetworkId(); - qnr.getRouteTargets(); - qnr.getSubnetIdMap(); - qnr.getVlans(); - qnr.toJsonString(); - - UpdateNetworkRequest unr = new UpdateNetworkRequest(); - unr.setBackout(null); - unr.setCloudSiteId(null); - unr.setContrailNetwork(null); - unr.setMessageId(null); - unr.setModelCustomizationUuid(null); - unr.setMsoRequest(null); - unr.setNetworkId(null); - unr.setNetworkName(null); - unr.setNetworkParams(null); - unr.setNetworkStackId(null); - unr.setNetworkTechnology("VMWARE"); - unr.setNetworkType(null); - unr.setNetworkTypeVersion(null); - unr.setNotificationUrl(null); - unr.setProviderVlanNetwork(null); - unr.setSkipAAI(null); - unr.setSubnets(null); - unr.setTenantId(null); - unr.getBackout(); - unr.getCloudSiteId(); - unr.getContrailNetwork(); - unr.getMessageId(); - unr.getModelCustomizationUuid(); - unr.getMsoRequest(); - unr.getNetworkId(); - unr.getNetworkName(); - unr.getNetworkParams(); - unr.getNetworkStackId(); - unr.getNetworkTechnology(); - unr.getNetworkType(); - unr.getNetworkTypeVersion(); - unr.getNotificationUrl(); - unr.getProviderVlanNetwork(); - unr.getSkipAAI(); - unr.getSubnets(); - unr.getTenantId(); - unr.isContrailRequest(); - - RollbackNetworkError err = new RollbackNetworkError("message"); - err = new RollbackNetworkError(null, null, false, null); - RollbackNetworkRequest req = new RollbackNetworkRequest(); - req.setNetworkRollback(null); - req.getNetworkRollback(); - req.setMessageId(null); - req.getMessageId(); - req.setNotificationUrl(null); - req.getNotificationUrl(); - req.setSkipAAI(null); - req.getSkipAAI(); - - RollbackNetworkResponse rnr = new RollbackNetworkResponse(true, null); - rnr.setMessageId(null); - rnr.getMessageId(); - rnr.setNetworkRolledBack(null); - rnr.getNetworkRolledBack(); - - UpdateNetworkError error = new UpdateNetworkError(null); - error = new UpdateNetworkError("test", null, false, null); - - UpdateVfModuleRequest uvmr = new UpdateVfModuleRequest(); - uvmr.setBackout(null); - uvmr.setBaseVfModuleId(null); - uvmr.setBaseVfModuleStackId(null); - uvmr.setFailIfExists(null); - uvmr.setMessageId(null); - uvmr.setModelCustomizationUuid(null); - uvmr.setMsoRequest(null); - uvmr.setNotificationUrl(null); - uvmr.setRequestType(null); - uvmr.setSkipAAI(true); - uvmr.setTenantId(null); - uvmr.setVfModuleId(null); - uvmr.setVfModuleName(null); - uvmr.setVfModuleParams(null); - uvmr.setVfModuleStackId(null); - uvmr.setVfModuleType(null); - uvmr.setVnfId(null); - uvmr.setVnfType(null); - uvmr.setVnfVersion(null); - uvmr.setVolumeGroupId(null); - uvmr.setVolumeGroupStackId(null); - uvmr.getBackout(); - uvmr.getBaseVfModuleId(); - uvmr.getBaseVfModuleStackId(); - uvmr.getCloudSiteId(); - uvmr.getFailIfExists(); - uvmr.getMessageId(); - uvmr.getModelCustomizationUuid(); - uvmr.getMsoRequest(); - uvmr.getNotificationUrl(); - uvmr.getRequestType(); - uvmr.getSkipAAI(); - uvmr.getTenantId(); - uvmr.getVfModuleId(); - uvmr.getVfModuleName(); - uvmr.getVfModuleParams(); - uvmr.getVfModuleStackId(); - uvmr.getVfModuleType(); - uvmr.getVnfId(); - uvmr.getVnfType(); - uvmr.getVnfVersion(); - uvmr.getVolumeGroupId(); - uvmr.getVolumeGroupStackId(); - uvmr.setCloudSiteId(null); - - CreateVfModuleRequest cvmr = new CreateVfModuleRequest(); - cvmr.setBackout(null); - cvmr.setBaseVfModuleId(null); - cvmr.setBaseVfModuleStackId(null); - cvmr.setCloudSiteId(null); - cvmr.setFailIfExists(null); - - coverCode(CreateVfModuleRequest.class); - CreateVfModuleResponse resp = new CreateVfModuleResponse(null, null, null, true, null, null, null); - resp.toJsonString(); - resp.toXmlString(); - coverCode(CreateVfModuleResponse.class); - - coverCode(CreateVolumeGroupRequest.class); - - CreateVolumeGroupResponse cvgr = new CreateVolumeGroupResponse(null, null, true, null, null, null); - coverCode(CreateVolumeGroupResponse.class); - coverCode(DeleteVfModuleRequest.class); - coverCode(DeleteVfModuleResponse.class); - coverCode(DeleteVolumeGroupRequest.class); - coverCode(DeleteVolumeGroupResponse.class); - QueryVfModuleResponse vfmr = new QueryVfModuleResponse(null, null, null, null, null); - coverCode(QueryVfModuleResponse.class); - QueryVolumeGroupResponse qvgr = new QueryVolumeGroupResponse(null, null, null, null); - coverCode(QueryVolumeGroupResponse.class); - UpdateVfModuleResponse uvfmr = new UpdateVfModuleResponse(null, null, null, null, null); - coverCode(UpdateVfModuleResponse.class); - coverCode(UpdateVolumeGroupRequest.class); - UpdateVolumeGroupResponse uvgr = new UpdateVolumeGroupResponse(null, null, null, null); - coverCode(UpdateVolumeGroupResponse.class); - VfModuleExceptionResponse vfmer = new VfModuleExceptionResponse(null, null, false, null); - coverCode(VfModuleExceptionResponse.class); - //VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, null); - VfModuleRollback vfmrb = new VfModuleRollback(null, null, null, false, null, null, null, null); - coverCode(VfModuleRollback.class); - //VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, null); - VolumeGroupRollback vgrback = new VolumeGroupRollback(null, null, false, null, null, null, null); - coverCode(VolumeGroupRollback.class); - RollbackVolumeGroupResponse rvgresp = new RollbackVolumeGroupResponse(null, null); - coverCode(RollbackVolumeGroupResponse.class); - } - - @Test - public void testTenantRestPackage(){ - CreateTenantError cte = new CreateTenantError(null, null, false); - coverCode(CreateTenantError.class); - CreateTenantRequest ctreq = new CreateTenantRequest(); - ctreq.toJsonString(); - ctreq.toXmlString(); - ctreq.toString(); - coverCode(CreateTenantRequest.class); - CreateTenantResponse ctresp = new CreateTenantResponse(null, null, null, new TenantRollback()); - ctresp.toString(); - coverCode(CreateTenantResponse.class); - DeleteTenantError dterr = new DeleteTenantError(null, null, false); - coverCode(DeleteTenantError.class); - coverCode(DeleteTenantRequest.class); - coverCode(DeleteTenantResponse.class); - coverCode(HealthCheckHandler.class); - QueryTenantError qnerr = new QueryTenantError(null, null); - coverCode(QueryTenantError.class); - QueryTenantResponse qtresp = new QueryTenantResponse(null, null, null); - coverCode(QueryTenantResponse.class); - coverCode(RollbackTenantError.class); - RollbackTenantError rollTer = new RollbackTenantError(null, null, false); - coverCode(RollbackTenantRequest.class); - coverCode(RollbackTenantResponse.class); - TenantExceptionResponse resp = new TenantExceptionResponse(null, null, false); - coverCode(TenantExceptionResponse.class); - coverCode(TenantRollback.class); - } - - private void coverCode(Class cls) { - try { - Object obj = cls.newInstance(); - Method[] methods = cls.getDeclaredMethods(); - for (Method m : methods) { - try { - m.setAccessible(true); - Type[] types = m.getGenericParameterTypes(); - Object[] objs = { new Object(), new Object(), new Object(), new Object() }; - if (types.length < 1) { - m.invoke(obj); - } else if (types.length == 1) { - String type = types[0].getTypeName(); - if (type.contains("<")) { - type = type.substring(0, type.indexOf("<")); - } - Class paramCls = Class.forName(type); - Object paramobj = paramCls.newInstance(); - m.invoke(obj, paramobj); - } else if (types.length == 2) { - // m.invoke(obj,null,null); - } - } catch (Exception ex) { - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java deleted file mode 100644 index fd0855e221..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapDeserializerTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.json; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; - -import java.util.Map; -import org.codehaus.jackson.JsonParser; -import org.codehaus.jackson.map.DeserializationContext; -import org.codehaus.jackson.map.ObjectMapper; -import org.json.JSONException; -import org.json.JSONObject; -import org.junit.Test; - -public class MapDeserializerTest { - - private static final String MAP_KEY = "keyTest"; - private static final String MAP_VALUE = "valueTest"; - - @Test - public void mapWithProperValuesIsReturned() throws Exception { - JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(getJsonAsString()); - MapDeserializer testedObject = new MapDeserializer(); - Map params = testedObject.deserialize(parser, mock(DeserializationContext.class)); - assertThat(params).hasSize(1).containsEntry(MAP_KEY, MAP_VALUE); - } - - private String getJsonAsString() throws JSONException { - JSONObject child2 = new JSONObject(); - child2.put("key", MAP_KEY); - child2.put("value", MAP_VALUE); - JSONObject child1 = new JSONObject(); - child1.put("child2", child2); - JSONObject parent = new JSONObject(); - parent.put("child1", child1); - return parent.toString(); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java deleted file mode 100644 index f903f21441..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/json/MapSerializerTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============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.openecomp.mso.adapters.json; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import java.util.HashMap; -import java.util.Map; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.map.SerializerProvider; -import org.junit.Test; - -public class MapSerializerTest { - - private static final String JSON_FIELD_NAME_1 = "testKey1"; - private static final String JSON_VALUE_1 = "testValue1"; - private static final String JSON_FIELD_NAME_2 = "testKey2"; - private static final String JSON_VALUE_2 = "testValue2"; - - @Test - public void serializationWritesTheProperFieldsToJson() throws Exception { - JsonGenerator jsonGeneratorMock = mock(JsonGenerator.class); - MapSerializer testedObject = new MapSerializer(); - testedObject.serialize(prepareMap(), jsonGeneratorMock, mock(SerializerProvider.class)); - verify(jsonGeneratorMock).writeStringField("key", JSON_FIELD_NAME_1); - verify(jsonGeneratorMock).writeStringField("value", JSON_VALUE_1); - verify(jsonGeneratorMock).writeStringField("key", JSON_FIELD_NAME_2); - verify(jsonGeneratorMock).writeStringField("value", JSON_VALUE_2); - } - - private Map prepareMap() { - Map map = new HashMap<>(); - map.put(JSON_FIELD_NAME_1, JSON_VALUE_1); - map.put(JSON_FIELD_NAME_2, JSON_VALUE_2); - return map; - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java deleted file mode 100644 index c6d815a960..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/RequestInformationTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * Licensed under the Apache License, Version 2.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.adapters.sdncrest; - -import org.junit.Assert; - -import org.junit.Before; -import org.junit.Test; - -public class RequestInformationTest { - - private RequestInformation requestInformation; - - @Before - public void setUp() { - requestInformation = new RequestInformation(); - } - - @Test - public void testGetRequestId() { - requestInformation.setRequestId("requestId"); - Assert.assertNotNull(requestInformation.getRequestId()); - Assert.assertEquals(requestInformation.getRequestId(), "requestId"); - } - - @Test - public void testGetSource() { - requestInformation.setSource("source"); - Assert.assertNotNull(requestInformation.getSource()); - Assert.assertEquals(requestInformation.getSource(), "source"); - } - - @Test - public void testGetNotificationUrl() { - requestInformation.setNotificationUrl("notificationUrl"); - Assert.assertNotNull(requestInformation.getNotificationUrl()); - Assert.assertEquals(requestInformation.getNotificationUrl(), "notificationUrl"); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java deleted file mode 100644 index 81d888bf70..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCEventTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * Licensed under the Apache License, Version 2.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.adapters.sdncrest; - -import static org.junit.Assert.*; - -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import java.util.HashMap; -import java.util.Map; - -public class SDNCEventTest { - - private SDNCEvent sdncEvent; - private Map param; - private String name = "name"; - private String value = "value"; - - @Before - public void setUp() { - sdncEvent = new SDNCEvent(); - } - - @Test - public void testGetEventType() { - sdncEvent.setEventType("eventType"); - Assert.assertNotNull(sdncEvent.getEventType()); - Assert.assertEquals(sdncEvent.getEventType(), "eventType"); - } - - @Test - public void testGetEventCorrelatorType() { - sdncEvent.setEventCorrelatorType("eventCorrelatorType"); - Assert.assertNotNull(sdncEvent.getEventCorrelatorType()); - Assert.assertEquals(sdncEvent.getEventCorrelatorType(), "eventCorrelatorType"); - } - - @Test - public void testGetEventCorrelator() { - sdncEvent.setEventCorrelator("eventCorrelator"); - Assert.assertNotNull(sdncEvent.getEventCorrelator()); - Assert.assertEquals(sdncEvent.getEventCorrelator(), "eventCorrelator"); - } - - @Test - public void testGetParams() { - param = new HashMap<>(); - param.put("paramKey", "paramValue"); - sdncEvent.setParams(param); - Assert.assertNotNull(sdncEvent.getParams()); - Assert.assertTrue(sdncEvent.getParams().containsKey("paramKey")); - Assert.assertTrue(sdncEvent.getParams().containsValue("paramValue")); - } - - @Test - public void testAddParam() { - sdncEvent.addParam("name", "value"); - - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java deleted file mode 100644 index df69b377ca..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.adapters.sdncrest; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon; -import org.openecomp.mso.adapters.sdncrest.SDNCServiceError; - -public class SDNCServiceErrorTest { - - @Mock - SDNCErrorCommon sec; - - @InjectMocks - SDNCServiceError ssc; - - @Before - public void init(){ - MockitoAnnotations.initMocks(this); - } - - @Test - public void testSDNCServiceError() { - - ssc= new SDNCServiceError("id", "200", - "msg", "indicator"); - assert(ssc!=null); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java deleted file mode 100644 index c63f1b8f82..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.adapters.sdncrest; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.adapters.sdncrest.SDNCRequestCommon; -import org.openecomp.mso.adapters.sdncrest.ServiceInformation; -import org.openecomp.mso.adapters.sdncrest.RequestInformation; - -public class SDNCServiceRequestTest { - - @Mock - SDNCRequestCommon src; - - @Mock - ServiceInformation si; - - @Mock - RequestInformation ri; - - @InjectMocks - SDNCServiceRequest ssr; - - @Before - public void init(){ - MockitoAnnotations.initMocks(this); - } - - @Test - public void test() { - ssr= new SDNCServiceRequest("url", "timeout", - "sdncRequestId", "sdncService", "sdncOperation", - ri, - si, "sdncServiceDataType", - "sndcServiceData"); - - ssr.setSDNCService("sdncService"); - ssr.setSDNCServiceData("sndcServiceData"); - ssr.setSDNCServiceDataType("sdncServiceDataType"); - ssr.setBPTimeout("timeout"); - ssr.setBPNotificationUrl("url"); - ssr.setRequestInformation(ri); - ssr.setServiceInformation(si); - ssr.setSDNCOperation("sdncOperation"); - ssr.setSDNCRequestId("sdncRequestId"); - assert(ssr.getSDNCService().equals("sdncService")); - assert(ssr.getSDNCServiceData().equals("sndcServiceData")); - assert(ssr.getSDNCServiceDataType().equals("sdncServiceDataType")); - assert(ssr.getBPTimeout().equals("timeout")); - assert(ssr.getBPNotificationUrl().equals("url")); - assert(ssr.getRequestInformation().equals(ri)); - assert(ssr.getServiceInformation().equals(si)); - assert(ssr.getSDNCOperation().equals("sdncOperation")); - assert(ssr.getSDNCRequestId().equals("sdncRequestId")); - } - -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java deleted file mode 100644 index 9c4e98a02b..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.adapters.sdncrest; - -import static org.junit.Assert.*; - -import java.util.HashMap; -import java.util.Map; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon; - -public class SDNCServiceResponseTest { - - @Mock - SDNCResponseCommon src; - - @InjectMocks - SDNCServiceResponse ssr; - - @Before - public void init(){ - MockitoAnnotations.initMocks(this); - } - - @Test - public void test() { - ssr=new SDNCServiceResponse("sdncRequestId", "200", - "msg", "indicator"); - Map mp = new HashMap<>(); - mp.put("name", "value"); - ssr.setParams(mp); - assert(ssr.getParams().equals(mp)); - assertNotNull(ssr); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java deleted file mode 100644 index 2b87bbf101..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* -* ============LICENSE_START======================================================= -* ONAP : SO -* ================================================================================ -* Copyright 2018 TechMahindra -*================================================================================= -* Licensed under the Apache License, Version 2.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.adapters.sdncrest; - -import org.junit.Test; - -public class ServiceInformationTest { - - - - @Test - public void test() { - ServiceInformation si= new ServiceInformation("id","service","GlobalId","name"); - - si.setServiceInstanceId("id"); - si.setServiceType("service"); - si.setSubscriberGlobalId("GlobalId"); - si.setSubscriberName("name"); - assert(si.getServiceInstanceId().equals("id")); - assert(si.getServiceType().equals("service")); - assert(si.getSubscriberGlobalId().equals("GlobalId")); - assert(si.getSubscriberName().equals("name")); - } -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java deleted file mode 100644 index 14f0485ba1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/HostRouteTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; - -public class HostRouteTest { - - HostRoute hostRoute = new HostRoute(); - - @Test - public void getPrefix() throws Exception { - hostRoute.getPrefix(); - } - - @Test - public void setPrefix() throws Exception { - hostRoute.setPrefix("192.168.21/0"); - } - - @Test - public void getNextHop() throws Exception { - hostRoute.setNextHop("127.0.0.1"); - } - - @Test - public void setNextHop() throws Exception { - hostRoute.setNextHop("127.0.0.1"); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java deleted file mode 100644 index 6e1f392c80..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/MsoTenantTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; - -import java.util.HashMap; - -public class MsoTenantTest { - - MsoTenant msoTenant = new MsoTenant(); - - @Test - public void getTenantId() throws Exception { - msoTenant.getTenantId(); - } - - @Test - public void setTenantId() throws Exception { - msoTenant.setTenantId("id-123"); - } - - @Test - public void getTenantName() throws Exception { - msoTenant.getTenantName(); - } - - @Test - public void setTenantName() throws Exception { - msoTenant.setTenantName("test"); - } - - @Test - public void getMetadata() throws Exception { - msoTenant.getMetadata(); - } - - @Test - public void setMetadata() throws Exception { - msoTenant.setMetadata(new HashMap<>()); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java deleted file mode 100644 index ec0b917a3d..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkInfoTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import com.woorea.openstack.quantum.model.Network; -import org.junit.Test; - -import java.util.Arrays; - -public class NetworkInfoTest { - - NetworkInfo networkInfo = new NetworkInfo(new Network()); - - @Test - public void getName() throws Exception { - networkInfo.getName(); - } - - @Test - public void setName() throws Exception { - networkInfo.setName("test"); - } - - @Test - public void getId() throws Exception { - networkInfo.getId(); - } - - @Test - public void setId() throws Exception { - networkInfo.setId("test"); - } - - @Test - public void getStatus() throws Exception { - networkInfo.getStatus(); - } - - @Test - public void setStatus() throws Exception { - networkInfo.setStatus(null); - } - - @Test - public void getProvider() throws Exception { - networkInfo.getProvider(); - } - - @Test - public void setProvider() throws Exception { - networkInfo.setProvider("provider"); - } - - @Test - public void getVlans() throws Exception { - networkInfo.getVlans(); - } - - @Test - public void setVlans() throws Exception { - networkInfo.setVlans(Arrays.asList(10, 20, 30)); - } - - @Test - public void getSubnets() throws Exception { - networkInfo.getSubnets(); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java deleted file mode 100644 index b6245f642f..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/NetworkRollbackTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; -import org.openecomp.mso.entity.MsoRequest; - -import java.util.Arrays; - -public class NetworkRollbackTest { - - NetworkRollback networkRollback = new NetworkRollback(); - - @Test - public void getNetworkId() throws Exception { - networkRollback.getNetworkId(); - } - - @Test - public void setNetworkId() throws Exception { - networkRollback.setNetworkId("255.255.255.0"); - } - - @Test - public void getNeutronNetworkId() throws Exception { - networkRollback.getNeutronNetworkId(); - } - - @Test - public void setNeutronNetworkId() throws Exception { - networkRollback.setNeutronNetworkId("192.168.0.0"); - } - - @Test - public void getNetworkStackId() throws Exception { - networkRollback.getNetworkStackId(); - } - - @Test - public void setNetworkStackId() throws Exception { - networkRollback.setNetworkStackId("id-123"); - } - - @Test - public void getTenantId() throws Exception { - networkRollback.getTenantId(); - } - - @Test - public void setTenantId() throws Exception { - networkRollback.setTenantId("id-123"); - } - - @Test - public void getCloudId() throws Exception { - networkRollback.getCloudId(); - } - - @Test - public void setCloudId() throws Exception { - networkRollback.setCloudId("id-123"); - } - - @Test - public void getNetworkType() throws Exception { - networkRollback.getNetworkType(); - } - - @Test - public void setNetworkType() throws Exception { - networkRollback.setNetworkType("type"); - } - - @Test - public void getModelCustomizationUuid() throws Exception { - networkRollback.getModelCustomizationUuid(); - } - - @Test - public void setModelCustomizationUuid() throws Exception { - networkRollback.setModelCustomizationUuid("id-123"); - } - - @Test - public void getNetworkCreated() throws Exception { - networkRollback.getNetworkCreated(); - } - - @Test - public void setNetworkCreated() throws Exception { - networkRollback.setNetworkCreated(true); - } - - @Test - public void getNetworkName() throws Exception { - networkRollback.getNetworkName(); - } - - @Test - public void setNetworkName() throws Exception { - networkRollback.setNetworkName("test"); - } - - @Test - public void getPhysicalNetwork() throws Exception { - networkRollback.getPhysicalNetwork(); - } - - @Test - public void setPhysicalNetwork() throws Exception { - networkRollback.setPhysicalNetwork("test"); - } - - @Test - public void getVlans() throws Exception { - networkRollback.getVlans(); - } - - @Test - public void setVlans() throws Exception { - networkRollback.setVlans(Arrays.asList(10, 20)); - } - - @Test - public void getMsoRequest() throws Exception { - networkRollback.getMsoRequest(); - } - - @Test - public void setMsoRequest() throws Exception { - networkRollback.setMsoRequest(new MsoRequest()); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java deleted file mode 100644 index 9795c18197..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/PoolTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; - -public class PoolTest { - - Pool pool = new Pool(); - - @Test - public void getStart() throws Exception { - pool.getStart(); - } - - @Test - public void setStart() throws Exception { - pool.setStart("test"); - } - - @Test - public void getEnd() throws Exception { - pool.getEnd(); - } - - @Test - public void setEnd() throws Exception { - pool.setEnd("test"); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java deleted file mode 100644 index fd34f48276..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/RouteTargetTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; - -public class RouteTargetTest { - - RouteTarget routeTarget = new RouteTarget(); - - @Test - public void getRouteTarget() throws Exception { - routeTarget.getRouteTarget(); - } - - @Test - public void setRouteTarget() throws Exception { - routeTarget.setRouteTarget("1.1.1.1"); - } - - @Test - public void getRouteTargetRole() throws Exception { - routeTarget.getRouteTargetRole(); - } - - @Test - public void setRole() throws Exception { - routeTarget.setRole("test"); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java deleted file mode 100644 index b549b5f853..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/StackInfoTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; - -import java.util.HashMap; - -public class StackInfoTest { - - StackInfo stackInfo = new StackInfo(); - - @Test - public void getName() throws Exception { - stackInfo.getName(); - } - - @Test - public void setName() throws Exception { - stackInfo.setName("test"); - } - - @Test - public void getCanonicalName() throws Exception { - stackInfo.getCanonicalName(); - } - - @Test - public void setCanonicalName() throws Exception { - stackInfo.setCanonicalName("test"); - } - - @Test - public void getStatus() throws Exception { - stackInfo.getStatus(); - } - - @Test - public void setStatus() throws Exception { - stackInfo.setStatus(HeatStatus.BUILDING); - } - - @Test - public void getStatusMessage() throws Exception { - stackInfo.getStatusMessage(); - } - - @Test - public void setStatusMessage() throws Exception { - stackInfo.setStatusMessage("test"); - } - - @Test - public void getOutputs() throws Exception { - stackInfo.getOutputs(); - } - - @Test - public void setOutputs() throws Exception { - stackInfo.setOutputs(new HashMap<>()); - } - - @Test - public void getParameters() throws Exception { - stackInfo.getParameters(); - } - - @Test - public void setParameters() throws Exception { - stackInfo.setParameters(new HashMap<>()); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java deleted file mode 100644 index 42781c04d1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/SubnetTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; - -import java.util.Arrays; -import java.util.Collections; - -public class SubnetTest { - - Subnet subnet = new Subnet(); - - @Test - public void getSubnetName() throws Exception { - subnet.getSubnetName(); - } - - @Test - public void setSubnetName() throws Exception { - subnet.setSubnetName("test"); - } - - @Test - public void getAllocationPools() throws Exception { - subnet.getAllocationPools(); - } - - @Test - public void getCidr() throws Exception { - subnet.getCidr(); - } - - @Test - public void getDnsNameServers() throws Exception { - subnet.getDnsNameServers(); - } - - @Test - public void getEnableDHCP() throws Exception { - subnet.getEnableDHCP(); - } - - @Test - public void getAddrFromStart() throws Exception { - subnet.getAddrFromStart(); - } - - @Test - public void setAddrFromStart() throws Exception { - subnet.setAddrFromStart(true); - } - - @Test - public void getGatewayIp() throws Exception { - subnet.getGatewayIp(); - } - - @Test - public void getHostRoutes() throws Exception { - subnet.getHostRoutes(); - } - - @Test - public void getNeutronId() throws Exception { - subnet.getNeutronId(); - } - - @Test - public void getIpVersion() throws Exception { - subnet.getIpVersion(); - } - - @Test - public void getSubnetId() throws Exception { - subnet.getSubnetId(); - } - - @Test - public void setAllocationPools() throws Exception { - subnet.setAllocationPools(Arrays.asList()); - } - - @Test - public void setCidr() throws Exception { - subnet.setCidr("255.255.255.0"); - } - - @Test - public void setDnsNameServers() throws Exception { - subnet.setDnsNameServers(Arrays.asList()); - } - - @Test - public void setEnableDHCP() throws Exception { - subnet.setEnableDHCP(true); - } - - @Test - public void setGatewayIp() throws Exception { - subnet.setGatewayIp("192.168.0.1"); - } - - @Test - public void setHostRoutes() throws Exception { - subnet.setHostRoutes(Collections.emptyList()); - } - - @Test - public void setNeutronId() throws Exception { - subnet.setNeutronId("test"); - } - - @Test - public void setIpVersion() throws Exception { - subnet.setIpVersion("ipv4"); - } - - @Test - public void setSubnetId() throws Exception { - subnet.setSubnetId("1.0.0.0"); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java deleted file mode 100644 index 9891811b86..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/beans/VnfRollbackTest.java +++ /dev/null @@ -1,179 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.openstack.beans; - -import org.junit.Test; -import org.openecomp.mso.entity.MsoRequest; - -public class VnfRollbackTest { - - VnfRollback vnfRollback = new VnfRollback(); - - @Test - public void getVnfId() throws Exception { - vnfRollback.getVnfId(); - } - - @Test - public void setVnfId() throws Exception { - vnfRollback.setVnfId("test"); - } - - @Test - public void getTenantId() throws Exception { - vnfRollback.getTenantId(); - } - - @Test - public void setTenantId() throws Exception { - vnfRollback.setTenantId("test"); - } - - @Test - public void getCloudSiteId() throws Exception { - vnfRollback.getCloudSiteId(); - } - - @Test - public void setCloudSiteId() throws Exception { - vnfRollback.setCloudSiteId("test"); - } - - @Test - public void getTenantCreated() throws Exception { - vnfRollback.getTenantCreated(); - } - - @Test - public void setTenantCreated() throws Exception { - vnfRollback.setTenantCreated(true); - } - - @Test - public void getVnfCreated() throws Exception { - vnfRollback.getVnfCreated(); - } - - @Test - public void setVnfCreated() throws Exception { - vnfRollback.setVnfCreated(true); - } - - @Test - public void getMsoRequest() throws Exception { - vnfRollback.getMsoRequest(); - } - - @Test - public void setMsoRequest() throws Exception { - vnfRollback.setMsoRequest(new MsoRequest()); - } - - @Test - public void getVolumeGroupName() throws Exception { - vnfRollback.getVolumeGroupName(); - } - - @Test - public void setVolumeGroupName() throws Exception { - vnfRollback.setVolumeGroupName("test"); - } - - @Test - public void getVolumeGroupId() throws Exception { - vnfRollback.getVolumeGroupId(); - } - - @Test - public void setVolumeGroupId() throws Exception { - vnfRollback.setVolumeGroupId("test"); - } - - @Test - public void getRequestType() throws Exception { - vnfRollback.getRequestType(); - } - - @Test - public void setRequestType() throws Exception { - vnfRollback.setRequestType("test"); - } - - @Test - public void getVolumeGroupHeatStackId() throws Exception { - vnfRollback.getVolumeGroupHeatStackId(); - } - - @Test - public void setVolumeGroupHeatStackId() throws Exception { - vnfRollback.setVolumeGroupHeatStackId("test"); - } - - @Test - public void getBaseGroupHeatStackId() throws Exception { - vnfRollback.getBaseGroupHeatStackId(); - } - - @Test - public void setBaseGroupHeatStackId() throws Exception { - vnfRollback.setBaseGroupHeatStackId("test"); - } - - @Test - public void isBase() throws Exception { - vnfRollback.isBase(); - } - - @Test - public void setIsBase() throws Exception { - vnfRollback.setIsBase(true); - } - - @Test - public void getVfModuleStackId() throws Exception { - vnfRollback.getVfModuleStackId(); - } - - @Test - public void setVfModuleStackId() throws Exception { - vnfRollback.setVfModuleStackId("test"); - } - - @Test - public void getModelCustomizationUuid() throws Exception { - vnfRollback.getModelCustomizationUuid(); - } - - @Test - public void setModelCustomizationUuid() throws Exception { - vnfRollback.setModelCustomizationUuid("test"); - } - - @Test - public void getMode() throws Exception { - vnfRollback.getMode(); - } - - @Test - public void setMode() throws Exception { - vnfRollback.setMode("test"); - } - -} \ No newline at end of file diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java deleted file mode 100644 index 738fe9e4d9..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoAdapterExceptionTest.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoAdapterExceptionTest { - MsoAdapterException msoAdapterException = new MsoAdapterException("test"); - MsoAdapterException msoAdapterExceptionThr = new MsoAdapterException("test" , new Throwable()); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java deleted file mode 100644 index 4027aa6342..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudIdentityNotFoundTest.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoCloudIdentityNotFoundTest { - MsoCloudIdentityNotFound msoCloudIdentityNotFound = new MsoCloudIdentityNotFound(); - MsoCloudIdentityNotFound msoCloudIdentityNotFoundStr = new MsoCloudIdentityNotFound("test"); - public String str = msoCloudIdentityNotFound.toString(); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java deleted file mode 100644 index cac02152e0..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoCloudSiteNotFoundTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoCloudSiteNotFoundTest { - MsoCloudSiteNotFound msoCloudSiteNotFound = new MsoCloudSiteNotFound(); - MsoCloudSiteNotFound msoCloudSiteNotFoundStr = new MsoCloudSiteNotFound("test"); - public String str = msoCloudSiteNotFoundStr.toString(); - -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java deleted file mode 100644 index d1f4db778e..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoIOExceptionTest.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoIOExceptionTest { - MsoIOException msoIOException = new MsoIOException("test"); - MsoIOException msoIOExceptionTh = new MsoIOException("test" , new Throwable()); - public String str = msoIOException.toString(); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java deleted file mode 100644 index c5217e4933..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkAlreadyExistsTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoNetworkAlreadyExistsTest { - MsoNetworkAlreadyExists msoNetworkAlreadyExists = new MsoNetworkAlreadyExists("test","test","test"); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java deleted file mode 100644 index ea74efcf42..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoNetworkNotFoundTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoNetworkNotFoundTest { - MsoNetworkNotFound msoNetworkNotFound =new MsoNetworkNotFound("test","test","test"); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java deleted file mode 100644 index 58cea958df..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoOpenstackExceptionTest.java +++ /dev/null @@ -1,28 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoOpenstackExceptionTest { - MsoOpenstackException msoOpenstackException= new MsoOpenstackException(404,"test","test"); - MsoOpenstackException msoOpenstackExceptionEx= new MsoOpenstackException(404,"test","test",new Exception()); - public String str = msoOpenstackException.toString(); - -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java deleted file mode 100644 index f36ddfe7a1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackAlreadyExistsTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoStackAlreadyExistsTest { - MsoStackAlreadyExists msoStackAlreadyExists = new MsoStackAlreadyExists("test","test","test"); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java deleted file mode 100644 index e422c04fcc..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoStackNotFoundTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoStackNotFoundTest { - MsoStackNotFound msoStackNotFound = new MsoStackNotFound("test","test","test"); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java deleted file mode 100644 index d9e83063d1..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantAlreadyExistsTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoTenantAlreadyExistsTest { - MsoTenantAlreadyExists msoTenantAlreadyExists = new MsoTenantAlreadyExists("test","test"); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java deleted file mode 100644 index a8dd6c6afb..0000000000 --- a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/openstack/exceptions/MsoTenantNotFoundTest.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.openstack.exceptions; - -public class MsoTenantNotFoundTest { - MsoTenantNotFound msoTenantNotFound = new MsoTenantNotFound("test","test"); -} diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json b/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json new file mode 100644 index 0000000000..c0f08f8bd7 --- /dev/null +++ b/adapters/mso-adapters-rest-interface/src/test/resources/stack-example.json @@ -0,0 +1,13 @@ +{ + "outputs" : [{ + "outputKey": "key1", + "outputValue": "value1" + },{ + "outputKey": "key2", + "outputValue": "value2" + },{ + "outputKey": "key3", + "outputValue": "value3" + }] + +} \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/.gitignore b/adapters/mso-catalog-db-adapter/.gitignore new file mode 100644 index 0000000000..82f0c3ac6d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/.gitignore @@ -0,0 +1 @@ +/data/ diff --git a/adapters/mso-catalog-db-adapter/.maven-dockerignore b/adapters/mso-catalog-db-adapter/.maven-dockerignore new file mode 100644 index 0000000000..90f0431277 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/.maven-dockerignore @@ -0,0 +1 @@ +target/** diff --git a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml deleted file mode 100644 index 53bdbc9ea7..0000000000 --- a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml deleted file mode 100644 index 2493bdb8b1..0000000000 --- a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,3 +0,0 @@ - - ecomp/mso/catalog - \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml deleted file mode 100644 index 750bba7633..0000000000 --- a/adapters/mso-catalog-db-adapter/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - mso-catalog-db - - - log.configuration - logback.catalog.xml - - - mso.configuration - MSO_PROP_TOPOLOGY=topology.properties - - - resteasy.resources - - org.openecomp.mso.adapters.catalogdb.CatalogDbAdapterRest - - - - Resteasy - org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher - - - Resteasy - /* - - - - MSO internal Requests - Internal Requests - /logging/* - /properties/* - POST - GET - - - MSO-Client - - - - MSO-Client - - - LogFilter - org.openecomp.mso.logger.LogFilter - - - LogFilter - /* - - - resteasy.scan - true - - - resteasy.scan.providers - true - - - resteasy.scan.resources - true - - - diff --git a/adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-dpl.yaml b/adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-dpl.yaml new file mode 100644 index 0000000000..d261f0d566 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-dpl.yaml @@ -0,0 +1,28 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: mso-catalog-db-adapter + namespace: com-att-mso-dev + labels: + app: mso-catalog-db-adapter +spec: + replicas: 1 + selector: + matchLabels: + app: mso-catalog-db-adapter + template: + metadata: + labels: + app: mso-catalog-db-adapter + spec: + restartPolicy: Always + containers: + - name: mso-catalog-db-adapter + image: ${docker_repository}/com.att.mso/${artifact_id}:${project_version} + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8080 + protocol: TCP + imagePullSecrets: + - name: msoregistrykey \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-srv.yaml b/adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-srv.yaml new file mode 100644 index 0000000000..6833d191ec --- /dev/null +++ b/adapters/mso-catalog-db-adapter/mso-catalog-db-adapter-srv.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: mso-catalog-db-adapter + name: mso-catalog-db-adapter + namespace: com-att-mso-dev +spec: + ports: + - name: http + port: 8080 + protocol: TCP + targetPort: 8080 + selector: + app: mso-catalog-db-adapter + type: NodePort diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml index 67d81dbb49..df5f3fac73 100644 --- a/adapters/mso-catalog-db-adapter/pom.xml +++ b/adapters/mso-catalog-db-adapter/pom.xml @@ -4,30 +4,56 @@ org.onap.so adapters - 1.2.0-SNAPSHOT + 1.3.0-SNAPSHOT org.onap.so.adapters mso-catalog-db-adapter - war - + jar + + UTF-8 + UTF-8 + 1.8 + - ${project.artifactId}-${project.version} - maven-war-plugin - 2.4 + org.springframework.boot + spring-boot-maven-plugin + ${springboot.version} - WebContent - false - true + org.onap.so.adapters.catalogdb.CatalogDBApplication + + + + repackage + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + extract-docker-file + + + + + io.fabric8 + fabric8-maven-plugin + + + start + + - - org.eclipse.m2e @@ -45,7 +71,7 @@ jaxws-maven-plugin - [2.3.1,) + [2.3,) wsgen @@ -59,39 +85,111 @@ + + + org.jacoco + jacoco-maven-plugin + + ${project.artifactId}-${project.version} - + + + + + org.springframework.boot + spring-boot-dependencies + ${springboot.version} + pom + import + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.apache.tomcat + tomcat-jdbc + + + + + org.apache.commons + commons-dbcp2 + + + io.swagger + swagger-jersey2-jaxrs + 1.5.16 + + + org.mariadb.jdbc + mariadb-java-client + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-jersey + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-test + test + org.onap.so - mso-catalog-db + deployment-configs ${project.version} - - - javax.json - javax.json-api - 1.0 - test - - - org.glassfish - javax.json - 1.0.4 - test - - - javax.servlet - javax.servlet-api - 3.1.0 - test - - - - +
+ + janino + janino + 2.5.15 + + + uk.co.blackpepper.bowman + bowman-client + 0.3.0 + + + ch.vorburger.mariaDB4j + mariaDB4j + 2.2.3 + test + + + org.flywaydb + flyway-core + + + io.micrometer + micrometer-spring-legacy + 1.0.5 + + + io.micrometer + micrometer-registry-prometheus + 1.0.5 + + + \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java new file mode 100644 index 0000000000..ce98b74fab --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.domain.EntityScan; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; + +@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client"}) +@EnableJpaRepositories("org.onap.so.db.catalog.data.repository") +@EntityScan("org.onap.so.db.catalog.beans") +public class CatalogDBApplication { + + private static final String LOGS_DIR = "logs_dir"; + + private static void setLogsDir() { + if (System.getProperty(LOGS_DIR) == null) { + System.getProperties().setProperty(LOGS_DIR, "./logs/catdb/"); + } + } + + public static void main(String[] args) { + SpringApplication.run(CatalogDBApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + setLogsDir(); + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java new file mode 100644 index 0000000000..3906762e60 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb; + +import java.util.stream.Collectors; + +import javax.persistence.EntityManager; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.rest.core.config.RepositoryRestConfiguration; +import org.springframework.data.rest.webmvc.config.RepositoryRestConfigurerAdapter; + +@Configuration +public class CatalogDbRepositoryConfiguration extends RepositoryRestConfigurerAdapter { + + @Autowired + private EntityManager entityManager; + + @Override + public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) { + config.exposeIdsFor(entityManager.getMetamodel().getEntities().stream().map(e -> e.getJavaType()).collect(Collectors.toList()).toArray(new Class[0])); + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java new file mode 100644 index 0000000000..dcd668f2c8 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb; + +import javax.annotation.PostConstruct; +import javax.ws.rs.ApplicationPath; + +import org.glassfish.jersey.server.ResourceConfig; +import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest; +import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging; +import org.springframework.context.annotation.Configuration; + +import io.swagger.jaxrs.config.BeanConfig; +import io.swagger.jaxrs.listing.ApiListingResource; +import io.swagger.jaxrs.listing.SwaggerSerializers; + +@Configuration +@ApplicationPath("/ecomp/mso/catalog") +public class JerseyConfiguration extends ResourceConfig { + + @PostConstruct + public void setUp() { + register(CatalogDbAdapterRest.class); + register(ApiListingResource.class); + register(SwaggerSerializers.class); + register(JaxRsFilterLogging.class); + BeanConfig beanConfig = new BeanConfig(); + beanConfig.setVersion("1.0.2"); + beanConfig.setSchemes(new String[]{"http"}); + beanConfig.setHost("localhost:8080"); + beanConfig.setBasePath("/ecomp/mso/catalog"); + beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb"); + beanConfig.setPrettyPrint(true); + beanConfig.setScan(true); + } +} + diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java new file mode 100644 index 0000000000..144df5fe6a --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb; + +import org.onap.so.security.MSOSpringFirewall; +import org.onap.so.security.WebSecurityConfig; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.builders.WebSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.firewall.StrictHttpFirewall; +import org.springframework.util.StringUtils; + +@EnableWebSecurity +public class WebSecurityConfigImpl extends WebSecurityConfig { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable() + .authorizeRequests() + .antMatchers("/manage/health","/manage/info").permitAll() + .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) + .and() + .httpBasic(); + } + + @Override + public void configure(WebSecurity web) throws Exception { + super.configure(web); + StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java new file mode 100644 index 0000000000..6b0d901cb4 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQuery.java @@ -0,0 +1,99 @@ +/*- + * ============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.adapters.catalogdb.catalogrest; + +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class CatalogQuery { + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogQuery.class); + private static final boolean IS_EMBED = true; + + public abstract String JSON2(boolean isArray, boolean isEmbed); + + protected void put(Map valueMap, String key, String value) { + valueMap.put(key, value == null? "null": '"'+ value+ '"'); + } + + protected void put(Map valueMap, String key, Integer value) { + valueMap.put(key, value == null? "null": value.toString()); + } + + protected void put(Map valueMap, String key, Boolean value) { + valueMap.put(key, value == null? "null": value? "true": "false"); + } + + protected String setTemplate(String template, Map valueMap) { + LOGGER.debug("CatalogQuery setTemplate"); + StringBuffer result = new StringBuffer(); + + String pattern = "<.*>"; + Pattern r = Pattern.compile(pattern); + Matcher m = r.matcher(template); + + LOGGER.debug("CatalogQuery template:" + template); + while (m.find()) { + String key = template.substring(m.start() + 1, m.end() - 1); + LOGGER.debug("CatalogQuery key:" + key + " contains key? " + valueMap.containsKey(key)); + m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); + } + m.appendTail(result); + LOGGER.debug("CatalogQuery return:" + result.toString()); + return result.toString(); + } + + /** + * The simple, clean, generic way to handle the interface + */ + protected String smartToJSON() { + String jsonString = null; + try { + ObjectMapper mapper = new ObjectMapper(); + jsonString = mapper.writeValueAsString(this); + } + catch (Exception e) { + LOGGER.debug("Exception:", e); + LOGGER.debug ("jsonString exception:"+e.getMessage()); + jsonString = "invalid"; //throws instead? + } + return jsonString; + } + + public String toJsonString(String version, boolean isArray) { + switch(version) { + case "v1": return smartToJSON(); + case "v2": return JSON2(isArray, !IS_EMBED); + default: + return "invalid version: "+ version; + } + } + @Override + public String toString(){ + return smartToJSON(); + + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java new file mode 100644 index 0000000000..890347344c --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryException.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +import java.io.Serializable; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "catalogQueryException") +public class CatalogQueryException extends CatalogQueryExceptionCommon implements Serializable { + private static final long serialVersionUID = -9062290006520066109L; + + private String message; + private CatalogQueryExceptionCategory category; + private Boolean rolledBack; + + public CatalogQueryException () {} + + public CatalogQueryException (String message) { + this.message = message; + } + + public CatalogQueryException (String message, CatalogQueryExceptionCategory category, boolean rolledBack, String messageid) { + super(messageid); + this.message = message; + this.category = category; + this.rolledBack = rolledBack; + } + + public String getMessage() { return message; } + public void setMessage(String message) { this.message = message; } + + public CatalogQueryExceptionCategory getCategory () { return category; } + public void setCategory (CatalogQueryExceptionCategory category) { this.category = category; } + + public Boolean getRolledBack() { return rolledBack; } + public void setRolledBack(Boolean rolledBack) { this.rolledBack = rolledBack; } + + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java new file mode 100644 index 0000000000..687cc7d3e0 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java @@ -0,0 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +public enum CatalogQueryExceptionCategory { OPENSTACK, IO, INTERNAL, USERDATA } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java new file mode 100644 index 0000000000..67f337e039 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java @@ -0,0 +1,75 @@ +/*- + * ============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.adapters.catalogdb.catalogrest; + +import java.io.ByteArrayOutputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.onap.so.logger.MsoLogger; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public abstract class CatalogQueryExceptionCommon { + private String messageId; + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogQueryExceptionCommon.class); + + public CatalogQueryExceptionCommon() { messageId = null; } + public CatalogQueryExceptionCommon(String messageId) { this.messageId = messageId; } + + public String getMessageId() { return messageId; } + public void setMessageId(String messageId) { this.messageId = messageId; } + + public String toJsonString() { + try { + String jsonString; + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + jsonString = mapper.writeValueAsString(this); + return jsonString; + } catch (Exception e) { + LOGGER.debug ("Exception:", e); + return ""; + } + } + + public String toXmlString() { + try { + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + JAXBContext context = JAXBContext.newInstance(this.getClass()); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML + marshaller.marshal(this, bs); + return bs.toString(); + } catch (Exception e) { + LOGGER.debug ("Exception:", e); + return ""; + } + } + + @Override + public String toString(){ + return toJsonString(); + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java new file mode 100644 index 0000000000..2deada5754 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java @@ -0,0 +1,123 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.logger.MsoLogger; + +@XmlRootElement(name = "serviceAllottedResources") +public class QueryAllottedResourceCustomization extends CatalogQuery { + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,QueryAllottedResourceCustomization.class); + private List allottedResourceCustomization; + private final String template = + "\t{\n"+ +// "\t{ \"allottedResource\" : {\n"+ + "\t\t\"modelInfo\" : {\n"+ + "\t\t\t\"modelName\" : ,\n"+ + "\t\t\t\"modelUuid\" : ,\n"+ + "\t\t\t\"modelInvariantUuid\" : ,\n"+ + "\t\t\t\"modelVersion\" : ,\n"+ + "\t\t\t\"modelCustomizationUuid\" : ,\n"+ + "\t\t\t\"modelInstanceName\" : \n"+ + "\t\t},\n"+ + "\t\t\"toscaNodeType\" : ,\n"+ + "\t\t\"allottedResourceType\" : ,\n"+ + "\t\t\"allottedResourceRole\" : ,\n"+ + "\t\t\"providingServiceModelName\" : ,\n"+ + "\t\t\"providingServiceModelInvariantUuid\" : ,\n"+ + "\t\t\"providingServiceModelUuid\" : ,\n"+ + "\t\t\"nfFunction\" : ,\n"+ + "\t\t\"nfType\" : ,\n"+ + "\t\t\"nfRole\" : ,\n"+ + "\t\t\"nfNamingCode\" : \n"+ + "\t}"; +// "\t}}"; + + public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<>(); } + public QueryAllottedResourceCustomization(List vlist) { allottedResourceCustomization = vlist; } + + public List getServiceAllottedResources(){ return this.allottedResourceCustomization; } + public void setServiceAllottedResources(List v) { this.allottedResourceCustomization = v; } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder(); + + boolean first = true; + int i = 1; + for (AllottedResourceCustomization o : allottedResourceCustomization) { + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); + } + return sb.toString(); + } + + @Override + public String JSON2(boolean isArray, boolean isEmbed) { + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"serviceAllottedResources\": ["); + Map valueMap = new HashMap<>(); + String sep = ""; + boolean first = true; + + if (this.allottedResourceCustomization != null) { + for (AllottedResourceCustomization o : allottedResourceCustomization) { + if (first) sb.append("\n"); first = false; + + boolean arNull = o.getAllottedResource() == null ? true : false; + + put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName()); + put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUUID()); + put(valueMap, "MODEL_INVARIANT_ID", arNull ? null : o.getAllottedResource().getModelInvariantUUID()); + put(valueMap, "MODEL_VERSION", arNull ? null : o.getAllottedResource().getModelVersion()); + put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID()); + put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); + put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getAllottedResource().getToscaNodeType()); + put(valueMap, "ALLOTTED_RESOURCE_TYPE", arNull ? null : o.getAllottedResource().getSubcategory()); + put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getTargetNetworkRole()); + put(valueMap, "NF_TYPE", o.getNfType()); + put(valueMap, "NF_ROLE", o.getNfRole()); + put(valueMap, "NF_FUNCTION", o.getNfFunction()); + put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode()); + put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUUID()); + put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUUID()); + put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName()); + + sb.append(sep).append(this.setTemplate(template, valueMap)); + sep = ",\n"; + } + } + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java new file mode 100644 index 0000000000..e0d187500e --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryResourceRecipe.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 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.adapters.catalogdb.catalogrest; + +import java.util.HashMap; +import java.util.Map; + +import org.onap.so.db.catalog.beans.Recipe; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +/** + * serivce csar query support + *
+ *

+ *

+ * + * @author + * @version ONAP Beijing Release 2018-02-28 + */ +public class QueryResourceRecipe extends CatalogQuery{ + + private Recipe resourceRecipe; + + public QueryResourceRecipe(Recipe resourceRecipe){ + this.resourceRecipe =resourceRecipe; + } + + @Override + public String toString() { + + return resourceRecipe.toString(); + } + + @Override + public String JSON2(boolean isArray, boolean isEmbed) { + Map valueMap = new HashMap<>(); + valueMap.put("id", null == resourceRecipe ? null :String.valueOf(resourceRecipe.getId())); + valueMap.put("action", null == resourceRecipe ? null :resourceRecipe.getAction()); + valueMap.put("orchestrationUri", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri()); + valueMap.put("recipeTimeout", null == resourceRecipe ? null : String.valueOf(resourceRecipe.getRecipeTimeout())); + valueMap.put("paramXSD", null == resourceRecipe ? null : resourceRecipe.getParamXsd()); + valueMap.put("description", null == resourceRecipe ? null : resourceRecipe.getDescription()); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); + String jsonStr = ""; + try { + jsonStr = mapper.writeValueAsString(valueMap); + } catch(JsonProcessingException e) { + + e.printStackTrace(); + } + return jsonStr; + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java new file mode 100644 index 0000000000..d49f8965fb --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceCsar.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 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.adapters.catalogdb.catalogrest; + +import java.util.HashMap; +import java.util.Map; + +import org.onap.so.db.catalog.beans.ToscaCsar; + +/** + * serivce csar query support + *
+ *

+ *

+ * + * @author + * @version ONAP Beijing Release 2018-02-28 + */ +public class QueryServiceCsar extends CatalogQuery{ + + private ToscaCsar toscaCsar; + + public QueryServiceCsar(ToscaCsar toscaCsar){ + this.toscaCsar = toscaCsar; + } + + private final String template = + "\t{\n"+ + "\t\t\"artifactUUID\" : ,\n"+ + "\t\t\"name\" : ,\n"+ + "\t\t\"version\" : ,\n"+ + "\t\t\"artifactChecksum\" : ,\n"+ + "\t\t\"url\" : ,\n"+ + "\t\t\"description\" : \n"+ + "\t}"; + + @Override + public String toString() { + + return toscaCsar.toString(); + } + + @Override + public String JSON2(boolean isArray, boolean isEmbed) { + Map valueMap = new HashMap<>(); + put(valueMap, "ARTIFACT_UUID", null == toscaCsar ? null : toscaCsar.getArtifactUUID()); + put(valueMap, "NAME", null == toscaCsar ? null : toscaCsar.getName()); + put(valueMap, "VERSION", null == toscaCsar ? null : toscaCsar.getVersion()); + put(valueMap, "ARTIFACT_CHECK_SUM", null == toscaCsar ? null : toscaCsar.getArtifactChecksum()); + put(valueMap, "URL", null == toscaCsar ? null : toscaCsar.getUrl()); + put(valueMap, "DESCRIPTION", null == toscaCsar ? null : toscaCsar.getDescription()); + return this.setTemplate(template, valueMap); + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java new file mode 100644 index 0000000000..12ba4c0598 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder; + +@XmlRootElement(name = "serviceResources") +public class QueryServiceMacroHolder extends CatalogQuery { + private ServiceMacroHolder serviceMacroHolder; + private static final String LINE_BEGINNING = "(?m)^"; + private static final String template = + "{ \"serviceResources\" : {\n"+ + "\t\"modelInfo\" : {\n"+ + "\t\t\"modelName\" : ,\n"+ + "\t\t\"modelUuid\" : ,\n"+ + "\t\t\"modelInvariantUuid\" : ,\n"+ + "\t\t\"modelVersion\" : \n"+ + "\t},\n"+ + "\t\"serviceType\" : ,\n"+ + "\t\"serviceRole\" : ,\n"+ + "\t\"environmentContext\" : ,\n"+ + "\t\"workloadContext\" : ,\n"+ + "<_SERVICEVNFS_>,\n"+ + "<_SERVICENETWORKS_>,\n"+ + "<_SERVICEALLOTTEDRESOURCES_>\n"+ + "\t}}"; + + public QueryServiceMacroHolder() { + super(); + serviceMacroHolder = new ServiceMacroHolder(); + } + public QueryServiceMacroHolder(ServiceMacroHolder vlist) { serviceMacroHolder = vlist; } + + public ServiceMacroHolder getServiceResources(){ return this.serviceMacroHolder; } + public void setServiceResources(ServiceMacroHolder v) { this.serviceMacroHolder = v; } + + @Override + public String toString () { return serviceMacroHolder.toString(); } + + @Override + public String JSON2(boolean isArray, boolean x) { + Service service = serviceMacroHolder.getService(); + if (service == null) { + return "\"serviceResources\": null"; + } + + StringBuilder buf = new StringBuilder(); + Map valueMap = new HashMap<>(); + + put(valueMap, "SERVICE_MODEL_NAME", service.getModelName()); //getServiceModelName()); + put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID()); //getServiceModelUuid()); + put(valueMap, "SERVICE_MODEL_INVARIANT_ID", service.getModelInvariantUUID()); //getServiceModelInvariantId()); + put(valueMap, "SERVICE_MODEL_VERSION", service.getModelVersion()); //getServiceModelVersion()); + put(valueMap, "SERVICE_TYPE", service.getServiceType()); + put(valueMap, "SERVICE_ROLE", service.getServiceRole()); + put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext()); + put(valueMap, "WORKLOAD_CONTEXT", service.getWorkloadContext()); + + String subitem; + subitem = new QueryServiceVnfs(service.getVnfCustomizations()).JSON2(true, true); + valueMap.put("_SERVICEVNFS_", subitem.replaceAll(LINE_BEGINNING, "\t")); + + subitem = new QueryServiceNetworks(service.getNetworkCustomizations()).JSON2(true, true); + valueMap.put("_SERVICENETWORKS_", subitem.replaceAll(LINE_BEGINNING, "\t")); + + subitem = new QueryAllottedResourceCustomization(service.getAllottedCustomizations()).JSON2(true, true); + valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t")); + + buf.append(this.setTemplate(template, valueMap)); + return buf.toString(); + } + +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java new file mode 100644 index 0000000000..b213d33af0 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java @@ -0,0 +1,117 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.logger.MsoLogger; + +@XmlRootElement(name = "serviceNetworks") +public class QueryServiceNetworks extends CatalogQuery { + protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,QueryServiceNetworks.class); + private List serviceNetworks; + private final String template = + "\t{\n"+ +// "\t{ \"networkResource\" : {\n"+ + "\t\t\"modelInfo\" : {\n"+ + "\t\t\t\"modelName\" : ,\n"+ + "\t\t\t\"modelUuid\" : ,\n"+ + "\t\t\t\"modelInvariantUuid\" : ,\n"+ + "\t\t\t\"modelVersion\" : ,\n"+ + "\t\t\t\"modelCustomizationUuid\" : ,\n"+ + "\t\t\t\"modelInstanceName\" : \n"+ + "\t},\n"+ + "\t\t\"toscaNodeType\" : ,\n"+ + "\t\t\"networkType\" : ,\n"+ + "\t\t\"networkTechnology\" : ,\n"+ + "\t\t\"networkRole\" : ,\n"+ + "\t\t\"networkScope\" : \n"+ + "\t}"; +// "\t}}"; + + public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<>(); } + public QueryServiceNetworks(List vlist) { + LOGGER.debug ("QueryServiceNetworks:"); + serviceNetworks = new ArrayList<>(); + for (NetworkResourceCustomization o : vlist) { + LOGGER.debug (o.toString()); + serviceNetworks.add(o); + LOGGER.debug ("-------------------"); + } + } + + public List getServiceNetworks(){ return this.serviceNetworks; } + public void setServiceNetworks(List v) { this.serviceNetworks = v; } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder(); + + boolean first = true; + int i = 1; + for (NetworkResourceCustomization o : serviceNetworks) { + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); + } + return sb.toString(); + } + + @Override + public String JSON2(boolean isArray, boolean isEmbed) { + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"serviceNetworks\": ["); + + Map valueMap = new HashMap<>(); + String sep = ""; + boolean first = true; + + for (NetworkResourceCustomization o : serviceNetworks) { + if (first) sb.append("\n"); first = false; + boolean nrNull = o.getNetworkResource() == null ? true : false; + put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName()); + put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID()); + put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID()); + put(valueMap, "MODEL_VERSION", nrNull ? null : o.getNetworkResource().getModelVersion()); + put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID()); + put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); + put(valueMap, "TOSCA_NODE_TYPE", nrNull ? null : o.getNetworkResource().getToscaNodeType()); + put(valueMap, "NETWORK_TYPE", o.getNetworkType()); + put(valueMap, "NETWORK_ROLE", o.getNetworkRole()); + put(valueMap, "NETWORK_SCOPE", o.getNetworkScope()); + put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology()); + + sb.append(sep).append(this.setTemplate(template, valueMap)); + sep = ",\n"; + } + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java new file mode 100644 index 0000000000..ff52daf880 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; +/* should be called QueryVnfResource.java */ + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.db.catalog.beans.VnfResourceCustomization; + +@XmlRootElement(name = "serviceVnfs") +public class QueryServiceVnfs extends CatalogQuery { + private List serviceVnfs; + private final String template = + "\n"+ + "\t{ \"modelInfo\" : {\n"+ + "\t\t\"modelName\" : ,\n"+ + "\t\t\"modelUuid\" : ,\n"+ + "\t\t\"modelInvariantUuid\" : ,\n"+ + "\t\t\"modelVersion\" : ,\n"+ + "\t\t\"modelCustomizationUuid\" : ,\n"+ + "\t\t\"modelInstanceName\" : \n"+ + "\t\t},\n"+ + "\t\"toscaNodeType\" : ,\n"+ + "\t\"nfFunction\" : ,\n"+ + "\t\"nfType\" : ,\n"+ + "\t\"nfRole\" : ,\n"+ + "\t\"nfNamingCode\" : ,\n"+ + "\t\"multiStageDesign\" : ,\n"+ + "<_VFMODULES_>\n" + + "\t}"; + + public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<>(); } + public QueryServiceVnfs(List vlist) { + LOGGER.debug ("QueryServiceVnfs:"); + serviceVnfs = new ArrayList<>(); + for (VnfResourceCustomization o : vlist) { + LOGGER.debug ("-- o is a serviceVnfs ----"); + LOGGER.debug (o.toString()); + serviceVnfs.add(o); + LOGGER.debug ("-------------------"); + } + } + + public List getServiceVnfs(){ return this.serviceVnfs; } + public void setServiceVnfs(List v) { this.serviceVnfs = v; } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder(); + + boolean first = true; + int i = 1; + for (VnfResourceCustomization o : serviceVnfs) { + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); + } + return sb.toString(); + } + + @Override + public String JSON2(boolean isArray, boolean isEmbed) { + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"serviceVnfs\": ["); + Map valueMap = new HashMap<>(); + String sep = ""; + boolean first = true; + + for (VnfResourceCustomization o : serviceVnfs) { + if (first) sb.append("\n"); first = false; + + boolean vrNull = o.getVnfResources() == null ? true : false; + + put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResources().getModelName()); + put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResources().getModelUUID()); + put(valueMap, "MODEL_INVARIANT_ID", vrNull ? null : o.getVnfResources().getModelInvariantId()); + put(valueMap, "MODEL_VERSION", vrNull ? null : o.getVnfResources().getModelVersion()); + put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID()); + put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); + put(valueMap, "TOSCA_NODE_TYPE", vrNull ? null : o.getVnfResources().getToscaNodeType()); + put(valueMap, "NF_FUNCTION", o.getNfFunction()); + put(valueMap, "NF_TYPE", o.getNfType()); + put(valueMap, "NF_ROLE", o.getNfRole()); + put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode()); + put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign()); + + String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true); + valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t")); + + sb.append(sep).append(this.setTemplate(template, valueMap)); + sep = ",\n"; + } + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java new file mode 100644 index 0000000000..e5fa14376b --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryVfModule.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.catalogrest; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlRootElement; + +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.VfModuleCustomization; + +@XmlRootElement(name = "vfModules") +public class QueryVfModule extends CatalogQuery { + private List vfModules; + private final String template = + "\t{\n"+ +// "\t{ \"vfModule\" : { \n"+ + "\t\t\"modelInfo\" : { \n"+ + "\t\t\t\"modelName\" : ,\n"+ + "\t\t\t\"modelUuid\" : ,\n"+ + "\t\t\t\"modelInvariantUuid\" : ,\n"+ + "\t\t\t\"modelVersion\" : ,\n"+ + "\t\t\t\"modelCustomizationUuid\" : \n"+ + "\t\t},"+ + "\t\t\"isBase\" : ,\n"+ + "\t\t\"vfModuleLabel\" : ,\n"+ + "\t\t\"initialCount\" : ,\n"+ + "\t\t\"hasVolumeGroup\" : \n"+ + "\t}"; +// "\t}}"; + + public QueryVfModule() { super(); vfModules = new ArrayList<>(); } + public QueryVfModule(List vlist) { + LOGGER.debug ("QueryVfModule:"); + vfModules = new ArrayList<>(); + if (vlist != null) { + for (VfModuleCustomization o : vlist) { + LOGGER.debug ("-- o is a vfModules ----"); + LOGGER.debug (o.toString()); + vfModules.add(o); + LOGGER.debug ("-------------------"); + } + } + } + + public List getVfModule(){ return this.vfModules; } + public void setVfModule(List v) { this.vfModules = v; } + + @Override + public String toString () { + StringBuilder sb = new StringBuilder(); + + boolean first = true; + int i = 1; + for (VfModuleCustomization o : vfModules) { + sb.append(i).append("\t"); + if (!first) sb.append("\n"); first = false; + sb.append(o); + } + return sb.toString(); + } + + @Override + public String JSON2(boolean isArray, boolean isEmbed) { + StringBuilder sb = new StringBuilder(); + if (!isEmbed && isArray) sb.append("{ "); + if (isArray) sb.append("\"vfModules\": ["); + Map valueMap = new HashMap<>(); + String sep = ""; + boolean first = true; + + for (VfModuleCustomization o : vfModules) { + if (first) sb.append("\n"); first = false; + + boolean vfNull = o.getVfModule() == null ? true : false; + boolean hasVolumeGroup = false; + HeatEnvironment envt = o.getVolumeHeatEnv(); + if (envt != null) { + hasVolumeGroup = true; + } + + put(valueMap, "MODEL_NAME", vfNull ? null : o.getVfModule().getModelName()); + put(valueMap, "MODEL_UUID", vfNull ? null : o.getVfModule().getModelUUID()); + put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUUID()); + put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getModelVersion()); + put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUUID()); + put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().getIsBase() ? true : false); + put(valueMap, "VF_MODULE_LABEL", o.getLabel()); + put(valueMap, "INITIAL_COUNT", o.getInitialCount()); + put(valueMap, "HAS_VOLUME_GROUP", new Boolean(hasVolumeGroup)); + + sb.append(sep).append(this.setTemplate(template, valueMap)); + sep = ",\n"; + } + if (!first) sb.append("\n"); + if (isArray) sb.append("]"); + if (!isEmbed && isArray) sb.append("}"); + return sb.toString(); + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java new file mode 100644 index 0000000000..0eeaa6a72c --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -0,0 +1,600 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.catalogdb.rest; + +/* +Create an initial query to retrieve a VNF Resource definition (including a list of possible module types) +within the context of a given service. Input is a vnf resource model customization ID (new field for 1702), +or a composite key (from 1610) of service name, service version, vnf instance name + +Returns a structure (JSON?) containing VNF RESOURCE attributes, plus a list of VF Module structures. + +Query a NETWORK_RESOURCE from the MSO Catalog, based on a networkModelCustomizationUUID (new for 1702), +a network type (unique type identifier in 1610), or based on network role within a service. + +Create Adapter framework for access to Catalog DB, including connection management, +login/password access, transaction logic, etc. This can be modeled after the Request DB Adapter + +Update the MSO Catalog DB schema to include the new fields defined in this user story. + +Note that the resourceModelCustomizationUUID (or vfModuleModelCustomizationUUID) will be unique keys (indexes) +on the VNF_RESOURCE and VF_MODULE tables respectively. +The previously constructed "vnf-type" and "vf-module-type" field may continue to be populated, +but should no longer be needed and can deprecate in future release. + +For migration, a new randomly generated UUID field may be generated for the *ModelCustomizationUUID" fields +until such time that the model is redistributed from ASDC. + +All other fields Check with Mike Z for appropriate value for the vfModuleLabel. +We might be able to derive it's value from the current vnf-type (using the "middle" piece that identifies the module type). + +min and initial counts can be 0. max can be null to indicate no maximum. + +Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table. +*/ + +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.GET; +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.GenericEntity; +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.onap.so.adapters.catalogdb.catalogrest.CatalogQuery; +import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryException; +import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryExceptionCategory; +import org.onap.so.adapters.catalogdb.catalogrest.QueryAllottedResourceCustomization; +import org.onap.so.adapters.catalogdb.catalogrest.QueryResourceRecipe; +import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceCsar; +import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceMacroHolder; +import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceNetworks; +import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs; +import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule; +import org.onap.so.db.catalog.beans.AllottedResource; +import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResource; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.Recipe; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.ToscaCsar; +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.data.repository.AllottedResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; +import org.onap.so.db.catalog.data.repository.ArRecipeRepository; +import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository; +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.ServiceRepository; +import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; +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.VnfRecipeRepository; +import org.onap.so.db.catalog.data.repository.VnfResourceRepository; +import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder; +import org.onap.so.logger.MessageEnum; +import org.onap.so.logger.MsoLogger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +/** + * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1) + * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. + * Requests respond synchronously only + */ +@Path("/{version: v[0-9]+}") +@Component +public class CatalogDbAdapterRest { + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,CatalogDbAdapterRest.class); + private static final boolean IS_ARRAY = true; + + @Autowired + private VnfCustomizationRepository vnfCustomizationRepo; + + @Autowired + private ServiceRepository serviceRepo; + + @Autowired + private NetworkResourceCustomizationRepository networkCustomizationRepo; + + @Autowired + private NetworkResourceRepository networkResourceRepo; + + @Autowired + private AllottedResourceCustomizationRepository allottedCustomizationRepo; + + @Autowired + private ToscaCsarRepository toscaCsarRepo; + + @Autowired + private VFModuleRepository vfModuleRepo; + + @Autowired + private VnfRecipeRepository vnfRecipeRepo; + + @Autowired + private NetworkRecipeRepository networkRecipeRepo; + + @Autowired + private ArRecipeRepository arRecipeRepo; + + @Autowired + private VnfResourceRepository vnfResourceRepo; + + @Autowired + private AllottedResourceRepository arResourceRepo; + + private static final String NO_MATCHING_PARAMETERS = "no matching parameters"; + + public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { + return Response + .status(respStatus) + //.entity(new GenericEntity(qryResp) {}) + .entity(qryResp.toJsonString(version, isArray)) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } + + @GET + @Path("vnfResources/{vnfModelCustomizationUuid}") + @Transactional( readOnly = true) + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceVnfs ( + @PathParam("version") String version, + @PathParam("vnfModelCustomizationUuid") String vnfUuid + ) { + return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null); + } + + @GET + @Path("serviceVnfs") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceVnfs( + @PathParam("version") String version, + @QueryParam("vnfModelCustomizationUuid") String vnfUuid, + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer, + @QueryParam("serviceModelName") String smName + ) { + return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName); + } + + public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String serviceModelUUID, String smiUuid, String smVer, String smName) { + QueryServiceVnfs qryResp = null; + int respStatus = HttpStatus.SC_OK; + List ret = new ArrayList<>(); + Service service = null; + try { + if (vnfUuid != null && !"".equals(vnfUuid)) + ret = vnfCustomizationRepo.findByModelCustomizationUUID(vnfUuid); + else if (serviceModelUUID != null && !"".equals(serviceModelUUID)) + service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID); + else if (smiUuid != null && !"".equals(smiUuid)) + if (smVer != null && !"".equals(smVer)) + service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid); + else + service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid); + else if (smName != null && !"".equals(smName)) { + if (smVer != null && !"".equals(smVer)) + service = serviceRepo.findByModelNameAndModelVersion(smName, smVer); + else + service = serviceRepo.findFirstByModelNameOrderByModelVersionDesc(smName); + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if (service == null && ret.isEmpty()) { + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceVnfs(); + }else if( service == null && !ret.isEmpty()){ + qryResp = new QueryServiceVnfs(ret); + } else if (service != null) { + qryResp = new QueryServiceVnfs(service.getVnfCustomizations()); + } + LOGGER.debug ("serviceVnfs qryResp="+ qryResp); + return respond(version, respStatus, isArray, qryResp); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, "", "", "queryServiceVnfs", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceVnfs", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + + @GET + @Path("networkResources/{networkModelCustomizationUuid}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceNetworks ( + @PathParam("version") String version, + @PathParam("networkModelCustomizationUuid") String nUuid + ) { + return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null); + } + + @GET + @Path("serviceNetworks") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceNetworks ( + @PathParam("version") String version, + @QueryParam("networkModelCustomizationUuid") String networkModelCustomizationUuid, + @QueryParam("networkType") String networkType, + @QueryParam("networkModelName") String networkModelName, + @QueryParam("serviceModelUuid") String serviceModelUuid, + @QueryParam("serviceModelInvariantUuid") String serviceModelInvariantUuid, + @QueryParam("serviceModelVersion") String serviceModelVersion, + @QueryParam("networkModelVersion") String networkModelVersion + ) { + if (networkModelName != null && !"".equals(networkModelName)) { + networkType = networkModelName; + } + return serviceNetworksImpl (version, IS_ARRAY, networkModelCustomizationUuid, networkType, serviceModelUuid, serviceModelInvariantUuid, serviceModelVersion); + } + + public Response serviceNetworksImpl (String version, boolean isArray, String networkModelCustomizationUuid, String networkType, String serviceModelUuid, String serviceModelInvariantUuid, String serviceModelVersion) { + QueryServiceNetworks qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List ret = new ArrayList<>(); + Service service = null; + + try{ + if (networkModelCustomizationUuid != null && !"".equals(networkModelCustomizationUuid)) { + uuid = networkModelCustomizationUuid; + ret = networkCustomizationRepo.findByModelCustomizationUUID(networkModelCustomizationUuid); + }else if (networkType != null && !"".equals(networkType)) { + uuid = networkType; + NetworkResource networkResources = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType); + if(networkResources != null) + ret=networkResources.getNetworkResourceCustomization(); + } + else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) { + uuid = serviceModelInvariantUuid; + if (serviceModelVersion != null && !"".equals(serviceModelVersion)) { + service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid); + } + else { + service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); + } + }else if (serviceModelUuid != null && !"".equals(serviceModelUuid)) { + uuid = serviceModelUuid; + service = serviceRepo.findOneByModelUUID(serviceModelUuid); + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if(service != null) + ret = service.getNetworkCustomizations(); + + if (ret == null || ret.isEmpty()) { + LOGGER.debug ("serviceNetworks not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceNetworks(); + } else { + LOGGER.debug ("serviceNetworks found"); + qryResp = new QueryServiceNetworks(ret); + LOGGER.debug ("serviceNetworks qryResp="+ qryResp); + } + LOGGER.debug ("Query serviceNetworks exit"); + return respond(version, respStatus, isArray, qryResp); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceNetworks", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceNetworks", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + + @GET + @Path("serviceResources") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional(readOnly = true) + public Response serviceResources( + @PathParam("version") String version, + @QueryParam("serviceModelUuid") String modelUUID, + @QueryParam("serviceModelInvariantUuid") String modelInvariantUUID, + @QueryParam("serviceModelVersion") String modelVersion) { + QueryServiceMacroHolder qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + ServiceMacroHolder ret = new ServiceMacroHolder(); + + try{ + if (modelUUID != null && !"".equals(modelUUID)) { + uuid = modelUUID; + LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: " + uuid); + Service serv =serviceRepo.findOneByModelUUID(uuid); + ret.setService(serv); + } + else if (modelInvariantUUID != null && !"".equals(modelInvariantUUID)) { + uuid = modelInvariantUUID; + if (modelVersion != null && !"".equals(modelVersion)) { + LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ modelVersion); + Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid); + ret.setService(serv); + } + else { + LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid); + Service serv = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); + ret.setService(serv); + } + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if (ret.getService() == null) { + LOGGER.debug ("serviceMacroHolder not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryServiceMacroHolder(); + } else { + LOGGER.debug ("serviceMacroHolder found"); + qryResp = new QueryServiceMacroHolder(ret); + LOGGER.debug ("serviceMacroHolder qryResp="+ qryResp); + } + LOGGER.debug ("Query serviceMacroHolder exit"); + return respond(version, respStatus, IS_ARRAY, qryResp); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceMacroHolder", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceMacroHolder", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp){} ) + .build(); + } + } + + + @GET + @Path("allottedResources/{arModelCustomizationUuid}") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceAllottedResources ( + @PathParam("version") String version, + @PathParam("arModelCustomizationUuid") String aUuid + ) { + return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null); + } + + @GET + @Path("serviceAllottedResources") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response serviceAllottedResources( + @PathParam("version") String version, + @QueryParam("serviceModelUuid") String smUuid, + @QueryParam("serviceModelInvariantUuid") String smiUuid, + @QueryParam("serviceModelVersion") String smVer, + @QueryParam("arModelCustomizationUuid") String aUuid + ) { + return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer); + } + + public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String serviceModelInvariantUuid, String smVer) { + QueryAllottedResourceCustomization qryResp; + int respStatus = HttpStatus.SC_OK; + String uuid = ""; + List ret = new ArrayList<>(); + Service service = null; + try{ + if (smUuid != null && !"".equals(smUuid)) { + uuid = smUuid; + service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(uuid); + } + else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) { + uuid = serviceModelInvariantUuid; + if (smVer != null && !"".equals(smVer)) { + service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid); + } + else { + service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid); + } + } + else if (aUuid != null && !"".equals(aUuid)) { + uuid = aUuid; + ret = allottedCustomizationRepo.findByModelCustomizationUUID(uuid); + } + else { + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if(service != null) + ret=service.getAllottedCustomizations(); + + if (ret == null || ret.isEmpty()) { + LOGGER.debug ("AllottedResourceCustomization not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryAllottedResourceCustomization(); + } else { + qryResp = new QueryAllottedResourceCustomization(ret); + LOGGER.debug ("AllottedResourceCustomization qryResp="+ qryResp); + } + return respond(version, respStatus, isArray, qryResp); + } catch (Exception e) { + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryAllottedResourceCustomization", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryAllottedResourceCustomization", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + + @GET + @Path("vfModules") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + @Transactional( readOnly = true) + public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) { + QueryVfModule qryResp; + int respStatus = HttpStatus.SC_OK; + List ret = null; + try{ + if(vfModuleModelName != null && !"".equals(vfModuleModelName)){ + VfModule vfModule = vfModuleRepo.findFirstByModelNameOrderByModelVersionDesc(vfModuleModelName); + if(vfModule != null) + ret = vfModule.getVfModuleCustomization(); + }else{ + throw(new Exception(NO_MATCHING_PARAMETERS)); + } + + if(ret == null || ret.isEmpty()){ + LOGGER.debug ("vfModules not found"); + respStatus = HttpStatus.SC_NOT_FOUND; + qryResp = new QueryVfModule(); + }else{ + qryResp = new QueryVfModule(ret); + LOGGER.debug ("vfModules tojsonstring is: "+ qryResp.JSON2(false, false)); + } + return Response + .status(respStatus) + .entity(qryResp.JSON2(false, false)) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + }catch(Exception e){ + LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleModelName, "", "queryVfModules", MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query VfModules by vfModuleModuleName: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) {}) + .build(); + } + } + /** + * Get the tosca csar info from catalog + *
+ * + * @param smUuid service model uuid + * @return the tosca csar information of the serivce. + * @since ONAP Beijing Release + */ + @GET + @Path("serviceToscaCsar") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) { + int respStatus = HttpStatus.SC_OK; + String entity = ""; + try { + if (smUuid != null && !"".equals(smUuid)) { + LOGGER.debug("Query Csar by service model uuid: " + smUuid); + ToscaCsar toscaCsar = toscaCsarRepo.findOne(smUuid); + if (toscaCsar != null) { + QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); + entity = serviceCsar.JSON2(false, false); + } else { + respStatus = HttpStatus.SC_NOT_FOUND; + } + } else { + throw (new Exception("Incoming parameter is null or blank")); + } + LOGGER.debug("Query Csar exit"); + return Response + .status(respStatus) + .entity(entity) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, smUuid, "", "ServiceToscaCsar", + MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query csar by service model uuid: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), + CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) { + }) + .build(); + } + } + + /** + * Get the resource recipe info from catalog + *
+ * + * @param rmUuid resource model uuid + * @return the recipe information of the resource. + * @since ONAP Beijing Release + */ + @GET + @Path("resourceRecipe") + @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) + public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) { + int respStatus = HttpStatus.SC_OK; + String entity = ""; + try { + if (rmUuid != null && !"".equals(rmUuid)) { + LOGGER.debug("Query recipe by resource model uuid: " + rmUuid); + //check vnf and network and ar, the resource could be any resource. + VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid); + Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action); + if (null == recipe) { + NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid); + recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action); + } + if (null == recipe) { + AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid); + recipe = arRecipeRepo.findByModelNameAndAction(arResource.getModelName(), action); + } + if (recipe != null) { + QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); + entity = resourceRecipe.JSON2(false, false); + } else { + respStatus = HttpStatus.SC_NOT_FOUND; + } + } else { + throw (new Exception("Incoming parameter is null or blank")); + } + LOGGER.debug("Query recipe exit"); + return Response + .status(respStatus) + .entity(entity) + .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .build(); + } catch (Exception e) { + LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", + MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e); + CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), + CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); + return Response + .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) + .entity(new GenericEntity(excResp) { + }) + .build(); + } + } +} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java new file mode 100644 index 0000000000..8f75008aef --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/package-info.java @@ -0,0 +1,28 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +/** + * + */ +/** + * + * + */ + +package org.onap.so.adapters.catalogdb.rest; diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java deleted file mode 100644 index c1c5aee8f1..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/CatalogDbAdapterRest.java +++ /dev/null @@ -1,573 +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.openecomp.mso.adapters.catalogdb; - -/* -Create an initial query to retrieve a VNF Resource definition (including a list of possible module types) -within the context of a given service. Input is a vnf resource model customization ID (new field for 1702), -or a composite key (from 1610) of service name, service version, vnf instance name - -Returns a structure (JSON?) containing VNF RESOURCE attributes, plus a list of VF Module structures. - -Query a NETWORK_RESOURCE from the MSO Catalog, based on a networkModelCustomizationUUID (new for 1702), -a network type (unique type identifier in 1610), or based on network role within a service. - -Create Adapter framework for access to Catalog DB, including connection management, -login/password access, transaction logic, etc. This can be modeled after the Request DB Adapter - -Update the MSO Catalog DB schema to include the new fields defined in this user story. - -Note that the resourceModelCustomizationUUID (or vfModuleModelCustomizationUUID) will be unique keys (indexes) -on the VNF_RESOURCE and VF_MODULE tables respectively. -The previously constructed "vnf-type" and "vf-module-type" field may continue to be populated, -but should no longer be needed and can deprecate in future release. - -For migration, a new randomly generated UUID field may be generated for the *ModelCustomizationUUID" fields -until such time that the model is redistributed from ASDC. - -All other fields Check with Mike Z for appropriate value for the vfModuleLabel. -We might be able to derive it's value from the current vnf-type (using the "middle" piece that identifies the module type). - -min and initial counts can be 0. max can be null to indicate no maximum. - -Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table. -*/ - -import java.util.ArrayList; -import java.util.List; - -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -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.GenericEntity; -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.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQuery; -import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryException; -import org.openecomp.mso.adapters.catalogdb.catalogrest.CatalogQueryExceptionCategory; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryAllottedResourceCustomization; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryResourceRecipe; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceCsar; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceMacroHolder; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceNetworks; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryServiceVnfs; -import org.openecomp.mso.adapters.catalogdb.catalogrest.QueryVfModule; -import org.openecomp.mso.db.catalog.CatalogDatabase; -import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; -import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; -import org.openecomp.mso.db.catalog.beans.Recipe; -import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; -import org.openecomp.mso.db.catalog.beans.ToscaCsar; -import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; -import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; -import org.openecomp.mso.logger.MessageEnum; -import org.openecomp.mso.logger.MsoLogger; - -/** - * This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1) - * Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default. - * Requests respond synchronously only - */ -@Path("/{version: v[0-9]+}") -public class CatalogDbAdapterRest { - private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private static final boolean IS_ARRAY = true; - - public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { - return Response - .status(respStatus) - //.entity(new GenericEntity(qryResp) {}) - .entity(qryResp.toJsonString(version, isArray)) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } - - @HEAD - @GET - @Path("healthcheck") - @Produces(MediaType.TEXT_HTML) - public Response healthcheck ( - @PathParam("version") String version - ) { - String CHECK_HTML = "Health CheckApplication "+ version+ " ready"; - return Response.ok().entity(CHECK_HTML).build(); - } - - @GET - @Path("vnfResources/{vnfModelCustomizationUuid}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceVnfs ( - @PathParam("version") String version, - @PathParam("vnfModelCustomizationUuid") String vnfUuid - ) { - return serviceVnfsImpl (version, !IS_ARRAY, vnfUuid, null, null, null, null); - } - - @GET - @Path("serviceVnfs") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceVnfs( - @PathParam("version") String version, - @QueryParam("vnfModelCustomizationUuid") String vnfUuid, - @QueryParam("serviceModelUuid") String smUuid, - @QueryParam("serviceModelInvariantUuid") String smiUuid, - @QueryParam("serviceModelVersion") String smVer, - @QueryParam("serviceModelName") String smName - ) { - return serviceVnfsImpl (version, IS_ARRAY, vnfUuid, smUuid, smiUuid, smVer, smName); - } - - public Response serviceVnfsImpl(String version, boolean isArray, String vnfUuid, String smUuid, String smiUuid, String smVer, String smName) { - QueryServiceVnfs qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - List ret; - - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (vnfUuid != null && !"".equals(vnfUuid)) { - uuid = vnfUuid; - LOGGER.debug ("Query serviceVnfs getAllVnfsByVnfModelCustomizationUuid vnfModelCustomizationUuid: " + uuid); - ret = db.getAllVnfsByVnfModelCustomizationUuid(uuid); - } - else if (smUuid != null && !"".equals(smUuid)) { - uuid = smUuid; - LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceModelUuid serviceModelUuid: " + uuid); - ret = db.getAllVnfsByServiceModelUuid(uuid); - } - else if (smiUuid != null && !"".equals(smiUuid)) { - uuid = smiUuid; - if (smVer != null && !"".equals(smVer)) { - LOGGER.debug ("Query serviceVnfs getAllNetworksByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); - ret = db.getAllVnfsByServiceModelInvariantUuid(uuid, smVer); - } - else { - LOGGER.debug ("Query serviceVnfs getAllNetworksByServiceModelInvariantUuid serviceModelUuid: " + uuid); - ret = db.getAllVnfsByServiceModelInvariantUuid(uuid); - } - } - else if (smName != null && !"".equals(smName)) { - if (smVer != null && !"".equals(smVer)) { - LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceName serviceModelInvariantName: " + smName+ " serviceModelVersion: "+ smVer); - ret = db.getAllVnfsByServiceName(smName, smVer); - } - else { - LOGGER.debug ("Query serviceVnfs getAllVnfsByServiceName serviceModelName: " + smName); - ret = db.getAllVnfsByServiceName(smName); - } - } - else { - throw(new Exception("no matching parameters")); - } - - if (ret == null || ret.isEmpty()) { - LOGGER.debug ("serviceVnfs not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryServiceVnfs(); - } else { - LOGGER.debug ("serviceVnfs found"); - qryResp = new QueryServiceVnfs(ret); - LOGGER.debug ("serviceVnfs qryResp="+ qryResp); - } - LOGGER.debug ("Query serviceVnfs exit"); - return respond(version, respStatus, isArray, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceVnfs", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceVnfs", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) {}) - .build(); - } - } - - @GET - @Path("networkResources/{networkModelCustomizationUuid}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceNetworks ( - @PathParam("version") String version, - @PathParam("networkModelCustomizationUuid") String nUuid - ) { - return serviceNetworksImpl (version, !IS_ARRAY, nUuid, null, null, null, null); - } - - @GET - @Path("serviceNetworks") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceNetworks ( - @PathParam("version") String version, - @QueryParam("networkModelCustomizationUuid") String nUuid, - @QueryParam("networkType") String nType, - @QueryParam("networkModelName") String nModelName, - @QueryParam("serviceModelUuid") String smUuid, - @QueryParam("serviceModelInvariantUuid") String smiUuid, - @QueryParam("serviceModelVersion") String smVer, - @QueryParam("networkModelVersion") String nmVer - ) { - if (nModelName != null && !"".equals(nModelName)) { - nType = nModelName; - } - return serviceNetworksImpl (version, IS_ARRAY, nUuid, nType, smUuid, smiUuid, smVer); - } - - public Response serviceNetworksImpl (String version, boolean isArray, String nUuid, String nType, String smUuid, String smiUuid, String smVer) { - QueryServiceNetworks qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - List ret; - - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (nUuid != null && !"".equals(nUuid)) { - uuid = nUuid; - LOGGER.debug ("Query serviceNetworks getAllNetworksByNetworkModelCustomizationUuid networkModelCustomizationUuid: " + uuid); - ret = db.getAllNetworksByNetworkModelCustomizationUuid(uuid); - } - else if (smUuid != null && !"".equals(smUuid)) { - uuid = smUuid; - LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelUuid serviceModelUuid: " + uuid); - ret = db.getAllNetworksByServiceModelUuid(uuid); - } - else if (nType != null && !"".equals(nType)) { - uuid = nType; - LOGGER.debug ("Query serviceNetworks getAllNetworksByNetworkType serviceModelUuid: " + uuid); - ret = db.getAllNetworksByNetworkType(uuid); - } - else if (smiUuid != null && !"".equals(smiUuid)) { - uuid = smiUuid; - if (smVer != null && !"".equals(smVer)) { - LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); - ret = db.getAllNetworksByServiceModelInvariantUuid(uuid, smVer); - } - else { - LOGGER.debug ("Query serviceNetworks getAllNetworksByServiceModelInvariantUuid serviceModelUuid: " + uuid); - ret = db.getAllNetworksByServiceModelInvariantUuid(uuid); - } - } - else { - throw(new Exception("no matching parameters")); - } - - if (ret == null || ret.isEmpty()) { - LOGGER.debug ("serviceNetworks not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryServiceNetworks(); - } else { - LOGGER.debug ("serviceNetworks found"); - qryResp = new QueryServiceNetworks(ret); - LOGGER.debug ("serviceNetworks qryResp="+ qryResp); - } - LOGGER.debug ("Query serviceNetworks exit"); - return respond(version, respStatus, isArray, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceNetworks", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceNetworks", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) {}) - .build(); - } - } - - @GET - @Path("serviceResources") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceResources( - @PathParam("version") String version, - @QueryParam("serviceModelUuid") String smUuid, - @QueryParam("serviceModelInvariantUuid") String smiUuid, - @QueryParam("serviceModelVersion") String smVer) { - QueryServiceMacroHolder qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - ServiceMacroHolder ret; - - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (smUuid != null && !"".equals(smUuid)) { - uuid = smUuid; - LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelUuid serviceModelUuid: " + uuid); - ret = db.getAllResourcesByServiceModelUuid(uuid); - } - else if (smiUuid != null && !"".equals(smiUuid)) { - uuid = smiUuid; - if (smVer != null && !"".equals(smVer)) { - LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); - ret = db.getAllResourcesByServiceModelInvariantUuid(uuid, smVer); - } - else { - LOGGER.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid); - ret = db.getAllResourcesByServiceModelInvariantUuid(uuid); - } - } - else { - throw(new Exception("no matching parameters")); - } - - if (ret == null) { - LOGGER.debug ("serviceMacroHolder not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryServiceMacroHolder(); - } else { - LOGGER.debug ("serviceMacroHolder found"); - qryResp = new QueryServiceMacroHolder(ret); - LOGGER.debug ("serviceMacroHolder qryResp="+ qryResp); - } - LOGGER.debug ("Query serviceMacroHolder exit"); - return respond(version, respStatus, IS_ARRAY, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryServiceMacroHolder", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryServiceMacroHolder", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) {}) - .build(); - } - } - - @GET - @Path("allottedResources/{arModelCustomizationUuid}") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceAllottedResources ( - @PathParam("version") String version, - @PathParam("arModelCustomizationUuid") String aUuid - ) { - return serviceAllottedResourcesImpl(version, !IS_ARRAY, aUuid, null, null, null); - } - - @GET - @Path("serviceAllottedResources") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceAllottedResources( - @PathParam("version") String version, - @QueryParam("serviceModelUuid") String smUuid, - @QueryParam("serviceModelInvariantUuid") String smiUuid, - @QueryParam("serviceModelVersion") String smVer, - @QueryParam("arModelCustomizationUuid") String aUuid - ) { - return serviceAllottedResourcesImpl(version, IS_ARRAY, aUuid, smUuid, smiUuid, smVer); - } - - public Response serviceAllottedResourcesImpl(String version, boolean isArray, String aUuid, String smUuid, String smiUuid, String smVer) { - QueryAllottedResourceCustomization qryResp; - int respStatus = HttpStatus.SC_OK; - String uuid = ""; - List ret; - - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (smUuid != null && !"".equals(smUuid)) { - uuid = smUuid; - LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelUuid serviceModelUuid: " + uuid); - ret = db.getAllAllottedResourcesByServiceModelUuid(uuid); - } - else if (smiUuid != null && !"".equals(smiUuid)) { - uuid = smiUuid; - if (smVer != null && !"".equals(smVer)) { - LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: " + uuid+ " serviceModelVersion: "+ smVer); - ret = db.getAllAllottedResourcesByServiceModelInvariantUuid(uuid, smVer); - } - else { - LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByServiceModelInvariantUuid serviceModelUuid: " + uuid); - ret = db.getAllAllottedResourcesByServiceModelInvariantUuid(uuid); - } - } - else if (aUuid != null && !"".equals(aUuid)) { - uuid = aUuid; - LOGGER.debug ("Query AllottedResourceCustomization getAllAllottedResourcesByArModelCustomizationUuid serviceModelUuid: " + uuid); - ret = db.getAllAllottedResourcesByArModelCustomizationUuid(uuid); - } - else { - throw(new Exception("no matching parameters")); - } - - if (ret == null || ret.isEmpty()) { - LOGGER.debug ("AllottedResourceCustomization not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryAllottedResourceCustomization(); - } else { - LOGGER.debug ("AllottedResourceCustomization found"); - qryResp = new QueryAllottedResourceCustomization(ret); - LOGGER.debug ("AllottedResourceCustomization qryResp="+ qryResp); - } - LOGGER.debug ("Query AllottedResourceCustomization exit"); - return respond(version, respStatus, isArray, qryResp); - } catch (Exception e) { - LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, uuid, "", "queryAllottedResourceCustomization", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - queryAllottedResourceCustomization", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) {}) - .build(); - } - } - - // Added for DHV in 1702. Might be a temporary solution! - // Changing to use QueryVfModule so the modelCustomizationUuid is included in response - @GET - @Path("vfModules") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response vfModules(@QueryParam("vfModuleModelName") String vfModuleModelName) { - QueryVfModule qryResp; - int respStatus = HttpStatus.SC_OK; - List ret = null; - - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (vfModuleModelName != null && !"".equals(vfModuleModelName)) { - LOGGER.debug("Query vfModules by vfModuleModuleName: " + vfModuleModelName); - VfModuleCustomization vfModule = db.getVfModuleCustomizationByModelName(vfModuleModelName); - if (vfModule != null) { - ret = new ArrayList<>(1); - ret.add(vfModule); - } - } else { - throw (new Exception("Incoming parameter is null or blank")); - } - if (ret == null || ret.isEmpty()) { - LOGGER.debug("vfModules not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - qryResp = new QueryVfModule(); - } else { - LOGGER.debug("vfModules found"); - qryResp = new QueryVfModule(ret); - LOGGER.debug("vfModules query Results is: " + qryResp); - LOGGER.debug("vfModules tojsonstring is: " + qryResp.JSON2(false, false)); - } - LOGGER.debug("Query vfModules exit"); - return Response - .status(respStatus) - .entity(qryResp.JSON2(false, false)) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, vfModuleModelName, "", "queryVfModules", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query VfModules by vfModuleModuleName: ", - e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), - CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) { - }) - .build(); - } - } - - /** - * Get the tosca csar info from catalog - *
- * - * @param smUuid service model uuid - * @return the tosca csar information of the serivce. - * @since ONAP Beijing Release - */ - @GET - @Path("serviceToscaCsar") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response serviceToscaCsar(@QueryParam("serviceModelUuid") String smUuid) { - int respStatus = HttpStatus.SC_OK; - String entity = ""; - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (smUuid != null && !"".equals(smUuid)) { - LOGGER.debug("Query Csar by service model uuid: " + smUuid); - ToscaCsar toscaCsar = db.getToscaCsarByServiceModelUUID(smUuid); - if (toscaCsar != null) { - QueryServiceCsar serviceCsar = new QueryServiceCsar(toscaCsar); - entity = serviceCsar.JSON2(false, false); - } else { - respStatus = HttpStatus.SC_NOT_FOUND; - } - } else { - throw (new Exception("Incoming parameter is null or blank")); - } - LOGGER.debug("Query Csar exit"); - return Response - .status(respStatus) - .entity(entity) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, smUuid, "", "ServiceToscaCsar", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query csar by service model uuid: ", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), - CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) { - }) - .build(); - } - } - - /** - * Get the resource recipe info from catalog - *
- * - * @param rmUuid resource model uuid - * @return the recipe information of the resource. - * @since ONAP Beijing Release - */ - @GET - @Path("resourceRecipe") - @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) - public Response resourceRecipe(@QueryParam("resourceModelUuid") String rmUuid, @QueryParam("action") String action) { - int respStatus = HttpStatus.SC_OK; - String entity = ""; - try (CatalogDatabase db = CatalogDatabase.getInstance()) { - if (rmUuid != null && !"".equals(rmUuid)) { - LOGGER.debug("Query recipe by resource model uuid: " + rmUuid); - //check vnf and network and ar, the resource could be any resource. - Recipe recipe = db.getVnfRecipeByModuleUuid(rmUuid, action); - if (null == recipe) { - recipe = db.getNetworkRecipeByModuleUuid(rmUuid, action); - } - if (null == recipe) { - recipe = db.getArRecipeByModuleUuid(rmUuid, action); - } - if (recipe != null) { - QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); - entity = resourceRecipe.JSON2(false, false); - } else { - respStatus = HttpStatus.SC_NOT_FOUND; - } - } else { - throw (new Exception("Incoming parameter is null or blank")); - } - LOGGER.debug("Query recipe exit"); - return Response - .status(respStatus) - .entity(entity) - .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .build(); - } catch (Exception e) { - LOGGER.error(MessageEnum.RA_QUERY_VNF_ERR, rmUuid, "", "resourceRecipe", - MsoLogger.ErrorCode.BusinessProcesssError, "Exception during query recipe by resource model uuid: ", e); - CatalogQueryException excResp = new CatalogQueryException(e.getMessage(), - CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null); - return Response - .status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity(excResp) { - }) - .build(); - } - } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java deleted file mode 100644 index 10d76f145b..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQuery.java +++ /dev/null @@ -1,92 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import org.openecomp.mso.logger.MsoLogger; -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public abstract class CatalogQuery { - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - private static final boolean IS_EMBED = true; - - public abstract String JSON2(boolean isArray, boolean isEmbed); - - protected void put(Map valueMap, String key, String value) { - valueMap.put(key, value == null? "null": '"'+ value+ '"'); - } - - protected void put(Map valueMap, String key, Integer value) { - valueMap.put(key, value == null? "null": value.toString()); - } - - protected void put(Map valueMap, String key, Boolean value) { - valueMap.put(key, value == null? "null": value? "true": "false"); - } - - protected String setTemplate(String template, Map valueMap) { - LOGGER.debug("CatalogQuery setTemplate"); - StringBuffer result = new StringBuffer(); - - String pattern = "<.*>"; - Pattern r = Pattern.compile(pattern); - Matcher m = r.matcher(template); - - LOGGER.debug("CatalogQuery template:" + template); - while (m.find()) { - String key = template.substring(m.start() + 1, m.end() - 1); - LOGGER.debug("CatalogQuery key:" + key + " contains key? " + valueMap.containsKey(key)); - m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\"")); - } - m.appendTail(result); - LOGGER.debug("CatalogQuery return:" + result.toString()); - return result.toString(); - } - - /** - * The simple, clean, generic way to handle the interface - */ - protected String smartToJSON() { - String jsonString = null; - try { - ObjectMapper mapper = new ObjectMapper(); - jsonString = mapper.writeValueAsString(this); - } - catch (Exception e) { - LOGGER.debug("Exception:", e); - LOGGER.debug ("jsonString exception:"+e.getMessage()); - jsonString = "invalid"; //throws instead? - } - return jsonString; - } - - public String toJsonString(String version, boolean isArray) { - switch(version) { - case "v1": return smartToJSON(); - case "v2": return JSON2(isArray, !IS_EMBED); - default: - return "invalid version: "+ version; - } - } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryException.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryException.java deleted file mode 100644 index a35bc78229..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryException.java +++ /dev/null @@ -1,54 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import javax.xml.bind.annotation.XmlRootElement; -import java.io.Serializable; - -@XmlRootElement(name = "catalogQueryException") -public class CatalogQueryException extends CatalogQueryExceptionCommon implements Serializable { - private static final long serialVersionUID = -9062290006520066109L; - - private String message; - private CatalogQueryExceptionCategory category; - private Boolean rolledBack; - - public CatalogQueryException () {} - - public CatalogQueryException (String message) { - this.message = message; - } - - public CatalogQueryException (String message, CatalogQueryExceptionCategory category, boolean rolledBack, String messageid) { - super(messageid); - this.message = message; - this.category = category; - this.rolledBack = rolledBack; - } - - public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } - - public CatalogQueryExceptionCategory getCategory () { return category; } - public void setCategory (CatalogQueryExceptionCategory category) { this.category = category; } - - public Boolean getRolledBack() { return rolledBack; } - public void setRolledBack(Boolean rolledBack) { this.rolledBack = rolledBack; } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java deleted file mode 100644 index 2364ccc667..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCategory.java +++ /dev/null @@ -1,22 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -public enum CatalogQueryExceptionCategory { OPENSTACK, IO, INTERNAL, USERDATA } diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java deleted file mode 100644 index a1414e08bd..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java +++ /dev/null @@ -1,67 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import java.io.ByteArrayOutputStream; -import org.openecomp.mso.logger.MsoLogger; - -public abstract class CatalogQueryExceptionCommon { - private String messageId; - protected static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); - - public CatalogQueryExceptionCommon() { messageId = null; } - public CatalogQueryExceptionCommon(String messageId) { this.messageId = messageId; } - - public String getMessageId() { return messageId; } - public void setMessageId(String messageId) { this.messageId = messageId; } - - public String toJsonString() { - try { - String jsonString; - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - jsonString = mapper.writeValueAsString(this); - return jsonString; - } catch (Exception e) { - LOGGER.debug ("Exception:", e); - return ""; - } - } - - public String toXmlString() { - try { - ByteArrayOutputStream bs = new ByteArrayOutputStream(); - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); //pretty print XML - marshaller.marshal(this, bs); - return bs.toString(); - } catch (Exception e) { - LOGGER.debug ("Exception:", e); - return ""; - } - } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java deleted file mode 100644 index b249b58d48..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java +++ /dev/null @@ -1,119 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import org.openecomp.mso.db.catalog.beans.AllottedResourceCustomization; - -import javax.xml.bind.annotation.XmlRootElement; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@XmlRootElement(name = "serviceAllottedResources") -public class QueryAllottedResourceCustomization extends CatalogQuery { - private List allottedResourceCustomization; - private final String template = - "\t{\n"+ -// "\t{ \"allottedResource\" : {\n"+ - "\t\t\"modelInfo\" : {\n"+ - "\t\t\t\"modelName\" : ,\n"+ - "\t\t\t\"modelUuid\" : ,\n"+ - "\t\t\t\"modelInvariantUuid\" : ,\n"+ - "\t\t\t\"modelVersion\" : ,\n"+ - "\t\t\t\"modelCustomizationUuid\" : ,\n"+ - "\t\t\t\"modelInstanceName\" : \n"+ - "\t\t},\n"+ - "\t\t\"toscaNodeType\" : ,\n"+ - "\t\t\"allottedResourceType\" : ,\n"+ - "\t\t\"allottedResourceRole\" : ,\n"+ - "\t\t\"providingServiceModelName\" : ,\n"+ - "\t\t\"providingServiceModelInvariantUuid\" : ,\n"+ - "\t\t\"providingServiceModelUuid\" : ,\n"+ - "\t\t\"nfFunction\" : ,\n"+ - "\t\t\"nfType\" : ,\n"+ - "\t\t\"nfRole\" : ,\n"+ - "\t\t\"nfNamingCode\" : \n"+ - "\t}"; -// "\t}}"; - - public QueryAllottedResourceCustomization() { super(); allottedResourceCustomization = new ArrayList<>(); } - public QueryAllottedResourceCustomization(List vlist) { allottedResourceCustomization = vlist; } - - public List getServiceAllottedResources(){ return this.allottedResourceCustomization; } - public void setServiceAllottedResources(List v) { this.allottedResourceCustomization = v; } - - @Override - public String toString () { - StringBuilder sb = new StringBuilder(); - - boolean first = true; - int i = 1; - for (AllottedResourceCustomization o : allottedResourceCustomization) { - sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; - sb.append(o); - } - return sb.toString(); - } - - @Override - public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"serviceAllottedResources\": ["); - Map valueMap = new HashMap<>(); - String sep = ""; - boolean first = true; - - if (this.allottedResourceCustomization != null) { - for (AllottedResourceCustomization o : allottedResourceCustomization) { - if (first) sb.append("\n"); first = false; - - boolean arNull = o.getAllottedResource() == null ? true : false; - - put(valueMap, "MODEL_NAME", arNull ? null : o.getAllottedResource().getModelName()); - put(valueMap, "MODEL_UUID", arNull ? null : o.getAllottedResource().getModelUuid()); - put(valueMap, "MODEL_INVARIANT_ID", arNull ? null : o.getAllottedResource().getModelInvariantUuid()); - put(valueMap, "MODEL_VERSION", arNull ? null : o.getAllottedResource().getModelVersion()); - put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUuid()); - put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); - put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getAllottedResource().getToscaNodeType()); - put(valueMap, "ALLOTTED_RESOURCE_TYPE", o.getNfType()); - put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getNfRole()); - put(valueMap, "NF_TYPE", o.getNfType()); - put(valueMap, "NF_ROLE", o.getNfRole()); - put(valueMap, "NF_FUNCTION", o.getNfFunction()); - put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode()); - put(valueMap, "PROVIDING_SERVICE_MODEL_INVARIANT_UUID", o.getProvidingServiceModelInvariantUuid()); - put(valueMap, "PROVIDING_SERVICE_MODEL_UUID", o.getProvidingServiceModelUuid()); - put(valueMap, "PROVIDING_SERVICE_MODEL_NAME", o.getProvidingServiceModelName()); - - sb.append(sep).append(this.setTemplate(template, valueMap)); - sep = ",\n"; - } - } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); - return sb.toString(); - } - -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java deleted file mode 100644 index 4d8b65a0c8..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryResourceRecipe.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.adapters.catalogdb.catalogrest; - -import java.util.HashMap; -import java.util.Map; - -import org.openecomp.mso.db.catalog.beans.Recipe; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -/** - * serivce csar query support - *
- *

- *

- * - * @author - * @version ONAP Beijing Release 2018-02-28 - */ -public class QueryResourceRecipe extends CatalogQuery{ - - private Recipe resourceRecipe; - - public QueryResourceRecipe(Recipe resourceRecipe){ - this.resourceRecipe =resourceRecipe; - } - - @Override - public String toString() { - - return resourceRecipe.toString(); - } - - @Override - public String JSON2(boolean isArray, boolean isEmbed) { - - Map valueMap = new HashMap<>(); - valueMap.put("id", null == resourceRecipe ? null :String.valueOf(resourceRecipe.getId())); - valueMap.put("action", null == resourceRecipe ? null :resourceRecipe.getAction()); - valueMap.put("orchestrationUri", null == resourceRecipe ? null : resourceRecipe.getOrchestrationUri()); - valueMap.put("recipeTimeout", null == resourceRecipe ? null : String.valueOf(resourceRecipe.getRecipeTimeout())); - valueMap.put("paramXSD", null == resourceRecipe ? null : resourceRecipe.getParamXSD()); - valueMap.put("description", null == resourceRecipe ? null : resourceRecipe.getDescription()); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false); - String jsonStr = ""; - try { - jsonStr = mapper.writeValueAsString(valueMap); - } catch(JsonProcessingException e) { - LOGGER.error("JsonProcessingException", e); - } - return jsonStr; - } - -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java deleted file mode 100644 index 6b1eb836d9..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceCsar.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 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.openecomp.mso.adapters.catalogdb.catalogrest; - -import java.util.HashMap; -import java.util.Map; - -import org.openecomp.mso.db.catalog.beans.ToscaCsar; - -/** - * serivce csar query support - *
- *

- *

- * - * @author - * @version ONAP Beijing Release 2018-02-28 - */ -public class QueryServiceCsar extends CatalogQuery{ - - private ToscaCsar toscaCsar; - - public QueryServiceCsar(ToscaCsar toscaCsar){ - this.toscaCsar = toscaCsar; - } - - private final String template = - "\t{\n"+ - "\t\t\"artifactUUID\" : ,\n"+ - "\t\t\"name\" : ,\n"+ - "\t\t\"version\" : ,\n"+ - "\t\t\"artifactChecksum\" : ,\n"+ - "\t\t\"url\" : ,\n"+ - "\t\t\"description\" : \n"+ - "\t}"; - - @Override - public String toString() { - - return toscaCsar.toString(); - } - - @Override - public String JSON2(boolean isArray, boolean isEmbed) { - Map valueMap = new HashMap<>(); - put(valueMap, "ARTIFACT_UUID", null == toscaCsar ? null : toscaCsar.getArtifactUUID()); - put(valueMap, "NAME", null == toscaCsar ? null : toscaCsar.getName()); - put(valueMap, "VERSION", null == toscaCsar ? null : toscaCsar.getVersion()); - put(valueMap, "ARTIFACT_CHECK_SUM", null == toscaCsar ? null : toscaCsar.getArtifactChecksum()); - put(valueMap, "URL", null == toscaCsar ? null : toscaCsar.getUrl()); - put(valueMap, "DESCRIPTION", null == toscaCsar ? null : toscaCsar.getDescription()); - return this.setTemplate(template, valueMap); - } - -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java deleted file mode 100644 index e683a9fd8d..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java +++ /dev/null @@ -1,95 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import org.openecomp.mso.db.catalog.beans.Service; -import org.openecomp.mso.db.catalog.beans.ServiceMacroHolder; - -import javax.xml.bind.annotation.XmlRootElement; -import java.util.HashMap; -import java.util.Map; - -@XmlRootElement(name = "serviceResources") -public class QueryServiceMacroHolder extends CatalogQuery { - private ServiceMacroHolder serviceMacroHolder; - private static final String LINE_BEGINNING = "(?m)^"; - private static final String template = - "{ \"serviceResources\" : {\n"+ - "\t\"modelInfo\" : {\n"+ - "\t\t\"modelName\" : ,\n"+ - "\t\t\"modelUuid\" : ,\n"+ - "\t\t\"modelInvariantUuid\" : ,\n"+ - "\t\t\"modelVersion\" : \n"+ - "\t},\n"+ - "\t\"serviceType\" : ,\n"+ - "\t\"serviceRole\" : ,\n"+ - "\t\"environmentContext\" : ,\n"+ - "\t\"workloadContext\" : ,\n"+ - "<_SERVICEVNFS_>,\n"+ - "<_SERVICENETWORKS_>,\n"+ - "<_SERVICEALLOTTEDRESOURCES_>\n"+ - "\t}}"; - - public QueryServiceMacroHolder() { - super(); - serviceMacroHolder = new ServiceMacroHolder(); - } - public QueryServiceMacroHolder(ServiceMacroHolder vlist) { serviceMacroHolder = vlist; } - - public ServiceMacroHolder getServiceResources(){ return this.serviceMacroHolder; } - public void setServiceResources(ServiceMacroHolder v) { this.serviceMacroHolder = v; } - - @Override - public String toString () { return serviceMacroHolder.toString(); } - - @Override - public String JSON2(boolean isArray, boolean x) { - Service service = serviceMacroHolder.getService(); - if (service == null) { - return "\"serviceResources\": null"; - } - - StringBuilder buf = new StringBuilder(); - Map valueMap = new HashMap<>(); - - put(valueMap, "SERVICE_MODEL_NAME", service.getModelName()); //getServiceModelName()); - put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID()); //getServiceModelUuid()); - put(valueMap, "SERVICE_MODEL_INVARIANT_ID", service.getModelInvariantUUID()); //getServiceModelInvariantId()); - put(valueMap, "SERVICE_MODEL_VERSION", service.getVersion()); //getServiceModelVersion()); - put(valueMap, "SERVICE_TYPE", service.getServiceType()); - put(valueMap, "SERVICE_ROLE", service.getServiceRole()); - put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext()); - put(valueMap, "WORKLOAD_CONTEXT", service.getWorkloadContext()); - - String subitem; - subitem = new QueryServiceVnfs(serviceMacroHolder.getVnfResourceCustomizations()).JSON2(true, true); - valueMap.put("_SERVICEVNFS_", subitem.replaceAll(LINE_BEGINNING, "\t")); - - subitem = new QueryServiceNetworks(serviceMacroHolder.getNetworkResourceCustomization()).JSON2(true, true); - valueMap.put("_SERVICENETWORKS_", subitem.replaceAll(LINE_BEGINNING, "\t")); - - subitem = new QueryAllottedResourceCustomization(serviceMacroHolder.getAllottedResourceCustomization()).JSON2(true, true); - valueMap.put("_SERVICEALLOTTEDRESOURCES_", subitem.replaceAll(LINE_BEGINNING, "\t")); - - buf.append(this.setTemplate(template, valueMap)); - return buf.toString(); - } - -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java deleted file mode 100644 index 9795deec54..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceNetworks.java +++ /dev/null @@ -1,113 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import org.openecomp.mso.db.catalog.beans.NetworkResourceCustomization; - -import javax.xml.bind.annotation.XmlRootElement; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@XmlRootElement(name = "serviceNetworks") -public class QueryServiceNetworks extends CatalogQuery { - private List serviceNetworks; - private final String template = - "\t{\n"+ -// "\t{ \"networkResource\" : {\n"+ - "\t\t\"modelInfo\" : {\n"+ - "\t\t\t\"modelName\" : ,\n"+ - "\t\t\t\"modelUuid\" : ,\n"+ - "\t\t\t\"modelInvariantUuid\" : ,\n"+ - "\t\t\t\"modelVersion\" : ,\n"+ - "\t\t\t\"modelCustomizationUuid\" : ,\n"+ - "\t\t\t\"modelInstanceName\" : \n"+ - "\t},\n"+ - "\t\t\"toscaNodeType\" : ,\n"+ - "\t\t\"networkType\" : ,\n"+ - "\t\t\"networkTechnology\" : ,\n"+ - "\t\t\"networkRole\" : ,\n"+ - "\t\t\"networkScope\" : \n"+ - "\t}"; -// "\t}}"; - - public QueryServiceNetworks() { super(); serviceNetworks = new ArrayList<>(); } - public QueryServiceNetworks(List vlist) { - LOGGER.debug ("QueryServiceNetworks:"); - serviceNetworks = new ArrayList<>(); - for (NetworkResourceCustomization o : vlist) { - LOGGER.debug (o.toString()); - serviceNetworks.add(o); - LOGGER.debug ("-------------------"); - } - } - - public List getServiceNetworks(){ return this.serviceNetworks; } - public void setServiceNetworks(List v) { this.serviceNetworks = v; } - - @Override - public String toString () { - StringBuilder sb = new StringBuilder(); - - boolean first = true; - int i = 1; - for (NetworkResourceCustomization o : serviceNetworks) { - sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; - sb.append(o); - } - return sb.toString(); - } - - @Override - public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"serviceNetworks\": ["); - - Map valueMap = new HashMap<>(); - String sep = ""; - boolean first = true; - - for (NetworkResourceCustomization o : serviceNetworks) { - if (first) sb.append("\n"); first = false; - boolean nrNull = o.getNetworkResource() == null ? true : false; - put(valueMap, "MODEL_NAME", nrNull ? null : o.getNetworkResource().getModelName()); - put(valueMap, "MODEL_UUID", nrNull ? null : o.getNetworkResource().getModelUUID()); - put(valueMap, "MODEL_INVARIANT_ID", nrNull ? null : o.getNetworkResource().getModelInvariantUUID()); - put(valueMap, "MODEL_VERSION", nrNull ? null : o.getNetworkResource().getVersion()); - put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUuid()); - put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); - put(valueMap, "TOSCA_NODE_TYPE", nrNull ? null : o.getNetworkResource().getToscaNodeType()); - put(valueMap, "NETWORK_TYPE", o.getNetworkType()); - put(valueMap, "NETWORK_ROLE", o.getNetworkRole()); - put(valueMap, "NETWORK_SCOPE", o.getNetworkScope()); - put(valueMap, "NETWORK_TECHNOLOGY", o.getNetworkTechnology()); - - sb.append(sep).append(this.setTemplate(template, valueMap)); - sep = ",\n"; - } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); - return sb.toString(); - } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java deleted file mode 100644 index 383a106b18..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryServiceVnfs.java +++ /dev/null @@ -1,121 +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.openecomp.mso.adapters.catalogdb.catalogrest; -/* should be called QueryVnfResource.java */ - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.db.catalog.beans.VnfResourceCustomization; - -@XmlRootElement(name = "serviceVnfs") -public class QueryServiceVnfs extends CatalogQuery { - private List serviceVnfs; - private final String template = - "\n"+ - "\t{ \"modelInfo\" : {\n"+ - "\t\t\"modelName\" : ,\n"+ - "\t\t\"modelUuid\" : ,\n"+ - "\t\t\"modelInvariantUuid\" : ,\n"+ - "\t\t\"modelVersion\" : ,\n"+ - "\t\t\"modelCustomizationUuid\" : ,\n"+ - "\t\t\"modelInstanceName\" : \n"+ - "\t\t},\n"+ - "\t\"toscaNodeType\" : ,\n"+ - "\t\"nfFunction\" : ,\n"+ - "\t\"nfType\" : ,\n"+ - "\t\"nfRole\" : ,\n"+ - "\t\"nfNamingCode\" : ,\n"+ - "\t\"multiStageDesign\" : ,\n"+ - "<_VFMODULES_>\n" + - "\t}"; - - public QueryServiceVnfs() { super(); serviceVnfs = new ArrayList<>(); } - public QueryServiceVnfs(List vlist) { - LOGGER.debug ("QueryServiceVnfs:"); - serviceVnfs = new ArrayList<>(); - for (VnfResourceCustomization o : vlist) { - LOGGER.debug ("-- o is a serviceVnfs ----"); - LOGGER.debug (o.toString()); - serviceVnfs.add(o); - LOGGER.debug ("-------------------"); - } - } - - public List getServiceVnfs(){ return this.serviceVnfs; } - public void setServiceVnfs(List v) { this.serviceVnfs = v; } - - @Override - public String toString () { - StringBuilder sb = new StringBuilder(); - - boolean first = true; - int i = 1; - for (VnfResourceCustomization o : serviceVnfs) { - sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; - sb.append(o); - } - return sb.toString(); - } - - @Override - public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"serviceVnfs\": ["); - Map valueMap = new HashMap<>(); - String sep = ""; - boolean first = true; - - for (VnfResourceCustomization o : serviceVnfs) { - if (first) sb.append("\n"); first = false; - - boolean vrNull = o.getVnfResource() == null ? true : false; - - put(valueMap, "MODEL_NAME", vrNull ? null : o.getVnfResource().getModelName()); - put(valueMap, "MODEL_UUID", vrNull ? null : o.getVnfResource().getModelUuid()); - put(valueMap, "MODEL_INVARIANT_ID", vrNull ? null : o.getVnfResource().getModelInvariantId()); - put(valueMap, "MODEL_VERSION", vrNull ? null : o.getVnfResource().getVersion()); - put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUuid()); - put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); - put(valueMap, "TOSCA_NODE_TYPE", vrNull ? null : o.getVnfResource().getToscaNodeType()); - put(valueMap, "NF_FUNCTION", o.getNfFunction()); - put(valueMap, "NF_TYPE", o.getNfType()); - put(valueMap, "NF_ROLE", o.getNfRole()); - put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode()); - put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign()); - - String subitem = new QueryVfModule(vrNull ? null : o.getVfModuleCustomizations()).JSON2(true, true); - valueMap.put("_VFMODULES_", subitem.replaceAll("(?m)^", "\t\t")); - - sb.append(sep).append(this.setTemplate(template, valueMap)); - sep = ",\n"; - } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); - return sb.toString(); - } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java deleted file mode 100644 index 9215c38706..0000000000 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryVfModule.java +++ /dev/null @@ -1,119 +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.openecomp.mso.adapters.catalogdb.catalogrest; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.annotation.XmlRootElement; - -import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; - -@XmlRootElement(name = "vfModules") -public class QueryVfModule extends CatalogQuery { - private List vfModules; - private final String template = - "\t{\n"+ -// "\t{ \"vfModule\" : { \n"+ - "\t\t\"modelInfo\" : { \n"+ - "\t\t\t\"modelName\" : ,\n"+ - "\t\t\t\"modelUuid\" : ,\n"+ - "\t\t\t\"modelInvariantUuid\" : ,\n"+ - "\t\t\t\"modelVersion\" : ,\n"+ - "\t\t\t\"modelCustomizationUuid\" : \n"+ - "\t\t},"+ - "\t\t\"isBase\" : ,\n"+ - "\t\t\"vfModuleLabel\" : ,\n"+ - "\t\t\"initialCount\" : ,\n"+ - "\t\t\"hasVolumeGroup\" : \n"+ - "\t}"; -// "\t}}"; - - public QueryVfModule() { super(); vfModules = new ArrayList<>(); } - public QueryVfModule(List vlist) { - LOGGER.debug ("QueryVfModule:"); - vfModules = new ArrayList<>(); - if (vlist != null) { - for (VfModuleCustomization o : vlist) { - LOGGER.debug ("-- o is a vfModules ----"); - LOGGER.debug (o.toString()); - vfModules.add(o); - LOGGER.debug ("-------------------"); - } - } - } - - public List getVfModule(){ return this.vfModules; } - public void setVfModule(List v) { this.vfModules = v; } - - @Override - public String toString () { - StringBuilder sb = new StringBuilder(); - - boolean first = true; - int i = 1; - for (VfModuleCustomization o : vfModules) { - sb.append(i).append("\t"); - if (!first) sb.append("\n"); first = false; - sb.append(o); - } - return sb.toString(); - } - - @Override - public String JSON2(boolean isArray, boolean isEmbed) { - StringBuilder sb = new StringBuilder(); - if (!isEmbed && isArray) sb.append("{ "); - if (isArray) sb.append("\"vfModules\": ["); - Map valueMap = new HashMap<>(); - String sep = ""; - boolean first = true; - - for (VfModuleCustomization o : vfModules) { - if (first) sb.append("\n"); first = false; - - boolean vfNull = o.getVfModule() == null ? true : false; - boolean hasVolumeGroup = false; - String envt = o.getHeatEnvironmentArtifactUuid(); - if (envt != null && !"".equals(envt)) { - hasVolumeGroup = true; - } - - put(valueMap, "MODEL_NAME", vfNull ? null : o.getVfModule().getModelName()); - put(valueMap, "MODEL_UUID", vfNull ? null : o.getVfModule().getModelUUID()); - put(valueMap, "MODEL_INVARIANT_ID", vfNull ? null : o.getVfModule().getModelInvariantUuid()); - put(valueMap, "MODEL_VERSION", vfNull ? null : o.getVfModule().getVersion()); - put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUuid()); - put(valueMap, "IS_BASE", vfNull ? false : o.getVfModule().isBase() ? true : false); - put(valueMap, "VF_MODULE_LABEL", o.getLabel()); - put(valueMap, "INITIAL_COUNT", o.getInitialCount()); - put(valueMap, "HAS_VOLUME_GROUP", hasVolumeGroup); - - sb.append(sep).append(this.setTemplate(template, valueMap)); - sep = ",\n"; - } - if (!first) sb.append("\n"); - if (isArray) sb.append("]"); - if (!isEmbed && isArray) sb.append("}"); - return sb.toString(); - } -} diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml new file mode 100644 index 0000000000..dbf09a898d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application-local.yaml @@ -0,0 +1,51 @@ +ssl-enable: false +mso: + site-name: localDevEnv + logPath: logs + catalog: + db: + spring: + endpoint: "http://localhost:8090" + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= +# H2 +spring: + datasource: + url: jdbc:mariadb://localhost:3306/catalogdb + username: catalog + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + + jpa: + show-sql: true + hibernate: + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: bpel + password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO' + role: BPEL-Client + - + username: mso_admin + password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' + role: ACTUATOR +server: + port: 8090 + tomcat: + max-threads: 50 + + +#Actuator +management: + context-path: /manage + +flyway: + baseline-on-migrate: true + url: jdbc:mariadb://localhost:3306/catalogdb + user: catalog + password: catalog123 diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml new file mode 100644 index 0000000000..94705861f9 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -0,0 +1,55 @@ +# will be used as entry in DB to say SITE OFF/ON for healthcheck +# MSO Properties go here + +server: + port: 8080 + tomcat: + max-threads: 50 + +mso: + logPath: ./logs/openstack + site-name: localDevEnv + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + +# CatalogDB +spring: + datasource: + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + username: ${DB_USERNAME} + password: ${DB_PASSWORD} + driver-class-name: org.mariadb.jdbc.Driver + dbcp2: + initial-size: 5 + max-total: 20 + validation-query: select 1 + test-on-borrow: true + jpa: + show-sql: true + hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + jackson: + serialization: + fail-on-empty-beans: false +flyway: + baseline-on-migrate: false + url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + user: ${DB_ADMIN_USERNAME} + password: ${DB_ADMIN_PASSWORD} + outOfOrder: true + validateOnMigrate: false + +#Actuator +management: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql new file mode 100644 index 0000000000..0042888117 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1810.1__AddModelAndModelRecipe.sql @@ -0,0 +1,31 @@ +USE catalogdb; + +create table if not exists model_recipe ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_ID` INT(11), + `ACTION` VARCHAR(40), + `SCHEMA_VERSION` VARCHAR(40), + `DESCRIPTION` VARCHAR(40), + `ORCHESTRATION_URI` VARCHAR(20), + `MODEL_PARAM_XSD` VARCHAR(20), + `RECIPE_TIMEOUT` INT(11), + `CREATION_TIMESTAMP` datetime not null default current_timestamp, + PRIMARY KEY (`ID`), + CONSTRAINT uk1_model_recipe UNIQUE (`MODEL_ID`, `ACTION`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +create table if not exists model ( + `ID` INT(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_ID` VARCHAR(40), + `MODEL_CUSTOMIZATION_NAME` VARCHAR(40), + `MODEL_INVARIANT_ID` VARCHAR(40), + `MODEL_NAME` VARCHAR(40), + `MODEL_TYPE` VARCHAR(20), + `MODEL_VERSION` VARCHAR(20), + `MODEL_VERSION_ID` VARCHAR(40), + `CREATION_TIMESTAMP` datetime not null default current_timestamp, + `RECIPE` INT(11), + PRIMARY KEY (`ID`), + CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`), + FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1__Base_version.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1__Base_version.sql new file mode 100644 index 0000000000..d603146d73 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1__Base_version.sql @@ -0,0 +1,343 @@ + +USE `catalogdb`; + +CREATE TABLE `allotted_resource` ( + `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) DEFAULT NULL, + `SUBCATEGORY` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `allotted_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `PROVIDING_SERVICE_MODEL_UUID` varchar(200) DEFAULT NULL, + `PROVIDING_SERVICE_MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `PROVIDING_SERVICE_MODEL_NAME` varchar(200) DEFAULT NULL, + `TARGET_NETWORK_ROLE` varchar(200) DEFAULT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `MIN_INSTANCES` int(11) DEFAULT NULL, + `MAX_INSTANCES` int(11) DEFAULT NULL, + `AR_MODEL_UUID` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_allotted_resource_customization__allotted_resource1_idx` (`AR_MODEL_UUID`), + CONSTRAINT `fk_allotted_resource_customization__allotted_resource1` FOREIGN KEY (`AR_MODEL_UUID`) REFERENCES `allotted_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `heat_environment` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(100) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext NOT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `heat_files` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext NOT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `heat_template` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext NOT NULL, + `TIMEOUT_MINUTES` int(11) DEFAULT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `heat_nested_template` ( + `PARENT_HEAT_TEMPLATE_UUID` varchar(200) NOT NULL, + `CHILD_HEAT_TEMPLATE_UUID` varchar(200) NOT NULL, + `PROVIDER_RESOURCE_FILE` varchar(100) DEFAULT NULL, + PRIMARY KEY (`PARENT_HEAT_TEMPLATE_UUID`,`CHILD_HEAT_TEMPLATE_UUID`), + KEY `fk_heat_nested_template__heat_template2_idx` (`CHILD_HEAT_TEMPLATE_UUID`), + CONSTRAINT `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` FOREIGN KEY (`CHILD_HEAT_TEMPLATE_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` FOREIGN KEY (`PARENT_HEAT_TEMPLATE_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `heat_template_params` ( + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL, + `PARAM_NAME` varchar(100) NOT NULL, + `IS_REQUIRED` bit(1) NOT NULL, + `PARAM_TYPE` varchar(20) DEFAULT NULL, + `PARAM_ALIAS` varchar(45) DEFAULT NULL, + PRIMARY KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`,`PARAM_NAME`), + CONSTRAINT `fk_heat_template_params__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `network_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_NAME` varchar(20) NOT NULL, + `ACTION` varchar(50) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `NETWORK_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `SERVICE_TYPE` varchar(45) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VERSION_STR` varchar(20) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_rl4f296i0p8lyokxveaiwkayi` (`MODEL_NAME`,`ACTION`,`VERSION_STR`) +) ENGINE=InnoDB AUTO_INCREMENT=178 DEFAULT CHARSET=latin1; + +CREATE TABLE `temp_network_heat_template_lookup` ( + `NETWORK_RESOURCE_MODEL_NAME` varchar(200) NOT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL, + `AIC_VERSION_MIN` varchar(20) NOT NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + PRIMARY KEY (`NETWORK_RESOURCE_MODEL_NAME`), + KEY `fk_temp_network_heat_template_lookup__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_temp_network_heat_template_lookup__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `network_resource` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL, + `NEUTRON_NETWORK_TYPE` varchar(20) DEFAULT NULL, + `MODEL_VERSION` varchar(20) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `AIC_VERSION_MIN` varchar(20) NOT NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + `ORCHESTRATION_MODE` varchar(20) DEFAULT 'HEAT', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`), + KEY `fk_network_resource__temp_network_heat_template_lookup1_idx` (`MODEL_NAME`), + KEY `fk_network_resource__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_network_resource__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` FOREIGN KEY (`MODEL_NAME`) REFERENCES `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `network_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NETWORK_TECHNOLOGY` varchar(45) DEFAULT NULL, + `NETWORK_TYPE` varchar(45) DEFAULT NULL, + `NETWORK_ROLE` varchar(200) DEFAULT NULL, + `NETWORK_SCOPE` varchar(45) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `NETWORK_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_network_resource_customization__network_resource1_idx` (`NETWORK_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_network_resource_customization__network_resource1` FOREIGN KEY (`NETWORK_RESOURCE_MODEL_UUID`) REFERENCES `network_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `tosca_csar` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL, + `URL` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `service` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `SERVICE_TYPE` varchar(200) DEFAULT NULL, + `SERVICE_ROLE` varchar(200) DEFAULT NULL, + `ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL, + `WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`), + CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `service_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ACTION` varchar(50) NOT NULL, + `VERSION_STR` varchar(20) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `SERVICE_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `SERVICE_TIMEOUT_INTERIM` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_7fav5dkux2v8g9d2i5ymudlgc` (`SERVICE_MODEL_UUID`,`ACTION`), + KEY `fk_service_recipe__service1_idx` (`SERVICE_MODEL_UUID`), + CONSTRAINT `fk_service_recipe__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1; + +CREATE TABLE `service_to_resource_customizations` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_TYPE` varchar(20) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`,`MODEL_TYPE`), + KEY `fk_service_to_resource_cust__service_model_uuid_idx` (`SERVICE_MODEL_UUID`), + KEY `fk_service_to_resource_cust__resource_model_customiz_uuid_idx` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `fk_service_to_resource_cust__service__model_uuid0` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `vnf_components` ( + `VNF_ID` int(11) NOT NULL, + `COMPONENT_TYPE` varchar(20) NOT NULL, + `HEAT_TEMPLATE_ID` int(11) DEFAULT NULL, + `HEAT_ENVIRONMENT_ID` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`VNF_ID`,`COMPONENT_TYPE`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `vnf_components_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `VNF_TYPE` varchar(200) DEFAULT NULL, + `VNF_COMPONENT_TYPE` varchar(45) NOT NULL, + `ACTION` varchar(50) NOT NULL, + `SERVICE_TYPE` varchar(45) DEFAULT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `VNF_COMPONENT_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP, + `VF_MODULE_MODEL_UUID` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_4dpdwddaaclhc11wxsb7h59ma` (`VF_MODULE_MODEL_UUID`,`VNF_COMPONENT_TYPE`,`ACTION`,`VERSION`) +) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1; + +CREATE TABLE `vnf_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `VNF_TYPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(50) NOT NULL, + `SERVICE_TYPE` varchar(45) DEFAULT NULL, + `VERSION_STR` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `VNF_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP, + `VF_MODULE_ID` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_f3tvqau498vrifq3cr8qnigkr` (`VF_MODULE_ID`,`ACTION`,`VERSION_STR`) +) ENGINE=InnoDB AUTO_INCREMENT=10006 DEFAULT CHARSET=latin1; + +CREATE TABLE `vnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `MODEL_UUID` varchar(200) NOT NULL, + `AIC_VERSION_MIN` varchar(20) DEFAULT NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `fk_vnf_resource__heat_template1` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_vnf_resource__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `vnf_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `MIN_INSTANCES` int(11) DEFAULT NULL, + `MAX_INSTANCES` int(11) DEFAULT NULL, + `AVAILABILITY_ZONE_MAX_COUNT` int(11) DEFAULT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_vnf_resource_customization__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + +CREATE TABLE `vf_module` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `IS_BASE` int(11) NOT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `VOL_HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_UUID`,`VNF_RESOURCE_MODEL_UUID`), + KEY `fk_vf_module__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), + KEY `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + KEY `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_vf_module__heat_template_art_uuid__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module__vol_heat_template_art_uuid__heat_template2` FOREIGN KEY (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `vf_module_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `LABEL` varchar(200) DEFAULT NULL, + `INITIAL_COUNT` int(11) DEFAULT '0', + `MIN_INSTANCES` int(11) DEFAULT '0', + `MAX_INSTANCES` int(11) DEFAULT NULL, + `AVAILABILITY_ZONE_COUNT` int(11) DEFAULT NULL, + `HEAT_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `VOL_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`), + KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`), + KEY `fk_vf_module_customization__vol_env__heat_environment2_idx` (`VOL_ENVIRONMENT_ARTIFACT_UUID`), + CONSTRAINT `fk_vf_module_customization__heat_env__heat_environment1` FOREIGN KEY (`HEAT_ENVIRONMENT_ARTIFACT_UUID`) REFERENCES `heat_environment` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_customization__vf_module1` FOREIGN KEY (`VF_MODULE_MODEL_UUID`) REFERENCES `vf_module` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_customization__vol_env__heat_environment2` FOREIGN KEY (`VOL_ENVIRONMENT_ARTIFACT_UUID`) REFERENCES `heat_environment` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `vf_module_to_heat_files` ( + `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, + `HEAT_FILES_ARTIFACT_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`VF_MODULE_MODEL_UUID`,`HEAT_FILES_ARTIFACT_UUID`), + KEY `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`HEAT_FILES_ARTIFACT_UUID`), + CONSTRAINT `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` FOREIGN KEY (`HEAT_FILES_ARTIFACT_UUID`) REFERENCES `heat_files` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_to_heat_files__vf_module__model_uuid1` FOREIGN KEY (`VF_MODULE_MODEL_UUID`) REFERENCES `vf_module` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='il fait ce qu''il dit'; + + +CREATE TABLE `vnf_res_custom_to_vf_module_custom` ( + `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`,`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `fk_vnf_res_custom_to_vf_module_custom__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_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.0__Modify_Resource_Relationships.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.0__Modify_Resource_Relationships.sql new file mode 100644 index 0000000000..b141784e8d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.0__Modify_Resource_Relationships.sql @@ -0,0 +1,247 @@ + +USE catalogdb; + +DELETE from service where model_uuid in ( SELECT SERVICE_MODEL_UUID +FROM service_to_resource_customizations +GROUP BY +SERVICE_MODEL_UUID, resource_model_customization_uuid +HAVING COUNT(*) > 1); + + +CREATE TABLE IF NOT EXISTS external_service_to_internal_model_mapping ( +id INT(11) NOT NULL, +SERVICE_NAME VARCHAR(200) NOT NULL, +PRODUCT_FLAVOR VARCHAR(200) NULL, +SUBSCRIPTION_SERVICE_TYPE VARCHAR(200) NOT NULL, +SERVICE_MODEL_UUID VARCHAR(200) NOT NULL, +PRIMARY KEY (id), +UNIQUE INDEX UK_external_service_to_internal_model_mapping +(SERVICE_NAME ASC, PRODUCT_FLAVOR ASC, SERVICE_MODEL_UUID ASC)); + +CREATE TABLE IF NOT EXISTS `collection_resource` ( + MODEL_UUID varchar(200) NOT NULL, + MODEL_NAME varchar(200) NOT NULL, + MODEL_INVARIANT_UUID varchar(200) NOT NULL, + MODEL_VERSION varchar(20) NOT NULL, + TOSCA_NODE_TYPE varchar(200) NOT NULL, + DESCRIPTION varchar(200), + CREATION_TIMESTAMP datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `collection_resource_customization` ( + MODEL_CUSTOMIZATION_UUID varchar(200) NOT NULL, + MODEL_INSTANCE_NAME varchar(200) NOT NULL, + ROLE varchar(200) NOT NULL, + PRIMARY_TYPE varchar(200) NOT NULL, + FUNCTION varchar(200) NOT NULL, + SUBINTERFACE_NETWORK_QUANTITY INT, + COLLECTION_RESOURCE_TYPE varchar(200) NOT NULL, + CREATION_TIMESTAMP datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + CR_MODEL_UUID varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `instance_group` ( + MODEL_UUID varchar(200) NOT NULL, + MODEL_NAME varchar(200) NOT NULL, + MODEL_INVARIANT_UUID varchar(200) NOT NULL, + MODEL_VERSION varchar(20) NOT NULL, + TOSCA_NODE_TYPE varchar(200) DEFAULT NULL, + ROLE varchar(200) NOT NULL, + PRIMARY_TYPE varchar(200) NOT NULL, + FUNCTION varchar(200) NOT NULL, + DESCRIPTION varchar(200), + CREATION_TIMESTAMP datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + CR_MODEL_UUID varchar(200) NOT NULL, + INSTANCE_GROUP_TYPE varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + + CREATE TABLE IF NOT EXISTS `catalogdb`.`configuration` + ( `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, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`)) + ENGINE = InnoDB AUTO_INCREMENT = 20654 + DEFAULT CHARACTER SET = latin1; + + CREATE TABLE IF NOT EXISTS `catalogdb`.`service_proxy` ( + `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, + `DESCRIPTION` VARCHAR(1200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`)) + ENGINE = InnoDB AUTO_INCREMENT = 20654 + DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `service_proxy_customization` ( +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, +`SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +`SERVICE_PROXY_MODEL_UUID` VARCHAR(200) NOT NULL, +PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), +INDEX `fk_service_proxy_customization__service_proxy1_idx` (`SERVICE_PROXY_MODEL_UUID` ASC), +INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC), +CONSTRAINT`fk_spr_customization__service_proxy_resource1` +FOREIGN KEY (`SERVICE_PROXY_MODEL_UUID`) REFERENCES `catalogdb`.`service_proxy` (`MODEL_UUID`) +ON DELETE CASCADE ON UPDATE CASCADE, +CONSTRAINT `fk_service_proxy_resource_customization__service1` +FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`) REFERENCES `catalogdb`.`service` +(`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE) +ENGINE = InnoDB +AUTO_INCREMENT = 20654 +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `catalogdb`.`configuration_customization` ( +`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, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +`CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL, +`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NULL, +`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NULL, +PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), +INDEX `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC), +INDEX `fk_configuration_customization__service_proxy_customization_idx` +(`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` ASC), +INDEX `fk_configuration_customization__configuration_customization_idx` +(`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` ASC), +CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` +FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `catalogdb`.`configuration` (`MODEL_UUID`) +ON DELETE CASCADE ON UPDATE CASCADE, +CONSTRAINT `fk_configuration_customization__service_proxy_customization1` FOREIGN +KEY (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES +`catalogdb`.`service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID`) +ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT +`fk_configuration_customization__configuration_customization1` FOREIGN +KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES +`catalogdb`.`configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) +ON DELETE CASCADE ON UPDATE CASCADE) +ENGINE = InnoDB +AUTO_INCREMENT =20654 +DEFAULT CHARACTER SET = latin1; + + +CREATE TABLE `service_proxy_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + + +CREATE TABLE `configuration_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + + +CREATE TABLE IF NOT EXISTS `collection_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + + +CREATE TABLE `network_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `vnf_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `allotted_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + + +CREATE TABLE IF NOT EXISTS `collection_network_resource_customization` ( +`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, +`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, +`NETWORK_TECHNOLOGY` VARCHAR(45) NULL, +`NETWORK_TYPE` VARCHAR(45) NULL, +`NETWORK_ROLE` VARCHAR(200) NULL, +`NETWORK_SCOPE` VARCHAR(45) NULL, +`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +`NETWORK_RESOURCE_MODEL_UUID` VARCHAR(200) NOT NULL, `INSTANCE_GROUP_MODEL_UUID` VARCHAR(200) NULL, +`CRC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY +(`MODEL_CUSTOMIZATION_UUID`, `CRC_MODEL_CUSTOMIZATION_UUID`), +INDEX `fk_collection_net_resource_customization__network_resource1_idx` +(`NETWORK_RESOURCE_MODEL_UUID` ASC), INDEX +`fk_collection_net_resource_customization__instance_group1_idx` +(`INSTANCE_GROUP_MODEL_UUID` ASC), INDEX +`fk_col_net_res_customization__collection_res_customization_idx` +(`CRC_MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT +`fk_collection_net_resource_customization__network_resource10` FOREIGN +KEY (`NETWORK_RESOURCE_MODEL_UUID`) REFERENCES +`catalogdb`.`network_resource` (`MODEL_UUID`) ON DELETE CASCADE ON +UPDATE CASCADE, CONSTRAINT +`fk_collection_net_resource_customization__instance_group10` FOREIGN KEY +(`INSTANCE_GROUP_MODEL_UUID`) REFERENCES `instance_group` +(`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT +`fk_collection_network_resource_customization__collection_reso1` FOREIGN +KEY (`CRC_MODEL_CUSTOMIZATION_UUID`) REFERENCES +`collection_resource_customization` +(`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE += InnoDB DEFAULT CHARACTER SET = latin1; + + +CREATE TABLE IF NOT EXISTS `northbound_request_ref_lookup` ( +`id` INT(11) NOT NULL AUTO_INCREMENT, +`REQUEST_SCOPE` VARCHAR(200) NOT NULL, +`MACRO_ACTION` VARCHAR(200) NOT NULL, +`ACTION` VARCHAR(200) NOT NULL, +`IS_ALACARTE` TINYINT(1) NOT NULL DEFAULT 0, +`MIN_API_VERSION` DOUBLE NOT NULL, +`MAX_API_VERSION` DOUBLE NULL, +PRIMARY KEY (`id`), +UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC, `MACRO_ACTION` ASC)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `orchestration_flow_reference` ( +`id` INT(11) NOT NULL AUTO_INCREMENT, +`COMPOSITE_ACTION` VARCHAR(200) NOT NULL, +`SEQ_NO` INT(11) NOT NULL, +`FLOW_NAME` VARCHAR(200) NOT NULL, +`FLOW_VERSION` DOUBLE NOT NULL, +`NB_REQ_REF_LOOKUP_ID` INT(11) NOT NULL, +PRIMARY KEY (`id`), +INDEX `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID` ASC), +UNIQUE INDEX `UK_orchestration_flow_reference` (`COMPOSITE_ACTION` ASC, `FLOW_NAME` ASC, `SEQ_NO` ASC, `NB_REQ_REF_LOOKUP_ID` ASC), +CONSTRAINT `fk_orchestration_flow_reference__northbound_request_ref_look1` +FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` (`id`) +ON DELETE CASCADE ON UPDATE CASCADE) +ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `rainy_day_handler_macro` ( +`id` INT(11) NOT NULL AUTO_INCREMENT, +`FLOW_NAME` VARCHAR(200) NOT NULL, +`SERVICE_TYPE` VARCHAR(200) NOT NULL, +`VNF_TYPE` VARCHAR(200) NOT NULL, +`ERROR_CODE` VARCHAR(200) NOT NULL, +`WORK_STEP` VARCHAR(200) NOT NULL, +`POLICY` VARCHAR(200) NOT NULL, +PRIMARY KEY (`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.1__Modify_Resource_Relationships_Alters.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.1__Modify_Resource_Relationships_Alters.sql new file mode 100644 index 0000000000..92b5c9b65f --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.0.1__Modify_Resource_Relationships_Alters.sql @@ -0,0 +1,208 @@ + +USE catalogdb; +ALTER TABLE collection_resource_customization +ADD FOREIGN KEY ( CR_MODEL_UUID) +REFERENCES collection_resource(MODEL_UUID) +ON DELETE CASCADE; + +ALTER TABLE vnf_resource_customization +ADD COLUMN +INSTANCE_GROUP_MODEL_UUID varchar(200); + + +ALTER TABLE instance_group +ADD FOREIGN KEY ( CR_MODEL_UUID) +REFERENCES collection_resource(MODEL_UUID) +ON DELETE CASCADE; + + +ALTER TABLE collection_resource_customization_to_service +ADD FOREIGN KEY (service_model_uuid) +REFERENCES service(MODEL_UUID) +ON DELETE CASCADE; + +ALTER TABLE allotted_resource_customization_to_service +ADD FOREIGN KEY (service_model_uuid) +REFERENCES service(MODEL_UUID) +ON DELETE CASCADE; + + +ALTER TABLE vnf_resource_customization_to_service +ADD FOREIGN KEY (service_model_uuid) +REFERENCES service(MODEL_UUID) +ON DELETE CASCADE; + + +ALTER TABLE network_resource_customization_to_service +ADD FOREIGN KEY (service_model_uuid) +REFERENCES service(MODEL_UUID) +ON DELETE CASCADE; + + +ALTER TABLE network_resource_customization_to_service +ADD FOREIGN KEY (resource_model_customization_uuid) +REFERENCES network_resource_customization(model_customization_uuid) +ON DELETE CASCADE; + +ALTER TABLE vnf_resource_customization_to_service +ADD FOREIGN KEY (resource_model_customization_uuid) +REFERENCES vnf_resource_customization(model_customization_uuid) +ON DELETE CASCADE; + +ALTER TABLE allotted_resource_customization_to_service +ADD FOREIGN KEY (resource_model_customization_uuid) +REFERENCES allotted_resource_customization(model_customization_uuid) +ON DELETE CASCADE; + +ALTER TABLE collection_resource_customization_to_service +ADD FOREIGN KEY (resource_model_customization_uuid) +REFERENCES collection_resource_customization(model_customization_uuid) +ON DELETE CASCADE; + +INSERT INTO network_resource_customization_to_service SELECT service_model_uuid,resource_model_customization_uuid +FROM service_to_resource_customizations WHERE model_type = 'network' and service_model_uuid in(select model_uuid from service) +AND resource_model_customization_uuid in ( SELECT MODEL_CUSTOMIZATION_UUID from network_resource_customization); + +INSERT INTO allotted_resource_customization_to_service SELECT service_model_uuid,resource_model_customization_uuid +FROM service_to_resource_customizations WHERE model_type = 'allottedResource' and service_model_uuid in(select model_uuid from service) +AND resource_model_customization_uuid in ( SELECT MODEL_CUSTOMIZATION_UUID from allotted_resource_customization); + +INSERT INTO vnf_resource_customization_to_service SELECT service_model_uuid,resource_model_customization_uuid +FROM service_to_resource_customizations WHERE model_type = 'vnf' and service_model_uuid in(select model_uuid from service) +AND resource_model_customization_uuid in ( SELECT MODEL_CUSTOMIZATION_UUID from vnf_resource_customization); + +DROP TABLE service_to_resource_customizations; + + +INSERT INTO vnf_recipe (VNF_TYPE, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT) +VALUES +('GR-API-DEFAULT', 'createInstance', '1', 'Gr api recipe to create vnf', '/mso/async/services/WorkflowActionBB', 180), +('GR-API-DEFAULT', 'deleteInstance', '1', 'Gr api recipe to delete vnf', '/mso/async/services/WorkflowActionBB', 180), +('GR-API-DEFAULT', 'updateInstance', '1', 'Gr api recipe to update vnf', '/mso/async/services/WorkflowActionBB', 180), +('GR-API-DEFAULT', 'replaceInstance', '1', 'Gr api recipe to replace vnf', '/mso/async/services/WorkflowActionBB', 180), +('GR-API-DEFAULT', 'inPlaceSoftwareUpdate', '1', 'Gr api recipe to do an in place software update', '/mso/async/services/WorkflowActionBB', 180), +('GR-API-DEFAULT', 'applyUpdatedConfig', '1', 'Gr api recipe to apply updated config', '/mso/async/services/WorkflowActionBB', 180); + +UPDATE vnf_recipe +SET vnf_type = 'VNF-API-DEFAULT' +WHERE vnf_type = 'VID_DEFAULT'; + +UPDATE vnf_recipe +SET description = 'Vnf api recipe to create vnf' +WHERE description = 'VID_DEFAULT recipe to create VNF if no custom BPMN flow is found'; + +UPDATE vnf_recipe +SET description = 'Vnf api recipe to delete vnf' +WHERE description = 'VID_DEFAULT recipe to delete VNF if no custom BPMN flow is found'; + +UPDATE vnf_recipe +SET description = 'Vnf api recipe to update vnf' +WHERE description = 'VID_DEFAULT update'; + +UPDATE vnf_recipe +SET description = 'Vnf api recipe to replace vnf' +WHERE description = 'VID_DEFAULT replace'; + +UPDATE vnf_recipe +SET description = 'Vnf api recipe to do an in place software update' +WHERE description = 'VID_DEFAULT inPlaceSoftwareUpdate'; + +UPDATE vnf_recipe +SET description = 'Vnf api recipe to apply updated config' +WHERE description = 'VID_DEFAULT applyUpdatedConfig'; + +INSERT INTO service (MODEL_UUID, MODEL_NAME, MODEL_INVARIANT_UUID, MODEL_VERSION, DESCRIPTION) +VALUES +('DummyGRApiDefaultModelUUID?', 'GR-API-DEFAULT', 'DummyGRApiDefaultModelInvariantUUID?', '1.0', 'Gr api service for VID to use for infra APIH orchestration'); + +UPDATE service +SET model_name = 'VNF-API-DEFAULT', + description = 'Vnf api service for VID to use for infra APIH orchestration' +WHERE model_name = 'VID_DEFAULT'; + +INSERT INTO service_recipe (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID) +VALUES +('activateInstance', '1.0', 'Gr api recipe to activate service-instance', '/mso/async/services/WorkflowActionBB', 180, 'DummyGRApiDefaultModelUUID?'), +('createInstance', '1.0', 'Gr api recipe to create service-instance', '/mso/async/services/WorkflowActionBB', 180, 'DummyGRApiDefaultModelUUID?'), +('deactivateInstance', '1.0', 'Gr api recipe to deactivate service-instance', '/mso/async/services/WorkflowActionBB', 180, 'DummyGRApiDefaultModelUUID?'), +('deleteInstance', '1.0', 'Gr api recipe to delete service-instance', '/mso/async/services/WorkflowActionBB', 180, 'DummyGRApiDefaultModelUUID?'); + +UPDATE service_recipe +SET description = 'Vnf api recipe to activate service-instance' +WHERE description = 'VID_DEFAULT activate'; + +UPDATE service_recipe +SET description = 'Vnf api recipe to create service-instance' +WHERE description = 'VID_DEFAULT recipe to create service-instance if no custom BPMN flow is found'; + +UPDATE service_recipe +SET description = 'Vnf api recipe to deactivate service-instance' +WHERE description = 'VID_DEFAULT deactivate'; + +UPDATE service_recipe +SET description = 'Vnf api recipe to delete service-instance' +WHERE description = 'VID_DEFAULT recipe to delete service-instance if no custom BPMN flow is found'; + +INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID) +VALUES +('volumeGroup', 'createInstance', '1', 'Gr api recipe to create volume-group', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('volumeGroup', 'deleteInstance', '1', 'Gr api recipe to delete volume-group', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('volumeGroup', 'updateInstance', '1', 'Gr api recipe to update volume-group', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('vfModule', 'createInstance', '1', 'Gr api recipe to create vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('vfModule', 'deleteInstance', '1', 'Gr api recipe to delete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('vfModule', 'updateInstance', '1', 'Gr api recipe to update vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'), +('vfModule', 'replaceInstance', '1', 'Gr api recipe to replace vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'); + +UPDATE vnf_components_recipe +SET vf_module_model_uuid = 'VNF-API-DEFAULT' +WHERE vf_module_model_uuid = 'VID_DEFAULT'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to create volume-group' +WHERE description = 'VID_DEFAULT recipe to create volume-group if no custom BPMN flow is found'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to delete volume-group' +WHERE description = 'VID_DEFAULT recipe to delete volume-group if no custom BPMN flow is found'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to update volume-group' +WHERE description = 'VID_DEFAULT recipe to update volume-group if no custom BPMN flow is found'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to create vf-module' +WHERE description = 'VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to delete vf-module' +WHERE description = 'VID_DEFAULT recipe to delete vf-module if no custom BPMN flow is found'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to update vf-module' +WHERE description = 'VID_DEFAULT recipe to update vf-module if no custom BPMN flow is found'; + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to replace vf-module' +WHERE description = 'VID_DEFAULT vfModule replace'; + +INSERT INTO network_recipe (MODEL_NAME, ACTION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VERSION_STR) +VALUES +('GR-API-DEFAULT', 'createInstance', 'Gr api recipe to create network', '/mso/async/services/WorkflowActionBB', 180, '1.0'), +('GR-API-DEFAULT', 'updateInstance', 'Gr api recipe to update network', '/mso/async/services/WorkflowActionBB', 180, '1.0'), +('GR-API-DEFAULT', 'deleteInstance', 'Gr api recipe to delete network', '/mso/async/services/WorkflowActionBB', 180, '1.0'); + +UPDATE network_recipe +SET model_name = 'VNF-API-DEFAULT' +WHERE model_name = 'VID_DEFAULT'; + +UPDATE network_recipe +SET description = 'Vnf api recipe to create network' +WHERE description = 'VID_DEFAULT recipe to create network if no custom BPMN flow is found'; + +UPDATE network_recipe +SET description = 'Vnf api recipe to update network' +WHERE description = 'VID_DEFAULT recipe to update network if no custom BPMN flow is found'; + +UPDATE network_recipe +SET description = 'Vnf api recipe to delete network' +WHERE description = 'VID_DEFAULT recipe to delete network if no custom BPMN flow is found'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.10__VNFCInstanceGroupChanges.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.10__VNFCInstanceGroupChanges.sql new file mode 100644 index 0000000000..ea7098724f --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.10__VNFCInstanceGroupChanges.sql @@ -0,0 +1,7 @@ +USE catalogdb; + +ALTER TABLE + `instance_group` CHANGE COLUMN `CR_MODEL_UUID` `CR_MODEL_UUID` VARCHAR(200) NULL, + CHANGE COLUMN `tosca_node_type` `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + CHANGE COLUMN `object_type` `OBJECT_TYPE` varchar(200) NOT NULL; + \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.11__Modify_IS_Base_Type.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.11__Modify_IS_Base_Type.sql new file mode 100644 index 0000000000..8e11121dd1 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.11__Modify_IS_Base_Type.sql @@ -0,0 +1,4 @@ +USE catalogdb; + +ALTER TABLE + `vf_module` CHANGE COLUMN `IS_BASE` `IS_BASE` TINYINT(1) NOT NULL; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.12__UpdateMacroReferenceData_Homing.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.12__UpdateMacroReferenceData_Homing.sql new file mode 100644 index 0000000000..442034ca98 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.12__UpdateMacroReferenceData_Homing.sql @@ -0,0 +1,4 @@ + +USE catalogdb; + +UPDATE orchestration_flow_reference SET FLOW_NAME = 'HomingV2' WHERE FLOW_NAME = 'SniroHoming'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.13__Alter_external_service_to_internal_model_mapping.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.13__Alter_external_service_to_internal_model_mapping.sql new file mode 100644 index 0000000000..2a2dc2aaf1 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.13__Alter_external_service_to_internal_model_mapping.sql @@ -0,0 +1,4 @@ + +USE catalogdb; + +ALTER TABLE external_service_to_internal_model_mapping MODIFY id int(11) not null auto_increment; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.14__DeactivateAndCloudDelete.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.14__DeactivateAndCloudDelete.sql new file mode 100644 index 0000000000..9c5c912d14 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.14__DeactivateAndCloudDelete.sql @@ -0,0 +1,10 @@ + +USE catalogdb; + +INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID) +VALUES +('vfModule', 'deactivateAndCloudDelete', '1', 'Gr api recipe to soft delete vf-module', '/mso/async/services/WorkflowActionBB', 180, 'GR-API-DEFAULT'); + +UPDATE vnf_components_recipe +SET description = 'Vnf api recipe to soft delete vf-module' +WHERE description = 'VID_DEFAULT vfModule soft delete'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.15__Orchestration_Status_Valid_Action_State_Transition_Table_Updates.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.15__Orchestration_Status_Valid_Action_State_Transition_Table_Updates.sql new file mode 100644 index 0000000000..9992f5531a --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.15__Orchestration_Status_Valid_Action_State_Transition_Table_Updates.sql @@ -0,0 +1,93 @@ +USE catalogdb; + +ALTER TABLE building_block_detail +CHANGE COLUMN building_block_name BUILDING_BLOCK_NAME VARCHAR(50) NOT NULL, +CHANGE COLUMN resource_type RESOURCE_TYPE VARCHAR(25) NOT NULL, +CHANGE COLUMN target_action TARGET_ACTION VARCHAR(25) NOT NULL; +/* +SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHANGE ', COLUMN_NAME, ' ', UPPER(COLUMN_NAME), ';') +FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'building_block_detail' AND COLUMN_NAME <> 'id'; +*/ + +ALTER TABLE orchestration_status_state_transition_directive +CHANGE COLUMN resource_type RESOURCE_TYPE VARCHAR(25) NOT NULL, +CHANGE COLUMN orchestration_status ORCHESTRATION_STATUS VARCHAR(25) NOT NULL, +CHANGE COLUMN target_action TARGET_ACTION VARCHAR(25) NOT NULL, +CHANGE COLUMN flow_directive FLOW_DIRECTIVE VARCHAR(25) NOT NULL; + +/* +SELECT CONCAT('ALTER TABLE ', TABLE_NAME, ' CHANGE ', COLUMN_NAME, ' ', UPPER(COLUMN_NAME), ';') +FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'orchestration_status_state_transition_directive' AND COLUMN_NAME <> 'id'; +*/ + +ALTER TABLE building_block_detail +DROP INDEX building_block_name; + +ALTER TABLE building_block_detail +ADD UNIQUE KEY UK_building_block_name (BUILDING_BLOCK_NAME); + + +/* +SELECT DISTINCT FLOW_NAME FROM orchestration_flow_reference WHERE FLOW_NAME NOT IN +(SELECT building_block_name FROM building_block_detail); + */ + +UPDATE orchestration_flow_reference +SET FLOW_NAME = 'ActivateServiceInstanceBB' +WHERE FLOW_NAME = 'ActivateServiceInstance'; + +DELETE FROM orchestration_flow_reference +WHERE FLOW_NAME = 'DeactivateNetworkCollectionBB'; + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO - 1 +WHERE COMPOSITE_ACTION = 'Service-Macro-Delete' AND SEQ_NO > 8; + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO - 1 +WHERE COMPOSITE_ACTION = 'NetworkCollection-Macro-Delete' AND SEQ_NO > 4; + +UPDATE building_block_detail +SET BUILDING_BLOCK_NAME = 'UnassignVolumeGroupBB' +WHERE BUILDING_BLOCK_NAME = 'UnassignVolumeGroup'; + +UPDATE building_block_detail +SET TARGET_ACTION = 'CHANGE_MODEL' +WHERE TARGET_ACTION = 'CHANGEMODEL'; + +INSERT INTO building_block_detail(BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION) +VALUES +('UnassignVfModuleBB', 'VF_MODULE', 'UNASSIGN'), +('AssignAndActivateVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), +('AvpnAssignServiceInstanceBB', 'CUSTOM', 'CUSTOM'), +('CreateCustomerVpnBindingBB', 'CUSTOM', 'CUSTOM'), +('SniroHoming', 'CUSTOM', 'CUSTOM'), +('DeactivateAndUnassignVpnBondingLinksBB', 'CUSTOM', 'CUSTOM'), +('DeactivateNetworkCollectionBB', 'CUSTOM', 'CUSTOM'), +('AAICheckVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('AAISetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('AAIUnsetVnfInMaintBB', 'CUSTOM', 'CUSTOM'), +('SDNOVnfHealthCheckBB', 'CUSTOM', 'CUSTOM'), +('VNF-Macro-Replace', 'CUSTOM', 'CUSTOM'), +('HomingV2', 'CUSTOM', 'CUSTOM'); + +ALTER TABLE building_block_detail +MODIFY COLUMN BUILDING_BLOCK_NAME VARCHAR(200); + +ALTER TABLE orchestration_flow_reference +ADD CONSTRAINT fk_orchestration_flow_reference__building_block_detail +FOREIGN KEY (FLOW_NAME) REFERENCES building_block_detail(BUILDING_BLOCK_NAME) +ON DELETE CASCADE +ON UPDATE CASCADE; + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES +('CUSTOM', 'ACTIVE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'ASSIGNED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'CREATED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'INVENTORIED', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_ACTIVATION', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_CREATE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'), +('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE'); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.16__Remove_Orchestration_Flow_Reference_FK_To_Building_Block_Detail_Pre_New_Solution.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.16__Remove_Orchestration_Flow_Reference_FK_To_Building_Block_Detail_Pre_New_Solution.sql new file mode 100644 index 0000000000..ee3cdd21ac --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.16__Remove_Orchestration_Flow_Reference_FK_To_Building_Block_Detail_Pre_New_Solution.sql @@ -0,0 +1,4 @@ +USE catalogdb; + +ALTER TABLE orchestration_flow_reference +DROP FOREIGN KEY fk_orchestration_flow_reference__building_block_detail; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.17__DeactivateAndCloudDeleteChanges.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.17__DeactivateAndCloudDeleteChanges.sql new file mode 100644 index 0000000000..77b4e60d49 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.17__DeactivateAndCloudDeleteChanges.sql @@ -0,0 +1,8 @@ +USE catalogdb; + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW) VALUES +('VFModule-DeactivateAndCloudDelete', 'deactivateAndCloudDelete', 'VfModule', true, '7','7', true); + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('VFModule-DeactivateAndCloudDelete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete')), +('VFModule-DeactivateAndCloudDelete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-DeactivateAndCloudDelete')); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.18__AlterVNFRecipeVnfTypeColumnName.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.18__AlterVNFRecipeVnfTypeColumnName.sql new file mode 100644 index 0000000000..44a35b9d58 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.18__AlterVNFRecipeVnfTypeColumnName.sql @@ -0,0 +1,9 @@ +USE catalogdb; + +ALTER TABLE `vnf_recipe` +CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; + +INSERT INTO `vnf_recipe` (`NF_ROLE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `RECIPE_TIMEOUT`) +VALUES ('vCE', 'replaceInstance', '1', 'custom bpmn for vCE recreate via POLO', '/mso/async/services/RecreateInfraVce', '180'); + +DELETE FROM `vnf_recipe` WHERE `NF_ROLE`='POLO_DEFAULT'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.1__Update_Recipe_For_API_Flag.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.1__Update_Recipe_For_API_Flag.sql new file mode 100644 index 0000000000..74e57e6647 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.1__Update_Recipe_For_API_Flag.sql @@ -0,0 +1,34 @@ +USE catalogdb; + +UPDATE vnf_recipe +SET ORCHESTRATION_URI = '/mso/async/services/VnfInPlaceUpdate' +WHERE VNF_TYPE = 'GR-API-DEFAULT' AND ACTION = 'inPlaceSoftwareUpdate'; + +UPDATE vnf_recipe +SET ORCHESTRATION_URI = '/mso/async/services/VnfConfigUpdate' +WHERE VNF_TYPE = 'GR-API-DEFAULT' AND ACTION = 'applyUpdatedConfig'; + +UPDATE service +SET MODEL_UUID = 'd88da85c-d9e8-4f73-b837-3a72a431622b' +WHERE MODEL_UUID = 'DummyGRApiDefaultModelUUID?'; + +UPDATE service +SET MODEL_INVARIANT_UUID = '944862ae-bb65-4429-8330-a6c9170d6672' +WHERE MODEL_INVARIANT_UUID = 'DummyGRApiDefaultModelInvariantUUID?'; + +UPDATE service_recipe +SET SERVICE_MODEL_UUID = 'd88da85c-d9e8-4f73-b837-3a72a431622b' +WHERE SERVICE_MODEL_UUID = 'DummyGRApiDefaultModelUUID?'; + +INSERT INTO service_recipe (ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, SERVICE_MODEL_UUID) +VALUES +('assignInstance', '1.0', 'Gr api recipe to assign service-instance', '/mso/async/services/WorkflowActionBB', 180, 'd88da85c-d9e8-4f73-b837-3a72a431622b'), +('unassignInstance', '1.0', 'Gr api recipe to unassign service-instance', '/mso/async/services/WorkflowActionBB', 180, 'd88da85c-d9e8-4f73-b837-3a72a431622b'); + +UPDATE service_recipe +SET DESCRIPTION = 'Vnf api recipe to assign service-instance' +WHERE ACTION = 'assignInstance' AND DESCRIPTION LIKE '%VID_DEFAULT%'; + +UPDATE service_recipe +SET DESCRIPTION = 'Vnf api recipe to unassign service-instance' +WHERE ACTION = 'unassignInstance' AND DESCRIPTION LIKE '%VID_DEFAULT%'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.2__ONAP_TABLE_CHANGES.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.2__ONAP_TABLE_CHANGES.sql new file mode 100644 index 0000000000..f90b18c28d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.2__ONAP_TABLE_CHANGES.sql @@ -0,0 +1,30 @@ +use catalogdb; +create table if not exists ar_recipe ( + ID INT(11) not null auto_increment, + MODEL_NAME varchar(200) NOT NULL, + ACTION varchar(200) NOT NULL, + VERSION_STR varchar(200) NOT NULL, + SERVICE_TYPE varchar(200), + DESCRIPTION varchar(200), + ORCHESTRATION_URI varchar(200) NOT NULL, + AR_PARAM_XSD varchar(200), + RECIPE_TIMEOUT INT(11), + CREATION_TIMESTAMP DATETIME NOT NULL default current_timestamp, + primary key (ID), + unique key `uk_ar_recipe` (`model_name`,`action`,`version_str`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +alter table network_recipe + ADD RESOURCE_CATEGORY varchar(200), + ADD RESOURCE_SUB_CATEGORY varchar(200); + +alter table service ADD SERVICE_CATEGORY varchar(200); + +alter table vnf_resource + ADD RESOURCE_CATEGORY varchar(200), + ADD RESOURCE_SUB_CATEGORY varchar(200); + +alter table network_resource + ADD RESOURCE_CATEGORY varchar(200), + ADD RESOURCE_SUB_CATEGORY varchar(200); + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.3__MacroTableChanges.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.3__MacroTableChanges.sql new file mode 100644 index 0000000000..4a74edb245 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.3__MacroTableChanges.sql @@ -0,0 +1,24 @@ +USE catalogdb; + + + +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'Service-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'Service-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'assignService' WHERE MACRO_ACTION = 'Service-Macro-Assign'; +UPDATE northbound_request_ref_lookup SET ACTION = 'activateService' WHERE MACRO_ACTION = 'Service-Macro-Activate'; +UPDATE northbound_request_ref_lookup SET ACTION = 'unassignService' WHERE MACRO_ACTION = 'Service-Macro-Unassign'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'Service-Macro-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'Service-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'Network-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'Network-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'replaceService' WHERE MACRO_ACTION = 'VNF-Macro-Replace'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'VNF-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'VNF-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'VolumeGroup-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'VolumeGroup-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'VFModule-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'VFModule-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'deleteService' WHERE MACRO_ACTION = 'AVPNBonding-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET ACTION = 'createService' WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.4__MacroReferenceData1806.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.4__MacroReferenceData1806.sql new file mode 100644 index 0000000000..2e264d9bbc --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.4__MacroReferenceData1806.sql @@ -0,0 +1,130 @@ + +USE catalogdb; + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION) VALUES +('Service-Create', 'createInstance', 'Service', true, '7','7'), +('Service-Delete', 'deleteInstance', 'Service', true, '7','7'), +('Service-Macro-Assign', 'assignInstance', 'Service', false, '7','7'), +('Service-Macro-Activate', 'activateInstance', 'Service', false, '7','7'), +('Service-Macro-Unassign', 'unassignInstance', 'Service', false, '7','7'), +('Service-Macro-Create', 'createInstance', 'Service', false, '7','7'), +('Service-Macro-Delete', 'deleteInstance', 'Service', false, '7','7'), +('Network-Create', 'createInstance', 'Network', true, '7','7'), +('Network-Delete', 'deleteInstance', 'Network', true, '7','7'), +('VNF-Macro-Recreate', 'replaceInstance', 'Vnf', false, '7','7'), +('VNF-Macro-Replace', 'internalReplace', 'Vnf', false, '7','7'), +('VNF-Create', 'createInstance', 'Vnf', true, '7', '7'), +('VNF-Delete', 'deleteInstance', 'Vnf', true, '7', '7'), +('VolumeGroup-Create', 'createInstance', 'VolumeGroup', true, '7','7'), +('VolumeGroup-Delete', 'deleteInstance', 'VolumeGroup', true, '7','7'), +('VFModule-Create', 'createInstance', 'VfModule', true, '7','7'), +('VFModule-Delete', 'deleteInstance', 'VfModule', true, '7','7'), +('NetworkCollection-Macro-Create', 'createInstance', 'NetworkCollection', false, '7','7'), +('NetworkCollection-Macro-Delete', 'deleteInstance', 'NetworkCollection', false, '7','7'), +('AVPNBonding-Macro-Delete', 'deleteInstance', 'BondingService', true, '7','7'), +('AVPNBonding-Macro-Create', 'createInstance', 'BondingService', true, '7','7'); + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create')), +('Service-Create', '2', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create')), +('Service-Delete', '1', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete')), +('Service-Delete', '2', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Delete')), +('Service-Macro-Assign', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '2', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '3', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '4', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Assign', '5', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Assign')), +('Service-Macro-Activate', '1', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '2', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '3', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '4', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '5', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '6', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '7', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Activate', '8', 'ActivateServiceInstance', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Activate')), +('Service-Macro-Unassign', '1', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '2', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '3', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '4', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Unassign', '5', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Unassign')), +('Service-Macro-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '2', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '3', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '4', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '5', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '6', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '7', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '8', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '9', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '10', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '11', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '12', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '13', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '14', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Create', '15', 'ActivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create')), +('Service-Macro-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Network-Create', '1', 'AssignNetwork1802BB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create')), +('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create')), +('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create')), +('Network-Delete', '1', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete')), +('Network-Delete', '2', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete')), +('Network-Delete', '3', 'UnassignNetwork1802BB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Delete')), +('VNF-Create', '1', 'AssignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create')), +('VNF-Create', '2', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Create')), +('VNF-Delete', '1', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete')), +('VNF-Delete', '2', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Delete')), +('VNF-Macro-Recreate', '1', 'AAICheckVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '2', 'AAISetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '3', 'VNF-Macro-Replace', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '4', 'SDNOVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Recreate', '5', 'AAIUnsetVnfInMaintBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Recreate')), +('VNF-Macro-Replace', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '3', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '4', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '5', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VNF-Macro-Replace', '6', 'ActivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VNF-Macro-Replace')), +('VolumeGroup-Create', '1', 'AssignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create')), +('VolumeGroup-Create', '2', 'CreateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create')), +('VolumeGroup-Create', '3', 'ActivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Create')), +('VolumeGroup-Delete', '1', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete')), +('VolumeGroup-Delete', '2', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete')), +('VolumeGroup-Delete', '3', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VolumeGroup-Delete')), +('VFModule-Create', '1', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create')), +('VFModule-Create', '2', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create')), +('VFModule-Create', '3', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Create')), +('VFModule-Delete', '1', 'DeactivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete')), +('VFModule-Delete', '2', 'DeleteVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete')), +('VFModule-Delete', '3', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete')), +('NetworkCollection-Macro-Create', '1', 'CreateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '2', 'AssignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '3', 'CreateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '4', 'ActivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Create', '5', 'ActivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create')), +('NetworkCollection-Macro-Delete', '1', 'DeactivateNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '2', 'DeleteNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '3', 'UnassignNetworkBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '4', 'DeactivateNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('NetworkCollection-Macro-Delete', '5', 'DeleteNetworkCollectionBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete')), +('AVPNBonding-Macro-Delete','1','DeactivateServiceInstanceBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Delete')), +('AVPNBonding-Macro-Delete','2','DeactivateAndUnassignVpnBondingLinksBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Delete')), +('AVPNBonding-Macro-Delete','3','UnassignServiceInstanceBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Delete')), +('AVPNBonding-Macro-Create','1','SniroHoming',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create')), +('AVPNBonding-Macro-Create','2','CreateCustomerVpnBindingBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create')), +('AVPNBonding-Macro-Create','3','AvpnAssignServiceInstanceBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create')), +('AVPNBonding-Macro-Create','4','AssignAndActivateVpnBondingLinksBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create')), +('AVPNBonding-Macro-Create','5','ActivateServiceInstanceBB',1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create')); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.5__RainyDayHandlerMacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.5__RainyDayHandlerMacroData.sql new file mode 100644 index 0000000000..b81688e47d --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.5__RainyDayHandlerMacroData.sql @@ -0,0 +1,45 @@ +use catalogdb; + +INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) +VALUES +('ActivateNetworkBB', '*', '*', '*', "*" , 'Rollback'), +('ActivateNetworkCollectionBB', '*', '*', '*', "*" , 'Rollback'), +('ActivateServiceInstanceBB', '*', '*', '*', "*" , 'Rollback'), +('ActivateVfModuleBB', '*', '*', '*', "*" , 'Rollback'), +('ActivateVnfBB', '*', '*', '*', "*" , 'Rollback'), +('ActivateVolumeGroupBB', '*', '*', '*', "*" , 'Rollback'), +('AssignNetwork1802BB', '*', '*', '*', "*" , 'Rollback'), +('AssignNetworkBB', '*', '*', '*', "*" , 'Rollback'), +('AssignServiceInstanceBB', '*', '*', '*', "*" , 'Rollback'), +('AssignVfModuleBB', '*', '*', '*', "*" , 'Rollback'), +('AssignVnfBB', '*', '*', '*', "*" , 'Rollback'), +('AssignVolumeGroupBB', '*', '*', '*', "*" , 'Rollback'), +('CreateNetworkBB', '*', '*', '*', "*" , 'Retry'), +('CreateNetworkCollectionBB', '*', '*', '*', "*" , 'Retry'), +('CreateVfModuleBB', '*', '*', '*', "*" , 'Retry'), +('CreateVolumeGroupBB', '*', '*', '*', "*" , 'Retry'), +('ChangeModelServiceInstanceBB', '*', '*', '*', "*" , 'Abort'), +('ChangeModelVfModuleBB', '*', '*', '*', "*" , 'Abort'), +('ChangeModelVnfBB', '*', '*', '*', "*" , 'Abort'), +('CreateCustomerBB', '*', '*', '*', "*" , 'Abort'), +('DeactivateNetworkBB', '*', '*', '*', "*" , 'Abort'), +('DeactivateServiceInstanceBB', '*', '*', '*', "*" , 'Abort'), +('DeactivateVfModuleBB', '*', '*', '*', "*" , 'Abort'), +('DeactivateVnfBB', '*', '*', '*', "*" , 'Abort'), +('DeactivateVolumeGroupBB', '*', '*', '*', "*" , 'Abort'), +('DeleteNetworkBB', '*', '*', '*', "*" , 'Retry'), +('DeleteNetworkCollectionBB', '*', '*', '*', "*" , 'Retry'), +('DeleteVfModuleBB', '*', '*', '*', "*" , 'Retry'), +('DeleteVolumeGroupBB', '*', '*', '*', "*" , 'Retry'), +('UnassignNetwork1802BB', '*', '*', '*', "*" , 'Retry'), +('UnassignNetworkBB', '*', '*', '*', "*" , 'Retry'), +('UnassignServiceInstanceBB', '*', '*', '*', "*" , 'Retry'), +('UnassignVfModuleBB', '*', '*', '*', "*" , 'Retry'), +('UnassignVnfBB', '*', '*', '*', "*" , 'Retry'), +('UnassignVolumeGroupBB', '*', '*', '*', "*" , 'Retry'), +('UpdateNetworkBB', '*', '*', '*', "*" , 'Retry'), +('VnfAdapterBB', '*', '*', '*', "*" , 'Retry'), +('AAICheckVnfInMaintBB', '*', '*', '*', "*" , 'Abort'), +('AAISetVnfInMaintBB', '*', '*', '*', "*" , 'Abort'), +('SDNOVnfHealthCheckBB', '*', '*', '*', "*" , 'Abort'), +('AAIUnsetVnfInMaintBB', '*', '*', '*', "*" , 'Abort'); \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.6__NorthboundAddTopLevelFlow.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.6__NorthboundAddTopLevelFlow.sql new file mode 100644 index 0000000000..ee2b63c079 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.6__NorthboundAddTopLevelFlow.sql @@ -0,0 +1,28 @@ +USE catalogdb; + +ALTER TABLE + `northbound_request_ref_lookup` +ADD + ISTOPLEVELFLOW TINYINT(1); + +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Macro-Assign'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Macro-Activate'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Macro-Unassign'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Macro-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Service-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Network-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'Network-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = FALSE WHERE MACRO_ACTION = 'VNF-Macro-Replace'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VNF-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VNF-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VolumeGroup-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VolumeGroup-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VFModule-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VFModule-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'NetworkCollection-Macro-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'NetworkCollection-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'AVPNBonding-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'AVPNBonding-Macro-Create'; +UPDATE northbound_request_ref_lookup SET ISTOPLEVELFLOW = TRUE WHERE MACRO_ACTION = 'VNF-Macro-Recreate'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.7__VNFCInstanceGroup1806.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.7__VNFCInstanceGroup1806.sql new file mode 100644 index 0000000000..d83d6ecad9 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.7__VNFCInstanceGroup1806.sql @@ -0,0 +1,57 @@ +use catalogdb; + +CREATE TABLE IF NOT EXISTS `catalogdb`.`collection_resource_instance_group_customization` ( + `COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `INSTANCE_GROUP_MODEL_UUID` VARCHAR(200) NOT NULL, + `FUNCTION` VARCHAR(200) NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `SUBINTERFACE_NETWORK_QUANTITY` INT(11) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID`, `INSTANCE_GROUP_MODEL_UUID`), + INDEX `fk_collection_resource_instance_group_customization__instan_idx` (`INSTANCE_GROUP_MODEL_UUID` ASC), + CONSTRAINT `fk_collection_resource_instance_group_customization__collecti1` + FOREIGN KEY (`COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID`) + REFERENCES `catalogdb`.`collection_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_collection_resource_instance_group_customization__instance1` + FOREIGN KEY (`INSTANCE_GROUP_MODEL_UUID`) + REFERENCES `catalogdb`.`instance_group` (`MODEL_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +CREATE TABLE IF NOT EXISTS `catalogdb`.`vnfc_instance_group_customization` ( + `VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID` VARCHAR(200) NOT NULL, + `INSTANCE_GROUP_MODEL_UUID` VARCHAR(200) NOT NULL, + `FUNCTION` VARCHAR(200) NULL, + `DESCRIPTION` VARCHAR(1200) NULL, + `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID`, `INSTANCE_GROUP_MODEL_UUID`), + INDEX `fk_vnfc_instance_group_customization__instance_group1_idx` (`INSTANCE_GROUP_MODEL_UUID` ASC), + CONSTRAINT `fk_vnfc_instance_group_customization__vnf_resource_customizat1` + FOREIGN KEY (`VNF_RESOURCE_CUSTOMIZATION_MODEL_UUID`) + REFERENCES `catalogdb`.`vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE, + CONSTRAINT `fk_vnfc_instance_group_customization__instance_group1` + FOREIGN KEY (`INSTANCE_GROUP_MODEL_UUID`) + REFERENCES `catalogdb`.`instance_group` (`MODEL_UUID`) + ON DELETE CASCADE + ON UPDATE CASCADE) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +Alter TABLE `instance_group` +DROP COLUMN `function`, +DROP COLUMN `description`, +CHANGE `primary_type` `object_type` varchar(200) NOT NULL, +MODIFY `tosca_node_type` varchar(200) NULL; + +Alter TABLE `collection_resource_customization` +DROP COLUMN `subinterface_network_quantity`, +CHANGE `primary_type` `object_type` varchar(200) NOT NULL, +MODIFY role varchar(200) NULL, +MODIFY function varchar(200) NULL, +MODIFY collection_resource_type varchar(200) NULL; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.8__OrchestrationStatus_ValidActionStateTransition.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.8__OrchestrationStatus_ValidActionStateTransition.sql new file mode 100644 index 0000000000..1f3e7906ec --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.8__OrchestrationStatus_ValidActionStateTransition.sql @@ -0,0 +1,398 @@ +USE catalogdb; + +CREATE TABLE IF NOT EXISTS `building_block_detail` ( +`id` INT(11) AUTO_INCREMENT, +`building_block_name` VARCHAR(50) UNIQUE NOT NULL, +`resource_type` VARCHAR(25) NOT NULL, +`target_action` VARCHAR(25) NOT NULL, +PRIMARY KEY(`id`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +INSERT INTO building_block_detail (building_block_name, resource_type, target_action) +VALUES +('AssignServiceInstanceBB', 'SERVICE', 'ASSIGN'), +('AssignVnfBB', 'VNF', 'ASSIGN'), +('AssignVolumeGroupBB', 'VOLUME_GROUP', 'ASSIGN'), +('AssignVfModuleBB', 'VF_MODULE', 'ASSIGN'), +('AssignNetworkBB', 'NETWORK', 'ASSIGN'), +('AssignNetwork1802BB', 'NETWORK', 'ASSIGN'), + +('UnassignServiceInstanceBB', 'SERVICE', 'UNASSIGN'), +('UnassignVnfBB', 'VNF', 'UNASSIGN'), +('UnassignVolumeGroup', 'VOLUME_GROUP', 'UNASSIGN'), +('UnassignNetwork1802BB', 'NETWORK', 'UNASSIGN'), +('UnassignNetworkBB', 'NETWORK', 'UNASSIGN'), + +('ActivateServiceInstanceBB', 'SERVICE', 'ACTIVATE'), +('ActivateVnfBB', 'VNF', 'ACTIVATE'), +('ActivateVolumeGroupBB', 'VOLUME_GROUP', 'ACTIVATE'), +('ActivateVfModuleBB', 'VF_MODULE', 'ACTIVATE'), +('ActivateNetworkBB', 'NETWORK', 'ACTIVATE'), +('ActivateNetworkCollectionBB', 'NETWORK', 'ACTIVATE'), + +('DeactivateServiceInstanceBB', 'SERVICE', 'DEACTIVATE'), +('DeactivateVnfBB', 'VNF', 'DEACTIVATE'), +('DeactivateVolumeGroupBB', 'VOLUME_GROUP', 'DEACTIVATE'), +('DeactivateVfModuleBB', 'VF_MODULE', 'DEACTIVATE'), +('DeactivateNetworkBB', 'NETWORK', 'DEACTIVATE'), + + +('ChangeModelServiceInstanceBB', 'SERVICE', 'CHANGEMODEL'), +('ChangeModelVnfBB', 'VNF', 'CHANGEMODEL'), +('ChangeModelVfModuleBB', 'VF_MODULE', 'CHANGEMODEL'), + + +('CreateVolumeGroupBB', 'VOLUME_GROUP', 'CREATE'), +('CreateVfModuleBB', 'VF_MODULE', 'CREATE'), +('CreateNetworkBB', 'NETWORK', 'CREATE'), +('CreateNetworkCollectionBB', 'NETWORK', 'CREATE'), + +('DeleteVolumeGroupBB', 'VOLUME_GROUP', 'DELETE'), +('DeleteVfModuleBB', 'VF_MODULE', 'DELETE'), +('DeleteNetworkBB', 'NETWORK', 'DELETE'), +('DeleteNetworkCollectionBB', 'NETWORK', 'DELETE'); + +CREATE TABLE IF NOT EXISTS `orchestration_status_state_transition_directive` ( +`id` INT(11) AUTO_INCREMENT, +`resource_type` VARCHAR(25) NOT NULL, +`orchestration_status` VARCHAR(25) NOT NULL, +`target_action` VARCHAR(25) NOT NULL, +`flow_directive` VARCHAR(25) NOT NULL, +PRIMARY KEY (`id`), +UNIQUE KEY `UK_orchestration_status_state_transition_directive` (`resource_type`, `orchestration_status`, `target_action`)) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + +INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive) +VALUES + +('SERVICE', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VNF', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('VF_MODULE', 'PRECREATED', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'PRECREATED', 'ASSIGN', 'CONTINUE'), + +('SERVICE', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('VNF', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'INVENTORIED', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'INVENTORIED', 'ASSIGN', 'CONTINUE'), + +('SERVICE', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'CREATED', 'ASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'ASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_CREATE', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('VNF', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'ASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'ASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'ASSIGN', 'FAIL'), + +('SERVICE', 'PENDING', 'ASSIGN', 'FAIL'), +('VNF', 'PENDING', 'ASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'ASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'ASSIGN', 'FAIL'), +('NETWORK', 'PENDING', 'ASSIGN', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VNF', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('VF_MODULE', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), +('NETWORK', 'PRECREATED', 'UNASSIGN', 'SILENT_SUCCESS'), + +('SERVICE', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'INVENTORIED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'CREATED', 'UNASSIGN', 'CONTINUE'), +('VNF', 'CREATED', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'CREATED', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'CREATED', 'UNASSIGN', 'FAIL'), +('NETWORK', 'CREATED', 'UNASSIGN', 'FAIL'), + +('SERVICE', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VNF', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('NETWORK', 'ACTIVE', 'UNASSIGN', 'FAIL'), + +('SERVICE', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_CREATE', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('VNF', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_DELETE', 'UNASSIGN', 'CONTINUE'), + +('SERVICE', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'UNASSIGN', 'CONTINUE'), +('NETWORK', 'PENDING_ACTIVATION', 'UNASSIGN', 'FAIL'), + +('SERVICE', 'PENDING', 'UNASSIGN', 'FAIL'), +('VNF', 'PENDING', 'UNASSIGN', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'UNASSIGN', 'CONTINUE'), +('VF_MODULE', 'PENDING', 'UNASSIGN', 'FAIL'), +('NETWORK', 'PENDING', 'UNASSIGN', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VNF', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VNF', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'INVENTORIED', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('VNF', 'ASSIGNED', 'ACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'ASSIGNED', 'ACTIVATE', 'FAIL'), +('NETWORK', 'ASSIGNED', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('VNF', 'CREATED', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('VF_MODULE', 'CREATED', 'ACTIVATE', 'CONTINUE'), +('NETWORK', 'CREATED', 'ACTIVATE', 'CONTINUE'), + +('SERVICE', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'ACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_CREATE', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING_DELETE', 'ACTIVATE', 'CONTINUE'), +('VNF', 'PENDING_DELETE', 'ACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_DELETE', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING_ACTIVATION', 'ACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING', 'ACTIVATE', 'FAIL'), +('VNF', 'PENDING', 'ACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'ACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING', 'ACTIVATE', 'FAIL'), +('NETWORK', 'PENDING', 'ACTIVATE', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VNF', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'DEACTIVATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'DEACTIVATE', 'FAIL'), + +('SERVICE', 'INVENTORIED', 'DEACTIVATE', 'FAIL'), +('VNF', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'INVENTORIED', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'INVENTORIED', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VNF', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VOLUME_GROUP', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('VF_MODULE', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), +('NETWORK', 'ACTIVE', 'DEACTIVATE', 'CONTINUE'), + +('SERVICE', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_CREATE', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_CREATE', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VNF', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VOLUME_GROUP', 'PENDING_DELETE', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'DEACTIVATE', 'SILENT_SUCCESS'), + +('SERVICE', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'DEACTIVATE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'DEACTIVATE', 'FAIL'), + +('SERVICE', 'PENDING', 'DEACTIVATE', 'FAIL'), +('VNF', 'PENDING', 'DEACTIVATE', 'FAIL'), +('VOLUME_GROUP', 'PENDING', 'DEACTIVATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'DEACTIVATE', 'FAIL'), +('NETWORK', 'PENDING', 'DEACTIVATE', 'FAIL'), + + +('SERVICE', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'ASSIGNED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'ASSIGNED', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'CREATED', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'CREATED', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('VNF', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'ACTIVE', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'CHANGE_MODEL', 'FAIL'), + +('SERVICE', 'PENDING_DELETE', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_DELETE', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'PENDING_DELETE', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'CONTINUE'), +('VF_MODULE', 'PENDING_ACTIVATION', 'CHANGE_MODEL', 'CONTINUE'), + +('SERVICE', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VNF', 'PENDING', 'CHANGE_MODEL', 'FAIL'), +('VF_MODULE', 'PENDING', 'CHANGE_MODEL', 'FAIL'), + + +('VOLUME_GROUP', 'PRECREATED', 'CREATE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'CREATE', 'FAIL'), +('NETWORK', 'PRECREATED', 'CREATE', 'FAIL'), + +('VOLUME_GROUP', 'INVENTORIED', 'CREATE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'CREATE', 'FAIL'), +('NETWORK', 'INVENTORIED', 'CREATE', 'FAIL'), + +('VOLUME_GROUP', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('VF_MODULE', 'ASSIGNED', 'CREATE', 'CONTINUE'), +('NETWORK', 'ASSIGNED', 'CREATE', 'CONTINUE'), + +('VOLUME_GROUP', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'CREATED', 'CREATE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), +('NETWORK', 'ACTIVE', 'CREATE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING_CREATE', 'CREATE', 'CONTINUE'), + +('VOLUME_GROUP', 'PENDING_DELETE', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'CREATE', 'CONTINUE'), +('NETWORK', 'PENDING_DELETE', 'CREATE', 'CONTINUE'), + +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING_ACTIVATION', 'CREATE', 'FAIL'), + +('VOLUME_GROUP', 'PENDING', 'CREATE', 'CONTINUE'), +('VF_MODULE', 'PENDING', 'CREATE', 'FAIL'), +('NETWORK', 'PENDING', 'CREATE', 'FAIL'), + + +('VOLUME_GROUP', 'PRECREATED', 'DELETE', 'FAIL'), +('VF_MODULE', 'PRECREATED', 'DELETE', 'FAIL'), +('NETWORK', 'PRECREATED', 'DELETE', 'FAIL'), + +('VOLUME_GROUP', 'INVENTORIED', 'DELETE', 'FAIL'), +('VF_MODULE', 'INVENTORIED', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'INVENTORIED', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'ASSIGNED', 'DELETE', 'SILENT_SUCCESS'), +('VF_MODULE', 'ASSIGNED', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'ASSIGNED', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'CREATED', 'DELETE', 'CONTINUE'), +('VF_MODULE', 'CREATED', 'DELETE', 'CONTINUE'), +('NETWORK', 'CREATED', 'DELETE', 'CONTINUE'), + +('VOLUME_GROUP', 'ACTIVE', 'DELETE', 'FAIL'), +('VF_MODULE', 'ACTIVE', 'DELETE', 'FAIL'), +('NETWORK', 'ACTIVE', 'DELETE', 'FAIL'), + +('VOLUME_GROUP', 'PENDING_CREATE', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_CREATE', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_CREATE', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'PENDING_DELETE', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_DELETE', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_DELETE', 'DELETE', 'SILENT_SUCCESS'), + +('VOLUME_GROUP', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), +('VF_MODULE', 'PENDING_ACTIVATION', 'DELETE', 'SILENT_SUCCESS'), +('NETWORK', 'PENDING_ACTIVATION', 'DELETE', 'FAIL'), + +('VOLUME_GROUP', 'PENDING', 'DELETE', 'SILENT_SUCCESS'), +('VF_MODULE', 'PENDING', 'DELETE', 'FAIL'), +('NETWORK', 'PENDING', 'DELETE', 'FAIL'); diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.9__UpdateIsTopLevelFlowColumn.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.9__UpdateIsTopLevelFlowColumn.sql new file mode 100644 index 0000000000..855b1715ff --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V2.9__UpdateIsTopLevelFlowColumn.sql @@ -0,0 +1,4 @@ +USE catalogdb; + +ALTER TABLE + `northbound_request_ref_lookup` CHANGE ISTOPLEVELFLOW IS_TOPLEVELFLOW TINYINT(1); \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.1__AddServiceMacroDeactivateToMacroTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.1__AddServiceMacroDeactivateToMacroTables.sql new file mode 100644 index 0000000000..d8291b7712 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.1__AddServiceMacroDeactivateToMacroTables.sql @@ -0,0 +1,7 @@ +USE catalogdb; + +INSERT INTO northbound_request_ref_lookup (REQUEST_SCOPE, MACRO_ACTION, ACTION, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW) +values ( 'Service', 'Service-Macro-Deactivate', 'deactivateInstance', '0', '7', '7', '1'); + +INSERT INTO orchestration_flow_reference (COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) +values ( 'Service-Macro-Deactivate', '1', 'DeactivateServiceInstanceBB', '1', (SELECT id FROM northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Deactivate')); \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.2__ChangeMINApiVersionInNorthbound.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.2__ChangeMINApiVersionInNorthbound.sql new file mode 100644 index 0000000000..9016d5bf93 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.2__ChangeMINApiVersionInNorthbound.sql @@ -0,0 +1,5 @@ +USE catalogdb; + +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Create'; +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Delete'; +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Activate'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.3__ChangeMINApiVersionServiceMacroDeactivate.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.3__ChangeMINApiVersionServiceMacroDeactivate.sql new file mode 100644 index 0000000000..a471e2d0a5 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.3__ChangeMINApiVersionServiceMacroDeactivate.sql @@ -0,0 +1,3 @@ +USE catalogdb; + +UPDATE northbound_request_ref_lookup SET MIN_API_VERSION = 5 WHERE MACRO_ACTION = 'Service-Macro-Deactivate'; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.4__AddUpdateNetworkALaCarte.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.4__AddUpdateNetworkALaCarte.sql new file mode 100644 index 0000000000..350dde6b9a --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.4__AddUpdateNetworkALaCarte.sql @@ -0,0 +1,20 @@ +USE catalogdb; + +INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, MIN_API_VERSION, MAX_API_VERSION, IS_TOPLEVELFLOW) VALUES +('Network-Update', 'updateInstance', 'Network', true, '7','7','1'); + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES +('Network-Update', '1', 'UpdateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Update')); + +INSERT INTO building_block_detail(BUILDING_BLOCK_NAME,RESOURCE_TYPE,TARGET_ACTION) VALUES +('UpdateNetworkBB','NETWORK','UPDATE'); + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS,TARGET_ACTION,FLOW_DIRECTIVE) VALUES +('NETWORK','PRECREATED','UPDATE','FAIL'), +('NETWORK','INVENTORIED','UPDATE','FAIL'), +('NETWORK','ASSIGNED','UPDATE','FAIL'), +('NETWORK','CREATED','UPDATE','FAIL'), +('NETWORK','PENDING_CREATE','UPDATE','FAIL'), +('NETWORK','PENDING_DELETE','UPDATE','FAIL'), +('NETWORK','PENDING_ACTIVATION','UPDATE','FAIL'), +('NETWORK','ACTIVE','UPDATE','CONTINUE'); \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.5__PointGrApiDefault_To_UpdateVfModuleVolumeInfraV1.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.5__PointGrApiDefault_To_UpdateVfModuleVolumeInfraV1.sql new file mode 100644 index 0000000000..dbabcb6419 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.5__PointGrApiDefault_To_UpdateVfModuleVolumeInfraV1.sql @@ -0,0 +1,4 @@ +USE catalogdb; + + +UPDATE `catalogdb`.`vnf_components_recipe` SET `ORCHESTRATION_URI`='/mso/async/services/UpdateVfModuleVolumeInfraV1' WHERE `VF_MODULE_MODEL_UUID`='GR-API-DEFAULT' and `VNF_COMPONENT_TYPE`='volumeGroup' and `ACTION`='updateInstance'; diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.6__UpdateNetworkCollectionCatalogDB.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.6__UpdateNetworkCollectionCatalogDB.sql new file mode 100644 index 0000000000..8b66706032 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.6__UpdateNetworkCollectionCatalogDB.sql @@ -0,0 +1,38 @@ +use catalogdb; + +UPDATE building_block_detail SET RESOURCE_TYPE = "NETWORK_COLLECTION" WHERE BUILDING_BLOCK_NAME = "ActivateNetworkCollectionBB"; +UPDATE building_block_detail SET RESOURCE_TYPE = "NETWORK_COLLECTION" WHERE BUILDING_BLOCK_NAME = "CreateNetworkCollectionBB"; +UPDATE building_block_detail SET RESOURCE_TYPE = "NETWORK_COLLECTION" WHERE BUILDING_BLOCK_NAME = "DeleteNetworkCollectionBB"; +UPDATE building_block_detail SET RESOURCE_TYPE = "NETWORK_COLLECTION" WHERE BUILDING_BLOCK_NAME = "DeactivateNetworkCollectionBB"; +UPDATE building_block_detail SET TARGET_ACTION = "DEACTIVATE" WHERE BUILDING_BLOCK_NAME = "DeactivateNetworkCollectionBB"; + +INSERT into orchestration_status_state_transition_directive (RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) values +("NETWORK_COLLECTION", "PRECREATED", "CREATE", "CONTINUE"), +("NETWORK_COLLECTION", "ASSIGNED", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "CREATED", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "ACTIVE", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_CREATE", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_DELETE", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_ACTIVATION", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "PENDING", "CREATE", "FAIL"), +("NETWORK_COLLECTION", "INVENTORIED", "CREATE", "SILENT_SUCCESS"), + +("NETWORK_COLLECTION", "PRECREATED", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "ASSIGNED", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "CREATED", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "ACTIVE", "DELETE", "CONTINUE"), +("NETWORK_COLLECTION", "PENDING_CREATE", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_DELETE", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_ACTIVATION", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "PENDING", "DELETE", "FAIL"), +("NETWORK_COLLECTION", "INVENTORIED", "DELETE", "CONTINUE"), + +("NETWORK_COLLECTION", "PRECREATED", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "ASSIGNED", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "CREATED", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "ACTIVE", "ACTIVE", "SILENT_SUCCESS"), +("NETWORK_COLLECTION", "PENDING_CREATE", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_DELETE", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "PENDING_ACTIVATION", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "PENDING", "ACTIVE", "FAIL"), +("NETWORK_COLLECTION", "INVENTORIED", "ACTIVE", "CONTINUE"); \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.7__FixDeactivateNetworkCollection.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.7__FixDeactivateNetworkCollection.sql new file mode 100644 index 0000000000..872f22fee0 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.7__FixDeactivateNetworkCollection.sql @@ -0,0 +1,5 @@ +use catalogdb; + +UPDATE orchestration_status_state_transition_directive SET TARGET_ACTION = "ACTIVATE" WHERE TARGET_ACTION = "ACTIVE"; + +DELETE FROM building_block_detail WHERE BUILDING_BLOCK_NAME = "DeactivateNetworkCollectionBB"; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.8__UnassignFabricConfigurationData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.8__UnassignFabricConfigurationData.sql new file mode 100644 index 0000000000..29a8c1ed5f --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.8__UnassignFabricConfigurationData.sql @@ -0,0 +1,31 @@ +use catalogdb; + +INSERT INTO building_block_detail (building_block_name, resource_type, target_action) +VALUES +('UnassignFabricConfigurationBB', 'CONFIGURATION', 'UNASSIGN'); + +INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE) +VALUES +('CONFIGURATION', 'PRECREATED', 'UNASSIGN', 'SILENT SUCCESS'), +('CONFIGURATION', 'INVENTORIED', 'UNASSIGN', 'CONTINUE'), +('CONFIGURATION', 'ASSIGNED', 'UNASSIGN', 'CONTINUE'), +('CONFIGURATION', 'CREATED', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'ACTIVE', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING CREATE', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING DELETE', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING ACTIVATION', 'UNASSIGN', 'FAIL'), +('CONFIGURATION', 'PENDING', 'UNASSIGN', 'FAIL'); + +UPDATE orchestration_flow_reference +SET SEQ_NO = SEQ_NO + 2 WHERE COMPOSITE_ACTION = 'SERVICE-MACRO-DELETE'; + +INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) +VALUES +('Service-Macro-Delete', '1', 'DeactivateFabricConfigurationBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')), +('Service-Macro-Delete', '2', 'UnassignFabricConfigurationBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete')); + +INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY) +VALUES +('UnassignFabricConfigurationBB', '*', '*', '*', '*' , 'Retry'); + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.9__DropCRModelUUID_FK.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.9__DropCRModelUUID_FK.sql new file mode 100644 index 0000000000..d406f8ab4a --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V3.9__DropCRModelUUID_FK.sql @@ -0,0 +1,3 @@ +use catalogdb; + +ALTER TABLE instance_group DROP FOREIGN KEY instance_group_ibfk_1; \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/index.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/index.html new file mode 100644 index 0000000000..572e311533 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/index.html @@ -0,0 +1,41 @@ + + + + SO Catalog Database + + + +
+ + + + + + + + + + + + + + + + + +
+ Visit our Swagger UI +
+ CatalogDB Read me +
+ View Current Properties +
+ View Health +
+ View Metrics +
+ H2 Console +
+
+ + \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/index.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/index.html new file mode 100644 index 0000000000..b6ff8f3991 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/index.html @@ -0,0 +1,53 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Introduction

    +
  • +
  • +

    SO API Handler

    +
  • +
  • +

    SO API Handler utilizes RESTful interfaces to interact with consumer applications. The SO interface + is used to orchestrate VNFs, allow for manual task completion, and send vnf replace requests. + It contains both the SOServiceInstantiation API and SOManualTasks API.

    +
  • +
  • +

    SOServiceInstantiation API

    +
  • +
  • +

    The SOServiceInstantiation API handles service instance requests, and supports both macro and aLaCarte + orchestrations. Change management operations, activation and deactivation of service instances, and new + requests for configuration resources are handled by this API. This API is currently + set for version 6 ("v6") while also supporting versions 4 and 5 ("v4", "v5") minus additional "v6" features.

    +
  • +
  • +

    SOManualTasks API

    +
  • +
  • +

    The SOManualTasks API handles queries about open manual tasks. This API also accepts POST requests + containing information about how SO should proceed with handling the open tasks, and resolving the + errors. SOManualTasks API currently supports version 1 ("v1").

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/install.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/install.html new file mode 100644 index 0000000000..297a32074f --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/install.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Install

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/jars.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/jars.html new file mode 100644 index 0000000000..8d5c12bda7 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/jars.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Jars

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/layout.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/layout.html new file mode 100644 index 0000000000..cf47ed6a52 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/layout.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Layout

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/logging.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/logging.html new file mode 100644 index 0000000000..af68c7c634 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/logging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Logging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/onaplogo.png b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/onaplogo.png new file mode 100644 index 0000000000..c6f6857a58 Binary files /dev/null and b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/onaplogo.png differ diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/packaging.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/packaging.html new file mode 100644 index 0000000000..a72542c968 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/packaging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Packaging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/page.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/page.html new file mode 100644 index 0000000000..baee81bd83 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/page.html @@ -0,0 +1,67 @@ + + + + + + + \ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/readme.css b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/readme.css new file mode 100644 index 0000000000..68963ba3ad --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/readme.css @@ -0,0 +1,114 @@ +html, body{ + margin:0; + padding:0; + height:100%; +} +div#page-wrapper{ + width: 991px; + min-height: 100%; + margin: auto; + border-style: solid; + border-width: thin; + border-color: #d0d6e0; + position: relative; +} +body{ + display:none; +} +nav#header{ + padding: 10px; + width: 972px; + height: 101.8px; + border-bottom: 1px solid #d0d6e0; + text-align: left; +} +nav#header ul{ + padding-left: 0px; + list-style-type: none; +} +nav#header a{ + color: #008080; + text-decoration: none; +} +nav#header a:hover{ + text-decoration: underline; +} +nav#left-col{ + position: absolute; + left: 0; + width: 248px; + padding-bottom: 35px; +} +nav#left-col ul{ + padding-left: 10px; + list-style-type: none; +} +.pages { + color: #008080; + text-decoration: none; + text-align: left; + font-size: 18px; +} +.sub-bullet a{ + text-decoration: none; + text-align: left; + font-size: 14px; + color: black; +} +.sub-bullet a:hover{ + text-decoration: underline; +} +div#right-col{ + padding-left: 150px; + padding-bottom: 35px; + padding-right: 50px; +} +.title{ + color: #008080; + font-size: 24px; + list-style-type: none; +} +.info-title{ + color: black; + font-size: 18px; + list-style-type: none; +} +.info{ + color: grey; + font-size: 14px; + list-style-type: none; +} +.info-list{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; +} +.info-sublist{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; + padding-left: 45px; +} +div#footer-wrapper{ + position: absolute; + bottom: 0; + width: 981px; + height: 35px; + background-color: #008080; + color: white; + font-size:15px; + text-align:right; + padding-right:10px; +} +div#footer-wrapper a{ + color: white; + text-align:right; + text-decoration:none; +} +div#footer-wrapper a:hover{ + text-decoration: underline; +} diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/spring.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/spring.html new file mode 100644 index 0000000000..c6e2b46710 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/spring.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Spring

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/tools.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/tools.html new file mode 100644 index 0000000000..b1813db387 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/readme/tools.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Tools

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-16x16.png b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-16x16.png new file mode 100644 index 0000000000..0f7e13b0d9 Binary files /dev/null and b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-16x16.png differ diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-32x32.png b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-32x32.png new file mode 100644 index 0000000000..b0a3352ffd Binary files /dev/null and b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/favicon-32x32.png differ diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/index.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/index.html new file mode 100644 index 0000000000..13354cd3bb --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/index.html @@ -0,0 +1,95 @@ + + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/oauth2-redirect.html b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/oauth2-redirect.html new file mode 100644 index 0000000000..eb00dc686a --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/oauth2-redirect.html @@ -0,0 +1,60 @@ + + + + + + diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js new file mode 100644 index 0000000000..50ac4c2e40 --- /dev/null +++ b/adapters/mso-catalog-db-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js @@ -0,0 +1,99 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist",t(t.s=1139)}([function(e,t,n){"use strict";e.exports=n(86)},function(e,t,n){e.exports=n(923)()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function v(){return!0}function g(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function y(e,t){return b(e,t,0)}function _(e,t){return b(e,t,t)}function b(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function x(e){this.next=e}function k(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function w(){return{value:void 0,done:!0}}function E(e){return!!A(e)}function S(e){return e&&"function"==typeof e.next}function C(e){var t=A(e);return t&&t.call(e)}function A(e){var t=e&&(kn&&e[kn]||e[wn]);if("function"==typeof t)return t}function D(e){return e&&"number"==typeof e.length}function O(e){return null===e||void 0===e?j():o(e)?e.toSeq():z(e)}function T(e){return null===e||void 0===e?j().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():L(e)}function M(e){return null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():q(e)}function P(e){return(null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e:q(e)).toSetSeq()}function I(e){this._array=e,this.size=e.length}function F(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function N(e){this._iterable=e,this.size=e.length||e.size}function R(e){this._iterator=e,this._iteratorCache=[]}function B(e){return!(!e||!e[Sn])}function j(){return Cn||(Cn=new I([]))}function L(e){var t=Array.isArray(e)?new I(e).fromEntrySeq():S(e)?new R(e).fromEntrySeq():E(e)?new N(e).fromEntrySeq():"object"==typeof e?new F(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function q(e){var t=U(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function z(e){var t=U(e)||"object"==typeof e&&new F(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function U(e){return D(e)?new I(e):S(e)?new R(e):E(e)?new N(e):void 0}function W(e,t,n,r){var i=e._cache;if(i){for(var o=i.length-1,a=0;a<=o;a++){var s=i[n?o-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function V(e,t,n,r){var i=e._cache;if(i){var o=i.length-1,a=0;return new x(function(){var e=i[n?o-a:a];return a++>o?w():k(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function H(e,t){return t?G(t,e,"",{"":e}):J(e)}function G(e,t,n,r){return Array.isArray(t)?e.call(r,n,M(t).map(function(n,r){return G(e,n,r,t)})):X(t)?e.call(r,n,T(t).map(function(n,r){return G(e,n,r,t)})):t}function J(e){return Array.isArray(e)?M(e).map(J).toList():X(e)?T(e).map(J).toMap():e}function X(e){return e&&(e.constructor===Object||void 0===e.constructor)}function K(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function Y(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&K(i[1],e)&&(n||K(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var c=e;e=t,t=c}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):i?!K(t,e.get(r,vn)):!K(e.get(r,vn),t))return p=!1,!1});return p&&e.size===f}function $(e,t){if(!(this instanceof $))return new $(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(An)return An;An=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function oe(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return ie(n)}if("string"===t)return e.length>Rn?ae(e):se(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return ue(e);if("function"==typeof e.toString)return se(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Ln[e];return void 0===t&&(t=se(e),jn===Bn&&(jn=0,Ln={}),jn++,Ln[e]=t),t}function se(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ce(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?ke():fe(e)&&!l(e)?e:ke().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[qn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ge(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ye(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&be(e._root)}function _e(e,t){return k(e,t[0],t[1])}function be(e,t){return{node:e,index:0,__prev:t}}function xe(e,t,n,r){var i=Object.create(zn);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ke(){return Un||(Un=xe(0))}function we(e,t,n){var r,i;if(e._root){var o=c(gn),a=c(yn);if(r=Ee(e._root,e.__ownerID,0,void 0,t,n,o,a),!a.value)return e;i=e.size+(o.value?n===vn?-1:1:0)}else{if(n===vn)return e;i=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?xe(i,r):ke()}function Ee(e,t,n,r,i,o,a,s){return e?e.update(t,n,r,i,o,a,s):o===vn?e:(p(s),p(a),new ge(t,r,[i,o]))}function Se(e){return e.constructor===ge||e.constructor===ve}function Ce(e,t,n,r,i){if(e.keyHash===r)return new ve(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&mn,s=(0===n?r:r>>>n)&mn;return new de(t,1<>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new me(e,o+1,a)}function Te(e,t,r){for(var i=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function Re(e,t,n,r){var i=r?e:h(e);return i[t]=n,i}function Be(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;s0&&io?0:o-n,l=a-n;return l>dn&&(l=dn),function(){if(i===l)return Kn;var e=t?--l:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,l=i>o?0:o-i>>r,c=1+(a-i>>r);return c>dn&&(c=dn),function(){for(;;){if(s){var e=s();if(e!==Kn)return e;s=null}if(l===c)return Kn;var o=t?--c:l++;s=n(u&&u[o],r-hn,i+(o<=e.size||t<0)return e.withMutations(function(e){t<0?Ke(e,t).set(0,n):Ke(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,o=c(yn);return t>=$e(e._capacity)?r=Ge(r,e.__ownerID,0,t,n,o):i=Ge(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):We(e._origin,e._capacity,e._level,i,r):e}function Ge(e,t,n,r,i,o){var a=r>>>n&mn,s=e&&a0){var l=e&&e.array[a],c=Ge(l,t,n-hn,r,i,o);return c===l?e:(u=Je(e,t),u.array[a]=c,u)}return s&&e.array[a]===i?e:(p(o),u=Je(e,t),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Je(e,t){return t&&e&&t===e.ownerID?e:new ze(e?e.array.slice():[],t)}function Xe(e,t){if(t>=$e(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&mn],r-=hn;return n}}function Ke(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,i=e._origin,o=e._capacity,a=i+t,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return e;if(a>=s)return e.clear();for(var u=e._level,l=e._root,c=0;a+c<0;)l=new ze(l&&l.array.length?[void 0,l]:[],r),u+=hn,c+=1<=1<p?new ze([],r):d;if(d&&h>p&&ahn;g-=hn){var y=p>>>g&mn;v=v.array[y]=Je(v.array[y],r)}v.array[p>>>hn&mn]=d}if(s=h)a-=h,s-=h,u=hn,l=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>>u&mn;if(_!==h>>>u&mn)break;_&&(c+=(1<i&&(l=l.removeBefore(r,u,a-c)),l&&ha&&(a=l.size),o(u)||(l=l.map(function(e){return H(e)})),i.push(l)}return a>e.size&&(e=e.setSize(a)),Ie(e,t,i)}function $e(e){return e>>hn<=dn&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):et(r,i)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function st(e){var t=Dt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ot,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===xn){var r=e.__iterator(t,n);return new x(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===bn?_n:bn,n)},t}function ut(e,t,n){var r=Dt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,vn);return o===vn?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return!1!==r(t.call(n,e,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(xn,i);return new x(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return k(r,s,t.call(n,a[1],s,e),i)})},r}function lt(e,t){var n=Dt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=st(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ot,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ct(e,t,n,r){var i=Dt(e);return r&&(i.has=function(r){var i=e.get(r,vn);return i!==vn&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,vn);return o!==vn&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){if(t.call(n,e,o,u))return s++,i(e,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(xn,o),s=0;return new x(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,l=u[0],c=u[1];if(t.call(n,c,l,e))return k(i,r?l:s++,c,o)}})},i}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),i=(l(e)?Ze():pe()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=At(e);return i.map(function(t){return Et(e,o(t))})}function ht(e,t,n,r){var i=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=i:n|=0),g(t,n,i))return e;var o=y(t,i),a=_(n,i);if(o!==o||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var s,u=a-o;u===u&&(s=u<0?0:u);var l=Dt(e);return l.size=0===s?s:e.size&&s||void 0,!r&&B(e)&&s>=0&&(l.get=function(t,n){return t=m(this,t),t>=0&&ts)return w();var e=i.next();return r||t===bn?e:t===_n?k(t,u-1,void 0,e):k(t,u-1,e.value[1],e)})},l}function dt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(xn,i),s=!0;return new x(function(){if(!s)return w();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],l=i[1];return t.call(n,l,u,o)?r===xn?e:k(r,u,l,e):(s=!1,w())})},r}function mt(e,t,n,r){var i=Dt(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,l){if(!s||!(s=t.call(n,e,o,l)))return u++,i(e,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(xn,o),u=!0,l=0;return new x(function(){var e,o,c;do{if(e=s.next(),e.done)return r||i===bn?e:i===_n?k(i,l++,void 0,e):k(i,l++,e.value[1],e);var p=e.value;o=p[0],c=p[1],u&&(u=t.call(n,c,o,a))}while(u);return i===xn?e:k(i,o,c,e)})},i}function vt(e,t){var r=a(e),i=[e].concat(t).map(function(e){return o(e)?r&&(e=n(e)):e=r?L(e):q(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===i.length)return e;if(1===i.length){var u=i[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var l=new I(i);return r?l=l.toKeyedSeq():s(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=i.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function gt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){function a(e,l){var c=this;e.__iterate(function(e,i){return(!t||l0}function wt(e,n,r){var i=Dt(e);return i.size=new I(r).map(function(e){return e.size}).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(bn,t),i=0;!(n=r.next()).done&&!1!==e(n.value,i++,this););return i},i.__iteratorUncached=function(e,i){var o=r.map(function(e){return e=t(e),C(i?e.reverse():e)}),a=0,s=!1;return new x(function(){var t;return s||(t=o.map(function(e){return e.next()}),s=t.some(function(e){return e.done})),s?w():k(e,a++,n.apply(null,t.map(function(e){return e.value})))})},i}function Et(e,t){return B(e)?t:e.constructor(t)}function St(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return ce(e.size),d(e)}function At(e){return a(e)?n:s(e)?r:i}function Dt(e){return Object.create((a(e)?T:s(e)?M:P).prototype)}function Ot(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):O.prototype.cacheResult.call(this)}function Tt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+sn(oe(e),oe(t))|0}:function(e,t){r=r+sn(oe(e),oe(t))|0}:t?function(e){r=31*r+oe(e)|0}:function(e){r=r+oe(e)|0}),r)}function an(e,t){return t=Tn(t,3432918353),t=Tn(t<<15|t>>>-15,461845907),t=Tn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Tn(t^t>>>16,2246822507),t=Tn(t^t>>>13,3266489909),t=ie(t^t>>>16)}function sn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var un=Array.prototype.slice;e(n,t),e(r,t),e(i,t),t.isIterable=o,t.isKeyed=a,t.isIndexed=s,t.isAssociative=u,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=i;var ln="@@__IMMUTABLE_ITERABLE__@@",cn="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?w():k(e,i,n[t?r-i++:i++])})},e(F,T),F.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},F.prototype.has=function(e){return this._object.hasOwnProperty(e)},F.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var a=r[t?i-o:o];if(!1===e(n[a],a,this))return o+1}return o},F.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,o=0;return new x(function(){var a=r[t?i-o:o];return o++>i?w():k(e,a,n[a])})},F.prototype[fn]=!0,e(N,M),N.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=C(n),i=0;if(S(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,i++,this););return i},N.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=C(n);if(!S(r))return new x(w);var i=0;return new x(function(){var t=r.next();return t.done?t:k(e,i++,t.value)})},e(R,M),R.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return k(e,i,r[i++])})};var Cn;e($,M),$.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$.prototype.get=function(e,t){return this.has(e)?this._value:t},$.prototype.includes=function(e){return K(this._value,e)},$.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:new $(this._value,_(t,n)-y(e,n))},$.prototype.reverse=function(){return this},$.prototype.indexOf=function(e){return K(this._value,e)?0:-1},$.prototype.lastIndexOf=function(e){return K(this._value,e)?this.size:-1},$.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?w():k(e,o++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:Y(this,e)};var Dn;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var On,Tn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Mn=Object.isExtensible,Pn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),In="function"==typeof WeakMap;In&&(On=new WeakMap);var Fn=0,Nn="__immutablehash__";"function"==typeof Symbol&&(Nn=Symbol(Nn));var Rn=16,Bn=255,jn=0,Ln={};e(pe,te),pe.of=function(){var e=un.call(arguments,0);return ke().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return we(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,vn,function(){return t})},pe.prototype.remove=function(e){return we(this,e,vn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return vn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Fe(this,Mt(e),t,n);return r===vn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ke()},pe.prototype.merge=function(){return Te(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Te(this,e,un.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Te(this,Me,arguments)},pe.prototype.mergeDeepWith=function(e){var t=un.call(arguments,1);return Te(this,Pe(e),t)},pe.prototype.mergeDeepIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(bt(this,e))},pe.prototype.sortBy=function(e,t){return Ze(bt(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ye(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xe(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var qn="@@__IMMUTABLE_MAP__@@",zn=pe.prototype;zn[qn]=!0,zn.delete=zn.remove,zn.removeIn=zn.deleteIn,he.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;o=Wn)return Ae(e,u,r,i);var d=e&&e===this.ownerID,m=d?u:h(u);return f?s?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new he(e,m)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=1<<((0===e?t:t>>>e)&mn),o=this.bitmap;return 0==(o&i)?r:this.nodes[Ne(o&i-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=1<=Vn)return Oe(e,f,l,s,d);if(c&&!d&&2===f.length&&Se(f[1^p]))return f[1^p];if(c&&d&&1===f.length&&Se(d))return d;var m=e&&e===this.ownerID,v=c?d?l:l^u:l|u,g=c?d?Re(f,p,d,m):je(f,p,m):Be(f,p,d,m);return m?(this.bitmap=v,this.nodes=g,this):new de(e,v,g)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=(0===e?t:t>>>e)&mn,o=this.nodes[i];return o?o.get(e+hn,t,n,r):r},me.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=i===vn,l=this.nodes,c=l[s];if(u&&!c)return this;var p=Ee(c,e,t+hn,n,r,i,o,a);if(p===c)return this;var f=this.count;if(c){if(!p&&--f=0&&e>>t&mn;if(r>=this.array.length)return new ze([],e);var i,o=0===r;if(t>0){var a=this.array[r];if((i=a&&a.removeBefore(e,t-hn,n))===a&&o)return this}if(o&&!i)return this;var s=Je(this,e);if(!o)for(var u=0;u>>t&mn;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if((i=o&&o.removeAfter(e,t-hn,n))===o&&r===this.array.length-1)return this}var a=Je(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Xn,Kn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,vn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var Yn;e(rt,T),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=ut(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Ct(this):0,function(i){return e(i,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(bn,t),r=t?Ct(this):0;return new x(function(){var i=n.next();return i.done?i:k(e,t?--r:r++,i.value,i)})},rt.prototype[fn]=!0,e(it,M),it.prototype.includes=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t),r=0;return new x(function(){var t=n.next();return t.done?t:k(e,r++,t.value,t)})},e(ot,P),ot.prototype.has=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){var t=n.next();return t.done?t:k(e,t.value,t.value,t)})},e(at,T),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){St(t);var r=o(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){St(r);var i=o(r);return k(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},it.prototype.cacheResult=rt.prototype.cacheResult=ot.prototype.cacheResult=at.prototype.cacheResult=Ot,e(Pt,te),Pt.prototype.toString=function(){return this.__toString(Ft(this)+" {","}")},Pt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Pt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Pt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=It(this,ke()))},Pt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Ft(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:It(this,n)},Pt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:It(this,t)},Pt.prototype.wasAltered=function(){return this._map.wasAltered()},Pt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Pt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Pt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?It(this,t,e):(this.__ownerID=e,this._map=t,this)};var $n=Pt.prototype;$n.delete=$n.remove,$n.deleteIn=$n.removeIn=zn.removeIn,$n.merge=zn.merge,$n.mergeWith=zn.mergeWith,$n.mergeIn=zn.mergeIn,$n.mergeDeep=zn.mergeDeep,$n.mergeDeepWith=zn.mergeDeepWith,$n.mergeDeepIn=zn.mergeDeepIn,$n.setIn=zn.setIn,$n.update=zn.update,$n.updateIn=zn.updateIn,$n.withMutations=zn.withMutations,$n.asMutable=zn.asMutable,$n.asImmutable=zn.asImmutable,e(Bt,re),Bt.of=function(){return this(arguments)},Bt.fromKeys=function(e){return this(n(e).keySeq())},Bt.prototype.toString=function(){return this.__toString("Set {","}")},Bt.prototype.has=function(e){return this._map.has(e)},Bt.prototype.add=function(e){return Lt(this,this._map.set(e,!0))},Bt.prototype.remove=function(e){return Lt(this,this._map.remove(e))},Bt.prototype.clear=function(){return Lt(this,this._map.clear())},Bt.prototype.union=function(){var e=un.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Xt(e,t)},Gt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ce(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Xt(t,n)},Gt.prototype.pop=function(){return this.slice(1)},Gt.prototype.unshift=function(){return this.push.apply(this,arguments)},Gt.prototype.unshiftAll=function(e){return this.pushAll(e)},Gt.prototype.shift=function(){return this.pop.apply(this,arguments)},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Kt()},Gt.prototype.slice=function(e,t){if(g(e,t,this.size))return this;var n=y(e,this.size);if(_(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Xt(r,i)},Gt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Xt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Gt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Gt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new x(function(){if(r){var t=r.value;return r=r.next,k(e,n++,t)}return w()})},Gt.isStack=Jt;var rr="@@__IMMUTABLE_STACK__@@",ir=Gt.prototype;ir[rr]=!0,ir.withMutations=zn.withMutations,ir.asMutable=zn.asMutable,ir.asImmutable=zn.asImmutable,ir.wasAltered=zn.wasAltered;var or;t.Iterator=x,Yt(t,{toArray:function(){ce(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new it(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ce(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Ut(a(this)?this.valueSeq():this)},toSet:function(){return Bt(a(this)?this.valueSeq():this)},toSetSeq:function(){return new ot(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Gt(a(this)?this.valueSeq():this)},toList:function(){return Le(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Et(this,vt(this,un.call(arguments,0)))},includes:function(e){return this.some(function(t){return K(t,e)})},entries:function(){return this.__iterator(xn)},every:function(e,t){ce(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!e.call(t,r,i,o))return n=!1,!1}),n},filter:function(e,t){return Et(this,ct(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ce(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ce(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(_n)},map:function(e,t){return Et(this,ut(this,e,t))},reduce:function(e,t,n){ce(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,o,a){i?(i=!1,r=t):r=e.call(n,r,t,o,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Et(this,lt(this,!0))},slice:function(e,t){return Et(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Et(this,bt(this,e))},values:function(){return this.__iterator(bn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return Y(this,e)},entrySeq:function(){var e=this;if(e._cache)return new I(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,i,o){if(e.call(t,n,i,o))return r=[i,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(v)},flatMap:function(e,t){return Et(this,yt(this,e,t))},flatten:function(e){return Et(this,gt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return K(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,i=Mt(e);!(n=i.next()).done;){var o=n.value;if((r=r&&r.get?r.get(o,vn):vn)===vn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,vn)!==vn},hasIn:function(e){return this.getIn(e,vn)!==vn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return K(t,e)})},keySeq:function(){return this.toSeq().map($t).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return xt(this,e)},maxBy:function(e,t){return xt(this,t,e)},min:function(e){return xt(this,e?en(e):rn)},minBy:function(e,t){return xt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Et(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Et(this,mt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Et(this,bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Et(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Et(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[En]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,Yt(n,{flip:function(){return Et(this,st(this))},mapEntries:function(e,t){var n=this,r=0;return Et(this,this.toSeq().map(function(i,o){return e.call(t,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Et(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var sr=n.prototype;return sr[cn]=!0,sr[En]=ar.entries,sr.__toJS=ar.toObject,sr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},Yt(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Et(this,ct(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Et(this,lt(this,!1))},slice:function(e,t){return Et(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=y(e,e<0?this.count():this.size);var r=this.slice(0,e);return Et(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Et(this,gt(this,e,!1))},get:function(e,t){return e=m(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=m(this,e))>=0&&(void 0!==this.size?this.size===1/0||e5e3)return e.textContent;return function(e){for(var n,r,i,o,a,s=e.textContent,u=0,l=s[0],c=1,p=e.innerHTML="",f=0;r=n,n=f<7&&"\\"==n?1:c;){if(c=l,l=s[++u],o=p.length>1,!c||f>8&&"\n"==c||[/\S/.test(c),1,1,!/[$\w]/.test(c),("/"==n||"\n"==n)&&o,'"'==n&&o,"'"==n&&o,s[u-4]+r+n=="--\x3e",r+n=="*/"][f])for(p&&(e.appendChild(a=t.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][f?f<3?2:f>6?4:f>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/.test(p):0]),a.appendChild(t.createTextNode(p))),i=f&&f<7?f:i,p="",f=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/.test(c),/[\])]/.test(c),/[$\w]/.test(c),"/"==c&&i<2&&"<"!=n,'"'==c,"'"==c,c+l+s[u+1]+s[u+2]=="\x3c!--",c+l=="/*",c+l=="//","#"==c][--f];);p+=c}}(e)}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:j.default.Map();if(!j.default.Map.isMap(e)||!e.size)return j.default.List();if(Array.isArray(t)||(t=[t]),t.length<1)return e.merge(n);var r=j.default.List(),i=t[0],o=!0,a=!1,s=void 0;try{for(var u,l=(0,T.default)(e.entries());!(o=(u=l.next()).done);o=!0){var c=u.value,p=(0,D.default)(c,2),f=p[0],h=p[1],d=b(h,t.slice(1),n.set(i,f));r=j.default.List.isList(d)?r.concat(d):r.push(d)}}catch(e){a=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}function x(e){return(0,W.default)((0,z.default)(e))}function k(e){return x(e.replace(/\.[^.\/]*$/,""))}function w(e){return"string"!=typeof e||""===e?"":(0,L.sanitizeUrl)(e)}function E(e){if(!j.default.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find(function(e,t){return t.startsWith("2")&&(0,F.default)(e.get("content")||{}).length>0}),n=e.get("default")||j.default.OrderedMap(),r=(n.get("content")||j.default.OrderedMap()).keySeq().toJS(),i=r.length?n:null;return t||i}Object.defineProperty(t,"__esModule",{value:!0}),t.escapeDeepLinkPath=t.createDeepLinkPath=t.shallowEqualKeys=t.buildFormData=t.sorters=t.btoa=t.parseSearch=t.getSampleSchema=t.validateParam=t.validatePattern=t.validateMinLength=t.validateMaxLength=t.validateGuid=t.validateDateTime=t.validateString=t.validateBoolean=t.validateFile=t.validateInteger=t.validateNumber=t.validateMinimum=t.validateMaximum=t.propChecker=t.errorLog=t.memoize=t.isImmutable=void 0;var S=n(42),C=r(S),A=n(16),D=r(A),O=n(89),T=r(O),M=n(31),P=r(M),I=n(49),F=r(I),N=n(43),R=r(N);t.isJSONObject=i,t.objectify=o,t.arrayify=a,t.fromJSOrdered=s,t.bindToState=u,t.normalizeArray=l,t.isFn=c,t.isObject=p,t.isFunc=f,t.isArray=h,t.objMap=d,t.objReduce=m,t.systemThunkMiddleware=v,t.defaultStatusCode=g,t.getList=y,t.highlight=_,t.mapToList=b,t.pascalCase=x,t.pascalCaseFilename=k,t.sanitizeUrl=w,t.getAcceptControllingResponse=E;var B=n(8),j=r(B),L=n(471),q=n(881),z=r(q),U=n(406),W=r(U),V=n(403),H=r(V),G=n(215),J=r(G),X=n(897),K=r(X),Y=n(113),$=r(Y),Z=n(161),Q=n(48),ee=r(Q),te=n(639),ne=r(te),re="default",ie=t.isImmutable=function(e){return j.default.Iterable.isIterable(e)},oe=(t.memoize=H.default,t.errorLog=function(e){return function(){return function(t){return function(n){try{t(n)}catch(t){e().errActions.newThrownErr(t,n)}}}}},t.propChecker=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return(0,F.default)(e).length!==(0,F.default)(t).length||((0,K.default)(e,function(e,n){if(r.includes(n))return!1;var i=t[n];return j.default.Iterable.isIterable(e)?!j.default.is(e,i):("object"!==(void 0===e?"undefined":(0,R.default)(e))||"object"!==(void 0===i?"undefined":(0,R.default)(i)))&&e!==i})||n.some(function(n){return!(0,$.default)(e[n],t[n])}))},t.validateMaximum=function(e,t){if(e>t)return"Value must be less than Maximum"}),ae=t.validateMinimum=function(e,t){if(et)return"Value must be less than MaxLength"},me=t.validateMinLength=function(e,t){if(e.length2&&void 0!==arguments[2]&&arguments[2],r=[],i=t&&"body"===e.get("in")?e.get("value_xml"):e.get("value"),o=e.get("required"),a=n?e.get("schema"):e,s=a.get("maximum"),u=a.get("minimum"),l=a.get("type"),c=a.get("format"),p=a.get("maxLength"),f=a.get("minLength"),h=a.get("pattern");if(l&&(o||i)){var d="string"===l&&i,m="array"===l&&Array.isArray(i)&&i.length,v="array"===l&&j.default.List.isList(i)&&i.count(),g="file"===l&&i instanceof ee.default.File,y="boolean"===l&&(i||!1===i),_="number"===l&&(i||0===i),b="integer"===l&&(i||0===i);if(o&&!(d||m||v||g||y||_||b))return r.push("Required field is not provided"),r;if(h){var x=ve(i,h);x&&r.push(x)}if(p||0===p){var k=de(i,p);k&&r.push(k)}if(f){var w=me(i,f);w&&r.push(w)}if(s||0===s){var E=oe(i,s);E&&r.push(E)}if(u||0===u){var S=ae(i,u);S&&r.push(S)}if("string"===l){var C=void 0;if(!(C="date-time"===c?fe(i):"uuid"===c?he(i):pe(i)))return r;r.push(C)}else if("boolean"===l){var A=ce(i);if(!A)return r;r.push(A)}else if("number"===l){var D=se(i);if(!D)return r;r.push(D)}else if("integer"===l){var O=ue(i);if(!O)return r;r.push(O)}else if("array"===l){var T=void 0;if(!i.count())return r;T=a.getIn(["items","type"]),i.forEach(function(e,t){var n=void 0;"number"===T?n=se(e):"integer"===T?n=ue(e):"string"===T&&(n=pe(e)),n&&r.push({index:t,error:n})})}else if("file"===l){var M=le(i);if(!M)return r;r.push(M)}}return r},t.getSampleSchema=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return(0,Z.memoizedCreateXMLExample)(e,n)}return(0,C.default)((0,Z.memoizedSampleFromSchema)(e,n),null,2)},t.parseSearch=function(){var e={},t=window.location.search;if(""!=t){var n=t.substr(1).split("&");for(var r in n)r=n[r].split("="),e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e},t.btoa=function(t){var n=void 0;return n=t instanceof e?t:new e(t.toString(),"utf-8"),n.toString("base64")},t.sorters={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},t.buildFormData=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},t.shallowEqualKeys=function(e,t,n){return!!(0,J.default)(n,function(n){return(0,$.default)(e[n],t[n])})},t.createDeepLinkPath=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"_"):""});t.escapeDeepLinkPath=function(e){return(0,ne.default)(ge(e))}}).call(t,n(50).Buffer)},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=r(e),l=1;l=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function l(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e,t){var n=0;return o(y,t)?y[t]:35===t.charCodeAt(0)&&g.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?l(n):e}function p(e){return e.indexOf("&")<0?e:e.replace(v,c)}function f(e){return x[e]}function h(e){return _.test(e)?e.replace(b,f):e}var d=Object.prototype.hasOwnProperty,m=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,v=/&([a-z#][a-z0-9]{1,31});/gi,g=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,y=n(455),_=/[&<>"]/,b=/[&<>"]/g,x={"&":"&","<":"<",">":">",'"':"""};t.assign=a,t.isString=i,t.has=o,t.unescapeMd=s,t.isValidEntityCode=u,t.fromCodePoint=l,t.replaceEntities=p,t.escapeHtml=h},function(e,t,n){var r=n(342)("wks"),i=n(194),o=n(28).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";function r(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":e instanceof b.Iterable?"Immutable."+e.toSource().split(" ")[0]:t}function i(e){function t(t,n,r,i,o,a){for(var s=arguments.length,u=Array(s>6?s-6:0),l=6;l5?l-5:0),p=5;p5?a-5:0),u=5;u key("+c[p]+")"].concat(s));if(h instanceof Error)return h}}return i(t)}function u(e){return a(e,"List",b.List.isList)}function l(e,t,n,r){function o(){for(var i=arguments.length,o=Array(i),u=0;u5?s-5:0),l=5;l5?l-5:0),p=5;p>",k={listOf:u,mapOf:c,orderedMapOf:p,setOf:f,orderedSetOf:h,stackOf:d,iterableOf:m,recordOf:v,shape:y,contains:y,mapContains:_,list:o("List",b.List.isList),map:o("Map",b.Map.isMap),orderedMap:o("OrderedMap",b.OrderedMap.isOrderedMap),set:o("Set",b.Set.isSet),orderedSet:o("OrderedSet",b.OrderedSet.isOrderedSet),stack:o("Stack",b.Stack.isStack),seq:o("Seq",b.Seq.isSeq),record:o("Record",function(e){return e instanceof b.Record}),iterable:o("Iterable",b.Iterable.isIterable)};e.exports=k},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return function(){return e}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.get("openapi");return!!t&&t.startsWith("3.0.0")}function o(e){var t=e.get("swagger");return!!t&&t.startsWith("2")}function a(e){return function(t,n){return function(r){if(n&&n.specSelectors&&n.specSelectors.specJson){return i(n.specSelectors.specJson())?c.default.createElement(e,(0,u.default)({},r,n,{Ori:t})):c.default.createElement(t,r)}return console.warn("OAS3 wrapper: couldn't get spec"),null}}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(20),u=r(s);t.isOAS3=i,t.isSwagger2=o,t.OAS3ComponentWrapFactory=a;var l=n(0),c=r(l)},function(e,t,n){e.exports={default:n(556),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(27);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&h&&(m=!1,h.length?d=h.concat(d):v=-1,d.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=d.length;t;){for(h=d,d=[];++v1)for(var n=1;n0&&(a=this.buffer[u-1],e.call(r,a)<0);)if(u--,this.pointer-u>n/2-1){o=" ... ",u+=5;break}for(l="",i=this.pointer;in/2-1){l=" ... ",i-=5;break}return""+new Array(t).join(" ")+o+this.buffer.slice(u,i)+l+"\n"+new Array(t+this.pointer-u+o.length).join(" ")+"^"},t.prototype.toString=function(){var e,t;return e=this.get_snippet(),t=" on line "+(this.line+1)+", column "+(this.column+1),e?t:t+":\n"+e},t}(),this.YAMLError=function(e){function n(e){this.message=e,n.__super__.constructor.call(this),this.stack=this.toString()+"\n"+(new Error).stack.split("\n").slice(1).join("\n")}return t(n,e),n.prototype.toString=function(){return this.message},n}(Error),this.MarkedYAMLError=function(e){function n(e,t,r,i,o){this.context=e,this.context_mark=t,this.problem=r,this.problem_mark=i,this.note=o,n.__super__.constructor.call(this)}return t(n,e),n.prototype.toString=function(){var e;return e=[],null!=this.context&&e.push(this.context),null==this.context_mark||null!=this.problem&&null!=this.problem_mark&&this.context_mark.line===this.problem_mark.line&&this.context_mark.column===this.problem_mark.column||e.push(this.context_mark.toString()),null!=this.problem&&e.push(this.problem),null!=this.problem_mark&&e.push(this.problem_mark.toString()),null!=this.note&&e.push(this.note),e.join("\n")},n}(this.YAMLError)}).call(this)},function(e,t,n){e.exports={default:n(555),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(531),o=r(i),a=n(530),s=r(a),u="function"==typeof s.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===u(o.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":u(e)}},function(e,t,n){e.exports=!n(52)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e,t,n){return n?[e,t]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var o in i)if(i.hasOwnProperty(o)){var s=i[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var i=n(12),o=n(65),a=n(29),s=(n(9),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return D(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var l;if(i){var c=-1;for(l=n;ls&&(n=s-u),l=n;l>=0;l--){for(var p=!0,f=0;fi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,l,c,p;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&o)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&o)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function R(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function B(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function j(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return i||j(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,n,r,23,4),n+4}function q(e,t,n,r,i){return i||j(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,n,r,52,8),n+8}function z(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function J(e){return Y.toByteArray(z(e))}function X(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var Y=n(534),$=n(707),Z=n(366);t.Buffer=o,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return a(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return u(null,e,t,n)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,u=Math.min(a,s),l=this.slice(r,i),c=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a1?t-1:0),i=1;i2?n-2:0),o=2;o=n?e:e.length+1===n?""+t+e:""+new Array(n-e.length+1).join(t)+e},this.to_hex=function(e){return"string"==typeof e&&(e=e.charCodeAt(0)),e.toString(16)}}).call(this)}).call(t,n(18))},function(e,t,n){var r=n(101);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=n(668),i=Math.max;e.exports=function(e){return i(0,r(e))}},function(e,t,n){function r(e){return null==e?void 0===e?u:s:(e=Object(e),l&&l in e?o(e):a(e))}var i=n(76),o=n(837),a=n(866),s="[object Null]",u="[object Undefined]",l=i?i.toStringTag:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(795),o=n(838);e.exports=r},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=n(10),i=(n(7),function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)}),o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},s=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},u=function(e){var t=this;e instanceof t||r("25"),e.destructor(),t.instancePool.length`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t){e.exports={}},function(e,t,n){var r=n(172),i=n(169);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(169);e.exports=function(e){return Object(r(e))}},function(e,t){var n=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(132),i=n(341);e.exports=n(99)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(351)();e.exports=function(e){return e!==r&&null!==e}},function(e,t,n){"use strict";function r(e){return void 0===e||null===e}function i(e){return"object"==typeof e&&null!==e}function o(e){return Array.isArray(e)?e:r(e)?[]:[e]}function a(e,t){var n,r,i,o;if(t)for(o=Object.keys(t),n=0,r=o.length;n`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t,n){"use strict";var r=n(12),i=n(441),o=n(1026),a=n(1027),s=n(87),u=n(1028),l=n(1029),c=n(1030),p=n(1034),f=s.createElement,h=s.createFactory,d=s.cloneElement,m=r,v=function(e){return e},g={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:i.Component,PureComponent:i.PureComponent,createElement:f,cloneElement:d,isValidElement:s.isValidElement,PropTypes:u,createClass:c,createFactory:h,createMixin:v,DOM:a,version:l,__spread:m};e.exports=g},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function i(e){return void 0!==e.key}var o=n(12),a=n(47),s=(n(9),n(445),Object.prototype.hasOwnProperty),u=n(443),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,i,o,a){var s={$$typeof:u,type:e,key:t,ref:n,props:a,_owner:o};return s};c.createElement=function(e,t,n){var o,u={},p=null,f=null;if(null!=t){r(t)&&(f=t.ref),i(t)&&(p=""+t.key),void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source;for(o in t)s.call(t,o)&&!l.hasOwnProperty(o)&&(u[o]=t[o])}var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var d=Array(h),m=0;m1){for(var g=Array(v),y=0;y=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(527),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(589);for(var r=n(22),i=n(54),o=n(68),a=n(19)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u0&&void 0!==arguments[0]?arguments[0]:{};return{type:v,payload:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CLEAR=t.NEW_AUTH_ERR=t.NEW_SPEC_ERR_BATCH=t.NEW_SPEC_ERR=t.NEW_THROWN_ERR_BATCH=t.NEW_THROWN_ERR=void 0,t.newThrownErr=r,t.newThrownErrBatch=i,t.newSpecErr=o,t.newSpecErrBatch=a,t.newAuthErr=s,t.clear=u;var l=n(248),c=function(e){return e&&e.__esModule?e:{default:e}}(l),p=t.NEW_THROWN_ERR="err_new_thrown_err",f=t.NEW_THROWN_ERR_BATCH="err_new_thrown_err_batch",h=t.NEW_SPEC_ERR="err_new_spec_err",d=t.NEW_SPEC_ERR_BATCH="err_new_spec_err_batch",m=t.NEW_AUTH_ERR="err_new_auth_err",v=t.CLEAR="err_clear"},function(e,t,n){var r=n(51),i=n(319),o=n(317),a=n(33),s=n(126),u=n(184),l={},c={},t=e.exports=function(e,t,n,p,f){var h,d,m,v,g=f?function(){return e}:u(e),y=r(n,p,t?2:1),_=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(h=s(e.length);h>_;_++)if((v=t?y(a(d=e[_])[0],d[1]):y(e[_]))===l||v===c)return v}else for(m=g.call(e);!(d=m.next()).done;)if((v=i(m,y,d.value,t))===l||v===c)return v};t.BREAK=l,t.RETURN=c},function(e,t){e.exports=!0},function(e,t,n){var r=n(127)("meta"),i=n(27),o=n(53),a=n(37).f,s=0,u=Object.isExtensible||function(){return!0},l=!n(52)(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},p=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[r].i},f=function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[r].w},h=function(e){return l&&d.NEED&&u(e)&&!o(e,r)&&c(e),e},d=e.exports={KEY:r,NEED:!1,fastKey:p,getWeak:f,onFreeze:h}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(180),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(128);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(28),i=n(71),o=n(72),a=n(103),s=n(130),u=function(e,t,n){var l,c,p,f,h=e&u.F,d=e&u.G,m=e&u.S,v=e&u.P,g=e&u.B,y=d?r:m?r[t]||(r[t]={}):(r[t]||{}).prototype,_=d?i:i[t]||(i[t]={}),b=_.prototype||(_.prototype={});d&&(n=t);for(l in n)c=!h&&y&&void 0!==y[l],p=(c?y:n)[l],f=g&&c?s(p,r):v&&"function"==typeof p?s(Function.call,p):p,y&&a(y,l,p,e&u.U),_[l]!=p&&o(_,l,f),v&&b[l]!=p&&(b[l]=p)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){var r=n(59),i=n(609),o=n(627),a=Object.defineProperty;t.f=n(99)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r,i=n(352),o=n(355),a=n(672),s=n(677);r=e.exports=function(e,t){var n,r,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(n=a=!0,r=!1):(n=s.call(e,"c"),r=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:n,enumerable:r,writable:a},u?i(o(u),l):l},r.gs=function(e,t,n){var r,u,l,c;return"string"!=typeof e?(l=n,n=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==n?n=void 0:a(n)||(l=n,n=void 0):(l=t,t=n=void 0),null==e?(r=!0,u=!1):(r=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:n,configurable:r,enumerable:u},l?i(o(l),c):c}},function(e,t,n){"use strict";e.exports=n(669)("forEach")},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(75);e.exports=r.DEFAULT=new r({include:[n(111)],explicit:[n(748),n(747),n(746)]})},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e]/;e.exports=i},function(e,t,n){"use strict";var r,i=n(23),o=n(225),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(233),l=u(function(e,t){if(e.namespaceURI!==o.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(i.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}e.exports=l},function(e,t,n){"use strict";function r(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]="number"==typeof e[n]?e[n]:e[n].val);return t}t.__esModule=!0,t.default=r,e.exports=t.default},function(e,t,n){"use strict";e.exports=function(e,t){var n,r,i,o=-1,a=e.posMax,s=e.pos,u=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=t+1,e.isInLabel=!0,n=1;e.pos1&&void 0!==arguments[1])||arguments[1];return e=(0,s.normalizeArray)(e),{type:p,payload:{thing:e,shown:t}}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=(0,s.normalizeArray)(e),{type:c,payload:{thing:e,mode:t}}}Object.defineProperty(t,"__esModule",{value:!0}),t.SHOW=t.UPDATE_MODE=t.UPDATE_FILTER=t.UPDATE_LAYOUT=void 0,t.updateLayout=r,t.updateFilter=i,t.show=o,t.changeMode=a;var s=n(11),u=t.UPDATE_LAYOUT="layout_update_layout",l=t.UPDATE_FILTER="layout_update_filter",c=t.UPDATE_MODE="layout_update_mode",p=t.SHOW="layout_show"},function(e,t,n){"use strict";function r(e){return{type:u,payload:e}}function i(e){var t=e.value,n=e.pathMethod;return{type:l,payload:{value:t,pathMethod:n}}}function o(e){var t=e.value,n=e.pathMethod;return{type:c,payload:{value:t,pathMethod:n}}}function a(e){var t=e.value,n=e.path,r=e.method;return{type:p,payload:{value:t,path:n,method:r}}}function s(e){var t=e.server,n=e.key,r=e.val;return{type:f,payload:{server:t,key:n,val:r}}}Object.defineProperty(t,"__esModule",{value:!0}),t.setSelectedServer=r,t.setRequestBodyValue=i,t.setRequestContentType=o,t.setResponseContentType=a,t.setServerVariableValue=s;var u=t.UPDATE_SELECTED_SERVER="oas3_set_servers",l=t.UPDATE_REQUEST_BODY_VALUE="oas3_set_request_body_value",c=t.UPDATE_REQUEST_CONTENT_TYPE="oas3_set_request_content_type",p=t.UPDATE_RESPONSE_CONTENT_TYPE="oas3_set_response_content_type",f=t.UPDATE_SERVER_VARIABLE_VALUE="oas3_set_server_variable_value"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=h(e,t);if(n)return(0,s.default)(n,{declaration:!0,indent:"\t"})}Object.defineProperty(t,"__esModule",{value:!0}),t.memoizedSampleFromSchema=t.memoizedCreateXMLExample=t.sampleXmlFromSchema=t.inferSchema=t.sampleFromSchema=void 0,t.createXMLExample=i;var o=n(11),a=n(1125),s=r(a),u=n(910),l=r(u),c={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},p=function(e){e=(0,o.objectify)(e);var t=e,n=t.type,r=t.format,i=c[n+"_"+r]||c[n];return(0,o.isFunc)(i)?i(e):"Unknown Type: "+e.type},f=t.sampleFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.example,s=r.properties,u=r.additionalProperties,l=r.items,c=n.includeReadOnly,f=n.includeWriteOnly;if(void 0!==a)return a;if(!i)if(s)i="object";else{if(!l)return;i="array"}if("object"===i){var h=(0,o.objectify)(s),d={};for(var m in h)h[m].readOnly&&!c||h[m].writeOnly&&!f||(d[m]=e(h[m],n));if(!0===u)d.additionalProp1={};else if(u)for(var v=(0,o.objectify)(u),g=e(v,n),y=1;y<4;y++)d["additionalProp"+y]=g;return d}return"array"===i?[e(l,n)]:t.enum?t.default?t.default:(0,o.normalizeArray)(t.enum)[0]:"file"!==i?p(t):void 0},h=(t.inferSchema=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},t.sampleXmlFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.properties,s=r.additionalProperties,u=r.items,l=r.example,c=n.includeReadOnly,f=n.includeWriteOnly,h=r.default,d={},m={},v=t.xml,g=v.name,y=v.prefix,_=v.namespace,b=r.enum,x=void 0,k=void 0;if(!i)if(a||s)i="object";else{if(!u)return;i="array"}if(g=g||"notagname",x=(y?y+":":"")+g,_){m[y?"xmlns:"+y:"xmlns"]=_}if("array"===i&&u){if(u.xml=u.xml||v||{},u.xml.name=u.xml.name||v.name,v.wrapped)return d[x]=[],Array.isArray(l)?l.forEach(function(t){u.example=t,d[x].push(e(u,n))}):Array.isArray(h)?h.forEach(function(t){u.default=t,d[x].push(e(u,n))}):d[x]=[e(u,n)],m&&d[x].push({_attr:m}),d;var w=[];return Array.isArray(l)?(l.forEach(function(t){u.example=t,w.push(e(u,n))}),w):Array.isArray(h)?(h.forEach(function(t){u.default=t,w.push(e(u,n))}),w):e(u,n)}if("object"===i){var E=(0,o.objectify)(a);d[x]=[],l=l||{};for(var S in E)if((!E[S].readOnly||c)&&(!E[S].writeOnly||f))if(E[S].xml=E[S].xml||{},E[S].xml.attribute){var C=Array.isArray(E[S].enum)&&E[S].enum[0],A=E[S].example,D=E[S].default;m[E[S].xml.name||S]=void 0!==A&&A||void 0!==l[S]&&l[S]||void 0!==D&&D||C||p(E[S])}else{E[S].xml.name=E[S].xml.name||S,E[S].example=void 0!==E[S].example?E[S].example:l[S];var O=e(E[S]);Array.isArray(O)?d[x]=d[x].concat(O):d[x].push(O)}return!0===s?d[x].push({additionalProp:"Anything can be here"}):s&&d[x].push({additionalProp:p(s)}),m&&d[x].push({_attr:m}),d}return k=void 0!==l?l:void 0!==h?h:Array.isArray(b)?b[0]:p(t),d[x]=m?[{_attr:m},k]:k,d});t.memoizedCreateXMLExample=(0,l.default)(i),t.memoizedSampleFromSchema=(0,l.default)(f)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return e instanceof Error?{type:T,error:!0,payload:e}:"string"==typeof e?{type:T,payload:e.replace(/\t/g," ")||""}:{type:T,payload:""}}function o(e){return{type:W,payload:e}}function a(e){return{type:M,payload:e}}function s(e){if(!e||"object"!==(void 0===e?"undefined":(0,k.default)(e)))throw new Error("updateJson must only accept a simple JSON object");return{type:P,payload:e}}function u(e,t,n,r,i){return{type:I,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:i}}}function l(e){return{type:z,payload:{pathMethod:e}}}function c(e,t){return{type:U,payload:{path:e,value:t,key:"consumes_value"}}}function p(e,t){return{type:U,payload:{path:e,value:t,key:"produces_value"}}}function f(e,t){return{type:L,payload:{path:e,method:t}}}function h(e,t){return{type:q,payload:{path:e,method:t}}}function d(e,t,n){return{type:V,payload:{scheme:e,path:t,method:n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.execute=t.executeRequest=t.logRequest=t.setMutatedRequest=t.setRequest=t.setResponse=t.validateParams=t.formatIntoYaml=t.resolveSpec=t.parseToJson=t.SET_SCHEME=t.UPDATE_RESOLVED=t.UPDATE_OPERATION_VALUE=t.ClEAR_VALIDATE_PARAMS=t.CLEAR_REQUEST=t.CLEAR_RESPONSE=t.LOG_REQUEST=t.SET_MUTATED_REQUEST=t.SET_REQUEST=t.SET_RESPONSE=t.VALIDATE_PARAMS=t.UPDATE_PARAM=t.UPDATE_JSON=t.UPDATE_URL=t.UPDATE_SPEC=void 0;var m=n(20),v=r(m),g=n(90),y=r(g),_=n(31),b=r(_),x=n(43),k=r(x);t.updateSpec=i,t.updateResolved=o,t.updateUrl=a,t.updateJsonSpec=s,t.changeParam=u,t.clearValidateParams=l,t.changeConsumesValue=c,t.changeProducesValue=p,t.clearResponse=f,t.clearRequest=h,t.setScheme=d;var w=n(203),E=r(w),S=n(1115),C=r(S),A=n(248),D=r(A),O=n(11),T=t.UPDATE_SPEC="spec_update_spec",M=t.UPDATE_URL="spec_update_url",P=t.UPDATE_JSON="spec_update_json",I=t.UPDATE_PARAM="spec_update_param",F=t.VALIDATE_PARAMS="spec_validate_param",N=t.SET_RESPONSE="spec_set_response",R=t.SET_REQUEST="spec_set_request",B=t.SET_MUTATED_REQUEST="spec_set_mutated_request",j=t.LOG_REQUEST="spec_log_request",L=t.CLEAR_RESPONSE="spec_clear_response",q=t.CLEAR_REQUEST="spec_clear_request",z=t.ClEAR_VALIDATE_PARAMS="spec_clear_validate_param",U=t.UPDATE_OPERATION_VALUE="spec_update_operation_value",W=t.UPDATE_RESOLVED="spec_update_resolved",V=t.SET_SCHEME="set_scheme",H=(t.parseToJson=function(e){return function(t){var n=t.specActions,r=t.specSelectors,i=t.errActions,o=r.specStr,a=null;try{e=e||o(),i.clear({source:"parser"}),a=E.default.safeLoad(e)}catch(e){return console.error(e),i.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return n.updateJsonSpec(a)}},t.resolveSpec=function(e,t){return function(n){var r=n.specActions,i=n.specSelectors,o=n.errActions,a=n.fn,s=a.fetch,u=a.resolve,l=a.AST,c=n.getConfigs,p=c(),f=p.modelPropertyMacro,h=p.parameterMacro,d=p.requestInterceptor,m=p.responseInterceptor;void 0===e&&(e=i.specJson()),void 0===t&&(t=i.url());var v=l.getLineNumberForPath,g=i.specStr();return u({fetch:s,spec:e,baseDoc:t,modelPropertyMacro:f,parameterMacro:h,requestInterceptor:d,responseInterceptor:m}).then(function(e){var t=e.spec,n=e.errors;if(o.clear({type:"thrown"}),n.length>0){var i=n.map(function(e){return console.error(e),e.line=e.fullPath?v(g,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e});o.newThrownErrBatch(i)}return r.updateResolved(t)})}},t.formatIntoYaml=function(){return function(e){var t=e.specActions,n=e.specSelectors,r=n.specStr,i=t.updateSpec;try{var o=E.default.safeDump(E.default.safeLoad(r()),{indent:2});i(o)}catch(e){i(e)}}},t.validateParams=function(e,t){return{type:F,payload:{pathMethod:e,isOAS3:t}}},t.setResponse=function(e,t,n){return{payload:{path:e,method:t,res:n},type:N}},t.setRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:R}},t.setMutatedRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:B}},t.logRequest=function(e){return{payload:e,type:j}},t.executeRequest=function(e){return function(t){var n=t.fn,r=t.specActions,i=t.specSelectors,o=t.getConfigs,a=t.oas3Selectors,s=e.pathName,u=e.method,l=e.operation,c=o(),p=c.requestInterceptor,f=c.responseInterceptor,h=l.toJS();if(e.contextUrl=(0,C.default)(i.url()).toString(),h&&h.operationId?e.operationId=h.operationId:h&&s&&u&&(e.operationId=n.opId(h,s,u)),i.isOAS3()){e.server=a.selectedServer(),e.serverVariables=a.serverVariables(e.server).toJS(),e.requestContentType=a.requestContentType(s,u),e.responseContentType=a.responseContentType(s,u)||"*/*";var d=a.requestBodyValue(s,u);(0,O.isJSONObject)(d)?e.requestBody=JSON.parse(d):e.requestBody=d}var m=(0,b.default)({},e);m=n.buildRequest(m),r.setRequest(e.pathName,e.method,m);var v=function(t){var n=p.apply(this,[t]),i=(0,b.default)({},n);return r.setMutatedRequest(e.pathName,e.method,i),n};e.requestInterceptor=v,e.responseInterceptor=f;var g=Date.now();return n.execute(e).then(function(t){t.duration=Date.now()-g,r.setResponse(e.pathName,e.method,t)}).catch(function(t){return r.setResponse(e.pathName,e.method,{error:!0,err:(0,D.default)(t)})})}},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=(0,y.default)(e,["path","method"]);return function(e){var i=e.fn.fetch,o=e.specSelectors,a=e.specActions,s=o.spec().toJS(),u=o.operationScheme(t,n),l=o.contentTypeValues([t,n]).toJS(),c=l.requestContentType,p=l.responseContentType,f=/xml/i.test(c),h=o.parameterValues([t,n],f).toJS();return a.executeRequest((0,v.default)({fetch:i,spec:s,pathName:t,method:n,parameters:h,requestContentType:c,scheme:u,responseContentType:p},r))}});t.execute=H},function(e,t,n){"use strict";var r=n(11),i=n(1136);i.keys().forEach(function(t){if("./index.js"!==t){var n=i(t);e.exports[(0,r.pascalCaseFilename)(t)]=n.default?n.default:n}})},function(e,t,n){"use strict";function r(e){switch(e._type){case"document":case"block_quote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"link":case"image":case"custom_inline":case"custom_block":return!0;default:return!1}}var i=function(e,t){this.current=e,this.entering=!0===t},o=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=r(e);return t&&n?e._firstChild?(this.current=e._firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e._next?(this.current=e._parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:t,node:e}},a=function(e){return{current:e,root:e,entering:!0,next:o,resumeAt:i}},s=function(e,t){this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=null,this._next=null,this._sourcepos=t,this._lastLineBlank=!1,this._open=!0,this._string_content=null,this._literal=null,this._listData={},this._info=null,this._destination=null,this._title=null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=null,this._level=null,this._onEnter=null,this._onExit=null},u=s.prototype;Object.defineProperty(u,"isContainer",{get:function(){return r(this)}}),Object.defineProperty(u,"type",{get:function(){return this._type}}),Object.defineProperty(u,"firstChild",{get:function(){return this._firstChild}}),Object.defineProperty(u,"lastChild",{get:function(){return this._lastChild}}),Object.defineProperty(u,"next",{get:function(){return this._next}}),Object.defineProperty(u,"prev",{get:function(){return this._prev}}),Object.defineProperty(u,"parent",{get:function(){return this._parent}}),Object.defineProperty(u,"sourcepos",{get:function(){return this._sourcepos}}),Object.defineProperty(u,"literal",{get:function(){return this._literal},set:function(e){this._literal=e}}),Object.defineProperty(u,"destination",{get:function(){return this._destination},set:function(e){this._destination=e}}),Object.defineProperty(u,"title",{get:function(){return this._title},set:function(e){this._title=e}}),Object.defineProperty(u,"info",{get:function(){return this._info},set:function(e){this._info=e}}),Object.defineProperty(u,"level",{get:function(){return this._level},set:function(e){this._level=e}}),Object.defineProperty(u,"listType",{get:function(){return this._listData.type},set:function(e){this._listData.type=e}}),Object.defineProperty(u,"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.tight=e}}),Object.defineProperty(u,"listStart",{get:function(){return this._listData.start},set:function(e){this._listData.start=e}}),Object.defineProperty(u,"listDelimiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.delimiter=e}}),Object.defineProperty(u,"onEnter",{get:function(){return this._onEnter},set:function(e){this._onEnter=e}}),Object.defineProperty(u,"onExit",{get:function(){return this._onExit},set:function(e){this._onExit=e}}),s.prototype.appendChild=function(e){e.unlink(),e._parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this._lastChild,this._lastChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.prependChild=function(e){e.unlink(),e._parent=this,this._firstChild?(this._firstChild._prev=e,e._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this._parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,this._prev=null},s.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,e._next&&(e._next._prev=e),e._prev=this,this._next=e,e._parent=this._parent,e._next||(e._parent._lastChild=e)},s.prototype.insertBefore=function(e){e.unlink(),e._prev=this._prev,e._prev&&(e._prev._next=e),e._next=this,this._prev=e,e._parent=this._parent,e._prev||(e._parent._firstChild=e)},s.prototype.walker=function(){return new a(this)},e.exports=s},function(e,t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":typeof(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(51),i=n(172),o=n(70),a=n(126),s=n(569);e.exports=function(e,t){var n=1==e,u=2==e,l=3==e,c=4==e,p=6==e,f=5==e||p,h=t||s;return function(t,s,d){for(var m,v,g=o(t),y=i(g),_=r(s,d,3),b=a(y.length),x=0,k=n?h(t,b):u?h(t,0):void 0;b>x;x++)if((f||x in y)&&(m=y[x],v=_(m,x,g),e))if(n)k[x]=v;else if(v)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:k.push(m)}else if(c)return!1;return p?-1:l||c?c:k}}},function(e,t,n){var r=n(93),i=n(19)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(27),i=n(22).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(93);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(92);e.exports.f=function(e){return new r(e)}},function(e,t,n){var r=n(33),i=n(578),o=n(171),a=n(178)("IE_PROTO"),s=function(){},u=function(){var e,t=n(170)("iframe"),r=o.length;for(t.style.display="none",n(315).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(" + + + + + diff --git a/adapters/mso-openstack-adapters/src/main/resources/static/swagger/oauth2-redirect.html b/adapters/mso-openstack-adapters/src/main/resources/static/swagger/oauth2-redirect.html new file mode 100644 index 0000000000..eb00dc686a --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/resources/static/swagger/oauth2-redirect.html @@ -0,0 +1,60 @@ + + + + + + diff --git a/adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui-bundle.js b/adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui-bundle.js new file mode 100644 index 0000000000..e6e9789ed9 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/main/resources/static/swagger/swagger-ui-bundle.js @@ -0,0 +1,99 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist",t(t.s=1212)}([function(e,t,n){"use strict";e.exports=n(93)},function(e,t,n){e.exports=n(995)()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(332),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function v(){return!0}function g(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function y(e,t){return b(e,t,0)}function _(e,t){return b(e,t,t)}function b(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function x(e){this.next=e}function w(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function k(){return{value:void 0,done:!0}}function E(e){return!!A(e)}function S(e){return e&&"function"==typeof e.next}function C(e){var t=A(e);return t&&t.call(e)}function A(e){var t=e&&(wn&&e[wn]||e[kn]);if("function"==typeof t)return t}function D(e){return e&&"number"==typeof e.length}function O(e){return null===e||void 0===e?B():o(e)?e.toSeq():z(e)}function M(e){return null===e||void 0===e?B().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():L(e)}function T(e){return null===e||void 0===e?B():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():q(e)}function P(e){return(null===e||void 0===e?B():o(e)?a(e)?e.entrySeq():e:q(e)).toSetSeq()}function I(e){this._array=e,this.size=e.length}function R(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function F(e){this._iterable=e,this.size=e.length||e.size}function j(e){this._iterator=e,this._iteratorCache=[]}function N(e){return!(!e||!e[Sn])}function B(){return Cn||(Cn=new I([]))}function L(e){var t=Array.isArray(e)?new I(e).fromEntrySeq():S(e)?new j(e).fromEntrySeq():E(e)?new F(e).fromEntrySeq():"object"==typeof e?new R(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function q(e){var t=U(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function z(e){var t=U(e)||"object"==typeof e&&new R(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function U(e){return D(e)?new I(e):S(e)?new j(e):E(e)?new F(e):void 0}function W(e,t,n,r){var i=e._cache;if(i){for(var o=i.length-1,a=0;a<=o;a++){var s=i[n?o-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function V(e,t,n,r){var i=e._cache;if(i){var o=i.length-1,a=0;return new x(function(){var e=i[n?o-a:a];return a++>o?k():w(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function H(e,t){return t?G(t,e,"",{"":e}):J(e)}function G(e,t,n,r){return Array.isArray(t)?e.call(r,n,T(t).map(function(n,r){return G(e,n,r,t)})):K(t)?e.call(r,n,M(t).map(function(n,r){return G(e,n,r,t)})):t}function J(e){return Array.isArray(e)?T(e).map(J).toList():K(e)?M(e).map(J).toMap():e}function K(e){return e&&(e.constructor===Object||void 0===e.constructor)}function X(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function Y(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&X(i[1],e)&&(n||X(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var c=e;e=t,t=c}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):i?!X(t,e.get(r,vn)):!X(e.get(r,vn),t))return p=!1,!1});return p&&e.size===f}function $(e,t){if(!(this instanceof $))return new $(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(An)return An;An=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function oe(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return ie(n)}if("string"===t)return e.length>jn?ae(e):se(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return ue(e);if("function"==typeof e.toString)return se(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Ln[e];return void 0===t&&(t=se(e),Bn===Nn&&(Bn=0,Ln={}),Bn++,Ln[e]=t),t}function se(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ce(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?we():fe(e)&&!l(e)?e:we().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[qn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ge(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ye(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&be(e._root)}function _e(e,t){return w(e,t[0],t[1])}function be(e,t){return{node:e,index:0,__prev:t}}function xe(e,t,n,r){var i=Object.create(zn);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function we(){return Un||(Un=xe(0))}function ke(e,t,n){var r,i;if(e._root){var o=c(gn),a=c(yn);if(r=Ee(e._root,e.__ownerID,0,void 0,t,n,o,a),!a.value)return e;i=e.size+(o.value?n===vn?-1:1:0)}else{if(n===vn)return e;i=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?xe(i,r):we()}function Ee(e,t,n,r,i,o,a,s){return e?e.update(t,n,r,i,o,a,s):o===vn?e:(p(s),p(a),new ge(t,r,[i,o]))}function Se(e){return e.constructor===ge||e.constructor===ve}function Ce(e,t,n,r,i){if(e.keyHash===r)return new ve(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&mn,s=(0===n?r:r>>>n)&mn;return new de(t,1<>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new me(e,o+1,a)}function Me(e,t,r){for(var i=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function je(e,t,n,r){var i=r?e:h(e);return i[t]=n,i}function Ne(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;s0&&io?0:o-n,l=a-n;return l>dn&&(l=dn),function(){if(i===l)return Xn;var e=t?--l:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,l=i>o?0:o-i>>r,c=1+(a-i>>r);return c>dn&&(c=dn),function(){for(;;){if(s){var e=s();if(e!==Xn)return e;s=null}if(l===c)return Xn;var o=t?--c:l++;s=n(u&&u[o],r-hn,i+(o<=e.size||t<0)return e.withMutations(function(e){t<0?Xe(e,t).set(0,n):Xe(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,o=c(yn);return t>=$e(e._capacity)?r=Ge(r,e.__ownerID,0,t,n,o):i=Ge(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):We(e._origin,e._capacity,e._level,i,r):e}function Ge(e,t,n,r,i,o){var a=r>>>n&mn,s=e&&a0){var l=e&&e.array[a],c=Ge(l,t,n-hn,r,i,o);return c===l?e:(u=Je(e,t),u.array[a]=c,u)}return s&&e.array[a]===i?e:(p(o),u=Je(e,t),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Je(e,t){return t&&e&&t===e.ownerID?e:new ze(e?e.array.slice():[],t)}function Ke(e,t){if(t>=$e(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&mn],r-=hn;return n}}function Xe(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,i=e._origin,o=e._capacity,a=i+t,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return e;if(a>=s)return e.clear();for(var u=e._level,l=e._root,c=0;a+c<0;)l=new ze(l&&l.array.length?[void 0,l]:[],r),u+=hn,c+=1<=1<p?new ze([],r):d;if(d&&h>p&&ahn;g-=hn){var y=p>>>g&mn;v=v.array[y]=Je(v.array[y],r)}v.array[p>>>hn&mn]=d}if(s=h)a-=h,s-=h,u=hn,l=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>>u&mn;if(_!==h>>>u&mn)break;_&&(c+=(1<i&&(l=l.removeBefore(r,u,a-c)),l&&ha&&(a=l.size),o(u)||(l=l.map(function(e){return H(e)})),i.push(l)}return a>e.size&&(e=e.setSize(a)),Ie(e,t,i)}function $e(e){return e>>hn<=dn&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):et(r,i)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function st(e){var t=Dt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ot,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===xn){var r=e.__iterator(t,n);return new x(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===bn?_n:bn,n)},t}function ut(e,t,n){var r=Dt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,vn);return o===vn?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return!1!==r(t.call(n,e,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(xn,i);return new x(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return w(r,s,t.call(n,a[1],s,e),i)})},r}function lt(e,t){var n=Dt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=st(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ot,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ct(e,t,n,r){var i=Dt(e);return r&&(i.has=function(r){var i=e.get(r,vn);return i!==vn&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,vn);return o!==vn&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){if(t.call(n,e,o,u))return s++,i(e,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(xn,o),s=0;return new x(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,l=u[0],c=u[1];if(t.call(n,c,l,e))return w(i,r?l:s++,c,o)}})},i}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),i=(l(e)?Ze():pe()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=At(e);return i.map(function(t){return Et(e,o(t))})}function ht(e,t,n,r){var i=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=i:n|=0),g(t,n,i))return e;var o=y(t,i),a=_(n,i);if(o!==o||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var s,u=a-o;u===u&&(s=u<0?0:u);var l=Dt(e);return l.size=0===s?s:e.size&&s||void 0,!r&&N(e)&&s>=0&&(l.get=function(t,n){return t=m(this,t),t>=0&&ts)return k();var e=i.next();return r||t===bn?e:t===_n?w(t,u-1,void 0,e):w(t,u-1,e.value[1],e)})},l}function dt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(xn,i),s=!0;return new x(function(){if(!s)return k();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],l=i[1];return t.call(n,l,u,o)?r===xn?e:w(r,u,l,e):(s=!1,k())})},r}function mt(e,t,n,r){var i=Dt(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,l){if(!s||!(s=t.call(n,e,o,l)))return u++,i(e,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(xn,o),u=!0,l=0;return new x(function(){var e,o,c;do{if(e=s.next(),e.done)return r||i===bn?e:i===_n?w(i,l++,void 0,e):w(i,l++,e.value[1],e);var p=e.value;o=p[0],c=p[1],u&&(u=t.call(n,c,o,a))}while(u);return i===xn?e:w(i,o,c,e)})},i}function vt(e,t){var r=a(e),i=[e].concat(t).map(function(e){return o(e)?r&&(e=n(e)):e=r?L(e):q(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===i.length)return e;if(1===i.length){var u=i[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var l=new I(i);return r?l=l.toKeyedSeq():s(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=i.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function gt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){function a(e,l){var c=this;e.__iterate(function(e,i){return(!t||l0}function kt(e,n,r){var i=Dt(e);return i.size=new I(r).map(function(e){return e.size}).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(bn,t),i=0;!(n=r.next()).done&&!1!==e(n.value,i++,this););return i},i.__iteratorUncached=function(e,i){var o=r.map(function(e){return e=t(e),C(i?e.reverse():e)}),a=0,s=!1;return new x(function(){var t;return s||(t=o.map(function(e){return e.next()}),s=t.some(function(e){return e.done})),s?k():w(e,a++,n.apply(null,t.map(function(e){return e.value})))})},i}function Et(e,t){return N(e)?t:e.constructor(t)}function St(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return ce(e.size),d(e)}function At(e){return a(e)?n:s(e)?r:i}function Dt(e){return Object.create((a(e)?M:s(e)?T:P).prototype)}function Ot(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):O.prototype.cacheResult.call(this)}function Mt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+sn(oe(e),oe(t))|0}:function(e,t){r=r+sn(oe(e),oe(t))|0}:t?function(e){r=31*r+oe(e)|0}:function(e){r=r+oe(e)|0}),r)}function an(e,t){return t=Mn(t,3432918353),t=Mn(t<<15|t>>>-15,461845907),t=Mn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Mn(t^t>>>16,2246822507),t=Mn(t^t>>>13,3266489909),t=ie(t^t>>>16)}function sn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var un=Array.prototype.slice;e(n,t),e(r,t),e(i,t),t.isIterable=o,t.isKeyed=a,t.isIndexed=s,t.isAssociative=u,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=i;var ln="@@__IMMUTABLE_ITERABLE__@@",cn="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?k():w(e,i,n[t?r-i++:i++])})},e(R,M),R.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},R.prototype.has=function(e){return this._object.hasOwnProperty(e)},R.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var a=r[t?i-o:o];if(!1===e(n[a],a,this))return o+1}return o},R.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,o=0;return new x(function(){var a=r[t?i-o:o];return o++>i?k():w(e,a,n[a])})},R.prototype[fn]=!0,e(F,T),F.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=C(n),i=0;if(S(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,i++,this););return i},F.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=C(n);if(!S(r))return new x(k);var i=0;return new x(function(){var t=r.next();return t.done?t:w(e,i++,t.value)})},e(j,T),j.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return w(e,i,r[i++])})};var Cn;e($,T),$.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$.prototype.get=function(e,t){return this.has(e)?this._value:t},$.prototype.includes=function(e){return X(this._value,e)},$.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:new $(this._value,_(t,n)-y(e,n))},$.prototype.reverse=function(){return this},$.prototype.indexOf=function(e){return X(this._value,e)?0:-1},$.prototype.lastIndexOf=function(e){return X(this._value,e)?this.size:-1},$.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?k():w(e,o++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:Y(this,e)};var Dn;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var On,Mn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Tn=Object.isExtensible,Pn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),In="function"==typeof WeakMap;In&&(On=new WeakMap);var Rn=0,Fn="__immutablehash__";"function"==typeof Symbol&&(Fn=Symbol(Fn));var jn=16,Nn=255,Bn=0,Ln={};e(pe,te),pe.of=function(){var e=un.call(arguments,0);return we().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return ke(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,vn,function(){return t})},pe.prototype.remove=function(e){return ke(this,e,vn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return vn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Re(this,Tt(e),t,n);return r===vn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):we()},pe.prototype.merge=function(){return Me(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Me(this,e,un.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,we(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Me(this,Te,arguments)},pe.prototype.mergeDeepWith=function(e){var t=un.call(arguments,1);return Me(this,Pe(e),t)},pe.prototype.mergeDeepIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,we(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(bt(this,e))},pe.prototype.sortBy=function(e,t){return Ze(bt(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ye(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xe(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var qn="@@__IMMUTABLE_MAP__@@",zn=pe.prototype;zn[qn]=!0,zn.delete=zn.remove,zn.removeIn=zn.deleteIn,he.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;o=Wn)return Ae(e,u,r,i);var d=e&&e===this.ownerID,m=d?u:h(u);return f?s?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new he(e,m)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=1<<((0===e?t:t>>>e)&mn),o=this.bitmap;return 0==(o&i)?r:this.nodes[Fe(o&i-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=1<=Vn)return Oe(e,f,l,s,d);if(c&&!d&&2===f.length&&Se(f[1^p]))return f[1^p];if(c&&d&&1===f.length&&Se(d))return d;var m=e&&e===this.ownerID,v=c?d?l:l^u:l|u,g=c?d?je(f,p,d,m):Be(f,p,m):Ne(f,p,d,m);return m?(this.bitmap=v,this.nodes=g,this):new de(e,v,g)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=(0===e?t:t>>>e)&mn,o=this.nodes[i];return o?o.get(e+hn,t,n,r):r},me.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=i===vn,l=this.nodes,c=l[s];if(u&&!c)return this;var p=Ee(c,e,t+hn,n,r,i,o,a);if(p===c)return this;var f=this.count;if(c){if(!p&&--f=0&&e>>t&mn;if(r>=this.array.length)return new ze([],e);var i,o=0===r;if(t>0){var a=this.array[r];if((i=a&&a.removeBefore(e,t-hn,n))===a&&o)return this}if(o&&!i)return this;var s=Je(this,e);if(!o)for(var u=0;u>>t&mn;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if((i=o&&o.removeAfter(e,t-hn,n))===o&&r===this.array.length-1)return this}var a=Je(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Kn,Xn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,vn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var Yn;e(rt,M),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=ut(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Ct(this):0,function(i){return e(i,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(bn,t),r=t?Ct(this):0;return new x(function(){var i=n.next();return i.done?i:w(e,t?--r:r++,i.value,i)})},rt.prototype[fn]=!0,e(it,T),it.prototype.includes=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t),r=0;return new x(function(){var t=n.next();return t.done?t:w(e,r++,t.value,t)})},e(ot,P),ot.prototype.has=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){var t=n.next();return t.done?t:w(e,t.value,t.value,t)})},e(at,M),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){St(t);var r=o(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){St(r);var i=o(r);return w(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},it.prototype.cacheResult=rt.prototype.cacheResult=ot.prototype.cacheResult=at.prototype.cacheResult=Ot,e(Pt,te),Pt.prototype.toString=function(){return this.__toString(Rt(this)+" {","}")},Pt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Pt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Pt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=It(this,we()))},Pt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Rt(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:It(this,n)},Pt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:It(this,t)},Pt.prototype.wasAltered=function(){return this._map.wasAltered()},Pt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Pt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Pt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?It(this,t,e):(this.__ownerID=e,this._map=t,this)};var $n=Pt.prototype;$n.delete=$n.remove,$n.deleteIn=$n.removeIn=zn.removeIn,$n.merge=zn.merge,$n.mergeWith=zn.mergeWith,$n.mergeIn=zn.mergeIn,$n.mergeDeep=zn.mergeDeep,$n.mergeDeepWith=zn.mergeDeepWith,$n.mergeDeepIn=zn.mergeDeepIn,$n.setIn=zn.setIn,$n.update=zn.update,$n.updateIn=zn.updateIn,$n.withMutations=zn.withMutations,$n.asMutable=zn.asMutable,$n.asImmutable=zn.asImmutable,e(Nt,re),Nt.of=function(){return this(arguments)},Nt.fromKeys=function(e){return this(n(e).keySeq())},Nt.prototype.toString=function(){return this.__toString("Set {","}")},Nt.prototype.has=function(e){return this._map.has(e)},Nt.prototype.add=function(e){return Lt(this,this._map.set(e,!0))},Nt.prototype.remove=function(e){return Lt(this,this._map.remove(e))},Nt.prototype.clear=function(){return Lt(this,this._map.clear())},Nt.prototype.union=function(){var e=un.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Kt(e,t)},Gt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ce(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Kt(t,n)},Gt.prototype.pop=function(){return this.slice(1)},Gt.prototype.unshift=function(){return this.push.apply(this,arguments)},Gt.prototype.unshiftAll=function(e){return this.pushAll(e)},Gt.prototype.shift=function(){return this.pop.apply(this,arguments)},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Xt()},Gt.prototype.slice=function(e,t){if(g(e,t,this.size))return this;var n=y(e,this.size);if(_(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Kt(r,i)},Gt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Kt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Gt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Gt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new x(function(){if(r){var t=r.value;return r=r.next,w(e,n++,t)}return k()})},Gt.isStack=Jt;var rr="@@__IMMUTABLE_STACK__@@",ir=Gt.prototype;ir[rr]=!0,ir.withMutations=zn.withMutations,ir.asMutable=zn.asMutable,ir.asImmutable=zn.asImmutable,ir.wasAltered=zn.wasAltered;var or;t.Iterator=x,Yt(t,{toArray:function(){ce(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new it(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ce(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Ut(a(this)?this.valueSeq():this)},toSet:function(){return Nt(a(this)?this.valueSeq():this)},toSetSeq:function(){return new ot(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Gt(a(this)?this.valueSeq():this)},toList:function(){return Le(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Et(this,vt(this,un.call(arguments,0)))},includes:function(e){return this.some(function(t){return X(t,e)})},entries:function(){return this.__iterator(xn)},every:function(e,t){ce(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!e.call(t,r,i,o))return n=!1,!1}),n},filter:function(e,t){return Et(this,ct(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ce(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ce(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(_n)},map:function(e,t){return Et(this,ut(this,e,t))},reduce:function(e,t,n){ce(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,o,a){i?(i=!1,r=t):r=e.call(n,r,t,o,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Et(this,lt(this,!0))},slice:function(e,t){return Et(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Et(this,bt(this,e))},values:function(){return this.__iterator(bn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return Y(this,e)},entrySeq:function(){var e=this;if(e._cache)return new I(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,i,o){if(e.call(t,n,i,o))return r=[i,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(v)},flatMap:function(e,t){return Et(this,yt(this,e,t))},flatten:function(e){return Et(this,gt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return X(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,i=Tt(e);!(n=i.next()).done;){var o=n.value;if((r=r&&r.get?r.get(o,vn):vn)===vn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,vn)!==vn},hasIn:function(e){return this.getIn(e,vn)!==vn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return X(t,e)})},keySeq:function(){return this.toSeq().map($t).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return xt(this,e)},maxBy:function(e,t){return xt(this,t,e)},min:function(e){return xt(this,e?en(e):rn)},minBy:function(e,t){return xt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Et(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Et(this,mt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Et(this,bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Et(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Et(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[En]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,Yt(n,{flip:function(){return Et(this,st(this))},mapEntries:function(e,t){var n=this,r=0;return Et(this,this.toSeq().map(function(i,o){return e.call(t,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Et(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var sr=n.prototype;return sr[cn]=!0,sr[En]=ar.entries,sr.__toJS=ar.toObject,sr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},Yt(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Et(this,ct(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Et(this,lt(this,!1))},slice:function(e,t){return Et(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=y(e,e<0?this.count():this.size);var r=this.slice(0,e);return Et(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Et(this,gt(this,e,!1))},get:function(e,t){return e=m(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=m(this,e))>=0&&(void 0!==this.size?this.size===1/0||e5e3)return e.textContent;return function(e){for(var n,r,i,o,a,s=e.textContent,u=0,l=s[0],c=1,p=e.innerHTML="",f=0;r=n,n=f<7&&"\\"==n?1:c;){if(c=l,l=s[++u],o=p.length>1,!c||f>8&&"\n"==c||[/\S/.test(c),1,1,!/[$\w]/.test(c),("/"==n||"\n"==n)&&o,'"'==n&&o,"'"==n&&o,s[u-4]+r+n=="--\x3e",r+n=="*/"][f])for(p&&(e.appendChild(a=t.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][f?f<3?2:f>6?4:f>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/.test(p):0]),a.appendChild(t.createTextNode(p))),i=f&&f<7?f:i,p="",f=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/.test(c),/[\])]/.test(c),/[$\w]/.test(c),"/"==c&&i<2&&"<"!=n,'"'==c,"'"==c,c+l+s[u+1]+s[u+2]=="\x3c!--",c+l=="/*",c+l=="//","#"==c][--f];);p+=c}}(e)}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:B.default.Map();if(!B.default.Map.isMap(e)||!e.size)return B.default.List();if(Array.isArray(t)||(t=[t]),t.length<1)return e.merge(n);var r=B.default.List(),i=t[0],o=!0,a=!1,s=void 0;try{for(var u,l=(0,M.default)(e.entries());!(o=(u=l.next()).done);o=!0){var c=u.value,p=(0,D.default)(c,2),f=p[0],h=p[1],d=b(h,t.slice(1),n.set(i,f));r=B.default.List.isList(d)?r.concat(d):r.push(d)}}catch(e){a=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}function x(e){return(0,W.default)((0,z.default)(e))}function w(e){return x(e.replace(/\.[^.\/]*$/,""))}function k(e){return"string"!=typeof e||""===e?"":(0,L.sanitizeUrl)(e)}function E(e){if(!B.default.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find(function(e,t){return t.startsWith("2")&&(0,R.default)(e.get("content")||{}).length>0}),n=e.get("default")||B.default.OrderedMap(),r=(n.get("content")||B.default.OrderedMap()).keySeq().toJS(),i=r.length?n:null;return t||i}Object.defineProperty(t,"__esModule",{value:!0}),t.getExtensions=t.escapeDeepLinkPath=t.createDeepLinkPath=t.shallowEqualKeys=t.buildFormData=t.sorters=t.btoa=t.parseSearch=t.getSampleSchema=t.validateParam=t.validatePattern=t.validateMinLength=t.validateMaxLength=t.validateGuid=t.validateDateTime=t.validateString=t.validateBoolean=t.validateFile=t.validateInteger=t.validateNumber=t.validateMinimum=t.validateMaximum=t.propChecker=t.errorLog=t.memoize=t.isImmutable=void 0;var S=n(35),C=r(S),A=n(17),D=r(A),O=n(96),M=r(O),T=n(36),P=r(T),I=n(47),R=r(I),F=n(48),j=r(F);t.isJSONObject=i,t.objectify=o,t.arrayify=a,t.fromJSOrdered=s,t.bindToState=u,t.normalizeArray=l,t.isFn=c,t.isObject=p,t.isFunc=f,t.isArray=h,t.objMap=d,t.objReduce=m,t.systemThunkMiddleware=v,t.defaultStatusCode=g,t.getList=y,t.highlight=_,t.mapToList=b,t.pascalCase=x,t.pascalCaseFilename=w,t.sanitizeUrl=k,t.getAcceptControllingResponse=E;var N=n(8),B=r(N),L=n(505),q=n(939),z=r(q),U=n(428),W=r(U),V=n(425),H=r(V),G=n(224),J=r(G),K=n(954),X=r(K),Y=n(120),$=r(Y),Z=n(172),Q=n(53),ee=r(Q),te=n(696),ne=r(te),re="default",ie=t.isImmutable=function(e){return B.default.Iterable.isIterable(e)},oe=(t.memoize=H.default,t.errorLog=function(e){return function(){return function(t){return function(n){try{t(n)}catch(t){e().errActions.newThrownErr(t,n)}}}}},t.propChecker=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return(0,R.default)(e).length!==(0,R.default)(t).length||((0,X.default)(e,function(e,n){if(r.includes(n))return!1;var i=t[n];return B.default.Iterable.isIterable(e)?!B.default.is(e,i):("object"!==(void 0===e?"undefined":(0,j.default)(e))||"object"!==(void 0===i?"undefined":(0,j.default)(i)))&&e!==i})||n.some(function(n){return!(0,$.default)(e[n],t[n])}))},t.validateMaximum=function(e,t){if(e>t)return"Value must be less than Maximum"}),ae=t.validateMinimum=function(e,t){if(et)return"Value must be less than MaxLength"},me=t.validateMinLength=function(e,t){if(e.length2&&void 0!==arguments[2]&&arguments[2],r=[],i=t&&"body"===e.get("in")?e.get("value_xml"):e.get("value"),o=e.get("required"),a=n?e.get("schema"):e;if(!a)return r;var s=a.get("maximum"),u=a.get("minimum"),l=a.get("type"),c=a.get("format"),p=a.get("maxLength"),f=a.get("minLength"),h=a.get("pattern");if(l&&(o||i)){var d="string"===l&&i,m="array"===l&&Array.isArray(i)&&i.length,v="array"===l&&B.default.List.isList(i)&&i.count(),g="file"===l&&i instanceof ee.default.File,y="boolean"===l&&(i||!1===i),_="number"===l&&(i||0===i),b="integer"===l&&(i||0===i);if(o&&!(d||m||v||g||y||_||b))return r.push("Required field is not provided"),r;if(h){var x=ve(i,h);x&&r.push(x)}if(p||0===p){var w=de(i,p);w&&r.push(w)}if(f){var k=me(i,f);k&&r.push(k)}if(s||0===s){var E=oe(i,s);E&&r.push(E)}if(u||0===u){var S=ae(i,u);S&&r.push(S)}if("string"===l){var C=void 0;if(!(C="date-time"===c?fe(i):"uuid"===c?he(i):pe(i)))return r;r.push(C)}else if("boolean"===l){var A=ce(i);if(!A)return r;r.push(A)}else if("number"===l){var D=se(i);if(!D)return r;r.push(D)}else if("integer"===l){var O=ue(i);if(!O)return r;r.push(O)}else if("array"===l){var M=void 0;if(!i.count())return r;M=a.getIn(["items","type"]),i.forEach(function(e,t){var n=void 0;"number"===M?n=se(e):"integer"===M?n=ue(e):"string"===M&&(n=pe(e)),n&&r.push({index:t,error:n})})}else if("file"===l){var T=le(i);if(!T)return r;r.push(T)}}return r},t.getSampleSchema=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return(0,Z.memoizedCreateXMLExample)(e,n)}return(0,C.default)((0,Z.memoizedSampleFromSchema)(e,n),null,2)},t.parseSearch=function(){var e={},t=ee.default.location.search;if(!t)return{};if(""!=t){var n=t.substr(1).split("&");for(var r in n)r=n[r].split("="),e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e},t.btoa=function(t){var n=void 0;return n=t instanceof e?t:new e(t.toString(),"utf-8"),n.toString("base64")},t.sorters={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},t.buildFormData=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},t.shallowEqualKeys=function(e,t,n){return!!(0,J.default)(n,function(n){return(0,$.default)(e[n],t[n])})},t.createDeepLinkPath=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"_"):""});t.escapeDeepLinkPath=function(e){return(0,ne.default)(ge(e))},t.getExtensions=function(e){return e.filter(function(e,t){return/^x-/.test(t)})}}).call(t,n(41).Buffer)},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=r(e),l=1;l6?s-6:0),l=6;l5?l-5:0),p=5;p5?a-5:0),u=5;u key("+c[p]+")"].concat(s));if(h instanceof Error)return h}}return i(t)}function u(e){return a(e,"List",b.List.isList)}function l(e,t,n,r){function o(){for(var i=arguments.length,o=Array(i),u=0;u5?s-5:0),l=5;l5?l-5:0),p=5;p>",w={listOf:u,mapOf:c,orderedMapOf:p,setOf:f,orderedSetOf:h,stackOf:d,iterableOf:m,recordOf:v,shape:y,contains:y,mapContains:_,list:o("List",b.List.isList),map:o("Map",b.Map.isMap),orderedMap:o("OrderedMap",b.OrderedMap.isOrderedMap),set:o("Set",b.Set.isSet),orderedSet:o("OrderedSet",b.OrderedSet.isOrderedSet),stack:o("Stack",b.Stack.isStack),seq:o("Seq",b.Seq.isSeq),record:o("Record",function(e){return e instanceof b.Record}),iterable:o("Iterable",b.Iterable.isIterable)};e.exports=w},function(e,t,n){var r=n(24),i=n(14),o=n(54),a=n(57),s=function(e,t,n){var u,l,c,p=e&s.F,f=e&s.G,h=e&s.S,d=e&s.P,m=e&s.B,v=e&s.W,g=f?i:i[t]||(i[t]={}),y=g.prototype,_=f?r:h?r[t]:(r[t]||{}).prototype;f&&(n=t);for(u in n)(l=!p&&_&&void 0!==_[u])&&u in g||(c=l?_[u]:n[u],g[u]=f&&"function"!=typeof _[u]?n[u]:m&&l?o(c,r):v&&_[u]==c?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(c):d&&"function"==typeof c?o(Function.call,c):c,d&&((g.virtual||(g.virtual={}))[u]=c,e&s.R&&y&&!y[u]&&a(y,u,c)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};e.exports=i},function(e,t,n){"use strict";function r(e){return Object.prototype.toString.call(e)}function i(e){return"[object String]"===r(e)}function o(e,t){return!!e&&d.call(e,t)}function a(e){return[].slice.call(arguments,1).forEach(function(t){if(t){if("object"!=typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function s(e){return e.indexOf("\\")<0?e:e.replace(m,"$1")}function u(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function l(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e,t){var n=0;return o(y,t)?y[t]:35===t.charCodeAt(0)&&g.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?l(n):e}function p(e){return e.indexOf("&")<0?e:e.replace(v,c)}function f(e){return x[e]}function h(e){return _.test(e)?e.replace(b,f):e}var d=Object.prototype.hasOwnProperty,m=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,v=/&([a-z#][a-z0-9]{1,31});/gi,g=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,y=n(488),_=/[&<>"]/,b=/[&<>"]/g,x={"&":"&","<":"<",">":">",'"':"""};t.assign=a,t.isString=i,t.has=o,t.unescapeMd=s,t.isValidEntityCode=u,t.fromCodePoint=l,t.replaceEntities=p,t.escapeHtml=h},function(e,t,n){"use strict";t.__esModule=!0;var r=n(562),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t"+i+""};e.exports=function(e,t){var n={};n[e]=t(s),r(r.P+r.F*i(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",n)}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return function(){return e}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&h&&(m=!1,h.length?d=h.concat(d):v=-1,d.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=d.length;t;){for(h=d,d=[];++v1)for(var n=1;n=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return D(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return T(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var l;if(i){var c=-1;for(l=n;ls&&(n=s-u),l=n;l>=0;l--){for(var p=!0,f=0;fi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,l,c,p;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&o)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&o)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function F(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function j(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function B(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return i||B(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,n,r,23,4),n+4}function q(e,t,n,r,i){return i||B(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,n,r,52,8),n+8}function z(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function J(e){return Y.toByteArray(z(e))}function K(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function X(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var Y=n(569),$=n(763),Z=n(387);t.Buffer=o,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return a(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return u(null,e,t,n)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,u=Math.min(a,s),l=this.slice(r,i),c=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return w(this,e,t,n);case"ascii":return k(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||R(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){F(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);F(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);F(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||F(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a0&&(a=this.buffer[u-1],e.call(r,a)<0);)if(u--,this.pointer-u>n/2-1){o=" ... ",u+=5;break}for(l="",i=this.pointer;in/2-1){l=" ... ",i-=5;break}return""+new Array(t).join(" ")+o+this.buffer.slice(u,i)+l+"\n"+new Array(t+this.pointer-u+o.length).join(" ")+"^"},t.prototype.toString=function(){var e,t;return e=this.get_snippet(),t=" on line "+(this.line+1)+", column "+(this.column+1),e?t:t+":\n"+e},t}(),this.YAMLError=function(e){function n(e){this.message=e,n.__super__.constructor.call(this),this.stack=this.toString()+"\n"+(new Error).stack.split("\n").slice(1).join("\n")}return t(n,e),n.prototype.toString=function(){return this.message},n}(Error),this.MarkedYAMLError=function(e){function n(e,t,r,i,o){this.context=e,this.context_mark=t,this.problem=r,this.problem_mark=i,this.note=o,n.__super__.constructor.call(this)}return t(n,e),n.prototype.toString=function(){var e;return e=[],null!=this.context&&e.push(this.context),null==this.context_mark||null!=this.problem&&null!=this.problem_mark&&this.context_mark.line===this.problem_mark.line&&this.context_mark.column===this.problem_mark.column||e.push(this.context_mark.toString()),null!=this.problem&&e.push(this.problem),null!=this.problem_mark&&e.push(this.problem_mark.toString()),null!=this.note&&e.push(this.note),e.join("\n")},n}(this.YAMLError)}).call(this)},function(e,t,n){e.exports={default:n(592),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(566),o=r(i),a=n(565),s=r(a),u="function"==typeof s.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===u(o.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":u(e)}},function(e,t,n){e.exports=!n(55)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e,t,n){return n?[e,t]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var o in i)if(i.hasOwnProperty(o)){var s=i[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var i=n(12),o=n(71),a=n(32),s=(n(9),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n1?t-1:0),i=1;i2?n-2:0),o=2;o=n?e:e.length+1===n?""+t+e:""+new Array(n-e.length+1).join(t)+e},this.to_hex=function(e){return"string"==typeof e&&(e=e.charCodeAt(0)),e.toString(16)}}).call(this)}).call(t,n(16))},function(e,t,n){var r=n(78);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){var n=e.exports={version:"2.5.3"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(138),i=n(360);e.exports=n(106)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(724),i=Math.max;e.exports=function(e){return i(0,r(e))}},function(e,t,n){function r(e){return null==e?void 0===e?u:s:(e=Object(e),l&&l in e?o(e):a(e))}var i=n(83),o=n(895),a=n(924),s="[object Null]",u="[object Undefined]",l=i?i.toStringTag:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(853),o=n(896);e.exports=r},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=n(10),i=(n(7),function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)}),o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},s=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},u=function(e){var t=this;e instanceof t||r("25"),e.destructor(),t.instancePool.length`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t){e.exports={}},function(e,t,n){var r=n(182),i=n(179);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(179);e.exports=function(e){return Object(r(e))}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(31),i=n(65),o=n(108),a=n(203)("src"),s=Function.toString,u=(""+s).split("toString");n(64).inspectSource=function(e){return s.call(e)},(e.exports=function(e,t,n,s){var l="function"==typeof n;l&&(o(n,"name")||i(n,"name",t)),e[t]!==n&&(l&&(o(n,a)||i(n,a,e[t]?""+e[t]:u.join(String(t)))),e===r?e[t]=n:s?e[t]?e[t]=n:i(e,t,n):(delete e[t],i(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[a]||s.call(this)})},function(e,t,n){"use strict";var r=n(372)();e.exports=function(e){return e!==r&&null!==e}},function(e,t,n){"use strict";function r(e){return void 0===e||null===e}function i(e){return"object"==typeof e&&null!==e}function o(e){return Array.isArray(e)?e:r(e)?[]:[e]}function a(e,t){var n,r,i,o;if(t)for(o=Object.keys(t),n=0,r=o.length;n`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t,n){"use strict";var r=n(12),i=n(474),o=n(1098),a=n(1099),s=n(94),u=n(1100),l=n(1101),c=n(1102),p=n(1106),f=s.createElement,h=s.createFactory,d=s.cloneElement,m=r,v=function(e){return e},g={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:i.Component,PureComponent:i.PureComponent,createElement:f,cloneElement:d,isValidElement:s.isValidElement,PropTypes:u,createClass:c,createFactory:h,createMixin:v,DOM:a,version:l,__spread:m};e.exports=g},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function i(e){return void 0!==e.key}var o=n(12),a=n(52),s=(n(9),n(478),Object.prototype.hasOwnProperty),u=n(476),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,i,o,a){var s={$$typeof:u,type:e,key:t,ref:n,props:a,_owner:o};return s};c.createElement=function(e,t,n){var o,u={},p=null,f=null;if(null!=t){r(t)&&(f=t.ref),i(t)&&(p=""+t.key),void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source;for(o in t)s.call(t,o)&&!l.hasOwnProperty(o)&&(u[o]=t[o])}var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var d=Array(h),m=0;m1){for(var g=Array(v),y=0;y=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(345),i=n(181);e.exports=Object.keys||function(e){return r(e,i)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(42).f,i=n(56),o=n(21)("toStringTag");e.exports=function(e,t,n){e&&!i(e=n?e:e.prototype,o)&&r(e,o,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r=n(616)(!0);n(339)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(621);for(var r=n(24),i=n(57),o=n(75),a=n(21)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u0?i(r(e),9007199254740991):0}},function(e,t,n){(function(e){function n(e){return Array.isArray?Array.isArray(e):"[object Array]"===v(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function a(e){return"number"==typeof e}function s(e){return"string"==typeof e}function u(e){return"symbol"==typeof e}function l(e){return void 0===e}function c(e){return"[object RegExp]"===v(e)}function p(e){return"object"==typeof e&&null!==e}function f(e){return"[object Date]"===v(e)}function h(e){return"[object Error]"===v(e)||e instanceof Error}function d(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function v(e){return Object.prototype.toString.call(e)}t.isArray=n,t.isBoolean=r,t.isNull=i,t.isNullOrUndefined=o,t.isNumber=a,t.isString=s,t.isSymbol=u,t.isUndefined=l,t.isRegExp=c,t.isObject=p,t.isDate=f,t.isError=h,t.isFunction=d,t.isPrimitive=m,t.isBuffer=e.isBuffer}).call(t,n(41).Buffer)},function(e,t,n){"use strict";function r(e){return"string"==typeof e&&i.test(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var i=/-webkit-|-moz-|-ms-/;e.exports=t.default},function(e,t){e.exports={Text:"text",Directive:"directive",Comment:"comment",Script:"script",Style:"style",Tag:"tag",CDATA:"cdata",Doctype:"doctype",isTag:function(e){return"tag"===e.type||"script"===e.type||"style"===e.type}}},function(e,t,n){var r=n(710),i=n(709);t.decode=function(e,t){return(!t||t<=0?i.XML:i.HTML)(e)},t.decodeStrict=function(e,t){return(!t||t<=0?i.XML:i.HTMLStrict)(e)},t.encode=function(e,t){return(!t||t<=0?r.XML:r.HTML)(e)},t.encodeXML=r.XML,t.encodeHTML4=t.encodeHTML5=t.encodeHTML=r.HTML,t.decodeXML=t.decodeXMLStrict=i.XML,t.decodeHTML4=t.decodeHTML5=t.decodeHTML=i.HTML,t.decodeHTML4Strict=t.decodeHTML5Strict=t.decodeHTMLStrict=i.HTMLStrict,t.escape=r.escape},function(e,t,n){"use strict";var r=n(80);e.exports=function(e){if(!r(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,n){function r(t,n){return delete e.exports[t],e.exports[t]=n,n}var i=n(380),o=n(699);e.exports={Parser:i,Tokenizer:n(381),ElementType:n(113),DomHandler:o,get FeedHandler(){return r("FeedHandler",n(759))},get Stream(){return r("Stream",n(761))},get WritableStream(){return r("WritableStream",n(382))},get ProxyHandler(){return r("ProxyHandler",n(760))},get DomUtils(){return r("DomUtils",n(701))},get CollectingHandler(){return r("CollectingHandler",n(758))},DefaultHandler:o,get RssHandler(){return r("RssHandler",this.FeedHandler)},parseDOM:function(e,t){var n=new o(t);return new i(n,t).end(e),n.dom},parseFeed:function(t,n){var r=new e.exports.FeedHandler(n);return new i(r,n).end(t),r.dom},createDomStream:function(e,t,n){var r=new o(e,t,n);return new i(r,t)},EVENTS:{attribute:2,cdatastart:0,cdataend:0,text:1,processinginstruction:2,comment:1,commentend:0,closetag:1,opentag:2,opentagname:1,error:1,end:0}}},function(e,t,n){"use strict";function r(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},e.exports=r},function(e,t,n){"use strict";var r=n(82);e.exports=new r({include:[n(388)],implicit:[n(813),n(806)],explicit:[n(798),n(808),n(809),n(811)]})},function(e,t,n){function r(e){return"function"==typeof e?e:null==e?a:"object"==typeof e?s(e)?o(e[0],e[1]):i(e):u(e)}var i=n(857),o=n(858),a=n(226),s=n(19),u=n(951);e.exports=r},function(e,t){function n(e,t){return e===t||e!==e&&t!==t}e.exports=n},function(e,t){function n(e,t,n){if(t in e)return e[t];if(3===arguments.length)return n;throw new Error('"'+t+'" is a required argument.')}function r(e){var t=e.match(y);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function i(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function o(e){var n=e,o=r(e);if(o){if(!o.path)return e;n=o.path}for(var a,s=t.isAbsolute(n),u=n.split(/\/+/),l=0,c=u.length-1;c>=0;c--)a=u[c],"."===a?u.splice(c,1):".."===a?l++:l>0&&(""===a?(u.splice(c+1,l),l=0):(u.splice(c,2),l--));return n=u.join("/"),""===n&&(n=s?"/":"."),o?(o.path=n,i(o)):n}function a(e,t){""===e&&(e="."),""===t&&(t=".");var n=r(t),a=r(e);if(a&&(e=a.path||"/"),n&&!n.scheme)return a&&(n.scheme=a.scheme),i(n);if(n||t.match(_))return t;if(a&&!a.host&&!a.path)return a.host=t,i(a);var s="/"===t.charAt(0)?t:o(e.replace(/\/+$/,"")+"/"+t);return a?(a.path=s,i(a)):s}function s(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var n=0;0!==t.indexOf(e+"/");){var r=e.lastIndexOf("/");if(r<0)return t;if(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/))return t;++n}return Array(n+1).join("../")+t.substr(e.length+1)}function u(e){return e}function l(e){return p(e)?"$"+e:e}function c(e){return p(e)?e.slice(1):e}function p(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var n=t-10;n>=0;n--)if(36!==e.charCodeAt(n))return!1;return!0}function f(e,t,n){var r=d(e.source,t.source);return 0!==r?r:0!==(r=e.originalLine-t.originalLine)?r:0!==(r=e.originalColumn-t.originalColumn)||n?r:0!==(r=e.generatedColumn-t.generatedColumn)?r:(r=e.generatedLine-t.generatedLine,0!==r?r:d(e.name,t.name))}function h(e,t,n){var r=e.generatedLine-t.generatedLine;return 0!==r?r:0!==(r=e.generatedColumn-t.generatedColumn)||n?r:0!==(r=d(e.source,t.source))?r:0!==(r=e.originalLine-t.originalLine)?r:(r=e.originalColumn-t.originalColumn,0!==r?r:d(e.name,t.name))}function d(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}function m(e,t){var n=e.generatedLine-t.generatedLine;return 0!==n?n:0!==(n=e.generatedColumn-t.generatedColumn)?n:0!==(n=d(e.source,t.source))?n:0!==(n=e.originalLine-t.originalLine)?n:(n=e.originalColumn-t.originalColumn,0!==n?n:d(e.name,t.name))}function v(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))}function g(e,t,n){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),n){var s=r(n);if(!s)throw new Error("sourceMapURL could not be parsed");if(s.path){var u=s.path.lastIndexOf("/");u>=0&&(s.path=s.path.substring(0,u+1))}t=a(i(s),t)}return o(t)}t.getArg=n;var y=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,_=/^data:.+\,.+$/;t.urlParse=r,t.urlGenerate=i,t.normalize=o,t.join=a,t.isAbsolute=function(e){return"/"===e.charAt(0)||y.test(e)},t.relative=s;var b=function(){return!("__proto__"in Object.create(null))}();t.toSetString=b?u:l,t.fromSetString=b?u:c,t.compareByOriginalPositions=f,t.compareByGeneratedPositionsDeflated=h,t.compareByGeneratedPositionsInflated=m,t.parseSourceMapInput=v,t.computeSourceURL=g},function(e,t,n){"use strict";function r(e){return"button"===e||"input"===e||"select"===e||"textarea"===e}function i(e,t,n){switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":return!(!n.disabled||!r(t));default:return!1}}var o=n(10),a=n(243),s=n(244),u=n(248),l=n(462),c=n(463),p=(n(7),{}),f=null,h=function(e,t){e&&(s.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},d=function(e){return h(e,!0)},m=function(e){return h(e,!1)},v=function(e){return"."+e._rootNodeID},g={injection:{injectEventPluginOrder:a.injectEventPluginOrder,injectEventPluginsByName:a.injectEventPluginsByName},putListener:function(e,t,n){"function"!=typeof n&&o("94",t,typeof n);var r=v(e);(p[t]||(p[t]={}))[r]=n;var i=a.registrationNameModules[t];i&&i.didPutListener&&i.didPutListener(e,t,n)},getListener:function(e,t){var n=p[t];if(i(t,e._currentElement.type,e._currentElement.props))return null;var r=v(e);return n&&n[r]},deleteListener:function(e,t){var n=a.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var r=p[t];if(r){delete r[v(e)]}},deleteAllListeners:function(e){var t=v(e);for(var n in p)if(p.hasOwnProperty(n)&&p[n][t]){var r=a.registrationNameModules[n];r&&r.willDeleteListener&&r.willDeleteListener(e,n),delete p[n][t]}},extractEvents:function(e,t,n,r){for(var i,o=a.plugins,s=0;s0&&void 0!==arguments[0]?arguments[0]:{};return{type:v,payload:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CLEAR=t.NEW_AUTH_ERR=t.NEW_SPEC_ERR_BATCH=t.NEW_SPEC_ERR=t.NEW_THROWN_ERR_BATCH=t.NEW_THROWN_ERR=void 0,t.newThrownErr=r,t.newThrownErrBatch=i,t.newSpecErr=o,t.newSpecErrBatch=a,t.newAuthErr=s,t.clear=u;var l=n(265),c=function(e){return e&&e.__esModule?e:{default:e}}(l),p=t.NEW_THROWN_ERR="err_new_thrown_err",f=t.NEW_THROWN_ERR_BATCH="err_new_thrown_err_batch",h=t.NEW_SPEC_ERR="err_new_spec_err",d=t.NEW_SPEC_ERR_BATCH="err_new_spec_err_batch",m=t.NEW_AUTH_ERR="err_new_auth_err",v=t.CLEAR="err_clear"},function(e,t,n){var r=n(54),i=n(338),o=n(336),a=n(38),s=n(133),u=n(194),l={},c={},t=e.exports=function(e,t,n,p,f){var h,d,m,v,g=f?function(){return e}:u(e),y=r(n,p,t?2:1),_=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(h=s(e.length);h>_;_++)if((v=t?y(a(d=e[_])[0],d[1]):y(e[_]))===l||v===c)return v}else for(m=g.call(e);!(d=m.next()).done;)if((v=i(m,y,d.value,t))===l||v===c)return v};t.BREAK=l,t.RETURN=c},function(e,t){e.exports=!0},function(e,t,n){var r=n(134)("meta"),i=n(28),o=n(56),a=n(42).f,s=0,u=Object.isExtensible||function(){return!0},l=!n(55)(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},p=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[r].i},f=function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[r].w},h=function(e){return l&&d.NEED&&u(e)&&!o(e,r)&&c(e),e},d=e.exports={KEY:r,NEED:!1,fastKey:p,getWeak:f,onFreeze:h}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(190),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(135);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){"use strict";var r=n(65),i=n(79),o=n(107),a=n(58),s=n(18);e.exports=function(e,t,n){var u=s(e),l=n(a,u,""[e]),c=l[0],p=l[1];o(function(){var t={};return t[u]=function(){return 7},7!=""[e](t)})&&(i(String.prototype,e,c),r(RegExp.prototype,u,2==t?function(e,t){return p.call(e,this,t)}:function(e){return p.call(e,this)}))}},function(e,t,n){var r=n(63),i=n(641),o=n(660),a=Object.defineProperty;t.f=n(106)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(643),i=n(58);e.exports=function(e){return r(i(e))}},function(e,t,n){"use strict";var r,i=n(373),o=n(376),a=n(728),s=n(733);r=e.exports=function(e,t){var n,r,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(n=a=!0,r=!1):(n=s.call(e,"c"),r=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:n,enumerable:r,writable:a},u?i(o(u),l):l},r.gs=function(e,t,n){var r,u,l,c;return"string"!=typeof e?(l=n,n=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==n?n=void 0:a(n)||(l=n,n=void 0):(l=t,t=n=void 0),null==e?(r=!0,u=!1):(r=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:n,configurable:r,enumerable:u},l?i(o(l),c):c}},function(e,t,n){"use strict";e.exports=n(725)("forEach")},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(82);e.exports=r.DEFAULT=new r({include:[n(118)],explicit:[n(804),n(803),n(802)]})},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e]/;e.exports=i},function(e,t,n){"use strict";var r,i=n(25),o=n(242),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(250),l=u(function(e,t){if(e.namespaceURI!==o.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(i.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}e.exports=l},function(e,t,n){"use strict";function r(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]="number"==typeof e[n]?e[n]:e[n].val);return t}t.__esModule=!0,t.default=r,e.exports=t.default},function(e,t,n){"use strict";e.exports=function(e,t){var n,r,i,o=-1,a=e.posMax,s=e.pos,u=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=t+1,e.isInLabel=!0,n=1;e.pos1&&void 0!==arguments[1])||arguments[1];return e=(0,s.normalizeArray)(e),{type:p,payload:{thing:e,shown:t}}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=(0,s.normalizeArray)(e),{type:c,payload:{thing:e,mode:t}}}Object.defineProperty(t,"__esModule",{value:!0}),t.SHOW=t.UPDATE_MODE=t.UPDATE_FILTER=t.UPDATE_LAYOUT=void 0,t.updateLayout=r,t.updateFilter=i,t.show=o,t.changeMode=a;var s=n(11),u=t.UPDATE_LAYOUT="layout_update_layout",l=t.UPDATE_FILTER="layout_update_filter",c=t.UPDATE_MODE="layout_update_mode",p=t.SHOW="layout_show"},function(e,t,n){"use strict";function r(e,t){return{type:u,payload:{selectedServerUrl:e,namespace:t}}}function i(e){var t=e.value,n=e.pathMethod;return{type:l,payload:{value:t,pathMethod:n}}}function o(e){var t=e.value,n=e.pathMethod;return{type:c,payload:{value:t,pathMethod:n}}}function a(e){var t=e.value,n=e.path,r=e.method;return{type:p,payload:{value:t,path:n,method:r}}}function s(e){var t=e.server,n=e.namespace,r=e.key,i=e.val;return{type:f,payload:{server:t,namespace:n,key:r,val:i}}}Object.defineProperty(t,"__esModule",{value:!0}),t.setSelectedServer=r,t.setRequestBodyValue=i,t.setRequestContentType=o,t.setResponseContentType=a,t.setServerVariableValue=s;var u=t.UPDATE_SELECTED_SERVER="oas3_set_servers",l=t.UPDATE_REQUEST_BODY_VALUE="oas3_set_request_body_value",c=t.UPDATE_REQUEST_CONTENT_TYPE="oas3_set_request_content_type",p=t.UPDATE_RESPONSE_CONTENT_TYPE="oas3_set_response_content_type",f=t.UPDATE_SERVER_VARIABLE_VALUE="oas3_set_server_variable_value"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=h(e,t);if(n)return(0,s.default)(n,{declaration:!0,indent:"\t"})}Object.defineProperty(t,"__esModule",{value:!0}),t.memoizedSampleFromSchema=t.memoizedCreateXMLExample=t.sampleXmlFromSchema=t.inferSchema=t.sampleFromSchema=void 0,t.createXMLExample=i;var o=n(11),a=n(1197),s=r(a),u=n(967),l=r(u),c={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},p=function(e){e=(0,o.objectify)(e);var t=e,n=t.type,r=t.format,i=c[n+"_"+r]||c[n];return(0,o.isFunc)(i)?i(e):"Unknown Type: "+e.type},f=t.sampleFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.example,s=r.properties,u=r.additionalProperties,l=r.items,c=n.includeReadOnly,f=n.includeWriteOnly;if(void 0!==a)return a;if(!i)if(s)i="object";else{if(!l)return;i="array"}if("object"===i){var h=(0,o.objectify)(s),d={};for(var m in h)h[m].readOnly&&!c||h[m].writeOnly&&!f||(d[m]=e(h[m],n));if(!0===u)d.additionalProp1={};else if(u)for(var v=(0,o.objectify)(u),g=e(v,n),y=1;y<4;y++)d["additionalProp"+y]=g;return d}return"array"===i?[e(l,n)]:t.enum?t.default?t.default:(0,o.normalizeArray)(t.enum)[0]:"file"!==i?p(t):void 0},h=(t.inferSchema=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},t.sampleXmlFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.properties,s=r.additionalProperties,u=r.items,l=r.example,c=n.includeReadOnly,f=n.includeWriteOnly,h=r.default,d={},m={},v=t.xml,g=v.name,y=v.prefix,_=v.namespace,b=r.enum,x=void 0,w=void 0;if(!i)if(a||s)i="object";else{if(!u)return;i="array"}if(g=g||"notagname",x=(y?y+":":"")+g,_){m[y?"xmlns:"+y:"xmlns"]=_}if("array"===i&&u){if(u.xml=u.xml||v||{},u.xml.name=u.xml.name||v.name,v.wrapped)return d[x]=[],Array.isArray(l)?l.forEach(function(t){u.example=t,d[x].push(e(u,n))}):Array.isArray(h)?h.forEach(function(t){u.default=t,d[x].push(e(u,n))}):d[x]=[e(u,n)],m&&d[x].push({_attr:m}),d;var k=[];return Array.isArray(l)?(l.forEach(function(t){u.example=t,k.push(e(u,n))}),k):Array.isArray(h)?(h.forEach(function(t){u.default=t,k.push(e(u,n))}),k):e(u,n)}if("object"===i){var E=(0,o.objectify)(a);d[x]=[],l=l||{};for(var S in E)if((!E[S].readOnly||c)&&(!E[S].writeOnly||f))if(E[S].xml=E[S].xml||{},E[S].xml.attribute){var C=Array.isArray(E[S].enum)&&E[S].enum[0],A=E[S].example,D=E[S].default;m[E[S].xml.name||S]=void 0!==A&&A||void 0!==l[S]&&l[S]||void 0!==D&&D||C||p(E[S])}else{E[S].xml.name=E[S].xml.name||S,E[S].example=void 0!==E[S].example?E[S].example:l[S];var O=e(E[S]);Array.isArray(O)?d[x]=d[x].concat(O):d[x].push(O)}return!0===s?d[x].push({additionalProp:"Anything can be here"}):s&&d[x].push({additionalProp:p(s)}),m&&d[x].push({_attr:m}),d}return w=void 0!==l?l:void 0!==h?h:Array.isArray(b)?b[0]:p(t),d[x]=m?[{_attr:m},w]:w,d});t.memoizedCreateXMLExample=(0,l.default)(i),t.memoizedSampleFromSchema=(0,l.default)(f)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=X(e).replace(/\t/g," ");if("string"==typeof e)return{type:R,payload:t}}function o(e){return{type:J,payload:e}}function a(e){return{type:F,payload:e}}function s(e){return{type:j,payload:e}}function u(e,t,n,r,i){return{type:N,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:i}}}function l(e){return{type:H,payload:{pathMethod:e}}}function c(e,t){return{type:G,payload:{path:e,value:t,key:"consumes_value"}}}function p(e,t){return{type:G,payload:{path:e,value:t,key:"produces_value"}}}function f(e,t){return{type:W,payload:{path:e,method:t}}}function h(e,t){return{type:V,payload:{path:e,method:t}}}function d(e,t,n){return{type:K,payload:{scheme:e,path:t,method:n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.execute=t.executeRequest=t.logRequest=t.setMutatedRequest=t.setRequest=t.setResponse=t.validateParams=t.resolveSpec=t.parseToJson=t.SET_SCHEME=t.UPDATE_RESOLVED=t.UPDATE_OPERATION_VALUE=t.CLEAR_VALIDATE_PARAMS=t.CLEAR_REQUEST=t.CLEAR_RESPONSE=t.LOG_REQUEST=t.SET_MUTATED_REQUEST=t.SET_REQUEST=t.SET_RESPONSE=t.VALIDATE_PARAMS=t.UPDATE_PARAM=t.UPDATE_JSON=t.UPDATE_URL=t.UPDATE_SPEC=void 0;var m=n(20),v=r(m),g=n(97),y=r(g),_=n(36),b=r(_),x=n(47),w=r(x),k=n(48),E=r(k);t.updateSpec=i,t.updateResolved=o,t.updateUrl=a,t.updateJsonSpec=s,t.changeParam=u,t.clearValidateParams=l,t.changeConsumesValue=c,t.changeProducesValue=p,t.clearResponse=f,t.clearRequest=h,t.setScheme=d;var S=n(212),C=r(S),A=n(1185),D=r(A),O=n(265),M=r(O),T=n(422),P=r(T),I=n(11),R=t.UPDATE_SPEC="spec_update_spec",F=t.UPDATE_URL="spec_update_url",j=t.UPDATE_JSON="spec_update_json",N=t.UPDATE_PARAM="spec_update_param",B=t.VALIDATE_PARAMS="spec_validate_param",L=t.SET_RESPONSE="spec_set_response",q=t.SET_REQUEST="spec_set_request",z=t.SET_MUTATED_REQUEST="spec_set_mutated_request",U=t.LOG_REQUEST="spec_log_request",W=t.CLEAR_RESPONSE="spec_clear_response",V=t.CLEAR_REQUEST="spec_clear_request",H=t.CLEAR_VALIDATE_PARAMS="spec_clear_validate_param",G=t.UPDATE_OPERATION_VALUE="spec_update_operation_value",J=t.UPDATE_RESOLVED="spec_update_resolved",K=t.SET_SCHEME="set_scheme",X=function(e){return(0,P.default)(e)?e:""},Y=(t.parseToJson=function(e){return function(t){var n=t.specActions,r=t.specSelectors,i=t.errActions,o=r.specStr,a=null;try{e=e||o(),i.clear({source:"parser"}),a=C.default.safeLoad(e)}catch(e){return console.error(e),i.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return a&&"object"===(void 0===a?"undefined":(0,E.default)(a))?n.updateJsonSpec(a):{}}},t.resolveSpec=function(e,t){return function(n){var r=n.specActions,i=n.specSelectors,o=n.errActions,a=n.fn,s=a.fetch,u=a.resolve,l=a.AST,c=n.getConfigs,p=c(),f=p.modelPropertyMacro,h=p.parameterMacro,d=p.requestInterceptor,m=p.responseInterceptor;void 0===e&&(e=i.specJson()),void 0===t&&(t=i.url());var v=l.getLineNumberForPath,g=i.specStr();return u({fetch:s,spec:e,baseDoc:t,modelPropertyMacro:f,parameterMacro:h,requestInterceptor:d,responseInterceptor:m}).then(function(e){var t=e.spec,n=e.errors;if(o.clear({type:"thrown"}),Array.isArray(n)&&n.length>0){var i=n.map(function(e){return console.error(e),e.line=e.fullPath?v(g,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e});o.newThrownErrBatch(i)}return r.updateResolved(t)})}},t.validateParams=function(e,t){return{type:B,payload:{pathMethod:e,isOAS3:t}}},t.setResponse=function(e,t,n){return{payload:{path:e,method:t,res:n},type:L}},t.setRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:q}},t.setMutatedRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:z}},t.logRequest=function(e){return{payload:e,type:U}},t.executeRequest=function(e){return function(t){var n=t.fn,r=t.specActions,i=t.specSelectors,o=t.getConfigs,a=t.oas3Selectors,s=e.pathName,u=e.method,l=e.operation,c=o(),p=c.requestInterceptor,f=c.responseInterceptor,h=l.toJS();if(e.contextUrl=(0,D.default)(i.url()).toString(),h&&h.operationId?e.operationId=h.operationId:h&&s&&u&&(e.operationId=n.opId(h,s,u)),i.isOAS3()){var d=s+":"+u;e.server=a.selectedServer(d)||a.selectedServer();var m=a.serverVariables({server:e.server,namespace:d}).toJS(),v=a.serverVariables({server:e.server}).toJS();e.serverVariables=(0,w.default)(m).length?m:v,e.requestContentType=a.requestContentType(s,u),e.responseContentType=a.responseContentType(s,u)||"*/*";var g=a.requestBodyValue(s,u);(0,I.isJSONObject)(g)?e.requestBody=JSON.parse(g):e.requestBody=g}var y=(0,b.default)({},e);y=n.buildRequest(y),r.setRequest(e.pathName,e.method,y);var _=function(t){var n=p.apply(this,[t]),i=(0,b.default)({},n);return r.setMutatedRequest(e.pathName,e.method,i),n};e.requestInterceptor=_,e.responseInterceptor=f;var x=Date.now();return n.execute(e).then(function(t){t.duration=Date.now()-x,r.setResponse(e.pathName,e.method,t)}).catch(function(t){return r.setResponse(e.pathName,e.method,{error:!0,err:(0,M.default)(t)})})}},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=(0,y.default)(e,["path","method"]);return function(e){var i=e.fn.fetch,o=e.specSelectors,a=e.specActions,s=o.spec().toJS(),u=o.operationScheme(t,n),l=o.contentTypeValues([t,n]).toJS(),c=l.requestContentType,p=l.responseContentType,f=/xml/i.test(c),h=o.parameterValues([t,n],f).toJS();return a.executeRequest((0,v.default)({fetch:i,spec:s,pathName:t,method:n,parameters:h,requestContentType:c,scheme:u,responseContentType:p},r))}});t.execute=Y},function(e,t,n){e.exports={default:n(594),__esModule:!0}},function(e,t,n){"use strict";function r(e){switch(e._type){case"document":case"block_quote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"link":case"image":case"custom_inline":case"custom_block":return!0;default:return!1}}var i=function(e,t){this.current=e,this.entering=!0===t},o=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=r(e);return t&&n?e._firstChild?(this.current=e._firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e._next?(this.current=e._parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:t,node:e}},a=function(e){return{current:e,root:e,entering:!0,next:o,resumeAt:i}},s=function(e,t){this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=null,this._next=null,this._sourcepos=t,this._lastLineBlank=!1,this._open=!0,this._string_content=null,this._literal=null,this._listData={},this._info=null,this._destination=null,this._title=null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=null,this._level=null,this._onEnter=null,this._onExit=null},u=s.prototype;Object.defineProperty(u,"isContainer",{get:function(){return r(this)}}),Object.defineProperty(u,"type",{get:function(){return this._type}}),Object.defineProperty(u,"firstChild",{get:function(){return this._firstChild}}),Object.defineProperty(u,"lastChild",{get:function(){return this._lastChild}}),Object.defineProperty(u,"next",{get:function(){return this._next}}),Object.defineProperty(u,"prev",{get:function(){return this._prev}}),Object.defineProperty(u,"parent",{get:function(){return this._parent}}),Object.defineProperty(u,"sourcepos",{get:function(){return this._sourcepos}}),Object.defineProperty(u,"literal",{get:function(){return this._literal},set:function(e){this._literal=e}}),Object.defineProperty(u,"destination",{get:function(){return this._destination},set:function(e){this._destination=e}}),Object.defineProperty(u,"title",{get:function(){return this._title},set:function(e){this._title=e}}),Object.defineProperty(u,"info",{get:function(){return this._info},set:function(e){this._info=e}}),Object.defineProperty(u,"level",{get:function(){return this._level},set:function(e){this._level=e}}),Object.defineProperty(u,"listType",{get:function(){return this._listData.type},set:function(e){this._listData.type=e}}),Object.defineProperty(u,"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.tight=e}}),Object.defineProperty(u,"listStart",{get:function(){return this._listData.start},set:function(e){this._listData.start=e}}),Object.defineProperty(u,"listDelimiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.delimiter=e}}),Object.defineProperty(u,"onEnter",{get:function(){return this._onEnter},set:function(e){this._onEnter=e}}),Object.defineProperty(u,"onExit",{get:function(){return this._onExit},set:function(e){this._onExit=e}}),s.prototype.appendChild=function(e){e.unlink(),e._parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this._lastChild,this._lastChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.prependChild=function(e){e.unlink(),e._parent=this,this._firstChild?(this._firstChild._prev=e,e._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this._parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,this._prev=null},s.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,e._next&&(e._next._prev=e),e._prev=this,this._next=e,e._parent=this._parent,e._next||(e._parent._lastChild=e)},s.prototype.insertBefore=function(e){e.unlink(),e._prev=this._prev,e._prev&&(e._prev._next=e),e._next=this,this._prev=e,e._parent=this._parent,e._prev||(e._parent._firstChild=e)},s.prototype.walker=function(){return new a(this)},e.exports=s},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(54),i=n(182),o=n(77),a=n(133),s=n(601);e.exports=function(e,t){var n=1==e,u=2==e,l=3==e,c=4==e,p=6==e,f=5==e||p,h=t||s;return function(t,s,d){for(var m,v,g=o(t),y=i(g),_=r(s,d,3),b=a(y.length),x=0,w=n?h(t,b):u?h(t,0):void 0;b>x;x++)if((f||x in y)&&(m=y[x],v=_(m,x,g),e))if(n)w[x]=v;else if(v)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:w.push(m)}else if(c)return!1;return p?-1:l||c?c:w}}},function(e,t,n){var r=n(99),i=n(21)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(28),i=n(24).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(99);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(98);e.exports.f=function(e){return new r(e)}},function(e,t,n){var r=n(38),i=n(610),o=n(181),a=n(188)("IE_PROTO"),s=function(){},u=function(){var e,t=n(180)("iframe"),r=o.length;for(t.style.display="none",n(334).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(" + + +
+
+
+
    +
  • +

    Introduction

    +
  • +
  • +

    SO API Handler

    +
  • +
  • +

    SO API Handler utilizes RESTful interfaces to interact with consumer applications. The SO interface + is used to orchestrate VNFs, allow for manual task completion, and send vnf replace requests. + It contains both the SOServiceInstantiation API and SOManualTasks API.

    +
  • +
  • +

    SOServiceInstantiation API

    +
  • +
  • +

    The SOServiceInstantiation API handles service instance requests, and supports both macro and aLaCarte + orchestrations. Change management operations, activation and deactivation of service instances, and new + requests for configuration resources are handled by this API. This API is currently + set for version 6 ("v6") while also supporting versions 4 and 5 ("v4", "v5") minus additional "v6" features.

    +
  • +
  • +

    SOManualTasks API

    +
  • +
  • +

    The SOManualTasks API handles queries about open manual tasks. This API also accepts POST requests + containing information about how SO should proceed with handling the open tasks, and resolving the + errors. SOManualTasks API currently supports version 1 ("v1").

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html new file mode 100644 index 0000000000..297a32074f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/install.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Install

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html new file mode 100644 index 0000000000..8d5c12bda7 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/jars.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Jars

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html new file mode 100644 index 0000000000..cf47ed6a52 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/layout.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Layout

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html new file mode 100644 index 0000000000..af68c7c634 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/logging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Logging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png new file mode 100644 index 0000000000..c6f6857a58 Binary files /dev/null and b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/onaplogo.png differ diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html new file mode 100644 index 0000000000..a72542c968 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/packaging.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Packaging

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html new file mode 100644 index 0000000000..baee81bd83 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/page.html @@ -0,0 +1,67 @@ + + + + + + + \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css new file mode 100644 index 0000000000..68963ba3ad --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/readme.css @@ -0,0 +1,114 @@ +html, body{ + margin:0; + padding:0; + height:100%; +} +div#page-wrapper{ + width: 991px; + min-height: 100%; + margin: auto; + border-style: solid; + border-width: thin; + border-color: #d0d6e0; + position: relative; +} +body{ + display:none; +} +nav#header{ + padding: 10px; + width: 972px; + height: 101.8px; + border-bottom: 1px solid #d0d6e0; + text-align: left; +} +nav#header ul{ + padding-left: 0px; + list-style-type: none; +} +nav#header a{ + color: #008080; + text-decoration: none; +} +nav#header a:hover{ + text-decoration: underline; +} +nav#left-col{ + position: absolute; + left: 0; + width: 248px; + padding-bottom: 35px; +} +nav#left-col ul{ + padding-left: 10px; + list-style-type: none; +} +.pages { + color: #008080; + text-decoration: none; + text-align: left; + font-size: 18px; +} +.sub-bullet a{ + text-decoration: none; + text-align: left; + font-size: 14px; + color: black; +} +.sub-bullet a:hover{ + text-decoration: underline; +} +div#right-col{ + padding-left: 150px; + padding-bottom: 35px; + padding-right: 50px; +} +.title{ + color: #008080; + font-size: 24px; + list-style-type: none; +} +.info-title{ + color: black; + font-size: 18px; + list-style-type: none; +} +.info{ + color: grey; + font-size: 14px; + list-style-type: none; +} +.info-list{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; +} +.info-sublist{ + list-style-position:inside; + font-size: 14px; + color: grey; + position: relative; + padding-bottom: 5px; + padding-left: 45px; +} +div#footer-wrapper{ + position: absolute; + bottom: 0; + width: 981px; + height: 35px; + background-color: #008080; + color: white; + font-size:15px; + text-align:right; + padding-right:10px; +} +div#footer-wrapper a{ + color: white; + text-align:right; + text-decoration:none; +} +div#footer-wrapper a:hover{ + text-decoration: underline; +} diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html new file mode 100644 index 0000000000..c6e2b46710 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/spring.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Spring

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html new file mode 100644 index 0000000000..b1813db387 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/readme/tools.html @@ -0,0 +1,34 @@ + + + + + Read Me + + + +
+
+
+
    +
  • +

    Tools

    +
  • +
  • +

    Information Title

    +
  • +
  • +

    Information

    +
  • +
+
+
+ + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png new file mode 100644 index 0000000000..0f7e13b0d9 Binary files /dev/null and b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-16x16.png differ diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png new file mode 100644 index 0000000000..b0a3352ffd Binary files /dev/null and b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/favicon-32x32.png differ diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html new file mode 100644 index 0000000000..37bd587752 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/index.html @@ -0,0 +1,95 @@ + + + + + + Swagger UI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html new file mode 100644 index 0000000000..eb00dc686a --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/oauth2-redirect.html @@ -0,0 +1,60 @@ + + + + + + diff --git a/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js new file mode 100644 index 0000000000..50ac4c2e40 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/main/resources/static/swagger/swagger-ui-bundle.js @@ -0,0 +1,99 @@ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist",t(t.s=1139)}([function(e,t,n){"use strict";e.exports=n(86)},function(e,t,n){e.exports=n(923)()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?d(e)+t:t}function v(){return!0}function g(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function y(e,t){return b(e,t,0)}function _(e,t){return b(e,t,t)}function b(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}function x(e){this.next=e}function k(e,t,n,r){var i=0===e?t:1===e?n:[t,n];return r?r.value=i:r={value:i,done:!1},r}function w(){return{value:void 0,done:!0}}function E(e){return!!A(e)}function S(e){return e&&"function"==typeof e.next}function C(e){var t=A(e);return t&&t.call(e)}function A(e){var t=e&&(kn&&e[kn]||e[wn]);if("function"==typeof t)return t}function D(e){return e&&"number"==typeof e.length}function O(e){return null===e||void 0===e?j():o(e)?e.toSeq():z(e)}function T(e){return null===e||void 0===e?j().toKeyedSeq():o(e)?a(e)?e.toSeq():e.fromEntrySeq():L(e)}function M(e){return null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e.toIndexedSeq():q(e)}function P(e){return(null===e||void 0===e?j():o(e)?a(e)?e.entrySeq():e:q(e)).toSetSeq()}function I(e){this._array=e,this.size=e.length}function F(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function N(e){this._iterable=e,this.size=e.length||e.size}function R(e){this._iterator=e,this._iteratorCache=[]}function B(e){return!(!e||!e[Sn])}function j(){return Cn||(Cn=new I([]))}function L(e){var t=Array.isArray(e)?new I(e).fromEntrySeq():S(e)?new R(e).fromEntrySeq():E(e)?new N(e).fromEntrySeq():"object"==typeof e?new F(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function q(e){var t=U(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function z(e){var t=U(e)||"object"==typeof e&&new F(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}function U(e){return D(e)?new I(e):S(e)?new R(e):E(e)?new N(e):void 0}function W(e,t,n,r){var i=e._cache;if(i){for(var o=i.length-1,a=0;a<=o;a++){var s=i[n?o-a:a];if(!1===t(s[1],r?s[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function V(e,t,n,r){var i=e._cache;if(i){var o=i.length-1,a=0;return new x(function(){var e=i[n?o-a:a];return a++>o?w():k(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function H(e,t){return t?G(t,e,"",{"":e}):J(e)}function G(e,t,n,r){return Array.isArray(t)?e.call(r,n,M(t).map(function(n,r){return G(e,n,r,t)})):X(t)?e.call(r,n,T(t).map(function(n,r){return G(e,n,r,t)})):t}function J(e){return Array.isArray(e)?M(e).map(J).toList():X(e)?T(e).map(J).toMap():e}function X(e){return e&&(e.constructor===Object||void 0===e.constructor)}function K(e,t){if(e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if(e=e.valueOf(),t=t.valueOf(),e===t||e!==e&&t!==t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function Y(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||a(e)!==a(t)||s(e)!==s(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!u(e);if(l(e)){var r=e.entries();return t.every(function(e,t){var i=r.next().value;return i&&K(i[1],e)&&(n||K(i[0],t))})&&r.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var c=e;e=t,t=c}var p=!0,f=t.__iterate(function(t,r){if(n?!e.has(t):i?!K(t,e.get(r,vn)):!K(e.get(r,vn),t))return p=!1,!1});return p&&e.size===f}function $(e,t){if(!(this instanceof $))return new $(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(An)return An;An=this}}function Z(e,t){if(!e)throw new Error(t)}function Q(e,t,n){if(!(this instanceof Q))return new Q(e,t,n);if(Z(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),t>>1&1073741824|3221225471&e}function oe(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!==e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)e/=4294967295,n^=e;return ie(n)}if("string"===t)return e.length>Rn?ae(e):se(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return ue(e);if("function"==typeof e.toString)return se(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ae(e){var t=Ln[e];return void 0===t&&(t=se(e),jn===Bn&&(jn=0,Ln={}),jn++,Ln[e]=t),t}function se(e){for(var t=0,n=0;n0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}function ce(e){Z(e!==1/0,"Cannot perform this action with an infinite size.")}function pe(e){return null===e||void 0===e?ke():fe(e)&&!l(e)?e:ke().withMutations(function(t){var r=n(e);ce(r.size),r.forEach(function(e,n){return t.set(n,e)})})}function fe(e){return!(!e||!e[qn])}function he(e,t){this.ownerID=e,this.entries=t}function de(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function me(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function ve(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function ge(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function ye(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&be(e._root)}function _e(e,t){return k(e,t[0],t[1])}function be(e,t){return{node:e,index:0,__prev:t}}function xe(e,t,n,r){var i=Object.create(zn);return i.size=e,i._root=t,i.__ownerID=n,i.__hash=r,i.__altered=!1,i}function ke(){return Un||(Un=xe(0))}function we(e,t,n){var r,i;if(e._root){var o=c(gn),a=c(yn);if(r=Ee(e._root,e.__ownerID,0,void 0,t,n,o,a),!a.value)return e;i=e.size+(o.value?n===vn?-1:1:0)}else{if(n===vn)return e;i=1,r=new he(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=i,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?xe(i,r):ke()}function Ee(e,t,n,r,i,o,a,s){return e?e.update(t,n,r,i,o,a,s):o===vn?e:(p(s),p(a),new ge(t,r,[i,o]))}function Se(e){return e.constructor===ge||e.constructor===ve}function Ce(e,t,n,r,i){if(e.keyHash===r)return new ve(t,r,[e.entry,i]);var o,a=(0===n?e.keyHash:e.keyHash>>>n)&mn,s=(0===n?r:r>>>n)&mn;return new de(t,1<>>=1)a[s]=1&n?t[o++]:void 0;return a[r]=i,new me(e,o+1,a)}function Te(e,t,r){for(var i=[],a=0;a>1&1431655765,e=(858993459&e)+(e>>2&858993459),e=e+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function Re(e,t,n,r){var i=r?e:h(e);return i[t]=n,i}function Be(e,t,n,r){var i=e.length+1;if(r&&t+1===i)return e[t]=n,e;for(var o=new Array(i),a=0,s=0;s0&&io?0:o-n,l=a-n;return l>dn&&(l=dn),function(){if(i===l)return Kn;var e=t?--l:i++;return r&&r[e]}}function i(e,r,i){var s,u=e&&e.array,l=i>o?0:o-i>>r,c=1+(a-i>>r);return c>dn&&(c=dn),function(){for(;;){if(s){var e=s();if(e!==Kn)return e;s=null}if(l===c)return Kn;var o=t?--c:l++;s=n(u&&u[o],r-hn,i+(o<=e.size||t<0)return e.withMutations(function(e){t<0?Ke(e,t).set(0,n):Ke(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,i=e._root,o=c(yn);return t>=$e(e._capacity)?r=Ge(r,e.__ownerID,0,t,n,o):i=Ge(i,e.__ownerID,e._level,t,n,o),o.value?e.__ownerID?(e._root=i,e._tail=r,e.__hash=void 0,e.__altered=!0,e):We(e._origin,e._capacity,e._level,i,r):e}function Ge(e,t,n,r,i,o){var a=r>>>n&mn,s=e&&a0){var l=e&&e.array[a],c=Ge(l,t,n-hn,r,i,o);return c===l?e:(u=Je(e,t),u.array[a]=c,u)}return s&&e.array[a]===i?e:(p(o),u=Je(e,t),void 0===i&&a===u.array.length-1?u.array.pop():u.array[a]=i,u)}function Je(e,t){return t&&e&&t===e.ownerID?e:new ze(e?e.array.slice():[],t)}function Xe(e,t){if(t>=$e(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&mn],r-=hn;return n}}function Ke(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new f,i=e._origin,o=e._capacity,a=i+t,s=void 0===n?o:n<0?o+n:i+n;if(a===i&&s===o)return e;if(a>=s)return e.clear();for(var u=e._level,l=e._root,c=0;a+c<0;)l=new ze(l&&l.array.length?[void 0,l]:[],r),u+=hn,c+=1<=1<p?new ze([],r):d;if(d&&h>p&&ahn;g-=hn){var y=p>>>g&mn;v=v.array[y]=Je(v.array[y],r)}v.array[p>>>hn&mn]=d}if(s=h)a-=h,s-=h,u=hn,l=null,m=m&&m.removeBefore(r,0,a);else if(a>i||h>>u&mn;if(_!==h>>>u&mn)break;_&&(c+=(1<i&&(l=l.removeBefore(r,u,a-c)),l&&ha&&(a=l.size),o(u)||(l=l.map(function(e){return H(e)})),i.push(l)}return a>e.size&&(e=e.setSize(a)),Ie(e,t,i)}function $e(e){return e>>hn<=dn&&a.size>=2*o.size?(i=a.filter(function(e,t){return void 0!==e&&s!==t}),r=i.toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=i.__ownerID=e.__ownerID)):(r=o.remove(t),i=s===a.size-1?a.pop():a.set(s,void 0))}else if(u){if(n===a.get(s)[1])return e;r=o,i=a.set(s,[t,n])}else r=o.set(t,a.size),i=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=i,e.__hash=void 0,e):et(r,i)}function rt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function it(e){this._iter=e,this.size=e.size}function ot(e){this._iter=e,this.size=e.size}function at(e){this._iter=e,this.size=e.size}function st(e){var t=Dt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Ot,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===xn){var r=e.__iterator(t,n);return new x(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===bn?_n:bn,n)},t}function ut(e,t,n){var r=Dt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,i){var o=e.get(r,vn);return o===vn?i:t.call(n,o,r,e)},r.__iterateUncached=function(r,i){var o=this;return e.__iterate(function(e,i,a){return!1!==r(t.call(n,e,i,a),i,o)},i)},r.__iteratorUncached=function(r,i){var o=e.__iterator(xn,i);return new x(function(){var i=o.next();if(i.done)return i;var a=i.value,s=a[0];return k(r,s,t.call(n,a[1],s,e),i)})},r}function lt(e,t){var n=Dt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=st(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=Ot,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function ct(e,t,n,r){var i=Dt(e);return r&&(i.has=function(r){var i=e.get(r,vn);return i!==vn&&!!t.call(n,i,r,e)},i.get=function(r,i){var o=e.get(r,vn);return o!==vn&&t.call(n,o,r,e)?o:i}),i.__iterateUncached=function(i,o){var a=this,s=0;return e.__iterate(function(e,o,u){if(t.call(n,e,o,u))return s++,i(e,r?o:s-1,a)},o),s},i.__iteratorUncached=function(i,o){var a=e.__iterator(xn,o),s=0;return new x(function(){for(;;){var o=a.next();if(o.done)return o;var u=o.value,l=u[0],c=u[1];if(t.call(n,c,l,e))return k(i,r?l:s++,c,o)}})},i}function pt(e,t,n){var r=pe().asMutable();return e.__iterate(function(i,o){r.update(t.call(n,i,o,e),0,function(e){return e+1})}),r.asImmutable()}function ft(e,t,n){var r=a(e),i=(l(e)?Ze():pe()).asMutable();e.__iterate(function(o,a){i.update(t.call(n,o,a,e),function(e){return e=e||[],e.push(r?[a,o]:o),e})});var o=At(e);return i.map(function(t){return Et(e,o(t))})}function ht(e,t,n,r){var i=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=i:n|=0),g(t,n,i))return e;var o=y(t,i),a=_(n,i);if(o!==o||a!==a)return ht(e.toSeq().cacheResult(),t,n,r);var s,u=a-o;u===u&&(s=u<0?0:u);var l=Dt(e);return l.size=0===s?s:e.size&&s||void 0,!r&&B(e)&&s>=0&&(l.get=function(t,n){return t=m(this,t),t>=0&&ts)return w();var e=i.next();return r||t===bn?e:t===_n?k(t,u-1,void 0,e):k(t,u-1,e.value[1],e)})},l}function dt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterate(r,i);var a=0;return e.__iterate(function(e,i,s){return t.call(n,e,i,s)&&++a&&r(e,i,o)}),a},r.__iteratorUncached=function(r,i){var o=this;if(i)return this.cacheResult().__iterator(r,i);var a=e.__iterator(xn,i),s=!0;return new x(function(){if(!s)return w();var e=a.next();if(e.done)return e;var i=e.value,u=i[0],l=i[1];return t.call(n,l,u,o)?r===xn?e:k(r,u,l,e):(s=!1,w())})},r}function mt(e,t,n,r){var i=Dt(e);return i.__iterateUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterate(i,o);var s=!0,u=0;return e.__iterate(function(e,o,l){if(!s||!(s=t.call(n,e,o,l)))return u++,i(e,r?o:u-1,a)}),u},i.__iteratorUncached=function(i,o){var a=this;if(o)return this.cacheResult().__iterator(i,o);var s=e.__iterator(xn,o),u=!0,l=0;return new x(function(){var e,o,c;do{if(e=s.next(),e.done)return r||i===bn?e:i===_n?k(i,l++,void 0,e):k(i,l++,e.value[1],e);var p=e.value;o=p[0],c=p[1],u&&(u=t.call(n,c,o,a))}while(u);return i===xn?e:k(i,o,c,e)})},i}function vt(e,t){var r=a(e),i=[e].concat(t).map(function(e){return o(e)?r&&(e=n(e)):e=r?L(e):q(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===i.length)return e;if(1===i.length){var u=i[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var l=new I(i);return r?l=l.toKeyedSeq():s(e)||(l=l.toSetSeq()),l=l.flatten(!0),l.size=i.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}function gt(e,t,n){var r=Dt(e);return r.__iterateUncached=function(r,i){function a(e,l){var c=this;e.__iterate(function(e,i){return(!t||l0}function wt(e,n,r){var i=Dt(e);return i.size=new I(r).map(function(e){return e.size}).min(),i.__iterate=function(e,t){for(var n,r=this.__iterator(bn,t),i=0;!(n=r.next()).done&&!1!==e(n.value,i++,this););return i},i.__iteratorUncached=function(e,i){var o=r.map(function(e){return e=t(e),C(i?e.reverse():e)}),a=0,s=!1;return new x(function(){var t;return s||(t=o.map(function(e){return e.next()}),s=t.some(function(e){return e.done})),s?w():k(e,a++,n.apply(null,t.map(function(e){return e.value})))})},i}function Et(e,t){return B(e)?t:e.constructor(t)}function St(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Ct(e){return ce(e.size),d(e)}function At(e){return a(e)?n:s(e)?r:i}function Dt(e){return Object.create((a(e)?T:s(e)?M:P).prototype)}function Ot(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):O.prototype.cacheResult.call(this)}function Tt(e,t){return e>t?1:et?-1:0}function on(e){if(e.size===1/0)return 0;var t=l(e),n=a(e),r=t?1:0;return an(e.__iterate(n?t?function(e,t){r=31*r+sn(oe(e),oe(t))|0}:function(e,t){r=r+sn(oe(e),oe(t))|0}:t?function(e){r=31*r+oe(e)|0}:function(e){r=r+oe(e)|0}),r)}function an(e,t){return t=Tn(t,3432918353),t=Tn(t<<15|t>>>-15,461845907),t=Tn(t<<13|t>>>-13,5),t=(t+3864292196|0)^e,t=Tn(t^t>>>16,2246822507),t=Tn(t^t>>>13,3266489909),t=ie(t^t>>>16)}function sn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}var un=Array.prototype.slice;e(n,t),e(r,t),e(i,t),t.isIterable=o,t.isKeyed=a,t.isIndexed=s,t.isAssociative=u,t.isOrdered=l,t.Keyed=n,t.Indexed=r,t.Set=i;var ln="@@__IMMUTABLE_ITERABLE__@@",cn="@@__IMMUTABLE_KEYED__@@",pn="@@__IMMUTABLE_INDEXED__@@",fn="@@__IMMUTABLE_ORDERED__@@",hn=5,dn=1<r?w():k(e,i,n[t?r-i++:i++])})},e(F,T),F.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},F.prototype.has=function(e){return this._object.hasOwnProperty(e)},F.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,i=r.length-1,o=0;o<=i;o++){var a=r[t?i-o:o];if(!1===e(n[a],a,this))return o+1}return o},F.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,i=r.length-1,o=0;return new x(function(){var a=r[t?i-o:o];return o++>i?w():k(e,a,n[a])})},F.prototype[fn]=!0,e(N,M),N.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=this._iterable,r=C(n),i=0;if(S(r))for(var o;!(o=r.next()).done&&!1!==e(o.value,i++,this););return i},N.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=this._iterable,r=C(n);if(!S(r))return new x(w);var i=0;return new x(function(){var t=r.next();return t.done?t:k(e,i++,t.value)})},e(R,M),R.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n=this._iterator,r=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[i]=t.value}return k(e,i,r[i++])})};var Cn;e($,M),$.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$.prototype.get=function(e,t){return this.has(e)?this._value:t},$.prototype.includes=function(e){return K(this._value,e)},$.prototype.slice=function(e,t){var n=this.size;return g(e,t,n)?this:new $(this._value,_(t,n)-y(e,n))},$.prototype.reverse=function(){return this},$.prototype.indexOf=function(e){return K(this._value,e)?0:-1},$.prototype.lastIndexOf=function(e){return K(this._value,e)?this.size:-1},$.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?w():k(e,o++,a)})},Q.prototype.equals=function(e){return e instanceof Q?this._start===e._start&&this._end===e._end&&this._step===e._step:Y(this,e)};var Dn;e(ee,t),e(te,ee),e(ne,ee),e(re,ee),ee.Keyed=te,ee.Indexed=ne,ee.Set=re;var On,Tn="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){e|=0,t|=0;var n=65535&e,r=65535&t;return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0},Mn=Object.isExtensible,Pn=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),In="function"==typeof WeakMap;In&&(On=new WeakMap);var Fn=0,Nn="__immutablehash__";"function"==typeof Symbol&&(Nn=Symbol(Nn));var Rn=16,Bn=255,jn=0,Ln={};e(pe,te),pe.of=function(){var e=un.call(arguments,0);return ke().withMutations(function(t){for(var n=0;n=e.length)throw new Error("Missing value for key: "+e[n]);t.set(e[n],e[n+1])}})},pe.prototype.toString=function(){return this.__toString("Map {","}")},pe.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},pe.prototype.set=function(e,t){return we(this,e,t)},pe.prototype.setIn=function(e,t){return this.updateIn(e,vn,function(){return t})},pe.prototype.remove=function(e){return we(this,e,vn)},pe.prototype.deleteIn=function(e){return this.updateIn(e,function(){return vn})},pe.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},pe.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=Fe(this,Mt(e),t,n);return r===vn?void 0:r},pe.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):ke()},pe.prototype.merge=function(){return Te(this,void 0,arguments)},pe.prototype.mergeWith=function(e){return Te(this,e,un.call(arguments,1))},pe.prototype.mergeIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.merge?e.merge.apply(e,t):t[t.length-1]})},pe.prototype.mergeDeep=function(){return Te(this,Me,arguments)},pe.prototype.mergeDeepWith=function(e){var t=un.call(arguments,1);return Te(this,Pe(e),t)},pe.prototype.mergeDeepIn=function(e){var t=un.call(arguments,1);return this.updateIn(e,ke(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,t):t[t.length-1]})},pe.prototype.sort=function(e){return Ze(bt(this,e))},pe.prototype.sortBy=function(e,t){return Ze(bt(this,t,e))},pe.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},pe.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new f)},pe.prototype.asImmutable=function(){return this.__ensureOwner()},pe.prototype.wasAltered=function(){return this.__altered},pe.prototype.__iterator=function(e,t){return new ye(this,e,t)},pe.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},pe.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?xe(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},pe.isMap=fe;var qn="@@__IMMUTABLE_MAP__@@",zn=pe.prototype;zn[qn]=!0,zn.delete=zn.remove,zn.removeIn=zn.deleteIn,he.prototype.get=function(e,t,n,r){for(var i=this.entries,o=0,a=i.length;o=Wn)return Ae(e,u,r,i);var d=e&&e===this.ownerID,m=d?u:h(u);return f?s?l===c-1?m.pop():m[l]=m.pop():m[l]=[r,i]:m.push([r,i]),d?(this.entries=m,this):new he(e,m)}},de.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=1<<((0===e?t:t>>>e)&mn),o=this.bitmap;return 0==(o&i)?r:this.nodes[Ne(o&i-1)].get(e+hn,t,n,r)},de.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=1<=Vn)return Oe(e,f,l,s,d);if(c&&!d&&2===f.length&&Se(f[1^p]))return f[1^p];if(c&&d&&1===f.length&&Se(d))return d;var m=e&&e===this.ownerID,v=c?d?l:l^u:l|u,g=c?d?Re(f,p,d,m):je(f,p,m):Be(f,p,d,m);return m?(this.bitmap=v,this.nodes=g,this):new de(e,v,g)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=oe(n));var i=(0===e?t:t>>>e)&mn,o=this.nodes[i];return o?o.get(e+hn,t,n,r):r},me.prototype.update=function(e,t,n,r,i,o,a){void 0===n&&(n=oe(r));var s=(0===t?n:n>>>t)&mn,u=i===vn,l=this.nodes,c=l[s];if(u&&!c)return this;var p=Ee(c,e,t+hn,n,r,i,o,a);if(p===c)return this;var f=this.count;if(c){if(!p&&--f=0&&e>>t&mn;if(r>=this.array.length)return new ze([],e);var i,o=0===r;if(t>0){var a=this.array[r];if((i=a&&a.removeBefore(e,t-hn,n))===a&&o)return this}if(o&&!i)return this;var s=Je(this,e);if(!o)for(var u=0;u>>t&mn;if(r>=this.array.length)return this;var i;if(t>0){var o=this.array[r];if((i=o&&o.removeAfter(e,t-hn,n))===o&&r===this.array.length-1)return this}var a=Je(this,e);return a.array.splice(r+1),i&&(a.array[r]=i),a};var Xn,Kn={};e(Ze,pe),Ze.of=function(){return this(arguments)},Ze.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Ze.prototype.get=function(e,t){var n=this._map.get(e);return void 0!==n?this._list.get(n)[1]:t},Ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):tt()},Ze.prototype.set=function(e,t){return nt(this,e,t)},Ze.prototype.remove=function(e){return nt(this,e,vn)},Ze.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Ze.prototype.__iterate=function(e,t){var n=this;return this._list.__iterate(function(t){return t&&e(t[1],t[0],n)},t)},Ze.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},Ze.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),n=this._list.__ensureOwner(e);return e?et(t,n,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=n,this)},Ze.isOrderedMap=Qe,Ze.prototype[fn]=!0,Ze.prototype.delete=Ze.prototype.remove;var Yn;e(rt,T),rt.prototype.get=function(e,t){return this._iter.get(e,t)},rt.prototype.has=function(e){return this._iter.has(e)},rt.prototype.valueSeq=function(){return this._iter.valueSeq()},rt.prototype.reverse=function(){var e=this,t=lt(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},rt.prototype.map=function(e,t){var n=this,r=ut(this,e,t);return this._useKeys||(r.valueSeq=function(){return n._iter.toSeq().map(e,t)}),r},rt.prototype.__iterate=function(e,t){var n,r=this;return this._iter.__iterate(this._useKeys?function(t,n){return e(t,n,r)}:(n=t?Ct(this):0,function(i){return e(i,t?--n:n++,r)}),t)},rt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var n=this._iter.__iterator(bn,t),r=t?Ct(this):0;return new x(function(){var i=n.next();return i.done?i:k(e,t?--r:r++,i.value,i)})},rt.prototype[fn]=!0,e(it,M),it.prototype.includes=function(e){return this._iter.includes(e)},it.prototype.__iterate=function(e,t){var n=this,r=0;return this._iter.__iterate(function(t){return e(t,r++,n)},t)},it.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t),r=0;return new x(function(){var t=n.next();return t.done?t:k(e,r++,t.value,t)})},e(ot,P),ot.prototype.has=function(e){return this._iter.includes(e)},ot.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){return e(t,t,n)},t)},ot.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){var t=n.next();return t.done?t:k(e,t.value,t.value,t)})},e(at,T),at.prototype.entrySeq=function(){return this._iter.toSeq()},at.prototype.__iterate=function(e,t){var n=this;return this._iter.__iterate(function(t){if(t){St(t);var r=o(t);return e(r?t.get(1):t[1],r?t.get(0):t[0],n)}},t)},at.prototype.__iterator=function(e,t){var n=this._iter.__iterator(bn,t);return new x(function(){for(;;){var t=n.next();if(t.done)return t;var r=t.value;if(r){St(r);var i=o(r);return k(e,i?r.get(0):r[0],i?r.get(1):r[1],t)}}})},it.prototype.cacheResult=rt.prototype.cacheResult=ot.prototype.cacheResult=at.prototype.cacheResult=Ot,e(Pt,te),Pt.prototype.toString=function(){return this.__toString(Ft(this)+" {","}")},Pt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Pt.prototype.get=function(e,t){if(!this.has(e))return t;var n=this._defaultValues[e];return this._map?this._map.get(e,n):n},Pt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=It(this,ke()))},Pt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+Ft(this));if(this._map&&!this._map.has(e)){if(t===this._defaultValues[e])return this}var n=this._map&&this._map.set(e,t);return this.__ownerID||n===this._map?this:It(this,n)},Pt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:It(this,t)},Pt.prototype.wasAltered=function(){return this._map.wasAltered()},Pt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterator(e,t)},Pt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map(function(e,t){return r.get(t)}).__iterate(e,t)},Pt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?It(this,t,e):(this.__ownerID=e,this._map=t,this)};var $n=Pt.prototype;$n.delete=$n.remove,$n.deleteIn=$n.removeIn=zn.removeIn,$n.merge=zn.merge,$n.mergeWith=zn.mergeWith,$n.mergeIn=zn.mergeIn,$n.mergeDeep=zn.mergeDeep,$n.mergeDeepWith=zn.mergeDeepWith,$n.mergeDeepIn=zn.mergeDeepIn,$n.setIn=zn.setIn,$n.update=zn.update,$n.updateIn=zn.updateIn,$n.withMutations=zn.withMutations,$n.asMutable=zn.asMutable,$n.asImmutable=zn.asImmutable,e(Bt,re),Bt.of=function(){return this(arguments)},Bt.fromKeys=function(e){return this(n(e).keySeq())},Bt.prototype.toString=function(){return this.__toString("Set {","}")},Bt.prototype.has=function(e){return this._map.has(e)},Bt.prototype.add=function(e){return Lt(this,this._map.set(e,!0))},Bt.prototype.remove=function(e){return Lt(this,this._map.remove(e))},Bt.prototype.clear=function(){return Lt(this,this._map.clear())},Bt.prototype.union=function(){var e=un.call(arguments,0);return e=e.filter(function(e){return 0!==e.size}),0===e.length?this:0!==this.size||this.__ownerID||1!==e.length?this.withMutations(function(t){for(var n=0;n=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):Xt(e,t)},Gt.prototype.pushAll=function(e){if(e=r(e),0===e.size)return this;ce(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):Xt(t,n)},Gt.prototype.pop=function(){return this.slice(1)},Gt.prototype.unshift=function(){return this.push.apply(this,arguments)},Gt.prototype.unshiftAll=function(e){return this.pushAll(e)},Gt.prototype.shift=function(){return this.pop.apply(this,arguments)},Gt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Kt()},Gt.prototype.slice=function(e,t){if(g(e,t,this.size))return this;var n=y(e,this.size);if(_(t,this.size)!==this.size)return ne.prototype.slice.call(this,e,t);for(var r=this.size-n,i=this._head;n--;)i=i.next;return this.__ownerID?(this.size=r,this._head=i,this.__hash=void 0,this.__altered=!0,this):Xt(r,i)},Gt.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Xt(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Gt.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},Gt.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new x(function(){if(r){var t=r.value;return r=r.next,k(e,n++,t)}return w()})},Gt.isStack=Jt;var rr="@@__IMMUTABLE_STACK__@@",ir=Gt.prototype;ir[rr]=!0,ir.withMutations=zn.withMutations,ir.asMutable=zn.asMutable,ir.asImmutable=zn.asImmutable,ir.wasAltered=zn.wasAltered;var or;t.Iterator=x,Yt(t,{toArray:function(){ce(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new it(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new rt(this,!0)},toMap:function(){return pe(this.toKeyedSeq())},toObject:function(){ce(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Ze(this.toKeyedSeq())},toOrderedSet:function(){return Ut(a(this)?this.valueSeq():this)},toSet:function(){return Bt(a(this)?this.valueSeq():this)},toSetSeq:function(){return new ot(this)},toSeq:function(){return s(this)?this.toIndexedSeq():a(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return Gt(a(this)?this.valueSeq():this)},toList:function(){return Le(a(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Et(this,vt(this,un.call(arguments,0)))},includes:function(e){return this.some(function(t){return K(t,e)})},entries:function(){return this.__iterator(xn)},every:function(e,t){ce(this.size);var n=!0;return this.__iterate(function(r,i,o){if(!e.call(t,r,i,o))return n=!1,!1}),n},filter:function(e,t){return Et(this,ct(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return ce(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){ce(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(_n)},map:function(e,t){return Et(this,ut(this,e,t))},reduce:function(e,t,n){ce(this.size);var r,i;return arguments.length<2?i=!0:r=t,this.__iterate(function(t,o,a){i?(i=!1,r=t):r=e.call(n,r,t,o,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Et(this,lt(this,!0))},slice:function(e,t){return Et(this,ht(this,e,t,!0))},some:function(e,t){return!this.every(Qt(e),t)},sort:function(e){return Et(this,bt(this,e))},values:function(){return this.__iterator(bn)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return d(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return pt(this,e,t)},equals:function(e){return Y(this,e)},entrySeq:function(){var e=this;if(e._cache)return new I(e._cache);var t=e.toSeq().map(Zt).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Qt(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,i,o){if(e.call(t,n,i,o))return r=[i,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(v)},flatMap:function(e,t){return Et(this,yt(this,e,t))},flatten:function(e){return Et(this,gt(this,e,!0))},fromEntrySeq:function(){return new at(this)},get:function(e,t){return this.find(function(t,n){return K(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,i=Mt(e);!(n=i.next()).done;){var o=n.value;if((r=r&&r.get?r.get(o,vn):vn)===vn)return t}return r},groupBy:function(e,t){return ft(this,e,t)},has:function(e){return this.get(e,vn)!==vn},hasIn:function(e){return this.getIn(e,vn)!==vn},isSubset:function(e){return e="function"==typeof e.includes?e:t(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return e="function"==typeof e.isSubset?e:t(e),e.isSubset(this)},keyOf:function(e){return this.findKey(function(t){return K(t,e)})},keySeq:function(){return this.toSeq().map($t).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return xt(this,e)},maxBy:function(e,t){return xt(this,t,e)},min:function(e){return xt(this,e?en(e):rn)},minBy:function(e,t){return xt(this,t?en(t):rn,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Et(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Et(this,mt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Qt(e),t)},sortBy:function(e,t){return Et(this,bt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Et(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Et(this,dt(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Qt(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=on(this))}});var ar=t.prototype;ar[ln]=!0,ar[En]=ar.values,ar.__toJS=ar.toArray,ar.__toStringMapper=tn,ar.inspect=ar.toSource=function(){return this.toString()},ar.chain=ar.flatMap,ar.contains=ar.includes,Yt(n,{flip:function(){return Et(this,st(this))},mapEntries:function(e,t){var n=this,r=0;return Et(this,this.toSeq().map(function(i,o){return e.call(t,[o,i],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Et(this,this.toSeq().flip().map(function(r,i){return e.call(t,r,i,n)}).flip())}});var sr=n.prototype;return sr[cn]=!0,sr[En]=ar.entries,sr.__toJS=ar.toObject,sr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+tn(e)},Yt(r,{toKeyedSeq:function(){return new rt(this,!1)},filter:function(e,t){return Et(this,ct(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Et(this,lt(this,!1))},slice:function(e,t){return Et(this,ht(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=y(e,e<0?this.count():this.size);var r=this.slice(0,e);return Et(this,1===n?r:r.concat(h(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Et(this,gt(this,e,!1))},get:function(e,t){return e=m(this,e),e<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=m(this,e))>=0&&(void 0!==this.size?this.size===1/0||e5e3)return e.textContent;return function(e){for(var n,r,i,o,a,s=e.textContent,u=0,l=s[0],c=1,p=e.innerHTML="",f=0;r=n,n=f<7&&"\\"==n?1:c;){if(c=l,l=s[++u],o=p.length>1,!c||f>8&&"\n"==c||[/\S/.test(c),1,1,!/[$\w]/.test(c),("/"==n||"\n"==n)&&o,'"'==n&&o,"'"==n&&o,s[u-4]+r+n=="--\x3e",r+n=="*/"][f])for(p&&(e.appendChild(a=t.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][f?f<3?2:f>6?4:f>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/.test(p):0]),a.appendChild(t.createTextNode(p))),i=f&&f<7?f:i,p="",f=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/.test(c),/[\])]/.test(c),/[$\w]/.test(c),"/"==c&&i<2&&"<"!=n,'"'==c,"'"==c,c+l+s[u+1]+s[u+2]=="\x3c!--",c+l=="/*",c+l=="//","#"==c][--f];);p+=c}}(e)}function b(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:j.default.Map();if(!j.default.Map.isMap(e)||!e.size)return j.default.List();if(Array.isArray(t)||(t=[t]),t.length<1)return e.merge(n);var r=j.default.List(),i=t[0],o=!0,a=!1,s=void 0;try{for(var u,l=(0,T.default)(e.entries());!(o=(u=l.next()).done);o=!0){var c=u.value,p=(0,D.default)(c,2),f=p[0],h=p[1],d=b(h,t.slice(1),n.set(i,f));r=j.default.List.isList(d)?r.concat(d):r.push(d)}}catch(e){a=!0,s=e}finally{try{!o&&l.return&&l.return()}finally{if(a)throw s}}return r}function x(e){return(0,W.default)((0,z.default)(e))}function k(e){return x(e.replace(/\.[^.\/]*$/,""))}function w(e){return"string"!=typeof e||""===e?"":(0,L.sanitizeUrl)(e)}function E(e){if(!j.default.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find(function(e,t){return t.startsWith("2")&&(0,F.default)(e.get("content")||{}).length>0}),n=e.get("default")||j.default.OrderedMap(),r=(n.get("content")||j.default.OrderedMap()).keySeq().toJS(),i=r.length?n:null;return t||i}Object.defineProperty(t,"__esModule",{value:!0}),t.escapeDeepLinkPath=t.createDeepLinkPath=t.shallowEqualKeys=t.buildFormData=t.sorters=t.btoa=t.parseSearch=t.getSampleSchema=t.validateParam=t.validatePattern=t.validateMinLength=t.validateMaxLength=t.validateGuid=t.validateDateTime=t.validateString=t.validateBoolean=t.validateFile=t.validateInteger=t.validateNumber=t.validateMinimum=t.validateMaximum=t.propChecker=t.errorLog=t.memoize=t.isImmutable=void 0;var S=n(42),C=r(S),A=n(16),D=r(A),O=n(89),T=r(O),M=n(31),P=r(M),I=n(49),F=r(I),N=n(43),R=r(N);t.isJSONObject=i,t.objectify=o,t.arrayify=a,t.fromJSOrdered=s,t.bindToState=u,t.normalizeArray=l,t.isFn=c,t.isObject=p,t.isFunc=f,t.isArray=h,t.objMap=d,t.objReduce=m,t.systemThunkMiddleware=v,t.defaultStatusCode=g,t.getList=y,t.highlight=_,t.mapToList=b,t.pascalCase=x,t.pascalCaseFilename=k,t.sanitizeUrl=w,t.getAcceptControllingResponse=E;var B=n(8),j=r(B),L=n(471),q=n(881),z=r(q),U=n(406),W=r(U),V=n(403),H=r(V),G=n(215),J=r(G),X=n(897),K=r(X),Y=n(113),$=r(Y),Z=n(161),Q=n(48),ee=r(Q),te=n(639),ne=r(te),re="default",ie=t.isImmutable=function(e){return j.default.Iterable.isIterable(e)},oe=(t.memoize=H.default,t.errorLog=function(e){return function(){return function(t){return function(n){try{t(n)}catch(t){e().errActions.newThrownErr(t,n)}}}}},t.propChecker=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return(0,F.default)(e).length!==(0,F.default)(t).length||((0,K.default)(e,function(e,n){if(r.includes(n))return!1;var i=t[n];return j.default.Iterable.isIterable(e)?!j.default.is(e,i):("object"!==(void 0===e?"undefined":(0,R.default)(e))||"object"!==(void 0===i?"undefined":(0,R.default)(i)))&&e!==i})||n.some(function(n){return!(0,$.default)(e[n],t[n])}))},t.validateMaximum=function(e,t){if(e>t)return"Value must be less than Maximum"}),ae=t.validateMinimum=function(e,t){if(et)return"Value must be less than MaxLength"},me=t.validateMinLength=function(e,t){if(e.length2&&void 0!==arguments[2]&&arguments[2],r=[],i=t&&"body"===e.get("in")?e.get("value_xml"):e.get("value"),o=e.get("required"),a=n?e.get("schema"):e,s=a.get("maximum"),u=a.get("minimum"),l=a.get("type"),c=a.get("format"),p=a.get("maxLength"),f=a.get("minLength"),h=a.get("pattern");if(l&&(o||i)){var d="string"===l&&i,m="array"===l&&Array.isArray(i)&&i.length,v="array"===l&&j.default.List.isList(i)&&i.count(),g="file"===l&&i instanceof ee.default.File,y="boolean"===l&&(i||!1===i),_="number"===l&&(i||0===i),b="integer"===l&&(i||0===i);if(o&&!(d||m||v||g||y||_||b))return r.push("Required field is not provided"),r;if(h){var x=ve(i,h);x&&r.push(x)}if(p||0===p){var k=de(i,p);k&&r.push(k)}if(f){var w=me(i,f);w&&r.push(w)}if(s||0===s){var E=oe(i,s);E&&r.push(E)}if(u||0===u){var S=ae(i,u);S&&r.push(S)}if("string"===l){var C=void 0;if(!(C="date-time"===c?fe(i):"uuid"===c?he(i):pe(i)))return r;r.push(C)}else if("boolean"===l){var A=ce(i);if(!A)return r;r.push(A)}else if("number"===l){var D=se(i);if(!D)return r;r.push(D)}else if("integer"===l){var O=ue(i);if(!O)return r;r.push(O)}else if("array"===l){var T=void 0;if(!i.count())return r;T=a.getIn(["items","type"]),i.forEach(function(e,t){var n=void 0;"number"===T?n=se(e):"integer"===T?n=ue(e):"string"===T&&(n=pe(e)),n&&r.push({index:t,error:n})})}else if("file"===l){var M=le(i);if(!M)return r;r.push(M)}}return r},t.getSampleSchema=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated --\x3e':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return(0,Z.memoizedCreateXMLExample)(e,n)}return(0,C.default)((0,Z.memoizedSampleFromSchema)(e,n),null,2)},t.parseSearch=function(){var e={},t=window.location.search;if(""!=t){var n=t.substr(1).split("&");for(var r in n)r=n[r].split("="),e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e},t.btoa=function(t){var n=void 0;return n=t instanceof e?t:new e(t.toString(),"utf-8"),n.toString("base64")},t.sorters={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},t.buildFormData=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},t.shallowEqualKeys=function(e,t,n){return!!(0,J.default)(n,function(n){return(0,$.default)(e[n],t[n])})},t.createDeepLinkPath=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"_"):""});t.escapeDeepLinkPath=function(e){return(0,ne.default)(ge(e))}}).call(t,n(50).Buffer)},function(e,t,n){"use strict";function r(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}/* +object-assign +(c) Sindre Sorhus +@license MIT +*/ +var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,s,u=r(e),l=1;l=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function l(e){if(e>65535){e-=65536;var t=55296+(e>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}function c(e,t){var n=0;return o(y,t)?y[t]:35===t.charCodeAt(0)&&g.test(t)&&(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10),u(n))?l(n):e}function p(e){return e.indexOf("&")<0?e:e.replace(v,c)}function f(e){return x[e]}function h(e){return _.test(e)?e.replace(b,f):e}var d=Object.prototype.hasOwnProperty,m=/\\([\\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,v=/&([a-z#][a-z0-9]{1,31});/gi,g=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,y=n(455),_=/[&<>"]/,b=/[&<>"]/g,x={"&":"&","<":"<",">":">",'"':"""};t.assign=a,t.isString=i,t.has=o,t.unescapeMd=s,t.isValidEntityCode=u,t.fromCodePoint=l,t.replaceEntities=p,t.escapeHtml=h},function(e,t,n){var r=n(342)("wks"),i=n(194),o=n(28).Symbol,a="function"==typeof o;(e.exports=function(e){return r[e]||(r[e]=a&&o[e]||(a?o:i)("Symbol."+e))}).store=r},function(e,t,n){"use strict";function r(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":e instanceof b.Iterable?"Immutable."+e.toSource().split(" ")[0]:t}function i(e){function t(t,n,r,i,o,a){for(var s=arguments.length,u=Array(s>6?s-6:0),l=6;l5?l-5:0),p=5;p5?a-5:0),u=5;u key("+c[p]+")"].concat(s));if(h instanceof Error)return h}}return i(t)}function u(e){return a(e,"List",b.List.isList)}function l(e,t,n,r){function o(){for(var i=arguments.length,o=Array(i),u=0;u5?s-5:0),l=5;l5?l-5:0),p=5;p>",k={listOf:u,mapOf:c,orderedMapOf:p,setOf:f,orderedSetOf:h,stackOf:d,iterableOf:m,recordOf:v,shape:y,contains:y,mapContains:_,list:o("List",b.List.isList),map:o("Map",b.Map.isMap),orderedMap:o("OrderedMap",b.OrderedMap.isOrderedMap),set:o("Set",b.Set.isSet),orderedSet:o("OrderedSet",b.OrderedSet.isOrderedSet),stack:o("Stack",b.Stack.isStack),seq:o("Seq",b.Seq.isSeq),record:o("Record",function(e){return e instanceof b.Record}),iterable:o("Iterable",b.Iterable.isIterable)};e.exports=k},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return function(){return e}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(e){return e},e.exports=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){var t=e.get("openapi");return!!t&&t.startsWith("3.0.0")}function o(e){var t=e.get("swagger");return!!t&&t.startsWith("2")}function a(e){return function(t,n){return function(r){if(n&&n.specSelectors&&n.specSelectors.specJson){return i(n.specSelectors.specJson())?c.default.createElement(e,(0,u.default)({},r,n,{Ori:t})):c.default.createElement(t,r)}return console.warn("OAS3 wrapper: couldn't get spec"),null}}}Object.defineProperty(t,"__esModule",{value:!0});var s=n(20),u=r(s);t.isOAS3=i,t.isSwagger2=o,t.OAS3ComponentWrapFactory=a;var l=n(0),c=r(l)},function(e,t,n){e.exports={default:n(556),__esModule:!0}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(312),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e,t,n){return t in e?(0,i.default)(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t,n){var r=n(27);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t){function n(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(p===clearTimeout)return clearTimeout(e);if((p===r||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&h&&(m=!1,h.length?d=h.concat(d):v=-1,d.length&&s())}function s(){if(!m){var e=i(a);m=!0;for(var t=d.length;t;){for(h=d,d=[];++v1)for(var n=1;n0&&(a=this.buffer[u-1],e.call(r,a)<0);)if(u--,this.pointer-u>n/2-1){o=" ... ",u+=5;break}for(l="",i=this.pointer;in/2-1){l=" ... ",i-=5;break}return""+new Array(t).join(" ")+o+this.buffer.slice(u,i)+l+"\n"+new Array(t+this.pointer-u+o.length).join(" ")+"^"},t.prototype.toString=function(){var e,t;return e=this.get_snippet(),t=" on line "+(this.line+1)+", column "+(this.column+1),e?t:t+":\n"+e},t}(),this.YAMLError=function(e){function n(e){this.message=e,n.__super__.constructor.call(this),this.stack=this.toString()+"\n"+(new Error).stack.split("\n").slice(1).join("\n")}return t(n,e),n.prototype.toString=function(){return this.message},n}(Error),this.MarkedYAMLError=function(e){function n(e,t,r,i,o){this.context=e,this.context_mark=t,this.problem=r,this.problem_mark=i,this.note=o,n.__super__.constructor.call(this)}return t(n,e),n.prototype.toString=function(){var e;return e=[],null!=this.context&&e.push(this.context),null==this.context_mark||null!=this.problem&&null!=this.problem_mark&&this.context_mark.line===this.problem_mark.line&&this.context_mark.column===this.problem_mark.column||e.push(this.context_mark.toString()),null!=this.problem&&e.push(this.problem),null!=this.problem_mark&&e.push(this.problem_mark.toString()),null!=this.note&&e.push(this.note),e.join("\n")},n}(this.YAMLError)}).call(this)},function(e,t,n){e.exports={default:n(555),__esModule:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var i=n(531),o=r(i),a=n(530),s=r(a),u="function"==typeof s.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":typeof e};t.default="function"==typeof s.default&&"symbol"===u(o.default)?function(e){return void 0===e?"undefined":u(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default&&e!==s.default.prototype?"symbol":void 0===e?"undefined":u(e)}},function(e,t,n){e.exports=!n(52)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";function r(e,t,n){return n?[e,t]:e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,e.exports=t.default},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var o in i)if(i.hasOwnProperty(o)){var s=i[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue;return this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse,this}var i=n(12),o=n(65),a=n(29),s=(n(9),["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|e}function m(e){return+e!=e&&(e=0),o.alloc(+e)}function v(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return J(e).length;default:if(r)return V(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,t>>>=0,n<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return D(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return M(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function _(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}var l;if(i){var c=-1;for(l=n;ls&&(n=s-u),l=n;l>=0;l--){for(var p=!0,f=0;fi&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a239?4:o>223?3:o>191?2:1;if(i+s<=n){var u,l,c,p;switch(s){case 1:o<128&&(a=o);break;case 2:u=e[i+1],128==(192&u)&&(p=(31&o)<<6|63&u)>127&&(a=p);break;case 3:u=e[i+1],l=e[i+2],128==(192&u)&&128==(192&l)&&(p=(15&o)<<12|(63&u)<<6|63&l)>2047&&(p<55296||p>57343)&&(a=p);break;case 4:u=e[i+1],l=e[i+2],c=e[i+3],128==(192&u)&&128==(192&l)&&128==(192&c)&&(p=(15&o)<<18|(63&u)<<12|(63&l)<<6|63&c)>65535&&p<1114112&&(a=p)}}null===a?(a=65533,s=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=s}return O(r)}function O(e){var t=e.length;if(t<=Q)return String.fromCharCode.apply(String,e);for(var n="",r=0;rr)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function R(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function B(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function j(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,i){return i||j(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,n,r,23,4),n+4}function q(e,t,n,r,i){return i||j(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,n,r,52,8),n+8}function z(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;a55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function H(e){for(var t=[],n=0;n>8,i=n%256,o.push(i),o.push(r);return o}function J(e){return Y.toByteArray(z(e))}function X(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e){return e!==e}/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +var Y=n(534),$=n(707),Z=n(366);t.Buffer=o,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=r(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,n){return a(null,e,t,n)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,n){return u(null,e,t,n)},o.allocUnsafe=function(e){return l(null,e)},o.allocUnsafeSlow=function(e){return l(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},o.prototype.compare=function(e,t,n,r,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,s=n-t,u=Math.min(a,s),l=this.slice(r,i),c=e.slice(t,n),p=0;pi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return x(this,e,t,n);case"utf8":case"utf-8":return k(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;o.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUInt8=function(e,t){return t||F(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||F(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||F(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||F(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||F(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=this[e],i=1,o=0;++o=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||F(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return t||F(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||F(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){t||F(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return t||F(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||F(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||F(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||F(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):B(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o>0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):B(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):B(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return q(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return q(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;a1?t-1:0),i=1;i2?n-2:0),o=2;o=n?e:e.length+1===n?""+t+e:""+new Array(n-e.length+1).join(t)+e},this.to_hex=function(e){return"string"==typeof e&&(e=e.charCodeAt(0)),e.toString(16)}}).call(this)}).call(t,n(18))},function(e,t,n){var r=n(101);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){"use strict";var r=n(668),i=Math.max;e.exports=function(e){return i(0,r(e))}},function(e,t,n){function r(e){return null==e?void 0===e?u:s:(e=Object(e),l&&l in e?o(e):a(e))}var i=n(76),o=n(837),a=n(866),s="[object Null]",u="[object Undefined]",l=i?i.toStringTag:void 0;e.exports=r},function(e,t,n){function r(e,t){var n=o(e,t);return i(n)?n:void 0}var i=n(795),o=n(838);e.exports=r},function(e,t){function n(e){return null!=e&&"object"==typeof e}e.exports=n},function(e,t,n){"use strict"},function(e,t,n){"use strict";var r=n(10),i=(n(7),function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)}),o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},s=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},u=function(e){var t=this;e instanceof t||r("25"),e.destructor(),t.instancePool.length`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t){e.exports={}},function(e,t,n){var r=n(172),i=n(169);e.exports=function(e){return r(i(e))}},function(e,t,n){var r=n(169);e.exports=function(e){return Object(r(e))}},function(e,t){var n=e.exports={version:"2.5.1"};"number"==typeof __e&&(__e=n)},function(e,t,n){var r=n(132),i=n(341);e.exports=n(99)?function(e,t,n){return r.f(e,t,i(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){"use strict";var r=n(351)();e.exports=function(e){return e!==r&&null!==e}},function(e,t,n){"use strict";function r(e){return void 0===e||null===e}function i(e){return"object"==typeof e&&null!==e}function o(e){return Array.isArray(e)?e:r(e)?[]:[e]}function a(e,t){var n,r,i,o;if(t)for(o=Object.keys(t),n=0,r=o.length;n`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>",u="]",l=new RegExp("^(?:<[A-Za-z][A-Za-z0-9-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^\"'=<>`\\x00-\\x20]+|'[^']*'|\"[^\"]*\"))?)*\\s*/?>|]|\x3c!----\x3e|\x3c!--(?:-?[^>-])(?:-?[^-])*--\x3e|[<][?].*?[?][>]|]*>|)","i"),c=/[\\&]/,p="[!\"#$%&'()*+,./:;<=>?@[\\\\\\]^_`{|}~-]",f=new RegExp("\\\\"+p+"|"+a,"gi"),h=new RegExp('[&<>"]',"g"),d=new RegExp(a+'|[&<>"]',"gi"),m=function(e){return 92===e.charCodeAt(0)?e.charAt(1):o(e)},v=function(e){return c.test(e)?e.replace(f,m):e},g=function(e){try{return r(i(e))}catch(t){return e}},y=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return e}},_=function(e,t){return h.test(e)?t?e.replace(d,y):e.replace(h,y):e};e.exports={unescapeString:v,normalizeURI:g,escapeXml:_,reHtmlTag:l,OPENTAG:s,CLOSETAG:u,ENTITY:a,ESCAPABLE:p}},function(e,t,n){"use strict";var r=n(12),i=n(441),o=n(1026),a=n(1027),s=n(87),u=n(1028),l=n(1029),c=n(1030),p=n(1034),f=s.createElement,h=s.createFactory,d=s.cloneElement,m=r,v=function(e){return e},g={Children:{map:o.map,forEach:o.forEach,count:o.count,toArray:o.toArray,only:p},Component:i.Component,PureComponent:i.PureComponent,createElement:f,cloneElement:d,isValidElement:s.isValidElement,PropTypes:u,createClass:c,createFactory:h,createMixin:v,DOM:a,version:l,__spread:m};e.exports=g},function(e,t,n){"use strict";function r(e){return void 0!==e.ref}function i(e){return void 0!==e.key}var o=n(12),a=n(47),s=(n(9),n(445),Object.prototype.hasOwnProperty),u=n(443),l={key:!0,ref:!0,__self:!0,__source:!0},c=function(e,t,n,r,i,o,a){var s={$$typeof:u,type:e,key:t,ref:n,props:a,_owner:o};return s};c.createElement=function(e,t,n){var o,u={},p=null,f=null;if(null!=t){r(t)&&(f=t.ref),i(t)&&(p=""+t.key),void 0===t.__self?null:t.__self,void 0===t.__source?null:t.__source;for(o in t)s.call(t,o)&&!l.hasOwnProperty(o)&&(u[o]=t[o])}var h=arguments.length-2;if(1===h)u.children=n;else if(h>1){for(var d=Array(h),m=0;m1){for(var g=Array(v),y=0;y=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";t.__esModule=!0;var r=n(527),i=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){n(589);for(var r=n(22),i=n(54),o=n(68),a=n(19)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u0&&void 0!==arguments[0]?arguments[0]:{};return{type:v,payload:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.CLEAR=t.NEW_AUTH_ERR=t.NEW_SPEC_ERR_BATCH=t.NEW_SPEC_ERR=t.NEW_THROWN_ERR_BATCH=t.NEW_THROWN_ERR=void 0,t.newThrownErr=r,t.newThrownErrBatch=i,t.newSpecErr=o,t.newSpecErrBatch=a,t.newAuthErr=s,t.clear=u;var l=n(248),c=function(e){return e&&e.__esModule?e:{default:e}}(l),p=t.NEW_THROWN_ERR="err_new_thrown_err",f=t.NEW_THROWN_ERR_BATCH="err_new_thrown_err_batch",h=t.NEW_SPEC_ERR="err_new_spec_err",d=t.NEW_SPEC_ERR_BATCH="err_new_spec_err_batch",m=t.NEW_AUTH_ERR="err_new_auth_err",v=t.CLEAR="err_clear"},function(e,t,n){var r=n(51),i=n(319),o=n(317),a=n(33),s=n(126),u=n(184),l={},c={},t=e.exports=function(e,t,n,p,f){var h,d,m,v,g=f?function(){return e}:u(e),y=r(n,p,t?2:1),_=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(o(g)){for(h=s(e.length);h>_;_++)if((v=t?y(a(d=e[_])[0],d[1]):y(e[_]))===l||v===c)return v}else for(m=g.call(e);!(d=m.next()).done;)if((v=i(m,y,d.value,t))===l||v===c)return v};t.BREAK=l,t.RETURN=c},function(e,t){e.exports=!0},function(e,t,n){var r=n(127)("meta"),i=n(27),o=n(53),a=n(37).f,s=0,u=Object.isExtensible||function(){return!0},l=!n(52)(function(){return u(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++s,w:{}}})},p=function(e,t){if(!i(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,r)){if(!u(e))return"F";if(!t)return"E";c(e)}return e[r].i},f=function(e,t){if(!o(e,r)){if(!u(e))return!0;if(!t)return!1;c(e)}return e[r].w},h=function(e){return l&&d.NEED&&u(e)&&!o(e,r)&&c(e),e},d=e.exports={KEY:r,NEED:!1,fastKey:p,getWeak:f,onFreeze:h}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(180),i=Math.min;e.exports=function(e){return e>0?i(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(128);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,i){return e.call(t,n,r,i)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(28),i=n(71),o=n(72),a=n(103),s=n(130),u=function(e,t,n){var l,c,p,f,h=e&u.F,d=e&u.G,m=e&u.S,v=e&u.P,g=e&u.B,y=d?r:m?r[t]||(r[t]={}):(r[t]||{}).prototype,_=d?i:i[t]||(i[t]={}),b=_.prototype||(_.prototype={});d&&(n=t);for(l in n)c=!h&&y&&void 0!==y[l],p=(c?y:n)[l],f=g&&c?s(p,r):v&&"function"==typeof p?s(Function.call,p):p,y&&a(y,l,p,e&u.U),_[l]!=p&&o(_,l,f),v&&b[l]!=p&&(b[l]=p)};r.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},function(e,t,n){var r=n(59),i=n(609),o=n(627),a=Object.defineProperty;t.f=n(99)?Object.defineProperty:function(e,t,n){if(r(e),t=o(t,!0),r(n),i)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";var r,i=n(352),o=n(355),a=n(672),s=n(677);r=e.exports=function(e,t){var n,r,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(n=a=!0,r=!1):(n=s.call(e,"c"),r=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:n,enumerable:r,writable:a},u?i(o(u),l):l},r.gs=function(e,t,n){var r,u,l,c;return"string"!=typeof e?(l=n,n=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==n?n=void 0:a(n)||(l=n,n=void 0):(l=t,t=n=void 0),null==e?(r=!0,u=!1):(r=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:n,configurable:r,enumerable:u},l?i(o(l),c):c}},function(e,t,n){"use strict";e.exports=n(669)("forEach")},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,i,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],a(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),i=l.length,u=0;u0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n),i||(i=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var i=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,i,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],a=n.length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){i=s;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";var r=n(75);e.exports=r.DEFAULT=new r({include:[n(111)],explicit:[n(748),n(747),n(746)]})},function(e,t,n){function r(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e]/;e.exports=i},function(e,t,n){"use strict";var r,i=n(23),o=n(225),a=/^[ \r\n\t\f]/,s=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,u=n(233),l=u(function(e,t){if(e.namespaceURI!==o.svg||"innerHTML"in e)e.innerHTML=t;else{r=r||document.createElement("div"),r.innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(i.canUseDOM){var c=document.createElement("div");c.innerHTML=" ",""===c.innerHTML&&(l=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&s.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),c=null}e.exports=l},function(e,t,n){"use strict";function r(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]="number"==typeof e[n]?e[n]:e[n].val);return t}t.__esModule=!0,t.default=r,e.exports=t.default},function(e,t,n){"use strict";e.exports=function(e,t){var n,r,i,o=-1,a=e.posMax,s=e.pos,u=e.isInLabel;if(e.isInLabel)return-1;if(e.labelUnmatchedScopes)return e.labelUnmatchedScopes--,-1;for(e.pos=t+1,e.isInLabel=!0,n=1;e.pos1&&void 0!==arguments[1])||arguments[1];return e=(0,s.normalizeArray)(e),{type:p,payload:{thing:e,shown:t}}}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=(0,s.normalizeArray)(e),{type:c,payload:{thing:e,mode:t}}}Object.defineProperty(t,"__esModule",{value:!0}),t.SHOW=t.UPDATE_MODE=t.UPDATE_FILTER=t.UPDATE_LAYOUT=void 0,t.updateLayout=r,t.updateFilter=i,t.show=o,t.changeMode=a;var s=n(11),u=t.UPDATE_LAYOUT="layout_update_layout",l=t.UPDATE_FILTER="layout_update_filter",c=t.UPDATE_MODE="layout_update_mode",p=t.SHOW="layout_show"},function(e,t,n){"use strict";function r(e){return{type:u,payload:e}}function i(e){var t=e.value,n=e.pathMethod;return{type:l,payload:{value:t,pathMethod:n}}}function o(e){var t=e.value,n=e.pathMethod;return{type:c,payload:{value:t,pathMethod:n}}}function a(e){var t=e.value,n=e.path,r=e.method;return{type:p,payload:{value:t,path:n,method:r}}}function s(e){var t=e.server,n=e.key,r=e.val;return{type:f,payload:{server:t,key:n,val:r}}}Object.defineProperty(t,"__esModule",{value:!0}),t.setSelectedServer=r,t.setRequestBodyValue=i,t.setRequestContentType=o,t.setResponseContentType=a,t.setServerVariableValue=s;var u=t.UPDATE_SELECTED_SERVER="oas3_set_servers",l=t.UPDATE_REQUEST_BODY_VALUE="oas3_set_request_body_value",c=t.UPDATE_REQUEST_CONTENT_TYPE="oas3_set_request_content_type",p=t.UPDATE_RESPONSE_CONTENT_TYPE="oas3_set_response_content_type",f=t.UPDATE_SERVER_VARIABLE_VALUE="oas3_set_server_variable_value"},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=h(e,t);if(n)return(0,s.default)(n,{declaration:!0,indent:"\t"})}Object.defineProperty(t,"__esModule",{value:!0}),t.memoizedSampleFromSchema=t.memoizedCreateXMLExample=t.sampleXmlFromSchema=t.inferSchema=t.sampleFromSchema=void 0,t.createXMLExample=i;var o=n(11),a=n(1125),s=r(a),u=n(910),l=r(u),c={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},p=function(e){e=(0,o.objectify)(e);var t=e,n=t.type,r=t.format,i=c[n+"_"+r]||c[n];return(0,o.isFunc)(i)?i(e):"Unknown Type: "+e.type},f=t.sampleFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.example,s=r.properties,u=r.additionalProperties,l=r.items,c=n.includeReadOnly,f=n.includeWriteOnly;if(void 0!==a)return a;if(!i)if(s)i="object";else{if(!l)return;i="array"}if("object"===i){var h=(0,o.objectify)(s),d={};for(var m in h)h[m].readOnly&&!c||h[m].writeOnly&&!f||(d[m]=e(h[m],n));if(!0===u)d.additionalProp1={};else if(u)for(var v=(0,o.objectify)(u),g=e(v,n),y=1;y<4;y++)d["additionalProp"+y]=g;return d}return"array"===i?[e(l,n)]:t.enum?t.default?t.default:(0,o.normalizeArray)(t.enum)[0]:"file"!==i?p(t):void 0},h=(t.inferSchema=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},t.sampleXmlFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,o.objectify)(t),i=r.type,a=r.properties,s=r.additionalProperties,u=r.items,l=r.example,c=n.includeReadOnly,f=n.includeWriteOnly,h=r.default,d={},m={},v=t.xml,g=v.name,y=v.prefix,_=v.namespace,b=r.enum,x=void 0,k=void 0;if(!i)if(a||s)i="object";else{if(!u)return;i="array"}if(g=g||"notagname",x=(y?y+":":"")+g,_){m[y?"xmlns:"+y:"xmlns"]=_}if("array"===i&&u){if(u.xml=u.xml||v||{},u.xml.name=u.xml.name||v.name,v.wrapped)return d[x]=[],Array.isArray(l)?l.forEach(function(t){u.example=t,d[x].push(e(u,n))}):Array.isArray(h)?h.forEach(function(t){u.default=t,d[x].push(e(u,n))}):d[x]=[e(u,n)],m&&d[x].push({_attr:m}),d;var w=[];return Array.isArray(l)?(l.forEach(function(t){u.example=t,w.push(e(u,n))}),w):Array.isArray(h)?(h.forEach(function(t){u.default=t,w.push(e(u,n))}),w):e(u,n)}if("object"===i){var E=(0,o.objectify)(a);d[x]=[],l=l||{};for(var S in E)if((!E[S].readOnly||c)&&(!E[S].writeOnly||f))if(E[S].xml=E[S].xml||{},E[S].xml.attribute){var C=Array.isArray(E[S].enum)&&E[S].enum[0],A=E[S].example,D=E[S].default;m[E[S].xml.name||S]=void 0!==A&&A||void 0!==l[S]&&l[S]||void 0!==D&&D||C||p(E[S])}else{E[S].xml.name=E[S].xml.name||S,E[S].example=void 0!==E[S].example?E[S].example:l[S];var O=e(E[S]);Array.isArray(O)?d[x]=d[x].concat(O):d[x].push(O)}return!0===s?d[x].push({additionalProp:"Anything can be here"}):s&&d[x].push({additionalProp:p(s)}),m&&d[x].push({_attr:m}),d}return k=void 0!==l?l:void 0!==h?h:Array.isArray(b)?b[0]:p(t),d[x]=m?[{_attr:m},k]:k,d});t.memoizedCreateXMLExample=(0,l.default)(i),t.memoizedSampleFromSchema=(0,l.default)(f)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return e instanceof Error?{type:T,error:!0,payload:e}:"string"==typeof e?{type:T,payload:e.replace(/\t/g," ")||""}:{type:T,payload:""}}function o(e){return{type:W,payload:e}}function a(e){return{type:M,payload:e}}function s(e){if(!e||"object"!==(void 0===e?"undefined":(0,k.default)(e)))throw new Error("updateJson must only accept a simple JSON object");return{type:P,payload:e}}function u(e,t,n,r,i){return{type:I,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:i}}}function l(e){return{type:z,payload:{pathMethod:e}}}function c(e,t){return{type:U,payload:{path:e,value:t,key:"consumes_value"}}}function p(e,t){return{type:U,payload:{path:e,value:t,key:"produces_value"}}}function f(e,t){return{type:L,payload:{path:e,method:t}}}function h(e,t){return{type:q,payload:{path:e,method:t}}}function d(e,t,n){return{type:V,payload:{scheme:e,path:t,method:n}}}Object.defineProperty(t,"__esModule",{value:!0}),t.execute=t.executeRequest=t.logRequest=t.setMutatedRequest=t.setRequest=t.setResponse=t.validateParams=t.formatIntoYaml=t.resolveSpec=t.parseToJson=t.SET_SCHEME=t.UPDATE_RESOLVED=t.UPDATE_OPERATION_VALUE=t.ClEAR_VALIDATE_PARAMS=t.CLEAR_REQUEST=t.CLEAR_RESPONSE=t.LOG_REQUEST=t.SET_MUTATED_REQUEST=t.SET_REQUEST=t.SET_RESPONSE=t.VALIDATE_PARAMS=t.UPDATE_PARAM=t.UPDATE_JSON=t.UPDATE_URL=t.UPDATE_SPEC=void 0;var m=n(20),v=r(m),g=n(90),y=r(g),_=n(31),b=r(_),x=n(43),k=r(x);t.updateSpec=i,t.updateResolved=o,t.updateUrl=a,t.updateJsonSpec=s,t.changeParam=u,t.clearValidateParams=l,t.changeConsumesValue=c,t.changeProducesValue=p,t.clearResponse=f,t.clearRequest=h,t.setScheme=d;var w=n(203),E=r(w),S=n(1115),C=r(S),A=n(248),D=r(A),O=n(11),T=t.UPDATE_SPEC="spec_update_spec",M=t.UPDATE_URL="spec_update_url",P=t.UPDATE_JSON="spec_update_json",I=t.UPDATE_PARAM="spec_update_param",F=t.VALIDATE_PARAMS="spec_validate_param",N=t.SET_RESPONSE="spec_set_response",R=t.SET_REQUEST="spec_set_request",B=t.SET_MUTATED_REQUEST="spec_set_mutated_request",j=t.LOG_REQUEST="spec_log_request",L=t.CLEAR_RESPONSE="spec_clear_response",q=t.CLEAR_REQUEST="spec_clear_request",z=t.ClEAR_VALIDATE_PARAMS="spec_clear_validate_param",U=t.UPDATE_OPERATION_VALUE="spec_update_operation_value",W=t.UPDATE_RESOLVED="spec_update_resolved",V=t.SET_SCHEME="set_scheme",H=(t.parseToJson=function(e){return function(t){var n=t.specActions,r=t.specSelectors,i=t.errActions,o=r.specStr,a=null;try{e=e||o(),i.clear({source:"parser"}),a=E.default.safeLoad(e)}catch(e){return console.error(e),i.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return n.updateJsonSpec(a)}},t.resolveSpec=function(e,t){return function(n){var r=n.specActions,i=n.specSelectors,o=n.errActions,a=n.fn,s=a.fetch,u=a.resolve,l=a.AST,c=n.getConfigs,p=c(),f=p.modelPropertyMacro,h=p.parameterMacro,d=p.requestInterceptor,m=p.responseInterceptor;void 0===e&&(e=i.specJson()),void 0===t&&(t=i.url());var v=l.getLineNumberForPath,g=i.specStr();return u({fetch:s,spec:e,baseDoc:t,modelPropertyMacro:f,parameterMacro:h,requestInterceptor:d,responseInterceptor:m}).then(function(e){var t=e.spec,n=e.errors;if(o.clear({type:"thrown"}),n.length>0){var i=n.map(function(e){return console.error(e),e.line=e.fullPath?v(g,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e});o.newThrownErrBatch(i)}return r.updateResolved(t)})}},t.formatIntoYaml=function(){return function(e){var t=e.specActions,n=e.specSelectors,r=n.specStr,i=t.updateSpec;try{var o=E.default.safeDump(E.default.safeLoad(r()),{indent:2});i(o)}catch(e){i(e)}}},t.validateParams=function(e,t){return{type:F,payload:{pathMethod:e,isOAS3:t}}},t.setResponse=function(e,t,n){return{payload:{path:e,method:t,res:n},type:N}},t.setRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:R}},t.setMutatedRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:B}},t.logRequest=function(e){return{payload:e,type:j}},t.executeRequest=function(e){return function(t){var n=t.fn,r=t.specActions,i=t.specSelectors,o=t.getConfigs,a=t.oas3Selectors,s=e.pathName,u=e.method,l=e.operation,c=o(),p=c.requestInterceptor,f=c.responseInterceptor,h=l.toJS();if(e.contextUrl=(0,C.default)(i.url()).toString(),h&&h.operationId?e.operationId=h.operationId:h&&s&&u&&(e.operationId=n.opId(h,s,u)),i.isOAS3()){e.server=a.selectedServer(),e.serverVariables=a.serverVariables(e.server).toJS(),e.requestContentType=a.requestContentType(s,u),e.responseContentType=a.responseContentType(s,u)||"*/*";var d=a.requestBodyValue(s,u);(0,O.isJSONObject)(d)?e.requestBody=JSON.parse(d):e.requestBody=d}var m=(0,b.default)({},e);m=n.buildRequest(m),r.setRequest(e.pathName,e.method,m);var v=function(t){var n=p.apply(this,[t]),i=(0,b.default)({},n);return r.setMutatedRequest(e.pathName,e.method,i),n};e.requestInterceptor=v,e.responseInterceptor=f;var g=Date.now();return n.execute(e).then(function(t){t.duration=Date.now()-g,r.setResponse(e.pathName,e.method,t)}).catch(function(t){return r.setResponse(e.pathName,e.method,{error:!0,err:(0,D.default)(t)})})}},function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,r=(0,y.default)(e,["path","method"]);return function(e){var i=e.fn.fetch,o=e.specSelectors,a=e.specActions,s=o.spec().toJS(),u=o.operationScheme(t,n),l=o.contentTypeValues([t,n]).toJS(),c=l.requestContentType,p=l.responseContentType,f=/xml/i.test(c),h=o.parameterValues([t,n],f).toJS();return a.executeRequest((0,v.default)({fetch:i,spec:s,pathName:t,method:n,parameters:h,requestContentType:c,scheme:u,responseContentType:p},r))}});t.execute=H},function(e,t,n){"use strict";var r=n(11),i=n(1136);i.keys().forEach(function(t){if("./index.js"!==t){var n=i(t);e.exports[(0,r.pascalCaseFilename)(t)]=n.default?n.default:n}})},function(e,t,n){"use strict";function r(e){switch(e._type){case"document":case"block_quote":case"list":case"item":case"paragraph":case"heading":case"emph":case"strong":case"link":case"image":case"custom_inline":case"custom_block":return!0;default:return!1}}var i=function(e,t){this.current=e,this.entering=!0===t},o=function(){var e=this.current,t=this.entering;if(null===e)return null;var n=r(e);return t&&n?e._firstChild?(this.current=e._firstChild,this.entering=!0):this.entering=!1:e===this.root?this.current=null:null===e._next?(this.current=e._parent,this.entering=!1):(this.current=e._next,this.entering=!0),{entering:t,node:e}},a=function(e){return{current:e,root:e,entering:!0,next:o,resumeAt:i}},s=function(e,t){this._type=e,this._parent=null,this._firstChild=null,this._lastChild=null,this._prev=null,this._next=null,this._sourcepos=t,this._lastLineBlank=!1,this._open=!0,this._string_content=null,this._literal=null,this._listData={},this._info=null,this._destination=null,this._title=null,this._isFenced=!1,this._fenceChar=null,this._fenceLength=0,this._fenceOffset=null,this._level=null,this._onEnter=null,this._onExit=null},u=s.prototype;Object.defineProperty(u,"isContainer",{get:function(){return r(this)}}),Object.defineProperty(u,"type",{get:function(){return this._type}}),Object.defineProperty(u,"firstChild",{get:function(){return this._firstChild}}),Object.defineProperty(u,"lastChild",{get:function(){return this._lastChild}}),Object.defineProperty(u,"next",{get:function(){return this._next}}),Object.defineProperty(u,"prev",{get:function(){return this._prev}}),Object.defineProperty(u,"parent",{get:function(){return this._parent}}),Object.defineProperty(u,"sourcepos",{get:function(){return this._sourcepos}}),Object.defineProperty(u,"literal",{get:function(){return this._literal},set:function(e){this._literal=e}}),Object.defineProperty(u,"destination",{get:function(){return this._destination},set:function(e){this._destination=e}}),Object.defineProperty(u,"title",{get:function(){return this._title},set:function(e){this._title=e}}),Object.defineProperty(u,"info",{get:function(){return this._info},set:function(e){this._info=e}}),Object.defineProperty(u,"level",{get:function(){return this._level},set:function(e){this._level=e}}),Object.defineProperty(u,"listType",{get:function(){return this._listData.type},set:function(e){this._listData.type=e}}),Object.defineProperty(u,"listTight",{get:function(){return this._listData.tight},set:function(e){this._listData.tight=e}}),Object.defineProperty(u,"listStart",{get:function(){return this._listData.start},set:function(e){this._listData.start=e}}),Object.defineProperty(u,"listDelimiter",{get:function(){return this._listData.delimiter},set:function(e){this._listData.delimiter=e}}),Object.defineProperty(u,"onEnter",{get:function(){return this._onEnter},set:function(e){this._onEnter=e}}),Object.defineProperty(u,"onExit",{get:function(){return this._onExit},set:function(e){this._onExit=e}}),s.prototype.appendChild=function(e){e.unlink(),e._parent=this,this._lastChild?(this._lastChild._next=e,e._prev=this._lastChild,this._lastChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.prependChild=function(e){e.unlink(),e._parent=this,this._firstChild?(this._firstChild._prev=e,e._next=this._firstChild,this._firstChild=e):(this._firstChild=e,this._lastChild=e)},s.prototype.unlink=function(){this._prev?this._prev._next=this._next:this._parent&&(this._parent._firstChild=this._next),this._next?this._next._prev=this._prev:this._parent&&(this._parent._lastChild=this._prev),this._parent=null,this._next=null,this._prev=null},s.prototype.insertAfter=function(e){e.unlink(),e._next=this._next,e._next&&(e._next._prev=e),e._prev=this,this._next=e,e._parent=this._parent,e._next||(e._parent._lastChild=e)},s.prototype.insertBefore=function(e){e.unlink(),e._prev=this._prev,e._prev&&(e._prev._next=e),e._next=this,this._prev=e,e._parent=this._parent,e._prev||(e._parent._firstChild=e)},s.prototype.walker=function(){return new a(this)},e.exports=s},function(e,t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":typeof(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){var r=n(51),i=n(172),o=n(70),a=n(126),s=n(569);e.exports=function(e,t){var n=1==e,u=2==e,l=3==e,c=4==e,p=6==e,f=5==e||p,h=t||s;return function(t,s,d){for(var m,v,g=o(t),y=i(g),_=r(s,d,3),b=a(y.length),x=0,k=n?h(t,b):u?h(t,0):void 0;b>x;x++)if((f||x in y)&&(m=y[x],v=_(m,x,g),e))if(n)k[x]=v;else if(v)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:k.push(m)}else if(c)return!1;return p?-1:l||c?c:k}}},function(e,t,n){var r=n(93),i=n(19)("toStringTag"),o="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(e){}};e.exports=function(e){var t,n,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=a(t=Object(e),i))?n:o?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(27),i=n(22).document,o=r(i)&&r(i.createElement);e.exports=function(e){return o?i.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(93);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";function r(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=i(t),this.reject=i(n)}var i=n(92);e.exports.f=function(e){return new r(e)}},function(e,t,n){var r=n(33),i=n(578),o=n(171),a=n(178)("IE_PROTO"),s=function(){},u=function(){var e,t=n(170)("iframe"),r=o.length;for(t.style.display="none",n(315).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("