blob: 2230c0f42ad26b5c7233f2fab5b88e93b6b42ccb [file] [log] [blame]
elinuxhenrike8f75f42020-09-22 15:49:25 +02001.. This work is licensed under a Creative Commons Attribution 4.0 International License.
2.. http://creativecommons.org/licenses/by/4.0
JohnKeeney70fee182024-01-22 14:04:31 +00003.. Copyright 2023 Nordix Foundation. All rights reserved.
4.. Copyright 2024 OpenInfra Foundation Europe. All rights reserved.
elinuxhenrike8f75f42020-09-22 15:49:25 +02005
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +02006.. _developer_guide:
7
elinuxhenrike8f75f42020-09-22 15:49:25 +02008Developer Guide
9===============
10
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000011This document provides a quickstart for developers of the CCSDK functions for O-RAN A1 Policies.
elinuxhenrike8f75f42020-09-22 15:49:25 +020012
JohnKeeney70fee182024-01-22 14:04:31 +000013.. image:: ../media/ONAP-A1ControllerArchitecture-Montreal.png
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010014 :width: 500pt
15
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020016Source tree
17+++++++++++
elinuxhenrike8f75f42020-09-22 15:49:25 +020018
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010019This provides ONAP CCSDK with "A1 Policy Management Service" and "A1 Adapter" functions.
JohnKeeney069b4692022-05-12 22:15:14 +010020Each resource is implemented independently in a sub-directory corresponding to its name.
elinuxhenrike8f75f42020-09-22 15:49:25 +020021
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020022A1 Policy Management Service
23++++++++++++++++++++++++++++
elinuxhenrike8f75f42020-09-22 15:49:25 +020024
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010025The ONAP CCSDK A1 Policy Management Service (A1-PMS) is a Java 17 web application built using the Spring Framework.
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020026Using Spring Boot dependencies, it runs as a standalone application.
elinuxhenrike8f75f42020-09-22 15:49:25 +020027
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010028A1 Policy Management Service provides a REST API for managing A1 Policies. It provides support for:
elinuxhenrike8f75f42020-09-22 15:49:25 +020029
elinuxhenrike8f75f42020-09-22 15:49:25 +020030 * Consistency monitoring of the SMO view of policies and the actual situation in the RICs
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010031 * Consistency monitoring of near-RT RIC capabilities (e.g. supported A1 Policy Types)
32 * Supervision of clients (e.g. 'rAPPs') that use the northbound interface, to help garbage-collect & remove un-owned policies (e.g. in case of failures)
33 * A1 Policy configuration. This includes:
elinuxhenrike8f75f42020-09-22 15:49:25 +020034
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010035 * One REST API towards all near-RT RICs in the network
36 * Query functions to discover A1 Policy Types supported by each near-RT RIC
37 * Query functions to find all A1 Policy instances in each near-RT RIC, all A1 Policies owned by a service (e.g. rAPP or client), all A1 Policies of certain A1 Policy Type etc.
38 * Create/Modify/Delete operations for A1 Policy Instances in each near-RT RIC
39 * Query functions to check the status of each near-RT RIC, and their A1 Policy Instances.
elinuxhenrike8f75f42020-09-22 15:49:25 +020040
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010041The A1 Policy Management Service can be accessed over the REST API. See :ref:`pms_api` for more information about the API.
elinuxhenrike8f75f42020-09-22 15:49:25 +020042
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010043The configured A1 Policies are stored persistently, and can survive service restart. This state information can be stored in a persistent volume or in an S3 Object Store bucket.
PatrikBuhr24ad7392021-05-19 14:44:43 +020044
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020045Dependencies
46------------
elinuxhenrikea2fcc82020-10-13 16:39:13 +020047
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020048This project uses various frameworks which are managed with Maven
49dependency management tool (see *pom.xml* file at root level) :
50
JohnKeeney069b4692022-05-12 22:15:14 +010051- Swagger annotations
52- `Spring Framework <https://github.com/spring-projects/spring-boot>`_
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010053- `SpringDoc and OpenAPI <https://springdoc.org/>`_ Automated JSON API documentation for APIs built with Spring
JohnKeeney069b4692022-05-12 22:15:14 +010054- `Lombok <https://github.com/rzwitserloot/lombok>`_ to generate code, such as getters and setters
55- `Awaitility <https://github.com/awaitility/awaitility>`_ to test asynchronous functionality
PatrikBuhr9f1d9492023-04-17 13:00:15 +020056
JohnKeeney069b4692022-05-12 22:15:14 +010057
PatrikBuhr01162ea2022-01-12 16:15:34 +010058To get a complete list of all dependencies, use command "mvn dependency:tree".
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020059
60Configuration
61-------------
62
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000063There are two configuration files for A1 Policy Management Service, *config/application_configuration.json* and *config/application.yaml*
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010064The first (*config/application_configuration.json*) contains application-specific configuration needed by the application, such as which near-RT RICs, or controller to use.
JohnKeeney069b4692022-05-12 22:15:14 +010065The second (*config/application.yaml*) contains logging and security configurations.
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020066
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010067For more information about these configuration files can be found as comments in the sample files provided with the source code, or on the `ONAP wiki <https://wiki.onap.org/display/DW/O-RAN+A1+Policies+in+ONAP+London>`_
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000068
JohnKeeney069b4692022-05-12 22:15:14 +010069Static configuration - Settings that cannot be changed at runtime (*application.yaml*)
70--------------------------------------------------------------------------------------
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000071
72The file *./config/application.yaml* is read by the application at startup. It provides the following configurable features:
73
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010074 * *server*; configuration for the WEB server
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000075
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010076 * used port for HTTP/HTTPS, this is however not the port number visible outside the container
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000077 * SSL parameters for setting up using of key store and trust store databases.
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010078 * *webclient*; configuration parameters for a web client used by the component
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000079
80 * SSL parameters for setting up using of key store and trust store databases.
81 * Usage of HTTP(S) Proxy; if configured, the proxy will be used for southbound access to the NearRT-RICs
82
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010083 * *logging*; setting for which information is logged.
84 * *auth-token*; optional authorization token to use for REST call.
85 * *filepath*; the local path to a file used for dynamic configuration (if used). See next chapter.
86 * *persistent storage* of runtime information. Configuration of A1 Policy instances is stored persistently. The media for this can be either filesystem (a persistent volume) or Amazon S3 - Cloud Object Storage.
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000087
88For details about the parameters in this file, see documentation in the file.
89
JohnKeeney069b4692022-05-12 22:15:14 +010090Dynamic configuration - Settings that can be changed at runtime (*application_configuration.json* or REST or ConfigMap)
JohnKeeneyc2077582022-10-27 18:11:42 +010091-----------------------------------------------------------------------------------------------------------------------
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010092The component has configuration that can be updated in runtime. This configuration can either be loaded from a file (accessible from the container), or using the Configuration REST API. The configuration is re-read and refreshed at regular intervals if the file is changed (e.g. using K8s ConfigMap capabilities).
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000093
94The configuration includes:
95
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010096 * Optional *Controller* configuration, e.g. an SDNC instance (with A1-Adapter)
PatrikBuhr1c317eb2023-02-23 12:39:31 +010097
JohnKeeneyc86b5ae2023-07-28 19:25:14 +010098 * (If no 'Contoller' is configured, the A1 Policy Management Service will connect direct to near-RT RICs, bypassing the SDNC controller)
99 * One entry for each near-RT-RIC (*ric*), which includes:
PatrikBuhr1c317eb2023-02-23 12:39:31 +0100100
JohnKeeney069b4692022-05-12 22:15:14 +0100101 * The base URL of the near-RT-RIC
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100102 * A optional list of O1 identifiers that near-RT-RIC is controlling. An application can query this service which near-RT-RIC should be addressed for which component (e.g. cells, sectors, locations, etc.).
JohnKeeney069b4692022-05-12 22:15:14 +0100103 * An optional reference to the controller to use, or excluded if the near-RT-RIC should be accessed directly from the A1 Policy Management Service.
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000104
105For details about the syntax of the file, there is an example in source code repository */config/application_configuration.json*. This file is also included in the docker container */opt/app/policy-agent/data/application_configuration.json_example*.
106
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000107
JohnKeeney069b4692022-05-12 22:15:14 +0100108Configuring certificates
109------------------------
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200110
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100111The A1 Policy Management Service uses the default security keystore and truststore that are included in the built container. The paths and
112passwords for these stores are located in the static configuration file described above (*application.yaml*), with an example is provided in the source code repository *a1-policy-management/config/application.yaml*
elinuxhenrike8f75f42020-09-22 15:49:25 +0200113
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100114A default cert and truststore is also included in the A1 Policy Management Service, but should only be used for *mocking* and *testing* purposes.
JohnKeeney069b4692022-05-12 22:15:14 +0100115(*ApplicationTest.java*).
elinuxhenrike8f75f42020-09-22 15:49:25 +0200116
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100117The default keystore, truststore, and application.yaml files can be overridden by mounting new files using the the docker 'volumes'
118command for 'docker-compose' or 'docker run' command. Assuming that the *keystore*, *truststore*, and *application.yaml* files are located in the same directory as 'docker-compose',
elinuxhenrikea2fcc82020-10-13 16:39:13 +0200119the volumes field should have these entries: ::
120
121 `volumes:`
elinuxhenrike8f75f42020-09-22 15:49:25 +0200122 `- ./new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro`
elinuxhenrike8f75f42020-09-22 15:49:25 +0200123 `- ./new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro`
elinuxhenrike8f75f42020-09-22 15:49:25 +0200124 `- ./new_application.yaml:/opt/app/policy-agent/config/application.yaml:ro`
125
126The target paths in the container should not be modified.
127
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100128Example 'docker run' command for mounting new files (assuming they are located in the current directory): ::
elinuxhenrike8f75f42020-09-22 15:49:25 +0200129
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100130 docker run -p 8081:8081 -p 8433:8433 --name=policy-agent-container --network=nonrtric-docker-net --volume "$PWD/new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks" --volume "$PWD/new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks" --volume "$PWD/new_application.yaml:/opt/app/policy-agent/config/application.yaml" onap/ccsdk-oran-a1policymanagementservice:1.5.0
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200131
elinuxhenrikea2fcc82020-10-13 16:39:13 +0200132A1 Adapter (Internal)
133+++++++++++++++++++++
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200134
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100135The O-RAN A1 Adapter provides an **internal** RESTCONF API that is used only by the A1 Policy Management System when accessing the A1 Interface via SDNC. This API is useful for test and verification but should not used otherwise.
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200136
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000137See :ref:`a1_adapter_api` for details of this internal API.
ychacon65cf80b2021-09-16 09:40:38 +0200138
139Configuration of HTTP Proxy
140---------------------------
141
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100142In order to configure a HTTP Proxy for the A1-Adapter to use for southbound connections:
ychacon65cf80b2021-09-16 09:40:38 +0200143
JohnKeeney069b4692022-05-12 22:15:14 +0100144 * Modify file: *odlsli/src/main/properties/a1-adapter-api-dg.properties*. This file is found in CCSDK/distribution for SDNC.
145 * In a running container this file is found at */opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties*
JohnKeeneyc86b5ae2023-07-28 19:25:14 +0100146 * Variable *a1Mediator.proxy.url* must contain the full Proxy URL
PatrikBuhr1c317eb2023-02-23 12:39:31 +0100147
JohnKeeney069b4692022-05-12 22:15:14 +0100148After this configuration has been changed the A1 adapter needs to be either rebuilt, or restarted if the configuration is changed inside a container, or re-read by the container if externally accessible (e.g. K8s ConfigMap).
ychacon65cf80b2021-09-16 09:40:38 +0200149
150