diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-03 22:50:11 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-01-04 09:15:22 -0500 |
commit | f49313bb87e0dc2ee20f5621c6858d119e5f8f83 (patch) | |
tree | ba1902c3f1ee2f5aa54f75ebe533d58d07755ba5 /bpmn/so-bpmn-infrastructure-common/src | |
parent | a5bb70becba912f172615b873c4921a2a88dcf3e (diff) |
Bugfixes for December 2018
Changed the way that the cidr is constructed in network utils.
added in the if statement to check if selflink already exists
removed execution line that was not needed in pull
added service instance id to workflowResourceIds for virtualLinkKey
network flows
wrote test for updating request to complete in db
workflow action directly updates db instead of using mso complete
process
Increase max timeout for SDNO Health Checks dmaap.
Added execution variable and corrected type and way data is retrieved
to fix defect
fixed retry status message in request db for #/5
updated workflowActionBBTasks for flow status message
updated flow status to failed on a workflowaction fail
Removed slashes and fixed rollbackStatusMessage
Updated requestStatus logic for adding status messages
Added junit test to validate casue of a defect and cleaned up code and
logging
added end timestamp to request db on complete request
fixed l3Network update of orchestation status in
DoUpdateNetworkInstance groovy as well
fixed update of l3network orchestration status
Add explicit resetting of heatStackId in A&AI to DeleteVfModule and
DeleteVolumeGroup BBs.
Preserve heatStackId setting in the copiedVfModule when updating the VF
Module in A&AI.
added functionality to skip rollback based on flag
Update snapshot version for logging, add headers
fixed optional of error in retrieveErrorMessage method
Set heatStackId to null if we want to remove it in A&AI.
added in a warn logger statement to keep track of field
map network technology from l3network instead of model info for network
adapter object mapper
Force heatStackId value to empty on an attempt to set it to null on
update
updated common pom to use aai schema version 1.4.1
removed handle sync error from SDNCHandler bpmn flow
Change-Id: I1bd7aa55b06d4e439000b216165c9daafeacc9a4
Issue-ID: SO-1361
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
3 files changed, 42 insertions, 49 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index 91b6c2af06..1b64671163 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -527,6 +527,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { L3Network network = client.get(uri, NotFoundException.class).asBean(L3Network.class).get() execution.setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + execution.setVariable(Prefix + "requeryIdAAIResponse", network) String netName = network.getNetworkName() String networkOutputs = @@ -764,29 +765,26 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { execution.setVariable("prefix",Prefix) - msoLogger.debug(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) + msoLogger.trace(" ***** Inside callRESTUpdateContrailAAINetwork() of DoCreateNetworkInstance ***** " ) try { // get variables String networkId = execution.getVariable(Prefix + "networkId") - String requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") + L3Network requeryIdAAIResponse = execution.getVariable(Prefix + "requeryIdAAIResponse") String createNetworkResponse = execution.getVariable(Prefix + "createNetworkResponse") L3Network l3Network = new L3Network() - if (utils.nodeExists(requeryIdAAIResponse, 'heat-stack-id')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getHeatStackId())) { if (utils.nodeExists(createNetworkResponse, 'networkStackId')) { l3Network.setHeatStackId(utils.getNodeText(createNetworkResponse, 'networkStackId')) } } - if (utils.nodeExists(requeryIdAAIResponse, 'neutron-network-id')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getNeutronNetworkId())) { if (utils.nodeExists(createNetworkResponse, 'neutronNetworkId')) { l3Network.setNeutronNetworkId(utils.getNodeText(createNetworkResponse, 'neutronNetworkId')) } } - if (utils.nodeExists(requeryIdAAIResponse, 'contrail-network-fqdn')) { - } else { + if (StringUtils.isBlank(requeryIdAAIResponse.getContrailNetworkFqdn())) { if (utils.nodeExists(createNetworkResponse, 'networkFqdn')) { l3Network.setContrailNetworkFqdn(utils.getNodeText(createNetworkResponse, 'networkFqdn')) } @@ -794,39 +792,33 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String status = utils.getNodeText(createNetworkResponse, 'orchestration-status') if(status.equals("pending-create") || status.equals("PendingCreate")){ - l3Network.setOperationalStatus("Created") + l3Network.setOrchestrationStatus("Created") }else{ - l3Network.setOperationalStatus("Active") + l3Network.setOrchestrationStatus("Active") } + msoLogger.debug("Updating l3-network in AAI" ) + AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId) client.update(uri, l3Network) - String subnetsXml = utils.getNodeXml(requeryIdAAIResponse, "subnets") - InputSource source = new InputSource(new StringReader(subnetsXml)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - docFactory.setNamespaceAware(true) - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document xml = docBuilder.parse(source) - NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet") - for (int x = 0; x < nodeList.getLength(); x++) { - Node node = nodeList.item(x) - if (node.getNodeType() == Node.ELEMENT_NODE) { - Element eElement = (Element) node - String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent() - String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent() + if(requeryIdAAIResponse.getSubnets() != null){ + for(Subnet s:requeryIdAAIResponse.getSubnets().getSubnet()){ + String subnetOrchStatus = s.getOrchestrationStatus() + String subnetId = s.getSubnetId() Subnet subnet = new Subnet() - String neutronSubnetId = networkUtils.extractNeutSubId(createNetworkResponse, subnetId) - subnet.setNeutronSubnetId(neutronSubnetId) + subnet.setNeutronSubnetId(networkUtils.extractNeutSubId(createNetworkResponse, subnetId)) if(subnetOrchStatus.equals("pending-create") || subnetOrchStatus.equals("PendingCreate") ){ subnet.setOrchestrationStatus("Created") }else{ subnet.setOrchestrationStatus("Active") } + msoLogger.debug("Updating subnet in AAI" ) AAIResourceUri subUri = AAIUriFactory.createResourceUri(AAIObjectType.SUBNET, networkId, subnetId) client.update(subUri, subnet) + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index cc301db4cd..6dd8085bae 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -721,9 +721,9 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String status = utils.getNodeText(updateNetworkResponse, 'orchestration-status') if(status.equals("pending-create") || status.equals("PendingCreate")){ - l3Network.setOperationalStatus("Created") + l3Network.setOrchestrationStatus("Created") }else{ - l3Network.setOperationalStatus("Active") + l3Network.setOrchestrationStatus("Active") } AAIResourcesClient client = new AAIResourcesClient() diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy index 11dbf7d2ee..7523427c84 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceTest.groovy @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -43,9 +43,11 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.MockitoAnnotations import org.mockito.runners.MockitoJUnitRunner +import org.onap.aai.domain.yang.L3Network import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.WorkflowException - +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri import com.github.tomakehurst.wiremock.client.WireMock import com.github.tomakehurst.wiremock.junit.WireMockRule import org.apache.commons.lang3.* @@ -480,7 +482,7 @@ class DoCreateNetworkInstanceTest { <host-route-id>string</host-route-id> <route-prefix>192.10.16.0/24</route-prefix> <next-hop>192.10.16.100/24</next-hop> - <next-hop-type>ip-address</next-hop-type> + <next-hop-type>ip-address</next-hop-type> <resource-version>1505857301954</resource-version> </host-route> <host-route> @@ -508,7 +510,7 @@ class DoCreateNetworkInstanceTest { <host-route-id>string</host-route-id> <route-prefix>192.10.16.0/24</route-prefix> <next-hop>192.10.16.100/24</next-hop> - <next-hop-type>ip-address</next-hop-type> + <next-hop-type>ip-address</next-hop-type> <resource-version>1505857301954</resource-version> </host-route> </host-routes> @@ -1669,7 +1671,7 @@ String createNetworkRequest_Ipv4 = <notificationUrl/> </createNetworkRequest>""" -String createNetworkRequestAlaCarte = +String createNetworkRequestAlaCarte = """<createNetworkRequest> <cloudSiteId>RDM2WAGPLCP</cloudSiteId> <tenantId>7dd5365547234ee8937416c65507d266</tenantId> @@ -1874,8 +1876,8 @@ String createNetworkRequest_SRIOV = <serviceInstanceId/> </msoRequest> </networkRollback> -</rollbackNetworkRequest>""" - +</rollbackNetworkRequest>""" + String createNetworkResponse = """<ns2:createNetworkResponse xmlns:ns2="http://org.onap.so/network" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> @@ -3053,7 +3055,7 @@ String sdncAdapterWorkflowAssignResponse = when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) // JSON format when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") // 1610 default when(mockExecution.getVariable("disableRollback")).thenReturn(true) - + when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") @@ -3182,8 +3184,8 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest) } - - + + @Test //@Ignore public void prepareCreateNetworkRequest_Ipv4() { @@ -3220,7 +3222,7 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution).setVariable(Prefix + "createNetworkRequest", createNetworkRequest_Ipv4) } - + @Test //@Ignore public void prepareCreateNetworkRequest_AlaCarte() { @@ -3712,7 +3714,7 @@ String sdncAdapterWorkflowAssignResponse = //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() //preDebugger.printInvocations(mockExecution) - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix) verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") @@ -3791,7 +3793,7 @@ String sdncAdapterWorkflowAssignResponse = verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") } - + @Test //@Ignore public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { @@ -4025,26 +4027,25 @@ String sdncAdapterWorkflowAssignResponse = @Test //@Ignore public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - + AAIResourcesClient mockClient = mock(AAIResourcesClient.class) WireMock.reset(); - MockPutNetworkIdWithDepth("CreateNetworkV2/createNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); + L3Network network = new L3Network() + //TODO need to inject mock ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(network) when(mockExecution.getVariable(Prefix + "createNetworkResponse")).thenReturn(createNetworkResponseREST) when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + // old: when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") when(mockExecution.getVariable("mso.workflow.DoCreateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("false") when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + doNothing().when(mockClient).update(isA(AAIResourceUri.class), isA(L3Network.class)) // preProcessRequest(DelegateExecution execution) DoCreateNetworkInstance DoCreateNetworkInstance = new DoCreateNetworkInstance() DoCreateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) @@ -4102,7 +4103,7 @@ String sdncAdapterWorkflowAssignResponse = } - + @Test //@Ignore |