diff options
41 files changed, 1320 insertions, 389 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java new file mode 100644 index 0000000000..86be9ec3d8 --- /dev/null +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/CreateStackRequest.java @@ -0,0 +1,36 @@ +package org.onap.so.openstack.beans; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class CreateStackRequest { + + @JsonProperty("parameters") + private Map<String, Object> parameters; + + @JsonProperty("environment") + private String environment; + + public Map<String, Object> getParameters() { + return parameters; + } + + public void setParameters(Map<String, Object> parameters) { + this.parameters = parameters; + } + + public String getEnvironment() { + return environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + @Override + public String toString() { + return "CreateStackRequest [parameters=" + parameters + ", environment=" + environment + "]"; + } + + +} 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 index 28d4f3f9b4..1d75892138 100644 --- 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 @@ -55,6 +55,7 @@ import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; +import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound; @@ -354,7 +355,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { try { ObjectMapper mapper = new ObjectMapper(); InfraActiveRequests foundRequest = requestDBClient.getInfraActiveRequestbyRequestId(requestId); - String stackRequest = mapper.writeValueAsString(request.getParameters()); + CreateStackRequest createStackRequest = new CreateStackRequest(); + createStackRequest.setEnvironment(request.getEnvironment()); + createStackRequest.setParameters(request.getParameters()); + String stackRequest = mapper.writeValueAsString(createStackRequest); CloudApiRequests cloudReq = new CloudApiRequests(); cloudReq.setCloudIdentifier(stackName); cloudReq.setRequestBody(stackRequest); diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java index 687b7d8d2f..e840d5affd 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java @@ -48,10 +48,12 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.db.request.beans.CloudApiRequests; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.openstack.beans.CreateStackRequest; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoOpenstackException; import org.onap.so.openstack.exceptions.MsoStackAlreadyExists; import org.springframework.core.env.Environment; +import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.base.client.OpenStackResponseException; import com.woorea.openstack.heat.Heat; import com.woorea.openstack.heat.StackResource; @@ -415,11 +417,22 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { @Test public final void saveStack_Test() throws MsoException, IOException, NovaClientException { + CreateStackParam createStackParam = new CreateStackParam(); createStackParam.setStackName("stackName"); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("test", "value"); + String environment = + "parameters:\n mmn_volume_name_1: \"data-mn-v-vdb\"\n mmn_volume_name_2: \"arch-mn-v-vdc\"\n"; createStackParam.setParameters(parameters); + createStackParam.setEnvironment(environment); + + CreateStackRequest createStackRequest = new CreateStackRequest(); + createStackRequest.setEnvironment(environment); + createStackRequest.setParameters(parameters); + ObjectMapper mapper = new ObjectMapper(); + String stackRequest = mapper.writeValueAsString(createStackRequest); + InfraActiveRequests request = new InfraActiveRequests(); request.setRequestId("requestId"); doReturn(request).when(requestDbClient).getInfraActiveRequestbyRequestId("requestId"); @@ -427,7 +440,8 @@ public class MsoHeatUtilsTest extends MsoHeatUtils { heatUtils.saveStackRequest(createStackParam, "requestId", "stackName"); Mockito.verify(requestDbClient, times(1)).updateInfraActiveRequests(request); assertNotNull(request.getCloudApiRequests().get(0)); - assertEquals(request.getCloudApiRequests().get(0).getRequestId(), "requestId"); + assertEquals("requestId", request.getCloudApiRequests().get(0).getRequestId()); + assertEquals(stackRequest, request.getCloudApiRequests().get(0).getRequestBody()); } @Test diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java index 2f99fed875..4a5a6119cd 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java @@ -37,6 +37,16 @@ public class VduArtifact { 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; + } + @Override public boolean equals(final Object other) { if (!(other instanceof VduArtifact)) { @@ -52,16 +62,6 @@ public class VduArtifact { return new HashCodeBuilder().append(name).append(content).append(type).toHashCode(); } - // 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; } diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml index bcf5429789..1487cb21b2 100644 --- a/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-catalog-db-adapter/src/main/resources/application.yaml @@ -41,6 +41,8 @@ spring: jackson: serialization: fail-on-empty-beans: false + main: + allow-bean-definition-overriding: true #Actuator management: diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java index 34177ff5a3..3c073af6ba 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java @@ -48,10 +48,10 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; -import org.springframework.http.client.BufferingClientHttpRequestFactory; -import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import org.onap.so.client.RestTemplateConfig; +import javax.inject.Provider; @Component public class ValetClient { @@ -75,6 +75,9 @@ public class ValetClient { private static final String BODY = ", body="; @Autowired private ObjectMapper mapper; + @Autowired + private Provider<RestTemplate> templateProvider; + protected String baseUrl; protected String basePath; @@ -123,10 +126,7 @@ public class ValetClient { } private RestTemplate getRestTemplate() { - RestTemplate restTemplate = new RestTemplate(); - restTemplate - .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); - return restTemplate; + return templateProvider.get(); } /* diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index 1c4de2daa1..ba31daaeaf 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -33,6 +33,8 @@ spring: ddl-auto: none naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy enable-lazy-load-no-trans: true + main: + allow-bean-definition-overriding: true org: onap: so: diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml index 7234733b95..17b014b993 100644 --- a/adapters/mso-requests-db-adapter/src/main/resources/application.yaml +++ b/adapters/mso-requests-db-adapter/src/main/resources/application.yaml @@ -47,6 +47,8 @@ spring: username: mso_admin password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' role: ACTUATOR + main: + allow-bean-definition-overriding: true #Actuator management: diff --git a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml index 9be0a257c9..2ef721fca5 100644 --- a/adapters/mso-sdnc-adapter/src/main/resources/application.yaml +++ b/adapters/mso-sdnc-adapter/src/main/resources/application.yaml @@ -11,6 +11,10 @@ mso: max-pool-size: 50 queue-capacity: 500 +spring: + main: + allow-bean-definition-overriding: true + #Actuator management: endpoints: diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java index 3342e0d054..ab631837db 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java @@ -63,9 +63,9 @@ public class VnfmServiceProviderConfiguration { private static final Logger logger = LoggerFactory.getLogger(VnfmServiceProviderConfiguration.class); - @Value("${http.client.ssl.trust-store}") + @Value("${http.client.ssl.trust-store:#{null}}") private Resource keyStore; - @Value("${http.client.ssl.trust-store-password}") + @Value("${http.client.ssl.trust-store-password:#{null}}") private String keyStorePassword; @Bean(name = "vnfmServiceProvider") @@ -77,7 +77,9 @@ public class VnfmServiceProviderConfiguration { private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate, final HttpHeadersProvider httpHeadersProvider) { setGsonMessageConverter(restTemplate); - setTrustStore(restTemplate); + if (keyStore != null) { + setTrustStore(restTemplate); + } removeSpringClientFilter(restTemplate); return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider); } diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml index 0bd63dffa9..4434d2edd9 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml @@ -34,6 +34,11 @@ server: port: 9092 tomcat: max-threads: 50 + ssl: + key-alias: so@so.onap.org + key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L' + key-store: classpath:so-vnfm-adapter.p12 + key-store-type: PKCS12 mso: key: 07a7159d3bf51a0e53be7a8f89699be7 @@ -50,7 +55,7 @@ sdc: endpoint: http://sdc.onap/1234A vnfmadapter: - endpoint: http://so-vnfm-adapter.onap:9092 + endpoint: https://so-vnfm-adapter.onap:9092 #Actuator management: diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 Binary files differnew file mode 100644 index 0000000000..ae4fddc684 --- /dev/null +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/so-vnfm-adapter.p12 diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml index 3afc542a1b..8cf8b51b9f 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application-test.yaml +++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/resources/application.yaml @@ -38,3 +38,17 @@ sdc: vnfmadapter: endpoint: https://so-vnfm-adapter.onap:30406 + +#Actuator +management: + endpoints: + web: + base-path: /manage + exposure: + include: "*" + 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. diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index a08206b477..e4c95f6290 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -1087,9 +1087,9 @@ public class ToscaResourceInstaller { tempGroupList.addAll(groupList); for (Group group : groupList) { + boolean isAllExists = true; ArrayList<NodeTemplate> members = group.getMemberNodes(); for (NodeTemplate memberNode : members) { - boolean isAllExists = true; RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(memberNode); if (requirements == null || requirements.getAll() == null || requirements.getAll().isEmpty()) { continue; @@ -1097,27 +1097,28 @@ public class ToscaResourceInstaller { List<RequirementAssignment> rqaList = requirements.getAll(); for (RequirementAssignment rqa : rqaList) { String name = rqa.getNodeTemplateName(); - for (NodeTemplate node : nodes) { - if (name.equals(node.getName())) { - break; - } + Optional<NodeTemplate> findNode = + nodes.stream().filter(node -> node.getName().equals(name)).findFirst(); + if (!findNode.isPresent()) { + isAllExists = false; + break; } - - isAllExists = false; - break; } - - if (isAllExists) { - strSequence.add(group.getName()); - tempGroupList.remove(group); - nodes.addAll(group.getMemberNodes()); + if (!isAllExists) { + break; } } - if (!tempGroupList.isEmpty() && tempGroupList.size() < groupList.size()) { - getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + if (isAllExists) { + strSequence.add(group.getName()); + tempGroupList.remove(group); + nodes.addAll(group.getMemberNodes()); } } + + if (tempGroupList.size() != 0 && tempGroupList.size() < groupList.size()) { + getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + } } public void processWatchdog(String distributionId, String servideUUID, Optional<String> distributionNotification, @@ -1896,7 +1897,13 @@ public class ToscaResourceInstaller { vnfcCustomization .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcTemplate, inputList)); - vfcInstanceGroupCustom.getVnfcCustomizations().add(vnfcCustomization); + List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations(); + + if (vnfcCustomizations == null) { + vnfcCustomizations = new ArrayList<>(); + vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations); + } + vnfcCustomizations.add(vnfcCustomization); } } } diff --git a/asdc-controller/src/main/resources/application.yaml b/asdc-controller/src/main/resources/application.yaml index beb40e5e65..2de5b6914f 100644 --- a/asdc-controller/src/main/resources/application.yaml +++ b/asdc-controller/src/main/resources/application.yaml @@ -18,6 +18,8 @@ spring: ddl-auto: validate naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy enable-lazy-load-no-trans: true + main: + allow-bean-definition-overriding: true request: datasource: diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index 115af3adaf..7534ea645a 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -32,6 +32,7 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -51,6 +52,8 @@ import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.Group; import org.onap.sdc.toscaparser.api.NodeTemplate; +import org.onap.sdc.toscaparser.api.RequirementAssignment; +import org.onap.sdc.toscaparser.api.RequirementAssignments; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.toscaparser.api.elements.StatefulEntityType; import org.onap.sdc.utils.DistributionStatusEnum; @@ -76,6 +79,7 @@ import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatu import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.util.ReflectionTestUtils; import java.util.Optional; +import java.util.stream.Collectors; public class ToscaResourceInstallerTest extends BaseTest { @Autowired @@ -488,6 +492,81 @@ public class ToscaResourceInstallerTest extends BaseTest { verify(vnrConfigCustom, times(1)).setConfigResourceCustomization(vrfConfigCustom); } + @Test + public void testProcessVNFCGroupSequence() { + List<Group> groupList = new ArrayList<>(); + + Group group1 = mock(Group.class); + NodeTemplate node1 = mock(NodeTemplate.class); + List<NodeTemplate> nodeList1 = new ArrayList<>(); + nodeList1.add(node1); + doReturn("VfcInstanceGroup..0").when(group1).getName(); + doReturn(nodeList1).when(group1).getMemberNodes(); + doReturn("deviceV3").when(node1).getName(); + + Group group2 = mock(Group.class); + NodeTemplate node2 = mock(NodeTemplate.class); + List<NodeTemplate> nodeList2 = new ArrayList<>(); + nodeList2.add(node2); + doReturn("VfcInstanceGroup..1").when(group2).getName(); + doReturn(nodeList2).when(group2).getMemberNodes(); + RequirementAssignments requirements2 = mock(RequirementAssignments.class); + RequirementAssignment requirement2 = mock(RequirementAssignment.class); + List<RequirementAssignment> requirementCollection2 = new ArrayList<>(); + requirementCollection2.add(requirement2); + doReturn(requirementCollection2).when(requirements2).getAll(); + doReturn("deviceV3").when(requirement2).getNodeTemplateName(); + doReturn("SiteV2").when(node2).getName(); + + Group group3 = mock(Group.class); + NodeTemplate node3 = mock(NodeTemplate.class); + List<NodeTemplate> nodeList3 = new ArrayList<>(); + nodeList3.add(node3); + doReturn("VfcInstanceGroup..2").when(group3).getName(); + doReturn(nodeList3).when(group3).getMemberNodes(); + RequirementAssignments requirements3 = mock(RequirementAssignments.class); + RequirementAssignment requirement3 = mock(RequirementAssignment.class); + List<RequirementAssignment> requirementCollection3 = new ArrayList<>(); + requirementCollection3.add(requirement3); + doReturn(requirementCollection3).when(requirements3).getAll(); + doReturn("SiteV2").when(requirement3).getNodeTemplateName(); + doReturn("siteWanV2").when(node3).getName(); + + groupList.add(group1); + groupList.add(group2); + groupList.add(group3); + + doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); + doReturn(null).when(csarHelper).getRequirementsOf(node1); + doReturn(requirements2).when(csarHelper).getRequirementsOf(node2); + doReturn(requirements3).when(csarHelper).getRequirementsOf(node3); + + ToscaResourceInstaller installer = new ToscaResourceInstaller(); + Method[] methods = installer.getClass().getDeclaredMethods(); + Method testMethod = null; + for (Method method : methods) { + String name = method.getName(); + if (name.equals("processVNFCGroupSequence")) { + method.setAccessible(true); + testMethod = method; + } + } + + if (null != testMethod) { + try { + Object seqResult = testMethod.invoke(installer, toscaResourceStructure, groupList); + if (seqResult instanceof List) { + String resultStr = ((List<String>) seqResult).stream().collect(Collectors.joining(",")); + assertEquals(((List<String>) seqResult).size(), 3); + } + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + } + + class MockConstants { public final static String MODEL_NAME = "VLAN Network Receptor Configuration"; public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0"; diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index c7665acc68..9a39334af1 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -150,6 +150,17 @@ public class BBInputSetup implements JavaDelegate { this.mapperLayer = mapperLayer; } + /** + * This method is used for executing the building block. + * + * It will get the BB from the execution object by checking if the aLaCarte and homing is true. + * + * Then it will get the GBB and execute it. + * + * @param execution + * @throws Exception + * @return + */ @Override public void execute(DelegateExecution execution) throws Exception { try { @@ -1538,6 +1549,14 @@ public class BBInputSetup implements JavaDelegate { return serviceInstance; } + /** + * This method is used for getting the existing service instance. + * + * This will map the serviceInstanceAAI to serviceInstance and return the serviceInstance. + * + * @throws Exception + * @return serviceInstance + */ public ServiceInstance getExistingServiceInstance(org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI) throws Exception { ServiceInstance serviceInstance = mapperLayer.mapAAIServiceInstanceIntoServiceInstance(serviceInstanceAAI); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index f8d5402260..dcb9e08d0b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -31,6 +31,7 @@ import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.Configurations; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.InstanceGroup; @@ -50,6 +51,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFou import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.NoServiceInstanceFoundException; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; @@ -575,4 +577,53 @@ public class BBInputSetupUtils { } return Optional.empty(); } + + public ServiceInstances getAAIServiceInstancesGloballyByName(String serviceInstanceName) { + + return injectionHelper.getAaiClient() + .get(ServiceInstances.class, AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + .queryParam("service-instance-name", serviceInstanceName)) + .orElseGet(() -> { + logger.debug("No Service Instance matched by name"); + return null; + }); + } + + public boolean existsAAINetworksGloballyByName(String networkName) { + + AAIResourceUri l3networkUri = + AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); + AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); + return aaiRC.exists(l3networkUri); + } + + public GenericVnfs getAAIVnfsGloballyByName(String vnfName) { + + return injectionHelper.getAaiClient() + .get(GenericVnfs.class, + AAIUriFactory.createNodesUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)) + .orElseGet(() -> { + logger.debug("No GenericVnfs matched by name"); + return null; + }); + } + + public Optional<Configuration> getRelatedConfigurationByNameFromServiceInstance(String serviceInstanceId, + String configurationName) throws Exception { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId); + uri.relatedTo(AAIObjectPlurals.CONFIGURATION).queryParam("configuration-name", configurationName); + Optional<Configurations> configurations = injectionHelper.getAaiClient().get(Configurations.class, uri); + Configuration configuration = null; + if (!configurations.isPresent()) { + logger.debug("No Configurations matched by name"); + return Optional.empty(); + } else { + if (configurations.get().getConfiguration().size() > 1) { + throw new Exception("Multiple Configurations Returned"); + } else { + configuration = configurations.get().getConfiguration().get(0); + } + return Optional.of(configuration); + } + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index 189947595a..7780837714 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -47,6 +47,7 @@ import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.CloudRegion; import org.onap.aai.domain.yang.Configuration; +import org.onap.aai.domain.yang.Configurations; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.L3Network; @@ -865,4 +866,16 @@ public class BBInputSetupUtilsTest { assertEquals(expectedFlowsToExecute.size(), flowsToExecute.size()); } + @Test + public void getRelatedConfigurationByNameFromServiceInstanceTest() throws Exception { + Optional<Configurations> expected = Optional.of(new Configurations()); + Configuration configuration = new Configuration(); + configuration.setConfigurationId("id123"); + expected.get().getConfiguration().add(configuration); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(Configurations.class), any(AAIResourceUri.class)); + Optional<Configuration> actual = + this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123"); + assertEquals(actual.get().getConfigurationId(), expected.get().getConfiguration().get(0).getConfigurationId()); + } + } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml index 185db168fe..1ad95b3ab9 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml +++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml @@ -19,6 +19,8 @@ spring: enabled: false jersey: application-path: /sobpmnengine + main: + allow-bean-definition-overriding: true camunda: bpm: application: diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn index fb9704d294..884ec209aa 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/PauseForManualTaskActivity.bpmn @@ -22,11 +22,11 @@ </bpmn2:userTask> <bpmn2:sequenceFlow id="SequenceFlow_0b84ki5" sourceRef="UpdateDbStatusToPendingManualTask" targetRef="CreateExternalTicket" /> <bpmn2:sequenceFlow id="SequenceFlow_14cyk9v" sourceRef="UpdateDbStatusToInProgress" targetRef="PauseForManualTaskActivity_End" /> - <bpmn2:serviceTask id="UpdateDbStatusToPendingManualTask" name="Update Infra DB Status to PENDING_MANUAL_TASK" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution,"PENDING_MANUAL_TASK")}"> + <bpmn2:serviceTask id="UpdateDbStatusToPendingManualTask" name="Update Infra DB Status to PENDING_MANUAL_TASK" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")),"PENDING_MANUAL_TASK")}"> <bpmn2:incoming>SequenceFlow_0jav6cu</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0b84ki5</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="UpdateDbStatusToInProgress" name="Update Infra DB Status to IN_PROGRESS" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution, "IN_PROGRESS")}"> + <bpmn2:serviceTask id="UpdateDbStatusToInProgress" name="Update Infra DB Status to IN_PROGRESS" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), "IN_PROGRESS")}"> <bpmn2:incoming>SequenceFlow_192yimz</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_14cyk9v</bpmn2:outgoing> </bpmn2:serviceTask> @@ -37,12 +37,12 @@ <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression"><![CDATA[${execution.getVariable("taskTimeout")}]]></bpmn2:timeDuration> </bpmn2:timerEventDefinition> </bpmn2:boundaryEvent> - <bpmn2:serviceTask id="CreateExternalTicket" name="Create ExternalTicket" camunda:expression="${ManualHandlingTasks.createExternalTicket(execution)}"> + <bpmn2:serviceTask id="CreateExternalTicket" name="Create ExternalTicket" camunda:expression="${ManualHandlingTasks.createExternalTicket(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn2:incoming>SequenceFlow_0b84ki5</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0igra4l</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_01k6zgt" sourceRef="ManualTaskTimer" targetRef="UpdateDBStatusToTimeout" /> - <bpmn2:serviceTask id="UpdateDBStatusToTimeout" name="Update Infra DB Status To TIMEOUT" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(execution, "TIMEOUT")}"> + <bpmn2:serviceTask id="UpdateDBStatusToTimeout" name="Update Infra DB Status To TIMEOUT" camunda:expression="${ManualHandlingTasks.updateRequestDbStatus(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), "TIMEOUT")}"> <bpmn2:incoming>SequenceFlow_01k6zgt</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_16bjdgj</bpmn2:outgoing> </bpmn2:serviceTask> @@ -147,4 +147,4 @@ </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn2:definitions> +</bpmn2:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java index 484f9b8506..c0b0094f20 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskActivityTest.java @@ -35,6 +35,7 @@ import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.onap.so.bpmn.BaseBPMNTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; public class PauseForManualTaskActivityTest extends BaseBPMNTest { @@ -85,7 +86,7 @@ public class PauseForManualTaskActivityTest extends BaseBPMNTest { @Test public void rainyDayPauseForManualTask_Test() throws Exception { doThrow(new BpmnError("7000", "TESTING ERRORS")).when(manualHandlingTasks) - .createExternalTicket((any(DelegateExecution.class))); + .createExternalTicket((any(BuildingBlockExecution.class))); ProcessInstance pi = runtimeService.startProcessInstanceByKey("PauseForManualTaskActivity", variables); assertThat(pi).isNotNull().isStarted() .hasPassedInOrder("PauseForManualTaskActivity_Start", "UpdateDbStatusToPendingManualTask", diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 95be6ba7fc..1516f289fe 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -89,6 +89,14 @@ public class ServicePluginFactory { private static ServicePluginFactory instance; + private static final String CUSTOM_RESOURCE_TP = "custom-resource-tp"; + private static final String VS_MONITORED = "VS_assured"; + private static final String VS_UNMONITORED = "VS_besteffort"; + private static final String TS_MONITORED = "TS1"; + private static final String TS_UNMONITORED = "TS2"; + private static final String CUSTOM_TP_LIST[] = + new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED}; + static { try (InputStream is = ClassLoader.class.getResourceAsStream("/application.properties")) { Properties prop = new Properties(); @@ -351,13 +359,6 @@ public class ServicePluginFactory { return false; } - public static String CUSTOM_RESOURCE_TP = "custom-resource-tp"; - public static String VS_MONITORED = "VS_assured"; - public static String VS_UNMONITORED = "VS_besteffort"; - public static String TS_MONITORED = "TS1"; - public static String TS_UNMONITORED = "TS2"; - public static String CUSTOM_TP_LIST[] = new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED}; - private void customizeTP(Map<String, Object> crossTps, String svcName, DelegateExecution execution) { Optional<String> customType = Arrays.stream(CUSTOM_TP_LIST).filter(svcName::contains).findFirst(); if (customType.isPresent()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index 583e3e172a..68cfd487b3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -104,6 +104,14 @@ public class AAICreateTasks { @Autowired private Environment env; + /** + * This method is used for creating the service instance in A&AI. + * + * It will check the alaCarte and create the service instance in A&AI. + * + * @param execution + * @throws @return + */ public void createServiceInstance(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -115,6 +123,12 @@ public class AAICreateTasks { } } + /** + * This method is used for creating and subscribing the service in A&AI. + * + * @param execution + * @throws @return + */ public void createServiceSubscription(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -136,6 +150,12 @@ public class AAICreateTasks { } } + /** + * This method is used for creation of the project A&AI. + * + * @param execution + * @throws @return + */ public void createProject(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -153,6 +173,12 @@ public class AAICreateTasks { } } + /** + * This method is used for creating OwningEntity A&AI. + * + * @param execution + * @throws @return + */ public void createOwningEntity(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -192,6 +218,16 @@ public class AAICreateTasks { } } + /** + * This method is used for creating Vnf in A&AI. + * + * It will check if the Vnf Name is exits in A&AI then it will throw the duplicate name exception. + * + * Otherwise it will create the vnf amd connect to the serviceinstance. + * + * @param execution + * @throws @return + */ public void createVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -204,6 +240,12 @@ public class AAICreateTasks { } } + /** + * This method is used for separating (,) from the string. + * + * @param str + * @throws @return + */ public void createPlatform(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -223,10 +265,22 @@ public class AAICreateTasks { } + /** + * This method is used for separating (,) from the string. + * + * @param str + * @throws @return + */ public List<String> splitCDL(String str) { return Stream.of(str.split(",")).map(String::trim).map(elem -> new String(elem)).collect(Collectors.toList()); } + /** + * This method is used for creating the type of business in A&AI. + * + * @param execution + * @throws @return + */ public void createLineOfBusiness(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -246,6 +300,12 @@ public class AAICreateTasks { } } + /** + * This method is used for creating the volume group in A&AI. + * + * @param execution + * @throws @return + */ public void createVolumeGroup(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -261,6 +321,12 @@ public class AAICreateTasks { } } + /** + * This method is used for creating the vfModule in A&AI. + * + * @param execution + * @throws @return + */ public void createVfModule(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -279,7 +345,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -304,7 +370,7 @@ public class AAICreateTasks { /** * BPMN access method to execute Create L3Network operation (PUT )in AAI - * + * * @param execution * @throws Exception */ @@ -325,6 +391,12 @@ public class AAICreateTasks { } } + /** + * This method is used for creating the customer in A&AI. + * + * @param execution + * @throws Exception + */ public void createCustomer(BuildingBlockExecution execution) throws Exception { try { Customer customer = execution.getGeneralBuildingBlock().getCustomer(); @@ -337,7 +409,7 @@ public class AAICreateTasks { /** * BPMN access method to execute NetworkCollection operation (PUT) in AAI - * + * * @param execution * @throws Exception */ @@ -357,7 +429,7 @@ public class AAICreateTasks { /** * BPMN access method to execute NetworkCollectionInstanceGroup operation (PUT) in AAI - * + * * @param execution * @throws Exception */ @@ -378,7 +450,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -393,7 +465,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -409,7 +481,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -432,7 +504,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -447,7 +519,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -464,7 +536,7 @@ public class AAICreateTasks { /** * BPMN access method to establish relationships in AAI - * + * * @param execution * @throws Exception */ @@ -482,6 +554,11 @@ public class AAICreateTasks { } } + /** + * This method is used for configuring the service in A&AI. + * + * @param execution @throws + */ public void createConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); @@ -491,6 +568,11 @@ public class AAICreateTasks { } } + /** + * This method is used for creating vnf instance group in A&AI. + * + * @param execution @throws + */ public void createInstanceGroupVnf(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -502,6 +584,11 @@ public class AAICreateTasks { } } + /** + * This method is used to put the network policy in A&AI. + * + * @param execution @throws + */ public void createNetworkPolicies(BuildingBlockExecution execution) { try { String fqdns = execution.getVariable(CONTRAIL_NETWORK_POLICY_FQDN_LIST); @@ -536,10 +623,10 @@ public class AAICreateTasks { /** * Groups existing vf modules by the model uuid of our new vf module and returns the lowest unused index - * + * * if we have a module type A, and there are 3 instances of those, and then module type B has 2 instances, if we are * adding a new module type A, the vf-module-index should be 3 assuming contiguous indices (not 5, or 2) - * + * */ protected int getLowestUnusedVfModuleIndexFromAAIVnfResponse(GenericVnf genericVnf, VfModule newVfModule) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 01bdc09419..20f4443291 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -79,6 +79,11 @@ public class AAIUpdateTasks { @Autowired private AAIConfigurationResources aaiConfigurationResources; + /** + * BPMN access method to update the status of Service to Assigned in AAI + * + * @param execution + */ public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -91,6 +96,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Service to Active in AAI + * + * @param execution + */ public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) { try { ServiceInstance serviceInstance = @@ -102,6 +112,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Vnf to Assigned in AAI + * + * @param execution + */ public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -111,6 +126,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Vnf to Active in AAI + * + * @param execution + */ public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -120,6 +140,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VolumeGroup to Assigned in AAI + * + * @param execution + */ public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -134,6 +159,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VolumeGroup to Active in AAI + * + * @param execution + */ public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -148,6 +178,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VolumeGroup to Created in AAI + * + * @param execution + */ public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -162,6 +197,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update HeatStackId and VolumeGroup in AAI + * + * @param execution + */ public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -179,6 +219,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VfModule to Assigned in AAI + * + * @param execution + */ public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -190,6 +235,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VfModule to PendingActivation in AAI + * + * @param execution + */ public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -201,6 +251,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI + * + * @param execution + */ public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -222,6 +277,12 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VfModule to Created in AAI + * + * @param execution + * + */ public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -232,6 +293,12 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule + * + * @param execution + * @throws buildAndThrowWorkflowException + */ public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeactivateVfModuleRollback", false); try { @@ -246,7 +313,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Assigned in AAI - * + * * @param execution * @throws BBObjectNotFoundException */ @@ -256,7 +323,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Active in AAI - * + * * @param execution * @throws BBObjectNotFoundException */ @@ -266,7 +333,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Created in AAI - * + * * @param execution * @throws BBObjectNotFoundException */ @@ -302,7 +369,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network Collection to Active in AAI - * + * * @param execution * @throws BBObjectNotFoundException */ @@ -323,6 +390,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VfModule to Active in AAI + * + * @param execution + */ public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiActivateVfModuleRollback", false); try { @@ -335,6 +407,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update HeatStackId of VfModule in AAI + * + * @param execution + */ public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { try { String heatStackId = execution.getVariable("heatStackId"); @@ -352,7 +429,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network after it was created in cloud - * + * * @param execution * @throws Exception */ @@ -395,7 +472,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network after it was updated in cloud - * + * * @param execution * @throws Exception */ @@ -422,6 +499,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update L3Network Object + * + * @param execution + */ public void updateObjectNetwork(BuildingBlockExecution execution) { try { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); @@ -433,7 +515,7 @@ public class AAIUpdateTasks { /** * BPMN access method to update ServiceInstance - * + * * @param execution */ public void updateServiceInstance(BuildingBlockExecution execution) { @@ -446,6 +528,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update Vnf Object + * + * @param execution + */ public void updateObjectVnf(BuildingBlockExecution execution) { try { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -455,6 +542,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of VfModuleRollback as true + * + * @param execution + */ public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeleteVfModuleRollback", false); try { @@ -471,6 +563,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update Model of VfModule + * + * @param execution + */ public void updateModelVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); @@ -481,6 +578,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of FabricConfiguration to Assigned in AAI + * + * @param execution + */ public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); @@ -491,6 +593,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of FabricConfiguration to Active in AAI + * + * @param execution + */ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); @@ -500,6 +607,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of FabricConfiguration to deactive in AAI + * + * @param execution + */ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) { try { Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); @@ -510,6 +622,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update Ipv4OamAddress of Vnf + * + * @param execution + */ public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) { try { String ipv4OamAddress = execution.getVariable("oamManagementV4Address"); @@ -527,6 +644,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update ManagementV6Address of Vnf + * + * @param execution + */ public void updateManagementV6AddressVnf(BuildingBlockExecution execution) { try { String managementV6Address = execution.getVariable("oamManagementV6Address"); @@ -544,6 +666,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update ContrailServiceInstanceFqdn of VfModule + * + * @param execution + */ public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) { try { String contrailServiceInstanceFqdn = execution.getVariable("contrailServiceInstanceFqdn"); @@ -558,6 +685,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Vnf to ConfigAssigned in AAI + * + * @param execution + */ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -567,6 +699,11 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Vnf to Configure in AAI + * + * @param execution + */ public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -578,6 +715,11 @@ public class AAIUpdateTasks { } + /** + * BPMN access method to update status of Vnf to configured in AAI + * + * @param execution + */ public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java index 775e3213d4..638ecefa49 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.activity; +import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -99,6 +100,12 @@ public class ExecuteActivity implements JavaDelegate { variables.put("retryCount", 1); variables.put("aLaCarte", true); + execution.getVariables().forEach((key, value) -> { + if (value instanceof Serializable) { + variables.put(key, (Serializable) value); + } + }); + ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables) .executeWithVariablesInReturn(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java index 4cf5131747..c112d200e3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/Constants.java @@ -45,7 +45,7 @@ public class Constants { public static final String UNDERSCORE = "_"; public static final String SPACE = "\\s+"; - public static final String VNFM_ADAPTER_DEFAULT_URL = "http://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/"; + public static final String VNFM_ADAPTER_DEFAULT_URL = "https://so-vnfm-adapter.onap:9092/so/vnfm-adapter/v1/"; public static final String VNFM_ADAPTER_DEFAULT_AUTH = "Basic dm5mbTpwYXNzd29yZDEk"; public static final String FORWARD_SLASH = "/"; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index 17089be571..7e45c3b640 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -27,6 +27,7 @@ import org.camunda.bpm.engine.TaskService; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateTask; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.ticket.ExternalTicket; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -46,7 +47,7 @@ public class ManualHandlingTasks { private static final String TASK_TYPE_FALLOUT = "fallout"; public static final String VNF_TYPE = "vnfType"; public static final String SERVICE_TYPE = "serviceType"; - public static final String MSO_REQUEST_ID = "msoRequestId"; + public static final String MSO_REQUEST_ID = "mso-request-id"; public static final String REQUESTOR_ID = "requestorId"; public static final String ERROR_CODE = "errorCode"; public static final String VALID_RESPONSES = "validResponses"; @@ -120,7 +121,7 @@ public class ManualHandlingTasks { String originalRequestId = (String) execution.getVariable(MSO_REQUEST_ID); String originalRequestorId = (String) execution.getVariable(REQUESTOR_ID); String description = (String) execution.getVariable(DESCRIPTION); - String timeout = (String) execution.getVariable("taskTimeout"); + String timeout = ""; String errorSource = ""; String errorCode = ""; String errorMessage = ""; @@ -188,7 +189,7 @@ public class ManualHandlingTasks { } - public void createExternalTicket(DelegateExecution execution) { + public void createExternalTicket(BuildingBlockExecution execution) { try { ExternalTicket ticket = new ExternalTicket(); @@ -218,7 +219,7 @@ public class ManualHandlingTasks { } - public void updateRequestDbStatus(DelegateExecution execution, String status) { + public void updateRequestDbStatus(BuildingBlockExecution execution, String status) { try { String requestId = (String) execution.getVariable(MSO_REQUEST_ID); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index 4fcacb3c42..7eaf011c75 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -63,6 +63,11 @@ public class OrchestrationStatusValidator { @Autowired private CatalogDbClient catalogDbClient; + /** + * This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType + * + * @param execution + */ public void validateOrchestrationStatus(BuildingBlockExecution execution) { try { OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult = diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 89030d52dc..78cb533c9e 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -36,9 +36,11 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; @@ -51,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.client.aai.AAICommonObjectMapperProvider; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; @@ -112,6 +115,14 @@ public class WorkflowAction { private static final String SERVICE_TYPE_BONDING = "BONDING"; private static final String CLOUD_OWNER = "DEFAULT"; private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); + private static final String NAME_EXISTS_WITH_DIFF_VERSION_ID = "(%s) and different version id (%s)"; + private static final String NAME_EXISTS_MULTIPLE = + "(%s) and multiple combination of model-version-id + service-type + global-customer-id"; + private static final String NAME_EXISTS_WITH_DIFF_COMBINATION = + "(%s) and global-customer-id (%s), service-type (%s), model-version-id (%s)"; + private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID = + "(%s), same parent and different customization id (%s)"; + private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship"; @Autowired protected BBInputSetup bbInputSetup; @@ -149,6 +160,7 @@ public class WorkflowAction { String uri = (String) execution.getVariable(BBConstants.G_URI); final String vnfType = (String) execution.getVariable(VNF_TYPE); String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + final String createInstanceAction = "createInstance"; final String serviceType = Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse(""); @@ -189,7 +201,8 @@ public class WorkflowAction { WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); String resourceId = ""; - if (resource.isGenerated()) { + if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction) + && sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) { resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType, sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(), workflowResourceIds); @@ -1134,55 +1147,146 @@ public class WorkflowAction { RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws Exception { try { if ("SERVICE".equalsIgnoreCase(type.toString())) { + // Service name verification based upon name + model-version-id + // + service-type + global-customer-id per requirements String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId(); String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType(); if (instanceName != null) { Optional<ServiceInstance> serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName); if (serviceInstanceAAI.isPresent()) { - return serviceInstanceAAI.get().getServiceInstanceId(); + if (serviceInstanceAAI.get().getModelVersionId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) { + return serviceInstanceAAI.get().getServiceInstanceId(); + } else { + throw new DuplicateNameException("serviceInstance", + String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, instanceName, + reqDetails.getModelInfo().getModelVersionId())); + } + } else { + ServiceInstances aaiServiceInstances = + bbInputSetupUtils.getAAIServiceInstancesGloballyByName(instanceName); + if (aaiServiceInstances != null) { + if (aaiServiceInstances.getServiceInstance() != null + && !aaiServiceInstances.getServiceInstance().isEmpty()) { + if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new DuplicateNameException("serviceInstance", + String.format(NAME_EXISTS_MULTIPLE, instanceName)); + } else { + ServiceInstance si = + aaiServiceInstances.getServiceInstance().stream().findFirst().get(); + Map<String, String> keys = + bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId()); + + throw new DuplicateNameException("serviceInstance", + String.format(NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName, + keys.get("global-customer-id"), keys.get("service-type"), + si.getModelVersionId())); + } + } + } } } } else if ("NETWORK".equalsIgnoreCase(type.toString())) { Optional<L3Network> network = bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance( workflowResourceIds.getServiceInstanceId(), instanceName); if (network.isPresent()) { - return network.get().getNetworkId(); + if (network.get().getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return network.get().getNetworkId(); + } else { + throw new DuplicateNameException("l3Network", + String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, + network.get().getModelCustomizationId())); + } + } + + if (bbInputSetupUtils.existsAAINetworksGloballyByName(instanceName)) { + throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_PARENT, + instanceName, workflowResourceIds.getServiceInstanceId())); } + } else if ("VNF".equalsIgnoreCase(type.toString())) { Optional<GenericVnf> vnf = bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance( workflowResourceIds.getServiceInstanceId(), instanceName); if (vnf.isPresent()) { - return vnf.get().getVnfId(); + if (vnf.get().getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return vnf.get().getVnfId(); + } else { + throw new DuplicateNameException("generic-vnf", + String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, + vnf.get().getModelCustomizationId())); + } + } + GenericVnfs vnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(instanceName); + if (vnfs != null) { + throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_PARENT, + instanceName, vnfs.getGenericVnf().get(0).getVnfId())); } } else if ("VFMODULE".equalsIgnoreCase(type.toString())) { GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); if (vnf != null && vnf.getVfModules() != null) { for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { - return vfModule.getVfModuleId(); + if (vfModule.getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return vfModule.getVfModuleId(); + } else { + throw new DuplicateNameException("vfModule", + String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, + reqDetails.getModelInfo().getModelCustomizationId())); + } } } } } else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) { + GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); Optional<VolumeGroup> volumeGroup = bbInputSetupUtils .getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName); if (volumeGroup.isPresent()) { - return volumeGroup.get().getVolumeGroupId(); + if (vnf.getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return volumeGroup.get().getVolumeGroupId(); + } else { + throw new DuplicateNameException("volumeGroup", volumeGroup.get().getVolumeGroupName()); + } } - GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); if (vnf != null && vnf.getVfModules() != null) { for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { Optional<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(), vfModule.getVfModuleId(), instanceName); if (volumeGroupFromVfModule.isPresent()) { - return volumeGroupFromVfModule.get().getVolumeGroupId(); + if (vnf.getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return volumeGroupFromVfModule.get().getVolumeGroupId(); + } else { + throw new DuplicateNameException("volumeGroup", + String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, + volumeGroupFromVfModule.get().getModelCustomizationId())); + } } } } + } else if ("CONFIGURATION".equalsIgnoreCase(type.toString())) { + Optional<org.onap.aai.domain.yang.Configuration> configuration = + bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance( + workflowResourceIds.getServiceInstanceId(), instanceName); + if (configuration.isPresent()) { + if (configuration.get().getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return configuration.get().getConfigurationId(); + } else { + throw new DuplicateNameException("configuration", + String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, + configuration.get().getConfigurationId())); + } + } } return generatedResourceId; + } catch (DuplicateNameException dne) { + throw dne; } catch (Exception ex) { logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex); throw new IllegalStateException( diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java index 376a27e830..4cde9c1fc8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners; import java.util.Collections; import java.util.List; +import java.util.Optional; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.listener.db.PostCompletionRequestsDbListener; @@ -55,7 +56,7 @@ public class MultiStageSkipListener implements FlowManipulator, PostCompletionRe @Override public boolean shouldRunFor(BuildingBlockExecution execution) { - return (boolean) execution.getVariable(G_MULTI_STAGE_DESIGN); + return (boolean) Optional.ofNullable(execution.getVariable(G_MULTI_STAGE_DESIGN)).orElse(false); } @Override diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java index 9677f8e8f3..b40195c07b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java @@ -38,6 +38,8 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; import org.onap.so.db.request.beans.InfraActiveRequests; public class ManualHandlingTasksTest extends BaseTaskTest { @@ -56,11 +58,13 @@ public class ManualHandlingTasksTest extends BaseTaskTest { @Mock private DelegateTask task; - private DelegateExecution delegateExecution; + @Mock + private BuildingBlockExecution buildingBlockExecution; @Before public void before() throws Exception { delegateExecution = new DelegateExecutionFake(); + buildingBlockExecution = new DelegateExecutionImpl(delegateExecution); } @Test @@ -99,18 +103,18 @@ public class ManualHandlingTasksTest extends BaseTaskTest { @Test public void updateRequestDbStatus_Test() throws Exception { InfraActiveRequests mockedRequest = new InfraActiveRequests(); - delegateExecution.setVariable("msoRequestId", "testMsoRequestId"); + buildingBlockExecution.setVariable("mso-request-id", "msoRequestId"); when(requestsDbClient.getInfraActiveRequestbyRequestId(any(String.class))).thenReturn(mockedRequest); doNothing().when(requestsDbClient).updateInfraActiveRequests(any(InfraActiveRequests.class)); - manualHandlingTasks.updateRequestDbStatus(delegateExecution, "IN_PROGRESS"); + manualHandlingTasks.updateRequestDbStatus(buildingBlockExecution, "IN_PROGRESS"); verify(requestsDbClient, times(1)).updateInfraActiveRequests(any(InfraActiveRequests.class)); assertEquals(mockedRequest.getRequestStatus(), "IN_PROGRESS"); } @Test public void createExternalTicket_Test() throws Exception { - delegateExecution.setVariable("msoRequestId", ("testMsoRequestId")); - delegateExecution.setVariable("vnfType", "testVnfType"); - manualHandlingTasks.createExternalTicket(delegateExecution); + buildingBlockExecution.setVariable("mso-request-id", ("testMsoRequestId")); + buildingBlockExecution.setVariable("vnfType", "testVnfType"); + manualHandlingTasks.createExternalTicket(buildingBlockExecution); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 918a474b8a..eea885288e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -44,8 +44,10 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.UUID; @@ -62,10 +64,13 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.L3Networks; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.VfModule; import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.VolumeGroup; @@ -76,6 +81,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.aai.entities.Relationships; @@ -99,6 +105,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.RequestProcessingData; +import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; @@ -114,7 +121,6 @@ public class WorkflowActionTest extends BaseTaskTest { protected WorkflowAction workflowAction; private DelegateExecution execution; - @InjectMocks @Spy protected WorkflowAction SPY_workflowAction; @@ -1494,104 +1500,368 @@ public class WorkflowActionTest extends BaseTaskTest { assertNull(x.getVolumeGroupId()); } - @Test - public void validateResourceIdInAAITest() throws Exception { - // SI + private RequestDetails setupRequestDetails(String globalSubscriberId, String subscriptionServiceType, + String modelCustomizationId) { RequestDetails reqDetails = new RequestDetails(); SubscriberInfo subInfo = new SubscriberInfo(); - subInfo.setGlobalSubscriberId("id123"); + subInfo.setGlobalSubscriberId(globalSubscriberId); reqDetails.setSubscriberInfo(subInfo); RequestParameters reqParams = new RequestParameters(); - reqParams.setSubscriptionServiceType("subServiceType123"); + reqParams.setSubscriptionServiceType(subscriptionServiceType); reqDetails.setRequestParameters(reqParams); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationId(modelCustomizationId); + reqDetails.setModelInfo(modelInfo); + return reqDetails; + } + + @Test + public void validateVnfResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - Optional<ServiceInstance> siOp = Optional.of(si); - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111")) - .thenReturn(Optional.empty()); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", - reqDetails, workflowResourceIds); - assertEquals("siId123", id); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", - reqDetails, workflowResourceIds); + workflowResourceIds.setServiceInstanceId("siId123"); + // Vnf + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("vnfName123"); + vnf.setModelCustomizationId("1234567"); + Optional<GenericVnf> opVnf = Optional.of(vnf); + GenericVnf vnf2 = new GenericVnf(); + vnf2.setVnfId("id123"); + vnf2.setVnfName("vnfName222"); + vnf2.setModelCustomizationId("222"); + Optional<GenericVnf> opVnf2 = Optional.of(vnf2); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName222")).thenReturn(opVnf2); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty()); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails, + workflowResourceIds); assertEquals("generatedId123", id2); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "generic-vnf with name (vnfName222), same parent and different customization id (222) already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateVnfResourceNameInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + // Vnf + GenericVnfs genericVnfs = new GenericVnfs(); + GenericVnf vnf3 = new GenericVnf(); + vnf3.setVnfId("id123"); + vnf3.setVnfName("vnfName333"); + genericVnfs.getGenericVnf().add(vnf3); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName333")).thenReturn(Optional.empty()); + when(bbSetupUtils.getAAIVnfsGloballyByName("vnfName333")).thenReturn(genericVnfs); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "generic-vnf with name (vnfName333) id (id123) and different parent relationship already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName333", reqDetails, + workflowResourceIds); + } + + @Test + public void validateNetworkResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + // Network L3Network network = new L3Network(); network.setNetworkId("id123"); network.setNetworkName("name123"); + network.setModelCustomizationId("1234567"); workflowResourceIds.setServiceInstanceId("siId123"); Optional<L3Network> opNetwork = Optional.of(network); + L3Network network2 = new L3Network(); + network2.setNetworkId("id123"); + network2.setNetworkName("networkName222"); + network2.setModelCustomizationId("222"); + Optional<L3Network> opNetwork2 = Optional.of(network2); when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork); + when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "networkName222")) + .thenReturn(opNetwork2); when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty()); - id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, - workflowResourceIds); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", + reqDetails, workflowResourceIds); assertEquals("id123", id); - id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, - workflowResourceIds); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", + reqDetails, workflowResourceIds); assertEquals("generatedId123", id2); - // Vnf + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "l3Network with name (networkName222), same parent and different customization id (222) already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateNetworkResourceNameExistsInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + // Network + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + network.setModelCustomizationId("1234567"); + workflowResourceIds.setServiceInstanceId("siId123"); + + when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("networkName333", "111111")) + .thenReturn(Optional.empty()); + when(bbSetupUtils.existsAAINetworksGloballyByName("networkName333")).thenReturn(true); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "l3Network with name (networkName333) id (siId123) and different parent relationship already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName333", reqDetails, + workflowResourceIds); + } + + @Test + public void validateVfModuleResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + GenericVnf vnf = new GenericVnf(); vnf.setVnfId("id123"); vnf.setVnfName("vnfName123"); - Optional<GenericVnf> opVnf = Optional.of(vnf); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "name123")).thenReturn(opVnf); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty()); - id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "name123", reqDetails, - workflowResourceIds); - assertEquals("id123", id); - id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id2); + vnf.setModelCustomizationId("222"); // VfModule VfModules vfModules = new VfModules(); VfModule vfModule = new VfModule(); vfModule.setVfModuleId("id123"); vfModule.setVfModuleName("name123"); + vfModule.setModelCustomizationId("1234567"); vfModules.getVfModule().add(vfModule); vnf.setVfModules(vfModules); workflowResourceIds.setVnfId("id123"); when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); - id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", reqDetails, - workflowResourceIds); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", + reqDetails, workflowResourceIds); assertEquals("id123", id); - GenericVnf vnf2 = new GenericVnf(); + GenericVnf vnf1 = new GenericVnf(); VfModules vfModules2 = new VfModules(); VfModule vfModule2 = new VfModule(); vfModule2.setVfModuleId("id123"); - vfModule2.setVfModuleName("name123"); + vfModule2.setVfModuleName("vFModName222"); + vfModule2.setModelCustomizationId("222"); vfModules2.getVfModule().add(vfModule2); - vnf2.setVfModules(vfModules2); + vnf1.setVfModules(vfModules2); workflowResourceIds.setVnfId("id111"); - when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf2); - id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", reqDetails, - workflowResourceIds); + when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf1); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", + reqDetails, workflowResourceIds); assertEquals("generatedId123", id2); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "vfModule with name (vFModName222), same parent and different customization id (1234567) already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName222", reqDetails, + workflowResourceIds); + + } + + @Test + public void validateVolumeGroupResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("vnfName123"); + vnf.setModelCustomizationId("1234567"); + + GenericVnf vnf2 = new GenericVnf(); + vnf2.setVnfId("id123"); + vnf2.setVnfName("vnfName123"); + vnf2.setModelCustomizationId("222"); + // VolumeGroup VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); volumeGroup.setVolumeGroupName("name123"); workflowResourceIds.setVnfId("id123"); Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); + + workflowResourceIds.setVnfId("id123"); + + when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(opVolumeGroup); - id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, - workflowResourceIds); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", + reqDetails, workflowResourceIds); assertEquals("id123", id); - workflowResourceIds.setVnfId("id444"); - when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf); + when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf2); when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "111111")) .thenReturn(opVolumeGroup); - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444", "111111")).thenReturn(Optional.empty()); - id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, + + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "111111")).thenReturn(Optional.empty()); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", + reqDetails, workflowResourceIds); + assertEquals("generatedId123", id2); + } + + @Test + public void validateConfigurationResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + // Configuration + org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); + configuration.setConfigurationId("id123"); + configuration.setConfigurationName("name123"); + configuration.setModelCustomizationId("1234567"); + Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); + + org.onap.aai.domain.yang.Configuration configuration2 = new org.onap.aai.domain.yang.Configuration(); + configuration2.setConfigurationId("id123"); + configuration2.setConfigurationName("name123"); + configuration2.setModelCustomizationId("222"); + Optional<org.onap.aai.domain.yang.Configuration> opConfiguration2 = Optional.of(configuration2); + + workflowResourceIds.setVnfId("id123"); + + when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opConfiguration); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name123", + reqDetails, workflowResourceIds); + assertEquals("id123", id); + + when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "111111")) + .thenReturn(Optional.empty()); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "111111", + reqDetails, workflowResourceIds); + assertEquals("generatedId123", id2); + + when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name222")) + .thenReturn(opConfiguration2); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "configuration with name (name222), same parent and different customization id (id123) already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateServiceInstanceResourceIdInAAITest() throws Exception { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + si.setModelVersionId("1234567"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + Optional<ServiceInstance> siOp = Optional.of(si); + ServiceInstance si2 = new ServiceInstance(); + si2.setServiceInstanceId("siId222"); + si2.setModelVersionId("22222"); + si2.setServiceInstanceName("siName222"); + Optional<ServiceInstance> siOp2 = Optional.of(si2); + ServiceInstances serviceInstances2 = new ServiceInstances(); + serviceInstances2.getServiceInstance().add(si2); + + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName222")).thenReturn(siOp2); + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111")) + .thenReturn(Optional.empty()); + + when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", + reqDetails, workflowResourceIds); + assertEquals("siId123", id); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", + reqDetails, workflowResourceIds); + assertEquals("generatedId123", id2); + + when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName222")).thenReturn(serviceInstances2); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName222) and different version id (1234567) already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateServiceInstanceResourceIdInAAIMultipleTest() throws Exception { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + si.setModelVersionId("1234567"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + + ServiceInstance si2 = new ServiceInstance(); + si2.setServiceInstanceId("siId222"); + si2.setModelVersionId("22222"); + si2.setServiceInstanceName("siName222"); + serviceInstances.getServiceInstance().add(si2); + + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siId123")) + .thenReturn(Optional.empty()); + + when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName123) and multiple combination of model-version-id + service-type + global-customer-id already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, + workflowResourceIds); + } + + @Test + public void validateServiceInstanceResourceIdInAAIExistsTest() throws Exception { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + si.setModelVersionId("1234567"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siId123")) + .thenReturn(Optional.empty()); + + when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); + + Map<String, String> uriKeys = new HashMap<>(); + uriKeys.put("global-customer-id", "globalCustomerId"); + uriKeys.put("service-type", "serviceType"); + + when(bbSetupUtils.getURIKeysFromServiceInstance("siId123")).thenReturn(uriKeys); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName123) and global-customer-id (globalCustomerId), service-type (serviceType), model-version-id (1234567) already exists. The name must be unique.")); + workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, workflowResourceIds); - assertEquals("id123", id2); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java index 9e2eac416c..82d610fa97 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java @@ -77,6 +77,8 @@ public class MultiStageSkipListenerTest { execution.setVariable("multiStageDesign", false); assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution)); + execution.setVariable("multiStageDesign", null); + assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution)); } diff --git a/docs/api/apis/SO_Interface.rst b/docs/api/apis/SO_Interface.rst index b079989aff..d1586eb5d0 100644 --- a/docs/api/apis/SO_Interface.rst +++ b/docs/api/apis/SO_Interface.rst @@ -3,7 +3,7 @@ .. Copyright 2018 Huawei Technologies Co., Ltd. SO Interfaces -================================ +============= .. image:: ../../images/SO_1.png @@ -13,17 +13,17 @@ SO APIs North Bound APIs ---------------- Create service instance -++++++++++++++++++++++++ ++++++++++++++++++++++++ -+--------------------+-------------------------------------+ -|Interface Definition|Description | -+====================+=====================================+ ++--------------------+------------------------------------------------------------+ +|Interface Definition|Description | ++====================+============================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6 | -+--------------------+-------------------------------------+ -|Operation Type |POST | -+--------------------+-------------------------------------+ -|Content-Type |application/json | -+--------------------+-------------------------------------+ ++--------------------+------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+------------------------------------------------------------+ Request Body: @@ -205,17 +205,17 @@ LineOfBusiness Object +-------------------------+------------------+-------------------------------------------------+ Delete service instance -++++++++++++++++++++++++ ++++++++++++++++++++++++ -+--------------------+---------------------------------------------------------+ -|Interface Definition|Description | -+====================+=========================================================+ ++--------------------+--------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId} | -+--------------------+---------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+---------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+---------------------------------------------------------+ ++--------------------+--------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+--------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+--------------------------------------------------------------------------------+ Request Body: @@ -258,17 +258,17 @@ RequestInfo Object +-------------------------+------------------+-------------------------------------------------+ Create Volume Group -++++++++++++++++++++++++ ++++++++++++++++++++ -+--------------------+-------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+===========================================================================================+ ++--------------------+------------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+==================================================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups | -+--------------------+-------------------------------------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+-------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+-------------------------------------------------------------------------------------------+ ++--------------------+------------------------------------------------------------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+------------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+------------------------------------------------------------------------------------------------------------------+ Request Body: @@ -389,17 +389,17 @@ relatedInstance List +-------------------------+------------------+-------------------------------------------------+ Delete Volume Group -++++++++++++++++++++++++ ++++++++++++++++++++ -+--------------------+---------------------------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+=====================================================================================================================+ ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+============================================================================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volume-groupinstance-id} | -+--------------------+---------------------------------------------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+---------------------------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+---------------------------------------------------------------------------------------------------------------------+ ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+--------------------------------------------------------------------------------------------------------------------------------------------+ Request Body: @@ -450,17 +450,17 @@ RequestInfo Object +-------------------------+------------------+-------------------------------------------------+ Create VF Module -+++++++++++++++++ +++++++++++++++++ -+--------------------+----------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+========================================================================================+ ++--------------------+---------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+===============================================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules | -+--------------------+----------------------------------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+----------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+----------------------------------------------------------------------------------------+ ++--------------------+---------------------------------------------------------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+---------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+---------------------------------------------------------------------------------------------------------------+ Request Body: @@ -545,17 +545,17 @@ relatedInstance List +-------------------------+------------------+-------------------------------------------------+ Delete VF Module -++++++++++++++++++++++++ +++++++++++++++++ -+--------------------+--------------------------------------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+==============================================================================================================+ ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleinstance-id} | -+--------------------+--------------------------------------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+--------------------------------------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+--------------------------------------------------------------------------------------------------------------+ ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-------------------------------------------------------------------------------------------------------------------------------------+ Request Body: @@ -614,17 +614,17 @@ RequestInfo Object +-------------------------+------------------+-------------------------------------------------+ Create VNF -+++++++++++++++ +++++++++++ -+--------------------+--------------------------------------------------------------+ -|Interface Definition|Description | -+====================+==============================================================+ ++--------------------+-------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs | -+--------------------+--------------------------------------------------------------+ -|Operation Type |POST | -+--------------------+--------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+--------------------------------------------------------------+ ++--------------------+-------------------------------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+-------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-------------------------------------------------------------------------------------+ Request Body: @@ -761,17 +761,17 @@ UserParams Object +-------------------------+------------------+-------------------------------------------------+ Delete VNF -+++++++++++++++ +++++++++++ -+--------------------+------------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+==============================================================================+ ++--------------------+-----------------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================================+ |URI |/onap/so/infra/serviceInstantiation/serviceInstances/v6/{serviceInstanceId}/vnfs/{vnfInstanceId} | -+--------------------+------------------------------------------------------------------------------+ -|Operation Type |DELETE | -+--------------------+------------------------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+------------------------------------------------------------------------------+ ++--------------------+-----------------------------------------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+-----------------------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-----------------------------------------------------------------------------------------------------+ Request Body: @@ -842,17 +842,17 @@ UserParams Object +-------------------------+------------------+-------------------------------------------------+ GET Orchestration Request -++++++++++++++++++++++++++ ++++++++++++++++++++++++++ -+--------------------+--------------------------------------------------------------+ -|Interface Definition|Description | -+====================+==============================================================+ ++--------------------+-------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+=====================================================================================+ |URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6/{request-id} | -+--------------------+--------------------------------------------------------------+ -|Operation Type |GET | -+--------------------+--------------------------------------------------------------+ -|Content-Type |application/json | -+--------------------+--------------------------------------------------------------+ ++--------------------+-------------------------------------------------------------------------------------+ +|Operation Type |GET | ++--------------------+-------------------------------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+-------------------------------------------------------------------------------------+ Response Body: @@ -998,7 +998,7 @@ GET Orchestration Requests +--------------------+--------------------------------------------------------------+ |Interface Definition|Description | +====================+==============================================================+ -|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 | +|URI |/onap/so/infra/serviceInstantiation/orchestrationRequests/v6 | +--------------------+--------------------------------------------------------------+ |Operation Type |GET | +--------------------+--------------------------------------------------------------+ @@ -1152,7 +1152,7 @@ RequestStatus Object +-------------------------+------------------+-------------------------------------------------+ SDC Client API ------------------- +-------------- Get List of Existing Catalog Assets +++++++++++++++++++++++++++++++++++ @@ -1291,7 +1291,7 @@ Response: Resource Object: +---------------------+---------+-------+-------------------------------------------------------------------------------------------------------------------+ -|Attribute |Qualifier|Content|Description | | +|Attribute |Qualifier|Content|Description | +=====================+=========+=======+===================================================================================================================+ |resourceInstanceName |M |String |Logical Resource Instance Name.Unique Identifier of the instance of the specific resource in the service context.| +---------------------+---------+-------+-------------------------------------------------------------------------------------------------------------------+ @@ -1372,20 +1372,20 @@ Response: +--------------------+---------+--------------------------------------------------------------------------------------------------------------------------+ E2E Service API ----------------- +--------------- Create E2E service instance -++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++ -+--------------------+-------------------------------------+ -|Interface Definition|Description | -+====================+=====================================+ ++--------------------+------------------------------------------------------------+ +|Interface Definition|Description | ++====================+============================================================+ |URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3 | -+--------------------+-------------------------------------+ -|Operation Type |POST | -+--------------------+-------------------------------------+ -|Content-Type |application/json | -+--------------------+-------------------------------------+ ++--------------------+------------------------------------------------------------+ +|Operation Type |POST | ++--------------------+------------------------------------------------------------+ +|Content-Type |application/json | ++--------------------+------------------------------------------------------------+ Request Body: @@ -1424,7 +1424,7 @@ Parameter Object +------------------------------+-----------------+------------------------------------+ |resource |List of Resource |resource of service/resource | +------------------------------+-----------------+------------------------------------+ -|requestInputs |key-value map |input of service/resource +|requestInputs |key-value map |input of service/resource | +------------------------------+-----------------+------------------------------------+ LocationConstraint Object @@ -1472,15 +1472,15 @@ Response: +-------------+---------+-----------+-------+------------------------------------------------------------------------+ Delete E2E service instance -++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++ -+--------------------+-----------------------------------------------+ -|Interface Definition|Description | -+====================+===============================================+ ++--------------------+----------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+======================================================================+ |URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}| -+--------------------+-----------------------------------------------+ -|Operation Type |DELETE | -+--------------------+-----------------------------------------------+ ++--------------------+----------------------------------------------------------------------+ +|Operation Type |DELETE | ++--------------------+----------------------------------------------------------------------+ Request Parameters: @@ -1501,15 +1501,15 @@ Response: +-------------+---------+-----------+-------+------------------------------------------------------------------------+ Query E2E service operation result -++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++ -+--------------------+------------------------------------------------------------------------+ -|Interface Definition|Description | -+====================+========================================================================+ ++--------------------+-----------------------------------------------------------------------------------------------+ +|Interface Definition|Description | ++====================+===============================================================================================+ |URI |/onap/so/infra/serviceInstantiation/e2eServiceInstances/v3/{serviceId}/operations/{operationId}| -+--------------------+------------------------------------------------------------------------+ -|Operation Type |GET | -+--------------------+------------------------------------------------------------------------+ ++--------------------+-----------------------------------------------------------------------------------------------+ +|Operation Type |GET | ++--------------------+-----------------------------------------------------------------------------------------------+ Request Parameters: @@ -1548,7 +1548,7 @@ Response: +------------------+---------+-----------+-------+------------------------------------------------------------------------+ Inventory APIs ----------------- +-------------- create or update an existing service-instance +++++++++++++++++++++++++++++++++++++++++++++ @@ -1740,10 +1740,10 @@ Response: VFC APIs ---------- +-------- Create NS -+++++++++++ ++++++++++ +--------------------+-------------------+ |Interface Definition|Description | @@ -1778,7 +1778,7 @@ Response: +-----------------+---------+-----------+----------------+-------------------+ Get NS -+++++++ +++++++ +--------------------+-------------------+ |Interface Definition|Description | @@ -1869,7 +1869,7 @@ vnffgInfo Array: +----------------------+---------+-----------+----------------+-------------------+ Instantiate NS -+++++++++++++++ +++++++++++++++ +--------------------+-------------------------------------+ |Interface Definition|Description | @@ -1898,7 +1898,7 @@ LocationConstraints Array: +----------------------+---------+-----------+-------+-----------------------+ |Attribute |Qualifier|Cardinality|Content|Description | +======================+=========+===========+=======+=======================+ -|vnfProfileId |M |1 |String |vnfProfileId | +|vnfProfileId |M |1 |String |vnfProfileId | +----------------------+---------+-----------+-------+-----------------------+ |vimid |M |1 |String |vimid | +----------------------+---------+-----------+-------+-----------------------+ @@ -1912,7 +1912,7 @@ Response: +--------------+---------+-----------+-------+-----------------------+ Terminate NS -+++++++++++++++ +++++++++++++ +--------------------+-------------------------------------+ |Interface Definition|Description | @@ -1945,7 +1945,7 @@ Response: +--------------+---------+-----------+-------+-----------------------+ Delete NS -+++++++++++++++ ++++++++++ +--------------------+-------------------------------------+ |Interface Definition|Description | @@ -1964,9 +1964,9 @@ Request Parameters: +----------------------------+---------+-----------+-------+-----------------------------+ MultiVIM API ----------------- +------------ Get token -++++++++++ ++++++++++ https://developer.openstack.org/api-ref/identity/v3/#password-authentication-with-unscoped-authorization @@ -2051,7 +2051,7 @@ Response: +-------------------------+------------------+--------------------------------------------------------------------------+ Create stack -+++++++++++++ +++++++++++++ https://developer.openstack.org/api-ref/orchestration/v1/#create-stack @@ -2108,7 +2108,7 @@ Response: +-------------------------+------------------+--------------------------------------------------------------------------+ Get stack -+++++++++++++ ++++++++++ https://developer.openstack.org/api-ref/orchestration/v1/#show-stack-details @@ -2187,7 +2187,7 @@ Response: +-------------------------+------------------+------------------------------------------------------------------------------+ Delete stack -+++++++++++++ +++++++++++++ https://developer.openstack.org/api-ref/orchestration/v1/#show-stack-details @@ -2346,7 +2346,7 @@ Request Body: +------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ Create Keypair -+++++++++++++++ +++++++++++++++ https://developer.openstack.org/api-ref/compute/#create-or-import-keypair @@ -2397,7 +2397,7 @@ Response: +-----------------+------------------+------------------------------------------------------------------------------+ Delete Keypair -+++++++++++++++ +++++++++++++++ https://developer.openstack.org/api-ref/compute/#delete-keypair @@ -2422,7 +2422,7 @@ Request Body: +------------------+---------+-----------+--------------------------+-------------------------------------------------------------------------------------------------+ Create Network -+++++++++++++++ +++++++++++++++ https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail#create-network @@ -2543,7 +2543,7 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ Delete Network -+++++++++++++++ +++++++++++++++ https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail#delete-network @@ -2566,7 +2566,7 @@ Request Body: +----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+ Create Subnet -+++++++++++++++ ++++++++++++++ https://developer.openstack.org/api-ref/network/v2/?expanded=create-network-detail,create-subnet-detail#create-subnet @@ -2675,7 +2675,7 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ Delete Subnet -+++++++++++++++ ++++++++++++++ https://developer.openstack.org/api-ref/networking/v2/?expanded=create-network-detail,delete-subnet-detail#delete-subnet @@ -2698,7 +2698,7 @@ Request Body: +----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+ Create Port -+++++++++++++++ ++++++++++++ https://developer.openstack.org/api-ref/networking/v2/#create-port @@ -2829,7 +2829,7 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ Delete Port -+++++++++++++++ ++++++++++++ https://developer.openstack.org/api-ref/network/v2/#delete-port @@ -2852,7 +2852,7 @@ Request Body: +----------------------------+---------+-----------+--------------------------+--------------------------------------------------------------+ Create Security Group -++++++++++++++++++++++ ++++++++++++++++++++++ https://developer.openstack.org/api-ref/network/v2/#create-security-group @@ -2909,7 +2909,7 @@ Response: +-----------------------------+------------------+------------------------------------------------------------------------------+ Delete security group -++++++++++++++++++++++ ++++++++++++++++++++++ https://developer.openstack.org/api-ref/network/v2/#delete-security-group @@ -3007,7 +3007,7 @@ Response: +-----------------------------+------------------+-------------------------------------------------------------------------------------------------+ Delete security group -++++++++++++++++++++++ ++++++++++++++++++++++ https://developer.openstack.org/api-ref/networking/v2/#delete-security-group-rule @@ -3948,139 +3948,139 @@ Request Parameters: +-------------------+---------+-----------+-------+-------------------------------------------------------------+ -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|requestId |Y |1 |String |A unique ID to track multiple requests. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|callbackHeader |N |1 |String |The header information a client expecting in a async callback. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|sourceId |Y |1 |String |The unique ID of a client making an optimization call. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|requestType |Y |1 |String |The type of a request | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|numSolutions |N |1 |Integer|Expected number of solutions. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|optimizers |Y |1..N |List of Strings|A list of optimization services. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|timeout |N |1 |Integer|A tolerance window (in secs) for expecting solutions. Default is 600 secs.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content |Description | ++===================+=========+===========+===============+==========================================================================+ +|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|requestId |Y |1 |String |A unique ID to track multiple requests. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|callbackHeader |N |1 |String |The header information a client expecting in a async callback. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|sourceId |Y |1 |String |The unique ID of a client making an optimization call. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|requestType |Y |1 |String |The type of a request | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|numSolutions |N |1 |Integer |Expected number of solutions. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|optimizers |Y |1..N |List of Strings|A list of optimization services. | ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ +|timeout |N |1 |Integer |A tolerance window (in secs) for expecting solutions. Default is 600 secs.| ++-------------------+---------+-----------+---------------+--------------------------------------------------------------------------+ PlacementInfo Object -+-------------------+---------+-----------+-------+-------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=============================================================+ -|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|subscriberInfo |N |1 |Object |The information of a service subscriber. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content |Description | ++===================+=========+===========+==============================+=======================================================================================================================================================================================================================================================================================================================================+ +|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.| ++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service. | ++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +|subscriberInfo |N |1 |Object |The information of a service subscriber. | ++-------------------+---------+-----------+------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ PlacementDemand Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|resourceModuleName |Y |1 |String |A resource name as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|tenantId |N |1 |String |A tenant Id as defined in the ordering system. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content |Description | ++===================+=========+===========+============================+=======================================================================+ +|resourceModuleName |Y |1 |String |A resource name as defined in a service model. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|tenantId |N |1 |String |A tenant Id as defined in the ordering system. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ +|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. | ++-------------------+---------+-----------+----------------------------+-----------------------------------------------------------------------+ SubscriberInfo Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|globalSubscriberId |Y |1 |String |An ID of a subscriber. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++=======================+=========+===========+=======+===================================================================================+ +|globalSubscriberId |Y |1 |String |An ID of a subscriber. | ++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+ +|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'. | ++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+ +|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. | ++-----------------------+---------+-----------+-------+-----------------------------------------------------------------------------------+ ModelMetaData Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|modelName |N |1 |String |A model name as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|modelType |N |1 |String |A model type as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|modelVersion |N |1 |String |A model version as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++========================+=========+===========+=======+=======================================================================+ +|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. | ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. | ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelName |N |1 |String |A model name as defined in a service model. | ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelType |N |1 |String |A model type as defined in a service model. | ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelVersion |N |1 |String |A model version as defined in a service model. | ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. | ++------------------------+---------+-----------+-------+-----------------------------------------------------------------------+ Candidates Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|identifierType |Y |1 |String |The type of a candidate. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|identifiers |Y |1..N |List |A list of identifiers. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+================================================================================+ +|identifierType |Y |1 |String |The type of a candidate. | ++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ +|identifiers |Y |1..N |List |A list of identifiers. | ++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ +|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id. | ++-------------------+---------+-----------+-------+--------------------------------------------------------------------------------+ ServiceInfo Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|serviceInstanceId |Y |1 |String |A service instance id associated with a request. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|serviceName |Y |1 |String |The name of a service | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content |Description | ++===================+=========+===========+=====================+=======================================================================+ +|serviceInstanceId |Y |1 |String |A service instance id associated with a request. | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|serviceName |Y |1 |String |The name of a service | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ LicenseInfo Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+------------------------------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content |Description | ++===================+=========+===========+==============================+=======================================================================+ +|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. | ++-------------------+---------+-----------+------------------------------+-----------------------------------------------------------------------+ LicenseDemand Object -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|Attribute |Required |Cardinality|Content|Description | -+===================+=========+===========+=======+=======================================================================+ -|resourceModuleName |Y |1 |String |A resource name as defined in a service model. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model.| -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ -|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content |Description | ++===================+=========+===========+=====================+=======================================================================+ +|resourceModuleName |Y |1 |String |A resource name as defined in a service model. | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model. | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ +|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. | ++-------------------+---------+-----------+---------------------+-----------------------------------------------------------------------+ LicenseModel Object @@ -4105,4 +4105,4 @@ Response Body |statusMessage |N |1 |String |Reasoning if a requestStatus is failed. | +-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ |requestStatus |Y |1 |String |The status of a request. | -+-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
\ No newline at end of file ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml index 93a4ae9489..babefd9478 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml +++ b/mso-api-handlers/mso-api-handler-infra/src/main/resources/application.yaml @@ -49,6 +49,8 @@ spring: enable-lazy-load-no-trans: true jersey: type: filter + main: + allow-bean-definition-overriding: true request: datasource: diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 4b2644bc00..e28e36d307 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -2398,7 +2398,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals( - "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", + "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error", realResponse.getServiceException().getText()); } @@ -2443,7 +2443,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals( - "Unable to get process-instance history from Camunda for requestId: f0a35706-efc4-4e27-80ea-a995d7a2a40f due to error: org.springframework.web.client.HttpServerErrorException: 500 Server Error", + "Unable to get process-instance history from Camunda for requestId: f0a35706-efc4-4e27-80ea-a995d7a2a40f due to error: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error", realResponse.getServiceException().getText()); } @@ -2460,7 +2460,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals( - "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", + "Unable to check for duplicate instance due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error", realResponse.getServiceException().getText()); } @@ -2492,7 +2492,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals( - "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", + "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error", realResponse.getServiceException().getText()); } @@ -2512,7 +2512,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals( - "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", + "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error", realResponse.getServiceException().getText()); } @@ -2529,7 +2529,7 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); RequestError realResponse = errorMapper.readValue(response.getBody(), RequestError.class); assertEquals( - "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException: 500 Server Error", + "Unable to save instance to db due to error contacting requestDb: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error", realResponse.getServiceException().getText()); } @@ -66,7 +66,7 @@ <siteNexusPath>content/sites/site/org/onap/so/${project.version}/</siteNexusPath> <cxf.version>3.2.6</cxf.version> <jax.ws.rs>2.1</jax.ws.rs> - <springboot.version>2.0.5.RELEASE</springboot.version> + <springboot.version>2.1.5.RELEASE</springboot.version> <camunda.springboot.version>3.2.0</camunda.springboot.version> <format.skipValidate>false</format.skipValidate> <format.skipExecute>true</format.skipExecute> @@ -847,18 +847,13 @@ <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> - <version>5.1.4</version> + <version>5.2.4</version> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20140107</version> </dependency> - <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - <version>1.19</version> - </dependency> </dependencies> </dependencyManagement> <profiles> diff --git a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml index 347845e422..417febebf6 100644 --- a/so-monitoring/so-monitoring-service/src/main/resources/application.yaml +++ b/so-monitoring/so-monitoring-service/src/main/resources/application.yaml @@ -17,6 +17,8 @@ mso: auth: Basic YnBlbDpwYXNzd29yZDEk spring: + main: + allow-bean-definition-overriding: true security: usercredentials: - diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java index 218cc2de03..83f079c376 100644 --- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java +++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/services/OperationProgressor.java @@ -1,5 +1,7 @@ package org.onap.svnfm.simulator.services; +import java.io.IOException; +import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -34,10 +36,13 @@ import org.onap.svnfm.simulator.model.Vnfds; import org.onap.svnfm.simulator.repository.VnfOperationRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.core.io.ClassPathResource; public abstract class OperationProgressor implements Runnable { private static final Logger LOGGER = LoggerFactory.getLogger(OperationProgressor.class); + private static final String CERTIFICATE_TO_TRUST = "so-vnfm-adapter.crt.pem"; + protected final VnfOperation operation; protected final SvnfmService svnfmService; private final VnfOperationRepository vnfOperationRepository; @@ -61,14 +66,25 @@ public abstract class OperationProgressor implements Runnable { String callBackUrl = subscriptionService.getSubscriptions().iterator().next().getCallbackUri(); callBackUrl = callBackUrl.substring(0, callBackUrl.indexOf("/lcn/")); apiClient.setBasePath(callBackUrl); + apiClient.setSslCaCert(getCertificateToTrust()); notificationClient = new DefaultApi(apiClient); final org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient grantApiClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.ApiClient(); grantApiClient.setBasePath(callBackUrl); + grantApiClient.setSslCaCert(getCertificateToTrust()); grantClient = new org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.api.DefaultApi(grantApiClient); } + private InputStream getCertificateToTrust() { + try { + return new ClassPathResource(CERTIFICATE_TO_TRUST).getInputStream(); + } catch (final IOException exception) { + LOGGER.error("Error reading certificate to trust, https calls to VNFM adapter will fail", exception); + return null; + } + } + @Override public void run() { try { @@ -176,6 +192,9 @@ public abstract class OperationProgressor implements Runnable { MediaType.APPLICATION_JSON, authHeader); } catch (final ApiException exception) { LOGGER.error("Error sending notification: " + notification, exception); + LOGGER.error("Response code: {}, body: {}, basePath: {}", exception.getCode(), exception.getResponseBody(), + notificationClient.getApiClient().getBasePath()); + } } diff --git a/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem new file mode 100644 index 0000000000..3c899e3bf5 --- /dev/null +++ b/vnfm-simulator/vnfm-service/src/main/resources/so-vnfm-adapter.crt.pem @@ -0,0 +1,30 @@ +Bag Attributes + friendlyName: so@so.onap.org + localKeyID: 54 69 6D 65 20 31 35 36 33 34 36 33 36 32 39 35 38 33 +subject=/CN=so-vnfm-adapter/emailAddress=/OU=so@so.onap.org/OU=OSAAF/O=ONAP/C=US +issuer=/C=US/O=ONAP/OU=OSAAF/CN=intermediateCA_9 +-----BEGIN CERTIFICATE----- +MIIEITCCAwmgAwIBAgIILuAnLLineoYwDQYJKoZIhvcNAQELBQAwRzELMAkGA1UE +BhMCVVMxDTALBgNVBAoMBE9OQVAxDjAMBgNVBAsMBU9TQUFGMRkwFwYDVQQDDBBp +bnRlcm1lZGlhdGVDQV85MB4XDTE5MDcxODE1MjcwOVoXDTIwMDcxODE1MjcwOVow +cDEYMBYGA1UEAwwPc28tdm5mbS1hZGFwdGVyMQ8wDQYJKoZIhvcNAQkBFgAxFzAV +BgNVBAsMDnNvQHNvLm9uYXAub3JnMQ4wDAYDVQQLDAVPU0FBRjENMAsGA1UECgwE +T05BUDELMAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB +AQCu2NbWjFiZ5Tz5P7daCD6mqJqSWV3f+gkM2VC/UYM/43hd/2ILJbbtsv4uzS/P +GXl3UIKBjb7zRiDCvLNMFsHCZ9/gIonG1z737S42LCrdVKq/KQ59yIOPrxYmLyiQ +Xy81ChX77b2KvKPPeF+K/wnh5fLwlcJ18geeCoWGaMK0C/i6J/uUb9z+Ef0Nmtau +NdXAuUnERCKMra+3kFxZwaRC/gSCy+/s6EQdeaGNiijg03AmrUx9XjrJjHbYMDVo +OKSxtv0E4fxbfmTpHaKCuN4eg+0nEXw/eiIEuSHJuh3KKv7wRoP/hG/Tdog7x60M +SD+hdNjCbFP6yAyMPfoxVnjHAgMBAAGjgecwgeQwCQYDVR0TBAIwADAOBgNVHQ8B +Af8EBAMCBeAwIAYDVR0lAQH/BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMFQGA1Ud +IwRNMEuAFIH3mVsQuciM3vNSXupOaaBDPqzdoTCkLjAsMQ4wDAYDVQQLDAVPU0FB +RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVOCAQcwHQYDVR0OBBYEFFLrO3T4 +QybeDQ28mHgC/xT5f03qMDAGA1UdEQQpMCeCD3NvLXZuZm0tYWRhcHRlcoIUc28t +dm5mbS1hZGFwdGVyLm9uYXAwDQYJKoZIhvcNAQELBQADggEBACe+JaVIjTku/QNp +XoQCNN+sllSZmEHTLmYfpSzY5BY2AeJsgTYqFtAhtp6uQf8Jr993CyEyeJ4if2Z9 +J5NWoJKmY1+a63UphB1mg4sNSCuDxvbxPjtrFkOx/DiB1XEUdoifS9IQSDIIuhaD +YP6sih1TBOh/2ityCe51Mu1J9/wgb24rlYouVtEyQeIai4dqngFHeQHeNXOnGN0z +osEcKSYa0C+ZOAomBMT58C2aDz9vyI8YPuzwVSDKndmXUgvrkkVnxk3qJRtghDQc +RV+4SeZg8s4+5DxKL4AL15IAaAPMJHi+MRtfm7qNzqCEl5sAEzO7S4oVHeWLNFV8 +a9PHErg= +-----END CERTIFICATE----- |