Merge "fix issue where we attempt audit with no servers"
authorSteve Smokowski <ss835w@att.com>
Fri, 15 Feb 2019 12:40:24 +0000 (12:40 +0000)
committerGerrit Code Review <gerrit@onap.org>
Fri, 15 Feb 2019 12:40:24 +0000 (12:40 +0000)
17 files changed:
asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
bpmn/pom.xml
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicies.json [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPoliciesForDelete0.json [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPoliciesForDelete1.json [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/resources/schema.sql
mso-api-handlers/mso-api-handler-infra/pom.xml
pom.xml

index 4f64af0..f8d9d6c 100644 (file)
@@ -1220,16 +1220,32 @@ public class ToscaResourceInstaller {
                        crInstanceGroupCustomization.setModelCustomizationUUID(
                                        networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
                
-                       String quantityName = instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME);
-                       String fixedQuantity = quantityName.replace("NetworkCollection", "Fixed");
-                       if (toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
-                                       fixedQuantity + "_quantity") != null) {
-
-                               crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(
-                                               toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
-                                                               fixedQuantity + "_quantity"))); 
+                       // Loop through the template policy to find the subinterface_network_quantity property name.  Then extract the value for it.
+                       List<Policy> policyList = toscaResourceStructure.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType(networkNodeTemplate, "org.openecomp.policies.scaling.Fixed");
+                       
+                       if(policyList != null){
+                               for(Policy policy : policyList){
+                                       for(String policyNetworkCollection : policy.getTargets()){
+                                               
+                                               if(policyNetworkCollection.equalsIgnoreCase(group.getName())){
+                                               
+                                                       Map<String, Object> propMap = policy.getPolicyProperties();
+                                       
+                                                       if(propMap.get("quantity") != null){
+                                                                                                                               
+                                                               String quantity = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, getPropertyInput(propMap.get("quantity").toString())); 
+                                       
+                                                               if(quantity != null){
+                                                                       crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(quantity));
+                                                               }
+                                                                                               
+                                                   }
+                                       
+                                      }
+                                   }
+                           }   
                        }
-               
+                                       
                        crInstanceGroupCustomization.setDescription(
                                        toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate,
                                                        instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)
@@ -1246,7 +1262,6 @@ public class ToscaResourceInstaller {
 
                        networkInstanceGroupList.add(networkInstanceGroup);
 
-               //}
 
                toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
 
@@ -2032,6 +2047,20 @@ public class ToscaResourceInstaller {
                                + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
        }
        
+       protected String getPropertyInput(String propertyName){
+       
+               String inputName = new String();
+               
+               if (propertyName != null) { 
+                       int getInputIndex = propertyName.indexOf("{get_input="); 
+                       if (getInputIndex > -1) { 
+                               inputName = propertyName.substring(getInputIndex+11, propertyName.length()-1); 
+                       } 
+               }
+               
+               return inputName;
+       }
+       
        
        protected static Timestamp getCurrentTimeStamp() {
                
index e28bedd..df68017 100644 (file)
@@ -15,7 +15,7 @@
        <packaging>pom</packaging>
 
        <properties>
-               <camunda.version>7.9.0</camunda.version>
+               <camunda.version>7.10.0</camunda.version>
                <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version>
                <camunda.bpm.webapp.artifact>camunda-webapp-jboss-standalone</camunda.bpm.webapp.artifact>
                <h2.version>1.4.196</h2.version>
@@ -28,7 +28,7 @@
 
        <modules>
                <module>MSOCoreBPMN</module>
-               
+
                <module>MSOCommonBPMN</module>
                <module>so-bpmn-infrastructure-common</module>
                <module>so-bpmn-tasks</module>
index 828e3fc..4ac131f 100644 (file)
@@ -27,6 +27,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.camunda.bpm.engine.ProcessEngine;
 import org.camunda.bpm.engine.ProcessEngineServices;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.runtime.Incident;
@@ -53,7 +54,7 @@ public class AbstractBuilderTest {
         private String operType;
                private String resourceType;
                private String requestId;
-               
+
        @Override
         public String getProcessInstanceId() {
             return null;
@@ -326,18 +327,30 @@ public class AbstractBuilderTest {
         public void removeVariablesLocal() {
 
         }
+
+               @Override
+               public ProcessEngine getProcessEngine(){
+                       // TODO Auto-generated method stub
+                       return null;
+               }
+
+               @Override
+               public void setProcessBusinessKey(String arg0){
+                       // TODO Auto-generated method stub
+
+               }
     };
 
     @Test
     public void requestActionGetIntValueTest() {
        assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue());
     }
-    
+
     @Test
     public void svcActionGetIntValueTest() {
        assertEquals(0, SvcAction.RESERVE.getIntValue());
     }
-    
+
     @Test
     public void buildTest() throws Exception {
         abstractBuilder.build(null, null);
@@ -347,75 +360,75 @@ public class AbstractBuilderTest {
     public void getRequestActionBlankOperationTypeTest() throws Exception {
         assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionDeleteOperationTypeBlankResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
        assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionDeleteOperationTypeBadResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
        assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
        assertEquals(AbstractBuilder.RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
        assertEquals(AbstractBuilder.RequestAction.DELETE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionDeleteOperationTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-       
+
     @Test
     public void getRequestActionCreateOperationTypeBlankResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
        assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionCreateOperationTypeBadResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
        assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionCreateOperationTypeOverlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
        assertEquals(AbstractBuilder.RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
        assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionCreateOperationTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution));
     }
-    
+
     @Test
     public void getRequestActionBadOperationType() {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
@@ -426,75 +439,75 @@ public class AbstractBuilderTest {
     public void getSvcActionBlankOperationTypeTest() throws Exception {
         assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionDeleteOperationTypeBlankResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
        assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionDeleteOperationTypeBadResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
        assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
        assertEquals(AbstractBuilder.SvcAction.DEACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
        assertEquals(AbstractBuilder.SvcAction.DELETE.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionDeleteOperationTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE);
        assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-       
+
     @Test
     public void getSvcActionCreateOperationTypeBlankResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "");
        assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionCreateOperationTypeBadResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad");
        assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionCreateOperationTypeOverlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay");
        assertEquals(AbstractBuilder.SvcAction.ACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay");
        assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionCreateOperationTypeTest() throws Exception {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE);
        assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution));
     }
-    
+
     @Test
     public void getSvcActionBadOperationType() {
        delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad");
@@ -505,14 +518,14 @@ public class AbstractBuilderTest {
     public void getRequestIdBlankNotOnExecutionTest() {
        abstractBuilder.getRequestId(delegateExecution);
     }
-    
+
     @Test
     public void getRequestIdBlankOnExecutionTest() {
        String expected = "requestId";
        delegateExecution.setVariable("msoRequestId", expected);
        assertEquals(expected, abstractBuilder.getRequestId(delegateExecution));
     }
-    
+
     @Test
     public void getRequestIdTest() {
        String expected = "requestId";
@@ -539,13 +552,13 @@ public class AbstractBuilderTest {
         assertEquals("foo", list.get(0).getName());
         assertEquals("bar", list.get(0).getValue());
     }
-    
+
     @Test
     public void getParamEntitiesNullInputsTest() {
        List<ParamEntity> list = abstractBuilder.getParamEntities(null);
        assertEquals(0, list.size());
     }
-    
+
     @Test
     public void getParamEntitiesEmptyInputsTest() {
        List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>());
index f7d73a3..4e39c7b 100644 (file)
@@ -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.
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
+import org.camunda.bpm.engine.ProcessEngine;
 import org.camunda.bpm.engine.ProcessEngineServices;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.runtime.Incident;
@@ -35,12 +36,12 @@ import org.junit.Test;
 
 public class NetworkRpcInputEntityBuilderTest {
        NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder();
-       
+
        DelegateExecution delegateExecution = new DelegateExecution() {
         private String operType;
                private String resourceType;
                private String requestId;
-               
+
        @Override
         public String getProcessInstanceId() {
             return null;
@@ -313,6 +314,18 @@ public class NetworkRpcInputEntityBuilderTest {
         public void removeVariablesLocal() {
 
         }
+
+               @Override
+               public ProcessEngine getProcessEngine(){
+                       // TODO Auto-generated method stub
+                       return null;
+               }
+
+               @Override
+               public void setProcessBusinessKey(String arg0){
+                       // TODO Auto-generated method stub
+
+               }
     };
 
        @Test
index 4db0421..556ff67 100644 (file)
@@ -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.
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Set;
 
+import org.camunda.bpm.engine.ProcessEngine;
 import org.camunda.bpm.engine.ProcessEngineServices;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.runtime.Incident;
@@ -35,12 +36,12 @@ import org.junit.Test;
 
 public class ServiceRpcInputEntityBuilderTest {
        ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder();
-       
+
        DelegateExecution delegateExecution = new DelegateExecution() {
         private String operType;
                private String resourceType;
                private String requestId;
-               
+
        @Override
         public String getProcessInstanceId() {
             return null;
@@ -313,6 +314,18 @@ public class ServiceRpcInputEntityBuilderTest {
         public void removeVariablesLocal() {
 
         }
+
+               @Override
+               public ProcessEngine getProcessEngine(){
+                       // TODO Auto-generated method stub
+                       return null;
+               }
+
+               @Override
+               public void setProcessBusinessKey(String arg0){
+                       // TODO Auto-generated method stub
+
+               }
     };
 
        @Test
index 8f0334e..0d9aeed 100644 (file)
 package org.onap.so.bpmn.infrastructure.aai.tasks;
 
 
+import java.util.List;
 import java.util.Optional;
-import java.util.UUID;
 
+import org.onap.aai.domain.yang.NetworkPolicies;
+import org.onap.aai.domain.yang.NetworkPolicy;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
@@ -169,18 +170,22 @@ public class AAIDeleteTasks {
                                                String fqdn = fqdnList[i];
                                                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
                                                uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn);
-                                               Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri);
-                                               if(oNetPolicy.isPresent()) {
-                                                       String networkPolicyId = oNetPolicy.get().getNetworkPolicyId();
-                                                       msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId);                                                   
-                                                       
-                                                       aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);
+                                               Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri);
+                                               if(oNetPolicies.isPresent()) {
+                                                       NetworkPolicies networkPolicies = oNetPolicies.get();
+                                                       List<NetworkPolicy> networkPolicyList = networkPolicies.getNetworkPolicy();
+                                                       if (networkPolicyList != null && !networkPolicyList.isEmpty()) {
+                                                               NetworkPolicy networkPolicy = networkPolicyList.get(0);
+                                                               String networkPolicyId = networkPolicy.getNetworkPolicyId();
+                                                               msoLogger.debug("Deleting network-policy with network-policy-id " + networkPolicyId);                                                           
+                                                               aaiNetworkResources.deleteNetworkPolicy(networkPolicyId);                                                               
+                                                       }                                                       
                                                }
                                        }
                                }
                        }                       
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
-               }               
+               }       
        }
 }
index f6c9597..2e91a52 100644 (file)
@@ -89,8 +89,8 @@ public class WorkflowActionBBTasks {
                        execution.setVariable("completed", true);
                } else {
                        execution.setVariable("completed", false);
-                       execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
                }
+               execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
        }
        
        public void updateFlowStatistics(DelegateExecution execution) {
index 4ca3f2a..7283c99 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.so.client.orchestration;
 
 import java.util.Optional;
 
+import org.onap.aai.domain.yang.NetworkPolicies;
 import org.onap.aai.domain.yang.NetworkPolicy;
 import org.onap.aai.domain.yang.RouteTableReference;
 import org.onap.aai.domain.yang.VpnBinding;
@@ -86,6 +87,10 @@ public class AAINetworkResources {
                return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class);
        }
        
+       public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) {
+               return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class);
+       }
+       
        public Optional<org.onap.aai.domain.yang.Subnet> getSubnet(AAIResourceUri subnetUri) {
                return injectionHelper.getAaiClient().get(subnetUri).asBean(org.onap.aai.domain.yang.Subnet.class);
        }
index 5cb7751..4984b2f 100644 (file)
@@ -30,6 +30,8 @@ import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Optional;
 
 import org.camunda.bpm.engine.delegate.BpmnError;
@@ -39,6 +41,7 @@ import org.mockito.ArgumentCaptor;
 import org.mockito.ArgumentMatchers;
 import org.mockito.Captor;
 import org.mockito.InjectMocks;
+import org.onap.aai.domain.yang.NetworkPolicies;
 import org.onap.aai.domain.yang.NetworkPolicy;
 import org.onap.so.bpmn.BaseTaskTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
@@ -50,11 +53,13 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
 import org.onap.so.client.aai.entities.uri.AAIResourceUri;
 import org.onap.so.client.exception.BBObjectNotFoundException;
 
 
 public class AAIDeleteTasksTest extends BaseTaskTest {
+       private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
        
        @InjectMocks
        private AAIDeleteTasks aaiDeleteTasks = new AAIDeleteTasks();
@@ -191,11 +196,14 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
        @Test
        public void deleteNetworkPolicyNeedToDeleteAllTest() throws Exception {         
                execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,DEF456");
-               NetworkPolicy networkPolicy0 = new NetworkPolicy();
-               networkPolicy0.setNetworkPolicyId("testNetworkPolicyId0");
-               NetworkPolicy networkPolicy1 = new NetworkPolicy();
-               networkPolicy1.setNetworkPolicyId("testNetworkPolicyId1");
-               doReturn(Optional.of(networkPolicy0),Optional.of(networkPolicy1)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+               final String content0 = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete0.json")));
+               AAIResultWrapper aaiResultWrapper0 = new AAIResultWrapper(content0);
+               NetworkPolicies networkPolicies0 = aaiResultWrapper0.asBean(NetworkPolicies.class).get();
+               final String content1 = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPoliciesForDelete1.json")));
+               AAIResultWrapper aaiResultWrapper1 = new AAIResultWrapper(content1);
+               NetworkPolicies networkPolicies1 = aaiResultWrapper1.asBean(NetworkPolicies.class).get();
+               
+               doReturn(Optional.of(networkPolicies0),Optional.of(networkPolicies1)).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
                doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
                aaiDeleteTasks.deleteNetworkPolicies(execution);
                verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
@@ -206,8 +214,8 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
        @Test
        public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {                
                execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
-               Optional<NetworkPolicy> networkPolicy = Optional.empty();               
-               doReturn(networkPolicy).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+               Optional<NetworkPolicies> networkPolicies = Optional.empty();           
+               doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
                aaiDeleteTasks.deleteNetworkPolicies(execution);
                verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
        }
index 2fc6297..17a37c8 100644 (file)
@@ -96,7 +96,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
                execution.setVariable("flowsToExecute", flowsToExecute);
                workflowActionBBTasks.selectBB(execution);
                boolean success = (boolean) execution.getVariable("completed");
+               int currentSequence = (int) execution.getVariable("gCurrentSequence");
                assertEquals(true,success);
+               assertEquals(1,currentSequence);
        }
        
        @Test
@@ -115,7 +117,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
                execution.setVariable("flowsToExecute", flowsToExecute);
                workflowActionBBTasks.selectBB(execution);
                boolean success = (boolean) execution.getVariable("completed");
+               int currentSequence = (int) execution.getVariable("gCurrentSequence");
                assertEquals(false,success);
+               assertEquals(1,currentSequence);
        }
        
        @Test
index 2e2cc5d..8632a6a 100644 (file)
@@ -56,6 +56,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.client.aai.AAIObjectPlurals;
 import org.onap.so.client.aai.AAIObjectType;
 import org.onap.so.client.aai.AAIResourcesClient;
 import org.onap.so.client.aai.entities.AAIEdgeLabel;
@@ -190,6 +191,22 @@ public class AAINetworkResourcesTest extends TestDataSetup{
                }
        }
        
+       @Test
+       public void getNetworkPoliciesTest() throws Exception {
+               final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
+               AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
+               Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
+               AAIResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+               
+               doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+               oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
+               verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));               
+               if (oNetPolicies.isPresent()) {
+                       org.onap.aai.domain.yang.NetworkPolicies networkPolicies = oNetPolicies.get();
+                       assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicies.class).get(), sameBeanAs(networkPolicies));
+               }
+       }
+       
        @Test
        public void getRouteTableTest() throws Exception {
                final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json")));
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicies.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicies.json
new file mode 100644 (file)
index 0000000..3bd60a7
--- /dev/null
@@ -0,0 +1,10 @@
+{"network-policy":
+       [
+               {
+                       "network-policy-id":"1ac71fb8-ad43-4e16-9459-c3f372b8236d",
+                       "network-policy-fqdn":"default-domain:enpx-26177-T-E2E-rdm6a:enpx-26177-T-E2E-rdm6a_TIPXH-DBEV-VIF-TDAT0_net_1",
+                       "heat-stack-id":"InfraMSO-vSAMP12_14_1.0-VF-Base-1902-est01-GR_API-021119-1/9a3be28f-115d-4693-9b17-9291b98b46de",
+                       "resource-version":"1550068250015"
+               }
+       ]
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPoliciesForDelete0.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPoliciesForDelete0.json
new file mode 100644 (file)
index 0000000..f60c6d9
--- /dev/null
@@ -0,0 +1,10 @@
+{"network-policy":
+       [
+               {
+                       "network-policy-id":"testNetworkPolicyId0",
+                       "network-policy-fqdn":"ABC123",
+                       "heat-stack-id":"InfraMSO-vSAMP12_14_1.0-VF-Base-1902-est01-GR_API-021119-1/9a3be28f-115d-4693-9b17-9291b98b46de",
+                       "resource-version":"1550068250015"
+               }
+       ]
+}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPoliciesForDelete1.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPoliciesForDelete1.json
new file mode 100644 (file)
index 0000000..6aaea8e
--- /dev/null
@@ -0,0 +1,10 @@
+{"network-policy":
+       [
+               {
+                       "network-policy-id":"testNetworkPolicyId1",
+                       "network-policy-fqdn":"DEF456",
+                       "heat-stack-id":"InfraMSO-vSAMP12_14_1.0-VF-Base-1902-est01-GR_API-021119-1/9a3be28f-115d-4693-9b17-9291b98b46de",
+                       "resource-version":"1550068250015"
+               }
+       ]
+}
\ No newline at end of file
index 7a15e84..5ae6a2d 100644 (file)
@@ -1184,5 +1184,12 @@ alter table ACT_ID_TENANT_MEMBER
     add constraint ACT_FK_TENANT_MEMB_GROUP
     foreign key (GROUP_ID_)
     references ACT_ID_GROUP (ID_);
-
-
+    
+ALTER TABLE ACT_GE_BYTEARRAY
+  ADD TYPE_ integer;
+  
+ALTER TABLE ACT_GE_BYTEARRAY
+  ADD CREATE_TIME_ datetime(3);
+  
+ALTER TABLE ACT_RE_PROCDEF
+  ADD STARTABLE_ BOOLEAN NOT NULL DEFAULT TRUE;
\ No newline at end of file
index dd77c24..f316384 100644 (file)
@@ -14,7 +14,7 @@
        <name>mso-api-handler-infra</name>
        <description>ONAP SO API Handler Infra</description>
        <properties>
-               <camunda.version>7.9.0</camunda.version>
+               <camunda.version>7.10.0</camunda.version>
                <camunda.bpm.assert.version>1.2</camunda.bpm.assert.version>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -51,7 +51,7 @@
                <dependency>
              <groupId>org.camunda.bpm</groupId>
              <artifactId>camunda-engine</artifactId>
-           </dependency>       
+           </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-web</artifactId>
diff --git a/pom.xml b/pom.xml
index d7664ef..1d5d53d 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -65,8 +65,8 @@
                <siteNexusPath>content/sites/site/org/onap/so/${project.version}/</siteNexusPath>
                <cxf.version>3.2.6</cxf.version>
                <jax.ws.rs>2.1</jax.ws.rs>
-               <springboot.version>2.0.5.RELEASE</springboot.version>  
-               <camunda.springboot.version>3.0.0</camunda.springboot.version>
+               <springboot.version>2.0.5.RELEASE</springboot.version>
+               <camunda.springboot.version>3.2.0</camunda.springboot.version>
        </properties>
        <distributionManagement>
                <repository>
                                                <skip>${docker.skip}</skip>
                                                <skipBuild>${docker.skip.build}</skipBuild>
                                                <skipPush>${docker.skip.push}</skipPush>
-                                               <dockerHost>${docker.newHost}</dockerHost> <!-- 1. Update address to your local docker VM. 2. Add IP to your NO_PROXY 
+                                               <dockerHost>${docker.newHost}</dockerHost> <!-- 1. Update address to your local docker VM. 2. Add IP to your NO_PROXY
                                                        environment variable -->
-                                               <certPath>${docker.host.cert.path}</certPath><!-- Add -Ddocker.host.cert.pat="path 
+                                               <certPath>${docker.host.cert.path}</certPath><!-- Add -Ddocker.host.cert.pat="path
                                                        to your local certs directory" to maven build command -->
-                                               <pushRegistry>${dockerPushRepo}</pushRegistry> <!-- Update .m2/settings.xml Add server id settings.dockerRepository, username, 
+                                               <pushRegistry>${dockerPushRepo}</pushRegistry> <!-- Update .m2/settings.xml Add server id settings.dockerRepository, username,
                                                        and password -->
-                                               <pullRegistry>${dockerPullRepo}</pullRegistry> <!-- If docker repo is not public. Update .m2/settings.xml Add server id 
+                                               <pullRegistry>${dockerPullRepo}</pullRegistry> <!-- If docker repo is not public. Update .m2/settings.xml Add server id
                                                        settings.dockerRepository, username, and password -->
                                                <images>
                                                        <image>
        <dependencies>
                <dependency>
                        <groupId>com.fasterxml.jackson.core</groupId>
-                       <artifactId>jackson-core</artifactId>                   
+                       <artifactId>jackson-core</artifactId>
                </dependency>
                <dependency>
                        <groupId>com.fasterxml.jackson.module</groupId>
-                       <artifactId>jackson-module-jaxb-annotations</artifactId>                        
+                       <artifactId>jackson-module-jaxb-annotations</artifactId>
                </dependency>
                <dependency>
                        <groupId>com.fasterxml.jackson.core</groupId>
-                       <artifactId>jackson-databind</artifactId>                       
+                       <artifactId>jackson-databind</artifactId>
                </dependency>
                <dependency>
                        <groupId>com.fasterxml.jackson.core</groupId>
-                       <artifactId>jackson-annotations</artifactId>                    
+                       <artifactId>jackson-annotations</artifactId>
                </dependency>
                <dependency>
                        <groupId>com.fasterxml.jackson.jaxrs</groupId>
-                       <artifactId>jackson-jaxrs-base</artifactId>                     
+                       <artifactId>jackson-jaxrs-base</artifactId>
                </dependency>
                <dependency>
                        <groupId>com.fasterxml.jackson.jaxrs</groupId>
-                       <artifactId>jackson-jaxrs-json-provider</artifactId>                    
+                       <artifactId>jackson-jaxrs-json-provider</artifactId>
                </dependency>
                <dependency>
                        <groupId>javax.ws.rs</groupId>
                </dependency>
                <dependency>
                        <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>          
+                       <artifactId>junit</artifactId>
                        <scope>test</scope>
                </dependency>
                <dependency>
        <dependencyManagement>
                <dependencies>
                        <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
-                       <!-- force use of version 4.5 everywhere in transient deps, aligned on 
+                       <!-- force use of version 4.5 everywhere in transient deps, aligned on
                                WildFly 10 version -->
                        <dependency>
                                <groupId>org.apache.httpcomponents</groupId>
                                <artifactId>commons-io</artifactId>
                                <version>2.5</version>
                                <scope>compile</scope>
-                       </dependency>           
+                       </dependency>
                        <dependency>
                                <groupId>com.sun.xml.fastinfoset</groupId>
                                <artifactId>FastInfoset</artifactId>