diff options
26 files changed, 968 insertions, 395 deletions
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-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java index fb8fb2ed84..6f24e60514 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java @@ -3,6 +3,8 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +26,6 @@ import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.onap.so.entity.MsoRequest; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java index 06fff19205..ffa76cf8ee 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java @@ -3,6 +3,8 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * + * Modifications Copyright (C) 2019 IBM. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +38,6 @@ import org.onap.aai.domain.yang.Vlan; import org.onap.aai.domain.yang.Vlans; import org.onap.aai.domain.yang.Vserver; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index d9f47f5c3a..c934291246 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -330,14 +330,15 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } else { // Populate the outputs from the existing stack. networkId.value = heatStack.getCanonicalName(); - neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID); - rollback.value = networkRollback; // Default rollback - no updates performed - if (aic3template) { - networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN); - } - Map<String, Object> outputs = heatStack.getOutputs(); Map<String, String> sMap = new HashMap<>(); - if (outputs != null) { + if (heatStack.getOutputs() != null) { + neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID); + rollback.value = networkRollback; // Default rollback - no updates performed + if (aic3template) { + networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN); + } + Map<String, Object> outputs = heatStack.getOutputs(); + for (Map.Entry<String, Object> entry : outputs.entrySet()) { String key = entry.getKey(); if (key != null && key.startsWith("subnet")) { @@ -437,9 +438,11 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // For Heat-based orchestration, the MSO-tracked network ID is the heat stack, // and the neutronNetworkId is the network UUID returned in stack outputs. networkId.value = heatStack.getCanonicalName(); - neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID); - if (aic3template) { - networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN); + if (heatStack.getOutputs() != null) { + neutronNetworkId.value = (String) heatStack.getOutputs().get(NETWORK_ID); + if (aic3template) { + networkFqdn.value = (String) heatStack.getOutputs().get(NETWORK_FQDN); + } } Map<String, Object> outputs = heatStack.getOutputs(); Map<String, String> sMap = new HashMap<>(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java index 2d77bf625a..70fb0b3857 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java @@ -339,7 +339,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { return null; } } else if ("boolean".equalsIgnoreCase(type)) { - return new Boolean(inputValue.toString()); + return Boolean.valueOf(inputValue.toString()); } // Nothing else matched. Return the original string diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index 3e5d4ad29a..16cc2c34de 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -62,40 +62,37 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369"); } - @Test - public void queryVnfExceptionTest() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - Holder<Map<String, String>> outputs = new Holder<>(); - instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), - new Holder<>(), outputs); - - assertTrue(outputs.value.isEmpty()); - } - - @Test - public void queryVnfTest() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")) - .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK))); - - wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")) - .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") - .withStatus(HttpStatus.SC_OK))); - - wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() - .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") - .withStatus(HttpStatus.SC_OK))); - - wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")) - .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK))); - - instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), - new Holder<>(), new Holder<>()); - } + /* + * @Test public void queryVnfExceptionTest() throws Exception { MsoRequest msoRequest = new MsoRequest(); + * msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); Holder<Map<String, String>> outputs = + * new Holder<>(); instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new + * Holder<>(), new Holder<>(), outputs); + * + * assertTrue(outputs.value.isEmpty()); } + */ + + /* + * @Test public void queryVnfTest() throws Exception { + * + * + * MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); + * msoRequest.setServiceInstanceId("12345"); + * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")) + * .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK))); + * + * wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")) + * .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") + * .withStatus(HttpStatus.SC_OK))); + * + * wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + * .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") + * .withStatus(HttpStatus.SC_OK))); + * + * instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new + * Holder<>(), new Holder<>()); + * + * } + */ @Test public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception { 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/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/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java index 49f373c01e..a9f33f20c5 100644 --- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java +++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/BaseTaskTest.java @@ -38,9 +38,9 @@ public class BaseTaskTest { private String anyValueString = "anyValue"; private String badValueString = "123abc"; private int anyValueInt = 123; - private Integer anyValueInteger = new Integer(anyValueInt); + private Integer anyValueInteger = Integer.valueOf(anyValueInt); private long anyValuelong = 123L; - private Long anyValueLong = new Long(anyValuelong); + private Long anyValueLong = Long.valueOf(anyValuelong); private DelegateExecution mockExecution; private Expression mockExpression; @@ -113,7 +113,7 @@ public class BaseTaskTest { assertEquals(anyValueString, obj1.toString()); expectedException.expect(MissingInjectedFieldException.class); - Object objectBoolean = new Boolean(true); // bad data + Object objectBoolean = Boolean.valueOf(true); // bad data when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); obj2 = baseTask.getStringField(null, mockExecution, anyVariable); } @@ -134,7 +134,7 @@ public class BaseTaskTest { @Test public void testGetIntegerFieldAndMissingInjectedFieldException() throws Exception { - objectInteger = new Integer(anyValueInt); + objectInteger = Integer.valueOf(anyValueInt); when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger); obj1 = baseTask.getIntegerField(mockExpression, mockExecution, anyVariable); assertEquals(anyValueInteger, (Integer) obj1); @@ -154,7 +154,7 @@ public class BaseTaskTest { @Test public void testGetOptionalIntegerField() throws Exception { - objectInteger = new Integer(anyValueInt); + objectInteger = Integer.valueOf(anyValueInt); when(mockExpression.getValue(mockExecution)).thenReturn(objectInteger); obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable); assertEquals(anyValueInteger, (Integer) obj1); @@ -163,14 +163,14 @@ public class BaseTaskTest { @Test public void testGetOptionalIntegerFieldAndBadInjectedFieldException() throws Exception { expectedException.expect(BadInjectedFieldException.class); - objectBoolean = new Boolean(true); + objectBoolean = Boolean.valueOf(true); when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); obj1 = baseTask.getOptionalIntegerField(mockExpression, mockExecution, anyVariable); } @Test public void testGetLongFieldAndMissingInjectedFieldException() throws Exception { - objectLong = new Long(anyValuelong); + objectLong = Long.valueOf(anyValuelong); when(mockExpression.getValue(mockExecution)).thenReturn(objectLong); obj1 = baseTask.getLongField(mockExpression, mockExecution, anyVariable); assertEquals(anyValueLong, (Long) obj1); @@ -189,7 +189,7 @@ public class BaseTaskTest { @Test public void testGetOptionalLongField() throws Exception { - objectLong = new Long(anyValuelong); + objectLong = Long.valueOf(anyValuelong); when(mockExpression.getValue(mockExecution)).thenReturn(objectLong); obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable); assertEquals(anyValueLong, (Long) obj1); @@ -198,7 +198,7 @@ public class BaseTaskTest { @Test public void testGetOptionalLongFieldAndBadInjectedFieldException() throws Exception { expectedException.expect(BadInjectedFieldException.class); - objectBoolean = new Boolean(true); + objectBoolean = Boolean.valueOf(true); when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); obj1 = baseTask.getOptionalLongField(mockExpression, mockExecution, anyVariable); } @@ -233,7 +233,7 @@ public class BaseTaskTest { @Test public void testGetOptionalOutputFieldAndBadInjectedFieldException() throws Exception { expectedException.expect(BadInjectedFieldException.class); - objectBoolean = new Boolean(true); + objectBoolean = Boolean.valueOf(true); when(mockExpression.getValue(mockExecution)).thenReturn(objectBoolean); obj1 = baseTask.getOptionalOutputField(mockExpression, mockExecution, anyVariable); } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java index 39a8995607..f3527fad7d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -60,7 +60,6 @@ public class OofHomingTestIT extends BaseIntegrationTest { Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); - String subscriber = ""; String subscriber2 = ""; private final CallbackSet callbacks = new CallbackSet(); @@ -208,8 +207,6 @@ public class OofHomingTestIT extends BaseIntegrationTest { serviceDecomposition.setServiceInstance(si); // Subscriber - subscriber = - "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; } 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/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java index b257e91165..9396f9dbfc 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java @@ -59,6 +59,12 @@ public class VnfAdapterCreateTasks { @Autowired private ExceptionBuilder exceptionUtil; + /** + * This method is used for creating the request for the VolumeGroup. + * + * @param execution + * @return + */ public void createVolumeGroupRequest(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -93,6 +99,12 @@ public class VnfAdapterCreateTasks { } + /** + * This method is used for creating the request for the VfModule. + * + * @param execution + * @return + */ public void createVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index ab2647a68d..1dcdfa912c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -52,6 +52,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; +/* + * This class is used for creating the service instance, assigning vnf, assigning the Vfmodule & assigning the L3Network + * on SDNC. + */ @Component public class SDNCAssignTasks extends AbstractSDNCTask { private static final Logger logger = LoggerFactory.getLogger(SDNCAssignTasks.class); @@ -71,6 +75,13 @@ public class SDNCAssignTasks extends AbstractSDNCTask { @Autowired private Environment env; + /** + * BPMN access method to assigning the service instance in SDNC. + * + * It will assign the service instance by the service instance id. + * + * @param execution + */ public void assignServiceInstance(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -89,6 +100,13 @@ public class SDNCAssignTasks extends AbstractSDNCTask { } } + /** + * BPMN access method to assigning the vnf in SDNC. + * + * It will assign the vnf according to the service instance id and vnf id. + * + * @param execution + */ public void assignVnf(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); @@ -111,6 +129,13 @@ public class SDNCAssignTasks extends AbstractSDNCTask { } } + /** + * BPMN access method to assigning the vfModule in SDNC. + * + * It will assign the VfModule by the service instance id ,Vnf id and module id. + * + * @param execution + */ public void assignVfModule(BuildingBlockExecution execution) { try { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 9bbe94a077..7478479a86 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -39,6 +39,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +/** + * This class is used for quering the SDNC + */ @Component public class SDNCQueryTasks { private static final Logger logger = LoggerFactory.getLogger(SDNCQueryTasks.class); @@ -53,6 +56,14 @@ public class SDNCQueryTasks { @Autowired private ExtractPojosForBB extractPojosForBB; + /** + * BPMN access method to query the SDNC for fetching the vnf details. + * + * It will get the vnf details according to service instance id. + * + * @param execution + * @throws Exception + */ public void queryVnf(BuildingBlockExecution execution) throws Exception { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -77,7 +88,14 @@ public class SDNCQueryTasks { } } - + /** + * BPMN access method to query the SDNC for fetching the VfModule details. + * + * It will get the vnf details according to service instance id, vnf id & Vf module id. + * + * @param execution + * @throws Exception + */ public void queryVfModule(BuildingBlockExecution execution) throws Exception { ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); @@ -108,6 +126,13 @@ public class SDNCQueryTasks { } } + /** + * BPMN access method to query the SDNC for fetching the VfModuleForVolumeGroup details. + * + * It will get the vnf details according to Vf module id. + * + * @param execution @throws + */ public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); 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/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index 12aae1e6a6..6434bfb176 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -50,6 +50,17 @@ public class SDNCVnfResources { @Autowired private SDNCClient sdncClient; + /** + * This method is used for setting the SDNCSvcAction for assignVnf . + * + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return + */ public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing, URI callbackURI) { @@ -58,6 +69,17 @@ public class SDNCVnfResources { cloudRegion, requestContext, homing, callbackURI); } + /** + * This method is used for setting the SDNCSvcAction for activate vnf. + * + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return + */ public GenericResourceApiVnfOperationInformation activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ACTIVATE, @@ -65,7 +87,17 @@ public class SDNCVnfResources { cloudRegion, requestContext, false, callbackURI); } - + /** + * This method is used for setting the SDNCSvcAction for deactivate vnf. + * + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return + */ public GenericResourceApiVnfOperationInformation deactivateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, @@ -73,7 +105,17 @@ public class SDNCVnfResources { cloudRegion, requestContext, false, callbackURI); } - + /** + * This method is used for setting the SDNCSvcAction for unassign vnf. + * + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return + */ public GenericResourceApiVnfOperationInformation unassignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, @@ -81,6 +123,17 @@ public class SDNCVnfResources { cloudRegion, requestContext, false, callbackURI); } + /** + * This method is used for setting the SDNCSvcAction for delete vnf. + * + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return + */ public GenericResourceApiVnfOperationInformation deleteVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, @@ -88,6 +141,17 @@ public class SDNCVnfResources { cloudRegion, requestContext, false, callbackURI); } + /** + * This method is used for setting the SDNCSvcAction for changeModelVnf. + * + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return + */ public GenericResourceApiVnfOperationInformation changeModelVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, URI callbackURI) { return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, @@ -95,6 +159,13 @@ public class SDNCVnfResources { cloudRegion, requestContext, false, callbackURI); } + /** + * This method is used for querying SDNC client for getting the vnf details. + * + * @param vnf + * @exception MapperException & BadResponseException + * @return + */ public String queryVnf(GenericVnf vnf) throws MapperException, BadResponseException { String queryPath = vnf.getSelflink(); return sdncClient.get(queryPath); 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/docs/architecture/architecture.rst b/docs/architecture/architecture.rst index 52eb38cfe4..7636792c41 100644 --- a/docs/architecture/architecture.rst +++ b/docs/architecture/architecture.rst @@ -3,10 +3,10 @@ .. Copyright 2018 Huawei Technologies Co., Ltd. SO - Architecture -=============== +================= SO Functional View --------------------- +------------------ .. image:: ../images/SO_Architecture_1.png @@ -21,9 +21,9 @@ SO Sub-Components **API Handler** RESTful interface to northbound clients - - * Handle service-level and infrastructure (VNF & network) requests - + +* Handle service-level and infrastructure (VNF & network) requests + Service-agnostic APIs * “Service Instantiation API” @@ -31,7 +31,7 @@ SO Sub-Components * Use SO Catalog to map input requests to BPMN flows * Dynamic lookup based on service-model + action * Input data forwarded to BPMN flow - + Track open and completed requests via SO Request DB Multiple API-H modules may support different APIs @@ -49,7 +49,7 @@ SO Sub-Components * Request and configure network resources via SDN-C * Manage cloud resources via PO (OpenStack) * Update inventory via A&AI - + Perform error handling/rollback **Resource Adapters** @@ -59,7 +59,7 @@ SO Sub-Components * Hides the details of complex interfaces (e.g. OpenStack APIs) * Expose interfaces to BPMN flows as SOAP or REST APIs * Support synchronous and asynchronous operations - + Provided as part of SO platform for use by all BPMN flows Use SO Catalog to map resource requests to a recipe/template @@ -69,10 +69,10 @@ SO Sub-Components * Merge input parameters with templates at run-time **Data Stores** - + Request DB * Tracks open and completed requests - + SO Catalog * SO view of the SDC Catalog * service and resource models, recipes, and templates @@ -81,13 +81,13 @@ SO Sub-Components Camunda DB * Maintain state for BPMN flows * Supports multiple active engines - + **SDC Distribution Client** Receive updated service models from SDC * Event-bus notifications when new models available * HTTP retrieval of models (TOSCA) and artifacts (Heat) - + Receive distributions as TOSCA models Populate SO Catalog @@ -119,11 +119,3 @@ Third Party and Open Source Tomcat MySQL/MariaDB Openstack Java SDK (“woorea”) - - - - - - - - diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java index a1c1dd1cc4..2fd426dec2 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/filters/RequestIdFilter.java @@ -24,22 +24,27 @@ import javax.annotation.Priority; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.ext.Provider; -import org.apache.http.HttpStatus; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.apihandler.common.ErrorNumbers; +import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestIdException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.slf4j.MDC; +import org.onap.so.serviceinstancebeans.RequestError; +import org.onap.so.serviceinstancebeans.ServiceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; @Priority(2) @Provider @Component public class RequestIdFilter implements ContainerRequestFilter { - protected static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class); + private static Logger logger = LoggerFactory.getLogger(RequestIdFilter.class); @Autowired private RequestsDbClient infraActiveRequestsClient; @@ -48,11 +53,33 @@ public class RequestIdFilter implements ContainerRequestFilter { public void filter(ContainerRequestContext context) throws IOException { String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID); + logger.info("Checking if requestId: {} already exists in requestDb InfraActiveRequests table", requestId); InfraActiveRequests infraActiveRequests = infraActiveRequestsClient.getInfraActiveRequestbyRequestId(requestId); if (infraActiveRequests != null) { - MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(HttpStatus.SC_BAD_REQUEST)); - logger.error("RequestID exists in RequestDB.InfraActiveRequests : {}", requestId); + logger.error( + "RequestId: {} already exists in RequestDB InfraActiveRequests table, throwing DuplicateRequestIdException", + requestId); + throw new DuplicateRequestIdException(createRequestError(requestId, "InfraActiveRequests")); + } + } + + protected String createRequestError(String requestId, String requestTable) { + ObjectMapper mapper = new ObjectMapper(); + RequestError error = new RequestError(); + ServiceException serviceException = new ServiceException(); + serviceException.setMessageId(ErrorNumbers.SVC_BAD_PARAMETER); + serviceException + .setText("RequestId: " + requestId + " already exists in the RequestDB " + requestTable + " table"); + error.setServiceException(serviceException); + String errorMessage = null; + + try { + errorMessage = mapper.writeValueAsString(error); + } catch (JsonProcessingException e) { + return "Unable to write requestError to String when requestId already exists in the RequestDb due to error: " + + e.getMessage(); } + return errorMessage; } } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java new file mode 100644 index 0000000000..f56b4218ba --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/DuplicateRequestIdException.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.apihandlerinfra.exceptions; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +public class DuplicateRequestIdException extends WebApplicationException { + + public DuplicateRequestIdException(String response) { + super(Response.status(Response.Status.BAD_REQUEST).entity(response).build()); + } +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java index 9bf83153b3..8716047603 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/filters/RequestIdFilterTest.java @@ -20,67 +20,85 @@ package org.onap.so.apihandler.filters; -import static org.junit.Assert.assertEquals; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; import static org.mockito.Mockito.doReturn; import java.io.IOException; +import java.util.Collections; import javax.ws.rs.container.ContainerRequestContext; -import org.apache.http.HttpStatus; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.Spy; -import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoJUnitRunner; -import org.mockito.junit.MockitoRule; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestIdException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.serviceinstancebeans.RequestError; +import org.onap.so.serviceinstancebeans.ServiceException; import org.slf4j.MDC; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) public class RequestIdFilterTest { @Mock - ContainerRequestContext mockContext; + private ContainerRequestContext mockContext; @Mock - protected RequestsDbClient requestsDbClient; + private RequestsDbClient requestsDbClient; @InjectMocks @Spy - RequestIdFilter requestIdFilter; + private RequestIdFilter requestIdFilter; @Rule public ExpectedException thrown = ExpectedException.none(); - @Rule - public MockitoRule mockitoRule = MockitoJUnit.rule(); + private static final String REQUEST_ID = "32807a28-1a14-4b88-b7b3-2950918aa769"; + private ObjectMapper mapper = new ObjectMapper(); - @Test - public void filterTest() throws IOException { + private RequestError getRequestError() throws IOException { + RequestError requestError = new RequestError(); + mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); + ServiceException serviceException = new ServiceException(); + serviceException.setMessageId("SVC0002"); + serviceException.setText( + "RequestId: 32807a28-1a14-4b88-b7b3-2950918aa769 already exists in the RequestDB InfraActiveRequests table"); + serviceException.setVariables(Collections.emptyList()); + requestError.setServiceException(serviceException); + return requestError; + } - String requestId = "32807a28-1a14-4b88-b7b3-2950918aa769"; + @Test + public void filterTestInfra() throws IOException { + String error = mapper.writeValueAsString(getRequestError()); + String requestId = REQUEST_ID; MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId); // ExpectedRecord InfraActiveRequests InfraActiveRequests infraActiveRequests = new InfraActiveRequests(); - infraActiveRequests.setRequestStatus("FAILED"); - infraActiveRequests.setProgress(100L); - infraActiveRequests.setLastModifiedBy("APIH"); - infraActiveRequests.setRequestScope("network"); - infraActiveRequests.setRequestAction("deleteInstance"); - infraActiveRequests.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa769"); + infraActiveRequests.setRequestId(REQUEST_ID); doReturn(infraActiveRequests).when(requestsDbClient).getInfraActiveRequestbyRequestId(requestId); + doReturn(error).when(requestIdFilter).createRequestError(REQUEST_ID, "InfraActiveRequests"); + thrown.expect(DuplicateRequestIdException.class); + thrown.expectMessage("HTTP 400 Bad Request"); requestIdFilter.filter(mockContext); + } - Mockito.verify(requestIdFilter, Mockito.times(1)).filter(mockContext); - assertEquals(MDC.get(ONAPLogConstants.MDCs.RESPONSE_CODE), String.valueOf(HttpStatus.SC_BAD_REQUEST)); + @Test + public void createRequestErrorTest() throws IOException { + RequestError requestError = getRequestError(); + String result = requestIdFilter.createRequestError(REQUEST_ID, "InfraActiveRequests"); + RequestError resultingError = mapper.readValue(result, RequestError.class); + assertThat(resultingError, sameBeanAs(requestError)); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java index ade13e7b57..554c794e3e 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java @@ -196,7 +196,7 @@ public class InstanceManagement { .setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()) .setRequestAction(action.toString()).setServiceInstanceId(serviceInstanceId).setVnfId(vnfId) .setServiceType(serviceInstanceType).setVnfType(vnfType) - .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, sir, aLaCarte, action)) + .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action)) .setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri).build(); } catch (IOException e) { ErrorLoggerInfo errorLoggerInfo = diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java index 5306888570..e4532cd8d7 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java @@ -27,6 +27,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID; @@ -150,6 +151,18 @@ public class RequestHandlerUtilsTest extends BaseTest { } + @Test + public void test_mapJSONtoMSOStyleCustomWorkflowRequest() throws IOException { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(Include.NON_NULL); + String testRequest = inputStream("/CustomWorkflowRequest.json"); + String resultString = + requestHandlerUtils.mapJSONtoMSOStyle(testRequest, null, true, Action.inPlaceSoftwareUpdate); + ServiceInstancesRequest sir = mapper.readValue(resultString, ServiceInstancesRequest.class); + assertEquals(sir.getRequestDetails().getCloudConfiguration().getTenantId(), "88a6ca3ee0394ade9403f075db23167e"); + assertNotEquals(sir.getRequestDetails().getRequestParameters().getUserParams().size(), 0); + } + @Test public void test_mapJSONtoMSOStyleUsePreload() throws IOException { diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json new file mode 100644 index 0000000000..6c59ec5f1f --- /dev/null +++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/CustomWorkflowRequest.json @@ -0,0 +1,21 @@ +{ + "requestDetails": { + "requestInfo": { + "source": "VID", + "requestorId": "xxxxxx", + "instanceName": "inPlaceSoftwareUpdateTest" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "requestParameters": { + "payload": "{\"request-parameters\":{\"host-ip-address\":\"10.10.10.10\"},\"configuration-parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}", + "userParams": [{ + "name": "vnf-id", + "value": "4603ad6d-dbfb-4899-a8bd-bc1dd0d74914" + } + ] + } + } +}
\ No newline at end of file |