aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java90
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml12
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/SniroHomingV2IT.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json46
14 files changed, 190 insertions, 110 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
deleted file mode 100644
index 73047cf961..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============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.common.baseclient;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-
-// TODO move to common location
-public class BaseClient<I, O> {
-
- private HttpHeaders httpHeader;
- private String targetUrl;
-
- public HttpHeaders getHttpHeader() {
- return httpHeader;
- }
-
- public HttpHeaders setDefaultHttpHeaders(String auth) {
- httpHeader = new HttpHeaders();
- httpHeader.set("Authorization", auth);
- httpHeader.setContentType(MediaType.APPLICATION_JSON);
- List<MediaType> acceptMediaTypes = new ArrayList<MediaType>();
- acceptMediaTypes.add(MediaType.APPLICATION_JSON);
- acceptMediaTypes.add(MediaType.TEXT_PLAIN);
- httpHeader.setAccept(acceptMediaTypes);
- return httpHeader;
- }
-
- public void setHttpHeader(HttpHeaders httpHeader) {
- this.httpHeader = httpHeader;
- }
-
- public String getTargetUrl() {
- return targetUrl;
- }
-
- public void setTargetUrl(String targetUrl) {
- this.targetUrl = targetUrl;
- }
-
- public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- return run(data, HttpMethod.GET, typeRef, uriVariables);
- }
-
- public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- return run(data, HttpMethod.POST, typeRef, uriVariables);
- }
-
- public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables)
- throws RestClientException {
- HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
- RestTemplate restTemplate = new RestTemplate();
- restTemplate
- .setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
- ResponseEntity<O> responseEntity =
- restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables);
- return responseEntity.getBody();
- }
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
index 6c3a0c43ed..b9f5a6af8e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/ServiceInstance.java
@@ -78,6 +78,8 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
private ModelInfoServiceInstance modelInfoServiceInstance;
@JsonProperty("instance-groups")
private List<InstanceGroup> instanceGroups = new ArrayList<>();
+ @JsonProperty("service-proxies")
+ private List<ServiceProxy> serviceProxies = new ArrayList<ServiceProxy>();
public List<GenericVnf> getVnfs() {
return vnfs;
@@ -211,6 +213,10 @@ public class ServiceInstance implements Serializable, ShallowCopy<ServiceInstanc
this.instanceGroups = instanceGroups;
}
+ public List<ServiceProxy> getServiceProxies() {
+ return serviceProxies;
+ }
+
@Override
public boolean equals(final Object other) {
if (!(other instanceof ServiceInstance)) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
index db5c11a954..4c91ad38a0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionCandidates.java
@@ -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.
@@ -34,7 +34,6 @@ public class SolutionCandidates implements Serializable {
private List<Candidate> requiredCandidates = new ArrayList<Candidate>();
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates = new ArrayList<Candidate>();
- // TODO figure out best way to do this
@JsonProperty("existingCandidates")
private List<Candidate> existingCandidates = new ArrayList<Candidate>();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
index ee2c10ca4b..05af5f71f8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
@@ -29,6 +29,7 @@ import java.util.Map;
import javax.ws.rs.core.UriBuilder;
import org.junit.Test;
import org.onap.so.BaseTest;
+import org.onap.so.client.BaseClient;
import org.springframework.core.ParameterizedTypeReference;
import wiremock.org.apache.http.entity.ContentType;
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 4dd7a467ea..e9ed15aa0f 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -152,12 +152,12 @@
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>${camunda.springboot.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.camunda.bpmn</groupId>
- <artifactId>camunda-engine-rest-core</artifactId>
- </exclusion>
- </exclusions>
+ <exclusions>
+ <exclusion>
+ <groupId>org.camunda.bpmn</groupId>
+ <artifactId>camunda-engine-rest-core</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
index a8e974d63a..2163e0b7a8 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFStartActivityTest.java
@@ -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.
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
index b6faf1b806..c5ddd56880 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnlockActivityTest.java
@@ -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.
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 2f898b6697..2b9729f7c7 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
@@ -334,6 +334,18 @@ public class SniroHomingV2 {
}
}
}
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
+ if (!serviceProxies.isEmpty()) {
+ logger.debug("Adding service proxies to placement demands list");
+ for (ServiceProxy sp : serviceProxies) {
+ if (isBlank(sp.getId())) {
+ sp.setId(UUID.randomUUID().toString());
+ }
+ Demand demand = buildDemand(sp.getId(), sp.getModelInfoServiceProxy());
+ addCandidates(sp, demand);
+ placementDemands.add(demand);
+ }
+ }
return placementDemands;
}
@@ -400,6 +412,7 @@ public class SniroHomingV2 {
private void addCandidates(SolutionCandidates candidates, Demand demand) {
List<Candidate> required = candidates.getRequiredCandidates();
List<Candidate> excluded = candidates.getExcludedCandidates();
+ List<Candidate> existing = candidates.getExistingCandidates();
if (!required.isEmpty()) {
List<org.onap.so.client.sniro.beans.Candidate> cans =
new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
@@ -424,7 +437,18 @@ public class SniroHomingV2 {
}
demand.setExcludedCandidates(cans);
}
- // TODO support existing candidates
+ if (!existing.isEmpty()) {
+ List<org.onap.so.client.sniro.beans.Candidate> cans =
+ new ArrayList<org.onap.so.client.sniro.beans.Candidate>();
+ for (Candidate c : existing) {
+ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
+ can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifiers(c.getIdentifiers());
+ can.setCloudOwner(c.getCloudOwner());
+ cans.add(can);
+ }
+ demand.setExistingCandidates(cans);
+ }
}
/**
@@ -462,6 +486,7 @@ public class SniroHomingV2 {
List<VpnBondingLink> links = serviceInstance.getVpnBondingLinks();
List<AllottedResource> allottes = serviceInstance.getAllottedResources();
List<GenericVnf> vnfs = serviceInstance.getVnfs();
+ List<ServiceProxy> serviceProxies = serviceInstance.getServiceProxies();
logger.debug("Processing placement solution " + i + 1);
for (int p = 0; p < placements.length(); p++) {
@@ -502,6 +527,12 @@ public class SniroHomingV2 {
break search;
}
}
+ for (ServiceProxy proxy : serviceProxies) {
+ if (placement.getString(SERVICE_RESOURCE_ID).equals(proxy.getId())) {
+ proxy.setServiceInstance(setSolution(solutionInfo, placement));
+ break search;
+ }
+ }
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
index e31285f044..e8a7fef1bd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
@@ -22,8 +22,8 @@ package org.onap.so.client.oof;
import org.camunda.bpm.engine.delegate.BpmnError;
-import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.oof.beans.OofProperties;
import org.onap.so.client.oof.beans.OofRequest;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index b70caa149c..2e7877fe3b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -24,7 +24,7 @@ package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
import javax.ws.rs.core.UriBuilder;
-import org.onap.so.bpmn.common.baseclient.BaseClient;
+import org.onap.so.client.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index f7aad558b2..21c0b971b8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -24,8 +24,8 @@ package org.onap.so.client.sniro;
import java.util.LinkedHashMap;
import org.camunda.bpm.engine.delegate.BpmnError;
-import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.sniro.beans.ManagerProperties;
import org.onap.so.client.sniro.beans.SniroConductorRequest;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
index 19378cdbfa..fe2b63ff92 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
@@ -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.
@@ -38,6 +38,8 @@ public class Demand implements Serializable {
private List<Candidate> requiredCandidates;
@JsonProperty("excludedCandidates")
private List<Candidate> excludedCandidates;
+ @JsonProperty("existingCandidates")
+ private List<Candidate> existingCandidates;
public List<Candidate> getRequiredCandidates() {
@@ -80,4 +82,12 @@ public class Demand implements Serializable {
this.modelInfo = modelInfo;
}
+ public List<Candidate> getExistingCandidates() {
+ return existingCandidates;
+ }
+
+ public void setExistingCandidates(List<Candidate> existingCandidates) {
+ this.existingCandidates = existingCandidates;
+ }
+
}
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 8d51ceb65f..b5a8318ce9 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
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.isA;
@@ -53,6 +53,7 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
public class SniroHomingV2IT extends BaseIntegrationTest {
@@ -107,6 +108,18 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
serviceInstance.getAllottedResources().add(setAllottedResource("3"));
}
+ public void beforeServiceProxy() {
+ ServiceProxy sp = setServiceProxy("1", "infrastructure");
+ Candidate requiredCandidate = new Candidate();
+ requiredCandidate.setIdentifierType(CandidateType.CLOUD_REGION_ID);
+ List<String> c = new ArrayList<String>();
+ c.add("testCloudRegionId");
+ requiredCandidate.setCloudOwner("att");
+ requiredCandidate.setIdentifiers(c);
+ sp.addRequiredCandidates(requiredCandidate);
+ serviceInstance.getServiceProxies().add(sp);
+ }
+
public void beforeVnf() {
setGenericVnf();
}
@@ -191,6 +204,23 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
verify(sniroClient, times(1)).postDemands(isA(SniroManagerRequest.class));
}
+ @Test
+ public void testCallSniro_success_1ServiceProxy() throws JsonProcessingException, BadResponseException {
+ beforeServiceProxy();
+
+ wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
+ aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
+
+ sniroHoming.callSniro(execution);
+
+ String request = readResourceFile(RESOURCE_PATH + "SniroManagerRequest1SP.json");
+ request = request.replace("28080", wireMockPort);
+
+ ArgumentCaptor<SniroManagerRequest> argument = ArgumentCaptor.forClass(SniroManagerRequest.class);
+ verify(sniroClient, times(1)).postDemands(argument.capture());
+ assertEquals(request, argument.getValue().toJsonString());
+ }
+
@Test(expected = Test.None.class)
public void testProcessSolution_success_1VpnLink_1Solution() {
beforeVpnBondingLink("1");
@@ -563,10 +593,57 @@ public class SniroHomingV2IT extends BaseIntegrationTest {
assertEquals(2, vnf.getLicense().getLicenseKeyGroupUuids().size());
assertEquals("f1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getEntitlementPoolUuids().get(0));
assertEquals("s1d563e8-e714-4393-8f99-cc480144a05e", vnf.getLicense().getLicenseKeyGroupUuids().get(0));
+ }
+
+ @Test
+ public void testProcessSolution_success_1ServiceProxy_1Solutions() {
+ beforeServiceProxy();
+
+ JSONObject asyncResponse = new JSONObject();
+ asyncResponse.put("transactionId", "testRequestId").put("requestId", "testRequestId").put("requestState",
+ "completed");
+ JSONArray solution1 = new JSONArray();
+ solution1
+ .put(new JSONObject()
+ .put("serviceResourceId", "testProxyId1").put(
+ "solution",
+ new JSONObject()
+ .put("identifierType", "serviceInstanceId")
+ .put("identifiers", new JSONArray().put("testServiceInstanceId1")))
+ .put("assignmentInfo",
+ new JSONArray().put(new JSONObject().put("key", "isRehome").put("value", "False"))
+ .put(new JSONObject().put("key", "cloudOwner").put("value", ""))
+ .put(new JSONObject().put("key", "aicClli").put("value", "testAicClli1"))
+ .put(new JSONObject().put("key", "aicVersion").put("value", "3"))
+ .put(new JSONObject().put("key", "cloudRegionId").put("value", ""))
+ .put(new JSONObject().put("key", "primaryPnfName").put("value",
+ "testPrimaryPnfName"))
+ .put(new JSONObject().put("key", "secondaryPnfName").put("value",
+ "testSecondaryPnfName"))));
+
+ asyncResponse.put("solutions", new JSONObject().put("placementSolutions", new JSONArray().put(solution1))
+ .put("licenseSolutions", new JSONArray()));
+ sniroHoming.processSolution(execution, asyncResponse.toString());
+ ServiceInstance si =
+ execution.getGeneralBuildingBlock().getCustomer().getServiceSubscription().getServiceInstances().get(0);
+
+ ServiceProxy sp = si.getServiceProxies().get(0);
+ assertNotNull(sp);
+ assertNotNull(sp.getServiceInstance());
+
+ assertEquals("testServiceInstanceId1", sp.getServiceInstance().getServiceInstanceId());
+ assertNotNull(sp.getServiceInstance().getSolutionInfo());
+
+ assertFalse(sp.getServiceInstance().getPnfs().isEmpty());
+ assertEquals("testPrimaryPnfName", sp.getServiceInstance().getPnfs().get(0).getPnfName());
+ assertEquals("primary", sp.getServiceInstance().getPnfs().get(0).getRole());
+ assertEquals("testSecondaryPnfName", sp.getServiceInstance().getPnfs().get(1).getPnfName());
+ assertEquals("secondary", sp.getServiceInstance().getPnfs().get(1).getRole());
}
+
@Test(expected = BpmnError.class)
public void testCallSniro_error_0Resources() throws BadResponseException, JsonProcessingException {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json
new file mode 100644
index 0000000000..27463350ab
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1SP.json
@@ -0,0 +1,46 @@
+{
+ "requestInfo" : {
+ "transactionId" : "testRequestId",
+ "requestId" : "testRequestId",
+ "callbackUrl" : "http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId",
+ "sourceId" : "mso",
+ "requestType" : "create",
+ "timeout" : 1800
+ },
+ "serviceInfo" : {
+ "modelInfo" : {
+ "modelName" : "testModelName1",
+ "modelVersionId" : "testModelUUID1",
+ "modelVersion" : "testModelVersion1",
+ "modelInvariantId" : "testModelInvariantUUID1"
+ },
+ "serviceRole" : "testServiceRole1",
+ "serviceInstanceId" : "testServiceInstanceId1",
+ "serviceName" : "testServiceType1"
+ },
+ "placementInfo" : {
+ "subscriberInfo" : {
+ "globalSubscriberId" : "testCustomerId",
+ "subscriberName" : "testCustomerName"
+ },
+ "placementDemands" : [ {
+ "serviceResourceId" : "testProxyId1",
+ "resourceModuleName" : "testProxyInstanceName1",
+ "resourceModelInfo" : {
+ "modelName" : "testProxyModelName1",
+ "modelVersionId" : "testProxyModelUuid1",
+ "modelVersion" : "testProxyModelVersion1",
+ "modelInvariantId" : "testProxyModelInvariantUuid1"
+ },
+ "requiredCandidates" : [ {
+ "identifierType" : "cloudRegionId",
+ "identifiers" : [ "testCloudRegionId" ],
+ "cloudOwner" : "att"
+ } ]
+ } ],
+ "requestParameters" : {"subscriptionServiceType":"testSubscriptionServiceType","aLaCarte":false}
+ },
+ "licenseInfo" : {
+ "licenseDemands" : [ ]
+ }
+} \ No newline at end of file