summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java83
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json14
9 files changed, 194 insertions, 32 deletions
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index becb66a6dc..0243ce8ae6 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -121,6 +121,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-adapter-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.onap.sdnc.northbound</groupId>
<artifactId>generic-resource-api-client</artifactId>
<version>1.5.0-SNAPSHOT</version>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index e83c27c400..92b4e211d5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -404,9 +404,9 @@ public class SniroHomingV2 {
for(Candidate c:required){
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
- type.setName(c.getCandidateType().getName());
- can.setCandidateType(type);
- can.setCandidates(c.getCandidates());
+ type.setName(c.getIdentifierType().getName());
+ can.setIdentifierType(type);
+ can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
cans.add(can);
}
@@ -417,9 +417,9 @@ public class SniroHomingV2 {
for(Candidate c:excluded){
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType();
- type.setName(c.getCandidateType().getName());
- can.setCandidateType(type);
- can.setCandidates(c.getCandidates());
+ type.setName(c.getIdentifierType().getName());
+ can.setIdentifierType(type);
+ can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
cans.add(can);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
new file mode 100644
index 0000000000..aaa9e51d15
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.audit;
+
+
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditTasks {
+
+ private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class);
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private Environment env;
+
+ public void isAuditNeeded(BuildingBlockExecution execution) {
+ try {
+ logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory"));
+ execution.setVariable("auditInventoryNeeded",env.getProperty("mso.infra.auditInventory"));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void setupAuditVariable(BuildingBlockExecution execution) {
+ try {
+ execution.setVariable("auditInventory",createAuditInventory(execution));
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ AuditInventory auditInventory = new AuditInventory();
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
+ auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
+ auditInventory.setTenantId(cloudRegion.getTenantId());
+ auditInventory.setHeatStackName(vfModule.getVfModuleName());
+ return auditInventory;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index b42636b078..1f8c56e727 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -29,28 +29,28 @@ public class Candidate implements Serializable{
private static final long serialVersionUID = -5474502255533410907L;
- @JsonProperty("candidateType")
- private CandidateType candidateType;
- @JsonProperty("candidates")
- private List<String> candidates;
+ @JsonProperty("identifierType")
+ private CandidateType identifierType;
+ @JsonProperty("identifiers")
+ private List<String> identifiers;
@JsonProperty("cloudOwner")
private String cloudOwner;
- public CandidateType getCandidateType(){
- return candidateType;
+ public CandidateType getIdentifierType(){
+ return identifierType;
}
- public void setCandidateType(CandidateType candidateType){
- this.candidateType = candidateType;
+ public void setIdentifierType(CandidateType identifierType){
+ this.identifierType = identifierType;
}
- public List<String> getCandidates(){
- return candidates;
+ public List<String> getIdentifiers(){
+ return identifiers;
}
- public void setCandidates(List<String> candidates){
- this.candidates = candidates;
+ public void setIdentifiers(List<String> identifiers){
+ this.identifiers = identifiers;
}
public String getCloudOwner(){
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
new file mode 100644
index 0000000000..7a9e2bb6cf
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/audit/AuditTasksTest.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF 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.bpmn.infrastructure.audit;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+
+public class AuditTasksTest extends BaseTaskTest{
+
+ @InjectMocks
+ private AuditTasks auditTasks = new AuditTasks();
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+
+
+ @Rule
+ public final ExpectedException exception = ExpectedException.none();
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ setCloudRegion();
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID), any())).thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID), any())).thenReturn(vfModule);
+ when(extractPojosForBB.extractByKey(any(),ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID), any())).thenReturn(serviceInstance);
+ }
+
+ @Test
+ public void setupAuditVariableTest() throws Exception {
+ AuditInventory expectedAuditInventory = new AuditInventory();
+ expectedAuditInventory.setCloudOwner("testCloudOwner");
+ expectedAuditInventory.setCloudRegion("testLcpCloudRegionId");
+ expectedAuditInventory.setHeatStackName("testVfModuleName1");
+ expectedAuditInventory.setTenantId("testTenantId");
+ auditTasks.setupAuditVariable(execution);
+ assertThat((AuditInventory)execution.getVariable("auditInventory"), sameBeanAs(expectedAuditInventory));
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
index f0bb6a369c..59fad5cdd6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java
@@ -84,7 +84,7 @@ public class SniroHomingV2IT extends BaseIntegrationTest{
requestContext.setMsoRequestId("testRequestId");
RequestParameters params = new RequestParameters();
params.setaLaCarte(false);
- params.setSubscriptionServiceType("iptollfree");
+ params.setSubscriptionServiceType("testSubscriptionServiceType");
requestContext.setRequestParameters(params);
}
@@ -94,10 +94,10 @@ public class SniroHomingV2IT extends BaseIntegrationTest{
bondingLink.getServiceProxies().add(setServiceProxy("1", "transport"));
ServiceProxy sp2 = setServiceProxy("2", "infrastructure");
Candidate requiredCandidate = new Candidate();
- requiredCandidate.setCandidateType(CandidateType.VNF_ID);
+ requiredCandidate.setIdentifierType(CandidateType.VNF_ID);
List<String> c = new ArrayList<String>();
c.add("testVnfId");
- requiredCandidate.setCandidates(c);
+ requiredCandidate.setIdentifiers(c);
sp2.addRequiredCandidates(requiredCandidate);
bondingLink.getServiceProxies().add(sp2);
serviceInstance.getVpnBondingLinks().add(bondingLink);
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
index b65203b24d..83ecd6add1 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json
@@ -42,13 +42,13 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
+ "identifierType" : {
"name" : "vnfId"
},
- "candidates" : [ "testVnfId" ]
+ "identifiers" : [ "testVnfId" ]
} ]
} ],
- "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false}
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
},
"licenseInfo" : {
"licenseDemands" : [ ]
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json
index ac460c328a..740a05d1be 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json
@@ -51,7 +51,7 @@
"modelInvariantId" : "testAllottedModelInvariantUuid3"
}
} ],
- "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false}
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
},
"licenseInfo" : {
"licenseDemands" : [ ]
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
index 6db2153691..c3c5c0771a 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json
@@ -42,10 +42,10 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
+ "identifierType" : {
"name" : "vnfId"
},
- "candidates" : [ "testVnfId" ]
+ "identifiers" : [ "testVnfId" ]
} ]
}, {
"serviceResourceId" : "testProxyId1",
@@ -66,10 +66,10 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
+ "identifierType" : {
"name" : "vnfId"
},
- "candidates" : [ "testVnfId" ]
+ "identifiers" : [ "testVnfId" ]
} ]
}, {
"serviceResourceId" : "testProxyId1",
@@ -90,13 +90,13 @@
"modelInvariantId" : "testProxyModelInvariantUuid2"
},
"requiredCandidates" : [ {
- "candidateType" : {
+ "identifierType" : {
"name" : "vnfId"
},
- "candidates" : [ "testVnfId" ]
+ "identifiers" : [ "testVnfId" ]
} ]
} ],
- "requestParameters" : {"subscriptionServiceType":"iptollfree","aLaCarte":false}
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
},
"licenseInfo" : {
"licenseDemands" : [ ]