From dcbfd5f2e9f4a16d90c4e49aeed2c5278dbf8f47 Mon Sep 17 00:00:00 2001 From: ’zhaoyh6‘ Date: Wed, 13 Oct 2021 09:50:55 +0800 Subject: fix:Fix create instance problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue-ID: USECASEUI-605 Signed-off-by: ’zhaoyh6‘ Change-Id: Ia9a6e9e3d3d635beb63a55520c43dcbcea687a10 --- .../server/controller/IntentController.java | 4 ++-- .../server/service/intent/IntentApiService.java | 20 ++++++++------------ .../intent/impl/IntentInstanceServiceImpl.java | 5 +++-- .../dbscripts/postgres/uui_create_table.sql | 10 +++++----- 4 files changed, 18 insertions(+), 21 deletions(-) diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java index a1a2f206..4a324a63 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/IntentController.java @@ -186,7 +186,7 @@ public class IntentController { private String load(String dirPath) { - String url = "http://uui-nlp.onap:33011/api/online/load"; + String url = "http://uui-nlp:33011/api/online/load"; HashMap headers = new HashMap<>(); String bodyStr = "{" + "\"path\": \""+dirPath+"\"" + "}"; logger.info("request body: " + bodyStr); @@ -233,7 +233,7 @@ public class IntentController { throw new RuntimeException("The active model file does not support parsing the current text"); } - String url = "http://uui-nlp.onap:33011/api/online/predict"; + String url = "http://uui-nlp:33011/api/online/predict"; HashMap headers = new HashMap<>(); String bodyStr = "{\"title\": \"predict\", \"text\": \"" + text + "\"}"; diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java index 76014340..2c636479 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/IntentApiService.java @@ -24,9 +24,7 @@ import retrofit2.http.*; public interface IntentApiService { @Headers({ - "X-TransactionId: 9999", - "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json" }) @POST("/so/infra/serviceIntent/v1/create") @@ -35,7 +33,7 @@ public interface IntentApiService { @Headers({ "X-TransactionId: 9999", "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json" }) @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}?depth=all") @@ -44,7 +42,7 @@ public interface IntentApiService { @Headers({ "X-TransactionId: 9999", "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json" }) @GET("/aai/v24/network/network-policies/network-policy/{networkPolicyId}?depth=all") @@ -53,28 +51,26 @@ public interface IntentApiService { @Headers({ "X-TransactionId: 9999", "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json" }) @GET("/aai/v24/business/customers/customer/IBNCustomer/service-subscriptions/service-subscription/IBN/service-instances/service-instance/{resource-service-id}/metadata") Call getInstanceBandwidth(@Path("resource-service-id") String resourceServiceId); @Headers({ - "X-TransactionId: 9999", - "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json" }) - @POST("/so/infra/serviceIntent/v1/delete") + @DELETE("/so/infra/serviceIntent/v1/delete") Call deleteIntentInstance(@Body RequestBody body); @Headers({ "X-TransactionId: 9999", "X-FromAppId: MSO", - "Authorization: Basic QUFJOkFBSQ==", + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", "Accept: application/json" }) - @POST("/aai/v24/network/network-routes") + @GET("/aai/v24/network/network-routes") Call queryNetworkRoute(); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java b/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java index 1abd2515..fe8ee64f 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/intent/impl/IntentInstanceServiceImpl.java @@ -492,8 +492,9 @@ public class IntentInstanceServiceImpl implements IntentInstanceService { Map result = new HashMap<>(); List accessNodeList = new ArrayList<>(); List cloudAccessNodeList = new ArrayList<>(); - JSONObject body = intentApiService.queryNetworkRoute().execute().body(); - JSONArray data = body.getJSONArray("data"); + Response response = intentApiService.queryNetworkRoute().execute(); + JSONObject body = response.body(); + JSONArray data = body.getJSONArray("network-route"); for (int i = 0; i