diff options
author | 2025-02-24 10:20:20 +0100 | |
---|---|---|
committer | 2025-02-26 15:13:30 +0100 | |
commit | 05ace65562d347211f671ab6e5b253c36ca592eb (patch) | |
tree | 2bc088194ded9053af30d98096e402af09e85f14 | |
parent | 9308be90d43f4d4415667218ded1b4b80e06356f (diff) |
Directly invoke the AAI
- correct all AAI urls
- use v29 api version for all AAI endpoints
- make aai api version configurable via uui-server.client.aai.apiVersion
Issue-ID: USECASEUI-881
Change-Id: I95be774b4d272d5dd833b3752bef227ab65f1e67
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
10 files changed, 193 insertions, 170 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/config/AAIClientConfig.java b/server/src/main/java/org/onap/usecaseui/server/config/AAIClientConfig.java index 545f1582..44423e0a 100644 --- a/server/src/main/java/org/onap/usecaseui/server/config/AAIClientConfig.java +++ b/server/src/main/java/org/onap/usecaseui/server/config/AAIClientConfig.java @@ -21,11 +21,14 @@ import java.io.IOException; import org.onap.usecaseui.server.service.intent.IntentAaiClient; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIClient; import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpHeaders; +import io.micrometer.core.instrument.binder.okhttp3.OkHttpObservationInterceptor; +import io.micrometer.observation.ObservationRegistry; import okhttp3.Credentials; import okhttp3.Interceptor; import okhttp3.OkHttpClient; @@ -38,49 +41,54 @@ public class AAIClientConfig { @Value("${uui-server.client.aai.baseUrl}") String baseUrl; + @Value("${uui-server.client.aai.apiVersion}") + String apiVersion; @Value("${uui-server.client.aai.username}") String username; @Value("${uui-server.client.aai.password}") String password; @Bean - OkHttpClient okHttpClient() { - return new OkHttpClient().newBuilder().addInterceptor(new Interceptor() { - @Override - public okhttp3.Response intercept(Chain chain) throws IOException { - Request originalRequest = chain.request(); - Request.Builder builder = originalRequest.newBuilder() - .header("Authorization", Credentials.basic(username, password)) - .header(HttpHeaders.ACCEPT, "application/json") - .header("X-TransactionId", "7777") - .header("X-FromAppId", "uui"); - Request newRequest = builder.build(); - return chain.proceed(newRequest); - } - }).build(); + OkHttpClient okHttpClient(ObservationRegistry observationRegistry) { + return new OkHttpClient().newBuilder() + .addInterceptor( + OkHttpObservationInterceptor.builder(observationRegistry, "http.client.requests").build()) + .addInterceptor(new Interceptor() { + @Override + public okhttp3.Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + Request.Builder builder = originalRequest.newBuilder() + .header("Authorization", Credentials.basic(username, password)) + .header(HttpHeaders.ACCEPT, "application/json") + .header("X-TransactionId", "7777") + .header("X-FromAppId", "uui"); + Request newRequest = builder.build(); + return chain.proceed(newRequest); + } + }).build(); } - @Bean - Retrofit retrofit(OkHttpClient okHttpClient) { + @Bean("retrofitAAI") + Retrofit retrofitAAI(OkHttpClient okHttpClient) { return new Retrofit.Builder() - .baseUrl(baseUrl) + .baseUrl(baseUrl + "/aai/" + apiVersion + "/") .addConverterFactory(JacksonConverterFactory.create()) .client(okHttpClient) .build(); } @Bean - AAIClient aaiClient(Retrofit retrofit) { + AAIClient aaiClient(@Qualifier("retrofitAAI") Retrofit retrofit) { return retrofit.create(AAIClient.class); } @Bean - AAISliceClient aaiSliceClient(Retrofit retrofit) { + AAISliceClient aaiSliceClient(@Qualifier("retrofitAAI") Retrofit retrofit) { return retrofit.create(AAISliceClient.class); } @Bean - IntentAaiClient intentAaiClient(Retrofit retrofit) { + IntentAaiClient intentAaiClient(@Qualifier("retrofitAAI") Retrofit retrofit) { return retrofit.create(IntentAaiClient.class); } } diff --git a/server/src/main/java/org/onap/usecaseui/server/config/AAIClientProperties.java b/server/src/main/java/org/onap/usecaseui/server/config/AAIClientProperties.java index 1867c0cc..50bb561f 100644 --- a/server/src/main/java/org/onap/usecaseui/server/config/AAIClientProperties.java +++ b/server/src/main/java/org/onap/usecaseui/server/config/AAIClientProperties.java @@ -25,6 +25,7 @@ import lombok.Data; @ConfigurationProperties(prefix = "uui-server.client.aai") public class AAIClientProperties { String baseUrl; + String apiVersion; String username; String password; } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentAaiClient.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentAaiClient.java index 7ef6bfaa..90dc8874 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentAaiClient.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentAaiClient.java @@ -27,39 +27,39 @@ import retrofit2.http.Path; import retrofit2.http.Query; public interface IntentAaiClient { - @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}?depth=all") + @GET("business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}?depth=all") Call<JSONObject> getInstanceNetworkInfo(@Path("resource-service-id") String resourceServiceId); - @GET("/aai/v24/network/network-policies/network-policy/{networkPolicyId}?depth=all") + @GET("network/network-policies/network-policy/{networkPolicyId}?depth=all") Call<JSONObject> getInstanceNetworkPolicyInfo(@Path("networkPolicyId") String networkPolicyId); - @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}/metadata") + @GET("business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}/metadata") Call<JSONObject> getInstanceBandwidth(@Path("resource-service-id") String resourceServiceId); - @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}") + @GET("business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}") Call<JSONObject> getInstanceInfo(@Path("resource-service-id") String resourceServiceId); - @PUT("/aai/v24/business/customers/customer/{globalCustomerId}") + @PUT("business/customers/customer/{globalCustomerId}") Call<Void> addCustomer(@Path("globalCustomerId") String globalCustomerId,@Body RequestBody body); - @GET("/aai/v24/business/customers/customer/{globalCustomerId}") + @GET("business/customers/customer/{globalCustomerId}") Call<JSONObject> queryCustomer(@Path("globalCustomerId") String globalCustomerId); - @PUT("/aai/v24/business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}") + @PUT("business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}") Call<Void> addSubscription(@Path("globalCustomerId") String globalCustomerId, @Path("serviceType") String serviceType,@Body RequestBody body); - @GET("/aai/v24/business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}") + @GET("business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}") Call<JSONObject> querySubscription(@Path("globalCustomerId") String globalCustomerId, @Path("serviceType") String serviceType); - @PUT("/aai/v24/business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}/service-instances/service-instance/{serviceInstanceId}") + @PUT("business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}/service-instances/service-instance/{serviceInstanceId}") Call<Void> saveServiceInstance(@Path("globalCustomerId") String globalCustomerId, @Path("serviceType") String serviceType, @Path("serviceInstanceId") String serviceInstanceId, @Body RequestBody body); - @GET("/aai/v24/business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}/service-instances/service-instance/{serviceInstanceId}") + @GET("business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}/service-instances/service-instance/{serviceInstanceId}") Call<JSONObject> queryServiceInstance(@Path("globalCustomerId") String globalCustomerId, @Path("serviceType") String serviceType, @Path("serviceInstanceId") String serviceInstanceId); - @DELETE("/aai/v24/business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}/service-instances/service-instance/{serviceInstanceId}") + @DELETE("business/customers/customer/{globalCustomerId}/service-subscriptions/service-subscription/{serviceType}/service-instances/service-instance/{serviceInstanceId}") Call<Void> deleteServiceInstance(@Path("globalCustomerId") String globalCustomerId, @Path("serviceType") String serviceType, @Path("serviceInstanceId") String serviceInstanceId, @Query("resource-version") String resourceVersion); - @GET("/aai/v24/network/network-routes") + @GET("network/network-routes") Call<JSONObject> queryNetworkRoute(); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIClient.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIClient.java index 1f702d21..40a63014 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIClient.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/aai/AAIClient.java @@ -39,153 +39,145 @@ import retrofit2.http.Query; public interface AAIClient { - -// @GET("/api/aai-business/v11/customers") - @GET("/api/aai-business/v13/customers") + @GET("business/customers") Call<AAICustomerRsp> listCustomer(); - @GET("/api/aai-externalSystem/v16/esr-nfvo-list") + @GET("external-system/esr-nfvo-list") Call<AAIOrchestratorRsp> listOrchestrator(); - @GET("/api/aai-externalSystem/v16/esr-nfvo-list/esr-nfvo/{nfvo-id}?depth=all") + @GET("external-system/esr-nfvo-list/esr-nfvo/{nfvo-id}?depth=all") Call<AAISingleOrchestratorRsp> getOrchestrator(@Path("nfvo-id") String nfvoId); - @PUT("/api/aai-business/v13/customers/customer/{global-customer-id}") + @PUT("business/customers/customer/{global-customer-id}") Call<ResponseBody> createOrUpdateCustomer(@Path("global-customer-id") String customerId,@Body RequestBody body); - @DELETE("/api/aai-business/v13//customers/customer/{global-customer-id}") + @DELETE("business/customers/customer/{global-customer-id}") Call<ResponseBody> deleteCustomer(@Path("global-customer-id") String customerId,@Query("resource-version") String resourceVersion); - @GET("/api/aai-business/v13//customers/customer/{global-customer-id}") + @GET("business/customers/customer/{global-customer-id}") Call<AAICustomer> getCustomerById(@Path("global-customer-id") String customerId); -// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") - @GET("/api/aai-business/v16/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") Call<ResponseBody> listServiceInstances(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType); -// @GET("/cloud-infrastructure/cloud-regions") - @GET("/api/aai-cloudInfrastructure/v11/cloud-regions") + @GET("cloud-infrastructure/cloud-regions") Call<VimInfoRsp> listVimInfo(); -// @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") - @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions") Call<ServiceSubscriptionRsp> listServiceSubscriptions(@Path("global-customer-id") String customerId); - //@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") - @PUT("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}") + @PUT("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}") Call<ResponseBody> createOrUpdateServiceType(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType,@Body RequestBody body); - //@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") - @DELETE("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}") + @DELETE("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}") Call<ResponseBody> deleteServiceType(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType,@Query("resource-version") String resourceVersion); - //@GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions") - @GET("/api/aai-business/v11/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}") Call<AAIServiceSubscription> getServiceTypeById(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType); - @GET("/api/aai-externalSystem/v11/esr-thirdparty-sdnc-list") + @GET("external-system/esr-thirdparty-sdnc-list") Call<SDNCControllerRsp> listSdncControllers(); - @GET("/api/aai-business/v11/customers/customer/{customerId}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{serviceId}") + @GET("business/customers/customer/{customerId}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{serviceId}") Call<ResponseBody> getAAIServiceInstance(@Path("customerId") String customerId,@Path("service-type") String seviceType,@Path("serviceId") String serviceId); - @GET("/api/aai-network/v14/network-resources") + @GET("network/network-resources") Call<ResponseBody> listNetWorkResources(); - @GET("/api/aai-network/v14/pnfs/pnf/{pnfName}/p-interfaces") + @GET("network/pnfs/pnf/{pnfName}/p-interfaces") Call<PinterfaceRsp> getPinterfaceByPnfName(@Path("pnfName") String pnfName); - @GET("/aai/v24/network/logical-links") + @GET("network/logical-links") Call<ResponseBody> getLogicalLinks(); - @GET("/api/aai-network/v14/logical-links/logical-link/{link-name}") + @GET("network/logical-links/logical-link/{link-name}") Call<ResponseBody> getSpecificLogicalLink(@Path("link-name") String linkName); - @PUT("/api/aai-network/v14/network-resources/network-resource/{networkId}") + @PUT("network/network-resources/network-resource/{networkId}") Call<ResponseBody> createTopoNetwork(@Body RequestBody body,@Path("networkId") String networkId); - @PUT("/api/aai-network/v14/ext-aai-networks/ext-aai-network/{aai-id}") + @PUT("network/ext-aai-networks/ext-aai-network/{aai-id}") Call<ResponseBody> createHostUrl(@Body RequestBody body,@Path("aai-id") String aaiId); - @GET("/api/aai-network/v14/ext-aai-networks/ext-aai-network/{aai-id}") + @GET("network/ext-aai-networks/ext-aai-network/{aai-id}") Call<ResponseBody> getExtAaiId(@Path("aai-id") String aaiId); - @GET("/api/aai-network/v14/ext-aai-networks/ext-aai-network/{aai-id}/esr-system-info") + @GET("network/ext-aai-networks/ext-aai-network/{aai-id}/esr-system-info") Call<ResponseBody> getHostUrl(@Path("aai-id") String aaiId); - @PUT("/api/aai-network/v14/pnfs/pnf/{pnfName}/p-interfaces/p-interface/{tp-id}") + @PUT("network/pnfs/pnf/{pnfName}/p-interfaces/p-interface/{tp-id}") Call<ResponseBody> createTerminationPoint(@Body RequestBody body,@Path("pnfName") String pnfName,@Path("tp-id") String tpId); - @PUT("/api/aai-network/v14/pnfs/pnf/{pnfname}") + @PUT("network/pnfs/pnf/{pnfname}") Call<ResponseBody> createPnf(@Body RequestBody body,@Path("pnfname") String pnfname); - @PUT("/api/aai-network/v14/logical-links/logical-link/{linkName}") + @PUT("network/logical-links/logical-link/{linkName}") Call<ResponseBody> createLink(@Body RequestBody body,@Path("linkName") String linkName); - @DELETE("/api/aai-network/v14/logical-links/logical-link/{linkName}") + @DELETE("network/logical-links/logical-link/{linkName}") Call<ResponseBody> deleteLink(@Path("linkName") String linkName,@Query("resource-version") String resourceVersion); - @GET("/api/aai-business/v14/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") Call<ResponseBody> getServiceInstances(@Path("global-customer-id") String customerId,@Path("service-type") String serviceType); - @GET("/api/aai-business/v14/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") Call<ResponseBody> serviceInstaneInfo(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Query("service-instance-id") String serviceInstanceId); - @GET("/api/aai-business/v14/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources") Call<ResponseBody> getAllottedResources(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/aai/v24/network/pnfs") + @GET("network/pnfs") Call<ResponseBody> getPnfInfo(@Query("pnfName") String pnfName); - @GET("/aai/v24/network/connectivities") + @GET("network/connectivities") Call<ResponseBody> getConnectivityInfo(@Query("connectivity-id") String connectivityId); - @GET("/aai/v24/network/vpn-bindings") + @GET("network/vpn-bindings") Call<ResponseBody> getVpnBindingInfo(@Query("vpn-id") String vpnId); - @GET("/aai/v24/network/network-routes") + @GET("network/network-routes") Call<ResponseBody> getNetworkRouteInfo(@Query("route-id") String routeId); - @GET("/aai/v24/network/unis") + @GET("network/unis") Call<ResponseBody> getUniInfo(@Query("uni-id") String uniId); - @GET("/api/aai-network/v14/vpn-bindings") + @GET("network/vpn-bindings") Call<ResponseBody> getPinterfaceByVpnId(@Query("vpn-id") String vpnId); - @DELETE("/api/aai-network/v14/ext-aai-networks/ext-aai-network/{aai-id}") + @DELETE("network/ext-aai-networks/ext-aai-network/{aai-id}") Call<ResponseBody> deleteExtNetwork(@Path("aai-id") String aaiId,@Query("resource-version") String resourceVersion); - @PUT("/api/aai-query/v19?format=resource") - Call<ResponseBody> querynNetworkResourceList(@Body RequestBody body); - - @GET("/api/aai-business/v14/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") Call<ResponseBody> getServiceInstancesForEdge(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType, @Path("service-instance-id") String serviceinstanceid); - @GET("/api/aai-network/v14/connectivities/connectivity") + @GET("connectivities/connectivity") Call<ResponseBody> getConnectivityInformation(@Query("connectivity-id") String connectivityId); - @GET("/api/aai-network/v14/pnfs/pnf/{pnfName}/p-interfaces/p-interface/{tp-id}") + @GET("network/pnfs/pnf/{pnfName}/p-interfaces/p-interface/{tp-id}") Call<ResponseBody> getTerminationPoint(@Path("pnfName") String pnfName,@Path("tp-id") String tpId); - @GET("/api/aai-business/v16/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{allotted-resource-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{allotted-resource-id}") Call<ResponseBody> getAllotedResourceFor5G(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType, @Path("service-instance-id") String serviceinstanceid,@Path("allotted-resource-id") String allottedResourceId); - @GET("/api/aai-network/v14/site-resources/site-resource/{site-resource-id}") + @GET("network/site-resources/site-resource/{site-resource-id}") Call<ResponseBody> getSiteResourceInfo(@Path("site-resource-id") String siteResourceId); - @GET("/api/aai-cloudInfrastructure/v14/complexes/complex/{complex-id}") + @GET("cloud-infrastructure/complexes/complex/{complex-id}") Call<ResponseBody> getComplexObject(@Path("complex-id") String complexId); - @GET("/api/aai-business/v14/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances") Call<ResponseBody> getAllServiceInformation(@Path("global-customer-id") String customerId, @Path("service-type") String serviceType); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions") Call<ResponseBody> getServiceSubscription(@Path("global-customer-id") String customerID); - @GET("/aai/v19/network/generic-vnfs/generic-vnf/{vnf-id}") + @GET("network/generic-vnfs/generic-vnf/{vnf-id}") Call<ResponseBody> getVNFsDetail(@Path("vnf-id") String vnfId); - @GET("/aai/v19/network/unis/uni/{uni-id}") + @GET("network/unis/uni/{uni-id}") Call<ResponseBody> getUNIInfo(@Path("uni-id") String uniId); + + @PUT("/api/aai-query/v19?format=resource") + Call<ResponseBody> querynNetworkResourceList(@Body RequestBody body); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceClient.java b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceClient.java index ab2019de..02334a5c 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceClient.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/slicingdomain/aai/AAISliceClient.java @@ -32,77 +32,77 @@ import retrofit2.http.Query; public interface AAISliceClient { - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=service-profile") - Call<JSONObject> listService(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType); + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=service-profile") + Call<JSONObject> listService(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=service-profile") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=service-profile") Call<JSONObject> listServiceByStatus(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Query("orchestration-status") String orchestrationStatus); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") Call<JSONObject> listServiceById(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String businessId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nsi") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nsi") Call<JSONObject> listServiceNSI(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nsi") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nsi") Call<JSONObject> listServiceNSIByStatus(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Query("orchestration-status") String orchestrationStatus); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nssi") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nssi") Call<JSONObject> listServiceNSSI(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nssi") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nssi") Call<JSONObject> listServiceNSSIByStatus(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Query("orchestration-status") String orchestrationStatus); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nssi") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=nssi") Call<JSONObject> listServiceNSSIByEnv(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Query("environment-context") String environmentContext); - @GET("/api/aai-business/v19/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/service-profiles") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/service-profiles") Call<JSONObject> getServiceProfiles(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}/allotted-resources") Call<JSONObject> queryAllottedResources(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") Call<JSONObject> querySerAndSubInsByNSI(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") Call<JSONObject> queryNSIByNSSI(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") Call<JSONObject> queryOrderByService(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}") Call<JSONObject> queryOrderByOrderId(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType,@Path("service-instance-id") String serviceInstanceId); - @GET("/api/aai-sdc/v13/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}") + @GET("service-design-and-creation/models/model/{model-invariant-id}/model-vers/model-ver/{model-version-id}") Call<AAIServiceNST> queryServiceNST(@Path("model-invariant-id") String modelInvariantIid, - @Path("model-version-id") String modelVersionId); + @Path("model-version-id") String modelVersionId); - @GET("/api/aai-business/v13/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=communication-service") + @GET("business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances?service-role=communication-service") Call<JSONObject> listOrders(@Path("global-customer-id") String globalCustomerId,@Path("service-type") String serviceType); - @GET("/api/aai-network/v21/logical-links") + @GET("network/logical-links") Call<ConnectionLinkList> getConnectionLinks(); - @GET("/api/aai-network/v21/network-routes/network-route/{route-id}") + @GET("network/network-routes/network-route/{route-id}") Call<EndPointInfoList> getEndpointByLinkName(@Path("route-id") String linkName); - @GET("/api/aai-network/v21/network-routes/network-route/{route-id}") + @GET("network/network-routes/network-route/{route-id}") Call<EndPointInfoList> getEndpointByLinkName2(@Path("route-id") String linkName2); - @GET("/api/aai-business/v21/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{allotted-resource-id}") + @GET("business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}/allotted-resources/allotted-resource/{allotted-resource-id}") Call<ConnectionLink> getAllottedResource(@Path("service-instance-id") String serviceInstancesId,@Path("allotted-resource-id") String allottedResourceId); - @GET("/api/aai-business/v21/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}") Call<ConnectionLink> getServiceInstance(@Path("service-instance-id") String serviceInstancesId); - @GET("/api/aai-business/v21/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}") + @GET("business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}") Call<NetworkInfo> getServiceNetworkInstance(@Path("service-instance-id") String serviceInstancesId); - @GET("/api/aai-network/v21/network-policies/network-policy/{network-policy-id}") + @GET("network/network-policies/network-policy/{network-policy-id}") Call<NetworkPolicy> getNetworkPolicy(@Path("network-policy-id")String relationshipValue); - @GET("/api/aai-business/v21/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}/slice-profiles") + @GET("business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/{service-instance-id}/slice-profiles") Call<SliceProfileList> getSliceProfiles(@Path("service-instance-id") String serviceInstancesId); } diff --git a/server/src/main/resources/application.properties b/server/src/main/resources/application.properties index 5aef428f..398f66b7 100644 --- a/server/src/main/resources/application.properties +++ b/server/src/main/resources/application.properties @@ -56,6 +56,7 @@ management.tracing.sampling.probability=1.0 management.zipkin.tracing.endpoint=http://${COLLECTOR_HOST:jaeger-collector.istio-system}:${COLLECTOR_PORT:9411}/api/v2/spans uui-server.client.aai.baseUrl=http://aai.onap +uui-server.client.aai.apiVersion=v29 uui-server.client.aai.username=AAI uui-server.client.aai.password=AAI uui-server.client.so.baseUrl=http://so.onap:8080 diff --git a/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplIntegrationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplIntegrationTest.java index 80d3c0f6..fb039d76 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplIntegrationTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/csmf/impl/SlicingServiceImplIntegrationTest.java @@ -20,15 +20,17 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -41,16 +43,15 @@ import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; import org.onap.usecaseui.server.config.AAIClientConfig; import org.onap.usecaseui.server.config.SOClientConfig; import org.onap.usecaseui.server.constant.csmf.CsmfParamConstant; -import org.onap.usecaseui.server.constant.nsmf.NsmfParamConstant; import org.onap.usecaseui.server.service.csmf.SlicingService; import org.onap.usecaseui.server.service.csmf.config.SlicingProperties; import org.onap.usecaseui.server.service.lcm.ServiceLcmService; -import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; import org.onap.usecaseui.server.service.lcm.impl.DefaultServiceLcmService; import org.onap.usecaseui.server.service.slicingdomain.aai.AAISliceClient; import org.onap.usecaseui.server.service.slicingdomain.so.SOSliceService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; @@ -60,6 +61,7 @@ import org.wiremock.spring.EnableWireMock; import lombok.SneakyThrows; +@EnableAutoConfiguration @EnableWireMock @EnableConfigurationProperties @SpringBootTest( @@ -105,6 +107,9 @@ public class SlicingServiceImplIntegrationTest { @Value("${uui-server.client.aai.password}") String aaiPassword; + @Value("${uui-server.client.aai.apiVersion}") + String apiVersion; + @BeforeEach void setup() { slicingService = new SlicingServiceImpl(serviceLcmService,aaiSliceClient,soSliceService, slicingProperties); @@ -140,7 +145,7 @@ public class SlicingServiceImplIntegrationTest { @Test void thatSlicingOrdersCanBeListed() { stubFor( - get(String.format("/api/aai-business/v13/customers/customer/%s/service-subscriptions/service-subscription/%s/service-instances?service-role=communication-service", "5GCustomer", "5G")) + get("/aai/%s/business/customers/customer/%s/service-subscriptions/service-subscription/%s/service-instances?service-role=communication-service".formatted(apiVersion, "5GCustomer", "5G")) .withBasicAuth(aaiUsername, aaiPassword) .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) .withHeader("X-TransactionId", equalTo("7777")) @@ -151,6 +156,7 @@ public class SlicingServiceImplIntegrationTest { ServiceResult result = slicingService.querySlicingOrderList(CsmfParamConstant.ALL, "1","10"); + verify(getRequestedFor(urlEqualTo("/aai/%s/business/customers/customer/%s/service-subscriptions/service-subscription/%s/service-instances?service-role=communication-service".formatted(apiVersion, "5GCustomer", "5G")))); assertNotNull(result); OrderList orderList = (OrderList) result.getResult_body(); assertEquals(2, orderList.getRecord_number()); diff --git a/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceIntegrationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceIntegrationTest.java index a1e925a7..17e4459e 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceIntegrationTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceIntegrationTest.java @@ -19,9 +19,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -49,24 +53,26 @@ import org.onap.usecaseui.server.service.lcm.impl.DefaultServiceLcmService; import org.onap.usecaseui.server.service.nsmf.impl.ResourceMgtServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpHeaders; import org.wiremock.spring.EnableWireMock; +import com.github.tomakehurst.wiremock.client.WireMock; + import lombok.SneakyThrows; @EnableWireMock -@SpringBootTest( - classes = { - AAIClientConfig.class, - SOClientConfig.class, - SlicingServiceImpl.class, - SlicingProperties.class, - IntentProperties.class - }, - properties = { +@EnableAutoConfiguration +@SpringBootTest(classes = { + AAIClientConfig.class, + SOClientConfig.class, + SlicingServiceImpl.class, + SlicingProperties.class, + IntentProperties.class +}, properties = { "uui-server.client.aai.baseUrl=${wiremock.server.baseUrl}", "uui-server.client.aai.username=AAI", "uui-server.client.aai.password=AAI", @@ -78,8 +84,7 @@ import lombok.SneakyThrows; "uui-server.slicing.global-subscriber-id=someGlobalSubscriberId", "uui-server.slicing.service-type=someServiceType", "uui-server.ccvpn.globalCustomerId=defaultGlobalCustomerId" - } -) +}) @EnableConfigurationProperties public class IntentInstanceServiceIntegrationTest { @@ -95,6 +100,9 @@ public class IntentInstanceServiceIntegrationTest { @Value("${uui-server.client.aai.password}") String aaiPassword; + @Value("${uui-server.client.aai.apiVersion}") + String apiVersion; + @Mock ResourceMgtServiceImpl resourceMgtServiceImpl; @@ -122,7 +130,8 @@ public class IntentInstanceServiceIntegrationTest { Transaction transaction = mock(Transaction.class); when(sessionFactory.openSession()).thenReturn(session); when(session.beginTransaction()).thenReturn(transaction); - this.intentService = new IntentInstanceServiceImpl(slicingService, intentAaiClient, intentSoService, sessionFactory, resourceMgtServiceImpl, intentProperties); + this.intentService = new IntentInstanceServiceImpl(slicingService, intentAaiClient, intentSoService, sessionFactory, + resourceMgtServiceImpl, intentProperties); } IntentInstanceServiceImpl intentService; @@ -133,51 +142,53 @@ public class IntentInstanceServiceIntegrationTest { byte[] requestBytes = Files.readAllBytes(Paths.get("src/test/resources/__files/requests/createIntentRequest.json")); String expectedRequestBody = new String(requestBytes, StandardCharsets.UTF_8); stubFor( - post("/so/infra/serviceIntent/v1/create") - .withBasicAuth(soUsername, soPassword) - .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) - .withHeader("X-TransactionId", equalTo("9999")) - .withHeader("X-FromAppId", equalTo("onap-cli")) - .withRequestBody(equalToJson(expectedRequestBody)) - .willReturn( - aResponse().withBodyFile("createIntentResponse.json") - )); + post("/so/infra/serviceIntent/v1/create") + .withBasicAuth(soUsername, soPassword) + .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) + .withHeader("X-TransactionId", equalTo("9999")) + .withHeader("X-FromAppId", equalTo("onap-cli")) + .withRequestBody(equalToJson(expectedRequestBody)) + .willReturn( + aResponse().withBodyFile("createIntentResponse.json"))); stubFor( - get("/aai/v24/business/customers/customer/defaultGlobalCustomerId") - .withBasicAuth(aaiUsername, aaiPassword) - .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) - .withHeader("X-TransactionId", equalTo("7777")) - .withHeader("X-FromAppId", equalTo("uui")) - .willReturn( - aResponse().withBodyFile("customersResponse.json") - )); + get("/aai/%s/business/customers/customer/defaultGlobalCustomerId".formatted(apiVersion)) + .withBasicAuth(aaiUsername, aaiPassword) + .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) + .withHeader("X-TransactionId", equalTo("7777")) + .withHeader("X-FromAppId", equalTo("uui")) + .willReturn( + aResponse().withBodyFile("customersResponse.json"))); stubFor( - get("/aai/v24/business/customers/customer/defaultGlobalCustomerId/service-subscriptions/service-subscription/defaultServiceType") - .withBasicAuth(aaiUsername, aaiPassword) - .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) - .withHeader("X-TransactionId", equalTo("7777")) - .withHeader("X-FromAppId", equalTo("uui")) - .willReturn( - aResponse().withBodyFile("customersResponse.json") - )); + get("/aai/%s/business/customers/customer/defaultGlobalCustomerId/service-subscriptions/service-subscription/defaultServiceType".formatted(apiVersion)) + .withBasicAuth(aaiUsername, aaiPassword) + .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) + .withHeader("X-TransactionId", equalTo("7777")) + .withHeader("X-FromAppId", equalTo("uui")) + .willReturn( + aResponse().withBodyFile("customersResponse.json"))); stubFor( - put("/aai/v24/business/customers/customer/defaultGlobalCustomerId/service-subscriptions/service-subscription/defaultServiceType/service-instances/service-instance/IBN-someInstanceId") - .withBasicAuth(aaiUsername, aaiPassword) - .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) - .withHeader("X-TransactionId", equalTo("7777")) - .withHeader("X-FromAppId", equalTo("uui")) - .willReturn( - aResponse().withBodyFile("customersResponse.json") - )); + put("/aai/%s/business/customers/customer/defaultGlobalCustomerId/service-subscriptions/service-subscription/defaultServiceType/service-instances/service-instance/IBN-someInstanceId".formatted(apiVersion)) + .withBasicAuth(aaiUsername, aaiPassword) + .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) + .withHeader("X-TransactionId", equalTo("7777")) + .withHeader("X-FromAppId", equalTo("uui")) + .willReturn( + aResponse().withBodyFile("customersResponse.json"))); CCVPNInstance ccVpnInstance = new CCVPNInstance(); ccVpnInstance.setInstanceId("someInstanceId"); ccVpnInstance.setAccessPointOneName("accessPointOneName"); int result = intentService.createCCVPNInstance(ccVpnInstance); assertEquals(1, result); + WireMock.verify(postRequestedFor(urlEqualTo("/so/infra/serviceIntent/v1/create"))); + WireMock.verify(getRequestedFor(urlEqualTo("/aai/%s/business/customers/customer/defaultGlobalCustomerId".formatted(apiVersion)))); + WireMock.verify(getRequestedFor(urlEqualTo( + "/aai/%s/business/customers/customer/defaultGlobalCustomerId/service-subscriptions/service-subscription/defaultServiceType".formatted(apiVersion)))); + WireMock.verify(putRequestedFor(urlEqualTo( + "/aai/%s/business/customers/customer/defaultGlobalCustomerId/service-subscriptions/service-subscription/defaultServiceType/service-instances/service-instance/IBN-someInstanceId".formatted(apiVersion)))); } } diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceIntegrationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceIntegrationTest.java index 4050ac07..ef490674 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceIntegrationTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultCustomerServiceIntegrationTest.java @@ -27,30 +27,32 @@ import java.util.List; import org.junit.jupiter.api.Test; import org.onap.usecaseui.server.config.AAIClientConfig; -import org.onap.usecaseui.server.controller.lcm.CustomerController; import org.onap.usecaseui.server.service.lcm.CustomerService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.http.HttpHeaders; import org.wiremock.spring.EnableWireMock; +@EnableAutoConfiguration +// @AutoConfigureObservability @EnableWireMock @SpringBootTest( - webEnvironment = WebEnvironment.RANDOM_PORT, classes = { - AAIClientConfig.class, DefaultCustomerService.class, CustomerController.class + AAIClientConfig.class, DefaultCustomerService.class }, properties = { - "spring.main.web-application-type=none", // only temporary "uui-server.client.aai.baseUrl=${wiremock.server.baseUrl}", "uui-server.client.aai.username=AAI", "uui-server.client.aai.password=AAI" }) public class DefaultCustomerServiceIntegrationTest { + @Value("${uui-server.client.aai.apiVersion}") + String apiVersion; + @Autowired CustomerService customerService; @@ -63,7 +65,7 @@ public class DefaultCustomerServiceIntegrationTest { @Test void thatAAIRequestsAreCorrect() { stubFor( - get("/api/aai-business/v13/customers") + get("/aai/%s/business/customers".formatted(apiVersion)) .withBasicAuth(username, password) .withHeader(HttpHeaders.ACCEPT, equalTo("application/json")) .withHeader("X-TransactionId", equalTo("7777")) diff --git a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java index 9a4035a3..9b10b061 100644 --- a/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateServiceIntegrationTest.java @@ -30,6 +30,7 @@ import org.onap.usecaseui.server.config.SDCClientProperties; import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpHeaders; @@ -38,6 +39,7 @@ import org.wiremock.spring.EnableWireMock; import lombok.SneakyThrows; @EnableWireMock +@EnableAutoConfiguration @EnableConfigurationProperties(SDCClientProperties.class) @SpringBootTest( classes = { |