Support of DB-enabled features

Isolation and data migration support overall and on a per
feature basis.

policy@drools:/opt/app/policy$ policy.sh status

[drools-pdp-controllers]
 L []: Policy Management (no pidfile) is NOT running
	1 cron jobs installed.

[features]
name                 version         status
----                 -------         ------
eelf                 1.1.0           disabled
healthcheck          1.1.0           disabled
session-persistence  1.1.0           enabled

[migration]
session-persistence: upgrade out-of-sync: 0 -> 201702

policy@drools:/opt/app/policy$ features enable session-persistence
session-persistence: upgrade out-of-sync: 0 -> 201702

name                 version         status
----                 -------         ------
eelf                 1.1.0           disabled
healthcheck          1.1.0           disabled
session-persistence  1.1.0           enabled

policy@drools:/opt/app/policy$ db-migrator -s session-persistence -o upgrade
upgrade: 0 -> 201702

> upgrade 201701-blah.upgrade.sql
--------------
create table blah (a varchar(15), b varchar(20))
--------------

> upgrade 201702-blah2.upgrade.sql
--------------
create table blah2 (a varchar(15), b varchar(20))
--------------

session-persistence: OK: upgrade (201702)

policy@drools:/opt/app/policy$ db-migrator -s ALL -o report
+---------------------+---------+
| name                | version |
+---------------------+---------+
| session-persistence | 201702  |
+---------------------+---------+
+--------------------------+-----------+---------+---------------------+
| script                   | operation | success | atTime              |
+--------------------------+-----------+---------+---------------------+
| 201701-blah.upgrade.sql  | upgrade   | 1       | 2017-08-14 16:01:32 |
| 201702-blah2.upgrade.sql | upgrade   | 1       | 2017-08-14 16:01:32 |
+--------------------------+-----------+---------+---------------------+

policy@drools:/opt/app/policy$ features disable session-persistence

name                 version         status
----                 -------         ------
eelf                 1.1.0           disabled
healthcheck          1.1.0           disabled
session-persistence  1.1.0           disabled

policy@drools:/opt/app/policy$ db-migrator -s ALL -o downgrade
downgrade: 201702 -> 0

> downgrade 201702-blah2.downgrade.sql
--------------
drop table if exists blah2
--------------

> downgrade 201701-blah.downgrade.sql
--------------
drop table if exists blah
--------------

session-persistence: OK: downgrade (0)

policy@drools:/opt/app/policy$ db-migrator -s ALL -o report
+---------------------+---------+
| name                | version |
+---------------------+---------+
| session-persistence | 0       |
+---------------------+---------+
+----------------------------+-----------+---------+---------------------+
| script                     | operation | success | atTime              |
+----------------------------+-----------+---------+---------------------+
| 201701-blah.upgrade.sql    | upgrade   | 1       | 2017-08-14 16:01:32 |
| 201702-blah2.upgrade.sql   | upgrade   | 1       | 2017-08-14 16:01:32 |
| 201701-blah.downgrade.sql  | downgrade | 1       | 2017-08-14 16:13:49 |
| 201702-blah2.downgrade.sql | downgrade | 1       | 2017-08-14 16:13:49 |
+----------------------------+-----------+---------+---------------------+
session-persistence: OK @ 0

Change-Id: Ie185f5d7a8463cb349ac452d8c2b4b05928b3e56
Issue-ID: POLICY-96
Signed-off-by: Jorge Hernandez <jh1730@att.com>
3 files changed
tree: 32b8422350a6060b9f26bc12d79b7fc3e0684653
  1. feature-eelf/
  2. feature-healthcheck/
  3. packages/
  4. policy-core/
  5. policy-endpoints/
  6. policy-management/
  7. policy-utils/
  8. .gitignore
  9. .gitreview
  10. LICENSE.txt
  11. pom.xml
  12. README.md
  13. version.properties
README.md

This source repository contains the ONAP Policy DroolsPDP code. To build it:

  1. using Maven 3
  2. git clone http://gerrit.onap.org/r/oparent and copy oparent/settings.xml to ~/.m2
  3. mvn clean install