summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java32
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java31
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json3
7 files changed, 73 insertions, 19 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index f283af1ba6..aa039c6ac4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -655,4 +655,36 @@ public class CatalogDbAdapterRest {
return Response.status(HttpStatus.SC_NOT_FOUND).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.build();
}
+
+ @GET
+ @Path("processingFlags")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response getAllProcessingFlags() {
+ return getAllProcessingFlagsImpl();
+ }
+
+ public Response getAllProcessingFlagsImpl() {
+ List<ProcessingFlags> processingFlags = null;
+
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ processingFlags = processingFlagsRepo.findAll();
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlags not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ } else {
+
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ }
+ return Response.status(respStatus).entity(processingFlags)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 04161e9df9..3906229c2c 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -21,7 +21,9 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.json.JSONException;
@@ -37,6 +39,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -831,6 +834,34 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetAllProcessingFlags() throws Exception {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ ObjectMapper mapper = new ObjectMapper();
+
+ List<ProcessingFlags> processingFlagsResponse =
+ mapper.readValue(response.getBody(), new TypeReference<List<ProcessingFlags>>() {});
+
+ boolean testFlagFound = false;
+ for (int i = 0; i < processingFlagsResponse.size(); i++) {
+ if (processingFlagsResponse.get(i).getFlag().equals("TESTFLAG")) {
+ assertEquals(processingFlagsResponse.get(i).getEndpoint(), "TESTENDPOINT");
+ assertEquals(processingFlagsResponse.get(i).getDescription(), "TEST FLAG");
+ testFlagFound = true;
+ }
+ }
+ assertTrue(testFlagFound);
+ }
+
+ @Test
public void testSetProcessingFlagsFlagValue() throws JSONException {
ProcessingFlags updatedProcessingFlag = new ProcessingFlags();
updatedProcessingFlag.setFlag("TESTFLAG");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 92e9b13bb6..e537b241c0 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -570,9 +570,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Vserver vserver = vserverWrapper.asBean(Vserver.class).get();
List<String> pciIds = HeatBridgeUtils.extractPciIdsFromVServer(vserver);
if (CollectionUtils.isNotEmpty(pciIds)) {
- List<String> matchingPservers = vserverRelationships.get().getRelatedLinks(AAIObjectType.PSERVER);
+ List<AAIResourceUri> matchingPservers =
+ vserverRelationships.get().getRelatedUris(AAIObjectType.PSERVER);
if (matchingPservers != null && matchingPservers.size() == 1) {
- pserverToPciIdMap.put(matchingPservers.get(0), pciIds);
+ pserverToPciIdMap.put(matchingPservers.get(0).getURIKeys().get("hostname"), pciIds);
}
}
}
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 9b892af869..7711608288 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
@@ -133,7 +133,6 @@ public class OrchestrationRequestsTest extends BaseTest {
testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
RequestProcessingData e = new RequestProcessingData();
e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- e.setTag("pincFabricConfigRequest");
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
HashMap<String, String> data1 = new HashMap<String, String>();
data1.put("requestAction", "assign");
@@ -210,7 +209,6 @@ public class OrchestrationRequestsTest extends BaseTest {
testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
RequestProcessingData e = new RequestProcessingData();
e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- e.setTag("pincFabricConfigRequest");
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
HashMap<String, String> data1 = new HashMap<String, String>();
data1.put("requestAction", "assign");
@@ -256,7 +254,6 @@ public class OrchestrationRequestsTest extends BaseTest {
testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
RequestProcessingData e = new RequestProcessingData();
e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- e.setTag("pincFabricConfigRequest");
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
HashMap<String, String> data1 = new HashMap<String, String>();
data1.put("requestAction", "assign");
@@ -463,13 +460,11 @@ public class OrchestrationRequestsTest extends BaseTest {
HashMap<String, String> secondExpectedMap = new HashMap<>();
List<RequestProcessingData> expectedDataList = new ArrayList<>();
entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- entry.setTag("pincFabricConfigRequest");
expectedMap.put("requestAction", "assign");
- expectedMap.put("pincFabricId", "testId");
+ expectedMap.put("fabricId", "testId");
expectedList.add(expectedMap);
entry.setDataPairs(expectedList);
secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
- secondEntry.setTag("pincFabricConfig");
secondExpectedMap.put("requestAction", "unassign");
secondExpectedList.add(secondExpectedMap);
secondEntry.setDataPairs(secondExpectedList);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
index 79caa33419..a84b2dbe11 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
@@ -4,21 +4,18 @@
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
"name": "requestAction",
- "value": "assign",
- "tag": "pincFabricConfigRequest"
+ "value": "assign"
},{
"id": 2,
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
- "name": "pincFabricId",
- "value": "testId",
- "tag": "pincFabricConfigRequest"
+ "name": "fabricId",
+ "value": "testId"
},{
"id": 3,
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca715",
"name": "requestAction",
- "value": "unassign",
- "tag": "pincFabricConfig"
+ "value": "unassign"
}
] \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
index af28007900..6ebe55201a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
@@ -3,6 +3,5 @@
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
"name": "requestAction",
- "value": "assign",
- "tag": "pincFabricConfigRequest"
+ "value": "assign"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
index c746020e7f..c3554c86a5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
@@ -3,6 +3,5 @@
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
"name": "requestAction",
- "value": "assign",
- "tag": "pincFabricConfigRequest"
+ "value": "assign"
}]