diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-12 16:55:02 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-09-13 15:42:46 -0400 |
commit | 487061f35d918536c6ce8ec6fe7e0ee70532aedc (patch) | |
tree | 54d81c21f74a79f8aca7599864e517edec8dddad /mso-api-handlers/mso-requests-db/src | |
parent | 58a00a16d7df65f83f2a90893a8af9b717950d11 (diff) |
Stability fixes
sdnc now logs the full response message as a json
removed erroneous encoding of variables with full XML
Return created network from getVirtualLinkL3Network
added exception logger to workflowaction aai check
Check for null value for vnfcPorts before referencing it
Added test case for invalid camunda response
Changed to use updateStatus method
Added saving for currentActiveReq and test for 401 resp
Change JUnit to use expectedException and clean up unused items.
Add vfModuleId to the exception message for missing model info.
Report an error if VF Module model info is expected but is null.
- Just renamed the Cvnfc and Vnfc set names
- Updated code to check for duplicate VNFC's across multiple modules in
the same VNF.
- Removed commented out if statement line for ALLOTTED_RESOURCE
- Reinitialize the Cvnfc and Vnfc Sets each time we iterate the
VFModule loop. This will avoid the concurrent modification exception.
Eliminated Ben from the sample request
Changed to use else if for null check
Added null check before catdb call and test case
Fix implementation of a call to VNF Adapter for DeleteVolumeGroupBB.
Update the method to no call save and do a put
Revert usage of PUT method, use save instead
Change-Id: I9f69fb68d0639c23b8e1de6931938119bd3ac54b
Issue-ID: SO-1032
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src')
-rw-r--r-- | mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java index 5eb2addc0a..6ab92853d1 100644 --- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java +++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java @@ -82,10 +82,6 @@ public class RequestsDbClient { private static final String VALUE = "VALUE"; private static final String TAG = "TAG"; - private Client<InfraActiveRequests> infraActiveRequestClient; - private Client<RequestProcessingData> requestProcessingDataClient; - private final Client<OperationalEnvDistributionStatus> distributionStatusClient; - private final Client<OperationalEnvServiceModelStatus> serviceModelStatusClient; @Value("${mso.adapters.requestDb.endpoint}") protected String endpoint; @@ -140,11 +136,12 @@ public class RequestsDbClient { findOneByOperationalEnvIdAndServiceModelVersionIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdURI; findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI; } - - public RequestsDbClient() { + + public ClientFactory getClientFactory(){ + URI baseUri = UriBuilder.fromUri(endpoint).build(); ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()); - ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { + return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> { restTemplate.getInterceptors().add((new SpringClientFilter())); restTemplate.getInterceptors().add((request, body, execution) -> { @@ -153,11 +150,8 @@ public class RequestsDbClient { return execution.execute(request, body); }); }).build().buildClientFactory(); - infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class); - requestProcessingDataClient = clientFactory.create(RequestProcessingData.class); - distributionStatusClient = clientFactory.create(OperationalEnvDistributionStatus.class); - serviceModelStatusClient = clientFactory.create(OperationalEnvServiceModelStatus.class); } + public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){ URI uri = getUri(cloudOrchestrationFiltersFromInfraActive); @@ -176,7 +170,10 @@ public class RequestsDbClient { public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) { try { - InfraActiveRequests infraActiveRequests = restTemplate.exchange(getUri(endpoint + "/infraActiveRequests/" + requestId), HttpMethod.GET, HttpEntity.EMPTY, InfraActiveRequests.class).getBody(); + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", msoAdaptersAuth); + HttpEntity<?> entity = new HttpEntity<>(headers); + InfraActiveRequests infraActiveRequests = restTemplate.exchange(getUri(endpoint + "/infraActiveRequests/" + requestId), HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); if (infraActiveRequests != null) { infraActiveRequests.setRequestId(requestId); } @@ -198,9 +195,13 @@ public class RequestsDbClient { } public InfraActiveRequests checkVnfIdStatus(String operationalEnvironmentId) { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", msoAdaptersAuth); + HttpEntity<?> entity = new HttpEntity<>(headers); URI uri = getUri(checkVnfIdStatus + operationalEnvironmentId); - return restTemplate.exchange(uri, HttpMethod.GET, HttpEntity.EMPTY, InfraActiveRequests.class).getBody(); + return restTemplate.exchange(uri, HttpMethod.GET, entity, InfraActiveRequests.class).getBody(); } + public InfraActiveRequests checkInstanceNameDuplicate(HashMap<String, String> instanceIdMap, String instanceName, String requestScope) { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", msoAdaptersAuth); @@ -219,10 +220,13 @@ public class RequestsDbClient { public OperationStatus getOneByServiceIdAndOperationId(String serviceId, String operationId) { try { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", msoAdaptersAuth); + HttpEntity<?> entity = new HttpEntity<>(headers); OperationStatus operationStatus = restTemplate.exchange(UriBuilder.fromUri(getUri(findOneByServiceIdAndOperationIdURI)) .queryParam(SERVICE_ID, serviceId) .queryParam(OPERATION_ID, operationId) - .build(), HttpMethod.GET, HttpEntity.EMPTY, OperationStatus.class).getBody(); + .build(), HttpMethod.GET, entity, OperationStatus.class).getBody(); if (operationStatus != null) { operationStatus.setServiceId(serviceId); operationStatus.setOperationId(operationId); @@ -256,11 +260,11 @@ public class RequestsDbClient { } private OperationalEnvServiceModelStatus getSingleOperationalEnvServiceModelStatus(URI uri){ - return serviceModelStatusClient.get(uri); + return getClientFactory().create(OperationalEnvServiceModelStatus.class).get(uri); } private List<OperationalEnvServiceModelStatus> getMultipleOperationalEnvServiceModelStatus(URI uri){ - Iterable <OperationalEnvServiceModelStatus> iterable = serviceModelStatusClient.getAll(uri); + Iterable <OperationalEnvServiceModelStatus> iterable = getClientFactory().create(OperationalEnvServiceModelStatus.class).getAll(uri); List<OperationalEnvServiceModelStatus> serviceModelStatuses = new ArrayList<>(); Iterator<OperationalEnvServiceModelStatus> statusIterator = iterable.iterator(); statusIterator.forEachRemaining(serviceModelStatuses::add); @@ -284,11 +288,17 @@ public class RequestsDbClient { } private OperationalEnvDistributionStatus getSingleOperationalEnvDistributionStatus(URI uri){ - return distributionStatusClient.get(uri); + return getClientFactory().create(OperationalEnvDistributionStatus.class).get(uri); } - public void updateInfraActiveRequests(InfraActiveRequests request) { - infraActiveRequestClient.put(request); + public void updateInfraActiveRequests(InfraActiveRequests request) { + HttpHeaders headers = new HttpHeaders(); + headers.set("Authorization", msoAdaptersAuth); + headers.set(HttpHeaders.CONTENT_TYPE,"application/json"); + headers.set(HttpHeaders.ACCEPT, "application/json"); + URI uri = getUri(infraActiveRequestURI+request.getRequestId()); + HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(request, headers); + restTemplate.put(uri, entity); } protected URI getUri(String uri) { @@ -319,11 +329,11 @@ public class RequestsDbClient { } public RequestProcessingData getSingleRequestProcessingData(URI uri){ - return requestProcessingDataClient.get(uri); + return getClientFactory().create(RequestProcessingData.class).get(uri); } private List<RequestProcessingData> getRequestProcessingData(URI uri) { - Iterable<RequestProcessingData> requestProcessingDataIterator = requestProcessingDataClient.getAll(uri); + Iterable<RequestProcessingData> requestProcessingDataIterator = getClientFactory().create(RequestProcessingData.class).getAll(uri); List<RequestProcessingData> requestProcessingDataList = new ArrayList<>(); Iterator<RequestProcessingData> it = requestProcessingDataIterator.iterator(); it.forEachRemaining(requestProcessingDataList::add); @@ -335,8 +345,8 @@ public class RequestsDbClient { return (List<RequestProcessingData>) this.getAllRequestProcessingData(UriBuilder.fromUri(endpoint + "/requestProcessingData").build()); } - private Iterable<RequestProcessingData> getAllRequestProcessingData(URI uri) { - return requestProcessingDataClient.getAll(uri); + private Iterable<RequestProcessingData> getAllRequestProcessingData(URI uri) { + return getClientFactory().create(RequestProcessingData.class).getAll(uri); } @Component |