From f3ce354b2e6c538b50ed990ba359d3af2283c901 Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Thu, 30 Dec 2021 21:26:15 +0800 Subject: [PATCH] Docs: Add API docs from swagger json file; Add user guide document 1. Convert Swagger json API file to reST format documentation 2. Add user guide document, and make the DMS worked with new document 3. Fix the image miss the helm application 4. Change the configurationId to Id in the SMO endpoint API Signed-off-by: Zhang Rong(Jon) Change-Id: I0572f8b713c946625443d1adc8471a23fedeecff --- Dockerfile | 5 +- README.md | 6 +- charts/templates/deployment.yaml | 2 + charts/values.yaml | 1 + docs/api.rst | 2170 +++++++++++++++++++++++++++++++++++++ docs/index.rst | 4 +- docs/installation-guide.rst | 28 +- docs/user-guide.rst | 211 ++++ o2ims/domain/configuration_obj.py | 1 + o2ims/views/provision_dto.py | 8 +- o2ims/views/provision_view.py | 2 +- tests/unit/test_provision.py | 10 +- 12 files changed, 2430 insertions(+), 18 deletions(-) create mode 100644 docs/api.rst create mode 100644 docs/user-guide.rst diff --git a/Dockerfile b/Dockerfile index d0039fa..1ac328a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,9 @@ COPY configs/ /etc/o2/ COPY tests/ /tests/ -RUN apt-get install -y procps vim +RUN apt-get install -y procps vim curl + +RUN curl -O https://get.helm.sh/helm-v3.3.1-linux-amd64.tar.gz; +RUN tar -zxvf helm-v3.3.1-linux-amd64.tar.gz; cp linux-amd64/helm /usr/local/bin WORKDIR /src diff --git a/README.md b/README.md index aae2c5c..07aa32e 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,10 @@ kubectl get pods -A ## setup local repo: o2imsrepo ```sh -helm repo add chartmuseum https://chartmuseum.github.io/charts +# helm repo add chartmuseum https://chartmuseum.github.io/charts +# helm repo update +helm pull chartmuseum/chartmuseum # download chartmuseum-3.4.0.tgz to local +tar zxvf chartmuseum-3.4.0.tgz export NODE_IP= @@ -143,6 +146,7 @@ service: type: NodePort nodePort: 30330 EOF + helm install chartmuseumrepo chartmuseum/chartmuseum -f chartmuseum-override.yaml kubectl get pods Kubectl get services diff --git a/charts/templates/deployment.yaml b/charts/templates/deployment.yaml index cdb54d6..357823e 100644 --- a/charts/templates/deployment.yaml +++ b/charts/templates/deployment.yaml @@ -127,6 +127,8 @@ spec: value: "1" - name: REDIS_HOST value: redis + - name: K8S_KUBECONFIG + value: {{ .Values.ocloud.K8S_KUBECONFIG }} volumeMounts: - name: scripts mountPath: /opt diff --git a/charts/values.yaml b/charts/values.yaml index 1008681..f14a81d 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -41,3 +41,4 @@ ocloud: OS_AUTH_URL: "" OS_USERNAME: "" OS_PASSWORD: "" + K8S_KUBECONFIG: "" diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..a97adb1 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,2170 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. Copyright (C) 2021 Wind River Systems, Inc. + +O-Cloud O2 Services API 1.0.0 +============================= + +.. toctree:: + :maxdepth: 3 + + +Description +~~~~~~~~~~~ + +Swagger OpenAPI document for O-Cloud O2 Services + + + + + +Base URL +~~~~~~~~ + +http(s)://:30205/ + +O2DMS_LCM +~~~~~~~~~ + + +DMS LCM related operations. + + + + + +POST ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment`` +---------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + + +.. _d_1cdf8e618b9847878bed90d4897e6b3a: + +Body +^^^^ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + descriptorId | No | string | | | + name | No | string | | | + parentDeploymentId | No | string | | | + +.. code-block:: javascript + + { + "description": "somestring", + "descriptorId": "somestring", + "name": "somestring", + "parentDeploymentId": "somestring" + } + +Responses ++++++++++ + +**201** +^^^^^^^ + +Success + + +Type: :ref:`NfDeploymentCreateRespDto ` + +**Example:** + +.. code-block:: javascript + + { + "id": "somestring" + } + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +POST ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor`` +-------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + + +.. _d_1583b74cb6544a428fadd82cb4ff4b3b: + +Body +^^^^ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + artifactName | No | string | | | + artifactRepoUrl | No | string | | | + description | No | string | | | + inputParams | No | string | | | + name | No | string | | | + outputParams | No | string | | | + +.. code-block:: javascript + + { + "artifactName": "somestring", + "artifactRepoUrl": "somestring", + "description": "somestring", + "inputParams": "somestring", + "name": "somestring", + "outputParams": "somestring" + } + +Responses ++++++++++ + +**201** +^^^^^^^ + +Success + + +Type: :ref:`NfDeploymentDescriptorCreateRespDto ` + +**Example:** + +.. code-block:: javascript + + { + "id": "somestring" + } + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +DELETE ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}`` +----------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + nfDeploymentId | path | Yes | string | | | ID of the NfDeployment + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Responses ++++++++++ + +**204** +^^^^^^^ + +NfDeployment deleted + + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +DELETE ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}`` +------------------------------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + nfDeploymentDescriptorId | path | Yes | string | | | ID of the NfDeploymentDescriptor + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Responses ++++++++++ + +**204** +^^^^^^^ + +NfDeploymentDescriptor deleted + + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}`` +-------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + nfDeploymentId | path | Yes | string | | | ID of the NfDeployment + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`NfDeploymentGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "description": "somestring", + "descriptorId": "somestring", + "id": "somestring", + "name": "somestring", + "parentDeploymentId": "somestring", + "status": 1 + } + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}`` +---------------------------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + nfDeploymentDescriptorId | path | Yes | string | | | ID of the NfDeploymentDescriptor + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`NfDeploymentDescriptorGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "artifactName": "somestring", + "artifactRepoUrl": "somestring", + "description": "somestring", + "id": "somestring", + "inputParams": "somestring", + "name": "somestring", + "outputParams": "somestring" + } + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment`` +--------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`NfDeploymentGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "description": "somestring", + "descriptorId": "somestring", + "id": "somestring", + "name": "somestring", + "parentDeploymentId": "somestring", + "status": 1 + }, + { + "description": "somestring", + "descriptorId": "somestring", + "id": "somestring", + "name": "somestring", + "parentDeploymentId": "somestring", + "status": 1 + } + ] + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor`` +------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`NfDeploymentDescriptorGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "artifactName": "somestring", + "artifactRepoUrl": "somestring", + "description": "somestring", + "id": "somestring", + "inputParams": "somestring", + "name": "somestring", + "outputParams": "somestring" + }, + { + "artifactName": "somestring", + "artifactRepoUrl": "somestring", + "description": "somestring", + "id": "somestring", + "inputParams": "somestring", + "name": "somestring", + "outputParams": "somestring" + } + ] + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +GET ``/o2dms/{deploymentManagerID}`` +------------------------------------ + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`DmsGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "capabilities": "somestring", + "capacity": "somestring", + "deploymentManagerId": "somestring", + "description": "somestring", + "name": "somestring", + "supportedLocations": "somestring" + } + +**404** +^^^^^^^ + +Deployment manager not found + + + + + + +PUT ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}`` +-------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + nfDeploymentId | path | Yes | string | | | ID of the NfDeployment + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + + +.. _d_1a0e59d24d7db279637f186c203d883d: + +Body +^^^^ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + name | No | string | | | + parentDeploymentId | No | string | | | + +.. code-block:: javascript + + { + "description": "somestring", + "name": "somestring", + "parentDeploymentId": "somestring" + } + +Responses ++++++++++ + +**404** +^^^^^^^ + +DMS LCM not found + + + + + + +PUT ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}`` +---------------------------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + nfDeploymentDescriptorId | path | Yes | string | | | ID of the NfDeploymentDescriptor + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + + +.. _d_5a6ee319c7ac35eac173da7d57136a98: + +Body +^^^^ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + artifactName | No | string | | | + artifactRepoUrl | No | string | | | + description | No | string | | | + inputParams | No | string | | | + name | No | string | | | + outputParams | No | string | | | + +.. code-block:: javascript + + { + "artifactName": "somestring", + "artifactRepoUrl": "somestring", + "description": "somestring", + "inputParams": "somestring", + "name": "somestring", + "outputParams": "somestring" + } + +Responses ++++++++++ + +**404** +^^^^^^^ + +DMS LCM not found + + + + + +O2IMS_INVENTORY +~~~~~~~~~~~~~~~ + + +IMS Inventory related operations. + + + + + +POST ``/o2ims_infrastructureInventory/v1/subscriptions`` +-------------------------------------------------------- + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + + +.. _d_0fff8519707c32c34f86d6ac19fad342: + +Body +^^^^ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + callback | Yes | string | | | Subscription callback address + consumerSubscriptionId | No | string | | | + filter | No | string | | | + +.. code-block:: javascript + + { + "callback": "somestring", + "consumerSubscriptionId": "somestring", + "filter": "somestring" + } + +Responses ++++++++++ + +**201** +^^^^^^^ + +Success + + +Type: :ref:`SubscriptionCreatedRespDto ` + +**Example:** + +.. code-block:: javascript + + { + "subscriptionId": "somestring" + } + + + + + +DELETE ``/o2ims_infrastructureInventory/v1/subscriptions/{subscriptionID}`` +--------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + subscriptionID | path | Yes | string | | | ID of the subscription + + +Request ++++++++ + + +Responses ++++++++++ + +**204** +^^^^^^^ + +Subscription deleted + + +**404** +^^^^^^^ + +Subscription not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/deploymentManagers/{deploymentManagerID}`` +---------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + deploymentManagerID | path | Yes | string | | | ID of the deployment manager + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`DeploymentManagerGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "capabilities": "somestring", + "capacity": "somestring", + "deploymentManagementServiceEndpoint": "somestring", + "deploymentManagerId": "somestring", + "description": "somestring", + "name": "somestring", + "supportedLocations": "somestring" + } + +**404** +^^^^^^^ + +Deployment manager not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/resourcePools/{resourcePoolID}/resources/{resourceID}`` +----------------------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + resourceID | path | Yes | string | | | ID of the resource + resourcePoolID | path | Yes | string | | | ID of the resource pool + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`ResourceGetDto2 ` + +**Example:** + +.. code-block:: javascript + + { + "children": [ + { + "children": [ + { + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + }, + { + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + } + ], + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + }, + { + "children": [ + { + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + }, + { + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + } + ], + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + } + ], + "description": "somestring", + "elements": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + } + +**404** +^^^^^^^ + +Resource not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/resourcePools/{resourcePoolID}`` +------------------------------------------------------------------------ + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + resourcePoolID | path | Yes | string | | | ID of the resource pool + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`ResourcePoolGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "description": "somestring", + "globalLocationId": "somestring", + "location": "somestring", + "name": "somestring", + "resourcePoolId": "somestring" + } + +**404** +^^^^^^^ + +Resource pool not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/resourceTypes/{resourceTypeID}`` +------------------------------------------------------------------------ + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + resourceTypeID | path | Yes | string | | | ID of the resource type + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`ResourceTypeGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "description": "somestring", + "name": "somestring", + "resourceTypeId": "somestring", + "vendor": "somestring", + "version": "somestring" + } + +**404** +^^^^^^^ + +Resource type not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/subscriptions/{subscriptionID}`` +------------------------------------------------------------------------ + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + subscriptionID | path | Yes | string | | | ID of the subscription + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`SubscriptionGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "callback": "somestring", + "consumerSubscriptionId": "somestring", + "filter": "somestring", + "subscriptionId": "somestring" + } + +**404** +^^^^^^^ + +Subscription not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/subscriptions`` +------------------------------------------------------- + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`SubscriptionGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "callback": "somestring", + "consumerSubscriptionId": "somestring", + "filter": "somestring", + "subscriptionId": "somestring" + }, + { + "callback": "somestring", + "consumerSubscriptionId": "somestring", + "filter": "somestring", + "subscriptionId": "somestring" + } + ] + + + + + +GET ``/o2ims_infrastructureInventory/v1/deploymentManagers`` +------------------------------------------------------------ + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`DeploymentManagerGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "capabilities": "somestring", + "capacity": "somestring", + "deploymentManagementServiceEndpoint": "somestring", + "deploymentManagerId": "somestring", + "description": "somestring", + "name": "somestring", + "supportedLocations": "somestring" + }, + { + "capabilities": "somestring", + "capacity": "somestring", + "deploymentManagementServiceEndpoint": "somestring", + "deploymentManagerId": "somestring", + "description": "somestring", + "name": "somestring", + "supportedLocations": "somestring" + } + ] + + + + + +GET ``/o2ims_infrastructureInventory/v1/`` +------------------------------------------ + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`OcloudDto ` + +**Example:** + +.. code-block:: javascript + + { + "description": "somestring", + "globalCloudId": "somestring", + "infrastructureManagementServiceEndpoint": "somestring", + "name": "somestring", + "oCloudId": "somestring" + } + +**404** +^^^^^^^ + +oCloud not found + + + + + + +GET ``/o2ims_infrastructureInventory/v1/resourcePools`` +------------------------------------------------------- + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`ResourcePoolGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "description": "somestring", + "globalLocationId": "somestring", + "location": "somestring", + "name": "somestring", + "resourcePoolId": "somestring" + }, + { + "description": "somestring", + "globalLocationId": "somestring", + "location": "somestring", + "name": "somestring", + "resourcePoolId": "somestring" + } + ] + + + + + +GET ``/o2ims_infrastructureInventory/v1/resourceTypes`` +------------------------------------------------------- + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`ResourceTypeGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "description": "somestring", + "name": "somestring", + "resourceTypeId": "somestring", + "vendor": "somestring", + "version": "somestring" + }, + { + "description": "somestring", + "name": "somestring", + "resourceTypeId": "somestring", + "vendor": "somestring", + "version": "somestring" + } + ] + + + + + +GET ``/o2ims_infrastructureInventory/v1/resourcePools/{resourcePoolID}/resources`` +---------------------------------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + resourcePoolID | path | Yes | string | | | ID of the resource pool + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`ResourceListDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "description": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + }, + { + "description": "somestring", + "name": "somestring", + "parentId": "somestring", + "resourceId": "somestring", + "resourcePoolId": "somestring", + "resourceTypeId": "somestring" + } + ] + + + + +PROVISION +~~~~~~~~~ + + +Provision related operations. + + + + + +POST ``/provision/v1/smo-endpoint`` +----------------------------------- + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + + +.. _d_18b723a8578a1c0bdb13e962c902ad94: + +Body +^^^^ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + endpoint | Yes | string | | | Configuration SMO callback address + +.. code-block:: javascript + + { + "endpoint": "somestring" + } + +Responses ++++++++++ + +**201** +^^^^^^^ + +Success + + +Type: :ref:`SmoEndpointCreatedRespDto ` + +**Example:** + +.. code-block:: javascript + + { + "id": "somestring" + } + + + + + +DELETE ``/provision/v1/smo-endpoint/{configurationID}`` +------------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + configurationID | path | Yes | string | | | ID of the SMO endpoint configuration + + +Request ++++++++ + + +Responses ++++++++++ + +**204** +^^^^^^^ + +Configuration deleted + + +**404** +^^^^^^^ + +SMO Endpoint configuration not found + + + + + + +GET ``/provision/v1/smo-endpoint/{configurationID}`` +---------------------------------------------------- + + + + +Parameters +++++++++++ + +.. csv-table:: + :delim: | + :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 15, 10, 10, 10, 20, 30 + + configurationID | path | Yes | string | | | ID of the SMO endpoint configuration + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: :ref:`SmoEndpointGetDto ` + +**Example:** + +.. code-block:: javascript + + { + "comments": "somestring", + "endpoint": "somestring", + "id": "somestring", + "status": "somestring" + } + +**404** +^^^^^^^ + +SMO Endpoint configuration not found + + + + + + +GET ``/provision/v1/smo-endpoint`` +---------------------------------- + + + + + +Request ++++++++ + + +Headers +^^^^^^^ + +.. code-block:: javascript + + X-Fields: An optional fields mask + + +Responses ++++++++++ + +**200** +^^^^^^^ + +Success + + +Type: array of :ref:`SmoEndpointGetDto ` + + +**Example:** + +.. code-block:: javascript + + [ + { + "comments": "somestring", + "endpoint": "somestring", + "id": "somestring", + "status": "somestring" + }, + { + "comments": "somestring", + "endpoint": "somestring", + "id": "somestring", + "status": "somestring" + } + ] + + + + +Data Structures +~~~~~~~~~~~~~~~ + +.. _d_e936cc219a004ab92ac027b2690bdd5e: + +DeploymentManagerGetDto Model Structure +--------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + capabilities | No | string | | | + capacity | No | string | | | + deploymentManagementServiceEndpoint | No | string | | | + deploymentManagerId | Yes | string | | | Deployment manager ID + description | No | string | | | + name | No | string | | | + supportedLocations | No | string | | | + +.. _d_086ee84f2c2cf010478bfc73a87b5e80: + +DmsGetDto Model Structure +------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + capabilities | No | string | | | + capacity | No | string | | | + deploymentManagerId | Yes | string | | | Deployment manager ID + description | No | string | | | + name | No | string | | | + supportedLocations | No | string | | | + +.. _d_1cdf8e618b9847878bed90d4897e6b4a: + +NfDeploymentCreateDto Model Structure +------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + descriptorId | No | string | | | + name | No | string | | | + parentDeploymentId | No | string | | | + +.. _d_c00d46ffd3e149e2989d2a5264585581: + +NfDeploymentCreateRespDto Model Structure +----------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + id | Yes | string | | | NfDeployment ID + +.. _d_1583b74cb6544a428fadd82cb4ff4b4b: + +NfDeploymentDescriptorCreateDto Model Structure +----------------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + artifactName | No | string | | | + artifactRepoUrl | No | string | | | + description | No | string | | | + inputParams | No | string | | | + name | No | string | | | + outputParams | No | string | | | + +.. _d_67c3fe14b244e803ad34a57f27b4bb4e: + +NfDeploymentDescriptorCreateRespDto Model Structure +--------------------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + id | Yes | string | | | NfDeploymentDescriptor ID + +.. _d_5bdce8ac307530aa532cc25654cd5b07: + +NfDeploymentDescriptorGetDto Model Structure +-------------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + artifactName | No | string | | | + artifactRepoUrl | No | string | | | + description | No | string | | | + id | Yes | string | | | NfDeploymentDescriptor ID + inputParams | No | string | | | + name | No | string | | | + outputParams | No | string | | | + +.. _d_5a6ee319c7ac35eac173da7d57136a99: + +NfDeploymentDescriptorUpdateDto Model Structure +----------------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + artifactName | No | string | | | + artifactRepoUrl | No | string | | | + description | No | string | | | + inputParams | No | string | | | + name | No | string | | | + outputParams | No | string | | | + +.. _d_e28dc7c38126e125615678304c7a9508: + +NfDeploymentGetDto Model Structure +---------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + descriptorId | No | string | | | + id | Yes | string | | | NfDeployment ID + name | No | string | | | + parentDeploymentId | No | string | | | + status | No | integer | | | + +.. _d_1a0e59d24d7db279637f186c203d884d: + +NfDeploymentUpdateDto Model Structure +------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + name | No | string | | | + parentDeploymentId | No | string | | | + +.. _d_24d46c2729680edc54e60b2dfbea8ebf: + +OcloudDto Model Structure +------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + globalCloudId | No | string | | | + infrastructureManagementServiceEndpoint | No | string | | | + name | No | string | | | + oCloudId | Yes | string | | | + +.. _d_6d49595cea3e0fa957a06fb11bda4897: + +ResourceGetDto0 Model Structure +------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + elements | No | string | | | + name | No | string | | | + parentId | No | string | | | + resourceId | Yes | string | | | Resource ID + resourcePoolId | No | string | | | + resourceTypeId | No | string | | | + +.. _d_bb8426c45d4d19dc6128fbb298c7bb4d: + +ResourceGetDto1 Model Structure +------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + children | No | array of :ref:`ResourceGetDto0 ` | | | + description | No | string | | | + elements | No | string | | | + name | No | string | | | + parentId | No | string | | | + resourceId | Yes | string | | | Resource ID + resourcePoolId | No | string | | | + resourceTypeId | No | string | | | + +.. _d_958dd46196a624722ba9ea3ea4d27e38: + +ResourceGetDto2 Model Structure +------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + children | No | array of :ref:`ResourceGetDto1 ` | | | + description | No | string | | | + elements | No | string | | | + name | No | string | | | + parentId | No | string | | | + resourceId | Yes | string | | | Resource ID + resourcePoolId | No | string | | | + resourceTypeId | No | string | | | + +.. _d_942ff02bfe350c7d2a7f3faabf5d77d1: + +ResourceListDto Model Structure +------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + name | No | string | | | + parentId | No | string | | | + resourceId | Yes | string | | | Resource ID + resourcePoolId | No | string | | | + resourceTypeId | No | string | | | + +.. _d_296e5d50362a85c0b8843dfe38965ce9: + +ResourcePoolGetDto Model Structure +---------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + globalLocationId | No | string | | | + location | No | string | | | + name | No | string | | | + resourcePoolId | Yes | string | | | Resource pool ID + +.. _d_fb92075f954e3895d1435d4e523666fa: + +ResourceTypeGetDto Model Structure +---------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + description | No | string | | | + name | No | string | | | + resourceTypeId | Yes | string | | | Resource type ID + vendor | No | string | | | + version | No | string | | | + +.. _d_18b723a8578a1c0bdb13e962c902ad95: + +SmoEndpointCreateDto Model Structure +------------------------------------ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + endpoint | Yes | string | | | Configuration SMO callback address + +.. _d_36a34be9221cecc9bf82d276b9266961: + +SmoEndpointCreatedRespDto Model Structure +----------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + id | Yes | string | | | SMO Endpoint Configuration ID + +.. _d_a6b61d9695be919cc22b2e700eeb7e27: + +SmoEndpointGetDto Model Structure +--------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + comments | No | string | | | + endpoint | No | string | | | + id | Yes | string | | | SMO Endpoint Configuration ID + status | No | string | | | + +.. _d_0fff8519707c32c34f86d6ac19fad343: + +SubscriptionCreateDto Model Structure +------------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + callback | Yes | string | | | Subscription callback address + consumerSubscriptionId | No | string | | | + filter | No | string | | | + +.. _d_4397329931bf78862bc91387dbdb86c4: + +SubscriptionCreatedRespDto Model Structure +------------------------------------------ + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + subscriptionId | Yes | string | | | Subscription ID + +.. _d_90e532f740e7ec8e9d71fad08513c388: + +SubscriptionGetDto Model Structure +---------------------------------- + +.. csv-table:: + :delim: | + :header: "Name", "Required", "Type", "Format", "Properties", "Description" + :widths: 20, 10, 15, 15, 30, 25 + + callback | No | string | | | + consumerSubscriptionId | No | string | | | + filter | No | string | | | + subscriptionId | Yes | string | | | Subscription ID + diff --git a/docs/index.rst b/docs/index.rst index e9f0d9a..fb8c0e7 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,7 @@ .. Copyright (C) 2021 Wind River Systems, Inc. .. rtp documentation master -Welcome to RTP O2 ducomentation +Welcome to RTP O2 documentation =============================== @@ -15,5 +15,7 @@ Welcome to RTP O2 ducomentation developer-guide.rst release-notes.rst installation-guide.rst + user-guide.rst + api.rst * :ref:`search` diff --git a/docs/installation-guide.rst b/docs/installation-guide.rst index ff51d0f..20cbb00 100644 --- a/docs/installation-guide.rst +++ b/docs/installation-guide.rst @@ -87,7 +87,7 @@ The following instruction should be done outside of INF platform controller host source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first. echo "source <(kubectl completion bash)" >> ~/.bashrc # add autocomplete permanently to your bash shell. - curl https://get.helm.sh/helm-v3.5.3-linux-amd64.tar.gz --output helm-v3.5.3-linux-amd64.tar.gz + curl -O https://get.helm.sh/helm-v3.5.3-linux-amd64.tar.gz tar xvf helm-v3.5.3-linux-amd64.tar.gz sudo cp linux-amd64/helm /usr/local/bin/ @@ -128,9 +128,12 @@ The following instruction should be done outside of INF platform controller host export NAMESPACE=orano2 kubectl create ns ${NAMESPACE} - export OS_AUTH_URL= - export OS_USERNAME= - export OS_PASSWORD= + # default kube config location is ~/.kube/config + cp ~/.kube/config o2/charts/resources/scripts/init/k8s_kube.conf + + export OS_AUTH_URL= + export OS_USERNAME= + export OS_PASSWORD= cat <o2service-override.yaml o2ims: @@ -145,6 +148,7 @@ The following instruction should be done outside of INF platform controller host OS_AUTH_URL: "${OS_AUTH_URL}" OS_USERNAME: "${OS_USERNAME}" OS_PASSWORD: "${OS_PASSWORD}" + K8S_KUBECONFIG: "/opt/k8s_kube.conf" EOF @@ -164,10 +168,15 @@ The following instruction should be done outside of INF platform controller host .. code:: shell - curl -k http(s)://:30205 curl -k http(s)://:30205/o2ims_infrastructureInventory/v1/ +2.5 O2 Service API Swagger +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- Swagger UI can be found with URL: http(s)://:30205 + + 3. Register O-Cloud to SMO -------------------------- @@ -176,12 +185,21 @@ The following instruction should be done outside of INF platform controller host .. code:: shell + curl -X 'GET' \ + 'http(s)://:30205/provision/v1/smo-endpoint' \ + -H 'accept: application/json' + curl -k -X 'POST' \ 'http(s)://:30205/provision/v1/smo-endpoint' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{"endpoint": ""}' + # Confirm SMO endpoint provision status + curl -X 'GET' \ + 'http(s)://:30205/provision/v1/smo-endpoint' \ + -H 'accept: application/json' + References ---------- diff --git a/docs/user-guide.rst b/docs/user-guide.rst new file mode 100644 index 0000000..9a11012 --- /dev/null +++ b/docs/user-guide.rst @@ -0,0 +1,211 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. Copyright (C) 2021 Wind River Systems, Inc. + +O-Cloud O2 Service User Guide +============================= + +This guide will introduce the process that make O2 interface work with +SMO. + +- Assume you have an O-Cloud O2 environment + +- Discover O-Cloud inventory + + - O-Cloud auto discovery + + After you installed the O-Cloud service, it will automatically + discover the INF through the parameters that you give from the + “*o2service-override.yaml*” + + Below command can get the O-Cloud information + + .. code:: shell + + curl -X 'GET' \ + 'http://:30205/o2ims_infrastructureInventory/v1/' \ + -H 'accept: application/json' + + - Resource pool + + One O-Cloud have one resource pool, all the resources that belong + to this O-Cloud will be organized into this resource pool + + Get the resource pool information through this interface + + .. code:: shell + + curl -X 'GET' \ + 'http://:30205/o2ims_infrastructureInventory/v1/resourcePools' \ + -H 'accept: application/json' + + - Resource type + + Resource type defined what type is the specified resource, like a + physical machine, memory, or CPU + + Show all resource type + + .. code:: shell + + curl -X 'GET' \ + 'http://:30205/o2ims_infrastructureInventory/v1/resourceTypes' \ + -H 'accept: application/json' + + - Resource + + Get the list of all resources, the value of *resourcePoolId* from + the result of resource pool interface + + .. code:: shell + + curl -X 'GET' \ + "http://:30205/o2ims_infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources" \ + -H 'accept: application/json' + + Get detail of one resource + + .. code:: shell + + curl -X 'GET' \ + "http://:30205/o2ims_infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}" \ + -H 'accept: application/json' + + - Deployment manager services endpoint + + The Deployment Manager Service (DMS) that related to this IMS + information you can use below API to check + + .. code:: shell + + curl -X 'GET' \ + 'http://:30205/o2ims_infrastructureInventory/v1/deploymentManagers' \ + -H 'accept: application/json' + +- Subscribe to the O-Cloud resource change notification + + Assume you have a SMO, and the SMO have an API can be receive + callback request + + - Create subscription in O-Cloud IMS + + .. code:: bash + + curl -X 'POST' \ + 'http://:30205/o2ims_infrastructureInventory/v1/subscriptions' \ + -H 'accept: application/json' \ + -H 'Content-Type: application/json' \ + -d '{ + "callback": "http://SMO/address/to/callback", + "consumerSubscriptionId": "", + "filter": "" + }' + + - Handle resource change notification + + When the SMO callback API get the notification that the resource + of O-Cloud changing, use the URL to get the latest resource + information to update its database + +- Orchestrate CNF in helm chart + + On this sample, we prepare a firewall chart to test the + orchestration. + + We need to do some preparation to make the helm repo work and include + our firewall chart inside of the repository. + + Get the DMS Id in the O-Cloud, and set it into bash environment + + .. code:: bash + + curl --location --request GET 'http://:30205/o2ims_infrastructureInventory/v1/deploymentManagers' + + export dmsId=`curl --location --request GET 'http://:30205/o2ims_infrastructureInventory/v1/deploymentManagers' 2>/dev/null | jq .[].deploymentManagerId | xargs echo` + + Using helm to deploy a chartmuseum to the INF + + .. code:: bash + + helm pull chartmuseum/chartmuseum # download chartmuseum-3.4.0.tgz to local + tar zxvf chartmuseum-3.4.0.tgz + cat <chartmuseum-override.yaml + env: + open: + DISABLE_API: false + service: + type: NodePort + nodePort: 30330 + EOF + + helm install chartmuseumrepo chartmuseum/chartmuseum -f chartmuseum-override.yaml + kubectl get pods + Kubectl get services + + Update the helm repo and add the chartmusem into the repository + + .. code:: bash + + helm repo add o2imsrepo http://${NODE_IP}:30330 + helm repo update + + Download the firewall chart and push it into the repository + + .. code:: bash + + git clone https://github.com/biny993/firewall-host-netdevice.git + tar -zcvf firewall-host-netdevice-1.0.0.tgz firewall-host-netdevice/ + helm push firewall-host-netdevice-1.0.0.tgz o2imsrepo + helm repo update + helm search repo firewall + + - Create NfDeploymentDescriptor + + .. code:: bash + + curl --location --request POST "http://:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor" \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "cfwdesc1", + "description": "demo nf deployment descriptor", + "artifactRepoUrl": "http://${NODE_IP}:30330", + "artifactName": "firewall-host-netdevice", + "inputParams": + "{\n \"image\": {\n \"repository\": \"ubuntu\",\n \"tag\": 18.04,\n \"pullPolicy\": \"IfNotPresent\"\n },\n \"resources\": {\n \"cpu\": 2,\n \"memory\": \"2Gi\",\n \"hugepage\": \"256Mi\",\n \"unprotectedNetPortVpg\": \"veth11\",\n \"unprotectedNetPortVfw\": \"veth12\",\n \"unprotectedNetCidr\": \"10.10.1.0/24\",\n \"unprotectedNetGwIp\": \"10.10.1.1\",\n \"protectedNetPortVfw\": \"veth21\",\n \"protectedNetPortVsn\": \"veth22\",\n \"protectedNetCidr\": \"10.10.2.0/24\",\n \"protectedNetGwIp\": \"10.10.2.1\",\n \"vfwPrivateIp0\": \"10.10.1.1\",\n \"vfwPrivateIp1\": \"10.10.2.1\",\n \"vpgPrivateIp0\": \"10.10.1.2\",\n \"vsnPrivateIp0\": \"10.10.2.2\"\n }\n}", + "outputParams": "{\"output1\": 100}" + }' + + curl --location --request GET "http://:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor" + + - Create NfDeployment + + When you have an descriptor of deployment, you can create a + NfDeployment, it will trigger an event inside of the IMS/DMS, and + use the K8S API to create a real pod of the firewall sample + + .. code:: bash + + curl --location --request POST "http://:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "name": "cfw100", + "description": "demo nf deployment", + "descriptorId": "", + "parentDeploymentId": "" + }' + + curl --location --request GET "http://:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" + + - Check pods of the firewall sample + + .. code:: bash + + kubectl get pods + + - Delete the deployment we just created + + .. code:: shell + + export NfDeploymentId=`curl --location --request GET 'http://:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment' 2>/dev/null | jq .[].id | xargs echo` + + curl --location --request DELETE "http://:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment/${NfDeploymentId}" diff --git a/o2ims/domain/configuration_obj.py b/o2ims/domain/configuration_obj.py index f7b6c6b..3261b51 100644 --- a/o2ims/domain/configuration_obj.py +++ b/o2ims/domain/configuration_obj.py @@ -49,4 +49,5 @@ class Configuration(AgRoot, Serializer): d = Serializer.serialize(self) d['endpoint'] = d['callback'] + d['id'] = d['configurationId'] return d diff --git a/o2ims/views/provision_dto.py b/o2ims/views/provision_dto.py index f65ac49..fc71b7b 100644 --- a/o2ims/views/provision_dto.py +++ b/o2ims/views/provision_dto.py @@ -22,8 +22,8 @@ class SmoEndpointDTO: endpoint_get = api_provision_v1.model( "SmoEndpointGetDto", { - 'configurationId': fields.String(required=True, - description='Configuration ID'), + 'id': fields.String(required=True, + description='SMO Endpoint Configuration ID'), 'endpoint': fields.String, 'status': fields.String, 'comments': fields.String, @@ -43,7 +43,7 @@ class SmoEndpointDTO: endpoint_post_resp = api_provision_v1.model( "SmoEndpointCreatedRespDto", { - 'configurationId': fields.String(required=True, - description='Configuration ID'), + 'id': fields.String(required=True, + description='SMO Endpoint Configuration ID'), } ) diff --git a/o2ims/views/provision_view.py b/o2ims/views/provision_view.py index 54e5a15..2a389a7 100644 --- a/o2ims/views/provision_view.py +++ b/o2ims/views/provision_view.py @@ -52,7 +52,7 @@ def configuration_create(configurationDto: SmoEndpointDTO.endpoint, len(configuration.events))) uow.commit() _handle_events(bus) - return {"configurationId": conf_uuid} + return {"id": conf_uuid} def configuration_delete(configurationId: str, diff --git a/tests/unit/test_provision.py b/tests/unit/test_provision.py index 3585802..99c4fde 100644 --- a/tests/unit/test_provision.py +++ b/tests/unit/test_provision.py @@ -35,13 +35,13 @@ def test_view_smo_endpoint(mock_uow): configuration_id1 = str(uuid.uuid4()) conf1 = MagicMock() conf1.serialize_smo.return_value = { - "configurationId": configuration_id1, + "id": configuration_id1, } session.return_value.query.return_value = [conf1] configuration_list = provision_view.configurations(uow) assert str(configuration_list[0].get( - "configurationId")) == configuration_id1 + "id")) == configuration_id1 def test_view_smo_endpoint_one(mock_uow): @@ -58,13 +58,13 @@ def test_view_smo_endpoint_one(mock_uow): session.return_value.query.return_value.filter_by.return_value.first.\ return_value.serialize_smo.return_value = { - "configurationId": configuration_id1, + "id": configuration_id1, } configuration_res = provision_view.configuration_one( configuration_id1, uow) assert str(configuration_res.get( - "configurationId")) == configuration_id1 + "id")) == configuration_id1 def test_flask_get_list(mock_flask_uow): @@ -106,7 +106,7 @@ def test_flask_post(mock_flask_uow): 'endpoint': conf_callback }) assert resp.status_code == 201 - assert 'configurationId' in resp.get_json() + assert 'id' in resp.get_json() def test_flask_delete(mock_flask_uow): -- 2.16.6