From d801fdc32a34621aed239f5429c55cda0344eac9 Mon Sep 17 00:00:00 2001 From: romaingimbert Date: Thu, 7 Mar 2019 09:23:10 +0100 Subject: [PATCH] Improve nbi status -add components to check connectivity with onap (sdc, aai, so, dmaap) -activate full status with ?fullStatus=true -change test -change mock tests folders Change-Id: Iddcd7fce3c1b3b5abfea14c46b2f611f27057319 Issue-ID: EXTAPI-209 Signed-off-by: romaingimbert --- .../java/org/onap/nbi/OnapComponentsUrlPaths.java | 8 +- .../apis/hub/service/CheckDMaaPEventsManager.java | 14 +- .../onap/nbi/apis/servicecatalog/SdcClient.java | 13 ++ .../onap/nbi/apis/serviceinventory/AaiClient.java | 219 +++++++++++---------- .../onap/nbi/apis/serviceinventory/BaseClient.java | 23 +++ .../org/onap/nbi/apis/serviceorder/SoClient.java | 12 ++ .../java/org/onap/nbi/apis/status/OnapClient.java | 81 ++++++++ .../org/onap/nbi/apis/status/StatusResource.java | 52 ++--- .../org/onap/nbi/apis/status/StatusService.java | 5 + .../onap/nbi/apis/status/StatusServiceImpl.java | 12 +- .../nbi/apis/status/model/ApplicationStatus.java | 4 +- .../onap/nbi/apis/status/model/OnapModuleType.java | 46 +++++ .../features/04--StatusRessourceTest.feature | 36 +++- .../aai_get_6490_service-subscriptions.json | 0 .../mappings/{ => aai}/aai_get_customer_6490.json | 0 .../{ => aai}/aai_get_customer_generic.json | 0 .../resources/mappings/aai/aai_get_customers.json | 34 ++++ .../aai_get_generic_service-subscriptions.json | 0 ...i_get_service-subscription-Ansible-service.json | 0 .../aai_get_service-subscription_vnf.json | 0 .../aai_get_service-subscriptionsVFW.json | 0 ...service-subscriptionsvFW-service-2VF-based.json | 0 .../mappings/{ => aai}/aai_get_service_3.json | 0 .../aai_get_service_3_format_resource_url.json | 0 .../{ => aai}/aai_get_service_instance.json | 0 .../{ => aai}/aai_get_service_instance_2.json | 0 ...get_service_instance_2_format_resource_url.json | 0 ...i_get_service_instance_format_resource_url.json | 0 .../mappings/{ => aai}/aai_get_tenants.json | 0 .../mappings/{ => aai}/aai_put_customer.json | 0 .../{ => aai}/aai_put_customer_service.json | 0 .../mappings/{ => dmaap}/dmaap_get_aaievents.json | 0 .../resources/mappings/{ => sdc}/sdc_find.json | 0 ...c_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json | 0 ...1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json | 0 ...0-8e36-46c6-862c-236d9c626439_withoutTosca.json | 0 ...84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json | 0 ...84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json | 0 .../mappings/sdc/sdc_get_artifactTypes.json | 68 +++++++ .../{ => so}/so_delete_service_instance.json | 0 .../{ => so}/so_e2e_delete_service_instance.json | 0 src/test/resources/mappings/{ => so}/so_get_.json | 0 .../resources/mappings/{ => so}/so_get_e2e.json | 0 .../mappings/{ => so}/so_get_e2e_delete.json | 0 .../resources/mappings/so/so_get_healthcheck.json | 12 ++ src/test/resources/mappings/so/so_healthcheck.xml | 23 +++ .../{ => so}/so_post_create_service_instance.json | 0 .../so_post_e2e_create_service_instance.json | 0 48 files changed, 523 insertions(+), 139 deletions(-) create mode 100644 src/main/java/org/onap/nbi/apis/status/OnapClient.java create mode 100644 src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java rename src/test/resources/mappings/{ => aai}/aai_get_6490_service-subscriptions.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_customer_6490.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_customer_generic.json (100%) create mode 100644 src/test/resources/mappings/aai/aai_get_customers.json rename src/test/resources/mappings/{ => aai}/aai_get_generic_service-subscriptions.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service-subscription-Ansible-service.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service-subscription_vnf.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service-subscriptionsVFW.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service-subscriptionsvFW-service-2VF-based.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service_3.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service_3_format_resource_url.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service_instance.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service_instance_2.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service_instance_2_format_resource_url.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_service_instance_format_resource_url.json (100%) rename src/test/resources/mappings/{ => aai}/aai_get_tenants.json (100%) rename src/test/resources/mappings/{ => aai}/aai_put_customer.json (100%) rename src/test/resources/mappings/{ => aai}/aai_put_customer_service.json (100%) rename src/test/resources/mappings/{ => dmaap}/dmaap_get_aaievents.json (100%) rename src/test/resources/mappings/{ => sdc}/sdc_find.json (100%) rename src/test/resources/mappings/{ => sdc}/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json (100%) rename src/test/resources/mappings/{ => sdc}/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json (100%) rename src/test/resources/mappings/{ => sdc}/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json (100%) rename src/test/resources/mappings/{ => sdc}/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json (100%) rename src/test/resources/mappings/{ => sdc}/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json (100%) create mode 100644 src/test/resources/mappings/sdc/sdc_get_artifactTypes.json rename src/test/resources/mappings/{ => so}/so_delete_service_instance.json (100%) rename src/test/resources/mappings/{ => so}/so_e2e_delete_service_instance.json (100%) rename src/test/resources/mappings/{ => so}/so_get_.json (100%) rename src/test/resources/mappings/{ => so}/so_get_e2e.json (100%) rename src/test/resources/mappings/{ => so}/so_get_e2e_delete.json (100%) create mode 100644 src/test/resources/mappings/so/so_get_healthcheck.json create mode 100644 src/test/resources/mappings/so/so_healthcheck.xml rename src/test/resources/mappings/{ => so}/so_post_create_service_instance.json (100%) rename src/test/resources/mappings/{ => so}/so_post_e2e_create_service_instance.json (100%) diff --git a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java index 80563d5..428788d 100644 --- a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java +++ b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java @@ -27,6 +27,8 @@ public final class OnapComponentsUrlPaths { public static final String SDC_ROOT_URL = "/sdc/v1/catalog/services"; public static final String SDC_GET_PATH = "/metadata"; public static final String SDC_TOSCA_PATH = "/toscaModel"; + public static final String SDC_HEALTH_CHECK = "/sdc/v1/artifactTypes"; + // AAI public static final String AAI_GET_TENANTS_PATH = @@ -36,6 +38,8 @@ public final class OnapComponentsUrlPaths { "/aai/v14/business/customers/customer/$customerId/service-subscriptions"; public static final String AAI_PUT_SERVICE_FOR_CUSTOMER_PATH = "/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/"; + public static final String AAI_HEALTH_CHECK = + "/aai/v14/business/customers"; public static final String AAI_GET_SERVICE = "/aai/v14/nodes/service-instances/service-instance/$serviceId"; public static final String AAI_GET_SERVICE_CUSTOMER = @@ -43,6 +47,7 @@ public final class OnapComponentsUrlPaths { public static final String AAI_GET_SERVICE_INSTANCES_PATH = "/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/"; + // MSO public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/onap/so/infra/serviceInstantiation/v7/serviceInstances/"; public static final String MSO_GET_REQUEST_STATUS_PATH = "/onap/so/infra/orchestrationRequests/v7/"; @@ -50,7 +55,8 @@ public final class OnapComponentsUrlPaths { public static final String MSO_CREATE_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3"; public static final String MSO_DELETE_E2ESERVICE_INSTANCE_PATH = "/onap/so/infra/e2eServiceInstances/v3/"; public static final String MSO_GET_E2EREQUEST_STATUS_PATH = "/onap/so/infra/e2eServiceInstances/v3/$serviceId/operations/$operationId"; - + public static final String MSO_HEALTH_CHECK = "/globalhealthcheck"; + // DMaaP Message Router REST Client public static final String DMAAP_CONSUME_EVENTS = "/events/$topic/$consumergroup/$consumerid?timeout=$timeout"; diff --git a/src/main/java/org/onap/nbi/apis/hub/service/CheckDMaaPEventsManager.java b/src/main/java/org/onap/nbi/apis/hub/service/CheckDMaaPEventsManager.java index 6e2811f..7cd2287 100644 --- a/src/main/java/org/onap/nbi/apis/hub/service/CheckDMaaPEventsManager.java +++ b/src/main/java/org/onap/nbi/apis/hub/service/CheckDMaaPEventsManager.java @@ -88,12 +88,8 @@ public class CheckDMaaPEventsManager { ObjectMapper mapper = new ObjectMapper(); - String dmaapGetEventsUrlFormated = dmaapGetEventsUrl.replace("$topic", topic); - dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumergroup", consumerGroup); - dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumerid", consumerId); - dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$timeout", timeout); - List dmaapResponse = callDMaaPGetEvents(dmaapGetEventsUrlFormated); + List dmaapResponse = callDMaaPGetEvents(); if (!CollectionUtils.isEmpty(dmaapResponse)) { for (int i = 0; i < dmaapResponse.size(); i++) { String aaiEventString = dmaapResponse.get(i); @@ -158,7 +154,13 @@ public class CheckDMaaPEventsManager { } } - public List callDMaaPGetEvents(String dmaapGetEventsUrlFormated) { + public List callDMaaPGetEvents() { + + String dmaapGetEventsUrlFormated = dmaapGetEventsUrl.replace("$topic", topic); + dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumergroup", consumerGroup); + dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$consumerid", consumerId); + dmaapGetEventsUrlFormated = dmaapGetEventsUrlFormated.replace("$timeout", timeout); + if (logger.isDebugEnabled()) { logger.debug("Calling DMaaP Url : " + dmaapGetEventsUrlFormated); diff --git a/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java b/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java index e25ab4e..419a34a 100644 --- a/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java +++ b/src/main/java/org/onap/nbi/apis/servicecatalog/SdcClient.java @@ -71,15 +71,19 @@ public class SdcClient { private String sdcGetUrl; private String sdcFindUrl; + private String sdcHealthCheck; @PostConstruct private void setUpAndLogSDCUrl() { sdcGetUrl= new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_ROOT_URL+"/{id}"+OnapComponentsUrlPaths.SDC_GET_PATH).toString(); sdcFindUrl = new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_ROOT_URL).toString(); + sdcHealthCheck = new StringBuilder().append(sdcHost).append(OnapComponentsUrlPaths.SDC_HEALTH_CHECK).toString(); + LOGGER.info("SDC GET url : "+sdcGetUrl); LOGGER.info("SDC FIND url : "+ sdcFindUrl); + LOGGER.info("SDC HealthCheck : "+ sdcHealthCheck); } @@ -111,6 +115,15 @@ public class SdcClient { } + public List callCheckConnectivity() { + + UriComponentsBuilder callURI = UriComponentsBuilder.fromHttpUrl(sdcHealthCheck); + ResponseEntity response = callSdc(callURI.build().encode().toUri()); + return (List) response.getBody(); + + } + + public File callGetWithAttachment(String toscaModelUrl) { StringBuilder urlBuilder = new StringBuilder().append(sdcHost).append(toscaModelUrl); diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java index 5424db5..0becb02 100644 --- a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java @@ -1,15 +1,14 @@ /** * Copyright (c) 2018 Orange * - * 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 + * 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. + * 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. */ package org.onap.nbi.apis.serviceinventory; @@ -24,134 +23,146 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.stereotype.Service; @Service public class AaiClient extends BaseClient { - public static final String CUSTOMER_ID = "$customerId"; + public static final String CUSTOMER_ID = "$customerId"; - @Value("${aai.host}") - private String aaiHost; + @Value("${aai.host}") + private String aaiHost; - @Value("${aai.header.authorization}") - private String aaiHeaderAuthorization; + @Value("${aai.header.authorization}") + private String aaiHeaderAuthorization; - @Value("${aai.api.id}") - private String aaiApiId; + @Value("${aai.api.id}") + private String aaiApiId; - @Value("${aai.header.transaction.id}") - private String aaiTransactionId; + @Value("${aai.header.transaction.id}") + private String aaiTransactionId; - private static final String HEADER_AUTHORIZATION = "Authorization"; - private static final String X_FROM_APP_ID = "X-FromAppId"; - private static final Logger LOGGER = LoggerFactory.getLogger(AaiClient.class); - private static final String X_TRANSACTION_ID = "X-TransactionId"; + private static final String HEADER_AUTHORIZATION = "Authorization"; + private static final String X_FROM_APP_ID = "X-FromAppId"; + private static final Logger LOGGER = LoggerFactory.getLogger(AaiClient.class); + private static final String X_TRANSACTION_ID = "X-TransactionId"; - private String aaiServiceUrl; - private String aaiServiceCustomerUrl; - private String aaiServicesUrl; - private String aaiServicesInstancesUrl; + private String aaiServiceUrl; + private String aaiServiceCustomerUrl; + private String aaiServicesUrl; + private String aaiServicesInstancesUrl; + private String aaiHealthCheckUrl; - @PostConstruct - private void setUpAndlogAAIUrl() { - aaiServiceUrl = new StringBuilder().append(aaiHost) - .append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString(); - aaiServiceCustomerUrl = new StringBuilder().append(aaiHost) - .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_CUSTOMER).toString(); - aaiServicesUrl = new StringBuilder().append(aaiHost) - .append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString(); - aaiServicesInstancesUrl = new StringBuilder().append(aaiHost) - .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString(); + @PostConstruct + private void setUpAndlogAAIUrl() { + aaiServiceUrl = new StringBuilder().append(aaiHost) + .append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString(); + aaiServiceCustomerUrl = new StringBuilder().append(aaiHost) + .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_CUSTOMER).toString(); + aaiServicesUrl = new StringBuilder().append(aaiHost) + .append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString(); + aaiServicesInstancesUrl = new StringBuilder().append(aaiHost) + .append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString(); + aaiHealthCheckUrl = new StringBuilder().append(aaiHost) + .append(OnapComponentsUrlPaths.AAI_HEALTH_CHECK).toString(); - LOGGER.info("AAI service url : " + aaiServiceUrl); - LOGGER.info("AAI services url : " + aaiServicesUrl); - LOGGER.info("AAI service instances url : " + aaiServicesInstancesUrl); + LOGGER.info("AAI service url : " + aaiServiceUrl); + LOGGER.info("AAI services url : " + aaiServicesUrl); + LOGGER.info("AAI service instances url : " + aaiServicesInstancesUrl); + LOGGER.info("AAI aaiHealthCheckUrl : " + aaiHealthCheckUrl); - } + } - private HttpHeaders buildRequestHeaderForAAI() { + private HttpHeaders buildRequestHeaderForAAI() { - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.add(HEADER_AUTHORIZATION, aaiHeaderAuthorization); - httpHeaders.add(X_FROM_APP_ID, aaiApiId); - httpHeaders.add("Accept", "application/json"); - httpHeaders.add("Content-Type", "application/json"); - httpHeaders.add(X_TRANSACTION_ID, aaiTransactionId); + HttpHeaders httpHeaders = new HttpHeaders(); + httpHeaders.add(HEADER_AUTHORIZATION, aaiHeaderAuthorization); + httpHeaders.add(X_FROM_APP_ID, aaiApiId); + httpHeaders.add("Accept", "application/json"); + httpHeaders.add("Content-Type", "application/json"); + httpHeaders.add(X_TRANSACTION_ID, aaiTransactionId); - return httpHeaders; + return httpHeaders; - } + } - public Map getCatalogService(String customerId, String serviceSpecName, String serviceId) { + public Map getCatalogService(String customerId, String serviceSpecName, String serviceId) { - String callUrlFormated = aaiServiceUrl.replace(CUSTOMER_ID, customerId); - callUrlFormated = callUrlFormated.replace("$serviceSpecName", serviceSpecName); - callUrlFormated = callUrlFormated.replace("$serviceId", serviceId); + String callUrlFormated = aaiServiceUrl.replace(CUSTOMER_ID, customerId); + callUrlFormated = callUrlFormated.replace("$serviceSpecName", serviceSpecName); + callUrlFormated = callUrlFormated.replace("$serviceId", serviceId); - ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); - if (response != null && response.getStatusCode().equals(HttpStatus.OK)) { - return (LinkedHashMap) response.getBody(); + ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); + if (response != null && response.getStatusCode().equals(HttpStatus.OK)) { + return (LinkedHashMap) response.getBody(); + } + return null; } - return null; - } - - public Map getService(String serviceId) { - // Retrieve the Service Instance using AAI node query - String callUrlFormated = aaiServiceUrl.replace("$serviceId", serviceId); - ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); - if (response != null && response.getStatusCode().equals(HttpStatus.OK)) { - return (LinkedHashMap) response.getBody(); + + public Map getService(String serviceId) { + // Retrieve the Service Instance using AAI node query + String callUrlFormated = aaiServiceUrl.replace("$serviceId", serviceId); + ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); + if (response != null && response.getStatusCode().equals(HttpStatus.OK)) { + return (LinkedHashMap) response.getBody(); + } + return null; } - return null; - } - public Map getServiceCustomer(String serviceId) { + public Map getServiceCustomer(String serviceId) { - String callUrlFormated = aaiServiceCustomerUrl.replace("$serviceId", serviceId); - ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); - if (response != null && response.getStatusCode().equals(HttpStatus.OK)) { - return (LinkedHashMap) response.getBody(); + String callUrlFormated = aaiServiceCustomerUrl.replace("$serviceId", serviceId); + try { + ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); + return (LinkedHashMap) response.getBody(); + } catch (BackendFunctionalException e) { + LOGGER.error("error on calling {} , {}", callUrlFormated.toString(), e); + return null; + } } - return null; - } - - public Map getVNF(String relatedLink) { - - StringBuilder callURL = new StringBuilder().append(aaiHost).append(relatedLink); - try { - ResponseEntity response = callApiGet(callURL.toString(), buildRequestHeaderForAAI()); - return (LinkedHashMap) response.getBody(); - } catch (BackendFunctionalException e) { - LOGGER.error("error on calling {} , {}", callURL.toString(), e); - return null; + + public void callCheckConnectivity() { + String customersUrl = new StringBuilder().append(aaiHealthCheckUrl).toString(); + ResponseEntity response = callApiGetHealthCheck(customersUrl, buildRequestHeaderForAAI()); } - } - - public Map getServicesInAaiForCustomer(String customerId) { - String callUrlFormated = aaiServicesUrl.replace(CUSTOMER_ID, customerId); - try { - ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); - return (LinkedHashMap) response.getBody(); - } catch (BackendFunctionalException e) { - LOGGER.error("error on calling {} , {}", callUrlFormated, e); - return null; + + public Map getVNF(String relatedLink) { + + StringBuilder callURL = new StringBuilder().append(aaiHost).append(relatedLink); + try { + ResponseEntity response = callApiGet(callURL.toString(), buildRequestHeaderForAAI()); + return (LinkedHashMap) response.getBody(); + } catch (BackendFunctionalException e) { + LOGGER.error("error on calling {} , {}", callURL.toString(), e); + return null; + } + } + + public Map getServicesInAaiForCustomer(String customerId) { + String callUrlFormated = aaiServicesUrl.replace(CUSTOMER_ID, customerId); + try { + ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); + return (LinkedHashMap) response.getBody(); + } catch (BackendFunctionalException e) { + LOGGER.error("error on calling {} , {}", callUrlFormated, e); + return null; + } } - } - - public Map getServiceInstancesInAaiForCustomer(String customerId, String serviceType) { - String callUrlFormated = aaiServicesInstancesUrl.replace(CUSTOMER_ID, customerId); - callUrlFormated = callUrlFormated.replace("$serviceSpecName", serviceType); - - try { - ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); - return (LinkedHashMap) response.getBody(); - } catch (BackendFunctionalException e) { - LOGGER.error("error on calling {} , {}", callUrlFormated, e); - return null; + + public Map getServiceInstancesInAaiForCustomer(String customerId, String serviceType) { + String callUrlFormated = aaiServicesInstancesUrl.replace(CUSTOMER_ID, customerId); + callUrlFormated = callUrlFormated.replace("$serviceSpecName", serviceType); + + try { + ResponseEntity response = callApiGet(callUrlFormated, buildRequestHeaderForAAI()); + return (LinkedHashMap) response.getBody(); + } catch (BackendFunctionalException e) { + LOGGER.error("error on calling {} , {}", callUrlFormated, e); + return null; + } } - } } diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java index 72ee99e..adae4ec 100644 --- a/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceinventory/BaseClient.java @@ -23,6 +23,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.web.client.RestTemplate; public abstract class BaseClient { @@ -56,4 +57,26 @@ public abstract class BaseClient { return response; } + + protected ResponseEntity callApiGetHealthCheck(String callURL, HttpHeaders httpHeaders) { + + + if(LOGGER.isDebugEnabled()){ + LOGGER.debug("log request : "+callURL+ " "+httpHeaders); + } + + ResponseEntity response = null; + response = restTemplate.exchange(callURL, HttpMethod.GET, + new HttpEntity<>("parameters", httpHeaders), String.class); + + if(LOGGER.isDebugEnabled()){ + LOGGER.debug("response body : {}",response.getBody().toString()); + } + LOGGER.info("response status : {}", response.getStatusCodeValue()); + if (LOGGER.isWarnEnabled() && !response.getStatusCode().equals(HttpStatus.OK)) { + LOGGER.warn("HTTP call on {} returns {}, {}", callURL , response.getStatusCodeValue() ,response.getBody().toString()); + } + return response; + } + } diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java index 0d863d1..deb1443 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/SoClient.java @@ -66,6 +66,7 @@ public class SoClient { private String getE2ESoStatus; private String deleteE2ESoUrl; private String deleteSoUrl; + private String SoHealthCheck; @PostConstruct @@ -82,6 +83,8 @@ public class SoClient { .toString(); getE2ESoStatus = new StringBuilder().append(soHostname) .append(OnapComponentsUrlPaths.MSO_GET_E2EREQUEST_STATUS_PATH).toString(); + SoHealthCheck = new StringBuilder().append(soHostname) + .append(OnapComponentsUrlPaths.MSO_HEALTH_CHECK).toString(); LOGGER.info("SO create service url : " + createSoUrl); LOGGER.info("SO create e2e service url : " + createE2ESoUrl); @@ -89,6 +92,7 @@ public class SoClient { LOGGER.info("SO delete e2e service url : " + deleteE2ESoUrl); LOGGER.info("SO get so status url : " + getSoStatus); LOGGER.info("SO get e2e so status url : " + getE2ESoStatus); + LOGGER.info("SO healthCheck : " + SoHealthCheck); } @@ -250,6 +254,14 @@ public class SoClient { } } + + public void callCheckConnectivity() { + String url = SoHealthCheck; + restTemplate.exchange(url, HttpMethod.GET, + new HttpEntity<>(buildRequestHeader()), String.class); + + } + public GetE2ERequestStatusResponse callE2EGetRequestStatus(String operationId, String serviceId) { String callUrlFormated = getE2ESoStatus.replace("$serviceId", serviceId); diff --git a/src/main/java/org/onap/nbi/apis/status/OnapClient.java b/src/main/java/org/onap/nbi/apis/status/OnapClient.java new file mode 100644 index 0000000..d9bedc0 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/status/OnapClient.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2018 Orange + * + * 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. + */ +package org.onap.nbi.apis.status; + +import java.text.MessageFormat; +import org.onap.nbi.apis.hub.service.CheckDMaaPEventsManager; +import org.onap.nbi.apis.servicecatalog.SdcClient; +import org.onap.nbi.apis.serviceinventory.AaiClient; +import org.onap.nbi.apis.serviceorder.SoClient; +import org.onap.nbi.apis.status.model.ApplicationStatus; +import org.onap.nbi.apis.status.model.OnapModuleType; +import org.onap.nbi.apis.status.model.StatusType; +import org.onap.nbi.exceptions.BackendFunctionalException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.web.client.ResourceAccessException; + +@Service +public class OnapClient { + + @Autowired + private SdcClient sdcClient; + + @Autowired + private AaiClient aaiClient; + + @Autowired + private SoClient soClient; + + @Autowired + private CheckDMaaPEventsManager checkDMaaPEventsManager; + + private static final Logger LOGGER = LoggerFactory.getLogger(OnapClient.class); + + + public ApplicationStatus checkConnectivity(OnapModuleType onapModuleType) { + try { + + switch (onapModuleType) { + case SDC: + sdcClient.callCheckConnectivity(); + break; + case AAI: + aaiClient.callCheckConnectivity(); + break; + case SO: + soClient.callCheckConnectivity(); + break; + case DMAAP: + checkDMaaPEventsManager.callDMaaPGetEvents(); + break; + } + } catch (BackendFunctionalException e) { + String message = MessageFormat + .format("backend exception for {0}, status code {1}, body response {2}", onapModuleType, + e.getHttpStatus(), e.getBodyResponse()); + LOGGER.error(message); + return new ApplicationStatus(onapModuleType.getValue() + " connectivity", StatusType.KO, null); + } catch (ResourceAccessException e) { + String message = MessageFormat + .format("resource access exception for {0}, response {1}", onapModuleType, e.getMessage()); + LOGGER.error(message); + return new ApplicationStatus(onapModuleType.getValue() + " connectivity", StatusType.KO, null); + } + return new ApplicationStatus(onapModuleType.getValue() + " connectivity", StatusType.OK, null); + } + + +} \ No newline at end of file diff --git a/src/main/java/org/onap/nbi/apis/status/StatusResource.java b/src/main/java/org/onap/nbi/apis/status/StatusResource.java index 4fead09..e1510cc 100644 --- a/src/main/java/org/onap/nbi/apis/status/StatusResource.java +++ b/src/main/java/org/onap/nbi/apis/status/StatusResource.java @@ -1,21 +1,19 @@ /** - * Copyright (c) 2018 Orange + * Copyright (c) 2018 Orange * - * 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 + * 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 + * 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. + * 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. */ package org.onap.nbi.apis.status; import org.onap.nbi.apis.status.model.ApplicationStatus; +import org.onap.nbi.apis.status.model.OnapModuleType; import org.onap.nbi.apis.status.model.StatusType; import org.onap.nbi.commons.JsonRepresentation; import org.onap.nbi.commons.ResourceManagement; @@ -24,8 +22,10 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; @@ -44,30 +44,36 @@ public class StatusResource extends ResourceManagement { .add("components.name").add("components.status"); @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity status(HttpServletRequest request) { + public ResponseEntity status(HttpServletRequest request, @RequestParam MultiValueMap params) { ResponseEntity responseEntity = null; - final String[] splitPath = request.getRequestURI().split("/"); final String applicationName = splitPath[1]; - - final ApplicationStatus applicationStatus = this.statusService.get(applicationName, version); - - final boolean isServiceFullyFunctional = - StatusType.OK.equals(applicationStatus.getStatus()) ? applicationStatus.getComponents().stream() - .allMatch(componentStatus -> StatusType.OK.equals(componentStatus.getStatus())) : false; + boolean fullStatus = Boolean.valueOf(params.getFirst("fullStatus")); + final ApplicationStatus applicationStatus = buildNbiStatus(applicationName,fullStatus); // filter object Object response = this.getEntity(applicationStatus, fullRepresentation); - if (isServiceFullyFunctional) { - responseEntity = ResponseEntity.ok(response); - } else { - responseEntity = ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE).body(response); - } + responseEntity = ResponseEntity.ok(response); return responseEntity; } + private ApplicationStatus buildNbiStatus(String applicationName, boolean fullStatus) { + final ApplicationStatus applicationStatus = this.statusService.get(applicationName, version); + + if(fullStatus) { + final ApplicationStatus sdcConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.SDC); + final ApplicationStatus aaiConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.AAI); + final ApplicationStatus soConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.SO); + final ApplicationStatus dmaapConnectivityStatus = this.statusService.getOnapConnectivity(OnapModuleType.DMAAP); + applicationStatus.addComponent(sdcConnectivityStatus).addComponent(aaiConnectivityStatus) + .addComponent(soConnectivityStatus).addComponent(dmaapConnectivityStatus); + } + + return applicationStatus; + } + } diff --git a/src/main/java/org/onap/nbi/apis/status/StatusService.java b/src/main/java/org/onap/nbi/apis/status/StatusService.java index 8f285bf..35eba3a 100644 --- a/src/main/java/org/onap/nbi/apis/status/StatusService.java +++ b/src/main/java/org/onap/nbi/apis/status/StatusService.java @@ -16,9 +16,14 @@ package org.onap.nbi.apis.status; import org.onap.nbi.apis.status.model.ApplicationStatus; +import org.onap.nbi.apis.status.model.OnapModuleType; public interface StatusService { ApplicationStatus get(String serviceName, String serviceVersion); + + ApplicationStatus getOnapConnectivity(OnapModuleType onapModuleType); + + } diff --git a/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java b/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java index a55e113..1ee9fc6 100644 --- a/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java +++ b/src/main/java/org/onap/nbi/apis/status/StatusServiceImpl.java @@ -16,12 +16,18 @@ package org.onap.nbi.apis.status; import org.onap.nbi.apis.status.model.ApplicationStatus; +import org.onap.nbi.apis.status.model.OnapModuleType; import org.onap.nbi.apis.status.model.StatusType; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service("statusService") public class StatusServiceImpl implements StatusService { + @Autowired + private OnapClient onapClient; + + @Override public ApplicationStatus get(final String serviceName, final String serviceVersion) { @@ -29,9 +35,11 @@ public class StatusServiceImpl implements StatusService { } + @Override + public ApplicationStatus getOnapConnectivity(OnapModuleType onapModuleType) { - public boolean serviceIsUp() { - return true; + return onapClient.checkConnectivity(onapModuleType); } + } diff --git a/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java b/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java index 3e1a60f..6d8e0c1 100644 --- a/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java +++ b/src/main/java/org/onap/nbi/apis/status/model/ApplicationStatus.java @@ -33,7 +33,7 @@ public class ApplicationStatus implements Resource { * Builds a new {@code ApplicationStatus} with the following attributes : * * @param name name of the service - * @param state state of the service ({@code OK} | {@code KO}) + * @param status status of the service ({@code OK} | {@code KO}) * @param version version of the service ({@code x.y.z}) */ public ApplicationStatus(final String name, final StatusType status, final String version) { @@ -58,7 +58,7 @@ public class ApplicationStatus implements Resource { return this.components; } - public ApplicationStatus component(final ApplicationStatus componentStatus) { + public ApplicationStatus addComponent(final ApplicationStatus componentStatus) { this.components.add(componentStatus); return this; } diff --git a/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java b/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java new file mode 100644 index 0000000..2013147 --- /dev/null +++ b/src/main/java/org/onap/nbi/apis/status/model/OnapModuleType.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2018 Orange + * + * 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. + */ +package org.onap.nbi.apis.status.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum OnapModuleType { + + SDC("sdc"), AAI("aai"),SO("so"), DMAAP("dmaap"); + + private final String value; + + OnapModuleType(String v) { + this.value = v; + } + + @JsonValue + public String getValue() { + return this.value; + } + + @JsonCreator + public static OnapModuleType fromValue(String v) { + for (OnapModuleType c : OnapModuleType.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/src/test/resources/karatetest/features/04--StatusRessourceTest.feature b/src/test/resources/karatetest/features/04--StatusRessourceTest.feature index f616e90..5db5c78 100644 --- a/src/test/resources/karatetest/features/04--StatusRessourceTest.feature +++ b/src/test/resources/karatetest/features/04--StatusRessourceTest.feature @@ -9,9 +9,43 @@ Background: * call Context.startServers(); Scenario: testHealthCheck +Given path 'status' +When method get +Then status 200 +And match response.status == 'ok' +And match response.name == 'nbi' +Scenario: testFullHealthCheck Given path 'status' +And params {fullStatus :true} When method get Then status 200 And match response.status == 'ok' -And match response.name == 'nbi' \ No newline at end of file +And match response.name == 'nbi' +And assert response.components.length == 4 +And match each $.components contains {status :'ok'} + + +Scenario: testFullHealthChecWithoutWiremock +* call Context.stopWiremock(); +Given path 'status' +And params {fullStatus :true} +When method get +Then status 200 +And match response.status == 'ok' +And match response.name == 'nbi' +And assert response.components.length == 4 +And match each response.components contains { status: 'ko'} +* call Context.startServers(); + +Scenario: testFullHealthCheckWithSDCNotResponding +* call Context.removeWireMockMapping("/sdc/v1/artifactTypes"); +Given path 'status' +And params {fullStatus :true} +When method get +Then status 200 +And match response.status == 'ok' +And match response.name == 'nbi' +And assert response.components.length == 4 +And match response.components contains [{name:'sdc connectivity', status: 'ko'},{name:'so connectivity', status: 'ok'},{name:'aai connectivity', status: 'ok'},{name:'dmaap connectivity', status: 'ok'},] +* call Context.startServers(); diff --git a/src/test/resources/mappings/aai_get_6490_service-subscriptions.json b/src/test/resources/mappings/aai/aai_get_6490_service-subscriptions.json similarity index 100% rename from src/test/resources/mappings/aai_get_6490_service-subscriptions.json rename to src/test/resources/mappings/aai/aai_get_6490_service-subscriptions.json diff --git a/src/test/resources/mappings/aai_get_customer_6490.json b/src/test/resources/mappings/aai/aai_get_customer_6490.json similarity index 100% rename from src/test/resources/mappings/aai_get_customer_6490.json rename to src/test/resources/mappings/aai/aai_get_customer_6490.json diff --git a/src/test/resources/mappings/aai_get_customer_generic.json b/src/test/resources/mappings/aai/aai_get_customer_generic.json similarity index 100% rename from src/test/resources/mappings/aai_get_customer_generic.json rename to src/test/resources/mappings/aai/aai_get_customer_generic.json diff --git a/src/test/resources/mappings/aai/aai_get_customers.json b/src/test/resources/mappings/aai/aai_get_customers.json new file mode 100644 index 0000000..4146b6a --- /dev/null +++ b/src/test/resources/mappings/aai/aai_get_customers.json @@ -0,0 +1,34 @@ +{ + "request": { + "method": "GET", + "url": "/aai/v14/business/customers" + }, + "response": { + "status": 200, + "jsonBody": { + "customer": [ + { + "global-customer-id": "generic", + "subscriber-name": "generic", + "subscriber-type": "INFRA", + "resource-version": "1550238542827" + }, + { + "global-customer-id": "Generic-Vendor", + "subscriber-name": "Generic-Vendor", + "subscriber-type": "INFRA", + "resource-version": "1550569650318" + }, + { + "global-customer-id": "customerRG", + "subscriber-name": "customerRG", + "subscriber-type": "INFRA", + "resource-version": "1551445667218" + } + ] + }, + "headers": { + "Content-Type": "application/xml" + } + } +} diff --git a/src/test/resources/mappings/aai_get_generic_service-subscriptions.json b/src/test/resources/mappings/aai/aai_get_generic_service-subscriptions.json similarity index 100% rename from src/test/resources/mappings/aai_get_generic_service-subscriptions.json rename to src/test/resources/mappings/aai/aai_get_generic_service-subscriptions.json diff --git a/src/test/resources/mappings/aai_get_service-subscription-Ansible-service.json b/src/test/resources/mappings/aai/aai_get_service-subscription-Ansible-service.json similarity index 100% rename from src/test/resources/mappings/aai_get_service-subscription-Ansible-service.json rename to src/test/resources/mappings/aai/aai_get_service-subscription-Ansible-service.json diff --git a/src/test/resources/mappings/aai_get_service-subscription_vnf.json b/src/test/resources/mappings/aai/aai_get_service-subscription_vnf.json similarity index 100% rename from src/test/resources/mappings/aai_get_service-subscription_vnf.json rename to src/test/resources/mappings/aai/aai_get_service-subscription_vnf.json diff --git a/src/test/resources/mappings/aai_get_service-subscriptionsVFW.json b/src/test/resources/mappings/aai/aai_get_service-subscriptionsVFW.json similarity index 100% rename from src/test/resources/mappings/aai_get_service-subscriptionsVFW.json rename to src/test/resources/mappings/aai/aai_get_service-subscriptionsVFW.json diff --git a/src/test/resources/mappings/aai_get_service-subscriptionsvFW-service-2VF-based.json b/src/test/resources/mappings/aai/aai_get_service-subscriptionsvFW-service-2VF-based.json similarity index 100% rename from src/test/resources/mappings/aai_get_service-subscriptionsvFW-service-2VF-based.json rename to src/test/resources/mappings/aai/aai_get_service-subscriptionsvFW-service-2VF-based.json diff --git a/src/test/resources/mappings/aai_get_service_3.json b/src/test/resources/mappings/aai/aai_get_service_3.json similarity index 100% rename from src/test/resources/mappings/aai_get_service_3.json rename to src/test/resources/mappings/aai/aai_get_service_3.json diff --git a/src/test/resources/mappings/aai_get_service_3_format_resource_url.json b/src/test/resources/mappings/aai/aai_get_service_3_format_resource_url.json similarity index 100% rename from src/test/resources/mappings/aai_get_service_3_format_resource_url.json rename to src/test/resources/mappings/aai/aai_get_service_3_format_resource_url.json diff --git a/src/test/resources/mappings/aai_get_service_instance.json b/src/test/resources/mappings/aai/aai_get_service_instance.json similarity index 100% rename from src/test/resources/mappings/aai_get_service_instance.json rename to src/test/resources/mappings/aai/aai_get_service_instance.json diff --git a/src/test/resources/mappings/aai_get_service_instance_2.json b/src/test/resources/mappings/aai/aai_get_service_instance_2.json similarity index 100% rename from src/test/resources/mappings/aai_get_service_instance_2.json rename to src/test/resources/mappings/aai/aai_get_service_instance_2.json diff --git a/src/test/resources/mappings/aai_get_service_instance_2_format_resource_url.json b/src/test/resources/mappings/aai/aai_get_service_instance_2_format_resource_url.json similarity index 100% rename from src/test/resources/mappings/aai_get_service_instance_2_format_resource_url.json rename to src/test/resources/mappings/aai/aai_get_service_instance_2_format_resource_url.json diff --git a/src/test/resources/mappings/aai_get_service_instance_format_resource_url.json b/src/test/resources/mappings/aai/aai_get_service_instance_format_resource_url.json similarity index 100% rename from src/test/resources/mappings/aai_get_service_instance_format_resource_url.json rename to src/test/resources/mappings/aai/aai_get_service_instance_format_resource_url.json diff --git a/src/test/resources/mappings/aai_get_tenants.json b/src/test/resources/mappings/aai/aai_get_tenants.json similarity index 100% rename from src/test/resources/mappings/aai_get_tenants.json rename to src/test/resources/mappings/aai/aai_get_tenants.json diff --git a/src/test/resources/mappings/aai_put_customer.json b/src/test/resources/mappings/aai/aai_put_customer.json similarity index 100% rename from src/test/resources/mappings/aai_put_customer.json rename to src/test/resources/mappings/aai/aai_put_customer.json diff --git a/src/test/resources/mappings/aai_put_customer_service.json b/src/test/resources/mappings/aai/aai_put_customer_service.json similarity index 100% rename from src/test/resources/mappings/aai_put_customer_service.json rename to src/test/resources/mappings/aai/aai_put_customer_service.json diff --git a/src/test/resources/mappings/dmaap_get_aaievents.json b/src/test/resources/mappings/dmaap/dmaap_get_aaievents.json similarity index 100% rename from src/test/resources/mappings/dmaap_get_aaievents.json rename to src/test/resources/mappings/dmaap/dmaap_get_aaievents.json diff --git a/src/test/resources/mappings/sdc_find.json b/src/test/resources/mappings/sdc/sdc_find.json similarity index 100% rename from src/test/resources/mappings/sdc_find.json rename to src/test/resources/mappings/sdc/sdc_find.json diff --git a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json b/src/test/resources/mappings/sdc/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json similarity index 100% rename from src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json rename to src/test/resources/mappings/sdc/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439.json diff --git a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json b/src/test/resources/mappings/sdc/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json similarity index 100% rename from src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json rename to src/test/resources/mappings/sdc/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_tosca.json diff --git a/src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json b/src/test/resources/mappings/sdc/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json similarity index 100% rename from src/test/resources/mappings/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json rename to src/test/resources/mappings/sdc/sdc_get_1e3feeb0-8e36-46c6-862c-236d9c626439_withoutTosca.json diff --git a/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json b/src/test/resources/mappings/sdc/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json similarity index 100% rename from src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json rename to src/test/resources/mappings/sdc/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_toscafile.json diff --git a/src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json b/src/test/resources/mappings/sdc/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json similarity index 100% rename from src/test/resources/mappings/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json rename to src/test/resources/mappings/sdc/sdc_get_462f84e5-f0e5-44c5-ab95-38fb4bf77064_withTosca.json diff --git a/src/test/resources/mappings/sdc/sdc_get_artifactTypes.json b/src/test/resources/mappings/sdc/sdc_get_artifactTypes.json new file mode 100644 index 0000000..2c7f635 --- /dev/null +++ b/src/test/resources/mappings/sdc/sdc_get_artifactTypes.json @@ -0,0 +1,68 @@ +{ + "request": { + "method": "GET", + "url": "/sdc/v1/artifactTypes" + }, + "response": { + "status": 200, + "jsonBody": +[ + "CHEF", + "PUPPET", + "YANG", + "SHELL_SCRIPT", + "SHELL", + "ICON", + "UNKNOWN", + "HEAT", + "DG_XML", + "MURANO_PKG", + "HEAT_ENV", + "YANG_XML", + "HEAT_VOL", + "HEAT_NET", + "OTHER", + "WORKFLOW", + "NETWORK_CALL_FLOW", + "TOSCA_TEMPLATE", + "TOSCA_CSAR", + "VNF_CATALOG", + "VF_LICENSE", + "BPEL", + "VENDOR_LICENSE", + "MODEL_INVENTORY_PROFILE", + "MODEL_QUERY_SPEC", + "APPC_CONFIG", + "HEAT_NESTED", + "HEAT_ARTIFACT", + "VF_MODULES_METADATA", + "LIFECYCLE_OPERATIONS", + "VES_EVENTS", + "PERFORMANCE_COUNTER", + "UCPE_LAYER_2_CONFIGURATION", + "DCAE_TOSCA", + "DCAE_JSON", + "DCAE_POLICY", + "DCAE_DOC", + "DCAE_EVENT", + "DCAE_INVENTORY_TOSCA", + "DCAE_INVENTORY_JSON", + "DCAE_INVENTORY_POLICY", + "DCAE_INVENTORY_DOC", + "DCAE_INVENTORY_BLUEPRINT", + "DCAE_INVENTORY_EVENT", + "AAI_SERVICE_MODEL", + "AAI_VF_MODEL", + "AAI_VF_MODULE_MODEL", + "AAI_VF_INSTANCE_MODEL", + "SNMP_POLL", + "SNMP_TRAP", + "GUIDE", + "PLAN" +] + , + "headers": { + "Content-Type": "application/json" + } + } +} \ No newline at end of file diff --git a/src/test/resources/mappings/so_delete_service_instance.json b/src/test/resources/mappings/so/so_delete_service_instance.json similarity index 100% rename from src/test/resources/mappings/so_delete_service_instance.json rename to src/test/resources/mappings/so/so_delete_service_instance.json diff --git a/src/test/resources/mappings/so_e2e_delete_service_instance.json b/src/test/resources/mappings/so/so_e2e_delete_service_instance.json similarity index 100% rename from src/test/resources/mappings/so_e2e_delete_service_instance.json rename to src/test/resources/mappings/so/so_e2e_delete_service_instance.json diff --git a/src/test/resources/mappings/so_get_.json b/src/test/resources/mappings/so/so_get_.json similarity index 100% rename from src/test/resources/mappings/so_get_.json rename to src/test/resources/mappings/so/so_get_.json diff --git a/src/test/resources/mappings/so_get_e2e.json b/src/test/resources/mappings/so/so_get_e2e.json similarity index 100% rename from src/test/resources/mappings/so_get_e2e.json rename to src/test/resources/mappings/so/so_get_e2e.json diff --git a/src/test/resources/mappings/so_get_e2e_delete.json b/src/test/resources/mappings/so/so_get_e2e_delete.json similarity index 100% rename from src/test/resources/mappings/so_get_e2e_delete.json rename to src/test/resources/mappings/so/so_get_e2e_delete.json diff --git a/src/test/resources/mappings/so/so_get_healthcheck.json b/src/test/resources/mappings/so/so_get_healthcheck.json new file mode 100644 index 0000000..8f2171d --- /dev/null +++ b/src/test/resources/mappings/so/so_get_healthcheck.json @@ -0,0 +1,12 @@ +{ + "request": { + "method": "GET", + "url": "/globalhealthcheck" + }, + "response": { + "status": 200, + "jsonBody": { + "bodyFileName": "so_healthcheck.xml" + } + } +} diff --git a/src/test/resources/mappings/so/so_healthcheck.xml b/src/test/resources/mappings/so/so_healthcheck.xml new file mode 100644 index 0000000..d023c9f --- /dev/null +++ b/src/test/resources/mappings/so/so_healthcheck.xml @@ -0,0 +1,23 @@ + + + + + + Health Check + + Application ready + \ No newline at end of file diff --git a/src/test/resources/mappings/so_post_create_service_instance.json b/src/test/resources/mappings/so/so_post_create_service_instance.json similarity index 100% rename from src/test/resources/mappings/so_post_create_service_instance.json rename to src/test/resources/mappings/so/so_post_create_service_instance.json diff --git a/src/test/resources/mappings/so_post_e2e_create_service_instance.json b/src/test/resources/mappings/so/so_post_e2e_create_service_instance.json similarity index 100% rename from src/test/resources/mappings/so_post_e2e_create_service_instance.json rename to src/test/resources/mappings/so/so_post_e2e_create_service_instance.json -- 2.16.6