Docs: update the dms v1 path changes; Fix INF-254 through retry 94/7594/1
authorZhang Rong(Jon) <rong.zhang@windriver.com>
Fri, 21 Jan 2022 06:12:38 +0000 (14:12 +0800)
committerZhang Rong(Jon) <rong.zhang@windriver.com>
Fri, 21 Jan 2022 06:12:38 +0000 (14:12 +0800)
1. Update documents about the dms v1 endpoint changes
2. Add retry for the database mapper creation

Issue-ID: INF-254
Signed-off-by: Zhang Rong(Jon) <rong.zhang@windriver.com>
Change-Id: I5115cdb8333c720ed060032146135071eead7be5

README.md
docs/api.rst
docs/installation-guide.rst
docs/user-guide.rst
o2app/bootstrap.py
o2app/entrypoints/flask_application.py

index 3f15087..01d9710 100644 (file)
--- a/README.md
+++ b/README.md
@@ -264,7 +264,7 @@ docker logs -f o2_redis_pubsub_1
 \r
 curl --location --request GET 'http://localhost:5005/o2ims_infrastructureInventory/v1/deploymentManagers'\r
 export dmsId=<DMS ID>\r
-curl --location --request POST 'http://localhost:5005/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor' \\r
+curl --location --request POST 'http://localhost:5005/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor' \\r
 --header 'Content-Type: application/json' \\r
 --data-raw '{\r
   "name": "cfwdesc1",\r
@@ -276,9 +276,9 @@ curl --location --request POST 'http://localhost:5005/o2dms/${dmsId}/O2dms_Deplo
   "outputParams": "{\"output1\": 100}"\r
 }'\r
 \r
-curl --location --request GET 'http://localhost:5005/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor'\r
+curl --location --request GET 'http://localhost:5005/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor'\r
 \r
-curl --location --request POST 'http://localhost:5005/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment' \\r
+curl --location --request POST 'http://localhost:5005/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment' \\r
 --header 'Content-Type: application/json' \\r
 --data-raw '{\r
   "name": "cfw100",\r
@@ -287,7 +287,7 @@ curl --location --request POST 'http://localhost:5005/o2dms/${dmsId}/O2dms_Deplo
   "parentDeploymentId": ""\r
 }'\r
 \r
-curl --location --request GET 'http://localhost:5005/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment'\r
+curl --location --request GET 'http://localhost:5005/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment'\r
 \r
 export NfDeploymentId=<NfDeployment Id>\r
 \r
@@ -309,5 +309,5 @@ open browswer with url: http://<NODE_IP>:30667
 ## bring down CFW\r
 \r
 ```sh\r
-curl --location --request DELETE 'http://localhost:5005/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment/${NfDeploymentId}'\r
+curl --location --request DELETE 'http://localhost:5005/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment/${NfDeploymentId}'\r
 ```\r
index e593221..4763897 100644 (file)
@@ -12,7 +12,7 @@ INF O2 Services API 1.0.0
 Description
 ~~~~~~~~~~~
 
-Swagger OpenAPI document for INF O2 Services
+Swagger OpenAPI document for the INF O2 Services
 
 
 
@@ -33,8 +33,8 @@ DMS LCM related operations.
 
 
 
-POST ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment``
-----------------------------------------------------------------------------
+POST ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment``
+-------------------------------------------------------------------------------
 
 
 
@@ -116,8 +116,8 @@ DMS LCM not found
 
 
 
-POST ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor``
---------------------------------------------------------------------------------------
+POST ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor``
+-----------------------------------------------------------------------------------------
 
 
 
@@ -203,8 +203,8 @@ DMS LCM not found
 
 
 
-DELETE ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}``
------------------------------------------------------------------------------------------------
+DELETE ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}``
+--------------------------------------------------------------------------------------------------
 
 
 
@@ -244,8 +244,8 @@ DMS LCM not found
 
 
 
-DELETE ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}``
--------------------------------------------------------------------------------------------------------------------
+DELETE ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}``
+----------------------------------------------------------------------------------------------------------------------
 
 
 
@@ -285,8 +285,8 @@ DMS LCM not found
 
 
 
-GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}``
---------------------------------------------------------------------------------------------
+GET ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}``
+-----------------------------------------------------------------------------------------------
 
 
 
@@ -349,8 +349,8 @@ DMS LCM not found
 
 
 
-GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}``
-----------------------------------------------------------------------------------------------------------------
+GET ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}``
+-------------------------------------------------------------------------------------------------------------------
 
 
 
@@ -414,8 +414,8 @@ DMS LCM not found
 
 
 
-GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment``
----------------------------------------------------------------------------
+GET ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment``
+------------------------------------------------------------------------------
 
 
 
@@ -488,8 +488,8 @@ DMS LCM not found
 
 
 
-GET ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor``
--------------------------------------------------------------------------------------
+GET ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor``
+----------------------------------------------------------------------------------------
 
 
 
@@ -564,8 +564,8 @@ DMS LCM not found
 
 
 
-GET ``/o2dms/{deploymentManagerID}``
-------------------------------------
+GET ``/o2dms/v1/{deploymentManagerID}``
+---------------------------------------
 
 
 
@@ -627,8 +627,8 @@ Deployment manager not found
 
 
 
-PUT ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}``
---------------------------------------------------------------------------------------------
+PUT ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeployment/{nfDeploymentId}``
+-----------------------------------------------------------------------------------------------
 
 
 
@@ -685,8 +685,8 @@ DMS LCM not found
 
 
 
-PUT ``/o2dms/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}``
-----------------------------------------------------------------------------------------------------------------
+PUT ``/o2dms/v1/{deploymentManagerID}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor/{nfDeploymentDescriptorId}``
+-------------------------------------------------------------------------------------------------------------------
 
 
 
@@ -1529,6 +1529,8 @@ Parameters
     :header: "Name", "Located in", "Required", "Type", "Format", "Properties", "Description"
     :widths: 20, 15, 10, 10, 10, 20, 30
 
+        parentId | query | No | string |  |  | filter parentId
+        resourceTypeName | query | No | string |  |  | filter resource type
         resourcePoolID | path | Yes | string |  |  | ID of the resource pool
 
 
index 3c92bd3..68f7ed0 100644 (file)
@@ -136,7 +136,7 @@ The following instruction should be done outside of INF platform controller host
   export OS_PASSWORD=<INF password for user e.g.: adminpassword>
 
   # If the external OAM IP same as OS_AUTH_URL's IP address, you can use the below command to set the environment
-  # export API_HOST_EXTERNAL_FLOATING=$(echo ${OS_AUTH_URL/$(echo ${OS_AUTH_URL} | grep :// | sed -e's,^\(.*//\).*,\1,g')} | cut -d/ -f1 | sed -e 's,:.*,,g')
+  # export API_HOST_EXTERNAL_FLOATING=$(echo ${OS_AUTH_URL} | sed -e s,`echo ${OS_AUTH_URL} | grep :// | sed -e's,^\(.*//\).*,\1,g'`,,g | cut -d/ -f1 | sed -e 's,:.*,,g')
   export API_HOST_EXTERNAL_FLOATING=<INF external_oam_floating_address e.g.: 128.10.10.10>
 
   cat <<EOF>o2service-override.yaml
index d1559d8..ca4a19f 100644 (file)
@@ -208,7 +208,7 @@ SMO.
 
       .. code:: bash
 
-         curl --location --request POST "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor" \
+         curl --location --request POST "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor" \
          --header 'Content-Type: application/json' \
          --data-raw '{
            "name": "cfwdesc1",
@@ -220,9 +220,9 @@ SMO.
            "outputParams": "{\"output1\": 100}"
          }'
 
-         curl --location --request GET "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor"
+         curl --location --request GET "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor"
 
-         export descId=` curl -X 'GET'   "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor"   -H 'accept: application/json'   -H 'X-Fields: id' 2>/dev/null | jq .[].id | xargs echo`
+         export descId=` curl -X 'GET'   "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeploymentDescriptor"   -H 'accept: application/json'   -H 'X-Fields: id' 2>/dev/null | jq .[].id | xargs echo`
 
          echo ${descId} # check the exported descriptor id
 
@@ -234,7 +234,7 @@ SMO.
 
       .. code:: bash
 
-         curl --location --request POST "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" \
+         curl --location --request POST "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" \
          --header 'Content-Type: application/json' \
          --data-raw '{
            "name": "cfw100",
@@ -243,7 +243,7 @@ SMO.
            "parentDeploymentId": ""
          }'
 
-         curl --location --request GET "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment"
+         curl --location --request GET "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment"
 
    -  Check pods of the firewall sample
 
@@ -255,8 +255,8 @@ SMO.
 
       .. code:: shell
 
-         export NfDeploymentId=`curl --location --request GET "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" 2>/dev/null | jq .[].id | xargs echo`
+         export NfDeploymentId=`curl --location --request GET "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment" 2>/dev/null | jq .[].id | xargs echo`
 
          echo ${NfDeploymentId} # Check the exported deployment id
 
-         curl --location --request DELETE "http://${OAM_IP}:30205/o2dms/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment/${NfDeploymentId}"
+         curl --location --request DELETE "http://${OAM_IP}:30205/o2dms/v1/${dmsId}/O2dms_DeploymentLifecycle/NfDeployment/${NfDeploymentId}"
index 329d9e2..4413e80 100644 (file)
@@ -40,6 +40,15 @@ def wait_for_db_ready(engine):
     logger.info("DB is ready")
 
 
+@retry(tries=3, delay=2)
+def wait_for_mappers_ready(engine):
+    # wait for mapper ready
+    logger.info("Wait for mapper ready ...")
+    o2ims_orm.start_o2ims_mappers(engine)
+    o2dms_orm.start_o2dms_mappers(engine)
+    logger.info("mapper is ready")
+
+
 def bootstrap(
     start_orm: bool = True,
     uow: unit_of_work.AbstractUnitOfWork = SqlAlchemyUnitOfWork(),
@@ -56,8 +65,7 @@ def bootstrap(
             engine = uow.session.get_bind()
 
             wait_for_db_ready(engine)
-            o2ims_orm.start_o2ims_mappers(engine)
-            o2dms_orm.start_o2dms_mappers(engine)
+            wait_for_mappers_ready(engine)
 
     dependencies = {"uow": uow, "notifications": notifications,
                     "publish": publish}
index cb12fb4..cde0715 100644 (file)
@@ -24,9 +24,8 @@ from o2dms.api import configure_namespace as dms_route_configure_namespace
 app = Flask(__name__)\r
 app.config.SWAGGER_UI_DOC_EXPANSION = 'list'\r
 api = Api(app, version='1.0.0',\r
-          title='INF O2 Services',\r
-          description='Swagger OpenAPI document for \\r
-          the INF O2 Services',\r
+          title='INF O2 Services API',\r
+          description='Swagger OpenAPI document for the INF O2 Services',\r
           )\r
 bus = bootstrap.bootstrap()\r
 \r