aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json59
5 files changed, 146 insertions, 1 deletions
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
index 69d21c41ac..72374e0580 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/InstanceReferences.java
@@ -39,6 +39,8 @@ public class InstanceReferences {
protected String networkInstanceId;
protected String networkInstanceName;
protected String requestorId;
+ protected String instanceGroupId;
+ protected String instanceGroupName;
public String getServiceInstanceId() {
@@ -109,6 +111,18 @@ public class InstanceReferences {
public void setRequestorId(String requestorId) {
this.requestorId = requestorId;
}
+ public String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+ public void setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ }
+ public String getInstanceGroupName() {
+ return instanceGroupName;
+ }
+ public void setInstanceGroupName(String instanceGroupName) {
+ this.instanceGroupName = instanceGroupName;
+ }
@Override
public String toString() {
return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId)
@@ -118,6 +132,7 @@ public class InstanceReferences {
.append("volumeGroupInstanceId", volumeGroupInstanceId)
.append("volumeGroupInstanceName", volumeGroupInstanceName)
.append("networkInstanceId", networkInstanceId).append("networkInstanceName", networkInstanceName)
- .append("requestorId", requestorId).toString();
+ .append("requestorId", requestorId).append("instanceGroupId", instanceGroupId)
+ .append("instanceGroupName", instanceGroupName).toString();
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 0a60bff875..c809079acf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -299,6 +299,11 @@ public class OrchestrationRequests {
ir.setVolumeGroupInstanceName(iar.getVolumeGroupName());
if(iar.getRequestorId() != null)
ir.setRequestorId(iar.getRequestorId());
+ if(iar.getInstanceGroupId() != null)
+ ir.setInstanceGroupId(iar.getInstanceGroupId());
+ if(iar.getInstanceGroupName() != null)
+ ir.setInstanceGroupName(iar.getInstanceGroupName());
+
request.setInstanceReferences(ir);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 58d6b7f1c7..b2e221ac7b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -125,6 +125,31 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
assertEquals("00032ab7-na18-42e5-965d-8ea592502018", response.getHeaders().get("X-TransactionID").get(0));
}
+
+ @Test
+ public void testGetOrchestrationRequestInstanceGroup() throws Exception {
+ setupTestGetOrchestrationRequestInstanceGroup();
+ // TEST VALID REQUEST
+ GetOrchestrationResponse testResponse = new GetOrchestrationResponse();
+
+ Request request = ORCHESTRATION_LIST.getRequestList().get(8).getRequest();
+ testResponse.setRequest(request);
+ String testRequestId = request.getRequestId();
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
+
+ UriComponentsBuilder builder = UriComponentsBuilder
+ .fromHttpUrl(createURLWithPort("/onap/so/infra/orchestrationRequests/v7/" + testRequestId));
+
+ ResponseEntity<GetOrchestrationResponse> response = restTemplate.exchange(builder.toUriString(), HttpMethod.GET,
+ entity, GetOrchestrationResponse.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(response.getBody(),
+ sameBeanAs(testResponse).ignoring("request.startTime").ignoring("request.requestStatus.finishTime"));
+ }
@Test
public void testGetOrchestrationRequestRequestDetails() throws Exception {
@@ -401,6 +426,17 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
.withStatus(HttpStatus.SC_OK)));
}
+ public void setupTestGetOrchestrationRequestInstanceGroup() throws Exception{
+ //For testGetOrchestrationRequest
+ stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json"))))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
+ .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
+ .withStatus(HttpStatus.SC_OK)));
+ }
private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{
stubFor(get(urlPathEqualTo(getTestUrl(requestId))).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
index d24b48ba29..4ed5ffeb08 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
@@ -293,6 +293,36 @@
"statusMessage":"Error parsing request.\n\tNo valid instanceName is specified"
}
}
+ },
+ {
+ "request":{
+ "requestId":"00032ab7-na18-42e5-965d-8ea592502018",
+ "requestScope":"instanceGroup",
+ "requestType":"addMembers",
+ "requestDetails":{
+ "modelInfo":{
+ "modelType":"vfModule",
+ "modelName":"test::base::module-0"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false
+ },
+ "cloudConfiguration":{
+ "tenantId":"6accefef3cb442ff9e644d589fb04107",
+ "lcpCloudRegionId":"n6"
+ }
+ },
+ "instanceReferences":{
+ "instanceGroupId": "00032ab7-na18-42e5-965d-8ea592502019",
+ "instanceGroupName": "testInstanceGroup"
+ },
+ "requestStatus":{
+ "requestState":"PENDING",
+ "statusMessage":"STATUS: Adding members./FLOW STATUS: Building blocks 1 of 3 completed./RETRY STATUS: Retry 2/5 will be started in 8 min./ROLLBACK STATUS: Rollback has been completed successfully.",
+ "percentProgress":0
+ }
+ }
}
]
} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json
new file mode 100644
index 0000000000..e0ea6a805b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getOrchestrationRequestInstanceGroup.json
@@ -0,0 +1,59 @@
+{
+ "clientRequestId": "00032ab7-fake-42e5-965d-8ea592502018",
+ "action": "addMembers",
+ "requestStatus": "PENDING",
+ "statusMessage": "Adding members.",
+ "progress": 0,
+ "startTime": "2016-12-22T13:29:54.000+0000",
+ "endTime": "2016-12-22T13:30:28.000+0000",
+ "source": "VID",
+ "vnfId": null,
+ "vnfName": null,
+ "vnfType": null,
+ "serviceType": null,
+ "aicNodeClli": null,
+ "tenantId": "6accefef3cb442ff9e644d589fb04107",
+ "provStatus": null,
+ "vnfParams": null,
+ "vnfOutputs": null,
+ "requestBody": "{\"requestDetails\": {\"modelInfo\":{\"modelType\":\"vfModule\",\"modelName\":\"test::base::module-0\"},\"requestInfo\":{\"source\":\"VID\"},\"cloudConfiguration\":{\"tenantId\":\"6accefef3cb442ff9e644d589fb04107\",\"lcpCloudRegionId\":\"n6\"}}}",
+ "responseBody": null,
+ "lastModifiedBy": "BPMN",
+ "modifyTime": "2016-12-22T13:30:28.000+0000",
+ "requestType": null,
+ "volumeGroupId": null,
+ "volumeGroupName": null,
+ "vfModuleId": null,
+ "vfModuleName": null,
+ "vfModuleModelName": "test::base::module-0",
+ "aaiServiceId": null,
+ "aicCloudRegion": "n6",
+ "callBackUrl": null,
+ "correlator": null,
+ "serviceInstanceId": null,
+ "serviceInstanceName": null,
+ "requestScope": "instanceGroup",
+ "requestAction": "addMembers",
+ "networkId": null,
+ "networkName": null,
+ "networkType": null,
+ "requestorId": null,
+ "configurationId": null,
+ "configurationName": null,
+ "operationalEnvId": null,
+ "operationalEnvName": null,
+ "rollbackStatusMessage": "Rollback has been completed successfully.",
+ "flowStatus": "Building blocks 1 of 3 completed.",
+ "retryStatusMessage": "Retry 2/5 will be started in 8 min.",
+ "requestURI": "00032ab7-na18-42e5-965d-8ea592502018",
+ "instanceGroupId": "00032ab7-na18-42e5-965d-8ea592502019",
+ "instanceGroupName": "testInstanceGroup",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8087/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018"
+ },
+ "infraActiveRequests": {
+ "href": "http://localhost:8087/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018"
+ }
+ }
+} \ No newline at end of file