diff options
-rw-r--r-- | docs/administration/administration.rst | 4 | ||||
-rwxr-xr-x | docs/architecture/architecture.rst | 9 | ||||
-rwxr-xr-x | docs/consumedapis/consumedapis.rst | 15 | ||||
-rw-r--r-- | docs/delivery/delivery.rst | 7 | ||||
-rw-r--r-- | docs/humaninterfaces/humaninterfaces.rst | 6 | ||||
-rw-r--r-- | docs/index.rst | 3 | ||||
-rw-r--r-- | docs/installation/installation.rst | 8 | ||||
-rw-r--r-- | docs/offeredapis/offeredapis.rst | 3 | ||||
-rw-r--r-- | docs/offeredapis/pdf/nbicallflow.pdf | bin | 718197 -> 142247 bytes | |||
-rw-r--r-- | docs/offeredapis/swaggers/healthCheck_3_0_0.json | 61 | ||||
-rwxr-xr-x | docs/releasenotes/releasenotes.rst | 25 | ||||
-rw-r--r-- | src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java | 211 | ||||
-rw-r--r-- | tox.ini | 7 |
13 files changed, 204 insertions, 155 deletions
diff --git a/docs/administration/administration.rst b/docs/administration/administration.rst index 7abffd2..babf452 100644 --- a/docs/administration/administration.rst +++ b/docs/administration/administration.rst @@ -1,5 +1,4 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE @@ -14,4 +13,3 @@ Processes Actions ------- - diff --git a/docs/architecture/architecture.rst b/docs/architecture/architecture.rst index 31f0235..1ded2f6 100755 --- a/docs/architecture/architecture.rst +++ b/docs/architecture/architecture.rst @@ -1,6 +1,4 @@ -.. This work is licensed under -.. a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE @@ -17,9 +15,9 @@ used by external systems as BSS for example. These API are based on **TMF API**. -******************************************* +********************************************** Global NBI architecture for Casablanca release -******************************************* +********************************************** Following illustration provides a global view about NBI architecture, integration with other ONAP components and API resource/operation provided. @@ -38,4 +36,3 @@ could be found here: :doc:`NBI_Developer_Guide <NBI_Developer_Guide>` API Flow illustration (with example messages) is described in this document: :download:`nbicallflow.pdf <../offeredapis/pdf/nbicallflow.pdf>` - diff --git a/docs/consumedapis/consumedapis.rst b/docs/consumedapis/consumedapis.rst index 38418b3..02b5782 100755 --- a/docs/consumedapis/consumedapis.rst +++ b/docs/consumedapis/consumedapis.rst @@ -1,6 +1,4 @@ -.. This work is licensed under -.. a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE @@ -57,9 +55,10 @@ SO API ****** This API is used to perform Service Order and thus instantiate a service. -Distinct SO APIs are used for serviceInstance creation request depending on the serviceSpecification category (set in SDC). -If service could be delivered end-to-end from one request category is set to 'E2E Service'. -In this case NBI uses +Distinct SO APIs are used for serviceInstance creation request depending on the +serviceSpecification category (set in SDC). If service could be delivered +end-to-end from one request category is set to 'E2E Service'. +In this case NBI uses :: @@ -69,7 +68,7 @@ In this case NBI uses MSO_DELETE_REQUEST_STATUS_PATH = "/ecomp/mso/infra/serviceInstances/v6/" - + else following API are used: :: @@ -78,4 +77,4 @@ else following API are used: MSO_GET_REQUEST_STATUS_PATH = "/ecomp/mso/infra/orchestrationRequests/v6/" - MSO_DELETE_REQUEST_STATUS_PATH = "/ecomp/mso/infra/serviceInstances/v6/"
\ No newline at end of file + MSO_DELETE_REQUEST_STATUS_PATH = "/ecomp/mso/infra/serviceInstances/v6/" diff --git a/docs/delivery/delivery.rst b/docs/delivery/delivery.rst index 0bbc8c5..6c79228 100644 --- a/docs/delivery/delivery.rst +++ b/docs/delivery/delivery.rst @@ -1,5 +1,4 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE @@ -10,7 +9,8 @@ Delivery NBI Dockers Containers Structure ******************************** -Below is a diagram of the ExternalAPI/NBI project docker containers and the connections between them. +Below is a diagram of the ExternalAPI/NBI project docker containers and the +connections between them. .. blockdiag:: @@ -32,4 +32,3 @@ Below is a diagram of the ExternalAPI/NBI project docker containers and the conn MongoDB; MariaDB; } } - diff --git a/docs/humaninterfaces/humaninterfaces.rst b/docs/humaninterfaces/humaninterfaces.rst index 16f1835..506f1d8 100644 --- a/docs/humaninterfaces/humaninterfaces.rst +++ b/docs/humaninterfaces/humaninterfaces.rst @@ -1,5 +1,4 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE @@ -8,4 +7,5 @@ Human Interfaces no Human Interface (pure Rest API project) -Any "Rest Client" application may be used (Postman, ...) to interact with NBI application. +Any "Rest Client" application may be used (Postman, ...) to interact with NBI +application. diff --git a/docs/index.rst b/docs/index.rst index 5196d1f..f420998 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,5 +1,4 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 Orange ONAP ExternalAPI / NBI diff --git a/docs/installation/installation.rst b/docs/installation/installation.rst index 89a55fb..ebf8c7a 100644 --- a/docs/installation/installation.rst +++ b/docs/installation/installation.rst @@ -1,6 +1,4 @@ -.. This work is licensed under -.. a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE @@ -41,7 +39,8 @@ Defaults Mongo, host=localhost, port=27017, database=ServiceOrderDB - Mariadb, url=jdbc:mariadb://localhost:3306/nbi, username=root, password=secret + Mariadb, url=jdbc:mariadb://localhost:3306/nbi, username=root, + password=secret Run :: @@ -99,4 +98,3 @@ configuration file and */json/* package with samples requests that can be run. **Play with Postman** A collection is available here *docs/offeredapis/postman* - diff --git a/docs/offeredapis/offeredapis.rst b/docs/offeredapis/offeredapis.rst index ce87e03..5b3c4ae 100644 --- a/docs/offeredapis/offeredapis.rst +++ b/docs/offeredapis/offeredapis.rst @@ -87,7 +87,8 @@ API Table "serviceCatalog", ":download:`link <swaggers/serviceCatalog_3_0_0.json>`", ":download:`link <serviceCatalog/documentation.html>`", ":download:`link <serviceCatalog/apiServiceCatalog.plantuml>`", "coming", "coming", "coming" "serviceInventory", ":download:`link <swaggers/serviceInventory_3_0_0.json>`", ":download:`link <serviceInventory/documentation.html>`", ":download:`link <serviceInventory/apiServiceInventory.plantuml>`", "coming", "coming", "coming" "serviceOrder", ":download:`link <swaggers/serviceOrder_3_0_0.json>`", ":download:`link <serviceOrder/documentation.html>`", ":download:`link <serviceOrder/apiServiceOrder.plantuml>`", "coming", ":download:`link <postman/ONAPBeijingServiceOrderDoc.postman_collection.json>`", "coming" - + "listener", ":download:`link <swaggers/listener-1_0_0.json>`", ":download:`link <listener/documentation.html>`", ":download:`link <listener/apiListener.plantuml>`", "coming", "coming", "coming" + "healthCheck", ":download:`link <swaggers/healthCheck_3_0_0.json>`", "coming", "coming", "coming", "coming", "coming" *************** API Description diff --git a/docs/offeredapis/pdf/nbicallflow.pdf b/docs/offeredapis/pdf/nbicallflow.pdf Binary files differindex c84f0dc..8fc564b 100644 --- a/docs/offeredapis/pdf/nbicallflow.pdf +++ b/docs/offeredapis/pdf/nbicallflow.pdf diff --git a/docs/offeredapis/swaggers/healthCheck_3_0_0.json b/docs/offeredapis/swaggers/healthCheck_3_0_0.json new file mode 100644 index 0000000..8092cb0 --- /dev/null +++ b/docs/offeredapis/swaggers/healthCheck_3_0_0.json @@ -0,0 +1,61 @@ +{ + "swagger" : "2.0", + "info" : { + "description" : "This is the ONAP NBI HealthCheck API", + "version" : "3.0.0", + "title" : "NBI HealthCheck API", + "contact" : { + "email" : "romain.gimbert@orange.com" + }, + "license" : { + "name" : "Apache 2.0", + "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" + } + }, + "host" : "serverRoot", + "basePath" : "/nbi/api/v3", + "schemes" : [ "http" ], + "produces": [ + "application/json;charset=utf-8" + ], + "paths" : { + "/status" : { + "get" : { + "summary" : "Displays health status for the NBI component", + "operationId" : "commitInfo", + "description" : "Displays health status for the NBI component", + "responses": { + "200": { + "description": "Service OK", + "schema": { + "$ref": "#/definitions/Status" + } + }, + "503" : { + "description" : "Service Unavailable" + } + } + } + } + }, + "definitions": { + "Status": { + "description": "NBI Status", + "type": "object", + "properties": { + "name": { + "description": "name of NBI component", + "type": "string" + }, + "status": { + "description": "status of NBI component", + "type": "string" + }, + "version": { + "description": "version of NBI component", + "type": "string" + } + } + } + } +} diff --git a/docs/releasenotes/releasenotes.rst b/docs/releasenotes/releasenotes.rst index 1551e3a..cdf3090 100755 --- a/docs/releasenotes/releasenotes.rst +++ b/docs/releasenotes/releasenotes.rst @@ -1,15 +1,13 @@ -.. This work is licensed under a -.. Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 +.. SPDX-License-Identifier: CC-BY-4.0 .. Copyright 2018 ORANGE Release Notes ============= -Version: 3.0.0 +Version: 3.0.1 -------------- -:Release Date: 2018-11-15 +:Release Date: 2018-11-30 **New Features** @@ -21,36 +19,29 @@ Main features are: - `EXTAPI-101 <https://jira.onap.org/browse/EXTAPI-101>`_ - Integrate ExtAPI/NBI to MSB - `EXTAPI-102 <https://jira.onap.org/browse/EXTAPI-102>`_ - Integrate ExtAPI/NBI to an E2E ONAP UC - `EXTAPI-116 <https://jira.onap.org/browse/EXTAPI-116>`_ - Help NBI user to get information when Service order fails -- `EXTAPI-125 <https://jira.onap.org/browse/EXTAPI-125>`_ - Hadd support for progress percentage on ServiceOrder tracking +- `EXTAPI-125 <https://jira.onap.org/browse/EXTAPI-125>`_ - Add support for progress percentage on ServiceOrder tracking Detail of features described in the readTheDoc documentation. -**Bug Fixes** - -- `EXTAPI-70 <https://jira.onap.org/browse/EXTAPI-70>`_ - NBI should add relationship to tenant when creating service-subscription in AAI - - **Known Issues** No new issue (see Beijing ones) **Security Notes** -To be completed - +- `Vulnerability Report <https://wiki.onap.org/pages/viewpage.action?pageId=45301150>`_ + Quick Links: - `External API project page <https://wiki.onap.org/display/DW/External+API+Framework+Project>`_ -- `Passing Badge information for External API <to be completed>`_ -- `Project Vulnerability Review Table for External API <to be completed>`_ **Upgrade Notes** -To be completed +No upgrade available from Beijing **Deprecation Notes** -No deprecated feature from Beijing. +NA **Other** diff --git a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java index eb95792..be8bdc0 100644 --- a/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java +++ b/src/main/java/org/onap/nbi/apis/serviceorder/workflow/SOTaskManager.java @@ -1,106 +1,105 @@ -/** - * Copyright (c) 2018 Orange - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.onap.nbi.apis.serviceorder.workflow; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import org.onap.nbi.apis.serviceorder.model.OrderItemRelationship; -import org.onap.nbi.apis.serviceorder.model.ServiceOrder; -import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem; -import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask; -import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo; -import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository; -import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -@Service -@EnableScheduling -public class SOTaskManager { - - @Autowired - private ExecutionTaskRepository executionTaskRepository; - - @Autowired - private SOTaskProcessor soTaskProcessor; - - private static final Logger LOGGER = LoggerFactory.getLogger(SOTaskManager.class); - - /** - * @param orderItems - * @param serviceOrderInfoJson - */ - private void registerOrderItemExecutionPlan(List<ServiceOrderItem> orderItems, - String serviceOrderInfoJson) { - List<ExecutionTask> executionTasksSaved = new ArrayList<>(); - Map<String, Long> internalIdOrderItemsMap = new HashMap<>(); - if (orderItems != null) { - // first we save create all the execution tasks with order item id in relied tasks - for (ServiceOrderItem orderItem : orderItems) { - ExecutionTask task = new ExecutionTask(); - task.setOrderItemId(orderItem.getId()); - task.setCreateDate(new Date()); - StringBuilder sb = new StringBuilder(); - for (OrderItemRelationship orderItemRelationship : orderItem.getOrderItemRelationship()) { - sb.append(orderItemRelationship.getId()).append(" "); - } - task.setReliedTasks(sb.toString()); - task.setServiceOrderInfoJson(serviceOrderInfoJson); - ExecutionTask savedTask = executionTaskRepository.save(task); - executionTasksSaved.add(savedTask); - - internalIdOrderItemsMap.put(savedTask.getOrderItemId(), savedTask.getInternalId()); - } - // then we replace all orderitem ids in reliedtasks field with internalid of the tasks - for (ExecutionTask executionTask : executionTasksSaved) { - for (Entry<String, Long> entry : internalIdOrderItemsMap.entrySet()) { - String replace = executionTask.getReliedTasks().replace(entry.getKey(), - String.valueOf(entry.getValue())); - executionTask.setReliedTasks(replace); - } - if(LOGGER.isDebugEnabled()) { - LOGGER.debug("saving task with id {} , orderItemId {} , reliedtasks {}", executionTask.getInternalId(), - executionTask.getOrderItemId(), executionTask.getReliedTasks()); - } - executionTaskRepository.save(executionTask); - } - } - } - - /** - * - * @param serviceOrder - * @param serviceOrderInfo - */ - public void registerServiceOrder(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) { - String serviceOrderInfoJson = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo); - registerOrderItemExecutionPlan(serviceOrder.getOrderItem(), serviceOrderInfoJson); - } - - // Using fixedDelay to mitigate against Scheduler queue backlog with fixedRate - @Scheduled(fixedDelay = 2000) - private void processExecutionPlan() throws InterruptedException { - List<ExecutionTask> taskToExecute = executionTaskRepository.findByReliedTasksIsEmpty(); - for (ExecutionTask executionTask : taskToExecute) { - soTaskProcessor.processOrderItem(executionTask); - } - } -} +/**
+ * Copyright (c) 2018 Orange
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
+ * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package org.onap.nbi.apis.serviceorder.workflow;
+
+import java.util.*;
+import java.util.Map.Entry;
+import org.onap.nbi.apis.serviceorder.model.OrderItemRelationship;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrder;
+import org.onap.nbi.apis.serviceorder.model.ServiceOrderItem;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ExecutionTask;
+import org.onap.nbi.apis.serviceorder.model.orchestrator.ServiceOrderInfo;
+import org.onap.nbi.apis.serviceorder.repositories.ExecutionTaskRepository;
+import org.onap.nbi.apis.serviceorder.utils.JsonEntityConverter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+@Service
+@EnableScheduling
+public class SOTaskManager {
+
+ @Autowired
+ private ExecutionTaskRepository executionTaskRepository;
+
+ @Autowired
+ private SOTaskProcessor soTaskProcessor;
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SOTaskManager.class);
+
+ /**
+ * @param orderItems
+ * @param serviceOrderInfoJson
+ */
+ private void registerOrderItemExecutionPlan(List<ServiceOrderItem> orderItems,
+ String serviceOrderInfoJson) {
+ List<ExecutionTask> executionTasksSaved = new ArrayList<>();
+ Map<String, Long> internalIdOrderItemsMap = new HashMap<>();
+ if (orderItems != null) {
+ // first we save create all the execution tasks with order item id in relied tasks
+ for (ServiceOrderItem orderItem : orderItems) {
+ ExecutionTask task = new ExecutionTask();
+ task.setOrderItemId(orderItem.getId());
+ task.setCreateDate(new Date());
+ StringBuilder sb = new StringBuilder();
+ for (OrderItemRelationship orderItemRelationship : orderItem.getOrderItemRelationship()) {
+ sb.append(orderItemRelationship.getId()).append(" ");
+ }
+ task.setReliedTasks(sb.toString());
+ task.setServiceOrderInfoJson(serviceOrderInfoJson);
+ ExecutionTask savedTask = executionTaskRepository.save(task);
+ executionTasksSaved.add(savedTask);
+
+ internalIdOrderItemsMap.put(savedTask.getOrderItemId(), savedTask.getInternalId());
+ }
+ // then we replace all orderitem ids in reliedtasks field with internalid of the tasks
+ for (ExecutionTask executionTask : executionTasksSaved) {
+ List<String> reliedOrderItemsIds = new ArrayList<String>(Arrays.asList(executionTask.getReliedTasks().split(" ")));
+ List<String> reliedTasksInternalIds = new ArrayList<String>();
+ for (Entry<String, Long> entry : internalIdOrderItemsMap.entrySet()){
+ if(reliedOrderItemsIds.contains(entry.getKey())) {
+ reliedTasksInternalIds.add(entry.getValue().toString());
+ }
+ }
+ String reliedTasksString = String.join(" ", reliedTasksInternalIds);
+ executionTask.setReliedTasks(reliedTasksString);
+ if(LOGGER.isDebugEnabled()) {
+ LOGGER.debug("saving task with id {} , orderItemId {} , reliedtasks {}", executionTask.getInternalId(), executionTask.getOrderItemId(), executionTask.getReliedTasks());
+ }
+ executionTaskRepository.save(executionTask);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param serviceOrder
+ * @param serviceOrderInfo
+ */
+ public void registerServiceOrder(ServiceOrder serviceOrder, ServiceOrderInfo serviceOrderInfo) {
+ String serviceOrderInfoJson = JsonEntityConverter.convertServiceOrderInfoToJson(serviceOrderInfo);
+ registerOrderItemExecutionPlan(serviceOrder.getOrderItem(), serviceOrderInfoJson);
+ }
+
+ // Using fixedDelay to mitigate against Scheduler queue backlog with fixedRate
+ @Scheduled(fixedDelay = 2000)
+ private void processExecutionPlan() throws InterruptedException {
+ List<ExecutionTask> taskToExecute = executionTaskRepository.findByReliedTasksIsEmpty();
+ for (ExecutionTask executionTask : taskToExecute) {
+ soTaskProcessor.processOrderItem(executionTask);
+ }
+ }
+}
@@ -0,0 +1,7 @@ +[tox] +envlist = docs +skipsdist = True + +[testenv] +deps = doc8 +commands = doc8 docs |