elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 1 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 2 | .. http://creativecommons.org/licenses/by/4.0 |
JohnKeeney | 70fee18 | 2024-01-22 14:04:31 +0000 | [diff] [blame^] | 3 | .. Copyright 2023 Nordix Foundation. All rights reserved. |
| 4 | .. Copyright 2024 OpenInfra Foundation Europe. All rights reserved. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 5 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 6 | .. _developer_guide: |
| 7 | |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 8 | Developer Guide |
| 9 | =============== |
| 10 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 11 | This document provides a quickstart for developers of the CCSDK functions for O-RAN A1 Policies. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 12 | |
JohnKeeney | 70fee18 | 2024-01-22 14:04:31 +0000 | [diff] [blame^] | 13 | .. image:: ../media/ONAP-A1ControllerArchitecture-Montreal.png |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 14 | :width: 500pt |
| 15 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 16 | Source tree |
| 17 | +++++++++++ |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 18 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 19 | This provides ONAP CCSDK with "A1 Policy Management Service" and "A1 Adapter" functions. |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 20 | Each resource is implemented independently in a sub-directory corresponding to its name. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 21 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 22 | A1 Policy Management Service |
| 23 | ++++++++++++++++++++++++++++ |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 24 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 25 | The ONAP CCSDK A1 Policy Management Service (A1-PMS) is a Java 17 web application built using the Spring Framework. |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 26 | Using Spring Boot dependencies, it runs as a standalone application. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 27 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 28 | A1 Policy Management Service provides a REST API for managing A1 Policies. It provides support for: |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 29 | |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 30 | * Consistency monitoring of the SMO view of policies and the actual situation in the RICs |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 31 | * 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: |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 34 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 35 | * 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. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 40 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 41 | The A1 Policy Management Service can be accessed over the REST API. See :ref:`pms_api` for more information about the API. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 42 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 43 | The 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. |
PatrikBuhr | 24ad739 | 2021-05-19 14:44:43 +0200 | [diff] [blame] | 44 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 45 | Dependencies |
| 46 | ------------ |
elinuxhenrik | ea2fcc8 | 2020-10-13 16:39:13 +0200 | [diff] [blame] | 47 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 48 | This project uses various frameworks which are managed with Maven |
| 49 | dependency management tool (see *pom.xml* file at root level) : |
| 50 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 51 | - Swagger annotations |
| 52 | - `Spring Framework <https://github.com/spring-projects/spring-boot>`_ |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 53 | - `SpringDoc and OpenAPI <https://springdoc.org/>`_ Automated JSON API documentation for APIs built with Spring |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 54 | - `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 |
PatrikBuhr | 9f1d949 | 2023-04-17 13:00:15 +0200 | [diff] [blame] | 56 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 57 | |
PatrikBuhr | 01162ea | 2022-01-12 16:15:34 +0100 | [diff] [blame] | 58 | To get a complete list of all dependencies, use command "mvn dependency:tree". |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 59 | |
| 60 | Configuration |
| 61 | ------------- |
| 62 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 63 | There are two configuration files for A1 Policy Management Service, *config/application_configuration.json* and *config/application.yaml* |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 64 | The first (*config/application_configuration.json*) contains application-specific configuration needed by the application, such as which near-RT RICs, or controller to use. |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 65 | The second (*config/application.yaml*) contains logging and security configurations. |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 66 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 67 | For 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>`_ |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 68 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 69 | Static configuration - Settings that cannot be changed at runtime (*application.yaml*) |
| 70 | -------------------------------------------------------------------------------------- |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 71 | |
| 72 | The file *./config/application.yaml* is read by the application at startup. It provides the following configurable features: |
| 73 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 74 | * *server*; configuration for the WEB server |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 75 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 76 | * used port for HTTP/HTTPS, this is however not the port number visible outside the container |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 77 | * SSL parameters for setting up using of key store and trust store databases. |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 78 | * *webclient*; configuration parameters for a web client used by the component |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 79 | |
| 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 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 83 | * *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. |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 87 | |
| 88 | For details about the parameters in this file, see documentation in the file. |
| 89 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 90 | Dynamic configuration - Settings that can be changed at runtime (*application_configuration.json* or REST or ConfigMap) |
JohnKeeney | c207758 | 2022-10-27 18:11:42 +0100 | [diff] [blame] | 91 | ----------------------------------------------------------------------------------------------------------------------- |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 92 | The 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). |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 93 | |
| 94 | The configuration includes: |
| 95 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 96 | * Optional *Controller* configuration, e.g. an SDNC instance (with A1-Adapter) |
PatrikBuhr | 1c317eb | 2023-02-23 12:39:31 +0100 | [diff] [blame] | 97 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 98 | * (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: |
PatrikBuhr | 1c317eb | 2023-02-23 12:39:31 +0100 | [diff] [blame] | 100 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 101 | * The base URL of the near-RT-RIC |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 102 | * 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.). |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 103 | * 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. |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 104 | |
| 105 | For 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 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 107 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 108 | Configuring certificates |
| 109 | ------------------------ |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 110 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 111 | The A1 Policy Management Service uses the default security keystore and truststore that are included in the built container. The paths and |
| 112 | passwords 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* |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 113 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 114 | A default cert and truststore is also included in the A1 Policy Management Service, but should only be used for *mocking* and *testing* purposes. |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 115 | (*ApplicationTest.java*). |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 116 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 117 | The default keystore, truststore, and application.yaml files can be overridden by mounting new files using the the docker 'volumes' |
| 118 | command 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', |
elinuxhenrik | ea2fcc8 | 2020-10-13 16:39:13 +0200 | [diff] [blame] | 119 | the volumes field should have these entries: :: |
| 120 | |
| 121 | `volumes:` |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 122 | `- ./new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro` |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 123 | `- ./new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro` |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 124 | `- ./new_application.yaml:/opt/app/policy-agent/config/application.yaml:ro` |
| 125 | |
| 126 | The target paths in the container should not be modified. |
| 127 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 128 | Example 'docker run' command for mounting new files (assuming they are located in the current directory): :: |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 129 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 130 | 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 |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 131 | |
elinuxhenrik | ea2fcc8 | 2020-10-13 16:39:13 +0200 | [diff] [blame] | 132 | A1 Adapter (Internal) |
| 133 | +++++++++++++++++++++ |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 134 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 135 | The 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. |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 136 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 137 | See :ref:`a1_adapter_api` for details of this internal API. |
ychacon | 65cf80b | 2021-09-16 09:40:38 +0200 | [diff] [blame] | 138 | |
| 139 | Configuration of HTTP Proxy |
| 140 | --------------------------- |
| 141 | |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 142 | In order to configure a HTTP Proxy for the A1-Adapter to use for southbound connections: |
ychacon | 65cf80b | 2021-09-16 09:40:38 +0200 | [diff] [blame] | 143 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 144 | * 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* |
JohnKeeney | c86b5ae | 2023-07-28 19:25:14 +0100 | [diff] [blame] | 146 | * Variable *a1Mediator.proxy.url* must contain the full Proxy URL |
PatrikBuhr | 1c317eb | 2023-02-23 12:39:31 +0100 | [diff] [blame] | 147 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 148 | After 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). |
ychacon | 65cf80b | 2021-09-16 09:40:38 +0200 | [diff] [blame] | 149 | |
| 150 | |