blob: a7c5a83593c6dcc4f706b702d227d5d8c6945b4d [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
JohnKeeney069b4692022-05-12 22:15:14 +01003.. Copyright (C) 2022 Nordix Foundation.
elinuxhenrike8f75f42020-09-22 15:49:25 +02004
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +02005.. _developer_guide:
6
elinuxhenrike8f75f42020-09-22 15:49:25 +02007Developer Guide
8===============
9
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000010This document provides a quickstart for developers of the CCSDK functions for O-RAN A1 Policies.
elinuxhenrike8f75f42020-09-22 15:49:25 +020011
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020012Source tree
13+++++++++++
elinuxhenrike8f75f42020-09-22 15:49:25 +020014
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000015This provides CCSDK with "A1 Policy Management Service" and "A1 Adapter" functions.
JohnKeeney069b4692022-05-12 22:15:14 +010016Each resource is implemented independently in a sub-directory corresponding to its name.
elinuxhenrike8f75f42020-09-22 15:49:25 +020017
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020018A1 Policy Management Service
19++++++++++++++++++++++++++++
elinuxhenrike8f75f42020-09-22 15:49:25 +020020
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000021The ONAP CCSDK A1 Policy Management Service is a Java 11 web application built using the Spring Framework.
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020022Using Spring Boot dependencies, it runs as a standalone application.
elinuxhenrike8f75f42020-09-22 15:49:25 +020023
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000024A1 Policy Management Service provides a REST API for management of policies. It provides support for:
elinuxhenrike8f75f42020-09-22 15:49:25 +020025
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
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000035The 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.
PatrikBuhrba488752022-08-31 14:27:57 +020036Note that DMaaP is deprecated and the possibility to access this service using DMaaP is deprecated and will be removed.
elinuxhenrike8f75f42020-09-22 15:49:25 +020037
JohnKeeney069b4692022-05-12 22:15:14 +010038The configured A1 policies are stored persistently to survive a service restart.
PatrikBuhr24ad7392021-05-19 14:44:43 +020039
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020040Dependencies
41------------
elinuxhenrikea2fcc82020-10-13 16:39:13 +020042
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020043This project uses various frameworks which are managed with Maven
44dependency management tool (see *pom.xml* file at root level) :
45
JohnKeeney069b4692022-05-12 22:15:14 +010046- 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
PatrikBuhr01162ea2022-01-12 16:15:34 +010055To get a complete list of all dependencies, use command "mvn dependency:tree".
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020056
57Configuration
58-------------
59
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000060There are two configuration files for A1 Policy Management Service, *config/application_configuration.json* and *config/application.yaml*
PatrikBuhrba488752022-08-31 14:27:57 +020061The first (*config/application_configuration.json*) contains configuration needed by the application, such as which near-RT-RICs, controller, or DMaaP topic to use (deprecated).
JohnKeeney069b4692022-05-12 22:15:14 +010062The second (*config/application.yaml*) contains logging and security configurations.
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +020063
JohnKeeney069b4692022-05-12 22:15:14 +010064For 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+Jakarta>`_
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000065
JohnKeeney069b4692022-05-12 22:15:14 +010066Static configuration - Settings that cannot be changed at runtime (*application.yaml*)
67--------------------------------------------------------------------------------------
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000068
69The 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
JohnKeeney069b4692022-05-12 22:15:14 +010080 * logging; setting for which information is logged.
81 * auth-token; optional authorization token to use for REST call.
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000082 * filepath; the local path to a file used for dynamic configuration (if used). See next chapter.
83
84For details about the parameters in this file, see documentation in the file.
85
JohnKeeney069b4692022-05-12 22:15:14 +010086Dynamic configuration - Settings that can be changed at runtime (*application_configuration.json* or REST or ConfigMap)
87-------------------------------------------------------------------------------------------------------------------------------
88The component has configuration that can be updated in runtime. This configuration can either be loaded from a file (accessible from the container), or from a CBS/Consul database (Cloudify), or using the Configuration REST API. The configuration is re-read and refreshed at regular intervals.
JohnKeeneyde4ac0d2021-03-09 18:32:45 +000089
90The configuration includes:
91
JohnKeeney069b4692022-05-12 22:15:14 +010092 * Optional Controller configuration, e.g. an SDNC instance (with A1-Adapter)
93 * One entry for each near-RT-RIC, which includes:
94
95 * The base URL of the near-RT-RIC
96 * 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.) .
97 * 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.
PatrikBuhrba488752022-08-31 14:27:57 +020098
99 * Optional configuration for using of DMaaP (deprecated). There can be one stream for requests to the component and an other stream for responses.
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000100
101For 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*.
102
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000103
JohnKeeney069b4692022-05-12 22:15:14 +0100104Configuring certificates
105------------------------
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200106
JohnKeeney069b4692022-05-12 22:15:14 +0100107The A1 Policy Management Service uses the default keystore and truststore that are built into the container. The paths and
108passwords 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*
elinuxhenrike8f75f42020-09-22 15:49:25 +0200109
elinuxhenrikea2fcc82020-10-13 16:39:13 +0200110There is also Policy Management Service's own cert in the default truststore for mocking purposes and unit-testing
JohnKeeney069b4692022-05-12 22:15:14 +0100111(*ApplicationTest.java*).
elinuxhenrike8f75f42020-09-22 15:49:25 +0200112
JohnKeeney069b4692022-05-12 22:15:14 +0100113The default keystore, truststore, and application.yaml files can be overridden by mounting new files using the the docker "volumes"
114command 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 +0200115the volumes field should have these entries: ::
116
117 `volumes:`
elinuxhenrike8f75f42020-09-22 15:49:25 +0200118 `- ./new_keystore.jks:/opt/app/policy-agent/etc/cert/keystore.jks:ro`
elinuxhenrike8f75f42020-09-22 15:49:25 +0200119 `- ./new_truststore.jks:/opt/app/policy-agent/etc/cert/truststore.jks:ro`
elinuxhenrike8f75f42020-09-22 15:49:25 +0200120 `- ./new_application.yaml:/opt/app/policy-agent/config/application.yaml:ro`
121
122The target paths in the container should not be modified.
123
elinuxhenrikea2fcc82020-10-13 16:39:13 +0200124Example docker run command for mounting new files (assuming they are located in the current directory): ::
elinuxhenrike8f75f42020-09-22 15:49:25 +0200125
JohnKeeney069b4692022-05-12 22:15:14 +0100126 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.0-SNAPSHOT
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200127
elinuxhenrikea2fcc82020-10-13 16:39:13 +0200128A1 Adapter (Internal)
129+++++++++++++++++++++
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200130
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000131The 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.
elinuxhenrik9bb9a4c2020-10-08 14:36:37 +0200132
JohnKeeneyde4ac0d2021-03-09 18:32:45 +0000133See :ref:`a1_adapter_api` for details of this internal API.
ychacon65cf80b2021-09-16 09:40:38 +0200134
135Configuration of HTTP Proxy
136---------------------------
137
138In order to configure a HTTP Proxy for southbound connections:
ychacon65cf80b2021-09-16 09:40:38 +0200139
JohnKeeney069b4692022-05-12 22:15:14 +0100140 * Modify file: *odlsli/src/main/properties/a1-adapter-api-dg.properties*. This file is found in CCSDK/distribution for SDNC.
141 * In a running container this file is found at */opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties*
142 * Variable a1Mediator.proxy.url must contain the full Proxy URL
143
144After 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 +0200145
146