Merge "Part 1: Refactor CPS Delta code to utility class"
[cps.git] / docs / admin-guide.rst
index c2643f8..8f0634a 100644 (file)
@@ -1,6 +1,6 @@
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
 .. http://creativecommons.org/licenses/by/4.0
-.. Copyright (C) 2021-2022 Nordix Foundation
+.. Copyright (C) 2021-2025 OpenInfra Foundation Europe. All rights reserved.
 
 .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
 .. _adminGuide:
 
 .. DO NOT CHANGE THIS LABEL FOR RELEASE NOTES - EVEN THOUGH IT GIVES A WARNING
 .. _adminGuide:
@@ -12,6 +12,40 @@ CPS Admin Guide
 .. toctree::
    :maxdepth: 1
 
 .. toctree::
    :maxdepth: 1
 
+Regular Maintenance
+===================
+This section details tasks that an administrator of the CPS application should execute on regular basis
+to ensure optimum working of CPS.
+
+Dataspace Clean Up
+------------------
+Certain data in the CPS database might not be explicitly removed after it is no longer required ('orphaned data').
+For example, schema sets and their associated unique module resources no longer used by any anchor because of model upgrades.
+This data would unnecessarily take up space and could eventually affect the performance of the DB if it is not deleted.
+How often this needs to be done depends on how often schema sets are being deprecated.
+Typically once per month should suffice.
+
+To remove orphaned data in a given dataspace use the following post request:
+
+.. code::
+
+    http://<cps-component-service-name>:<cps-port>/v2/admin/dataspaces/<dataspace-name>/actions/clean
+
+for example
+
+.. code-block:: bash
+
+    curl --location --request POST 'http://cps:8080/admin/datsaspaces/bookstore/actions/clean' \
+    --header 'Content-Type: application/json; charset=utf-8'
+
+    Response : HTTP Status 204
+
+For more details refer to the CPS-Core API:  :doc:`design`.
+
+.. note::
+   NCMP has no specific maintenance tasks but it will also build up orphaned data when CM Handles get updated and or deleted.
+   To delete this data execute the above procedure for the dataspace named 'NFP-Operational'.
+
 Logging Configuration
 =====================
 
 Logging Configuration
 =====================
 
@@ -52,7 +86,7 @@ Change logging level
 
 .. code-block:: bash
 
 
 .. code-block:: bash
 
-    curl --location --request GET 'http://{cps-service-name:cps-management-port}/manage/loggers/org.onap.cps' \
+    curl --location --request GET 'http://{cps-service-name:cps-port}/actuator/loggers/org.onap.cps' \
     --header 'Content-Type: application/json; charset=utf-8'
 
     Response body : HTTP Status 200
     --header 'Content-Type: application/json; charset=utf-8'
 
     Response body : HTTP Status 200
@@ -70,7 +104,7 @@ Change logging level
 
 .. code-block:: bash
 
 
 .. code-block:: bash
 
-    curl --location --request POST 'http://{cps-service-name:cps-management-port}/manage/loggers/org.onap.cps' \
+    curl --location --request POST 'http://{cps-service-name:cps-port}/actuator/loggers/org.onap.cps' \
     --header 'Content-Type: application/json; charset=utf-8' \
     --data-raw '{
                     "configuredLevel": "DEBUG"
     --header 'Content-Type: application/json; charset=utf-8' \
     --data-raw '{
                     "configuredLevel": "DEBUG"
@@ -82,7 +116,7 @@ Change logging level
 
 .. code-block:: bash
 
 
 .. code-block:: bash
 
-    curl --location --request GET 'http://{cps-service-name:cps-management-port}/manage/loggers/org.onap.cps' \
+    curl --location --request GET 'http://{cps-service-name:cps-port}/actuator/loggers/org.onap.cps' \
     --header 'Content-Type: application/json; charset=utf-8'
 
     Response body : HTTP Status 200
     --header 'Content-Type: application/json; charset=utf-8'
 
     Response body : HTTP Status 200
@@ -97,7 +131,7 @@ Location of log files
 ---------------------
 By default, Spring Boot will only log to the console and will not write log files.
 
 ---------------------
 By default, Spring Boot will only log to the console and will not write log files.
 
-.. image:: images/cps-service-console.JPG
+.. image:: _static/cps-service-console.JPG
   :width: 700
   :alt: CPS service console
 
   :width: 700
   :alt: CPS service console
 
@@ -111,9 +145,9 @@ Execute CPS service that you want to calculate total elapsed time and log as sho
 
 .. code-block::
 
 
 .. code-block::
 
-   2022-01-28 18:39:17.679 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService   : Execution time of : DataspaceRepository.getByName() with argument[s] = [test42] having result = org.onap.cps.spi.entities.DataspaceEntity@68ded236 :: 205 ms
+   2022-01-28 18:39:17.679 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService   : Execution time of : DataspaceRepository.getByName() with argument[s] = [test42] having result = org.onap.cps.impl.models.DataspaceEntity@68ded236 :: 205 ms
 
 
-   2022-01-28 18:39:17.726 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService   : Execution time of : AnchorRepository.getByDataspaceAndName() with argument[s] = [org.onap.cps.spi.entities.DataspaceEntity@68ded236, bookstore] having result = org.onap.cps.spi.entities.AnchorEntity@71c47fb1 :: 46 ms
+   2022-01-28 18:39:17.726 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService   : Execution time of : AnchorRepository.getByDataspaceAndName() with argument[s] = [org.onap.cps.impl.models.DataspaceEntity@68ded236, bookstore] having result = org.onap.cps.impl.models.AnchorEntity@71c47fb1 :: 46 ms
 
    2022-01-28 18:39:17.768 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService   : Execution time of : CpsAdminPersistenceServiceImpl.getAnchor() with argument[s] = [test42, bookstore] having result = Anchor(name=bookstore, dataspaceName=test42, schemaSetName=bookstore) :: 299 ms
 
 
    2022-01-28 18:39:17.768 DEBUG [cps-application,e17da1571e518c59,e17da1571e518c59] 11128 --- [tp1901272535-29] o.onap.cps.aop.CpsLoggingAspectService   : Execution time of : CpsAdminPersistenceServiceImpl.getAnchor() with argument[s] = [test42, bookstore] having result = Anchor(name=bookstore, dataspaceName=test42, schemaSetName=bookstore) :: 299 ms
 
@@ -159,8 +193,6 @@ Logger configuration is provided as a chart resource :
     +================================+===============================================================================================================================================+
     | cps-core                       | `logback-spring.xml <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-core/resources/config/logback-spring.xml>`__       |
     +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
     +================================+===============================================================================================================================================+
     | cps-core                       | `logback-spring.xml <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-core/resources/config/logback-spring.xml>`__       |
     +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
-    | cps-temporal                   | `logback.xml <https://github.com/onap/oom/blob/master/kubernetes/cps/components/cps-temporal/resources/config/logback.xml>`__                 |
-    +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
     | ncmp-dmi-plugin                | Not yet applicable to DMI-Plugin                                                                                                              |
     +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
 
     | ncmp-dmi-plugin                | Not yet applicable to DMI-Plugin                                                                                                              |
     +--------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
 
@@ -173,7 +205,7 @@ Once CPS-Core is deployed, information related to the running instance of the ap
 
 .. code::
 
 
 .. code::
 
-    http://<cps-component-service-name>:8081/manage/info/
+    http://<cps-component-service-name>:8080/actuator/info/
 
 Health
 ------
 
 Health
 ------
@@ -183,16 +215,33 @@ This also includes both the liveliness state and readiness state.
 
 .. code::
 
 
 .. code::
 
-    http://<cps-component-service-name>:8081/manage/health/
+    http://<cps-component-service-name>:8080/actuator/health/
 
 Metrics
 -------
 
 
 Metrics
 -------
 
+Below table lists all CPS-NCMP custom metrics
+
+.. csv-table::
+    :file: csv/metrics.csv
+    :widths: 50, 50
+    :header-rows: 1
+
 Prometheus Metrics can be checked at the following endpoint
 
 .. code::
 
 Prometheus Metrics can be checked at the following endpoint
 
 .. code::
 
-    http://<cps-component-service-name>:8081/manage/prometheus
+    http://<cps-component-service-name>:8080/actuator/prometheus
+
+Heap Dump and Thread Dump
+-------------------------
+
+On demand heap dump and thread dump generation using the below endpoints.
+
+.. code::
+
+    http://<cps-component-service-name>:8080/actuator/heapdump
+    http://<cps-component-service-name>:8080/actuator/threaddump
 
 Naming Validation
 -----------------
 
 Naming Validation
 -----------------
@@ -200,9 +249,8 @@ Naming Validation
 As part of the Kohn 3.1.0 release, CPS has added validation to the names of the following components:
 
     - Dataspace names
 As part of the Kohn 3.1.0 release, CPS has added validation to the names of the following components:
 
     - Dataspace names
-    - Schema Set names
     - Anchor names
     - Anchor names
-    - Cm-Handle identifiers
+    - CHandle identifiers
 
 The following characters along with spaces are no longer valid for naming of these components.
 
 
 The following characters along with spaces are no longer valid for naming of these components.