diff options
-rw-r--r-- | docs/api/api.rst | 37 | ||||
-rw-r--r-- | docs/development/devtools/devtools.rst | 33 | ||||
-rw-r--r-- | docs/pap/pap.rst | 9 | ||||
-rw-r--r-- | integration/pom.xml | 2 | ||||
-rw-r--r-- | pom.xml | 4 |
5 files changed, 67 insertions, 18 deletions
diff --git a/docs/api/api.rst b/docs/api/api.rst index 5aa38853..273b8753 100644 --- a/docs/api/api.rst +++ b/docs/api/api.rst @@ -5,8 +5,11 @@ .. THIS IS USED INTERNALLY IN POLICY ONLY .. _api-label: -Policy Life Cycle API -##################### +1. Policy Life Cycle API +######################## + +1.1 Overview +------------ .. contents:: :depth: 2 @@ -105,6 +108,8 @@ triggers R O N/A Specification of policy triggers, not c The group types of targets in TOSCA are groups of TOSCA nodes, not PDP groups; the *target* concept in TOSCA is equivalent to the Policy Enforcement Point (PEP) concept +1.2 Preloaded policy types and policies +--------------------------------------- To ease policy creation, we preload several widely used policy types in policy database. Below is a table listing the preloaded policy types. @@ -169,10 +174,14 @@ Below is a table containing sample well-formed TOSCA compliant policies. "vFirewallCDS.Operational.Tosca", `vFirewallCDS.policy.operational.input.tosca.yaml <https://github.com/onap/policy-models/blob/master/models-examples/src/main/resources/policies/vFirewallCDS.policy.operational.input.tosca.yaml>`_ +2. APIs exposed +############### + +2.1 Global API Table +-------------------- + Below is a global API table from where swagger JSON for different types of policy design API can be downloaded. -Global API Table ----------------- .. csv-table:: :header: "API name", "Swagger JSON" :widths: 10,5 @@ -183,8 +192,8 @@ Global API Table "Tosca Policy API", ":download:`link <swagger/policy-api.json>`" "Tosca NodeTemplate API", ":download:`link <swagger/nodetemplates-api.json>`" -API Swagger ------------ +2.2 API Swagger +--------------- It is worth noting that we use basic authorization for API access with username and password set to *policyadmin* and *zb!XztG34* respectively. Also, the new APIs support both *http* and *https*. @@ -219,8 +228,8 @@ x-onap-requestid is used to track REST transactions for logging purpose, as desc .. swaggerv2doc:: swagger/policy-api.json -Creating MetadataSet for policy --------------------------------- +2.3 Creating MetadataSet for policy +----------------------------------- The policy type implementation in tosca policy can be independently persisted to the database as metadataSets via the Tosca node template Apis . The policy type implementation data can be excluded from the policy properties section of the tosca policy and the user can specify only the "metadataSetName" and "metadataSetVersion" @@ -289,8 +298,8 @@ Regarding DELETE APIs for TOSCA compliant policies, we only expose API to delete or policy type at a time for safety purpose. If client has the need to delete multiple or a group of policies or policy types, they will need to delete them one by one. -Sample API Curl Commands -------------------------- +2.4 Sample API Curl Commands +---------------------------- From an API client perspective, using *http* or *https* does not make much difference to the curl command. Here we list some sample curl commands (using *http*) for POST, GET and DELETE monitoring and operational policies that are used in vFirewall use case. @@ -324,3 +333,11 @@ Get version 1.0.0 of vFirewall Monitoring Policy:: Delete version 1.0.0 of vFirewall Monitoring Policy:: curl --user 'policyadmin:zb!XztG34' -X DELETE "http://{ip}:{port}/policy/api/v1/policies/onap.vfirewall.tca/versions/1.0.0" -H "Accept: application/json" -H "Content-Type: application/json" + + +3. Policy API application configuration +####################################### + +Starting from Jakarta Release policy-api is a Springboot based microservice. + +The policy-api application configuration is packaged as a K8S ConfigMap object via `Policy-API OOM charts <https://gerrit.onap.org/r/gitweb?p=oom.git;a=blob;f=kubernetes/policy/components/policy-api/resources/config/apiParameters.yaml;h=c08b035d53f299fe0e08b45bd95a760283acce66;hb=refs/heads/master>`_ diff --git a/docs/development/devtools/devtools.rst b/docs/development/devtools/devtools.rst index 787af683..5b75d328 100644 --- a/docs/development/devtools/devtools.rst +++ b/docs/development/devtools/devtools.rst @@ -253,9 +253,10 @@ running MariaDb database instance. The easiest way to do this is to run the dock information on doing so. Once the mariadb is up and running, a configuration file must be provided to the api in order for it to know how to connect to the mariadb. You can locate the default configuration file in the packaging of the api component: -`Default API Configuration <https://gerrit.onap.org/r/gitweb?p=policy/api.git;a=blob;f=packages/policy-api-tarball/src/main/resources/etc/defaultConfig.json;h=042fb9d54c79ce4dad517e2564636632a8ecc550;hb=refs/heads/master>`_ +`Default Policy API Configuration <https://gerrit.onap.org/r/gitweb?p=policy/api.git;a=blob;f=packages/policy-api-tarball/src/main/resources/etc/apiParameters.yaml;h=2c19199a8a889cb0ab203334182662fe15e1635e;hb=refs/heads/master>`_ -You will want to change the fields pertaining to "host", "port" and "databaseUrl" to your local environment settings. +You will want to change the fields pertaining to "host", "port" and "databaseUrl" to your local environment settings and start the +policy-api springboot application either using your IDE of choice or using the run goal from Spring Boot Maven plugin: *mvn spring-boot:run*. Running the API component using Docker Compose ++++++++++++++++++++++++++++++++++++++++++++++ @@ -264,6 +265,20 @@ An example of running the api using a docker compose script is located in the Po `Policy CSIT API Docker Compose <https://gerrit.onap.org/r/gitweb?p=integration/csit.git;a=blob;f=scripts/policy/docker-compose-api.yml;h=e32190f1e6cb6d9b64ddf53a2db2c746723a0c6a;hb=refs/heads/master>`_ +Running the PAP component standalone ++++++++++++++++++++++++++++++++++++++ + +Once you have successfully built the PAP codebase, a running MariaDb database and DMaaP instance will also be required to start up the application. +For MariaDb instance, the easiest way is to run the docker image, please see the mariadb documentation for the latest +information on doing so. For DMaaP, the easiest way during development is to run the DMaaP simulator which is explained in the below sections. +Once the mariadb and DMaaP are running, a configuration file must be provided to the PAP component in order for it to know how to +connect to the mariadb and DMaaP along with other relevant configuration details. You can locate the default configuration file in the packaging of the PAP component: + +`Default PAP Configuration <https://gerrit.onap.org/r/gitweb?p=policy/pap.git;a=blob;f=packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml;h=06dd45f4946fd0a11ed8ef859f8fc5bcf409a3f0;hb=HEAD>`_ + +Update the fields related to MariaDB, DMaaP and the RestServer for the application as per your local environment settings. +Then to start the application, just run the Spring Boot application using IDE or command line. + Running the Smoke Tests *********************** @@ -347,6 +362,10 @@ the Policy Framework works in a full ONAP deployment. Generating Swagger Documentation ******************************** + +1. Using Swagger2Markup maven plugin from Policy Parent Integration POM ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + The `Policy Parent Integration POM <https://github.com/onap/policy-parent/blob/master/integration/pom.xml>`_ contains a *generateSwaggerDocs* profile. This profile can be activated on any module that has a Swagger endpoint. When active, this profile creates a tarball in Nexus with the name *<project-artifactId>-swagger-docs.tar.gz*. The tarball contains the following files: @@ -394,6 +413,16 @@ of such a test case. See `this unit test case <https://github.com/onap/policy-clamp/blob/master/runtime/src/test/java/org/onap/policy/clamp/clds/it/HttpsItCase.java>`_ for the full example. +2. Accessing Swagger documentation for springboot based policy applications ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +Springfox Swagger2 maven dependency aids with auto-generation of Swagger documentation. + +Using the Swagger-UI maven dependency Swagger HTML documentation can be accessed at the root url. + +- The generated swagger.json can be accessed at: *https://service_IP:service_port/v2/api-docs* +- Swagger UI can be accessed at: *https://service_IP:service_port/swagger-ui/index.html* + Running the DMaaP Simulator during Development ********************************************** It is sometimes convenient to run the DMaaP simulator during development. You can run it from the command line using Maven or from within your IDE. diff --git a/docs/pap/pap.rst b/docs/pap/pap.rst index 074947bd..1af62617 100644 --- a/docs/pap/pap.rst +++ b/docs/pap/pap.rst @@ -387,14 +387,17 @@ Here is a sample response: 3 Configuration ================= +The *PolicyAdministration* component (PAP) is initialized using a configuration file: `papParameters.yaml +<https://github.com/onap/policy-pap/blob/master/packages/policy-pap-tarball/src/main/resources/etc/papParameters.yaml>`_ + +The configuration file is a YAML file containing the relevant fields for configuring the REST server, Database and DMaaP connectivity and so on. + 3.1 Disable collection of PDP Statistics ======================================== This configuration is to inform PAP to not save the PDP statistics in the database. -In `config.json -<https://github.com/onap/policy-pap/blob/master/packages/policy-pap-tarball/src/main/resources/etc/defaultConfig.json>`_, -add or change the property savePdpStatisticsInDb to false. +In *papParameters.yaml*, add or change the property savePdpStatisticsInDb to false. .. note:: By default, if the property is not present, it will be considered as false and diff --git a/integration/pom.xml b/integration/pom.xml index cd3df998..a427bf87 100644 --- a/integration/pom.xml +++ b/integration/pom.xml @@ -57,7 +57,7 @@ <version.eelf.core>1.0.0</version.eelf.core> <version.camel>3.7.3</version.camel> <version.tomcat>9.0.62</version.tomcat> - <version.mockserver>5.11.2</version.mockserver> + <version.mockserver>5.13.2</version.mockserver> <version.immutable>2.8.8</version.immutable> <version.springfox>3.0.0</version.springfox> <version.jakarta-api>2.0.2</version.jakarta-api> @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>3.3.1-SNAPSHOT</version> + <version>3.3.1</version> <relativePath /> </parent> <groupId>org.onap.policy.parent</groupId> @@ -33,7 +33,7 @@ <packaging>pom</packaging> <properties> - <oparent.version>3.3.1-SNAPSHOT</oparent.version> + <oparent.version>3.3.1</oparent.version> </properties> <modules> |