diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2017-10-18 15:48:57 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2017-10-18 15:49:05 +0800 |
commit | b65ec75e2e0c9d03828168761842c099e40c722a (patch) | |
tree | 89bbc8f80444951c24e6254cc1fba34dc14f3b63 | |
parent | 22c01f5a42e159190043ea39a16870b9ff6de1a2 (diff) |
Fix rest url missing /api.
Change-Id: I1d5eca9cb56bfeee9ee07e2cd87c8e140e6590ea
Issue-Id: USECASEUI-36
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
11 files changed, 152 insertions, 26 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java index 09162025..df1e076f 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIService.java @@ -32,7 +32,7 @@ public interface AAIService { "Accept: application/json" }) // @GET("/api/aai-business/v11/customers") - @GET("/aai-business/v11/customers") + @GET("/api/aai-business/v11/customers") Call<AAICustomerRsp> listCustomer(); @Headers({ @@ -42,7 +42,7 @@ public interface AAIService { "Accept: application/json" }) // @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") - @GET("/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") Call<ServiceInstanceRsp> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType); @Headers({ @@ -52,7 +52,7 @@ public interface AAIService { "Accept: application/json" }) // @GET("/cloud-infrastructure/cloud-regions") - @GET("/aai-cloudInfrastructure/v11/cloud-regions") + @GET("/api/aai-cloudInfrastructure/v11/cloud-regions") Call<VimInfoRsp> listVimInfo(); @Headers({ @@ -62,6 +62,6 @@ public interface AAIService { "Accept: application/json" }) // @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") - @GET("/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") + @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") Call<ServiceSubscriptionRsp> listServiceSubscriptions(@Path("global-customer-id") String customerId); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java index 199e324f..ae82131f 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/sdc/SDCCatalogService.java @@ -29,14 +29,14 @@ public interface SDCCatalogService { "X-ECOMP-InstanceID: 777", "Authorization: Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=" }) - @GET("/sdc/v1/catalog/services") + @GET("/api/sdc/v1/catalog/services") Call<List<SDCServiceTemplate>> listServices(@Query("category")String category, @Query("distributionStatus") String distributionStatus); @Headers({ "X-ECOMP-InstanceID: 777", "Authorization: Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=" }) - @GET("/sdc/v1/catalog/services/{uuid}/metadata") + @GET("/api/sdc/v1/catalog/services/{uuid}/metadata") Call<SDCServiceTemplate> getService(@Path("uuid") String uuid); @Headers({ @@ -50,6 +50,6 @@ public interface SDCCatalogService { "X-ECOMP-InstanceID: 777", "Authorization: Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=" }) - @GET("/sdc/v1/catalog/resources") + @GET("/api/sdc/v1/catalog/resources") Call<List<Vnf>> listResources(@Query("resourceType") String resourceType, @Query("distributionStatus") String distributionStatus); }
\ No newline at end of file diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java index f4dd388e..917ec3f3 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java @@ -23,12 +23,12 @@ import retrofit2.http.*; public interface SOService { - @POST("/so-e2eServiceInstances/v2") + @POST("/api/so-e2eServiceInstances/v2") Call<ServiceOperation> instantiateService(@Body RequestBody body); - @GET("/so-e2eServiceInstances/v2/{serviceId}/operations/{operationId}") + @GET("/api/so-e2eServiceInstances/v2/{serviceId}/operations/{operationId}") Call<OperationProgressInformation> queryOperationProgress(@Path("serviceId") String serviceId, @Path("operationId") String operationId); - @DELETE("/so-e2eServiceInstances/v2/{serviceId}") + @DELETE("/api/so-e2eServiceInstances/v2/{serviceId}") Call<ServiceOperation> terminateService(@Path("serviceId") String serviceId); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java index 409fd0e4..4eaff5af 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/exceptions/SOException.java @@ -17,6 +17,10 @@ package org.onap.usecaseui.server.service.lcm.domain.so.exceptions; public class SOException extends RuntimeException { + public SOException(String message) { + super(message); + } + public SOException(String message, Throwable cause) { super(message, cause); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/exceptions/VfcException.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/exceptions/VfcException.java index 3b499427..7d3da063 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/exceptions/VfcException.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/exceptions/VfcException.java @@ -17,6 +17,10 @@ package org.onap.usecaseui.server.service.lcm.domain.vfc.exceptions; public class VfcException extends RuntimeException { + public VfcException(String message) { + super(message); + } + public VfcException(String message, Throwable cause) { super(message, cause); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java index fbd9db87..972dbedc 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerService.java @@ -18,15 +18,19 @@ package org.onap.usecaseui.server.service.lcm.impl; import org.onap.usecaseui.server.service.lcm.CustomerService; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomerRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceSubscriptionRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; import org.onap.usecaseui.server.util.RestfulServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import retrofit2.Response; import java.io.IOException; +import java.util.Collections; import java.util.List; @Service("CustomerService") @@ -49,7 +53,13 @@ public class DefaultCustomerService implements CustomerService { @Override public List<AAICustomer> listCustomer() { try { - return this.aaiService.listCustomer().execute().body().getCustomer(); + Response<AAICustomerRsp> response = this.aaiService.listCustomer().execute(); + if (response.isSuccessful()) { + return response.body().getCustomer(); + } else { + logger.info(String.format("Can not get customers[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } } catch (IOException e) { logger.error("list customers occur exception"); throw new AAIException("AAI is not available.", e); @@ -59,7 +69,13 @@ public class DefaultCustomerService implements CustomerService { @Override public List<AAIServiceSubscription> listServiceSubscriptions(String customerId) { try { - return this.aaiService.listServiceSubscriptions(customerId).execute().body().getServiceSubscriptions(); + Response<ServiceSubscriptionRsp> response = this.aaiService.listServiceSubscriptions(customerId).execute(); + if (response.isSuccessful()) { + return response.body().getServiceSubscriptions(); + } else { + logger.info(String.format("Can not get service-subscriptions[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } } catch (IOException e) { logger.error("list customers occur exception"); throw new AAIException("AAI is not available.", e); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java index 9650cf69..f2231544 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java @@ -27,10 +27,14 @@ import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job; import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.JobStatus; import org.onap.usecaseui.server.service.lcm.domain.vfc.exceptions.VfcException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import retrofit2.Response; import java.io.IOException; +import java.util.Collections; import java.util.List; import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.*; @@ -41,6 +45,8 @@ import static org.onap.usecaseui.server.util.RestfulServices.create; @EnableAspectJAutoProxy public class DefaultPackageDistributionService implements PackageDistributionService { + private static final Logger logger = LoggerFactory.getLogger(DefaultPackageDistributionService.class); + private SDCCatalogService sdcCatalogService; private VfcService vfcService; @@ -57,18 +63,44 @@ public class DefaultPackageDistributionService implements PackageDistributionSer @Override public VfNsPackageInfo retrievePackageInfo() { try { - List<SDCServiceTemplate> nsTemplate = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); - List<Vnf> vnf = sdcCatalogService.listResources(RESOURCETYPE_VF, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); + List<SDCServiceTemplate> nsTemplate = getNsTemplate(); + List<Vnf> vnf = getVFResource(); return new VfNsPackageInfo(nsTemplate, vnf); } catch (IOException e) { throw new SDCCatalogException("SDC Service is not available!", e); } } + private List<Vnf> getVFResource() throws IOException { + Response<List<Vnf>> response = sdcCatalogService.listResources(RESOURCETYPE_VF, DISTRIBUTION_STATUS_DISTRIBUTED).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not get VF resources[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } + } + + private List<SDCServiceTemplate> getNsTemplate() throws IOException { + Response<List<SDCServiceTemplate>> response = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not get NS services[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } + } + @Override public DistributionResult postNsPackage(Csar csar) { try { - return vfcService.distributeNsPackage(csar).execute().body(); + Response<DistributionResult> response = vfcService.distributeNsPackage(csar).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not post NS packages[code=%s, message=%s]", response.code(), response.message())); + throw new VfcException("VFC service is not available!"); + } } catch (IOException e) { throw new VfcException("VFC service is not available!", e); } @@ -77,7 +109,13 @@ public class DefaultPackageDistributionService implements PackageDistributionSer @Override public Job postVfPackage(Csar csar) { try { - return vfcService.distributeVnfPackage(csar).execute().body(); + Response<Job> response = vfcService.distributeVnfPackage(csar).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not get VF packages[code=%s, message=%s]", response.code(), response.message())); + throw new VfcException("VFC service is not available!"); + } } catch (IOException e) { throw new VfcException("VFC service is not available!", e); } @@ -86,7 +124,13 @@ public class DefaultPackageDistributionService implements PackageDistributionSer @Override public JobStatus getJobStatus(String jobId) { try { - return vfcService.getJobStatus(jobId).execute().body(); + Response<JobStatus> response = vfcService.getJobStatus(jobId).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not get Job status[code=%s, message=%s]", response.code(), response.message())); + throw new VfcException("VFC service is not available!"); + } } catch (IOException e) { throw new VfcException("VFC service is not available!", e); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java index 586135fa..ff430a5c 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java @@ -18,14 +18,17 @@ package org.onap.usecaseui.server.service.lcm.impl; import org.onap.usecaseui.server.service.lcm.ServiceInstanceService; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstance; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.ServiceInstanceRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; import org.onap.usecaseui.server.util.RestfulServices; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import retrofit2.Response; import java.io.IOException; +import java.util.Collections; import java.util.List; @Service("ServiceInstanceService") @@ -48,7 +51,13 @@ public class DefaultServiceInstanceService implements ServiceInstanceService { @Override public List<ServiceInstance> listServiceInstances(String customerId, String serviceType) { try { - return aaiService.listServiceInstances(customerId, serviceType).execute().body().getServiceInstances(); + Response<ServiceInstanceRsp> response = aaiService.listServiceInstances(customerId, serviceType).execute(); + if (response.isSuccessful()) { + return response.body().getServiceInstances(); + } else { + logger.info(String.format("Can not get service instances[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } } catch (IOException e) { logger.error("list services instances occur exception"); throw new AAIException("AAI is not available.", e); diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java index 760eed14..d55712a5 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java @@ -21,11 +21,15 @@ import org.onap.usecaseui.server.service.lcm.domain.so.SOService; import org.onap.usecaseui.server.service.lcm.domain.so.bean.OperationProgressInformation; import org.onap.usecaseui.server.service.lcm.domain.so.bean.ServiceOperation; import org.onap.usecaseui.server.service.lcm.domain.so.exceptions.SOException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import retrofit2.Response; import javax.servlet.http.HttpServletRequest; import java.io.IOException; +import java.util.Collections; import static org.onap.usecaseui.server.util.RestfulServices.create; import static org.onap.usecaseui.server.util.RestfulServices.extractBody; @@ -35,6 +39,8 @@ import static org.onap.usecaseui.server.util.RestfulServices.extractBody; @EnableAspectJAutoProxy public class DefaultServiceLcmService implements ServiceLcmService { + private static final Logger logger = LoggerFactory.getLogger(DefaultServiceLcmService.class); + private SOService soService; public DefaultServiceLcmService() { @@ -49,7 +55,13 @@ public class DefaultServiceLcmService implements ServiceLcmService { public ServiceOperation instantiateService(HttpServletRequest request) { try { RequestBody requestBody = extractBody(request); - return soService.instantiateService(requestBody).execute().body(); + Response<ServiceOperation> response = soService.instantiateService(requestBody).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not instantiate service[code=%s, message=%s]", response.code(), response.message())); + throw new SOException("SO instantiate service failed!"); + } } catch (IOException e) { throw new SOException("SO Service is not available!", e); } @@ -58,7 +70,13 @@ public class DefaultServiceLcmService implements ServiceLcmService { @Override public OperationProgressInformation queryOperationProgress(String serviceId, String operationId) { try { - return soService.queryOperationProgress(serviceId, operationId).execute().body(); + Response<OperationProgressInformation> response = soService.queryOperationProgress(serviceId, operationId).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not query operation process[code=%s, message=%s]", response.code(), response.message())); + throw new SOException("SO query operation process failed!"); + } } catch (IOException e) { throw new SOException("SO Service is not available!", e); } @@ -67,7 +85,13 @@ public class DefaultServiceLcmService implements ServiceLcmService { @Override public ServiceOperation terminateService(String serviceId) { try { - return soService.terminateService(serviceId).execute().body(); + Response<ServiceOperation> response = soService.terminateService(serviceId).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not terminate service[code=%s, message=%s]", response.code(), response.message())); + throw new SOException("SO terminate service failed!"); + } } catch (IOException e) { throw new SOException("SO Service is not available!", e); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java index 111e45b8..b175cce7 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java @@ -22,6 +22,7 @@ import org.onap.usecaseui.server.bean.lcm.TemplateInput; import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfo; +import org.onap.usecaseui.server.service.lcm.domain.aai.bean.VimInfoRsp; import org.onap.usecaseui.server.service.lcm.domain.aai.exceptions.AAIException; import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService; import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; @@ -36,10 +37,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.stereotype.Service; +import retrofit2.Response; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.CATEGORY_E2E_SERVICE; @@ -68,7 +71,13 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { @Override public List<SDCServiceTemplate> listDistributedServiceTemplate() { try { - return this.sdcCatalog.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED).execute().body(); + Response<List<SDCServiceTemplate>> response = this.sdcCatalog.listServices(CATEGORY_E2E_SERVICE, DISTRIBUTION_STATUS_DISTRIBUTED).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + logger.info(String.format("Can not get distributed e2e service templates[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } } catch (IOException e) { logger.error("Visit SDC Catalog occur exception"); throw new SDCCatalogException("SDC Catalog is not available.", e); @@ -109,8 +118,7 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { ServiceTemplateInput serviceTemplateInput = fetchServiceTemplateInput(tosca); for (NodeTemplate nodeTemplate : tosca.getNodeTemplates()) { String nodeUUID = nodeTemplate.getMetaData().getValue("UUID"); - SDCServiceTemplate template = sdcCatalog.getService(nodeUUID).execute().body(); - String toscaModelURL = template.getToscaModelURL(); + String toscaModelURL = getToscaUrl(nodeUUID); if (toscaModelURL == null) { continue; } @@ -120,6 +128,17 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { return serviceTemplateInput; } + private String getToscaUrl(String nodeUUID) throws IOException { + Response<SDCServiceTemplate> response = sdcCatalog.getService(nodeUUID).execute(); + if (response.isSuccessful()) { + SDCServiceTemplate template = response.body(); + return template.getToscaModelURL(); + } else { + logger.info(String.format("Cannot get tosca model for node template[%s]", nodeUUID)); + return null; + } + } + // private List<ServiceTemplateInput> extractInputs(String toPath, List<ServiceTemplateInput> serviceTemplateInputs) throws JToscaException, IOException { // ToscaTemplate tosca = translateToToscaTemplate(toPath); // ServiceTemplateInput serviceTemplateInput = fetchServiceTemplateInput(tosca); @@ -195,7 +214,13 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { @Override public List<VimInfo> listVim() { try { - return aaiService.listVimInfo().execute().body().getCloudRegion(); + Response<VimInfoRsp> response = aaiService.listVimInfo().execute(); + if (response.isSuccessful()) { + return response.body().getCloudRegion(); + } else { + logger.info(String.format("Can not get vim info[code=%s, message=%s]", response.code(), response.message())); + return Collections.emptyList(); + } } catch (IOException e) { logger.error("Visit AAI occur exception"); throw new AAIException("AAI is not available.", e); diff --git a/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java b/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java index 4f202206..2d013ddf 100644 --- a/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java +++ b/server/src/main/java/org/onap/usecaseui/server/util/RestfulServices.java @@ -37,7 +37,7 @@ public class RestfulServices { public static <T> T create(Class<T> clazz) { String msbUrl = getMsbAddress(); Retrofit retrofit = new Retrofit.Builder() - .baseUrl("http://" + msbUrl+"/api/") + .baseUrl("http://" + msbUrl+"/") .addConverterFactory(JacksonConverterFactory.create()) .build(); return retrofit.create(clazz); |