From dcb890a6fa153900a0562872ccc31a5df2dffd24 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 6 Sep 2017 15:53:47 +0800 Subject: Fix the comments Fix the review comments for vf-c adapter Change-Id: I1b2a7de490b7d46c07d522f5720ef005bfffe67d Issue-ID:SO-109 Signed-off-by: c00149107 --- .../org/openecomp/mso/adapters/vfc/AaiAdapter.java | 46 ---------------------- .../org/openecomp/mso/adapters/vfc/AaiUtil.java | 46 ++++++++++++++++++++++ .../org/openecomp/mso/adapters/vfc/VfcManager.java | 8 ++-- .../mso/adapters/vfc/constant/CommonConstant.java | 17 -------- .../adapters/vfc/constant/DriverExceptionID.java | 6 +-- .../mso/adapters/vfc/constant/HttpCode.java | 4 +- .../vfc/exceptions/ApplicationException.java | 2 +- .../mso/adapters/vfc/model/LocationConstraint.java | 2 +- .../mso/adapters/vfc/model/NsInstantiateReq.java | 2 +- .../mso/adapters/vfc/model/NsParameters.java | 2 +- .../mso/adapters/vfc/model/NsProgressStatus.java | 2 +- .../mso/adapters/vfc/model/RestfulResponse.java | 12 ++++++ .../openecomp/mso/adapters/vfc/util/JsonUtil.java | 12 +++--- .../mso/adapters/vfc/util/RestfulUtil.java | 2 +- .../mso/adapters/vfc/util/ValidateUtil.java | 6 +-- 15 files changed, 81 insertions(+), 88 deletions(-) delete mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiAdapter.java create mode 100644 adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java (limited to 'adapters/mso-vfc-adapter/src/main/java') diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiAdapter.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiAdapter.java deleted file mode 100644 index 6e3eb93126..0000000000 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiAdapter.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * 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. - * ============LICENSE_END========================================================= - */ -package org.openecomp.mso.adapters.vfc; - -import org.openecomp.mso.adapters.vfc.model.RestfulResponse; - -/** - * Implement class of operating aai database table - *
- *

- *

- * - * @author - * @version ONAP Amsterdam Release 2017-08-28 - */ -public class AaiAdapter { - - public static RestfulResponse addRelation(String serviceInstanceID, String resourceInstanceID) - { - //sent rest to aai to add relation for service and ns. - return null; - } - - public static RestfulResponse removeRelation(String serviceInstanceID ,String resourceInstanceID) - { - //sent rest to aai to remove relation between service an ns. - return null; - } -} diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java new file mode 100644 index 0000000000..89c100d084 --- /dev/null +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * 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. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.adapters.vfc; + +import org.openecomp.mso.adapters.vfc.model.RestfulResponse; + +/** + * Implement class of operating aai database table + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-08-28 + */ +public class AaiUtil { + + public static RestfulResponse addRelation(String serviceInstanceID, String resourceInstanceID) + { + //sent rest to aai to add relation for service and ns. + return null; + } + + public static RestfulResponse removeRelation(String serviceInstanceID ,String resourceInstanceID) + { + //sent rest to aai to remove relation between service an ns. + return null; + } +} diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java index 221448cb7b..afea05c2bb 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java @@ -114,7 +114,7 @@ public class VfcManager { LOGGER.info("create ns -> end"); LOGGER.info("save segment and operaton info -> begin"); // Step 5: add relation between service and NS - AaiAdapter.addRelation(segInput.getNsOperationKey().getServiceId(), nsInstanceId); + AaiUtil.addRelation(segInput.getNsOperationKey().getServiceId(), nsInstanceId); // Step 6: save resource operation information ResourceOperationStatus nsOperInfo = RequestsDatabase.getResourceOperationStatus( @@ -168,7 +168,7 @@ public class VfcManager { } // Step3: remove relation info between service and ns - AaiAdapter.removeRelation(nsOperationKey.getServiceId(), nsInstanceId); + AaiUtil.removeRelation(nsOperationKey.getServiceId(), nsInstanceId); LOGGER.info("delete segment information -> end"); // Step4: update service segment operation status @@ -322,6 +322,7 @@ public class VfcManager { public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) { ValidateUtil.assertObjectNotNull(jobId); + // Step 1: query the current resource operation status ResourceOperationStatus nsOperInfo = RequestsDatabase.getResourceOperationStatus(nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateId()); @@ -334,6 +335,7 @@ public class VfcManager { ValidateUtil.assertObjectNotNull(rsp); LOGGER.info("query ns progress response status is : {}", rsp.getStatus()); LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent()); + //Step 3:check the response staus if(!HttpCode.isSucess(rsp.getStatus())) { LOGGER.info("fail to query job status"); nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus())); @@ -370,7 +372,7 @@ public class VfcManager { RequestsDatabase.updateResOperStatus(nsOperInfo); throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR); } else { - // do nothing + LOGGER.error("unexcepted response status"); } LOGGER.info("query ns status -> end"); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java index c2a9a685c9..b2fc4457a0 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java @@ -32,18 +32,6 @@ public class CommonConstant { public static final String STR_EMPTY = ""; - public static final String CATALOGUE_QUERY_SVC_TMPL_NODETYPE_URL = "/openoapi/catalog/v1/servicetemplates/nesting"; - - public static final String SDNO_CREATE_URL = "/openoapi/sdnonslcm/v1/ns"; - - public static final String SDNO_INSTANTIATE_URL = "/openoapi/sdnonslcm/v1/ns/%s/instantiate"; - - public static final String SDNO_TERMINATE_URL = "/openoapi/sdnonslcm/v1/ns/%s/terminate"; - - public static final String SDNO_DELETE_URL = "/openoapi/sdnonslcm/v1/ns/%s"; - - public static final String SDNO_QUERY_URL = "/openoapi/sdnonslcm/v1/jobs/%s"; - public static final String NFVO_CREATE_URL = "/openoapi/nslcm/v1/ns"; public static final String NFVO_INSTANTIATE_URL = "/openoapi/nslcm/v1/ns/%s/instantiate"; @@ -54,11 +42,6 @@ public class CommonConstant { public static final String NFVO_QUERY_URL = "/openoapi/nslcm/v1/jobs/%s"; - public static final String GSO_CREATE_URL = "/openoapi/gso/v1/services"; - - public static final String GSO_DELETE_URL = "/openoapi/gso/v1/services/%s"; - - public static final String GSO_QUERY_URL = "/openoapi/gso/v1/services/%s/operations/%s"; public static final String LEFT_QUOTE_LEFT_BRACE = "\"\\{"; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java index 5df1a9f684..652de97f5f 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java @@ -26,7 +26,7 @@ package org.openecomp.mso.adapters.vfc.constant; * identification of adapter exception * * @author - * @version GSO 0.5 2016/9/3 + * @version ONAP Amsterdam Release 2017-9-6 */ public class DriverExceptionID { @@ -45,14 +45,10 @@ public class DriverExceptionID { public static final String FAIL_TO_CREATE_NS = "Fail to create ns"; - public static final String FAIL_TO_CREATE_GSO_NS = "Fail to create gso ns"; - public static final String INVALID_RESPONSEE_FROM_DELETE_OPERATION = "Invalid response from delete operation"; public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION = "Invalid response from terminate operation"; - public static final String FAIL_TO_DELETE_GSO_NS = "Fail to delete gso ns"; - public static final String FAIL_TO_DELETE_NS = "Fail to delete ns"; public static final String FAIL_TO_TERMINATE_NS = "Fail to terminate ns"; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java index b9bb78689d..0eda7bd33b 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java @@ -72,7 +72,7 @@ public class HttpCode { *

*

* - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ private HttpCode() { @@ -83,7 +83,7 @@ public class HttpCode { * * @param httpCode response code * @return true or false - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static boolean isSucess(int httpCode) { return httpCode / 100 == 2; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java index 831eaab3d3..6a78d2e73e 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java @@ -37,7 +37,7 @@ public class ApplicationException extends WebApplicationException { * * @param errorCode error status * @param errorDetail error detail - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public ApplicationException(int errorCode, Object errorDetail) { super(Response.status(errorCode).entity(errorDetail).type(MediaType.APPLICATION_JSON).build()); diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java index b03145db20..8b259e915b 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java @@ -27,7 +27,7 @@ import java.util.Map; *

* * @author - * @version GSO 0.5 2017/2/21 + * @version ONAP Amsterdam Release 2017-9-6 */ public class LocationConstraint { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java index 6c1d209399..7e8a9ce0c3 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java @@ -26,7 +26,7 @@ package org.openecomp.mso.adapters.vfc.model; * request model for instatiate * * @author - * @version GSO 0.5 2016/9/3 + * @version ONAP Amsterdam Release 2017-9-6 */ public class NsInstantiateReq extends NsParameters { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java index ecb77cf762..79d770ba4d 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java @@ -28,7 +28,7 @@ import java.util.Map; *

* * @author - * @version GSO 0.5 2017/2/21 + * @version ONAP Amsterdam Release 2017-9-6 */ public class NsParameters { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java index 414c1f19b8..d68da47ed7 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java @@ -28,7 +28,7 @@ import java.util.List; * response model of query operation status * * @author - * @version GSO 0.5 2016/9/3 + * @version ONAP Amsterdam Release 2017-9-6 */ public class NsProgressStatus { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java index 510f61305c..483c952a97 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java @@ -21,12 +21,24 @@ package org.openecomp.mso.adapters.vfc.model; import java.util.Map; +/** + * The Unified Restful Reponse Class + *
+ *

+ *

+ * + * @author + * @version ONAP Amsterdam Release 2017-09-06 + */ public class RestfulResponse { + // the response content private String responseContent; + //the response status private int status; + //the response header private Map respHeaderMap; public RestfulResponse() { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java index 579c607f5b..34beb02c13 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java @@ -36,7 +36,7 @@ import org.openecomp.mso.logger.MsoLogger; *

* * @author - * @version GSO 0.5 2016/9/1 + * @version ONAP Amsterdam Release 2017-9-6 */ public class JsonUtil { @@ -61,7 +61,7 @@ public class JsonUtil { *

*

* - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ private JsonUtil() { @@ -73,7 +73,7 @@ public class JsonUtil { * @param jsonstr json string. * @param type that convert json string to * @return model object - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static T unMarshal(String jsonstr, Class type) { try { @@ -90,7 +90,7 @@ public class JsonUtil { * @param jsonstr json string. * @param type that convert json string to * @return model object - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static T unMarshal(String jsonstr, TypeReference type) { try { @@ -106,7 +106,7 @@ public class JsonUtil { * * @param srcObj data object * @return json string - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static String marshal(Object srcObj) { try { @@ -121,7 +121,7 @@ public class JsonUtil { * Get mapper.
* * @return mapper - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static ObjectMapper getMapper() { return MAPPER; diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java index 95025afd10..19cbca80e3 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java @@ -53,7 +53,7 @@ import org.openecomp.mso.logger.MsoLogger; * utility to invoke restclient * * @author - * @version GSO 0.5 2016/9/3 + * @version ONAP Amsterdam Release 2017-9-6 */ public class RestfulUtil { diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java index 1d8549c892..37228c805c 100644 --- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java +++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java @@ -36,7 +36,7 @@ public class ValidateUtil { *

*

* - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ private ValidateUtil() { @@ -47,7 +47,7 @@ public class ValidateUtil { * * @param paramValue parameter data * @param name of parameter - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static void assertStringNotNull(String paramValue, String paramName) { if(null != paramValue && !paramValue.isEmpty()) { @@ -62,7 +62,7 @@ public class ValidateUtil { * Assert object is null.
* * @param object data object - * @since GSO 0.5 + * @since ONAP Amsterdam Release 2017-9-6 */ public static void assertObjectNotNull(Object object) { if(null == object) { -- cgit 1.2.3-korg