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 | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 3 | .. Copyright (C) 2022 Nordix Foundation. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 4 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 5 | .. _developer_guide: |
| 6 | |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 7 | Developer Guide |
| 8 | =============== |
| 9 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 10 | 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] | 11 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 12 | Source tree |
| 13 | +++++++++++ |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 14 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 15 | This provides CCSDK with "A1 Policy Management Service" and "A1 Adapter" functions. |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 16 | Each resource is implemented independently in a sub-directory corresponding to its name. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 17 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 18 | A1 Policy Management Service |
| 19 | ++++++++++++++++++++++++++++ |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 20 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 21 | The ONAP CCSDK A1 Policy Management Service is a Java 11 web application built using the Spring Framework. |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 22 | Using Spring Boot dependencies, it runs as a standalone application. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 23 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 24 | A1 Policy Management Service provides a REST API for management of policies. It provides support for: |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 25 | |
| 26 | * Supervision of clients (R-APPs) to eliminate stray policies in case of failure |
| 27 | * Consistency monitoring of the SMO view of policies and the actual situation in the RICs |
| 28 | * Consistency monitoring of RIC capabilities (policy types) |
| 29 | * Policy configuration. This includes: |
| 30 | |
| 31 | * One REST API towards all RICs in the network |
| 32 | * Query functions that can find all policies in a RIC, all policies owned by a service (R-APP), all policies of a type etc. |
| 33 | * Maps O1 resources (ManagedElement) as defined in O1 to the controlling RIC. |
| 34 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 35 | The Policy Management Service can be accessed over the REST API, and with an equivalent interface using DMaaP. See :ref:`pms_api` for more information about the API. |
PatrikBuhr | ba48875 | 2022-08-31 14:27:57 +0200 | [diff] [blame] | 36 | Note that DMaaP is deprecated and the possibility to access this service using DMaaP is deprecated and will be removed. |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 37 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 38 | The configured A1 policies are stored persistently to survive a service restart. |
PatrikBuhr | 24ad739 | 2021-05-19 14:44:43 +0200 | [diff] [blame] | 39 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 40 | Dependencies |
| 41 | ------------ |
elinuxhenrik | ea2fcc8 | 2020-10-13 16:39:13 +0200 | [diff] [blame] | 42 | |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 43 | This project uses various frameworks which are managed with Maven |
| 44 | dependency management tool (see *pom.xml* file at root level) : |
| 45 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 46 | - Swagger annotations |
| 47 | - `Spring Framework <https://github.com/spring-projects/spring-boot>`_ |
| 48 | - `Springfox <https://github.com/springfox/springfox>`_ Automated JSON API documentation for APIs built with Spring |
| 49 | - `Immutable <https://immutables.github.io/>`_ to generate simple, safe and consistent value objects |
| 50 | - `JSON in Java <https://github.com/stleary/JSON-java>`_ to parse JSON documents into Java objects |
| 51 | - `Apache Commons Net <https://github.com/apache/commons-net>`_ for network utilities and protocol implementations |
| 52 | - `Lombok <https://github.com/rzwitserloot/lombok>`_ to generate code, such as getters and setters |
| 53 | - `Awaitility <https://github.com/awaitility/awaitility>`_ to test asynchronous functionality |
| 54 | |
PatrikBuhr | 01162ea | 2022-01-12 16:15:34 +0100 | [diff] [blame] | 55 | To get a complete list of all dependencies, use command "mvn dependency:tree". |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 56 | |
| 57 | Configuration |
| 58 | ------------- |
| 59 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 60 | There are two configuration files for A1 Policy Management Service, *config/application_configuration.json* and *config/application.yaml* |
JohnKeeney | c207758 | 2022-10-27 18:11:42 +0100 | [diff] [blame] | 61 | The first (*config/application_configuration.json*) contains configuration needed by the application, such as which near-RT-RICs, or controller to use. DMaaP topic can also be configured, but is deprecated. |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 62 | The second (*config/application.yaml*) contains logging and security configurations. |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 63 | |
JohnKeeney | c207758 | 2022-10-27 18:11:42 +0100 | [diff] [blame] | 64 | 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+Kohn>`_ |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 65 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 66 | Static configuration - Settings that cannot be changed at runtime (*application.yaml*) |
| 67 | -------------------------------------------------------------------------------------- |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 68 | |
| 69 | The file *./config/application.yaml* is read by the application at startup. It provides the following configurable features: |
| 70 | |
| 71 | * server; configuration for the WEB server |
| 72 | |
| 73 | * used port for HTTP/HTTPS, this is however not the port numbers visible outside the container |
| 74 | * SSL parameters for setting up using of key store and trust store databases. |
| 75 | * webclient; configuration parameters for a web client used by the component |
| 76 | |
| 77 | * SSL parameters for setting up using of key store and trust store databases. |
| 78 | * Usage of HTTP(S) Proxy; if configured, the proxy will be used for southbound access to the NearRT-RICs |
| 79 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 80 | * logging; setting for which information is logged. |
| 81 | * auth-token; optional authorization token to use for REST call. |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 82 | * filepath; the local path to a file used for dynamic configuration (if used). See next chapter. |
| 83 | |
| 84 | For details about the parameters in this file, see documentation in the file. |
| 85 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 86 | 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] | 87 | ----------------------------------------------------------------------------------------------------------------------- |
| 88 | 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. |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 89 | |
| 90 | The configuration includes: |
| 91 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 92 | * Optional Controller configuration, e.g. an SDNC instance (with A1-Adapter) |
JohnKeeney | c207758 | 2022-10-27 18:11:42 +0100 | [diff] [blame] | 93 | |
| 94 | * (If no 'Contoller' is configured, the A1 Policy Management Service will connect direct to near-RT-RICs, bypassing the SDNC controller) |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 95 | * One entry for each near-RT-RIC, which includes: |
| 96 | |
| 97 | * The base URL of the near-RT-RIC |
| 98 | * 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.) . |
| 99 | * 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. |
PatrikBuhr | ba48875 | 2022-08-31 14:27:57 +0200 | [diff] [blame] | 100 | |
| 101 | * Optional configuration for using of DMaaP (deprecated). There can be one stream for requests to the component and an other stream for responses. |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 102 | |
| 103 | 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*. |
| 104 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 105 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 106 | Configuring certificates |
| 107 | ------------------------ |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 108 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 109 | The A1 Policy Management Service uses the default keystore and truststore that are built into the container. The paths and |
| 110 | passwords for these stores are located in a yaml file, 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] | 111 | |
JohnKeeney | c207758 | 2022-10-27 18:11:42 +0100 | [diff] [blame] | 112 | There is also the A1 Policy Management Service's own cert in the default truststore for mocking purposes and unit-testing |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 113 | (*ApplicationTest.java*). |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 114 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 115 | The default keystore, truststore, and application.yaml files can be overridden by mounting new files using the the docker "volumes" |
| 116 | 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] | 117 | the volumes field should have these entries: :: |
| 118 | |
| 119 | `volumes:` |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 120 | `- ./new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro` |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 121 | `- ./new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro` |
elinuxhenrik | e8f75f4 | 2020-09-22 15:49:25 +0200 | [diff] [blame] | 122 | `- ./new_application.yaml:/opt/app/policy-agent/config/application.yaml:ro` |
| 123 | |
| 124 | The target paths in the container should not be modified. |
| 125 | |
elinuxhenrik | ea2fcc8 | 2020-10-13 16:39:13 +0200 | [diff] [blame] | 126 | 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] | 127 | |
JohnKeeney | c207758 | 2022-10-27 18:11:42 +0100 | [diff] [blame] | 128 | 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.4.2-SNAPSHOT |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 129 | |
elinuxhenrik | ea2fcc8 | 2020-10-13 16:39:13 +0200 | [diff] [blame] | 130 | A1 Adapter (Internal) |
| 131 | +++++++++++++++++++++ |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 132 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 133 | The O-RAN A1 Adapter provides an **internal** RESTCONF API that is used by the A1 Policy Management System when accessing the A1 Interface. This API is useful for test and verification but should not used otherwise. |
elinuxhenrik | 9bb9a4c | 2020-10-08 14:36:37 +0200 | [diff] [blame] | 134 | |
JohnKeeney | de4ac0d | 2021-03-09 18:32:45 +0000 | [diff] [blame] | 135 | See :ref:`a1_adapter_api` for details of this internal API. |
ychacon | 65cf80b | 2021-09-16 09:40:38 +0200 | [diff] [blame] | 136 | |
| 137 | Configuration of HTTP Proxy |
| 138 | --------------------------- |
| 139 | |
| 140 | In order to configure a HTTP Proxy for southbound connections: |
ychacon | 65cf80b | 2021-09-16 09:40:38 +0200 | [diff] [blame] | 141 | |
JohnKeeney | 069b469 | 2022-05-12 22:15:14 +0100 | [diff] [blame] | 142 | * Modify file: *odlsli/src/main/properties/a1-adapter-api-dg.properties*. This file is found in CCSDK/distribution for SDNC. |
| 143 | * In a running container this file is found at */opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties* |
| 144 | * Variable a1Mediator.proxy.url must contain the full Proxy URL |
| 145 | |
| 146 | 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] | 147 | |
| 148 | |